Bit handling in MikroPascal


1. The Bit type

The "Bit" type is now implemented in the PRO version (v1.40) of MikroPascal.
Each bit declaration only occupies 1 bit. The drawback of this is that pointers to bits or arrays of bits do not exist any more (the bits are embedded in bytes).

2. Manipulation of bits in e.g. a byte.

Bits, which are part of a larger variable, can easily be manipulated, e.g.
[code]
var Bt: boolean;
  ...
  I := %01010101
  J := 2;
  Bt := I.2;  	
  Bt := not Bt;
  Bt := I.J;
  Bt := not Bt;
  I.J := Bt;
[/code]
Another Example:
[code]
var I, J: byte;
  ...
  I := %01010101;
  J := 2;
  I.J := not I.J;  
  I.J := not I.J;  
  J := 3;
  I.J := not I.J;  
  I.J := not I.J;  
[/code]

3. Existing MikroPascal routines.

At this moment MikroPascal has some bit manipulating functions on "bits" embedded in e.g. bytes:
[code]
procedure SetBit(Variable, BitNr: byte);
procedure ClearBit(Variable, BitNr: byte);
function  TestBit(Variable, BitNr: byte): byte;
[/code]

-------------------------------------------