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 <e96nbr@efd.lth.se> writes:
>At 12:52 1997-08-17 -0500, you wrote:
>>On Sun, 17 Aug 1997 Slabbe <gu95masl@dd.chalmers.se> writes:
>>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.  
>
>So there's no point in using this in Fargo?

If the address is in the range of $0-$7FFF, you can still use absolute
short addressing.  This is useful for referencing LCD_MEM (and the
keyboard buffer (at least on "classic" TI-92s as the addresses are
different under ROM 2.1).  If you switch off the NMI which is normally
thrown when low memory is written, you can also use absolute short
addressing for the interrupt vectors.  However, you definitely can't
reference stuff inside your program with this, since programs are stored
much too high in memory.

>>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.
>
>No it doesn't. Then again, A68K may substitute LEA when the addition
>is 1-8, it substitutes ADD for ADDQ or ADDI...
>
>My .92p-file didn't get any shorter. I didn't compare sizes on the
>calc - the .92p:s file header is constant size, or is it?

Wrong!  The ADDQ really is smaller than LEA!  Actually, LEA (An),An is
the same size as ADDQ, but LEA d(An),An is two bytes longer.  The reason
that the files may seem to be the same size is that the object file
format output by A68K always rounds the length of each section (Fargo
programs should only have one) up to the nearest four bytes.  If you
take 1024 bytes of code and optimize it to 1022, you won't notice any
difference in the output size.  However, if you change two LEA (An),An
into ADDQ.L #n,An, you will always see a four byte size decrease.

A good 68000 assembler will automatically convert the LEA into an ADDQ
when it is possible (if the offset is 1 to 8) or to a SUBQ (if the offset
is -1 to -8).  However, A68K is not that advanced.  A68K does not change
between ADDQ and LEA.

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