Hi Gabor,
You wrote to Christopher Butler:
GM> CB> if (inp(0x64) & 1) // same as kbhit()
GM> ^^^^^^^^^^^^^^^
GM> The problem is here
No it isn't...
GM>Here you set the first bit if it is already set, and erase the others.
GM>This port can't be changed, and that is the reason why your computer
GM>crashes.
But that code does not write to the port, it only reads from it.
GM>If you want a chack the state of N-th bit you can do that like this:
GM>... (inp(0x64) && 1)
That will _ALWAYS_ return TRUE if _ANY_ bit on port 0x64 is set.
GM>& - binary AND operator
GM>&& - logical AND operator
That is correct, and using the logical operator with one side set to
always true (the "1") will just test if the other side is zero or
non-zero and return TRUE if it's non-zero. The original code using the
binary operator is the only way that will do what Christopher requires.
George
* SLMR 2.1a * Desk: A very large wastebasket with drawers.
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
|