comparison os9/level2/cmds/sbc09.asm @ 98:ba0af2b8836b

fix sbc09 echo problem
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 27 Dec 2018 08:23:42 +0900
parents 5aeff8abca9c
children c9dc1be48de4
comparison
equal deleted inserted replaced
97:5aeff8abca9c 98:ba0af2b8836b
39 size equ . 39 size equ .
40 40
41 name fcs /Sbc09/ 41 name fcs /Sbc09/
42 fcb edition 42 fcb edition
43 43
44 start 44 start clr <stdin
45 clr <stdin
46 stx <parmptr save parameter pointer 45 stx <parmptr save parameter pointer
47 stu <work save parameter pointer 46 stu <work save parameter pointer
48 lda #READ. read access mode 47 lda #READ. read access mode
49 os9 I$Open open file 48 os9 I$Open open file
50 bcs L0049 branch if error 49 lbcs L0049 branch if error
51 sta <filepath else save path to file 50 sta <filepath else save path to file
52 stx <parmptr and updated parm pointer 51 stx <parmptr and updated parm pointer
53 L001F lda <filepath get path 52 L001F lda <filepath get path
54 leax readbuff,u point X to read buffer 53 leax readbuff,u point X to read buffer
55 ldy #200 read up to 200 bytes 54 ldy #200 read up to 200 bytes
86 cmpx 2,s 85 cmpx 2,s
87 ble l1 86 ble l1
88 puls x,y 87 puls x,y
89 jmp $400 88 jmp $400
90 89
91 Exit lbsr setecho 90 Exit lbsr setecho
92 clrb 91 * ldx <work
93 os9 F$Exit 92 * leax readbuff,x
93 * ldb #1
94 * lbsr getline
95 * lbsr getpoll
96 * lda <stdin
97 * os9 I$Close
98
99 clrb
100 os9 F$Exit
101 * no return
102
94 103
95 iotbl 104 iotbl
96 fdb getchar-iotbl ; 0 105 fdb getchar-iotbl ; 0
97 fdb putchar-iotbl ; 3 106 fdb putchar-iotbl ; 3
98 fdb getline-iotbl ; 6 107 fdb getline-iotbl ; 6
211 RNSENSE 220 RNSENSE
212 PULS X,Y,D,PC 221 PULS X,Y,D,PC
213 222
214 getline * Input line at address in X, length in B. 223 getline * Input line at address in X, length in B.
215 PSHS A,B,X,Y 224 PSHS A,B,X,Y
225 clr ,s
216 GETLN0 226 GETLN0
217 CLRA 227 ldy ,s
218 TFR D,Y 228 clra
219 LDA <stdin
220 OS9 I$ReadLn 229 OS9 I$ReadLn
221 BCS GETLN0 230 BCS GETLN0
222 LEAY -1,Y 231 LEAY -1,Y
223 TFR Y,D
224 * LDA D,X
225 * CMPA #C$CR
226 * BNE GETLN1
227 * LEAY -1,Y
228 GETLN1 STY ,S 232 GETLN1 STY ,S
229 PULS A,B,X,Y,PC 233 PULS A,B,X,Y,PC
230 putline * Output string at address in X, length in B. 234 putline * Output string at address in X, length in B.
231 PSHS A,B,X,Y 235 PSHS A,B,X,Y
232 CLRA 236 CLRA
233 TFR D,Y 237 TFR D,Y
234 LDA <stdin 238 CLRA
235 OS9 I$WritLn 239 OS9 I$WritLn
236 PULS A,B,X,Y,PC 240 PULS A,B,X,Y,PC
237 xopenin 241 xopenin
238 xopenout 242 xopenout
239 xabortin 243 xabortin
242 RTS 246 RTS
243 247
244 setecho lda #1 248 setecho lda #1
245 bra sss 249 bra sss
246 noecho clra 250 noecho clra
247 sss pshs a 251 sss leas -128,s
248 sta ,s 252 leax ,s
249 LDA <stdin 253 pshs a
254 clra
250 ldb #SS.Opt 255 ldb #SS.Opt
251 LDX <work
252 leax readbuff,X
253 OS9 I$GetStt 256 OS9 I$GetStt
254 bcs err2 257 bcs err2
255 LDA ,s 258 LDA ,s
256 STA PD.EKO-PD.OPT,X 259 STA PD.EKO-PD.OPT,X
257 setopts 260 setopts
258 ldb #SS.Opt 261 ldb #SS.Opt
259 lda <stdin 262 clra
260 OS9 I$SetStt 263 OS9 I$SetStt
261 err2 264 err2
262 puls a,pc 265 puls a
266 leas 128,s
267 rts
263 268
264 269
265 delay PSHS D,X * address **$21** 270 delay PSHS D,X * address **$21**
266 * On input the D register contains the number of timer 271 * On input the D register contains the number of timer
267 * ticks to wait. Each timer tick is 20ms 272 * ticks to wait. Each timer tick is 20ms
268 TFR D,X 273 TFR D,X
269 OS9 F$Sleep 274 OS9 F$Sleep
270 PULS D,X,PC 275 PULS D,X,PC
271 276
272 exit bsr setecho
273 clrb
274 os9 F$Exit
275
276 277
277 emod 278 emod
278 eom equ * 279 eom equ *
279 end 280 end