'--------------------------------------------------------------
'                 (c) 1999-2003 MCS Electronics
'--------------------------------------------------------------
'  file: BOOLEAN.BAS
'  demo: AND, OR, XOR, NOT, BIT and MOD
'--------------------------------------------------------------
Dim A As Byte , B1 As Byte , C As Byte
Dim Aa As Bit , I As Integer

A = 5 : B1 = 3                          ' assign values
C = A And B1                            ' and a with b
Print "a AND c = " ; C                  ' print result

C = A Or B1                             'also for or
Print "a OR b1 = " ; C

C = A Xor B1                            ' and for xor
Print "a XOR b1 = " ; C

A = 1
C = Not A                               'not
Print "c = NOT a " ; C
C = C Mod 10
Print "c MOD 10 = " ; C


If Portb.1 = 1 Then
   Print "Bit set"
Else
   Print "Bit not set"
End If

Aa = 1                                  'use this or ..
Set Aa                                  'use the set statement
If Aa = 1 Then
   Print "Bit set (aa=1)"
Else
   Print "Bit not set(aa=0)"
End If

Aa = 0                                  'now try 0
Reset Aa                                                      'or use reset
If Aa = 1 Then
   Print "Bit set (aa=1)"
Else
   Print "Bit not set(aa=0)"
End If


B1 = 255                                'assign variable
Reset B1.0                              'reset bit 0 of a byte variable
Print B1                                'print it

Set B1.0                                'set it
Print B1                                                      'print it

End