Shop OBEX P1 Docs P2 Docs Learn Events
flip-a-byte — Parallax Forums

flip-a-byte

nicolad76nicolad76 Posts: 164
edited 2008-05-13 15:04 in Propeller 1
Hi,
do you know a better way to flip a byte?

I do this

···················· mov m_DataByte,myByte
···················· call #flip
················
····················· now m_DataByta· [noparse][[/noparse]7..0] have been flipped
'..........................
flip
···················· mov f_Count, #8
···················· mov temp2, m_DataByte
···················· mov temp, #0
··········· floop··· shr temp2, #1············· wc
············· if_c·· add temp, #1
···················· shl temp, #1
···················· djnz f_Count,#floop
···················· shr temp, #1
···················· mov m_DataByte, temp
flip_ret ret


I am a beginner and this is the only way I found....
Thanks
Nicola

Comments

  • hippyhippy Posts: 1,981
    edited 2008-05-13 12:37
    Have a read of the rev instruction in the Propeller Manual ( Page 399 ).
  • nicolad76nicolad76 Posts: 164
    edited 2008-05-13 15:04
    well... that was easy... [noparse];)[/noparse]
    thx!
Sign In or Register to comment.