smallbasicは、ビット操作の演算子が無い。
0~255を使って、なんとかする。
以下は、2進数表示。
サンプルコード
a = 255
If a - 128 < 0 then
TextWindow.Write(0)
Else
TextWindow.Write(1)
a = a - 128
endif
If a - 64 < 0 then
TextWindow.Write(0)
Else
TextWindow.Write(1)
a = a - 64
endif
If a - 32 < 0 then
TextWindow.Write(0)
Else
TextWindow.Write(1)
a = a - 32
endif
If a - 16 < 0 then
TextWindow.Write(0)
Else
TextWindow.Write(1)
a = a - 16
endif
If a - 8 < 0 then
TextWindow.Write(0)
Else
TextWindow.Write(1)
a = a - 8
endif
If a - 4 < 0 then
TextWindow.Write(0)
Else
TextWindow.Write(1)
a = a - 4
EndIf
If a - 2 < 0 then
TextWindow.Write(0)
Else
TextWindow.Write(1)
a = a - 2
EndIf
TextWindow.Write(a)
TextWindow.WriteLine("")