From ff1fde3e9fe8226daf859a2b2b03c1a5c8248362 Mon Sep 17 00:00:00 2001 From: Tom Everett Date: Fri, 18 Oct 2019 17:02:41 -0600 Subject: [PATCH] added stat and tm to build --- build/Makefile | 8 ++- src/cmd/stat/stat.s | 119 ++++++++++++++++++++++++++++++++++++++++++++ src/cmd/tm/tm.s | 74 +++++++++++++++++++++++++++ 3 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 src/cmd/stat/stat.s create mode 100644 src/cmd/tm/tm.s diff --git a/build/Makefile b/build/Makefile index 8b6658a..b32581b 100644 --- a/build/Makefile +++ b/build/Makefile @@ -94,7 +94,7 @@ dirs: cmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \ $(BINDIR)/chown $(BINDIR)/chrm $(BINDIR)/cp $(BINDIR)/ds \ $(BINDIR)/dskres $(BINDIR)/dsksav $(BINDIR)/ed $(BINDIR)/init \ - $(BINDIR)/db + $(BINDIR)/db $(BINDIR)/stat $(BINDIR)/tm # Alternate commands: no dd, but . and .. altcmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \ @@ -143,6 +143,12 @@ $(BINDIR)/init: $(CMDSRC)/init/init.s $(BINDIR)/db: $(CMDSRC)/db/db.s $(AS) $(ASARGS) -o $(BINDIR)/db $(CMDSRC)/db/db.s +$(BINDIR)/stat: $(CMDSRC)/stat/stat.s + $(AS) $(ASARGS) -o $(BINDIR)/stat $(CMDSRC)/stat/stat.s + +$(BINDIR)/tm: $(CMDSRC)/tm/tm.s + $(AS) $(ASARGS) -o $(BINDIR)/tm $(CMDSRC)/tm/tm.s + # Alternative init: no dd directory $(BINDIR)/altinit: $(ALTSRC)/init/init.s $(AS) $(ASARGS) -o $(BINDIR)/altinit $(ALTSRC)/init/init.s diff --git a/src/cmd/stat/stat.s b/src/cmd/stat/stat.s new file mode 100644 index 0000000..26b8298 --- /dev/null +++ b/src/cmd/stat/stat.s @@ -0,0 +1,119 @@ +"** 13-120-147.pdf page 1 +" stat + +arg = 017777 + + lac arg + tad d1 + dac name + +loop: + lac arg i + sad d4 + sys exit + tad dm4 + dac arg i + lac name + tad d4 + dac name + + law statbuf + sys status; dotdot; name: .. + spa + jmp error + law obuf-1 + dac 12 + lac ii + lmq + -3 + jms octal + lac iflags + lmq + -2 + jms octal + lac iuid + lmq + -2 + jms octal + -1 + tad iniks + cma + lmq + -2 + jms octal + lac isize + lmq + -5 + jms octal + lac o12 + dac obuf+18 + lac d1 + sys write; obuf; 19 + jmp loop + +error: + lac name + dac 1f + lac d1 + sys write; 1:..; 4 + lac d1 + sys write; 1f; 2 + jmp loop +1: 040077; 012 + +"** 13-120-147.pdf page 2 +octal: 0 + dac c + law tbuf-1 + dac 8 + lac o40 + dac 8 i +1: + lacq + and o7 + tad o60 + dac 8 i + lrs 3 + isz c + jmp 1b + lac 8 + dac c +1: + lac c i + dac 12 i + sad o40 + jmp octal i + -1 + tad c + dac c + jmp 1b + +dotdot: + 056056; 040040; 040040; 040040 + +d1: 1 +d2: 2 +d3: 3 +d8: 8 +d14: 14 +d12: 12 +o12: 012 +o60: 060 +o40: 040 +o7: 7 +d4: 4 +dm4: -4 + +c: .=.+1 + +statbuf: + iflags: .=.+1 + .=.+7 + iuid: .=.+1 + iniks: .=.+1 + isize: .=.+1 + .=.+1 + ii: .=.+1 + +obuf: .=.+19 +tbuf: .=.+10 diff --git a/src/cmd/tm/tm.s b/src/cmd/tm/tm.s new file mode 100644 index 0000000..015c5f2 --- /dev/null +++ b/src/cmd/tm/tm.s @@ -0,0 +1,74 @@ +"** 13-120-147.pdf page 3 +" tm + + sys time + cll + div + 216000 + dac t1 + lacq + cll + idiv + 10 + tad o60 + dac buf+1 + lacq + cll; idiv; 10 + tad o60 + dac buf + lacq + sna + jmp 1f + tad o60 + alss 9 + xor buf + dac buf +1: + lac t1 + cll + idiv + 6 + lacq + cll + idiv + 10 + tad o56060 + dac buf+6 + lacq + cll + idiv + 10 + tad o60 + dac buf+5 + lacq + cll + idiv + 6 + tad o72060 + dac buf+4 + lacq + cll + idiv + 10 + tad o60 + dac buf+3 + lacq + cll + idiv + 6 + tad o72060 + dac buf+2 + lac d1 + sys write; buf; 8 + sys exit + +"** 13-120-147.pdf page 4 +d1: 1 +d13: 13 +d2: 2 +o60: 060 +o56060: 056060 +o72060: 072060 +t1: 0 +t2: 0 +buf: .=.+7; 012