diff --git a/LICENSE.MD b/LICENSE.MD index 3bdaf2c..ce4ff25 100644 --- a/LICENSE.MD +++ b/LICENSE.MD @@ -1,7 +1,7 @@ MIT License =========== -Copyright (c) 2021 CrazyEttin +Copyright (c) 2021 CrazyEttin and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/README.MD b/README.MD index 4962cba..6f3eb58 100644 --- a/README.MD +++ b/README.MD @@ -2,8 +2,8 @@ EttinOS ======= EttinOS is a minimalist 16-bit DOS-like hobbyist operating system for -the IBM PC and compatible computers. Its git repository can be found at -https://ahti.space/git/crazyettin/EttinOS. +the IBM Personal Computer and compatible machines. Its git repository +can be found at https://ahti.space/git/crazyettin/EttinOS. System requirements ------------------- diff --git a/make.sh b/make.sh index cc36597..a6b996d 100755 --- a/make.sh +++ b/make.sh @@ -1,10 +1,7 @@ #!/bin/sh rm -f EttinOS.img -if [ ! -d "bin" ] -then - mkdir bin -fi +mkdir -p bin cd src/ if [ "$1" = "-1440" ] @@ -16,13 +13,13 @@ nasm HELLO.ASM -f bin -o ../bin/HELLO.BIN cd .. if [ "$1" = "-1440" ] - then mkfs.fat -C EttinOS.img 1440 - else mkfs.fat -C EttinOS.img 360 + then mkfs.fat -C EttinOS.img 1440 1>/dev/null + else mkfs.fat -C EttinOS.img 360 1>/dev/null fi if which rw > /dev/null 2>&1 then rw -i bin/BOOT.BIN -o EttinOS.img -b 512 -c 1x - else dd if=bin/BOOT.BIN of=EttinOS.img conv=notrunc bs=512 count=1 + else dd if=bin/BOOT.BIN of=EttinOS.img conv=notrunc bs=512 count=1 1>/dev/null fi mcopy -i EttinOS.img bin/SYSTEM.BIN :: mcopy -i EttinOS.img bin/HELLO.BIN :: diff --git a/src/BOOT.ASM b/src/BOOT.ASM index ffa9f04..3c4349e 100644 --- a/src/BOOT.ASM +++ b/src/BOOT.ASM @@ -63,7 +63,7 @@ cli mov sp, 0x0 sti ;Store the boot drive number -mov [bootdrive], dl +mov [drive], dl ;Load the root ;Set the source @@ -202,11 +202,13 @@ boot: ;Clear pop cx pop bx +;Pass the drive number to the system +mov dl, byte [drive] ;Boot jmp 0x0:0x500 ;Data -bootdrive db 0x0 +drive db 0x0 sysfile db "SYSTEM BIN" errormsg db "System not found", 0xd, 0xa, 0x0 cluster dw 0x0 @@ -230,7 +232,7 @@ mov dh, dl mov ch, al pop bx pop ax -mov dl, byte [bootdrive] +mov dl, byte [drive] ret ;Pad the binary to a full sector and make the disk bootable diff --git a/src/LOADF.INC b/src/LOADF.INC index 2edde77..6d8b8d0 100644 --- a/src/LOADF.INC +++ b/src/LOADF.INC @@ -67,6 +67,39 @@ jmp .done .load: pop ax +;Load the disk description table +;Set the source +mov dl, [drive] +mov ch, 0x0 +mov dh, 0x0 +mov cl, 0x1 +;Set the destination +mov si, buffer +mov bx, si +;Set the size +mov al, 0x1 +;Load +mov ah, 0x2 +int 0x13 + +;Store the disk values used for the rest of the call +mov ax, word [buffer + 0xb] +mov word [.sectorsize], ax +mov al, byte [buffer + 0xd] +mov byte [.clustersize], al +mov ax, word [buffer + 0xe] +mov word [.bootsectors], ax +mov al, byte [buffer + 0x10] +mov byte [.fats], al +mov ax, word [buffer + 0x11] +mov word [.rootentries], ax +mov ax, word [buffer + 0x16] +mov word [.sectorsperfat], ax +mov ax, word [buffer + 0x18] +mov word [.sectorspertrack], ax +mov ax, word [buffer + 0x1a] +mov word [.sides], ax + ;Load the root ;Set the source mov ah, 0x0 @@ -219,21 +252,18 @@ mov al, 0x1 iret ;Data -.file times 0xb db 0x20 -.errormsg db "File not found", 0x0 -.cluster dw 0x0 -.pointer dw 0x0 - -;These are temporary until i write something to load them from the disk itself -.bootdrive db 0x0 -.sectorsize dw 0x200 ;bytes -.clustersize db 0x2 ;sectors -.bootsectors dw 0x1 -.fats db 0x2 -.rootentries dw 0x70 -.sectorsperfat dw 0x2 -.sectorspertrack dw 0x9 -.sides dw 0x2 +.sectorsize dw 0x0 ;bytes +.clustersize db 0x0 ;sectors +.bootsectors dw 0x0 +.fats db 0x0 +.rootentries dw 0x0 +.sectorsperfat dw 0x0 +.sectorspertrack dw 0x0 +.sides dw 0x0 +.file times 0xb db 0x20 +.errormsg db "File not found", 0x0 +.cluster dw 0x0 +.pointer dw 0x0 ;Check the file name and convert to upper case .checkconv: @@ -278,7 +308,7 @@ sub al, 0x20 .storech: ;Store the character stosb -;Increase the counter +;Decrease the counter dec bl ret @@ -300,5 +330,5 @@ mov dh, dl mov ch, al pop bx pop ax -mov dl, byte [.bootdrive] +mov dl, byte [drive] ret diff --git a/src/SYSTEM.ASM b/src/SYSTEM.ASM index 3e09df3..a76ff1b 100644 --- a/src/SYSTEM.ASM +++ b/src/SYSTEM.ASM @@ -50,6 +50,9 @@ mov [0x82], ax mov [0x86], ax mov [0x8a], ax +;Store the boot drive number +mov [drive], dl + ;Print a welcome message mov si, welcomemsg mov ah, 0x2 @@ -102,6 +105,7 @@ int 0x21 jmp shell ;Data +drive db 0x0 welcomemsg db 0xd, 0xa, "Welcome to EttinOS!", 0xd, 0xa, 0x0 prompt db "> ", 0x0 errormsg db "Unknown command", 0x0