Compare commits
1 Commits
abe578882f
...
b34b0ea74e
Author | SHA1 | Date |
---|---|---|
CrazyEttin | b34b0ea74e |
47
README.MD
47
README.MD
|
@ -1,9 +1,9 @@
|
||||||
EttinOS
|
EttinOS
|
||||||
=======
|
=======
|
||||||
|
|
||||||
EttinOS is a minimalist 16-bit DOS-like hobbyist operating system for
|
EttinOS is a minimalist 16-bit hobbyist disk operating system for the
|
||||||
the IBM Personal Computer and compatible machines. Its git repository
|
IBM Personal Computer and compatible machines. Its git repository can be
|
||||||
can be found at https://ahti.space/git/crazyettin/EttinOS and that of
|
found at https://ahti.space/git/crazyettin/EttinOS and that of
|
||||||
EttinOS-extra, a collection of programs for the system, at
|
EttinOS-extra, a collection of programs for the system, at
|
||||||
https://ahti.space/git/crazyettin/EttinOS-extra.
|
https://ahti.space/git/crazyettin/EttinOS-extra.
|
||||||
|
|
||||||
|
@ -39,13 +39,11 @@ The input system is inspired by typewriters. Typing a character
|
||||||
overwrites the cursor location and the erase (=tab) key erases it. The
|
overwrites the cursor location and the erase (=tab) key erases it. The
|
||||||
space and backspace keys move the cursor.
|
space and backspace keys move the cursor.
|
||||||
|
|
||||||
EttinOS assigns the drives letters from A to D and uses the FAT12 file
|
EttinOS assigns the drives letters from A to D and uses a version of the
|
||||||
system. The hidden and total sectors entries of the BIOS parameter
|
MS-DOS 3.0 FAT12 file system (in actual use since 2.1) without support
|
||||||
block, the entire extended BIOS parameter block, file attributes, and
|
for file attributes and thus disk labels and subdirectories. Drive
|
||||||
the file access date are not supported and are ignored if present: as a
|
letters and file names are case-insensitive and the latter follow the
|
||||||
result disk labels and subdirectories are not supported. Drive letters
|
8.3 format. Text files use CRLF line endings.
|
||||||
and file names are case-insensitive and the latter follow the 8.3
|
|
||||||
format. Text files use CRLF line endings.
|
|
||||||
|
|
||||||
Drives and files are specified as ([A-D]:) and ([A-D]:)FILENAME.EXT
|
Drives and files are specified as ([A-D]:) and ([A-D]:)FILENAME.EXT
|
||||||
respectively. Specifying the current drive, indicated in the prompt, is
|
respectively. Specifying the current drive, indicated in the prompt, is
|
||||||
|
@ -53,11 +51,11 @@ optional.
|
||||||
|
|
||||||
A command can be followed by arguments separated from eachother and the
|
A command can be followed by arguments separated from eachother and the
|
||||||
command with spaces. Extra spaces are ignored. Commands other than
|
command with spaces. Extra spaces are ignored. Commands other than
|
||||||
changing the drive are stored as external programs: the command for a
|
changing the current drive are stored as external programs: the command
|
||||||
program is its file specification without the extension.
|
for a program is its file specification without the extension.
|
||||||
|
|
||||||
Commands included in EttinOS:
|
Commands included in EttinOS:
|
||||||
* [A-D]:: Change the drive.
|
* [A-D]:: Change the current drive.
|
||||||
* ECHO: Print a message. Syntax: ECHO Message to be printed
|
* ECHO: Print a message. Syntax: ECHO Message to be printed
|
||||||
* HELLO: Print "Hello world!".
|
* HELLO: Print "Hello world!".
|
||||||
* LIST: Print a list of the files on a drive. Syntax: LIST DRIVE
|
* LIST: Print a list of the files on a drive. Syntax: LIST DRIVE
|
||||||
|
@ -80,7 +78,7 @@ has finished running.
|
||||||
|
|
||||||
System calls:
|
System calls:
|
||||||
* Interrupt 0x20: Return to the shell.
|
* Interrupt 0x20: Return to the shell.
|
||||||
* Interrupt 0x21: Input and output:
|
* Interrupt 0x21: String operations:
|
||||||
* AH = 0x0: Print a string ending in a null from SI.
|
* AH = 0x0: Print a string ending in a null from SI.
|
||||||
* AH = 0x1: Read a string ending in a null of at most AL
|
* AH = 0x1: Read a string ending in a null of at most AL
|
||||||
characters to DI until a return.
|
characters to DI until a return.
|
||||||
|
@ -88,8 +86,25 @@ System calls:
|
||||||
CRLF.
|
CRLF.
|
||||||
* AH = 0x3: Read a string ending in a null of at most AL
|
* AH = 0x3: Read a string ending in a null of at most AL
|
||||||
characters to DI until a return and print a CRLF.
|
characters to DI until a return and print a CRLF.
|
||||||
|
* AH = 0x4: (Under construction) Convert a decimal string ending
|
||||||
|
in a null at SI to a value in AL.
|
||||||
|
* AH = 0x5: (Under construction) Convert a value in AL to a
|
||||||
|
decimal string ending in a null at DI.
|
||||||
|
* AH = 0x6: (Under construction) Convert a hexadecimal string
|
||||||
|
ending in a null at SI to a value in AL.
|
||||||
|
* AH = 0x7: (Under construction) Convert a value in AL to a
|
||||||
|
hexadecimal string ending in a null at DI.
|
||||||
* Interrupt 0x22: Disk operations:
|
* Interrupt 0x22: Disk operations:
|
||||||
* AH = 0x0: Load a file named at SI as a string ending in a null
|
* AH = 0x0: (Under construction) Load the directory of a drive
|
||||||
|
named at SI as a string ending in a null to the offset
|
||||||
|
BX and store the error codes in AL:
|
||||||
|
* AL = 0x0: Succesful load
|
||||||
|
* AL = 0x1: Drive not found
|
||||||
|
* AL = 0x2: Unable to read disk
|
||||||
|
* AH = 0x1: (Under construction) Store a directory at the offset
|
||||||
|
BX to a drive named at SI as a string ending in a
|
||||||
|
null.
|
||||||
|
* AH = 0x2: Load a file named at SI as a string ending in a null
|
||||||
to the offset BX and store the file size in CX and the
|
to the offset BX and store the file size in CX and the
|
||||||
error codes in AL:
|
error codes in AL:
|
||||||
* AL = 0x0: Succesful load
|
* AL = 0x0: Succesful load
|
||||||
|
@ -97,7 +112,7 @@ System calls:
|
||||||
* AL = 0x2: Unable to read disk
|
* AL = 0x2: Unable to read disk
|
||||||
* AL = 0x4: File or command not found
|
* AL = 0x4: File or command not found
|
||||||
* AL = 0x8: Not enough memory
|
* AL = 0x8: Not enough memory
|
||||||
* AH = 0x1: Save a file (under construction).
|
* AH = 0x3: (Under construction) Save a file.
|
||||||
|
|
||||||
Known bugs
|
Known bugs
|
||||||
----------
|
----------
|
||||||
|
|
|
@ -23,6 +23,7 @@ mediadescriptor db 0xf0
|
||||||
sectorsperfat dw 0x9
|
sectorsperfat dw 0x9
|
||||||
sectorspertrack dw 0x12
|
sectorspertrack dw 0x12
|
||||||
heads dw 0x2
|
heads dw 0x2
|
||||||
|
hiddensectors dw 0x0
|
||||||
|
|
||||||
%else
|
%else
|
||||||
|
|
||||||
|
@ -37,10 +38,10 @@ mediadescriptor db 0xfd
|
||||||
sectorsperfat dw 0x2
|
sectorsperfat dw 0x2
|
||||||
sectorspertrack dw 0x9
|
sectorspertrack dw 0x9
|
||||||
heads dw 0x2
|
heads dw 0x2
|
||||||
|
hiddensectors dw 0x0
|
||||||
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
;Setup
|
;Setup
|
||||||
;Set the segments
|
;Set the segments
|
||||||
start:
|
start:
|
||||||
|
|
|
@ -16,8 +16,8 @@ push di
|
||||||
|
|
||||||
;Store the current drive and offset
|
;Store the current drive and offset
|
||||||
mov word [.pointer], bx
|
mov word [.pointer], bx
|
||||||
mov dl, byte [drive]
|
mov dl, byte [curdrive]
|
||||||
mov byte [.drive], dl
|
mov byte [drive], dl
|
||||||
|
|
||||||
;Change the drive if needed
|
;Change the drive if needed
|
||||||
;Check for a drive specification
|
;Check for a drive specification
|
||||||
|
@ -53,7 +53,7 @@ mov cx, 0x0
|
||||||
jmp .done
|
jmp .done
|
||||||
;Change the drive
|
;Change the drive
|
||||||
.contchdrive:
|
.contchdrive:
|
||||||
mov [.drive], dl
|
mov [drive], dl
|
||||||
;Move to the file name
|
;Move to the file name
|
||||||
add si, 0x2
|
add si, 0x2
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ pop ax
|
||||||
|
|
||||||
;Load the disk description table
|
;Load the disk description table
|
||||||
;Set the source
|
;Set the source
|
||||||
mov dl, [.drive]
|
mov dl, [drive]
|
||||||
mov ch, 0x0
|
mov ch, 0x0
|
||||||
mov dh, 0x0
|
mov dh, 0x0
|
||||||
mov cl, 0x1
|
mov cl, 0x1
|
||||||
|
@ -136,48 +136,48 @@ jmp .done
|
||||||
;Store the disk values used for the rest of the call
|
;Store the disk values used for the rest of the call
|
||||||
.storevalues:
|
.storevalues:
|
||||||
mov ax, [buffer + 0xb]
|
mov ax, [buffer + 0xb]
|
||||||
mov [.sectorsize], ax
|
mov [sectorsize], ax
|
||||||
mov al, [buffer + 0xd]
|
mov al, [buffer + 0xd]
|
||||||
mov [.clustersize], al
|
mov [clustersize], al
|
||||||
mov ax, [buffer + 0xe]
|
mov ax, [buffer + 0xe]
|
||||||
mov [.reservedsectors], ax
|
mov [reservedsectors], ax
|
||||||
mov al, [buffer + 0x10]
|
mov al, [buffer + 0x10]
|
||||||
mov [.fats], al
|
mov [fats], al
|
||||||
mov ax, [buffer + 0x11]
|
mov ax, [buffer + 0x11]
|
||||||
mov [.rootentries], ax
|
mov [rootentries], ax
|
||||||
mov ax, [buffer + 0x16]
|
mov ax, [buffer + 0x16]
|
||||||
mov [.sectorsperfat], ax
|
mov [sectorsperfat], ax
|
||||||
mov ax, [buffer + 0x18]
|
mov ax, [buffer + 0x18]
|
||||||
mov [.sectorspertrack], ax
|
mov [sectorspertrack], ax
|
||||||
mov ax, [buffer + 0x1a]
|
mov ax, [buffer + 0x1a]
|
||||||
mov [.heads], ax
|
mov [heads], ax
|
||||||
|
|
||||||
;Calculate and store variables not found in the BPB
|
;Calculate and store variables not found in the BPB
|
||||||
;Start of the root
|
;Start of the root
|
||||||
mov ah, 0x0
|
mov ah, 0x0
|
||||||
mov al, [.fats]
|
mov al, [fats]
|
||||||
mul word [.sectorsperfat]
|
mul word [sectorsperfat]
|
||||||
add ax, [.reservedsectors]
|
add ax, [reservedsectors]
|
||||||
mov [.rootstart], ax
|
mov [rootstart], ax
|
||||||
;Size of the root in sectors
|
;Size of the root in sectors
|
||||||
mov ax, [.rootentries]
|
mov ax, [rootentries]
|
||||||
mov dx, 0x20
|
mov dx, 0x20
|
||||||
mul dx
|
mul dx
|
||||||
mov dx, 0x0
|
mov dx, 0x0
|
||||||
div word [.sectorsize]
|
div word [sectorsize]
|
||||||
mov [.rootsectors], ax
|
mov [rootsectors], ax
|
||||||
;Start of data
|
;Start of data
|
||||||
add ax, [.rootstart]
|
add ax, [rootstart]
|
||||||
mov [.datastart], ax
|
mov [datastart], ax
|
||||||
|
|
||||||
;Load the root
|
;Load the root
|
||||||
;Set the source
|
;Set the source
|
||||||
mov ax, [.rootstart]
|
mov ax, [rootstart]
|
||||||
;Set the destination
|
;Set the destination
|
||||||
mov si, buffer
|
mov si, buffer
|
||||||
mov bx, si
|
mov bx, si
|
||||||
;Set the size
|
;Set the size
|
||||||
mov cx, [.rootsectors]
|
mov cx, [rootsectors]
|
||||||
;Store the source and the loop counter in the stack
|
;Store the source and the loop counter in the stack
|
||||||
.loadrootsector:
|
.loadrootsector:
|
||||||
push ax
|
push ax
|
||||||
|
@ -194,7 +194,7 @@ pop cx
|
||||||
pop ax
|
pop ax
|
||||||
;Set the next sector
|
;Set the next sector
|
||||||
add ax, 0x1
|
add ax, 0x1
|
||||||
add bx, word [.sectorsize]
|
add bx, word [sectorsize]
|
||||||
;Load the next sector
|
;Load the next sector
|
||||||
loop .loadrootsector
|
loop .loadrootsector
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ loop .loadrootsector
|
||||||
;Set DI to the root
|
;Set DI to the root
|
||||||
mov di, buffer
|
mov di, buffer
|
||||||
;Set the number of root entries
|
;Set the number of root entries
|
||||||
mov cx, word [.rootentries]
|
mov cx, word [rootentries]
|
||||||
;Set the entry pointer
|
;Set the entry pointer
|
||||||
mov ax, 0x0
|
mov ax, 0x0
|
||||||
;Store the loop counter in the stack
|
;Store the loop counter in the stack
|
||||||
|
@ -238,8 +238,8 @@ cmp word [di + 0x13], 0x0
|
||||||
jne .sizerror
|
jne .sizerror
|
||||||
;Get the cluster size in bytes
|
;Get the cluster size in bytes
|
||||||
mov ah, 0x0
|
mov ah, 0x0
|
||||||
mov al, [.clustersize]
|
mov al, [clustersize]
|
||||||
mul word [.sectorsize]
|
mul word [sectorsize]
|
||||||
mov bx, ax
|
mov bx, ax
|
||||||
;Store the file size
|
;Store the file size
|
||||||
mov ax, [di + 0x11]
|
mov ax, [di + 0x11]
|
||||||
|
@ -267,12 +267,12 @@ jmp .done
|
||||||
mov ax, [di + 0xf]
|
mov ax, [di + 0xf]
|
||||||
mov [.cluster], ax
|
mov [.cluster], ax
|
||||||
;Set the source
|
;Set the source
|
||||||
mov ax, [.reservedsectors]
|
mov ax, [reservedsectors]
|
||||||
call .calcsource
|
call .calcsource
|
||||||
;Set the destination
|
;Set the destination
|
||||||
mov bx, buffer
|
mov bx, buffer
|
||||||
;Set the size
|
;Set the size
|
||||||
mov ax, [.sectorsperfat]
|
mov ax, [sectorsperfat]
|
||||||
;Load the FAT
|
;Load the FAT
|
||||||
mov ah, 0x2
|
mov ah, 0x2
|
||||||
int 0x13
|
int 0x13
|
||||||
|
@ -282,13 +282,13 @@ int 0x13
|
||||||
;Set the source
|
;Set the source
|
||||||
mov ax, word [.cluster]
|
mov ax, word [.cluster]
|
||||||
sub ax, 0x2
|
sub ax, 0x2
|
||||||
mul byte [.clustersize]
|
mul byte [clustersize]
|
||||||
add ax, [.datastart]
|
add ax, [datastart]
|
||||||
;Set the destination
|
;Set the destination
|
||||||
mov bx, word [.pointer]
|
mov bx, word [.pointer]
|
||||||
;Set the size
|
;Set the size
|
||||||
mov ch, 0x0
|
mov ch, 0x0
|
||||||
mov cl, byte [.clustersize]
|
mov cl, byte [clustersize]
|
||||||
;Store the loop counter in the stack
|
;Store the loop counter in the stack
|
||||||
.loadsector:
|
.loadsector:
|
||||||
push cx
|
push cx
|
||||||
|
@ -303,7 +303,7 @@ int 0x13
|
||||||
pop ax
|
pop ax
|
||||||
;Set the next sector
|
;Set the next sector
|
||||||
add ax, 0x1
|
add ax, 0x1
|
||||||
add bx, word [.sectorsize]
|
add bx, word [sectorsize]
|
||||||
;Load the loop counter from the stack
|
;Load the loop counter from the stack
|
||||||
pop cx
|
pop cx
|
||||||
;Load the next sector
|
;Load the next sector
|
||||||
|
@ -335,8 +335,8 @@ jge .success
|
||||||
;Store the address of the next cluster
|
;Store the address of the next cluster
|
||||||
mov word [.cluster], ax
|
mov word [.cluster], ax
|
||||||
;Set the destination of the next cluster
|
;Set the destination of the next cluster
|
||||||
mov ax, [.sectorsize]
|
mov ax, [sectorsize]
|
||||||
mul word [.clustersize]
|
mul word [clustersize]
|
||||||
add word [.pointer], ax
|
add word [.pointer], ax
|
||||||
;Load the next cluster
|
;Load the next cluster
|
||||||
jmp .loadcluster
|
jmp .loadcluster
|
||||||
|
@ -362,18 +362,6 @@ mov ah, 0x0
|
||||||
iret
|
iret
|
||||||
|
|
||||||
;Data
|
;Data
|
||||||
.drive db 0x0
|
|
||||||
.sectorsize dw 0x0 ;bytes
|
|
||||||
.clustersize db 0x0 ;sectors
|
|
||||||
.reservedsectors dw 0x0
|
|
||||||
.fats db 0x0
|
|
||||||
.rootentries dw 0x0
|
|
||||||
.sectorsperfat dw 0x0
|
|
||||||
.sectorspertrack dw 0x0
|
|
||||||
.heads dw 0x0
|
|
||||||
.rootstart dw 0x0
|
|
||||||
.rootsectors dw 0x0
|
|
||||||
.datastart dw 0x0
|
|
||||||
.file times 0xb db 0x20
|
.file times 0xb db 0x20
|
||||||
.size dw 0x0
|
.size dw 0x0
|
||||||
.cluster dw 0x0
|
.cluster dw 0x0
|
||||||
|
@ -454,21 +442,21 @@ push bx
|
||||||
mov bx, ax
|
mov bx, ax
|
||||||
;Calculate the sector
|
;Calculate the sector
|
||||||
mov dx, 0x0
|
mov dx, 0x0
|
||||||
div word [.sectorspertrack]
|
div word [sectorspertrack]
|
||||||
add dl, 0x1
|
add dl, 0x1
|
||||||
mov cl, dl
|
mov cl, dl
|
||||||
;Load the logical sector from BX
|
;Load the logical sector from BX
|
||||||
mov ax, bx
|
mov ax, bx
|
||||||
;Calculate the head and cylinder
|
;Calculate the head and cylinder
|
||||||
mov dx, 0x0
|
mov dx, 0x0
|
||||||
div word [.sectorspertrack]
|
div word [sectorspertrack]
|
||||||
mov dx, 0x0
|
mov dx, 0x0
|
||||||
div word [.heads]
|
div word [heads]
|
||||||
mov dh, dl ;Head
|
mov dh, dl ;Head
|
||||||
mov ch, al ;Cylinder
|
mov ch, al ;Cylinder
|
||||||
|
|
||||||
;Load the drive number
|
;Load the drive number
|
||||||
mov dl, byte [.drive]
|
mov dl, byte [drive]
|
||||||
|
|
||||||
;Load BX and AX from the stack
|
;Load BX and AX from the stack
|
||||||
pop bx
|
pop bx
|
||||||
|
|
|
@ -40,7 +40,7 @@ stosb
|
||||||
;Load
|
;Load
|
||||||
load:
|
load:
|
||||||
mov bx, stack + 0x100
|
mov bx, stack + 0x100
|
||||||
mov ah, 0x0
|
mov ah, 0x2
|
||||||
int 0x22
|
int 0x22
|
||||||
;Check for errors
|
;Check for errors
|
||||||
cmp al, 0x0
|
cmp al, 0x0
|
||||||
|
|
|
@ -21,7 +21,7 @@ je readln
|
||||||
iret
|
iret
|
||||||
;Disk operations
|
;Disk operations
|
||||||
int0x22:
|
int0x22:
|
||||||
cmp ah, 0x0
|
cmp ah, 0x2
|
||||||
je loadf
|
je loadf
|
||||||
;To do: savef
|
;To do: savef
|
||||||
iret
|
iret
|
||||||
|
@ -50,9 +50,10 @@ mov [0x82], ax
|
||||||
mov [0x86], ax
|
mov [0x86], ax
|
||||||
mov [0x8a], ax
|
mov [0x8a], ax
|
||||||
|
|
||||||
;Store the boot drive number and set the drive letter
|
;Store the boot drive number as the current drive and set the current
|
||||||
mov [drive], dl
|
;drive letter
|
||||||
call setdriveletter
|
mov [curdrive], dl
|
||||||
|
call setcurdriveletter
|
||||||
|
|
||||||
;Print a welcome message
|
;Print a welcome message
|
||||||
mov si, welcomemsg
|
mov si, welcomemsg
|
||||||
|
@ -67,8 +68,8 @@ mov sp, 0x0
|
||||||
sti
|
sti
|
||||||
|
|
||||||
;Prompt for and read a command
|
;Prompt for and read a command
|
||||||
;Print the drive letter
|
;Print the current drive letter
|
||||||
mov si, driveletter
|
mov si, curdriveletter
|
||||||
mov ah, 0x0
|
mov ah, 0x0
|
||||||
int 0x21
|
int 0x21
|
||||||
;Print a prompt
|
;Print a prompt
|
||||||
|
@ -85,26 +86,24 @@ int 0x21
|
||||||
cmp byte [input], 0x0
|
cmp byte [input], 0x0
|
||||||
jz shell
|
jz shell
|
||||||
|
|
||||||
;Check for a drive change command
|
;Set SI at the command
|
||||||
;Set SI at input
|
;Set SI at input
|
||||||
mov si, input
|
mov si, input
|
||||||
;Ignore leading spaces
|
;Ignore leading spaces
|
||||||
call ignoreleading
|
call ignoreleading
|
||||||
;Check
|
|
||||||
|
;Check for a current drive change command
|
||||||
cmp byte [si + 0x1], ":"
|
cmp byte [si + 0x1], ":"
|
||||||
jne extract
|
jne extract
|
||||||
cmp byte [si + 0x2], 0x0
|
cmp byte [si + 0x2], 0x0
|
||||||
je changedrive
|
je changecurdrive
|
||||||
cmp byte [si + 0x2], 0x20
|
cmp byte [si + 0x2], 0x20
|
||||||
je changedrive
|
je changecurdrive
|
||||||
|
|
||||||
;Extract the specification of the program file
|
;Extract the specification of the program file
|
||||||
extract:
|
extract:
|
||||||
;Set SI at input and DI at program
|
;Set DI at program
|
||||||
mov si, input
|
|
||||||
mov di, program
|
mov di, program
|
||||||
;Ignore leading spaces
|
|
||||||
call ignoreleading
|
|
||||||
;Initialise program with spaces
|
;Initialise program with spaces
|
||||||
mov cx, 0xe
|
mov cx, 0xe
|
||||||
mov al, 0x20
|
mov al, 0x20
|
||||||
|
@ -142,21 +141,28 @@ rep movsb
|
||||||
;Load the program
|
;Load the program
|
||||||
mov bx, 0x3000
|
mov bx, 0x3000
|
||||||
mov si, program
|
mov si, program
|
||||||
mov ah, 0x0
|
mov ah, 0x2
|
||||||
int 0x22
|
int 0x22
|
||||||
;Check for errors
|
;Check for errors
|
||||||
cmp al, 0x0
|
cmp al, 0x0
|
||||||
jne shell
|
jne shell
|
||||||
;Pass the drive and command tail to the program
|
;Pass the current drive and command tail to the program
|
||||||
mov dl, [drive]
|
mov dl, [curdrive]
|
||||||
pop si
|
pop si
|
||||||
call ignoreleading
|
call ignoreleading
|
||||||
;Execute the program
|
;Execute the program
|
||||||
jmp 0x3000
|
jmp 0x3000
|
||||||
|
|
||||||
;Change the drive
|
;Print a command error message and return to the shell
|
||||||
|
cmderror:
|
||||||
|
mov si, cmderrormsg
|
||||||
|
mov ah, 0x2
|
||||||
|
int 0x21
|
||||||
|
jmp shell
|
||||||
|
|
||||||
|
;Change the current drive
|
||||||
;Get the BIOS equipment list
|
;Get the BIOS equipment list
|
||||||
changedrive:
|
changecurdrive:
|
||||||
int 0x11
|
int 0x11
|
||||||
;Get the number of floppy drives
|
;Get the number of floppy drives
|
||||||
times 0x6 shr ax, 0x1
|
times 0x6 shr ax, 0x1
|
||||||
|
@ -184,33 +190,44 @@ int 0x21
|
||||||
jmp shell
|
jmp shell
|
||||||
;Change the drive
|
;Change the drive
|
||||||
contchdrive:
|
contchdrive:
|
||||||
mov [drive], dl
|
mov [curdrive], dl
|
||||||
call setdriveletter
|
call setcurdriveletter
|
||||||
jmp shell
|
jmp shell
|
||||||
|
|
||||||
;Print a command error message and return to the shell
|
;Welcome message
|
||||||
cmderror:
|
welcomemsg db 0xd, 0xa, "Welcome to EttinOS!", 0xd, 0xa, 0x0
|
||||||
mov si, cmderrormsg
|
|
||||||
mov ah, 0x2
|
|
||||||
int 0x21
|
|
||||||
jmp shell
|
|
||||||
|
|
||||||
;Data
|
;Drive stuff
|
||||||
welcomemsg db 0xd, 0xa, "Welcome to EttinOS!", 0xd, 0xa, 0x0
|
curdrive db 0x0
|
||||||
drive db 0x0
|
|
||||||
driveletter db "?:", 0x0
|
|
||||||
driveletters db "AaBbCcDd"
|
driveletters db "AaBbCcDd"
|
||||||
prompt db "> ", 0x0
|
|
||||||
input times 0x4c db 0x0
|
;Shell
|
||||||
program times 0xf db 0x0
|
curdriveletter db "?:", 0x0
|
||||||
extension db ".BIN", 0x0
|
prompt db "> ", 0x0
|
||||||
cmderrormsg db "File or command not found", 0x0
|
input times 0x4c db 0x0
|
||||||
driverrormsg db "Drive not found", 0x0
|
program times 0xf db 0x0
|
||||||
|
extension db ".BIN", 0x0
|
||||||
|
cmderrormsg db "File or command not found", 0x0
|
||||||
|
driverrormsg db "Drive not found", 0x0
|
||||||
|
|
||||||
|
;Disk parameters
|
||||||
|
drive db 0x0
|
||||||
|
sectorsize dw 0x0 ;bytes
|
||||||
|
clustersize db 0x0 ;sectors
|
||||||
|
reservedsectors dw 0x0
|
||||||
|
fats db 0x0
|
||||||
|
rootentries dw 0x0
|
||||||
|
sectorsperfat dw 0x0
|
||||||
|
sectorspertrack dw 0x0
|
||||||
|
heads dw 0x0
|
||||||
|
rootstart dw 0x0
|
||||||
|
rootsectors dw 0x0
|
||||||
|
datastart dw 0x0
|
||||||
|
|
||||||
;***
|
;***
|
||||||
|
|
||||||
;Set the drive letter
|
;Set the drive letter
|
||||||
setdriveletter:
|
setcurdriveletter:
|
||||||
|
|
||||||
;Set the drive number and letter counters
|
;Set the drive number and letter counters
|
||||||
mov dh, 0x0
|
mov dh, 0x0
|
||||||
|
@ -227,7 +244,7 @@ jmp .checkdrive
|
||||||
;Set the drive letter
|
;Set the drive letter
|
||||||
.set:
|
.set:
|
||||||
mov al, [si]
|
mov al, [si]
|
||||||
mov byte [driveletter], al
|
mov byte [curdriveletter], al
|
||||||
|
|
||||||
;Return
|
;Return
|
||||||
ret
|
ret
|
||||||
|
|
Loading…
Reference in New Issue