Re: A92: Reading a table or a matrix


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

Re: A92: Reading a table or a matrix




According to Max:
> 
> 
> I have created a matrix like that
> 
>     dc...    0,0,0,0,0,0,0,0
>     ....       0,0,0,0,0,1,0,0
> 
> Can somebody explain me how can i read the "1" (or another thing) in
> this table...
> P.S.(si vous parlez francais c'est mieux... Repo,dez directe à
> dir@infonie.fr)
> 
> 

Let's say that you want to put the (row,column) indicated by (d0,d1) in d2.
Let's say that a0 point the matrix.
You can put (d0,d1) in d2 by doing the following : 
  lsl.w #3,d0
  add.w d0,d1
  move.b 0(a0,d0.w),d2

Notice that the rows as well as the columns start at 0.
For example, if you want to read the "1", you have to first do the following :
  move.w #1,d0
  move.w #5,d1
  [then call the routine above]

Hope it will help.

-- 

    Jean-Baptiste CANAZZI
    canazz_j@epita.fr
    http://www.multimania.com/bloozed


References: