2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
; A20 Wraparound check as gotten from osdev.org
|
2024-06-16 21:02:55 +00:00
|
|
|
check_a20_wraparound:
|
2024-08-06 11:25:42 +00:00
|
|
|
pushf
|
|
|
|
push ds
|
|
|
|
push es
|
|
|
|
push di
|
|
|
|
push si
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
xor ax, ax ; ax = 0
|
|
|
|
mov es, ax
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
not ax ; ax = 0xFFFF
|
|
|
|
mov ds, ax
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
mov di, 0x0500
|
|
|
|
mov si, 0x0510
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
mov al, byte [es:di]
|
|
|
|
push ax
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
mov al, byte [ds:si]
|
|
|
|
push ax
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
mov byte [es:di], 0x00
|
|
|
|
mov byte [ds:si], 0xFF
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
cmp byte [es:di], 0xFF
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
pop ax
|
|
|
|
mov byte [ds:si], al
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
pop ax
|
|
|
|
mov byte [es:di], al
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
mov ax, 0
|
|
|
|
je .exit
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
mov ax, 1
|
2024-06-16 21:02:55 +00:00
|
|
|
|
2024-08-06 11:25:42 +00:00
|
|
|
.exit:
|
|
|
|
pop si
|
|
|
|
pop di
|
|
|
|
pop es
|
|
|
|
pop ds
|
|
|
|
popf
|
2024-06-16 21:02:55 +00:00
|
|
|
|
|
|
|
ret
|