luciaos/entry.nasm

41 lines
810 B
NASM
Raw Normal View History

2022-09-14 16:50:44 -05:00
global entry
entry:
2023-02-08 10:33:49 -06:00
mov dword [0xb8000], 0x07000700 | 'E' | 'N' << 16
mov dword [0xb8004], 0x07000700 | 'T' | 'R' << 16
mov dword [0xb8008], 0x07000700 | 'Y' | ' ' << 16
2022-09-14 16:50:44 -05:00
lgdt [gdt_desc] ; load gdt register
jmp 08h:Pmodecode
extern gdt_desc
2022-09-14 16:50:44 -05:00
[BITS 32]
Pmodecode:
mov ax, 0x10 ; set up segments
mov ds, ax
mov es, ax
mov ss, ax
mov fs, ax
mov gs, ax
mov ebp, 0x800000
2022-09-14 16:50:44 -05:00
mov esp, ebp
mov eax, 0x1f001f00
mov ecx, (80*25)/2
mov edi, 0xb8000
2022-09-14 21:54:59 -05:00
rep stosd ; clear screen
2023-02-08 10:33:49 -06:00
mov eax, dword [kernel_check]
cmp eax, 0x12345678
jne err
2022-09-14 16:50:44 -05:00
call start
hlt_loop:
hlt
jmp hlt_loop
2023-02-08 10:33:49 -06:00
err:
mov dword [0xb8000], 0x07000700 | 'L' | 'O' << 16
mov dword [0xb8004], 0x07000700 | 'A' | 'D' << 16
mov dword [0xb8008], 0x07000700 | 'F' | 'A' << 16
mov dword [0xb800C], 0x07000700 | 'I' | 'L' << 16
jmp hlt_loop
2022-09-14 16:50:44 -05:00
2022-09-14 21:54:59 -05:00
extern start
2023-02-08 10:33:49 -06:00
extern kernel_check