From bab09a13c255c7b2e1ed5d871fa90757330de10c Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 29 Aug 1991 11:36:20 +0000 Subject: [PATCH] New installation mechanism --- mach/z8000/libmon/.distr | 2 + mach/z8000/libmon/LIST | 2 + mach/z8000/libmon/mon.s | 88 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 mach/z8000/libmon/LIST create mode 100644 mach/z8000/libmon/mon.s diff --git a/mach/z8000/libmon/.distr b/mach/z8000/libmon/.distr index 8ce78cfaa..1edec9f14 100644 --- a/mach/z8000/libmon/.distr +++ b/mach/z8000/libmon/.distr @@ -1 +1,3 @@ +LIST head_em.s +libmon_s.a diff --git a/mach/z8000/libmon/LIST b/mach/z8000/libmon/LIST new file mode 100644 index 000000000..880f88c49 --- /dev/null +++ b/mach/z8000/libmon/LIST @@ -0,0 +1,2 @@ +libmon_s.a +mon.s diff --git a/mach/z8000/libmon/mon.s b/mach/z8000/libmon/mon.s new file mode 100644 index 000000000..407a9c576 --- /dev/null +++ b/mach/z8000/libmon/mon.s @@ -0,0 +1,88 @@ +.define mon +.sect .text +.sect .rom +.sect .data +.sect .bss +.sect .text + +mon: + popl saveret, *RR14 + pop R0, *RR14 ! iocode + cp R0, $1 ! exit + jr NE, read + inc R15, $2 + sc $EXIT +read: cp R0, $3 ! read + jr NE, write + pop R0, *RR14 ! dummy; all input from stdin + pop R1, *RR14 ! ptr to buffer + pop R2, *RR14 ! nr of bytes to be read + ld R3, R1 + cp R2, $0 + jr EQ, 6f +1: sc $2 ! read character into RL0 + cpb RL0, $004 ! \^D + jr EQ, 6f + cpb RL0, $015 ! \cr + jr NE, 2f + ldb RL0, $012 +2: sc $4 ! echo + cpb RL0, $010 ! \^H + jr NE, 3f + cp R1, R3 + jr EQ, 5f + dec R1 + jr 5f +3: cpb RL0, $0100 ! \@ + jr NE, 4f + ld R1, R3 + ldb RL0, $012 + sc $4 + jr 5f +4: ldb 0(R1), RL0 + inc R1 + cpb RL0, $012 ! \nl + jr EQ, 6f +5: djnz R2, 1b +6: sub R1, R3 ! nr of bytes read + push *RR14, R1 + push *RR14, $0 + jr retu +write: cp R0, $4 ! write + jr NE, open + pop R0, *RR14 ! dummy; all output to stdout + pop R1, *RR14 ! ptr to buffer + pop R2, *RR14 ! nr of bytes to be written + ld R3, R2 + cp R2, $0 + jr EQ, 8f +9: ld R0, $5000 ! counter to delay printing a little +7: djnz R0, 7b + ldb RL0, 0(R1) + sc $4 + inc R1 + djnz R2, 9b +8: sub R3, R2 ! nr of bytes written + push *RR14, R3 + push *RR14, $0 + jr retu +open: cp R0, $5 ! open + jr close + jr NE, close + ld *RR14, $0 + ld 2(R15), $0 + jr retu +close: cp R0, $6 ! close + jr NE, ioctl + ld *RR14, $0 + jr retu +ioctl: cp R0, $54 ! ioctl + jr NE, err + inc R15, $4 + ld *RR14, $0 +retu: ldl RR2, saveret + jp *RR2 +err: push *RR14, saveret + push *RR14, $EBADMON + calr trp + ret