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
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 * dw - command interface to the server
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 * Edt/Rev YYYY/MM/DD Modified by
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
7 * Comment
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
9 * 1 2010/01/02 Aaron Wolfe
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
10 * Most basic implementation using new DW utility API
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
11
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
12 nam dw
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
13 ttl command interface to the server
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
14
2807
3b7b5021f8bc Cosmetic
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2794
diff changeset
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
3b7b5021f8bc Cosmetic
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2794
diff changeset
22 endsect
2475
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
23
2807
3b7b5021f8bc Cosmetic
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2794
diff changeset
24 section bss
2475
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
25 pbuffer rmb 256
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
26 pbend rmb 2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
27 cbuffer rmb 256
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
28 portdev rmb 10
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
29 portpath rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
30 outpath rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
31 numbyt rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
32 die rmb 1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
33 endsect
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
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
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
37 * signal handling
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
38 icpt lda #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
39 sta die,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
40 rti
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
41
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
42 command fcc 'dw '
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
43
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
44 * save initial parameters
2790
19517af71188 Added __start
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2787
diff changeset
45 __start pshs d
2475
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
46 pshs x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
47 clr die,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
48 * set intercept handler
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
49 leax icpt,pcr *ptr to handler
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
50 os9 F$Icpt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
51
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
52 clra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
53 lbsr TCPOpen
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
54 lbcs errex1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
55
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
56
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
57 gotport sta portpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
58
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
59 * rawpath
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
60 lbsr RawPath
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
61
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
62 * write command to port
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
63 lda portpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
64 ldy #3
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
65 leax command,pc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
66 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
67 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
68
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
69 * write parameters to port - X = start addr, y = # bytes, A = path#
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
70 puls x
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
71 puls y
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
72
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
73 os9 I$WritLn
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
74 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
75
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
76 * read result
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
77 leax pbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
78 lda portpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
79 ldy #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
80 rrloop os9 I$Read
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
81 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
82 ldb ,x+
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
83 cmpb #C$CR * end of response
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
84 bne rrloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
85
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
86 * look for Fail
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
87 ldb pbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
88 cmpb #'F
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
89 bne gotconn * we connected
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
90
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
91 * display failure message
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
92 lda #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
93 ldy #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
94 leax pbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
95 ldb #9 *skip proto error info (FAIL xxx )
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
96 abx
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
97 prloop os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
98 ldb ,x+
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
99 cmpb #C$CR *end of response
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
100 bne prloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
101
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
102 ldy #2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
103 leax crlf,pc
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
104 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
105
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
106 lbra done
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
107
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
108 crlf fcb C$CR
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
109 fcb C$LF
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
110
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
111 * response loop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
112 * read 1 byte, this is how many bytes follow in this set. 0 for end of response
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
113 gotconn nop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
114
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
115 * check for incoming serial data
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
116 rloop lda portpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
117 ldb #SS.Ready
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
118 os9 I$GetStt
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
119 bcc serinc read and print the byte
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
120
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
121 * if we got no data and die is set, bail
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
122 lda die,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
123 bne done
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
124
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
125 * sleep a while
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
126 ldx #0001
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
127 os9 F$Sleep
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
128 bra rloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
129
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
130 * read B bytes from serial, print on screen
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
131 serinc clra
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
132 tfr d,y
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
133 lda portpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
134 leax pbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
135 os9 I$Read
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
136 lbcs errex2
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
137 * print the data to stdout
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
138 lda #1
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
139 leax pbuffer,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
140 os9 I$Write
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
141 bra rloop
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
142
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
143 done clrb *no errors here
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
144 * close port
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
145 errex2 lda portpath,u
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
146 os9 I$Close
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
147
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
148 errex1 os9 F$Exit *goodbye
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
149 endsect
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
150
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
151
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
152
c249cc490a83 Moved dw commands into main tree
boisy
parents:
diff changeset
153