Get loadf variables from the disk description table instead of hardcoding them, tidy up the make script a bit, add contributors to the copyright statement, and change the phrasing of the readme slightly.

This commit is contained in:
CrazyEttin 2021-06-24 18:34:41 +03:00
parent 5aa6bcb79c
commit 1758b807e0
6 changed files with 63 additions and 30 deletions

View File

@ -1,7 +1,7 @@
MIT License MIT License
=========== ===========
Copyright (c) 2021 CrazyEttin Copyright (c) 2021 CrazyEttin and contributors
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the copy of this software and associated documentation files (the

View File

@ -2,8 +2,8 @@ EttinOS
======= =======
EttinOS is a minimalist 16-bit DOS-like hobbyist operating system for 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 the IBM Personal Computer and compatible machines. Its git repository
https://ahti.space/git/crazyettin/EttinOS. can be found at https://ahti.space/git/crazyettin/EttinOS.
System requirements System requirements
------------------- -------------------

11
make.sh
View File

@ -1,10 +1,7 @@
#!/bin/sh #!/bin/sh
rm -f EttinOS.img rm -f EttinOS.img
if [ ! -d "bin" ] mkdir -p bin
then
mkdir bin
fi
cd src/ cd src/
if [ "$1" = "-1440" ] if [ "$1" = "-1440" ]
@ -16,13 +13,13 @@ nasm HELLO.ASM -f bin -o ../bin/HELLO.BIN
cd .. cd ..
if [ "$1" = "-1440" ] if [ "$1" = "-1440" ]
then mkfs.fat -C EttinOS.img 1440 then mkfs.fat -C EttinOS.img 1440 1>/dev/null
else mkfs.fat -C EttinOS.img 360 else mkfs.fat -C EttinOS.img 360 1>/dev/null
fi fi
if which rw > /dev/null 2>&1 if which rw > /dev/null 2>&1
then rw -i bin/BOOT.BIN -o EttinOS.img -b 512 -c 1x 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 fi
mcopy -i EttinOS.img bin/SYSTEM.BIN :: mcopy -i EttinOS.img bin/SYSTEM.BIN ::
mcopy -i EttinOS.img bin/HELLO.BIN :: mcopy -i EttinOS.img bin/HELLO.BIN ::

View File

@ -63,7 +63,7 @@ cli
mov sp, 0x0 mov sp, 0x0
sti sti
;Store the boot drive number ;Store the boot drive number
mov [bootdrive], dl mov [drive], dl
;Load the root ;Load the root
;Set the source ;Set the source
@ -202,11 +202,13 @@ boot:
;Clear ;Clear
pop cx pop cx
pop bx pop bx
;Pass the drive number to the system
mov dl, byte [drive]
;Boot ;Boot
jmp 0x0:0x500 jmp 0x0:0x500
;Data ;Data
bootdrive db 0x0 drive db 0x0
sysfile db "SYSTEM BIN" sysfile db "SYSTEM BIN"
errormsg db "System not found", 0xd, 0xa, 0x0 errormsg db "System not found", 0xd, 0xa, 0x0
cluster dw 0x0 cluster dw 0x0
@ -230,7 +232,7 @@ mov dh, dl
mov ch, al mov ch, al
pop bx pop bx
pop ax pop ax
mov dl, byte [bootdrive] mov dl, byte [drive]
ret ret
;Pad the binary to a full sector and make the disk bootable ;Pad the binary to a full sector and make the disk bootable

View File

@ -67,6 +67,39 @@ jmp .done
.load: .load:
pop ax 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 ;Load the root
;Set the source ;Set the source
mov ah, 0x0 mov ah, 0x0
@ -219,21 +252,18 @@ mov al, 0x1
iret iret
;Data ;Data
.file times 0xb db 0x20 .sectorsize dw 0x0 ;bytes
.errormsg db "File not found", 0x0 .clustersize db 0x0 ;sectors
.cluster dw 0x0 .bootsectors dw 0x0
.pointer dw 0x0 .fats db 0x0
.rootentries dw 0x0
;These are temporary until i write something to load them from the disk itself .sectorsperfat dw 0x0
.bootdrive db 0x0 .sectorspertrack dw 0x0
.sectorsize dw 0x200 ;bytes .sides dw 0x0
.clustersize db 0x2 ;sectors .file times 0xb db 0x20
.bootsectors dw 0x1 .errormsg db "File not found", 0x0
.fats db 0x2 .cluster dw 0x0
.rootentries dw 0x70 .pointer dw 0x0
.sectorsperfat dw 0x2
.sectorspertrack dw 0x9
.sides dw 0x2
;Check the file name and convert to upper case ;Check the file name and convert to upper case
.checkconv: .checkconv:
@ -278,7 +308,7 @@ sub al, 0x20
.storech: .storech:
;Store the character ;Store the character
stosb stosb
;Increase the counter ;Decrease the counter
dec bl dec bl
ret ret
@ -300,5 +330,5 @@ mov dh, dl
mov ch, al mov ch, al
pop bx pop bx
pop ax pop ax
mov dl, byte [.bootdrive] mov dl, byte [drive]
ret ret

View File

@ -50,6 +50,9 @@ mov [0x82], ax
mov [0x86], ax mov [0x86], ax
mov [0x8a], ax mov [0x8a], ax
;Store the boot drive number
mov [drive], dl
;Print a welcome message ;Print a welcome message
mov si, welcomemsg mov si, welcomemsg
mov ah, 0x2 mov ah, 0x2
@ -102,6 +105,7 @@ int 0x21
jmp shell jmp shell
;Data ;Data
drive db 0x0
welcomemsg db 0xd, 0xa, "Welcome to EttinOS!", 0xd, 0xa, 0x0 welcomemsg db 0xd, 0xa, "Welcome to EttinOS!", 0xd, 0xa, 0x0
prompt db "> ", 0x0 prompt db "> ", 0x0
errormsg db "Unknown command", 0x0 errormsg db "Unknown command", 0x0