Write echo, update the readme with information on how the commands work, and replace a lodsb stosb loop in the shell with a movsb one.

This commit is contained in:
CrazyEttin 2021-06-25 20:24:38 +03:00
parent 001faba978
commit 92d93714bd
5 changed files with 42 additions and 13 deletions

View File

@ -19,10 +19,10 @@ Building
Build dependencies: Build dependencies:
* A Unix-like operating system * A Unix-like operating system
* coreutils * coreutils
* rw (optional)
* dosfstools * dosfstools
* mtools * mtools
* nasm * nasm
* rw (optional)
Running make.sh will build EttinOS and create a bootable 360 KiB 5.25" Running make.sh will build EttinOS and create a bootable 360 KiB 5.25"
floppy disk image named EttinOS.img. To get a 1.44 MB 3.5" one instead floppy disk image named EttinOS.img. To get a 1.44 MB 3.5" one instead
@ -37,14 +37,32 @@ The EttinOS 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.
Commands
--------
EttinOS commands consist of the case-insensitive command itself followed
by a tail separated with a space. Extra spaces, be they leading,
trailing, or between a command and its tail, are ignored. What the tail
contains and how it should be formatted depends on the command. Tails on
commands that do not use them are ignored. All commands except for
changing the drive are stored as external programs, and you must be on
the same drive as the program file to execute one. A command for a
program does not include its filename extension.
Commands included in EttinOS by default:
* [A-D]:: Changes the drive.
* ECHO: Echoes its tail.
* HELLO: A hello world program.
Programming Programming
----------- -----------
EttinOS has a flat address space of 64 KiB. The data, stack, and EttinOS has a flat address space of 64 KiB. The data, stack, and
extra segments are set at the beginning of the RAM and the system stack extra segments are set at the beginning of the RAM and the system stack
at the end of the address space. Programs are loaded at address 0x2000. at the end of the address space. Programs are loaded at address 0x2000
The stack is reset back to the end of the address space after a program and SI is pointed at the command tail, a string ending in a null, when
has finished running. the program is executed. The stack is reset back to the end of the
address space after a program has finished running.
System calls: System calls:
* Interrupt 0x20: Return to the shell. * Interrupt 0x20: Return to the shell.

View File

@ -9,6 +9,7 @@ if [ "$1" = "-1440" ]
else nasm BOOT.ASM -f bin -o ../bin/BOOT.BIN else nasm BOOT.ASM -f bin -o ../bin/BOOT.BIN
fi fi
nasm SYSTEM.ASM -f bin -o ../bin/SYSTEM.BIN nasm SYSTEM.ASM -f bin -o ../bin/SYSTEM.BIN
nasm ECHO.ASM -f bin -o ../bin/ECHO.BIN
nasm HELLO.ASM -f bin -o ../bin/HELLO.BIN nasm HELLO.ASM -f bin -o ../bin/HELLO.BIN
cd .. cd ..
@ -22,6 +23,7 @@ if which rw > /dev/null 2>&1
else dd if=bin/BOOT.BIN of=EttinOS.img conv=notrunc bs=512 count=1 1>/dev/null 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 README.MD :: mcopy -i EttinOS.img README.MD ::
mcopy -i EttinOS.img LICENSE.MD :: mcopy -i EttinOS.img LICENSE.MD ::
mcopy -i EttinOS.img bin/ECHO.BIN ::
mcopy -i EttinOS.img bin/HELLO.BIN ::

12
src/ECHO.ASM Normal file
View File

@ -0,0 +1,12 @@
CPU 8086
ORG 0x2000
;Echoes its command tail
;Check for an empty tail
cmp byte [si], 0x0
je done
;Echo
mov ah, 0x2
int 0x21
done:
int 0x20

View File

@ -22,10 +22,10 @@ sub di, 0xb
;Convert .file into FAT formatting ;Convert .file into FAT formatting
;Initialise the length counter for the main part of the name ;Initialise the length counter for the main part of the filename
mov bl, 0x8 mov bl, 0x8
;Convert the main part of the file name ;Convert the main part of the filename
.nameloop: .nameloop:
;Load a character ;Load a character
lodsb lodsb
@ -53,7 +53,7 @@ pop ax
call .checkconv call .checkconv
jmp .extloop jmp .extloop
;Set the carry flag if the file name is invalid ;Set the carry flag if the filename is invalid
.error: .error:
pop ax pop ax
stc stc
@ -260,7 +260,7 @@ iret
.cluster dw 0x0 .cluster dw 0x0
.pointer dw 0x0 .pointer dw 0x0
;Check the file name and convert to upper case ;Check the filename and convert to upper case
.checkconv: .checkconv:
;Check for the string end ;Check for the string end
cmp al, 0x0 cmp al, 0x0

View File

@ -126,10 +126,7 @@ addext:
push si push si
mov si, extension mov si, extension
mov cx, 0x5 mov cx, 0x5
.loop: rep movsb
lodsb
stosb
loop .loop
;Load and execute the program ;Load and execute the program
;Load ;Load