flip-a-byte
nicolad76
Posts: 164
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
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
thx!