Using freepascal, you can now have bit packed records like so:
Code:
{
Flag register:
---------------
Bit[0] - Reserved
Bit[1] - c (Unsigned Carry and Unsigned Borrow flag)
Bit[2] - z (Zero flag)
Bit[3] - Reserved
Bit[4] - Reserved
Bit[5] - Reserved
Bit[6] - o (Signed Overflow Flag)
Bit[7] - n (Negative Flag; aka Sign Flag)
}
type
TBit = 0..1;
TFlags = bitpacked record
_0 : TBit;
c : TBit;
z : TBit;
_3 : TBit;
_4 : TBit;
_5 : TBit;
o : TBit;
n : TBit;
end;
here, you can access all the separate bits as a separate variable in the record...rather neat!
It isn't supported under Delphi unfortunately, but if you only use freepascal, then great
Bookmarks