1
0
tetros/bios/stage2.asm
2025-03-04 19:41:22 -08:00

39 lines
662 B
NASM

SECTION .text
USE16
stage2.entry:
mov si, stage_msg
call print
mov al, '3'
call print_char
call print_line
; enable A20-Line via IO-Port 92, might not work on all motherboards
in al, 0x92
or al, 2
out 0x92, al
mov dword [protected_mode.func], stage3.entry
jmp protected_mode.entry
%include "gdt.asm"
%include "protected_mode.asm"
%include "thunk.asm"
USE32
stage3.entry:
; stage3 stack at 448 KiB (512KiB minus 64KiB disk buffer)
mov esp, 0x70000
; push arguments to `start()`
mov eax, thunk.int10
push eax
mov eax, [stage3 + 0x18]
call eax
.halt:
cli
hlt
jmp .halt