enabling a20 line
Posted: Mon Jan 06, 2003 6:28 pm
i found some pseudo code on how to do this and did it in asm. Can you guys critique it for me? i think it makes the PC reset for some reason, am i sending keyboard wrong command? Thanks.
/---------------------Code Snippet-------------------\
;; src coded by xsism
;; put this in your kernel
;; give me some credit
cli
;; 'wait keyboard to clear' function
wkc:
in al, 0x64
test al, 2
jnz wkc
ret
;------------------;
call wkc ; wait for buffer to clear
mov al, 0xAD ; disable keyboard
out 0x64, al ; send to command port
call wkc ; wait for buffer
mov al, 0xD0 ; disable keyboard
out 0x64, al ; send to port
call wkc ; wait for buffer
in al, 0x60 ; save byte status from kbd port to 'al'
push ax ; save byte in stack
call wkc ; wait for buffer
mov al, 0xD1 ; write to output port
out 0x64, al ; send to port
call wkc ; wait for buffer
pop ax ; restore byte
or al,2 ; * turn on a20 bit *
out 0x60, al ; send to command port
call wkc ; wait for buffer
mov al, 0xAE ; re-enable keyboard
out 0x64, al ; send to command port
sti
\-----------------------End Code Snippet---------------------/
regards,
mr. xsism
/---------------------Code Snippet-------------------\
;; src coded by xsism
;; put this in your kernel
;; give me some credit
cli
;; 'wait keyboard to clear' function
wkc:
in al, 0x64
test al, 2
jnz wkc
ret
;------------------;
call wkc ; wait for buffer to clear
mov al, 0xAD ; disable keyboard
out 0x64, al ; send to command port
call wkc ; wait for buffer
mov al, 0xD0 ; disable keyboard
out 0x64, al ; send to port
call wkc ; wait for buffer
in al, 0x60 ; save byte status from kbd port to 'al'
push ax ; save byte in stack
call wkc ; wait for buffer
mov al, 0xD1 ; write to output port
out 0x64, al ; send to port
call wkc ; wait for buffer
pop ax ; restore byte
or al,2 ; * turn on a20 bit *
out 0x60, al ; send to command port
call wkc ; wait for buffer
mov al, 0xAE ; re-enable keyboard
out 0x64, al ; send to command port
sti
\-----------------------End Code Snippet---------------------/
regards,
mr. xsism