Added file loading

This commit is contained in:
2023-12-22 13:18:07 +01:00
parent bb4d159f8b
commit 5d787348b1
13 changed files with 153 additions and 23 deletions
+30 -4
View File
@@ -7,16 +7,29 @@ start:
xor ax, ax
mov es, ax
mov ds, ax
mov bp, 0x9000
mov bp, 0x7c00
mov sp, bp
; Save drive number
mov byte [driveNumber], dl
; Print boot message
mov si, bootMsg
call print
mov dl, byte [driveNumber]
call printHex
mov si, newline
call print
; Read filetable from disk
mov bx, FILETAB_LOC ; Filetable location in memory
mov es, bx
xor bx, bx
mov ah, 2 ; Read from disk
mov al, 1 ; Read 1 sector
mov al, 1 ; Read 1 sector (512B)
mov dl, byte [driveNumber] ; Drive number
mov ch, 0 ; Cylinder
mov dh, 0 ; Head
mov cl, 2 ; Sector
@@ -30,7 +43,9 @@ start:
xor bx, bx
mov ah, 2 ; Read from disk
mov al, 2 ; Read 2 sectors
mov al, 2 ; Read 2 sectors (1024B)
mov dl, byte [driveNumber] ; Drive number
mov ch, 0 ; Cylinder
mov dh, 0 ; Head
mov cl, 3 ; Sector
@@ -46,13 +61,24 @@ start:
mov gs, ax
mov ss, ax
mov bl, byte [driveNumber]
; Far jump to the kernel
jmp KERNEL_LOC:0x0
jmp KERNEL_LOC:0x0000
readFail:
mov si, diskErrorMsg
call print
cli
hlt
%include "./src/print.asm"
driveNumber: db 0
bootMsg: db ENDL, "Booting kern.", ENDL, "Booting from drive ", 0
diskErrorMsg: db "Disk Error!", ENDL, 0
FILETAB_LOC equ 0x1000
KERNEL_LOC equ 0x2000