A89: storing from d1 to a0


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

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:

You need a comma as in:

 move.w d1,(a0)
  
This works. If it doesn't, then you have a wrong value in a0.
  
 >  move.w scounter,d0
 >  rol.w #2,d0
 >  add.l #(t_stat),d0
 >  move.l d0,a0
 > 
 >  move.w d1,(a0)

Depending on what you do, that is, how often do you refer to the same
table, it might be advantageous to use the N8(An,Xn.s) addressing mode.
The above code, on its own, would be quicker this way:

  move.w scounter,d0
  move.l #t_stat,a0
  add.w d0,a0
  add.w d0,a0
  move.w d1,(a0)
  
Suggested reading would be:

MC68000UM/AD, The 68000 User's Manual from Motorola (available in 
PDF format from Motorla's website), or

M68000PM/AD, Programmers Reference Manual, can be ordered from the
Motorola Literature Center.

Would that be possible to post w/o the HTML extensios ? Nothing
serious, just asking. Maybe a wordwrap around 72-76 characters ?


Regards,

Zoltan


Follow-Ups: References: