[comp.sys.m68k] PC-relative summary

mazur@ishmael (04/09/88)

A couple of weeks ago, I asked people their opinion on pc-relative 
addressing for the M68000.  Well, I have received 6 responses, and 
surprise, 3 are for treating $20 in the effective address $20(pc) 
as an address, the other 3 are for treating it as an offset.

I've said I will go with whatever Motorola uses.  If someone has a 
Motorola assembler and can let me know what opcode, etc. it generates 
for a 
     MOVE $20(PC,D0) 
I'd appreciate it.
--
Beth Mazur
{ihnp4, ima, mirror}!inmet!mazur
mazur@inmet.com

dam@mtgzz.UUCP (XMRN40000[kvm]-d.a.morano) (04/12/88)

In article <127100001@ishmael>, mazur@ishmael writes:
> A couple of weeks ago, I asked people their opinion on pc-relative 

I have the Motorola '020 assembler based on the original PCC SGS from
AT&T.  The assembler syntax is :

	mov.l	x,20(%pc)

and the "20" refers to an offset as it should be.  Incidentally, I would
like to see the assembler automatically convert the following into 
the PC relative addressing mode for me :

x:	long	0			# some symbol 'x'

	mov.l	x,%d2			# move contents of 'x' to register

I would like to see the "x" automatically assembled as PC relative
when possible.  I realize that this would now leave the problem of 
how to specify direct addressing when desired.  How about :

	mov.l	*&x,%d2

for direct addressing.  This follows the DEC lead taken with the PDP-11
(and VAX) assemblers only with the C style operators applied instead,
as the assembler does now with the use of &.
Of course, on the DEC machines, this notation had much more intuitive
meaning since it semantically was broken out to mean :

	mov.l	@(%pc)+,%d2

where the direct absolute address of 'x' was stored in the instruction
stream located at where the PC pointed to.

Sorry if this was much more than you were thinking about.

Dave Morano	AT&T