A20 enabled yet disabled
Posted: Wed Mar 18, 2009 1:51 am
Hey,
I'm trying to make and run a code for enabling the A20 address line. I've used the memory wraparound concept to test whether A20 is enabled. When I start bochs, it shows A20 is disabled. However, when I query the keyboard controller, I see that the output port has the value 0x03, which would mean A20 is enabled.
Using almost the same code as in the wiki, I tried enabling the A20 (which is redundant right now), and checking the wraparound. I'm unable to enable the A20.
The code I've used-
Check a20
For enabling the A20
Could someone please help me. Thanks
EDIT:
Using int 15h BIOS function with ax: 2402h to check whether a20 is enabled, it showed that its already enabled.
I'm trying to make and run a code for enabling the A20 address line. I've used the memory wraparound concept to test whether A20 is enabled. When I start bochs, it shows A20 is disabled. However, when I query the keyboard controller, I see that the output port has the value 0x03, which would mean A20 is enabled.
Using almost the same code as in the wiki, I tried enabling the A20 (which is redundant right now), and checking the wraparound. I'm unable to enable the A20.
The code I've used-
Check a20
Code: Select all
check_a20: ; Returns 1 in ax if a20 is enabled
cli
xor ax,ax
mov fs,ax
not ax ; AX=0xffff
mov gs,ax
mov di,0500h
mov si,0510h
mov byte [fs:di],00h ; 0000:0500 = 00500h
mov byte [gs:si],0FFh ; FFFF:0510 = 100500h Check wraparound
cmp byte [fs:di],0FFh
xor ax,ax
je check_a20__exit
mov al,1
check_a20__exit:
sti
ret
Code: Select all
enable_a20:
cli
call enable_a20__wait ;clear
mov al,0ADh ; Disable keyboard
out 064h,al
call enable_a20__wait
mov al,0D0h ; Read from output port
out 064h,al
call enable_a20__waitob
xor ax,ax
in al,060h ; Read. Debugged to 0x03
mov bl,al ; Save
call enable_a20__wait
mov al,0D1h ; Write to output port
out 064h,al
call enable_a20__wait
mov al,bl
or al,00000010b ; Enable a20
out 060h,al
call enable_a20__wait
mov al,0D0h ; Last minute testing
out 064h,al
call enable_a20__waitob
xor ax,ax
in al,060h ; same value
call enable_a20__wait
mov al,0AEh ; Enable keyboard again
out 064h,al
sti
ret
enable_a20__wait:
in al,064h
test al,2 ; wait for input buffer to be empty
jnz enable_a20__wait
ret
enable_a20__waitob:
in al,064h
test al,1 ; wait for output buffer to be empty
jz enable_a20__waitob
ret
Could someone please help me. Thanks
EDIT:
Using int 15h BIOS function with ax: 2402h to check whether a20 is enabled, it showed that its already enabled.