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

PC-relative adddressing
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=945
Page 1 of 1

Author:  fpn [ Wed Nov 24, 2010 5:07 pm ]
Post subject:  PC-relative adddressing

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,

Author:  lee [ Wed Nov 24, 2010 8:18 pm ]
Post subject: 

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.

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