Welcome, Guest. Please login or register.

Author Topic: quickest way to swap byte order on 68000?  (Read 2428 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline DamageXTopic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show only replies by DamageX
    • http://www.hyakushiki.net/
quickest way to swap byte order on 68000?
« 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.)
 

Offline Lando

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 1390
    • Show only replies by Lando
    • https://bartechtv.com
Re: quickest way to swap byte order on 68000?
« Reply #1 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.
 

Offline DamageXTopic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show only replies by DamageX
    • http://www.hyakushiki.net/
Re: quickest way to swap byte order on 68000?
« Reply #2 on: April 14, 2006, 05:01:17 AM »
that's an improvement, thanks