comparison level1/cmds/tee.as @ 2802:58ca94b06908 lwtools-port

now built from defs files
author Boisy Pitre <boisy.pitre@nuance.com>
date Fri, 01 Feb 2013 19:26:44 -0600
parents a52a60c66f5a
children
comparison
equal deleted inserted replaced
2801:9ffe2daeb011 2802:58ca94b06908
12 nam Tee 12 nam Tee
13 ttl Split output to multiple devices 13 ttl Split output to multiple devices
14 14
15 * Disassembled 98/09/14 23:50:52 by Disasm v1.6 (C) 1988 by RML 15 * Disassembled 98/09/14 23:50:52 by Disasm v1.6 (C) 1988 by RML
16 16
17 use defsfile.d 17 section bss
18
19 rev set $00
20 edition set 2
21
22 section .bss
23 u0000 rmb 1 18 u0000 rmb 1
24 parray rmb 13 19 parray rmb 13
25 pcount rmb 1 20 pcount rmb 1
26 buff rmb 200 21 buff rmb 256
22 rmb 450
27 endsect 23 endsect
28 24
29 * psect tee_a,Prgrm+Objct,ReEnt+rev,edition,200,start 25 section __os9
26 rev set $00
27 edition set 2
28 stack set 200
29 endsect
30
30 section code 31 section code
31 32 __start clrb
32 __start clrb 33 clr pcount,u clear path counter
33 clr pcount clear path counter
34 cmpy #$0000 any parameters? 34 cmpy #$0000 any parameters?
35 lbeq exitok exit if none 35 lbeq exitok exit if none
36 leay parray else point Y to path array 36 leay parray,u else point Y to path array
37 37
38 * Walk the command line parameters 38 * Walk the command line parameters
39 parse lda ,x+ 39 parse lda ,x+
40 cmpa #C$SPAC 40 cmpa #C$SPAC
41 beq parse 41 beq parse
47 leax -1,x 47 leax -1,x
48 lda #WRITE. 48 lda #WRITE.
49 ldb #PREAD.+UPDAT. 49 ldb #PREAD.+UPDAT.
50 os9 I$Create open a path to the device or file 50 os9 I$Create open a path to the device or file
51 bcs exit branch if error 51 bcs exit branch if error
52 ldb pcount else get path counter 52 ldb pcount,u else get path counter
53 sta b,y save new path in the array offset 53 sta b,y save new path in the array offset
54 incb increment counter 54 incb increment counter
55 stb pcount and save 55 stb pcount,u and save
56 bra parse continue parsing command line 56 bra parse continue parsing command line
57 parsex stb pcount 57 parsex stb pcount,u
58 58
59 * Devices on command line are open, start pumping data 59 * Devices on command line are open, start pumping data
60 L0044 clra 60 L0044 clra
61 leax buff 61 leax buff,u
62 ldy #256 62 ldy #256
63 os9 I$ReadLn 63 os9 I$ReadLn
64 bcc L0057 64 bcc L0057
65 cmpb #E$EOF 65 cmpb #E$EOF
66 beq exitok 66 beq exitok
67 coma 67 coma
68 bra exit 68 bra exit
69 L0057 inca 69 L0057 inca
70 os9 I$WritLn 70 os9 I$WritLn
71 tst pcount 71 tst pcount,u
72 beq L0044 72 beq L0044
73 clrb 73 clrb
74 L0060 leay parray 74 L0060 leay parray,u
75 lda b,y 75 lda b,y
76 leax buff 76 leax buff,u
77 ldy #256 77 ldy #256
78 os9 I$WritLn 78 os9 I$WritLn
79 bcs exit 79 bcs exit
80 incb 80 incb
81 cmpb pcount 81 cmpb pcount,u
82 bne L0060 82 bne L0060
83 bra L0044 83 bra L0044
84 exitok clrb 84 exitok clrb
85 exit os9 F$Exit 85 exit os9 F$Exit
86 86