Re: A92: Constants and immediate values + movem


[Prev][Next][Index][Thread]

Re: A92: Constants and immediate values + movem



On Sun, 17 Aug 1997, Niklas Brunlid wrote:

> If I define a constant and use it, what is the difference between
> 
>    add.l	CONSTANT,a1
> 
> and
> 
>    add.l	#CONSTANT,a1
> 
> Is the constant added as a hex value on the first and integer on the second?


hmm.. is it not like that the first one adds the content of address
CONSTANT to A1 and second one adds CONSTANT to A1 ?
i.e. say CONSTANT=$4
add.l $4,a1    ; will load longword from address $4 and add it to a1
add.l #$4,a1   ; = lea $4(a1),a1 (but lea is a bit faster i think)
;however those could be simplified with
add.l $4.w,a1  ; and you save 2 bytes (on the Motorola 6510 there is a
	       ; special addressing mode for accessing the first
	       ; 256 bytes :) (commodore 64 processor)  ) but can only
	       ; be used for the first 65536 bytes	
addq.l #4,a1   ; i guess this is even faster then the lea but addq can
	       ; only add values between 1 and 7 (i think)	

> 
> Also, what's the default datalength (byte/word/longword) when using "movem"
> with dataregisters? It's not longword, found that out by trial and error ;-(

does it not depend on the assembler?  it might exist  a convention for
what to be default, but to be sure add the desired suffix.

/slabbe

---------------------------------------------------------------------------
Mattias Slabanja (Slabbe)     |    "Barn är bilar, mjuka är hårda!"
phone: +46 (0)31 7784243      |   
---------------------------------------------------------------------------


Follow-Ups: References: