PDA

View Full Version : flip-a-byte



nicolad76
05-13-2008, 08:10 PM
Hi,
do you know a better way to flip a byte?

I do this

···················· mov m_DataByte,myByte
···················· call #flip
················
····················· now m_DataByta· [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

hippy
05-13-2008, 08:37 PM
Have a read of the rev instruction in the Propeller Manual ( Page 399 ).

nicolad76
05-13-2008, 11:04 PM
well... that was easy... ;)
thx!