Doing Binary In BASIC

From Bitchin100 DocGarden
Jump to: navigation, search

When programming in assembly language, dealing with binary arithmetic is a straightforward affair. Your computer is designed in a deep way around binary numbers, operations, and arithmetic.

But layer a programming language like BASIC on top of it, and there are significant hurdles to dealing in binary.

Dealing with binary is important in the following use cases:

  • Determining if a number is even or odd
  • Packing 1-bit data together for space efficiency
  • Left shifts and right shifts on signed and unsigned data
  • Calculation complex conditional expressions without using IF
  • Signed and unsigned integer arithmetic
  • Masking bits

Although the manuals may document effectively what each of the logical operators do, it does not