Re:Z80 arithmetic: also surprisingly terrible (2018)
by _Codemonkeyism on Monday January 14, 2019 @04:24AM
(#18901786)
Same experience here. Came from a C64 (6202) to a CPC (Z80) in the 80s and the Z80 felt much more powerful and expressive with its instruction set and registers - also the instruction set of the Z80 felt more logical and planned.
Re:Z80 arithmetic: also surprisingly terrible (2018)
by beagle3 on Monday January 14, 2019 @05:20AM
(#18901991)
Indeed it felt that way, but in practice the 6502’s indirect addressing gives you 128 16-bit registers compared to the z80’s 5+3 (hl,de,bc,ix,iy,hl’,de’,bc’) which is a winner for code generation and macro programming.
Re:Z80 arithmetic: also surprisingly terrible (2018)
by _Codemonkeyism on Tuesday January 15, 2019 @03:41AM
(#18909684)
No longer an expert in Z80 - and perhaps I never was as much of my assembler career was Amiga 68k - but didn't the Z80 also have indirect adressing?
Re:Z80 arithmetic: also surprisingly terrible (2018)
by beagle3 on Tuesday January 15, 2019 @11:58AM
(#18912594)
No[0]. To read a byte through a pointer at IX, you have to:
LD L,(IX+0)
LD H,(IX+1)
LD A,(HL)
On the 6502, you can do that in one instruction[0] if your X or Y registers are zero (and more often than not, you can use the indexed-indirect or indirect-indexed to save even more instructions): LDA ($40,X) ; if X == 0, and $40 is your pointer.
[0] https://8bitnotes.com/2017/05/z80-addressing-modes/
Re:Z80 arithmetic: also surprisingly terrible (2018)
by Steve44 on Tuesday January 15, 2019 @03:29PM
(#18914765)
From memory the IX and IY instructions took a lot of clock cycles and I avoided them unless there was a really good reason to use them.
I've just had a quick look at an instruction cycle table and it seems that without indexing they took 4 cycles more than HL then with an index that increased to 12 more.
Ref from search returning http://www.z80.info/z80time.txt
One notable thing here is they are writing a code generator and not actually programming in assembly. As a result their modules need to be more general purpose than if directly programming.