Browse Source

initial commit

compile-me
garritfra 5 years ago
commit
010d0b5e1f
  1. 2
      .gitignore
  2. 7
      Makefile
  3. 37
      boot.asm
  4. 1
      run.sh

2
.gitignore vendored

@ -0,0 +1,2 @@
boot.bin
dittoOS.img

7
Makefile

@ -0,0 +1,7 @@
prog: bin image
image:
dd status=noxfer conv=notrunc if=boot.bin of=dittoOS.img
bin:
nasm -f bin -o boot.bin boot.asm

37
boot.asm

@ -0,0 +1,37 @@
BITS 16
start:
mov ax, 07C0h ; Set up 4K stack space after this bootloader
add ax, 288 ; (4096 + 512) / 16 bytes per paragraph
mov ss, ax
mov sp, 4096
mov ax, 07C0h ; Set data segment to where we're loaded
mov ds, ax
mov si, text_string ; Put string position into SI
call print_string ; Call our string-printing routine
jmp $ ; Jump here - infinite loop!
text_string db 'This is my cool new OS!', 0
print_string: ; Routine: output string in SI to screen
mov ah, 0Eh ; int 10h 'print char' function
.repeat:
lodsb ; Get character from string
cmp al, 0
je .done ; If char is zero, end of string
int 10h ; Otherwise, print it
jmp .repeat
.done:
ret
times 510-($-$$) db 0 ; Pad remainder of boot sector with 0s
dw 0xAA55 ; The standard PC boot signature

1
run.sh

@ -0,0 +1 @@
qemu-system-x86_64 -fda dittoOS.flp
Loading…
Cancel
Save