Re: coding the Z80 and 6510 From: "Joe Mackay" Reply to: "Joe Mackay" Date: 03 Nov 98 23:14:48 +0000 Organization: [posted via] UK Online Ltd References: <3635b416.21822437@news.telepac.pt> <16476-agent.imc@comlab.ox.ac.uk> <71fo4o$oe9@cpca3.uea.ac.uk> On 03-Nov-98 20:13:58, Brix did excrete via fingers: >In article <71fo4o$oe9@cpca3.uea.ac.uk>, a.p.cadley@uea.ac.uk says... >> >> Brix wrote in message ... >> >> >> :Well, to tell you about the 6510: >> >> >> Well I'll fill in Z80 equivalents: >> >> :To load a byte into an index-register (let's have X) you have the >> Instruction: >> :LDX #$byte (2 cycles) >> >> Z80 Index registers are 16 bit, so it would need LD IX,word (14 cycles) >Urggh! Ok, I can understand that you don't like indexes... They're not terribly good on the Z80, I admit. But there are quite a few bizarre undocumented instructions, like LD C, RRC(IY+04) which means "Rotate right the byte at IY+4 with carry, then load c with the result", which can be useful. Sort of. >"LD (HL),Byte" means "write byte to adress given in H (highbyte) and L >(Lowbyte) ? I f i understood correctly you need to load the highbyte to H and >the Lowbyte to L... means: to write a Byte to adress 1000h-1002h >(stupido-method) you could do: >ld l,00 >ld h,10 >ld (hl),byte >ld l,01 >ld (hl),byte >ld l,02 >ld (hl),byte If you really wanted to do it this way, you would use: ld hl,$1000 ; saves 1 byte and 4 cycles ld (hl),byte inc l ; saves 1 byte and 3 cycles ld (hl),byte inc l etc...