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

13 lines
492 B
Z80 Assembly

LD H,>MyTable ;works out to be LD h,4 thanks to our alignment below.
;>LABEL means "the high byte of the address represented by LABEL
LD L,13 ;this was a lot faster than doing LD HL,&0400 and adding the desired index later.
LD a,(HL) ;loads 12 into the accumulator.
RET
org &0400
MyTable: ;thanks to the ORG statement above, this label's address is guaranteed to be &0400
byte 1,2,3,4,5
byte 2,4,6,8,10
byte 3,6,9,12,15
byte 4,8,12,16,20
byte 5,10,15,20,25