User`s manual
main:
Sbb = $OFF0
Saa = $0a
Sbb = Sbb and Sa
' Bb becomes $0000
end.
In this case, Sa is treated as an integer with the upper byte equal to $00 (this in
fact is sign extending of short to integer) prior to the operation.
dim teA as byte
dim teB as byte
dim teC as byte
' The logical operators perform bitwise manipulation
' on the operands. For example, if the value stored in
' teA (in binary) is 00001111 and the value stored in
' teB is 10000001, the following statements..
main:
teA = $0F
' .. assign the value 00001111 to teA.
teB = $81
' .. assign the value 10000001 to teB.
teC = teA or teB
' Performs bitwise or with teA, teB and the
' result is assigned to teC (value 10001111)
teC = not teA
' Performs bitwise not with teA and the
' result is assigned to teC (value 11110000)
teC = teA << 4
' shift teA to the left for a number of positions
' specified in the operand on the right;
' operand on the right must be positive.
' In this example teC becomes $F0
' All bits shifted in are zeros.
teC = teA >> 4
' shift teA to the right for a number of positions
' specified in operand on the right;
' operand on the right must be positive.
' In this example C becomes $00.
' New bits shifted in are zeros if operand type is
' byte/word sign extended for short, word, integer.
end.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
82
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
Example