aboutsummaryrefslogtreecommitdiffstats
path: root/src/programs.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-24 12:48:51 +0200
committeruser <user@clank>2026-09-24 12:48:51 +0200
commit65b53de14dc6918db39b6ee6dc032f805182daad (patch)
tree6af7b52262321a3cbe11e1d472ca2938df2fc37e /src/programs.asm
parentsh: run scripts, and >> redirection (diff)
downloadgbos-65b53de14dc6918db39b6ee6dc032f805182daad.tar.gz
gbos-65b53de14dc6918db39b6ee6dc032f805182daad.tar.xz
gbos-65b53de14dc6918db39b6ee6dc032f805182daad.zip
usr: ls -l, df, mv, tail, tee, sleep, help, poweroff
Filling in the core utilities the box was missing: - ls -l: type, links and size, now that stat() exists. The screen is 40 columns, so it is "d 1 256 name", not the GNU sprawl. Sizes were previously unknowable except one file at a time with wc -c. - df: blocks and inodes, used and free, on the 32 KiB cart disk. - mv: no rename syscall, so it is cp + rm - and the copy has to finish before the source goes, or a failure loses the file. - tail [-n N]: no seek syscall, so it streams the input through a ring of N lines rather than jumping to the end. N is capped by that ring. - tee: the missing half of a pipeline - `cat big | tee copy | wc -l`. - sleep: the thing every script needs; the kernel counts 1/64 s ticks. - help: lists every command the shell knows, walked out of the kernel's own name table. The box previously had no way to tell you what it could do. - poweroff: the only safe way to stop a gbos that has data on it. The cart's battery RAM is written when the emulator exits cleanly, so killing it loses the whole filesystem - it comes back "formatted". Found while testing /rc.
Diffstat (limited to 'src/programs.asm')
-rw-r--r--src/programs.asm49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/programs.asm b/src/programs.asm
index 0277dcc..11da2b1 100644
--- a/src/programs.asm
+++ b/src/programs.asm
@@ -157,6 +157,27 @@ ProgHttpd:
SECTION "prog_ircd", ROMX[$4000], BANK[40]
ProgIrcd:
INCBIN "build/usr/ircd.bin"
+SECTION "prog_df", ROMX[$4000], BANK[41]
+ProgDf:
+ INCBIN "build/usr/df.bin"
+SECTION "prog_mv", ROMX[$4000], BANK[42]
+ProgMv:
+ INCBIN "build/usr/mv.bin"
+SECTION "prog_sleep", ROMX[$4000], BANK[43]
+ProgSleep:
+ INCBIN "build/usr/sleep.bin"
+SECTION "prog_tee", ROMX[$4000], BANK[44]
+ProgTee:
+ INCBIN "build/usr/tee.bin"
+SECTION "prog_tail", ROMX[$4000], BANK[45]
+ProgTail:
+ INCBIN "build/usr/tail.bin"
+SECTION "prog_help", ROMX[$4000], BANK[46]
+ProgHelp:
+ INCBIN "build/usr/help.bin"
+SECTION "prog_poweroff", ROMX[$4000], BANK[47]
+ProgPoweroff:
+ INCBIN "build/usr/poweroff.bin"
; -----------------------------------------------------------------------------
; PROG_SH (bank 3) - the shell, now written in C (usr/sh.c): parses >/</| and
@@ -277,6 +298,20 @@ ProgramTable::
dw ProgHttpd
db LOW(BANK(ProgIrcd)), HIGH(BANK(ProgIrcd))
dw ProgIrcd
+ db LOW(BANK(ProgDf)), HIGH(BANK(ProgDf))
+ dw ProgDf
+ db LOW(BANK(ProgMv)), HIGH(BANK(ProgMv))
+ dw ProgMv
+ db LOW(BANK(ProgSleep)), HIGH(BANK(ProgSleep))
+ dw ProgSleep
+ db LOW(BANK(ProgTee)), HIGH(BANK(ProgTee))
+ dw ProgTee
+ db LOW(BANK(ProgTail)), HIGH(BANK(ProgTail))
+ dw ProgTail
+ db LOW(BANK(ProgHelp)), HIGH(BANK(ProgHelp))
+ dw ProgHelp
+ db LOW(BANK(ProgPoweroff)), HIGH(BANK(ProgPoweroff))
+ dw ProgPoweroff
ProgramTableEnd::
; -----------------------------------------------------------------------------
@@ -362,4 +397,18 @@ NameTable::
db PROG_HTTPD
db "ircd", 0
db PROG_IRCD
+ db "df", 0
+ db PROG_DF
+ db "mv", 0
+ db PROG_MV
+ db "sleep", 0
+ db PROG_SLEEP
+ db "tee", 0
+ db PROG_TEE
+ db "tail", 0
+ db PROG_TAIL
+ db "help", 0
+ db PROG_HELP
+ db "poweroff", 0
+ db PROG_POWEROFF
db 0