3 ms·
I'd like to see that z80 library. The 8088 has more registers than the z80, but BASICA FP (at 4.77 MHz) is only very slightly faster than AppleSoft FP (at 1 MH
by brucehoult 2y ago
I'd like to see that z80 library.
The 8088 has more registers than the z80, but BASICA FP (at 4.77 MHz) is only very slightly faster than AppleSoft FP (at 1 MHz).
My experience is that 16 bit operations on the z80 save a lot of code size but very little time compared to doing multiple 8 bit operations. Adding a register pair to HL takes 11 cycles (15 to add to IX/IY), vs 4 cycles to add an 8 bit register to A. ADC to HL takes 15 cycles. Each byte copied from one register to another takes 4 cycles (7 for IX/IY H/L).
So if you want to ADC BC,DE you're looking at 64 = 24 cycles for adding in A vs 27 cycles copying BC to HL, adding DE, and copying back. The code size is 6 bytes vs 5 bytes.
On 6502 the same thing, using Zero Page, is 20 cycles and 13 bytes of code. So 6502 wins on cycles, but 6502 machines were 1-2 MHz and z80 3-4 MHz, so z80 wins on high clock speed.
BUT ... how the heck do you keep two 32 bit floats, plus* some just as large temporary variables, in the 11 bytes of registers on a z80? You can get a bit more using EX and EXX but it's going to be incredibly fiddly -- and you remove any possibility of fast interrupt handling on the same machine.
As soon as the z80 needs to use RAM it loses. Loading or storing a register pair to/from a fixed RAM location is 20 cycles. Indirecting via (IX/IY+n) is 19 cycles per byte. Indirecting via (HL) then INC/DEC HL is 13 cycles per byte.
Really, I'd like to see that 8080/z80 FP library.