port 60h wonder
port 60h wonder
after my kernel switch to protected mode
and try to read port 60h to print out the keyboard input to screen but
the result is always AAh
i really wonder why?
and try to read port 60h to print out the keyboard input to screen but
the result is always AAh
i really wonder why?
Re: port 60h wonder
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.)
so do i have to write all interrupts myself including the int 9?
(my building kernal hasnt an interrupt descriptor table yet)
Re: port 60h wonder
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)
To poll the keyboard you do not need IDT set up in pmode.
Something like this should work
Use the ArrowUp, ArrowDown, Enter key to print U, D, or E on screen in pmode, use rawrite to put on a floppy.
Something like this should work
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
Do you even understand how Dex's code works?
If you copy it word for word, then it'll only print out the letters 'D', 'U' or 'E' (but i have to say, the compared values don't seem right...) when you press them.
Other than that, maybe show us your printHexAL function?
If you copy it word for word, then it'll only print out the letters 'D', 'U' or 'E' (but i have to say, the compared values don't seem right...) when you press them.
Other than that, maybe show us your printHexAL function?
"Sufficiently advanced stupidity is indistinguishable from malice."
i found out the problem,
it is because of my tablet pc compaq tc1000
port 60h is not the keyboard port as i tried
to write a small program in real mode and run under dos to check but
the value from port 60h is also always AAh
i wonder which port is the keyboard port on compaq tc1000?
the keyboard buffer is set by int 9, but not available once
tune in to protected mode
i tried to trace int 16h function 0 but can not find out the port
anybody knows which port should it be?
it is because of my tablet pc compaq tc1000
port 60h is not the keyboard port as i tried
to write a small program in real mode and run under dos to check but
the value from port 60h is also always AAh
i wonder which port is the keyboard port on compaq tc1000?
the keyboard buffer is set by int 9, but not available once
tune in to protected mode
i tried to trace int 16h function 0 but can not find out the port
anybody knows which port should it be?