EASy68K  
It is currently Sun Dec 16, 2018 11:29 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: PC-relative adddressing
PostPosted: Wed Nov 24, 2010 5:07 pm 
Offline

Joined: Sun Nov 21, 2010 10:33 am
Posts: 1
Location: Germany
Hi,

I'm trying to simulate instructions using PC-relative addressing like

LEA (4,PC),A4
or
MOVE.W -4(PC),D1

The simulator seems to replace value of the program counter with 0.

Is this a bug or do I miss something?

Best regards,


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 24, 2010 8:18 pm 
Offline

Joined: Mon Dec 27, 2004 11:40 pm
Posts: 318
You're missing something. The target address is treated as an absolute address and used to calculate an offset from the current PC. So if you want to specify an offset you need to specify it as an offset from the current PC e.g.

Code:
      LEA         (*+4,pc),a4

      MOVE.w      *-4(pc),d1

Lee.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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