stage1.s: (bootloader)
Code: Select all
org 0x7c00
bits 16
cli
mov ax, 0x00
mov ds, ax
mov es, ax
mov ss, ax
mov bp, 0x7c00
mov sp, bp
sti
read:
mov ah, 0x02
mov al, 30
mov ch, 0
mov cl, 2
mov dh, 0
mov dl, 0x00
mov bx, 0x8000
int 13h
jc err
jmp 0x8000
print:
lodsb
cmp al, 0
je done
mov ah, 0eh
int 10h
jmp print
done:
ret
err:
mov si, errormsg
call print
mov ah, 0x00
int 16h
int 19h
errormsg: db "Error! Press any key to restart", 0
times 510-($-$$) db 0
dw 0xaa55
Kernel: (stage2.s)
Code: Select all
bits 16
org 0x8000
cli
mov ax, 0x00
mov ds, ax
mov es, ax
mov ss, ax
mov bp, 0x8000
mov sp, bp
sti
mov ah, 0x00
mov al, 0x03
int 10h
gdt_start:
dd 0x0
dd 0x0
gdt_code:
dw 0xFFFF
dw 0x0
db 0x0
db 0x00
db 0x00
db 0x00
db 10011010b
db 11001111b
db 0x0
gdt_data:
dw 0xFFFF
dw 0x0
db 0x0
db 10010010b
db 11001111b
db 0x0
gdt_end:
gdt_descriptor:
dw gdt_end - gdt_start - 1
dd gdt_start
CODE_SEG equ gdt_code - gdt_start
DATA_SEG equ gdt_data - gdt_start
cli
lgdt [gdt_descriptor]
mov eax, cr0
or eax, 1
mov cr0, eax
jmp dword CODE_SEG:_pmode
[bits 32]
_pmode:
mov ax, DATA_SEG
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax mov ebp, 0x100000
mov esp, ebp
in al, 0x92
or al, 2
out 0x92, al
mov dword [0xB8000], 0x07690748
jmp $
msg: db "Welcome to TastyCrepe!", 0
times 8192-($-$$) db 0
Any help would be appreciated.
