Nightloader/i386/legacy-boot/src-asm/memory/a20.asm

49 lines
595 B
NASM
Raw Normal View History

; A20 Wraparound check as gotten from osdev.org
check_a20_wraparound:
pushf
push ds
push es
push di
push si
xor ax, ax ; ax = 0
mov es, ax
not ax ; ax = 0xFFFF
mov ds, ax
mov di, 0x0500
mov si, 0x0510
mov al, byte [es:di]
push ax
mov al, byte [ds:si]
push ax
mov byte [es:di], 0x00
mov byte [ds:si], 0xFF
cmp byte [es:di], 0xFF
pop ax
mov byte [ds:si], al
pop ax
mov byte [es:di], al
mov ax, 0
je .exit
mov ax, 1
.exit:
pop si
pop di
pop es
pop ds
popf
ret