RosettaCodeData/Task/Arrays/Z80-Assembly/arrays-7.z80
2023-07-01 13:44:08 -04:00

7 lines
353 B
Z80 Assembly

LD h,&04 ;load high byte of address &0400
LD L,&1F ;desired index
ld a,(hl)
ld c,a
inc h ;LD h,&05. We can keep L the same since the index is the same.
;Effectively we did all the necessary pointer arithmetic for indexing the second table, just with this one instruction!
ld a,(hl) ;now we have the low byte in C and the high byte in A.