ErosOlmi
26-05-2007, 10:25
Thanks to Abraxas contribution this code will be present in next thinBasic help release:
' Usage of the SHIFT Instruction example
'
' Binary Divide by 2 (no remainder)
DIM MyByte AS BYTE VALUE &h08 ' Initialise Byte to 8
DIM sMsg as String
sMsg += "Original Byte Value " & Hex$(MyByte,2) & $CRLF & $CRLF
SHIFT SIGNED RIGHT MyByte,1 ' Binary Divide by 2 probably quicker than a /
sMsg += " New Byte Value " & Hex$(MyByte,2) & $CRLF
msgbox 0, sMsg
' Usage of the SHIFT Instruction example
'
' Binary Divide by 2 (no remainder)
DIM MyByte AS BYTE VALUE &h08 ' Initialise Byte to 8
DIM sMsg as String
sMsg += "Original Byte Value " & Hex$(MyByte,2) & $CRLF & $CRLF
SHIFT SIGNED RIGHT MyByte,1 ' Binary Divide by 2 probably quicker than a /
sMsg += " New Byte Value " & Hex$(MyByte,2) & $CRLF
msgbox 0, sMsg