EASy68K  
It is currently Fri Jul 21, 2017 2:47 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: question about move.w PC
PostPosted: Fri May 08, 2015 2:25 am 
Offline

Joined: Fri May 08, 2015 1:26 am
Posts: 2
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


Top
 Profile  
 
PostPosted: Fri May 08, 2015 10:22 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1039
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.

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Mon May 11, 2015 2:04 am 
Offline

Joined: Fri May 08, 2015 1:26 am
Posts: 2
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?


Top
 Profile  
 
PostPosted: Tue May 12, 2015 12:55 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1039
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

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group