• Please review our updated Terms and Rules here

Z80 to 8080 code convetor?

Probably, but I haven't seen one. I suspect the result would look pretty terrible--and there are hardware aspects of the Z80 that would be impossible to implement with the 8080 (e.g. the R register, the contents of the upper byte of the address bus during certain I/O instructions, etc.).

Any particular reason for asking?
 
I have never come across one either. That doesn't mean there isn't one tucked in a corner of the internet of course...

If any of the 'Z80 specific' instruction set was used (e.g. the IX or IY registers or the Exchange instructions) then you are in trouble.

The only 'easy' way that such a translator would work is if someone had written the code in Zilog mnemonics - but restricting themselves to 8080 object code compatibility.

This is why upward compatibility is relatively easy and downward compatibility isn't...

Dave
 
Well..I guess I will try diassembling and see what I find that is special. Then hand code it. I did that with another program, although I am not terribly proficient with either of the instruction sets. I provides a good way to learn.
 
Yep,

Use an 8080 disassembler - and see if it throws a fit with some of the binary instruction patterns - then look-up those in the Z80 manual and see if you can code around them.

Dave
 
Yeah, I'd give it a shot in 8080 disassembly. It could be that the thing might be a "you can't get there from here" issue, such as the use of INIR/OTIR instructions to handle a high data rate from the drive. Those should stick right out. You might even search the binary for those instruction opcodes. (ED 2B/ ED 3B, IIRC--it's been a long time)
 
Recreating the tools that work with a ccs2422 floppy controller to work on my 8080 imsai. From what I read they were written for a z80.

Do you have a link to the where the tools in question can be found in case someone is interested in taking a look?
 
There is a good chance that a floppy controller will not work with a 8080 processor, not because one can't make code that will do the same thing at the Z80 but because the 8080 will not be fast enough to keep up with the data rate. Most non-DMA floppy controllers need the processor to keep up with a faster data rate than the 8080 can keep up with, especially if one tries to emulate the Z80 code with a 8080 processor. I remember looking at the problem and writing some code that I never had time to test that would keep up with the data rate of the floppy but had to transfer 4 bytes in the loop instead of just a single loop. In other words, the loop counter was divided by 4. This isn't an issue since the sectors are powers of 2 in size.
As I recall, there wasn't enough time between bytes to both increment or decrement the loop counter between bytes but one could do one thing at a time between bytes reads from the controllers. If the loop counter was L then you get both a loop counter and a memory pointer in one. I believe if you play with that sequence and use careful buffer alignment for the data, it can be done. You need to understand the controllers timing because you don't have time to do much more than read the data with only occasional syncing with the controllers status. As I recall, the code would get a little ahead for part of the cycle and a little behind for the rest.
Dwight
 
Herb Johnson had a discussion about reading MFM 8" floppies using programmed I/O a few years ago. Most opined that it wasn't possible using an 8080. I demurred--the issue was doing an input, store and increment in sufficiently short time. I opined that it might be possible to do this for the entire sector:

Code:
      in   <port>
      mov   b,a
      in    <port>
      mov  c,a
      push  b
      ...repeat...

Of course, the code needs to "unravel" the on-stack data, but it was a thought. I never tried it out. N.B. this would only work on a Tarbell-style controller where the controller inserts wait states until a byte of data is actually ready.
 
If the driver makes use of the "fancier" Z80 interrupt modes- this will be hard. Also remember that the Z80 has the second set of general purpose registers that were often used for interrupts. You can do a lot with the Z80 more efficiently than the 8080.
 
At least one converter does exist -- part of a matched pair of 8080 -> Z80 and Z80 -> 8080 converters for CP/M. Search for XIZI-3.LBR on (eg) the Walnut Creek CP/M CDROM.
 
The program "XIZI" that John cited doesn't do what you think it might--it merely translates Z80 assembly to equivalent 8080 using 8080 names and syntax. It does not translate Z80-specific instructions, nor instructions that use Z80-specific registers, but it will flag them.
 
The program "XIZI" that John cited doesn't do what you think it might--it merely translates Z80 assembly to equivalent 8080 using 8080 names and syntax. It does not translate Z80-specific instructions, nor instructions that use Z80-specific registers, but it will flag them.

That could still be somewhat helpful.
 
Back
Top