forked from crazyettin/EttinOS
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:
parent
001faba978
commit
92d93714bd
5 changed files with 42 additions and 13 deletions
26
README.MD
26
README.MD
|
@ -19,10 +19,10 @@ Building
|
|||
Build dependencies:
|
||||
* A Unix-like operating system
|
||||
* coreutils
|
||||
* rw (optional)
|
||||
* dosfstools
|
||||
* mtools
|
||||
* nasm
|
||||
* rw (optional)
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
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
|
||||
-----------
|
||||
|
||||
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
|
||||
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
|
||||
has finished running.
|
||||
at the end of the address space. Programs are loaded at address 0x2000
|
||||
and SI is pointed at the command tail, a string ending in a null, when
|
||||
the program is executed. The stack is reset back to the end of the
|
||||
address space after a program has finished running.
|
||||
|
||||
System calls:
|
||||
* Interrupt 0x20: Return to the shell.
|
||||
|
|
4
make.sh
4
make.sh
|
@ -9,6 +9,7 @@ if [ "$1" = "-1440" ]
|
|||
else nasm BOOT.ASM -f bin -o ../bin/BOOT.BIN
|
||||
fi
|
||||
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
|
||||
|
||||
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
|
||||
fi
|
||||
mcopy -i EttinOS.img bin/SYSTEM.BIN ::
|
||||
mcopy -i EttinOS.img bin/HELLO.BIN ::
|
||||
mcopy -i EttinOS.img README.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
12
src/ECHO.ASM
Normal 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
|
|
@ -22,10 +22,10 @@ sub di, 0xb
|
|||
|
||||
;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
|
||||
|
||||
;Convert the main part of the file name
|
||||
;Convert the main part of the filename
|
||||
.nameloop:
|
||||
;Load a character
|
||||
lodsb
|
||||
|
@ -53,7 +53,7 @@ pop ax
|
|||
call .checkconv
|
||||
jmp .extloop
|
||||
|
||||
;Set the carry flag if the file name is invalid
|
||||
;Set the carry flag if the filename is invalid
|
||||
.error:
|
||||
pop ax
|
||||
stc
|
||||
|
@ -260,7 +260,7 @@ iret
|
|||
.cluster dw 0x0
|
||||
.pointer dw 0x0
|
||||
|
||||
;Check the file name and convert to upper case
|
||||
;Check the filename and convert to upper case
|
||||
.checkconv:
|
||||
;Check for the string end
|
||||
cmp al, 0x0
|
||||
|
|
|
@ -126,10 +126,7 @@ addext:
|
|||
push si
|
||||
mov si, extension
|
||||
mov cx, 0x5
|
||||
.loop:
|
||||
lodsb
|
||||
stosb
|
||||
loop .loop
|
||||
rep movsb
|
||||
|
||||
;Load and execute the program
|
||||
;Load
|
||||
|
|
Loading…
Reference in a new issue