Can Z88DK target for the 8080 processor?
Can Z88DK target for the 8080 processor?
Can Z88DK target for the 8080 processor?
Not without a little work.alank2 wrote:Can Z88DK target for the 8080 processor?
sccz80 (one of the c compilers) does produce 8080-compatible code but the libraries are written in z80 assembler. A lot of the library is compatible with the 8080 but the rest would have to have alternate 8080-compatible implementations written or else part of the library would have to be excluded.
Of the two c libraries in z88dk (classic and newlib), I think the classic would be easier to adapt to the 8080 especially regarding stdio. newlib's stdio uses ix as class *. In both, 32-bit math and floating point use z80 specific registers.
sccz80 is the original compiler. The newer one is zsdcc which is a modified sdcc. sdcc uses the index registers extensively, including using ix as frame pointer.alank2 wrote:Is the sccz80 the older or newer compiler? Thanks for the info!
sccz80 is still a capable compiler but not quite as standards compliant as zsdcc and not as optimal in code generation.
sdcc does support the gbz80 (game boy z80) which also does not have index registers but it does have the block instructions and a few new instructions like "ld a,(hl++)" (auto-increment on hl). An 8080 target is not out of the question for sdcc but someone would have to write it which represents some time investment.
I in the past I thought to get the (slightly simpler) 8085 compatibility but no luck. IIRC all the compilation sequence (compiler, optimizers, library.. even the relocating linker, when used) include z80 specific instructions. Such tools changed a lot recently, but as Alvin said it wouldn't come at zero cost.
Ciao Alank,
I worked on a couple of converters. We can get a reasonably good port of the 8080 mnemonics to z80 as well as z80 to i486.
Converting every z80 instruction to 80386 or less was not possible, because of the lack of the "swap" instruction, permitting to switch between the 32bit register halves and thus simulate the "exx" instructions. The instructions related to extra registers can be replaced by lenghty macros dealing with a RAM buffer and an the same can be done with LDIR and similar instructions, but this is not yet enough.. this table gives a good overview of the 8080 limits, they are 456 missing instructions, including the undocumented ones:
http://nemesis.lonestar.org/computers/t ... codes.html
Z88dk code is heavily optimized for the z80. The z80 features several extra instructions and registers which are not present on the 8080. In example, to restrict the compiler and the libraries to a single index register required a relevant effort (e.g. the zx81 video driver in ROM had to be replaced with a custom one) and still we need an index register (better both)
In short, it could be easier to port the z88dk to the 80486
I worked on a couple of converters. We can get a reasonably good port of the 8080 mnemonics to z80 as well as z80 to i486.
Converting every z80 instruction to 80386 or less was not possible, because of the lack of the "swap" instruction, permitting to switch between the 32bit register halves and thus simulate the "exx" instructions. The instructions related to extra registers can be replaced by lenghty macros dealing with a RAM buffer and an the same can be done with LDIR and similar instructions, but this is not yet enough.. this table gives a good overview of the 8080 limits, they are 456 missing instructions, including the undocumented ones:
http://nemesis.lonestar.org/computers/t ... codes.html
Z88dk code is heavily optimized for the z80. The z80 features several extra instructions and registers which are not present on the 8080. In example, to restrict the compiler and the libraries to a single index register required a relevant effort (e.g. the zx81 video driver in ROM had to be replaced with a custom one) and still we need an index register (better both)
In short, it could be easier to port the z88dk to the 80486
It took a little work, but z88dk can now generate code for the 8080 CP/M machines.
There?s a few bits of the library missing - mostly fairly rarely used - some will be re-added as required. More details on the wiki: https://github.com/z88dk/z88dk/wiki/Classic-8080
There?s a few bits of the library missing - mostly fairly rarely used - some will be re-added as required. More details on the wiki: https://github.com/z88dk/z88dk/wiki/Classic-8080