Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?


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/

[1] http://www.obelisk.me.uk/6502/addressing.html


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: