1 ; Some routines for managing the A20 line
3 ; Check if A20 is enabled
4 ; Based on <https://wiki.osdev.org/A20_Line#Testing_the_A20_line>
30 mov byte [ds:si], 0FFh
32 cmp byte [es:di], 0FFh
73 cli ; disable interrupts
76 mov al, 0ADh ; disable 1st PS/2 port
80 mov al, 0D0h ; read controller output port
84 in al, 60h ; do the actual read
85 push ax ; save the register
88 mov al, 0D1h ; write byte to output port
92 pop ax ; restore the register
93 or al, 2 ; toggle A20 bit
97 mov al, 0AEh ; reenable 1st PS/2 port
101 sti ; enable interrupts
113 A20_FAIL db "A20 enable fail, not booting!", 0