1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

what does -(A7) or (A7)+ mean

Discussion in 'Assembly Language Programming (ALP) Forum' started by Shafqat, Nov 27, 2008.

  1. Shafqat

    Shafqat New Member

    Joined:
    Nov 27, 2008
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Hi

    I'm a beginner at assembly language and I have a piece of code I'm trying to understand. I understand most of it but I still am not sure what -(A7) or (A7)+ mean.

    I know An are address registers and so A7 is the last 32 bit address register (coldfire processor). But whats the -/+ before and after?

    Is it decrementing or incrementing?

    If so, what is being incremented or decremented? The address registers themselves?

    e.g. does -(A7) mean A6?

    Thanks.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    -(A7) dereferences and predecrements A7, in C++ this would be *(--A7)
    (A7)+ dereferences and postincrements A7, in C++ *(A7++).

    -(A7) decreases the value in A7 by 1, then looks up in memory what is at address A7. So if we have the following memory layout:

    0012bcad 41
    0012bcae 37
    0012bcaf 26

    and A7 contains 0012bcae, move.b -(A7),d0 will change A7 to 0012bcad and load 41 into d0.
    Mirroring that, if A7 contains 0012bcae, move.b (A7)+,d0 will load 37 into d0 and change A7 to 0012bcaf.
     
  3. Shafqat

    Shafqat New Member

    Joined:
    Nov 27, 2008
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    That helped a lot, thank you :)
     

Share This Page