annotate level1/cmds/telnet.a @ 2609:9dd4f422aac7

Added NitrOS-9 ROM Kit from Cloud-9
author Boisy Pitre <boisy.pitre@nuance.com>
date Tue, 31 Jan 2012 13:57:35 -0600
parents c249cc490a83
children aaba193af04f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2475
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
1 ********************************************************************
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
2 * telnet - telnet client
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
3 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
4 * $Id$
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
5 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
6 * Notes:
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
7 * This utility works in similar fashion to telnet commands on other systems.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
8 * The user can telnet to a location, and once there, press the TELESCAPE key
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
9 * to invoke telnet command mode.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
10 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
11 * Two sets of path options are kept for the standard input. The first is an
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
12 * unmodified copy and the second is a modifable copy. The second is set up
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
13 * for raw mode and is used when communicating with the host. The first will
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
14 * be used when going into telnet command mode or exiting the telnet program.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
15 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
16 * The signal handler catches the S$HUP signal and shuts down gracefully. It
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
17 * also looks for the ABORT/QUIT characters and relays them to the session.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
18 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
19 * Reference used: http://www.faqs.org/rfcs/rfc854.html
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
20 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
21 * Edt/Rev YYYY/MM/DD Modified by
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
22 * Comment
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
23 * ------------------------------------------------------------------
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
24 * 1 2010/01/02 Aaron Wolfe
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
25 * Most basic implementation using new DW utility API
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
26 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
27 * 2 2010/01/06 Boisy G. Pitre
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
28 * Reformatted and optimized source. Added SS.Opt support, added telnet
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
29 * command mode which can be entered by pressing the TELESCAPE key.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
30 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
31 * 3 2010/01/07 Boisy G. Pitre
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
32 * Reworked buffer processing routine.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
33 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
34 * 4 2010/01/12 Boisy G. Pitre
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
35 * We allow host to do echo if it wants, we also now advertise the
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
36 * escape character when a connection is successful.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
37 *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
38 * 5 2010/01/15 Boisy G. Pitre
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
39 * Modified to be an rma assembled module and use the netlib library.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
40
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
41 * Set to 1 if you want to see telnet CTRL chars from host
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
42 DEBUG set 0
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
43
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
44 nam telnet
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
45 ttl program module
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
46
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
47 tylg set $01 Prgrm+Objct
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
48 atrv set $80+rev ReEnt+rev
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
49 rev set $00
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
50 edition set 5
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
51
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
52 psect telnet_a,tylg,atrv,edition,200,start
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
53
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
54 vsect
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
55 connected rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
56 netdatardy rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
57 keydatardy rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
58 lastsig rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
59 port rmb 2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
60 hostname rmb 2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
61 pbuffer rmb 256
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
62 pbufferl equ *
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
63 pbend rmb 2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
64 cbuffer rmb 256
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
65 ccount rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
66 opts rmb 32
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
67 orgopts rmb 32
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
68 tcmdbufl equ 32
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
69 tcmdbuf rmb tcmdbufl
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
70 portdev rmb 10
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
71 netpath rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
72 outpath rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
73 numbyt rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
74 state rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
75 telctrlbuf rmb 3
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
76 endsect
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
77
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
78 TELESCAPE equ 'Y-$40 * CTRL-Y
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
79
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
80 NetSig equ 32
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
81 KeySig equ 33
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
82
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
83 SE equ 240 * end of subnegotiation parameters
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
84 NOP equ 241 * no operation
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
85 DataMark equ 242 * the data stream portion of a Synch. This should always be accompanied by a TCP Urgent notification.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
86 Break equ 243 * NVT character BRK.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
87 IntProc equ 244 * the function IP
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
88 AbortOut equ 245 * the function AO.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
89 AreUThere equ 246 * the function AYT
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
90 EraseChar equ 247 * the function EC.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
91 EraseLine equ 248 * the function EL.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
92 GoAhead equ 249 * the GA signal.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
93 SB equ 250 * indicates that what follows is subnegotiation of the indicated option.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
94 WILL equ 251 * indicates the desire to begin performing, or confirmation that you are now performing, the indicated option.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
95 WONT equ 252 * indicates the refusal to perform, or continue performing, the indicated option.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
96 DO equ 253 * indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
97 DONT equ 254 * indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
98 IAC equ 255 * data byte 255.
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
99
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
100 * Telnet Options
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
101 TO_ECHO equ $01
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
102
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
103 escprompt fcc /Escape character is '^/
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
104 fcb TELESCAPE+$40
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
105 fcc /'./
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
106 crlf fcb C$CR,C$LF
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
107 escpromptl equ *-escprompt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
108 tprompt fcc /telnet> /
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
109 tpromptl equ *-tprompt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
110
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
111 trying fcc /Trying.../
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
112 fcb C$CR
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
113 tryingl equ *-trying
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
114
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
115 peerclosm fcc /Connection closed by foreign host./
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
116 fcb C$CR
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
117 peerclosml equ *-peerclosm
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
118
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
119 using fcc 'Using port '
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
120 usingl equ *-using
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
121
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
122 defportstr fcc '23'
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
123 fcb 0
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
124
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
125 peerclosed
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
126 clr connected,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
127 leax peerclosm,pcr
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
128 ldy #peerclosml
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
129 os9 I$WritLn
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
130 lbra done
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
131
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
132 * signal intercept routine
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
133 sigint
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
134 stb lastsig,u * save our signal received
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
135 cmpb #KeySig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
136 bne netchk
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
137 inc keydatardy,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
138 rti
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
139 netchk cmpb #NetSig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
140 bne hupchk
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
141 inc netdatardy,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
142 rti
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
143 hupchk cmpb #S$HUP * disconnect from peer signal received?
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
144 beq peerclosed * yep, exit nicely
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
145 lda #$03 * usual interrupt character
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
146 cmpb #S$Intrpt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
147 beq chksig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
148 lda #$05 * usual quit character
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
149 cmpb #S$Abort
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
150 bne sigex
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
151 chksig tst connected,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
152 lbeq done
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
153 pshs a
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
154 leax ,s
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
155 ldy #$0001
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
156 lda netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
157 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
158 puls a
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
159 sigex rti
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
160
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
161 * save initial parameters
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
162 start pshs x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
163 clr connected,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
164 clr netdatardy,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
165 clr keydatardy,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
166
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
167 * setup signal intercept
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
168 leax sigint,pcr
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
169 os9 F$Icpt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
170
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
171 * get path options (original and modifiable copy)
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
172 leax orgopts,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
173 ldd #SS.Opt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
174 os9 I$GetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
175 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
176
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
177 leax opts,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
178 ldd #SS.Opt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
179 os9 I$GetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
180 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
181
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
182 * set up our path to be raw (we will actually set it later)
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
183 leax PD.UPC-PD.OPT,x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
184 ldb #PD.INT-PD.UPC
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
185 rawloop clr ,x+
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
186 decb
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
187 bne rawloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
188
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
189 * set address as nul terminated string
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
190 addrloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
191 ldx ,s
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
192 addrloop2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
193 lda ,x+
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
194 cmpa #C$SPAC
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
195 beq nilit
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
196 cmpa #C$CR
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
197 beq nilit
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
198 bra addrloop2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
199
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
200 nilit clr -1,x nil terminate previous param
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
201 cmpa #C$CR are we at end of command line?
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
202 beq defaultport yep, set default port
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
203
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
204 skipspc lda ,x+
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
205 cmpa #C$CR
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
206 beq defaultport
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
207 cmpa #C$SPAC
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
208 beq skipspc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
209 * if here, we have a second parameter... probably port number
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
210 leay -1,x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
211 bra parsedone
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
212 defaultport leay defportstr,pcr
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
213 parsedone puls x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
214
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
215 * X holds pointer to nul terminated address
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
216 * Y holds port number string (nil terminated)
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
217 * do the open and connect
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
218 pshs y
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
219 std port,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
220 stx hostname,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
221
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
222 * announce our attempt to try to connect
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
223 lda #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
224 ldy #tryingl
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
225 leax trying,pcr
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
226 os9 I$WritLn
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
227
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
228 lbsr TCPOpen
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
229 puls y
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
230 lbcs errex1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
231 sta netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
232 ldx hostname,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
233 lbsr TCPConnectToHost
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
234 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
235 lbsr RawPath
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
236
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
237 * we're connected...
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
238 lda #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
239 sta connected,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
240 leax escprompt,pcr
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
241 ldy #escpromptl
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
242 os9 I$WritLn
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
243
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
244 * make our stdin opts raw
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
245 leax opts,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
246 ldd #SS.Opt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
247 os9 I$SetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
248 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
249
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
250 * setup data ready signal on stdin
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
251 clra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
252 ldb #SS.SSig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
253 ldx #KeySig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
254 os9 I$SetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
255 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
256
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
257 * setup data ready signal on netpath
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
258 lda netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
259 ldb #SS.SSig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
260 ldx #NetSig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
261 os9 I$SetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
262 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
263
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
264 * response loop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
265 * check for typed characters
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
266 rloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
267 pshs cc save interrupt state
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
268 orcc #IntMasks mask interrupts
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
269 tst netdatardy,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
270 bne GetNetData
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
271 tst keydatardy,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
272 bne GetKeyData
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
273 * sleep until signal
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
274 ldx #$0000
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
275 os9 F$Sleep
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
276 puls cc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
277 bra rloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
278
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
279 GetKeyData puls cc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
280 dec keydatardy,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
281 bra stdinc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
282
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
283 GetNetData puls cc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
284 dec netdatardy,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
285 lda netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
286 ldb #SS.Ready
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
287 os9 I$GetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
288 lbcc serinc read and print the byte
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
289 bra rloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
290
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
291 * telnet command interface
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
292 cmdint
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
293 * restore original opts for now
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
294 leax orgopts,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
295 ldd #SS.Opt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
296 os9 I$SetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
297 bcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
298
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
299 * write CR
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
300 lda #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
301 leax crlf,pcr
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
302 ldy #$02
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
303 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
304
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
305 * show prompt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
306 cmdloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
307 lda #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
308 leax tprompt,pcr
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
309 ldy #tpromptl
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
310 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
311
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
312 * read command
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
313 leax tcmdbuf,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
314 ldy #tcmdbufl
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
315 clra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
316 os9 I$ReadLn
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
317 bcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
318
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
319 * process command
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
320 lda ,x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
321 anda #$5F * make uppercase
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
322
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
323 cmpa #C$CR
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
324 beq ret2tel * just CR... return to telnet session
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
325 cmpa #'Q
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
326 beq okex
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
327 bra cmdloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
328
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
329 * return to telnet session
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
330 ret2tel
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
331 leax opts,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
332 ldd #SS.Opt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
333 os9 I$SetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
334 bcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
335
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
336 * read one byte from stdin, send to server
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
337 stdinc ldy #$0001
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
338 clra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
339 leax numbyt,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
340 os9 I$Read
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
341 bcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
342
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
343 * check if it is an escape character
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
344 lda ,x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
345 cmpa #TELESCAPE
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
346 beq cmdint
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
347
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
348 outc ldy #$0001
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
349 lda netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
350 leax numbyt,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
351 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
352 bcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
353
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
354 * setup data ready signal on stdin
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
355 clra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
356 ldb #SS.SSig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
357 ldx #KeySig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
358 os9 I$SetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
359 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
360
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
361 lbra rloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
362
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
363 done
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
364 okex clrb *no errors here
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
365 * close port
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
366 errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
367 pshs b,cc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
368 lda netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
369 lbsr TCPDisconnect
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
370 clr connected,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
371
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
372 leax orgopts,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
373 ldd #SS.Opt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
374 os9 I$SetStt *restore original path options
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
375 puls b,cc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
376
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
377 errex1 os9 F$Exit *goodbye
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
378
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
379 * read B bytes from serial
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
380 serinc clra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
381 tfr d,y
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
382 lda netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
383 leax pbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
384 os9 I$Read
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
385 bcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
386
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
387 * set buffer
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
388 tfr y,d
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
389 leax pbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
390 abx
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
391 stx pbend,u *set end addr
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
392 clrb
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
393 leax pbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
394 leay cbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
395 clr ccount,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
396
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
397 * call buffer processor
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
398 bsr procbuf
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
399
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
400 * print buffer
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
401 ldb ccount,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
402 beq serincex
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
403 clra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
404 tfr d,y
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
405 lda #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
406 leax cbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
407 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
408 bcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
409
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
410 * return to loop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
411 serincex
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
412 * setup data ready signal on netpath
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
413 lda netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
414 ldb #SS.SSig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
415 ldx #NetSig
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
416 os9 I$SetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
417 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
418
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
419 lbra rloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
420
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
421
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
422
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
423 * buffer processing routine
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
424 procbuf cmpx pbend,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
425 beq procbufex
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
426 * not at end of buffer, get next char
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
427 lda ,x+
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
428 * check state to see what we do with this byte
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
429 tst state,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
430 bne telctrl
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
431 cmpa #IAC
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
432 beq telstate
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
433 sta ,y+
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
434 inc ccount,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
435 bra procbuf
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
436 procbufex rts
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
437
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
438 conv anda #$0F
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
439 cmpa #$09
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
440 bgt alpha
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
441 adda #$30
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
442 fcb $8C
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
443 alpha adda #$41-$0A
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
444 rts
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
445
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
446 IFEQ DEBUG-1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
447 printhex pshs d,x,y
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
448 bsr conv
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
449 pshs a
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
450 lda 1,s
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
451 lsra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
452 lsra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
453 lsra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
454 lsra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
455 bsr conv
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
456 pshs a
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
457 lda #'$
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
458 pshs a
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
459 leax ,s
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
460 ldy #$0003
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
461 lda #$01
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
462 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
463 leas 3,s
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
464 puls d,x,y,pc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
465 ENDC
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
466
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
467 telstate sta telctrlbuf,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
468 IFEQ DEBUG-1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
469 bsr printhex
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
470 ENDC
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
471 inc state,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
472 bra procbuf
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
473
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
474 clrngo clr state,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
475 bra procbuf
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
476
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
477 * handles telnet control sequence... A = byte
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
478 telctrl
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
479 IFEQ DEBUG-1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
480 bsr printhex
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
481 ENDC
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
482 ldb state,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
483 cmpb #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
484 bne telctrl2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
485 cmpa #SB
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
486 ble clrngo
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
487 sta telctrlbuf+1,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
488 inc state,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
489 bra procbuf
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
490 telctrl2 sta telctrlbuf+2,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
491 clr state,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
492 * here we have a complete telnet control sequence
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
493 ldd telctrlbuf+1,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
494 cmpa #DO
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
495 beq dowont
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
496 cmpa #WILL
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
497 lbne procbuf
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
498 cmpb #TO_ECHO
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
499 bne dodont
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
500 * allow host to echo
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
501 lda #DO
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
502 fcb $8C
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
503 dodont lda #DONT
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
504 fcb $8C
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
505 dowont lda #WONT
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
506 sta telctrlbuf+1,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
507 ldy #3
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
508 lda netpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
509 pshs x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
510 leax telctrlbuf,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
511 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
512 puls x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
513 lbra procbuf
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
514
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
515 endsect