annotate level1/cmds/dw.asm @ 2286:d3c1d1258b42

Updated from Aaron's sources
author boisy
date Tue, 29 Dec 2009 02:34:05 +0000
parents 2a889a511f0a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
1 *********************************************************************************
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
2 * dw - send commands to DriveWire server
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
3 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
4 * using a virtual channel from DriveWire, send commands and write results
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
5 * to stdout.
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
6 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
7 * version 0.1 - 12/17/09 - AAW - bare minimum implementation
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
8 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
9
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
10 nam dw
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
11 ttl program module
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
12
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
13 ifp1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
14 use defsfile
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
15 endc
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
16
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
17 tylg set Prgrm+Objct
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
18 atrv set ReEnt+rev
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
19 rev set $00
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
20 edition set 1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
21
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
22 mod eom,name,tylg,atrv,start,size
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
23 pbuffer rmb 256
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
24 portdev rmb 10
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
25 portpath rmb 1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
26 numbyt rmb 1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
27
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
28 size equ .
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
29
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
30 name fcs /dw/
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
31 fcb edition
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
32
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
33 ******************************************
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
34 * writech - write character in A to screen
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
35 * In:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
36 * A = character to write
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
37 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
38
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
39 writech pshs y,x,a ;preserve regs + put A on stack for write
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
40 lda #1 ;path 1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
41 ldy #1 ;1 character
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
42 leax ,s ;write from stack
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
43 os9 I$Write ;write it
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
44 puls a,x,y,pc ;return
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
45
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
46 * write out the contents of pbuffer.. length is in numbyt
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
47 writepb clra
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
48 ldb numbyt,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
49 tfr d,y
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
50 lda #1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
51 leax pbuffer,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
52 os9 I$Write
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
53 wrpb02 rts
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
54
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
55 *************************************
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
56 * dw main
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
57 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
58
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
59 * default to port /t0.. and use it no matter what, maybe set on cmdline in future?
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
60 defport fcc '/t0'
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
61 fcb C$CR
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
62 fcb $00,$00
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
63
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
64 * initialization/startup?
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
65 start nop
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
66
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
67 * save parameters for later
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
68 pshs d
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
69 pshs x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
70
2286
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
71 * see if we can find a port to use
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
72
2286
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
73 * first setup pbuffer
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
74 leax pbuffer,u
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
75 lda #47
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
76 sta ,x+
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
77 lda #85
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
78 sta ,x+
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
79 lda #48
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
80 sta ,x+
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
81 lda #13
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
82 sta ,x
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
83
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
84 tryport lda #UPDAT. get mode for modem path
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
85 leax pbuffer,u point to modem path
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
86 os9 I$Open open it
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
87 bcc gotport
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
88
2286
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
89 cmpb #250 ;in use?
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
90 lbne errex1 ;other error, bail out
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
91 leax pbuffer,u
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
92 lda 2,x
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
93 inca
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
94 sta 2,x
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
95 bra tryport
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
96
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
97 gotport sta portpath,u
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
98
d3c1d1258b42 Updated from Aaron's sources
boisy
parents: 2242
diff changeset
99
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
100 * write our name
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
101 ldy #0001
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
102 leax <name,pc
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
103 wrnlp lda ,x+
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
104 bmi wrnout ;this is the last char
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
105 pshs x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
106 pshs a
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
107 lda portpath,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
108 leax ,s
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
109 os9 I$Write
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
110 leas 1,s
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
111 puls x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
112 lbcs errex2
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
113 bra wrnlp
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
114
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
115 wrnout ldb #C$CR ;end with a CR
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
116 anda #$7F
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
117 pshs d
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
118 ldy #0002
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
119 lda portpath,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
120 leax ,s
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
121 os9 I$Write
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
122 leas 2,s
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
123 lbcs errex2
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
124
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
125
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
126 * write parameters to port - X = start addr, y = # bytes, A = path#
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
127
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
128 puls x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
129 puls y
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
130 lda portpath,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
131
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
132 os9 I$Write
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
133 lbcs errex2
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
134
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
135 * response loop
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
136 * read 1 byte, this is how many bytes follow in this set. 0 for end of response
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
137
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
138 rloop ldy #0001 ;read one byte
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
139 leax numbyt,u ;put it in our numbyt
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
140 lda portpath,u ;read from port path
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
141 os9 I$Read
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
142 lbcs errex2
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
143
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
144 * if Y = 1, we got our byte, otherwise bail out
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
145 cmpy #0001
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
146 bne errex2
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
147
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
148 * if byte was 0, we're done
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
149 ldb numbyt,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
150 beq done
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
151
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
152 *otherwise read the number of bytes announced
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
153 clra
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
154 tfr d,y
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
155 leax pbuffer,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
156 lda portpath,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
157 os9 I$Read
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
158 lbcs errex2
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
159
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
160 * did we get the right # of bytes?
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
161 tfr y,d
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
162 cmpb numbyt,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
163 bne errex2 ; gives bytes actually read as error #.. wrong but handy
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
164
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
165 * write out pbuffer
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
166 lbsr writepb
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
167
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
168 * next set
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
169 bra rloop
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
170
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
171
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
172
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
173
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
174 done clrb ;no errors here
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
175 * close port
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
176 errex2 lda portpath,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
177 os9 I$Close
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
178
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
179 errex1 os9 F$Exit ;goodbye
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
180
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
181
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
182
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
183
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
184
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
185
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
186 *end of mod
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
187 emod
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
188 eom equ *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
189 end
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
190