diff --git a/yourfirstos/firstos.asm b/yourfirstos/firstos.asm new file mode 100644 index 0000000..8f66582 --- /dev/null +++ b/yourfirstos/firstos.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 Operating System!', 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 \ No newline at end of file diff --git a/yourfirstos/make-qemu.bat b/yourfirstos/make-qemu.bat new file mode 100644 index 0000000..39d7f9b --- /dev/null +++ b/yourfirstos/make-qemu.bat @@ -0,0 +1,2 @@ +..\ext\nasm\nasm -f bin -o os.flp firstos.asm +..\ext\qemu\qemu-system-x86_64.exe -L ..\ext\qemu -m 128 -fda os.flp \ No newline at end of file diff --git a/yourfirstos/make-qemu.sh b/yourfirstos/make-qemu.sh new file mode 100644 index 0000000..873c4b8 --- /dev/null +++ b/yourfirstos/make-qemu.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +nasm -f bin -o os.flp firstos.asm +qemu-system-x86_64.exe -m 128 -fda os.flp \ No newline at end of file diff --git a/yourfirstos/make-vb.bat b/yourfirstos/make-vb.bat new file mode 100644 index 0000000..173cc03 --- /dev/null +++ b/yourfirstos/make-vb.bat @@ -0,0 +1,15 @@ +@echo off +set vboxmanage="C:\Program Files\Oracle\VirtualBox\vboxmanage.exe" +set vboxname=os1_%COMPUTERNAME%_%USERNAME% +..\ext\nasm\nasm -f bin -o os.img firstos.asm +%vboxmanage% unregistervm %vboxname% --delete 2> nul +%vboxmanage% createvm --name %vboxname% --basefolder %CD% --register +%vboxmanage% modifyvm %vboxname% --memory "256" +%vboxmanage% modifyvm %vboxname% --bioslogodisplaytime "1" +%vboxmanage% storagectl %vboxname% --name Floppy --add floppy --bootable on +%vboxmanage% storageattach %vboxname% --device 0 --storagectl Floppy --type fdd --medium %CD%\os.img +%vboxmanage% startvm %vboxname% +pause +%vboxmanage% controlvm %vboxname% poweroff +timeout /t 2 /nobreak > NUL +%vboxmanage% unregistervm %vboxname% --delete diff --git a/yourfirstos/make-vb.sh b/yourfirstos/make-vb.sh new file mode 100644 index 0000000..ba639a1 --- /dev/null +++ b/yourfirstos/make-vb.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +vboxmanage=`which vboxmanage` +vboxname=os1_`hostname`_$USER +nasm -f bin -o os.img firstos.asm +$vboxmanage unregistervm $vboxname --delete 2> nul +$vboxmanage createvm --name $vboxname --basefolder $PWD --register +$vboxmanage modifyvm $vboxname --memory "256" +$vboxmanage modifyvm $vboxname --bioslogodisplaytime "1" +$vboxmanage storagectl $vboxname --name Floppy --add floppy --bootable on$PWD%CD%\os.img +$vboxmanage startvm $vboxname +pause +$vboxmanage controlvm $vboxname poweroff +timeout /t 2 /nobreak > NUL +$vboxmanage unregistervm $vboxname --delete \ No newline at end of file