[A83] Re: Getting a value from a data table


[Prev][Next][Index][Thread]

[A83] Re: Getting a value from a data table



okay, you know how many bytes are in each row, so take your y coordinate and 
multiply it by 5... 

ld a,e
add a,a
add a,a
add a,e

then just add your x coordinate

add a,d

then put it in hl

ld h,0
ld l,a

then add it to the location

ld de,datatable
add hl,de

then, (hl) contains the data.

it may be a good idea to use hl for the multiplying in case its >255

ld h,0
ld l,e
ld b,0
ld c,e
add hl,hl
add hl,hl
add hl,bc
ld b,0
ld c,d
add hl,bc
ld de,datatable
add hl,de

again, the value is in (hl)

hope this helps, if you dont understand, fire another mail

-joel






Follow-Ups: