EASy68K
http://www.easy68k.com/EASy68Kforum/

question about move.w PC
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=1483
Page 1 of 1

Author:  lqshadan [ Fri May 08, 2015 2:25 am ]
Post subject:  question about move.w PC

My code is the following

Code:
    ORG    $50
START:                  ; first instruction of program

* Put program code here
    lea message,a0       *50
   
    move.b #2,d0         *56
    MOVE.W #0,d1         *5A

    Move.w ($2,PC,d0.w) , d1  *5E

message dc.b 1  *62
        dc.b 2  *63
        dc.b 3  *64
        dc.b 4  *65
        dc.b 5  *66
        dc.b 6  *67
         dc.b 7  *68
         dc.b 8  *69
         dc.b 9  *70
 
* Put variables and constants here

    END    START        ; last line of source

I think the value in d1 should be 00000001. but the result is 0000FFFF.
what is wrong with it . The PC Is 5E , inplacement is $2 + #2 ,so the address is 62.
but it seem that the address is wrong(somewhere not init).could some one help me

Author:  profkelly [ Fri May 08, 2015 10:22 am ]
Post subject:  Re: question about move.w PC

The displacement word (x) is specified as an address relative to the current PC. Therefore:

Code:
    MOVE.L $1102(PC),D0
copies the longword stored at PC+$102 to D0 assuming the current PC is $1000.

Also, the first 200 or so bytes of the address space are reserved for exception vectors and should not be used for code.

Author:  lqshadan [ Mon May 11, 2015 2:04 am ]
Post subject:  Re: question about move.w PC

Code:
    ORG    $1100
    dc.w 1200
    ORG    $1200
START:                  ; first instruction of program

* Put program code here

    MOVE.w $1100(PC),D0
 
* Put variables and constants here

    END    START        ; last line of source


Thanks for your reply. How about code above? It seem that the value of D0 is 04B0(dw.w 1200)
I don't think PC is $0,It seems that Pc is ignored.Is there any bug with easy68k?

Author:  profkelly [ Tue May 12, 2015 12:55 pm ]
Post subject:  Re: question about move.w PC

The instruction:
00001200 303A FEFE MOVE.w $1100(PC),D0
Moves the word of data from address $1100 into register D0. The assembler calculates the offset as $FEFE (-258). The current PC($1202) + $FEFE = $1100

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/