Marcel Kilgus wrote:
> Fabrizio Diversi wrote: 
> 
>>I need some help to traslate Movep instruction, is it
>>correct what i did in the following example ?
> 
> 
> Yes.

I'll add that doing all those rotates is very inefficient and of course 
affects the status register, which maybe it shouldn't (the MOVEP 
instruction does't touch it at all).

I shan't quote "better" code, as it would vary dependant of what was 
being attempted. E.g. knowing that the address involved was always even 
(or odd!), caring whether the data bus was accessed in any specific 
order or if extra bytes could be fetched, etc, etc.

The sort of game that you'll find in the Minerva ROM, where every byte 
saved on non-critical code meant another feature could be squeezed in, 
might have gone something like:

  ...
  bsr.s getpl
  ...

getpl
  bsr.s getpw
  swap d0
getpw
  bsr.s getpb
  rol.w #8,d0
getpb
  move.b (a4)+,d0
  addq.l        #1,a4
  rts

... wildly inefficient in terms of execution time, etc, but saving quite 
a few bytes, especially if bits of it get re-used.

Note. In Fabrizio's original code, using:
  move.b 0(a4),d1
instead of:
  move.b (a4),d1
typically causes an assembler to generate exactly what is asked: a four 
byte instruction with a zero offset for a4 in the second word.

> 
> 
>>What is the equivalent of :
>>
>>movep.w d0,0(a5) ?
> 
> 
> move.b    d0,(a5)
> lsr.l     #8,d0
> move.b    d0,2(a5)
> 
> Viewed from the hardware on the bus both codes are not an exact
> replacement, but this doesn't matter nowadays.
>
Note that the above code destroys d0.l (and the status register) and 
that doing a ".l" instead of a ".w" takes longer.

> Ciao Marcel
> 
> 
> 


Ah well... I chip in my two cents once in a while. Hi all!

-- 
Lau
http://www.bergbland.info
Get a domain from http://oneandone.co.uk/xml/init?k_id=5165217 and I'll 
get the commission!

Reply via email to