Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: DamageX on April 13, 2006, 05:33:05 AM

Title: quickest way to swap byte order on 68000?
Post by: DamageX on April 13, 2006, 05:33:05 AM
Where's that BSWAP instruction when you need it eh? What is the fastest way to change $12345678 into $78563412? (and that's hexadecimal... no financial advice please.)
Title: Re: quickest way to swap byte order on 68000?
Post by: Lando on April 13, 2006, 05:57:54 AM
Code: [Select]

move.l  #$12345678,d1
rol.w   #8,d1         ;d1=$12347856
swap    d1            ;d1=$78561234
rol.w   #8,d1         ;d1=$78563412


(ror.w would work too of course)
I don't think there is any quicker way.
Title: Re: quickest way to swap byte order on 68000?
Post by: DamageX on April 14, 2006, 05:01:17 AM
that's an improvement, thanks