1755
|
1 ;*******************************************************************
|
|
2 ; Tee - Split output to multiple devices
|
|
3 ;
|
|
4 ; $Id$
|
|
5 ;
|
|
6 ; Edt/Rev YYYY/MM/DD Modified by
|
|
7 ; Comment
|
|
8 ; ------------------------------------------------------------------
|
|
9 ; 2 ????/??/??
|
|
10 ; From Tandy OS-9 Level One VR 02.00.00.
|
|
11
|
|
12 .include "/Users/boisy/Projects/nitros9/defs/const.d"
|
|
13 .include "/Users/boisy/Projects/nitros9/defs/io.d"
|
|
14 .include "/Users/boisy/Projects/nitros9/defs/ioman.d"
|
|
15 .include "/Users/boisy/Projects/nitros9/defs/errno.d"
|
|
16 .include "/Users/boisy/Projects/nitros9/defs/syscall.d"
|
|
17 .include "/Users/boisy/Projects/nitros9/defs/module.d"
|
|
18
|
1758
|
19 .module Tee,Prgrm+Objct,ReEnt+0,start,dsize
|
1755
|
20
|
1758
|
21 .area _DATA
|
1755
|
22
|
|
23 u0000: .blkb 1
|
|
24 parray: .blkb 13
|
|
25 pcount: .blkb 1
|
|
26 buff: .blkb 256
|
|
27 .blkb 450
|
|
28 dsize == .
|
|
29
|
1758
|
30 .area _CODE
|
|
31
|
1755
|
32 start: clrb
|
1758
|
33 clr <pcount,u ; clear path counter
|
1755
|
34 cmpy #0h0000 ; any parameters?
|
|
35 lbeq exitok ; exit if none
|
|
36 leay parray,u ; else point Y to path array
|
|
37
|
|
38 ; Walk the command line parameters
|
|
39 parse: lda ,x+
|
|
40 cmpa #C$SPAC
|
|
41 beq parse
|
|
42 cmpa #C$COMA
|
|
43 beq parse
|
|
44 cmpa #C$CR
|
|
45 lbeq parsex
|
|
46 ; We've found a file or device name
|
|
47 leax -1,x
|
|
48 lda #WRITE.
|
|
49 ldb #PREAD.+UPDAT.
|
|
50 os9 I$Create ; open a path to the device or file
|
|
51 bcs exit ; branch if error
|
|
52 ldb pcount,u ; else get path counter
|
|
53 sta b,y ; save new path in the array offset
|
|
54 incb ; increment counter
|
|
55 stb pcount,u ; and save
|
|
56 bra parse ; continue parsing command line
|
|
57 parsex: stb pcount,u
|
|
58
|
|
59 ; Devices on command line are open, start pumping data
|
|
60 L0044: clra
|
|
61 leax buff,u
|
|
62 ldy #256
|
|
63 os9 I$ReadLn
|
|
64 bcc L0057
|
|
65 cmpb #E$EOF
|
|
66 beq exitok
|
|
67 coma
|
|
68 bra exit
|
|
69 L0057: inca
|
|
70 os9 I$WritLn
|
|
71 tst pcount,u
|
|
72 beq L0044
|
|
73 clrb
|
|
74 L0060: leay parray,u
|
|
75 lda b,y
|
|
76 leax buff,u
|
|
77 ldy #256
|
|
78 os9 I$WritLn
|
|
79 bcs exit
|
|
80 incb
|
|
81 cmpb pcount,u
|
|
82 bne L0060
|
|
83 bra L0044
|
|
84 exitok: clrb
|
|
85 exit: os9 F$Exit
|