RosettaCodeData/Task/Arrays/Z80-Assembly/arrays-7.z80

8 lines
353 B
Z80 Assembly
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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.