Steve, if you now tell me that I've been doing something else stupid I shall slink off into a corner somewhere!
The only thing wrong which I can see is
how you use _BIT.
As Fell said, “There’s no way to store a single bit in memory and a byte will be taken up anyway.”
Think of a computer as a highway. Cars drive up and down the road, carrying information from one place to another...
In this analogy, a _BYTE would basically be a car, and a _BIT would be a person...
To drive down the interstate, you have to pack the person (_BIT) into a car (_BYTE). A person just can’t walk down the highway (it’s actually illegal here in Virginia; probably illegal across *all* US interstates); they HAVE to be inside a car.
Individually, it makes no sense to use _BIT; when they’re just going to be packed up and shoved into a _BYTE anyway.
So, if a _BIT *has* to be in a _BYTE, what’s the point to them??
Just like that car going down the highway can hold multiple people, a _BYTE can hold multiple _BITs.
A single person has to get in a car to use the interstate. A single _BIT has to be packed into a _BYTE to be stored in memory.
Multiple people can cram into the same car. Multiple _BITs can fit into the same _BYTE.
Honestly, the only time a programmer should use _BIT is when they’re going to pack an array with them.DIM True AS _BIT <— This line is actually doing your program HARM. The computer has to shove that bit into a byte, store it in memory, then unpack it again from that stored byte, every time you call it.
_BIT usage, by its very nature, is slow and inefficient. Another way to think of them is as an egg. You *have* to keep your eggs in a carton to put them in your fridge. When you need them, you open the fridge, get the carton, open it, and THEN pull out the egg to use. It’s much more efficient and quicker, if all you have to deal with is the egg cartons themselves.
_BITs purpose is to reduce speed and efficiency, in return for lower memory usage.
The only time it makes sense to use _BIT is with arrays of information.DIM variable AS _BIT <— this uses a _BYTE of memory, and is packed and unpacked before use.
DIM array(7) AS _BIT <— this packs 8 bits of infomation into a _BYTE of memory, and is packed and unpacked before use.
The *only* thing you accomplish by making a single variable a _BIT, is you slow down your program and make it less efficient. No memory savings. No advantage at all. Just a drag on performance.
_BIT is only useful, if you’re going to be packing multiple ones of it into _BYTE — and the *ONLY* way we do that is with arrays. ;)