Re: Re: A89: get a number


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

Re: Re: A89: get a number




> getData:
>  lea map(pc),a0
>  lsl #4,d0                            ;d0 * 16 (the # of bytes in a row)
>  lsl #1,d1                            ;d1 * 2 (because 2 bytes for each
> data)
>  add d1,d0                        ; d0 becomes data offset
>  move.w 0(d0,a0),d0        ;d0.w holds the data
>  rts
>
>  then call it like this:
>
>  move #2,d0                    ;the data you want is at row 2, column 8 in
> the matrix
>  move #8,d1
>  bsr getData                    ;data -> d0.w

But aren't you forgetting that it starts at ZERO?  for the above data (row
2, column 8), don't you want 1 in d0 and 7 in d1? or am I missing something?



Follow-Ups: