Code: Select all
char *monitor_getchar()
{
return inb(0x60);
}
Code: Select all
char *monitor_getchar()
{
return inb(0x60);
}
Now, I am having heaps of trouble. I will need to implement V86 in some way.Troy Martin wrote:Waiting for a character from the keyboard is simple; you repeatedly check the input buffer empty flag (in port 0x64) until it tells you there's a scancode in the buffer, then do your inb(0x60) to get the scancode, then pull the ASCII character from a table (use the scancode) to get the character.
Waiting for the scancode is just the same without using the char array.
Why is that? The method Troy Martin posted is the standard correct way of waiting for a keystroke and getting it from the keyboard.Now, I am having heaps of trouble. I will need to implement V86 in some way.
OK, code:neon wrote:Why is that? The method Troy Martin posted is the standard correct way of waiting for a keystroke and getting it from the keyboard.Now, I am having heaps of trouble. I will need to implement V86 in some way.
If you describe the problems a bit more and show some code we might be able to help.
Code: Select all
int monitor_getchar()
{
int ready;
do {
ready = inb(0x64);
} while (ready != 0x1c);
int t = inb(0x60);
int temp = inb(0x61);
outb(0x61,temp | 0x80);
outb(0x61,temp & 0x7F);
return t;
}
Ok, but HOW? I know this is not easy pezzy. More exactly, what are the values if the keyboard buffer is full, or empty.neon wrote:Why are you testing if the status register is 0x1c? You only need to test bit 0...
You missed: More exactly, what are the values if the keyboard buffer is full, or empty.pcmattman wrote:You do know how to test bits don't you - bitwise AND?
neon wrote:You only need to test bit 0...
Code: Select all
* Bit 0: Output Buffer Status
o 0: Output buffer empty, dont read yet
o 1: Output buffer full
* Bit 1: Input Buffer Status
* Bit 2: System flag
* Bit 3: Command Data
* Bit 4: Keyboard Locked
* Bit 5: Auxiliary Output buffer full
* Bit 6: Timeout
* Bit 7: Parity error
Code: Select all
0x0 Internal buffer overrun
0x1-0x58, 0x81-0xD8 Keypress scan code
0x83AB Keyboard ID code returned from F2 command
0xAA Returned during Basic Assurance Test (BAT) after reset. Also L. shift key make code
0xEE Returned from the ECHO command
0xF0 Prefix of certain make codes (Does not apply to PS/2)
0xFA Keyboard acknowledge to keyboard command
0xFC Basic Assurance Test (BAT) failed (PS/2 only)
0xFD Diagnostic failure (Except PS/2)
0xFE Keyboard requests for system to resend last command
0xFF Key error (PS/2 only)