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

Re: [MiNT] [Atari-coldfire] LEDs, interfaces, random thoughts, wiki policy..



so it is specifically the -(sp) part (when used with move.b)

paul

2011/8/1 Vincent Rivière <vincent.riviere@freesbee.fr>:
> Lonny Pursell wrote:
>>
>> I don't think this will work for all cases. The author of GFA has used
>> this
>> on purpose to decode words on an odd address.   Move.b the first byte onto
>> the stack, he knows it get put the the upper byte of the word, then pulls
>> it
>> write back off the stack with move.w, thus avoiding a rol or shift, and
>> then
>> takes the next byte and moves it into the lower byte.
>>
>> Something like:
>> a0 might be some odd address, pointing to a word (variable index)
>> Moveq #0,d1     ;clr d1
>> Move.b (a0)+,-(sp)  ;first byte ->  xx00
>> Move.w (sp)+,d1
>> Move.b (a0)+,d1 ;2nd byte , now d1=index (word)
>>
>> If Move.b (a0)+,-(sp) becomes Move.W (a0)+,-(sp) then a0 is bumped by 2
>> and
>> it breaks.  I'm not an asm guru but I think putting .w is to easy to fix
>> this. :)
>
> You can do something like this:
> subq.l  #2,sp
> move.b  (a0)+,(sp)
> move.b  (a0)+,1(sp)
> move.w  (sp)+,d1
>
> --
> Vincent Rivière
>
> _______________________________________________
> Atari-coldfire mailing list
> Atari-coldfire@lists.lnxnt.org
> https://lists.lnxnt.org/mailman/listinfo/atari-coldfire
>