aboutsummaryrefslogtreecommitdiffstats
path: root/src/programs.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-24 13:56:42 +0200
committeruser <user@clank>2026-09-24 13:56:42 +0200
commit0fa1b946ec5fd3f5cba49215ea9ab62c4004aa53 (patch)
tree2d50213ab441f2543ba129241ceda29c5d9b496d /src/programs.asm
parentircd: enforce unique nicknames (433), announce renames, fold case (diff)
downloadgbos-0fa1b946ec5fd3f5cba49215ea9ab62c4004aa53.tar.gz
gbos-0fa1b946ec5fd3f5cba49215ea9ab62c4004aa53.tar.xz
gbos-0fa1b946ec5fd3f5cba49215ea9ab62c4004aa53.zip
usr: xxd - hex dump a file or stdin
Eight bytes per line rather than the usual sixteen: offset + 8 hex pairs + the ASCII column is 38 of the terminal's 40 columns, where 16 would wrap every line and make the dump unreadable. -c overrides it. No -s (skip): there is no seek syscall, so it streams from the start - the same reason tail(1) has to keep a ring. /# xxd h 0000: 48 65 6c 6c 6f 20 67 62 Hello gb 0008: 6f 73 0d 0a os.. blk(1) could already peek at raw disk blocks; nothing could look inside a file. Verified against known bytes, from stdin, with -c, through a pipe, and on a missing file.
Diffstat (limited to '')
-rw-r--r--src/programs.asm7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/programs.asm b/src/programs.asm
index 11da2b1..a602350 100644
--- a/src/programs.asm
+++ b/src/programs.asm
@@ -178,6 +178,9 @@ ProgHelp:
SECTION "prog_poweroff", ROMX[$4000], BANK[47]
ProgPoweroff:
INCBIN "build/usr/poweroff.bin"
+SECTION "prog_xxd", ROMX[$4000], BANK[48]
+ProgXxd:
+ INCBIN "build/usr/xxd.bin"
; -----------------------------------------------------------------------------
; PROG_SH (bank 3) - the shell, now written in C (usr/sh.c): parses >/</| and
@@ -312,6 +315,8 @@ ProgramTable::
dw ProgHelp
db LOW(BANK(ProgPoweroff)), HIGH(BANK(ProgPoweroff))
dw ProgPoweroff
+ db LOW(BANK(ProgXxd)), HIGH(BANK(ProgXxd))
+ dw ProgXxd
ProgramTableEnd::
; -----------------------------------------------------------------------------
@@ -411,4 +416,6 @@ NameTable::
db PROG_HELP
db "poweroff", 0
db PROG_POWEROFF
+ db "xxd", 0
+ db PROG_XXD
db 0