Re: A92: Constants and immediate values + movem


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

Re: A92: Constants and immediate values + movem



On Sun, 17 Aug 1997 Slabbe <gu95masl@dd.chalmers.se> writes:

>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	

Oh no it can't!  Only the first 32768 bytes can be referenced by
absolute short addressing.  If the high bit is set, the address is
sign-extended so that it references the very last memory addresses.  

>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)	

Actually, ADDQ can add values from 1 to 8.  Using ADDQ can speed up
additions to data registers, but when adding to an address register
it is not any faster than an LEA.  It does save 2 bytes though.

--
Patrick Davidson (ariwsi@juno.com)
Visit my home page!  Stuff for Amiga, TI-85, TI-92, even DOS!
http://www.calweb.com/~kwdavids/patrick/
http://www.toptown.com/hp/ariwsi/


Follow-Ups: References: