Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/dw.as @ 3169:1ff3d7673e36
mc09 l2: bring sys/makefile in line with latest organisation for other platforms
Revise bootfiles/makefile to remove sysgo from bootfile - it can be
found on the root of the disk.
author | Neal Crook <foofoobedoo@gmail.com> |
---|---|
date | Mon, 17 Apr 2017 22:59:28 +0100 |
parents | d660d443fe5f |
children |
rev | line source |
---|---|
2475 | 1 ******************************************************************** |
2 * dw - command interface to the server | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Edt/Rev YYYY/MM/DD Modified by | |
7 * Comment | |
8 * ------------------------------------------------------------------ | |
9 * 1 2010/01/02 Aaron Wolfe | |
10 * Most basic implementation using new DW utility API | |
11 | |
12 nam dw | |
13 ttl command interface to the server | |
14 | |
2807 | 15 section __os9 |
2820
d660d443fe5f
Changed set to equ in __os9 section so stack/edition/etc are honored by lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2807
diff
changeset
|
16 type equ Prgrm |
d660d443fe5f
Changed set to equ in __os9 section so stack/edition/etc are honored by lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2807
diff
changeset
|
17 lang equ Objct |
d660d443fe5f
Changed set to equ in __os9 section so stack/edition/etc are honored by lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2807
diff
changeset
|
18 attr equ ReEnt |
d660d443fe5f
Changed set to equ in __os9 section so stack/edition/etc are honored by lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2807
diff
changeset
|
19 rev equ $00 |
d660d443fe5f
Changed set to equ in __os9 section so stack/edition/etc are honored by lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2807
diff
changeset
|
20 edition equ 1 |
d660d443fe5f
Changed set to equ in __os9 section so stack/edition/etc are honored by lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2807
diff
changeset
|
21 stack equ 200 |
2807 | 22 endsect |
2475 | 23 |
2807 | 24 section bss |
2475 | 25 pbuffer rmb 256 |
26 pbend rmb 2 | |
27 cbuffer rmb 256 | |
28 portdev rmb 10 | |
29 portpath rmb 1 | |
30 outpath rmb 1 | |
31 numbyt rmb 1 | |
32 die rmb 1 | |
33 endsect | |
34 | |
2787
28b6ec8a14d5
Added 'extern' pragam, fixed up rules.mak, changed 'section text' to 'section code' in sources
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2783
diff
changeset
|
35 section code |
2782
aaba193af04f
Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2475
diff
changeset
|
36 |
2475 | 37 * signal handling |
38 icpt lda #1 | |
39 sta die,u | |
40 rti | |
41 | |
42 command fcc 'dw ' | |
43 | |
44 * save initial parameters | |
2790 | 45 __start pshs d |
2475 | 46 pshs x |
47 clr die,u | |
48 * set intercept handler | |
49 leax icpt,pcr *ptr to handler | |
50 os9 F$Icpt | |
51 | |
52 clra | |
53 lbsr TCPOpen | |
54 lbcs errex1 | |
55 | |
56 | |
57 gotport sta portpath,u | |
58 | |
59 * rawpath | |
60 lbsr RawPath | |
61 | |
62 * write command to port | |
63 lda portpath,u | |
64 ldy #3 | |
65 leax command,pc | |
66 os9 I$Write | |
67 lbcs errex2 | |
68 | |
69 * write parameters to port - X = start addr, y = # bytes, A = path# | |
70 puls x | |
71 puls y | |
72 | |
73 os9 I$WritLn | |
74 lbcs errex2 | |
75 | |
76 * read result | |
77 leax pbuffer,u | |
78 lda portpath,u | |
79 ldy #1 | |
80 rrloop os9 I$Read | |
81 lbcs errex2 | |
82 ldb ,x+ | |
83 cmpb #C$CR * end of response | |
84 bne rrloop | |
85 | |
86 * look for Fail | |
87 ldb pbuffer,u | |
88 cmpb #'F | |
89 bne gotconn * we connected | |
90 | |
91 * display failure message | |
92 lda #1 | |
93 ldy #1 | |
94 leax pbuffer,u | |
95 ldb #9 *skip proto error info (FAIL xxx ) | |
96 abx | |
97 prloop os9 I$Write | |
98 ldb ,x+ | |
99 cmpb #C$CR *end of response | |
100 bne prloop | |
101 | |
102 ldy #2 | |
103 leax crlf,pc | |
104 os9 I$Write | |
105 | |
106 lbra done | |
107 | |
108 crlf fcb C$CR | |
109 fcb C$LF | |
110 | |
111 * response loop | |
112 * read 1 byte, this is how many bytes follow in this set. 0 for end of response | |
113 gotconn nop | |
114 | |
115 * check for incoming serial data | |
116 rloop lda portpath,u | |
117 ldb #SS.Ready | |
118 os9 I$GetStt | |
119 bcc serinc read and print the byte | |
120 | |
121 * if we got no data and die is set, bail | |
122 lda die,u | |
123 bne done | |
124 | |
125 * sleep a while | |
126 ldx #0001 | |
127 os9 F$Sleep | |
128 bra rloop | |
129 | |
130 * read B bytes from serial, print on screen | |
131 serinc clra | |
132 tfr d,y | |
133 lda portpath,u | |
134 leax pbuffer,u | |
135 os9 I$Read | |
136 lbcs errex2 | |
137 * print the data to stdout | |
138 lda #1 | |
139 leax pbuffer,u | |
140 os9 I$Write | |
141 bra rloop | |
142 | |
143 done clrb *no errors here | |
144 * close port | |
145 errex2 lda portpath,u | |
146 os9 I$Close | |
147 | |
148 errex1 os9 F$Exit *goodbye | |
149 endsect | |
150 | |
151 | |
152 | |
153 |