and try to read port 60h to print out the keyboard input to screen but
the result is always AAh
i really wonder why?

Source: Computer-Engineering.orgAdam wrote:At power-on or software reset (see the "Reset" command) the keyboard performs a diagnostic self-test referred to as BAT (Basic Assurance Test) and loads the following default values:
Typematic delay 500 ms.
Typematic rate 10.9 cps.
Scan code set 2.
Set all keys typematic/make/break.
When entering BAT, the keyboard enables its three LED indicators, and turns them off when BAT has completed. At this time, a BAT completion code of either 0xAA (BAT successful) or 0xFC (Error) is sent to the host.
i already used CLI before entering protected modeStevo14 wrote:AFAIK, In protected mode, the keyboard will send you an interrupt when it has data for you to read. It should be interrupt request number one. (number zero is the timer's interrupt.)
but how does that AAh from BAT relate to the AAh i receive from port 60h?egos wrote:Source: Computer-Engineering.orgAdam wrote:At power-on or software reset (see the "Reset" command) the keyboard performs a diagnostic self-test referred to as BAT (Basic Assurance Test) and loads the following default values:
Typematic delay 500 ms.
Typematic rate 10.9 cps.
Scan code set 2.
Set all keys typematic/make/break.
When entering BAT, the keyboard enables its three LED indicators, and turns them off when BAT has completed. At this time, a BAT completion code of either 0xAA (BAT successful) or 0xFC (Error) is sent to the host.
Again, according to my limited knowledge, the answer is yes. In protected mode you have the privilege (or responsibility or whatever) to handle all interrupts yourself. I would suggest looking through some basic kernel tutorials as most of them give a good walk-through of getting interrupts (and other goodies that rely on interrupts like timers and of course the keyboard) setup.Philip wrote: so do i have to write all interrupts myself including the int 9?
(my building kernal hasnt an interrupt descriptor table yet)
Code: Select all
;************************************
; Test key input.
; By Dex
;************************************
; Assemble with fasm
; c:\fasm TestKey.asm TestKey.bin
;
; Keys = (UpArrow)
; Keys = (DownArrow)
; Keys = (Enter)
;************************************
org 0x7C00
use16
;****************************
; Realmode startup code.
;****************************
start:
xor ax,ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7C00
;*****************************
; Setting up, to enter pmode.
;*****************************
cli
lgdt [gdtr]
mov eax, cr0
or al,0x1
mov cr0,eax
jmp 0x10: protected
;*****************************
; Pmode. ;-)
;*****************************
use32
protected:
mov ax,0x8
mov ds,ax
mov es,ax
mov ss,ax
mov esp,0x7C00
;*****************************
; Turn floppy off
;*****************************
mov dx,3F2h
mov al,0
out dx,al
;*********************************
; Main keyboard loop.
;*********************************
NoKey:
xor eax,eax
in al,60h
cmp al,0x50
jne TryNext1
mov byte [es:0xB8000], "D"
jmp NoKey
TryNext1:
cmp al,0x48
jne TryNext2
mov byte [es:0xB8000], "U"
jmp NoKey
TryNext2:
cmp al,0x1c
jne NoKey
mov byte [es:0xB8000], "E"
jmp NoKey
;*************************************
; GDT.
;*************************************
gdt: dw 0x0000, 0x0000, 0x0000, 0x0000
sys_data: dw 0xFFFF, 0x0000, 0x9200, 0x00CF
sys_code: dw 0xFFFF, 0x0000, 0x9800, 0x00CF
gdt_end:
gdtr: dw gdt_end - gdt - 1
dd gdt
;*************************************
; Make program 510 byte's + 0xaa55
;*************************************
times 510- ($-start) db 0
dw 0xaa55