Files
Foundry-Boot/examples and stuff/booting stuff/boot.S
T
2025-02-25 01:14:52 +00:00

55 lines
769 B
ArmAsm

[BITS 16]
[ORG 0x7c00]
start:
mov ah,0x00 ; set mode
mov al,0x03 ; set vga text buffer mode (80x25)
int 0x10 ; call bios
cli
in al, 0x92
or al, 2
out 0x92, al
xor ax, ax
mov ds, ax
lgdt [GDT_PTR]
mov eax, 0x11
mov cr0, eax
jmp GDT_BOOT_CS-GDT:protmode
[BITS 32]
protmode:
mov ax, GDT_BOOT_DS-GDT
mov ds, ax
mov ss, ax
mov es, ax
mov esp, 0x90000 ; temporary stack
mov edi, 0xb8000
mov eax, "P R "
stosd
hang:
pause
jmp hang
GDT_PTR:
dw GDT_END-GDT-1
dd GDT
align 16
GDT:
GDT_NULL: dq 0 ; segment zero cannot be used
GDT_BOOT_DS: dq 0X00CF92000000FFFF
GDT_BOOT_CS: dq 0X00CF9A000000FFFF
GDT_END:
times 510-$+start db 0;
db 0x55;
db 0xaa;