Re: A89: storing from d1 to a0


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

Re: A89: storing from d1 to a0




>I was wondering if it was possible to store something from d1to an address 
>pointed to by a0.  I tried doing this:
>
>move.w    d1(a0)
>
>after having pointed a0 to a variable earlier in the program, but it didn't 
>work.  The reason I need this is because I am using lookup tables, and I 
>need to store a variable located in d1 to the address pointed to by a0, as 
>in the following:
>
>  move.w scounter,d0
>  rol.w #2,d0
>  add.l #(t_stat),d0
>  move.l d0,a0
>
>  move.w d1,(a0)
>
>where:
>
>t_stat dc.l    stat1,stat2,stat3,etc.
>
>so that if scounter equaled 0 then stat1 would equal what is in d1.  Any 
>help would be appreciated.  Thanks.

Why doesn't it work? Does the compiler tell you the program can't be 
compiled? Check if a0 is even or odd, because if you try to store d1.w to 
a0, this must not be an odd address, since this leads to an address error!

If this is not the error, check another thing:

I suppose you want to add the address of t_stat to d0! Yes? If so, remove 
the parentheses from the code line.

add.l #(t_stat),d0   ->   add.l #t_stat,d0

If this still doesn't work, there's (obviously ;-)) something else!
I suppose 'move.w  d1(a0)' from above is a typo, the correct syntax is 
'move.w  d1,(a0)'! This could also be the reason why it doesn't work, but I 
assume it's not THE reason...

If you can't fix the problem, mail me at mike_emk@hotmail.com and tell why 
exactly this doesn't work, and I'll try to help you, but till then, remove 
the parentheses, I'm sure this is the bug!

See ya,

Michael Kristiansen

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com