Re:On choosing the Z80 over the 6502 (2014)
by to3m on Sunday December 20, 2015 @09:31AM
(#10767103)
Hmm... in this case, you might be right. You'd then need to advance 2 registers by 8 each time, and you'd be paying an extra 3 T-states per compare for the fetch of the immediate operand, but you'd be saving 4+ cycles in various places from never needing a DD prefix...
(Actually, MIN_X and MAX_X are supposed to be values you fetch from memory, as you can see from the 6502 code. I have no idea why I wrote what I did for the Z80 version. You could use self-modifying code to put constants in the right place, though - which, thinking about it, is actually what I should have done for the 6502 version.)
I'd forgotten (IX+n) instructions were so expensive! It's a shame, because your example is their purpose.
I guess Z80 is a higher-level micro-coded language: easier but slower. I also always found the orthogonal mnenonic style of Z80 much clearer, which I think 6502 could have used. e.g. "LDA $F453,X" could be "LD A,($F453+X)"
PS some references I found: 6502 addressing modes: http://www.dwheeler.com/6502/oneelkruns/asm1step.html
Absolute Indexed Addressing - Load the accumulator with the contents of address $F453 + 3 = $F456.Z80 timings: http://map.grauw.nl/resources/z80instr.php