diff --git a/Makefile b/Makefile index d8fd161..07f2fd0 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,6 @@ image: bin: nasm -f bin -o boot.bin boot.asm + +run: prog + qemu-system-x86_64 dittoOS.img \ No newline at end of file diff --git a/boot.asm b/boot.asm index 3536a72..9d30080 100644 --- a/boot.asm +++ b/boot.asm @@ -1,5 +1,7 @@ BITS 16 +main + start: mov ax, 07C0h ; Set up 4K stack space after this bootloader add ax, 288 ; (4096 + 512) / 16 bytes per paragraph @@ -7,24 +9,23 @@ start: mov sp, 4096 mov ax, 07C0h ; Set data segment to where we're loaded + add ax, 1000 mov ds, ax - mov si, text_string ; Put string position into SI - call print_string ; Call our string-printing routine - - mov ah, 1h ; Read Char (Saved in al) - int 21h ; Execute - mov dl, al ; copy char to dl - - mov ah, 2h ; Write char - int 21h ; Execute - - jmp $ ; Jump here - infinite loop! +main_loop: + call read_char + jmp main_loop ; Jump here - infinite loop! text_string db 'Loading kernel', 0 +read_char: + mov ah, 0h + int 16h + mov ah, 0eh + int 10h + print_string: ; Routine: output string in SI to screen mov ah, 0Eh ; int 10h 'print char' function diff --git a/boot.elf b/boot.elf new file mode 100644 index 0000000..fff3f88 Binary files /dev/null and b/boot.elf differ