Working on a project. Professor gave us a .zip file with some tests, so we can see if our project is working correctly. We are building a small kernel in c++.
Anyhow, there is a thread that waits for a keyboard interrupt (event9.wait()) and after that it should put characters in a buffer or end the program (if you press “esc”).
while (!theEnd) {
event9.wait();
status = inportb(0x64); // reading status reg. from 64h
while (status & 0x01){ //while status indicates that keys are pressed
....
I checked and I am certain that it waits for the interrupt regularly. The problem occurs because status&0x01 is 0.
Then I got the part of code that gets the characters from 0x60 and it worked just fine.
Is there something wrong with the code of test files? And if yes, what? If the code is correct what could cause the problem?
I could change the test files, but I need a good reason to do so. And so far the only reason I have is that it doesn’t work.
*note: comments are translated from Serbian, but I am almost certain they are translated correctly.
I think
status & 0x01is perfectly fine. However, you would need to read the port again after reading port 0x60 – it may well be that you do that later on in the code, but I personally would just re-write the code to:Note that you shouldn’t read port 0x64 again inside the loop in this case.