Anyway, I have a question:
For functions like getch(), timer_wait, kbhit(), etc, how does one go about implementing them?
From what I find, using this:
Code: Select all
while(!got_ch)
{
//Do something
}
//Somewhere else
keyboard_handler(...)
{
got_ch = 1;
}
doesn't work. If I guessed correctly, (I don't have multitasking yet) the kernel gets stuck in the while loop, because the keyboard handler can't get called? Or do interrupts rip control (figuratively?) from the current function, then transfer control to the handler? If the former is true, does that mean I need multitasking to do stuff like waiting on a timer or keyboard press?
Else, if the latter is true, why doesn't my pseudocode work?