Re: A86: Reading The Array


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

Re: A86: Reading The Array




I'm pretty sure this is working somewhat...but what is the output of
Get_Coords? (if you make it a call, add a 'ret' to the end, and load bc
before calling it)

Dave

>;lets pretend your array is like a graph
>;you pick the x and y coords of where you wanna read assuming this is 
>;the grid~~~>  0,0 +---------+ 40,0
>;                  |         |
>;                  |         |
>;                  |         |
>;              0,24+---------+40,24 
>;I think thats right anways you get the idea I hope
>;b=the "x" and c=the "y" of the spot you wanna read
>;also hl=area of you array
>;and (array) is your actual array's label (if that makes sense)
>
>Get_Coords:  ;this can also be some kinda input routine if you want
>             ;it to get somewhere the users says
> ld b,4 ;x
> ld c,5 ;y
> ld d,b ;saved x
> ld e,c ;saved y
> ld b,c ;get y into b so I can use djnz to recurse
>
>Find_Array:
> ld hl,Array  ;we need to know where the array is
>
>Get_Y_Of_Array:
> inc hl  ;move down a .db
> djnz Get_Y_Of_Array  ;repeat until we're at our .db
>
>Init_Get_X_Of_Array:
> ld b,d  ;get x back into b so we can recurse again
>
>Get_X_Of_Array:
> ld hl,(Array+1)  ;move over a cell
> djnz Get_X_Of_Array   ;repeat until until we're at our spot
>
>
>Matt



References: