forked from PoliEcho-holding-org/kern
Began moving to C. (No C yet)
If you want to build the assembly version, run the buildAsm.sh script Currently just setting up the bootloader.
This commit is contained in:
+53
-3
@@ -2,6 +2,8 @@
|
||||
[bits 16]
|
||||
[global start]
|
||||
|
||||
%define ENDL 0x0A, 0x0D
|
||||
|
||||
start:
|
||||
; Setup
|
||||
xor ax, ax
|
||||
@@ -17,7 +19,7 @@ start:
|
||||
mov si, bootMsg
|
||||
call print
|
||||
mov dl, byte [driveNumber]
|
||||
call printHex
|
||||
call printHexByte
|
||||
mov si, newline
|
||||
call print
|
||||
|
||||
@@ -84,13 +86,61 @@ readFail:
|
||||
cli
|
||||
hlt
|
||||
|
||||
%include "./src/lib/print.asm"
|
||||
;
|
||||
; Prints a string
|
||||
; si - Pointer to NULL terminated string
|
||||
;
|
||||
print:
|
||||
pusha
|
||||
mov ah, 0x0e
|
||||
mov bl, 0x1f
|
||||
mov bh, 0
|
||||
.loop:
|
||||
lodsb ; Load [si] into al; Increment si
|
||||
or al, al
|
||||
jz .done
|
||||
int 0x10
|
||||
jmp .loop
|
||||
.done:
|
||||
popa
|
||||
ret
|
||||
|
||||
;
|
||||
; Prints a hex byte
|
||||
; dl - Hex byte
|
||||
;
|
||||
printHexByte:
|
||||
pusha
|
||||
xor cx, cx
|
||||
mov bh, 0
|
||||
mov bl, 0x1f ; White on blue
|
||||
.loop:
|
||||
mov al, dl
|
||||
and al, 0xF0
|
||||
ror al, 4
|
||||
add al, '0'
|
||||
cmp al, '9'
|
||||
jle .hexNum
|
||||
add al, 7
|
||||
.hexNum:
|
||||
mov ah, 0x0e
|
||||
int 0x10
|
||||
inc cx
|
||||
cmp cx, 2
|
||||
je .done
|
||||
ror dl, 4
|
||||
jmp .loop
|
||||
.done:
|
||||
popa
|
||||
ret
|
||||
|
||||
driveNumber: db 0
|
||||
|
||||
bootMsg: db ENDL, "Booting kern.", ENDL, "Booting from drive ", 0
|
||||
bootMsg: db ENDL, "Booting kern.", ENDL, "Booting from drive 0x", 0
|
||||
diskErrorMsg: db "Disk Error!", ENDL, 0
|
||||
|
||||
newline: db ENDL
|
||||
|
||||
FILETAB_LOC equ 0x1000
|
||||
KERNEL_LOC equ 0x2000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user