]> cloudbase.mooo.com Git - z180-stamp-cpm3.git/blame - cbios/ascii.180
Unifiy asci0/asci1 interrupt routines
[z180-stamp-cpm3.git] / cbios / ascii.180
CommitLineData
d6829fd3
L
1\r
2; Interrupt drivers for ASCI0 and ASCI1\r
3\r
6dd88c25 4 global as0_dev,as1_dev\r
d6829fd3 5\r
1c7e3963 6 extrn @ctbl,f_cpu\r
81ba3c84
L
7 extrn ff_empty,ff_get,ff_full,ff_put\r
8 extrn ff_puth,ff_cnt,ff_gech\r
d6829fd3 9 extrn bufinit\r
1c7e3963
L
10 extrn isv_sw,ijphl,add_hla,div32_r\r
11 extrn b_st_a,b_ld_a\r
d6829fd3
L
12\r
13\r
14\r
1c7e3963
L
15 maclib z180reg.inc\r
16 maclib config.inc\r
17 maclib ioctl.inc\r
18 maclib modebaud.inc\r
d6829fd3
L
19\r
20\r
1c7e3963 21 m2b mbxon_bit,mb$xon$xoff\r
d6829fd3
L
22\r
23;-----------------------------------------------------\r
24\r
25 dseg\r
26\r
6dd88c25
L
27 dw asci0_out\r
28 dw asci0_osta\r
29 dw asci0_inp\r
30 dw asci0_ista\r
31 dw asci_ioctl\r
32as0_dev:\r
1c7e3963
L
33 db 0 ;absolute device #\r
34 db 0 ;relative device\r
35 db 0 ;iflags\r
36 db 0 ;fflags\r
37 db M_CS8 ;cflags\r
6dd88c25
L
38o.absdev equ 0\r
39o.reldev equ 1\r
1c7e3963
L
40o.iflags equ 2\r
41o.fflags equ 3\r
42o.cflags equ 4\r
43\r
44 db 0\r
45 db 0\r
46oint.iflags equ as0_dev+o.iflags-s0.inbuf\r
47oint.fflags equ as0_dev+o.fflags-s0.inbuf\r
48 mkbuf s0.rx_id, s0.inbuf, s0.rx_len\r
49 mkbuf s0.tx_id, s0.outbuf,s0.tx_len\r
50\r
6dd88c25
L
51\r
52 dw asci1_out\r
53 dw asci1_osta\r
54 dw asci1_inp\r
55 dw asci1_ista\r
56 dw asci_ioctl\r
57as1_dev:\r
1c7e3963
L
58 db 0 ;absolute device #\r
59 db 1 ;relative device\r
60 db 0 ;iflags\r
61 db 0 ;fflags\r
62 db M_CS8 ;cflags\r
6dd88c25 63\r
6dd88c25 64 db 0\r
6dd88c25 65 db 0\r
d6829fd3 66 mkbuf s1.rx_id, s1.inbuf, s1.rx_len\r
81ba3c84 67 mkbuf s1.tx_id, s1.outbuf,s1.tx_len\r
d6829fd3
L
68\r
69\r
70\r
71 dseg\r
72\r
6dd88c25
L
73\r
74ioctl_ftab:\r
1c7e3963
L
75 dw func_tcinit ;(00h) CP/M 3 DEVINI function\r
76 dw func_tcgeta ;(01h) Get the current serial port settings.\r
77 dw func_tcseta ;(02h) Set the current serial port settings.\r
78 dw func_tcsetaw ;(03h) Allow the output buffer to drain\r
79 dw func_tcsetaf ;(04h) Allow the output buffer to drain, discard pending input\r
80 dw func_tcsbrk ;(05h) Sending a break (250ms .. 500ms)\r
81 dw func_tcsbrkp ;(06h) arg is timeinterval in 0.1sec\r
82 dw func_tiocsbrk ;(07h) Turn break on\r
83 dw func_tioccbrk ;(08h) Turn break off\r
84 dw func_tcxonc ;(09h) Software flow control (TCOOFF, TCOON, TCIOFF, TCION)\r
85 dw func_tcflsh ;(0Ah) Flush input/output buffer (TCIFLUSH, TCOFLUSH, TCIOFLUSH)\r
86 dw func_fionread ;(0Bh) Get the number of bytes in the input buffer.\r
87 dw func_tiocoutq ;(0Ch) Get the number of bytes in the output buffer.\r
88 dw func_tiocmget ;(0Dh) get the status of modem bits.\r
89 dw func_tiocmbis ;(0Eh) set the indicated modem bits.\r
90 dw func_tiocmbic ;(0Fh) clear the indicated modem bits.\r
91 dw func_tiocmset ;(10h) set the status of modem bits.\r
92 dw func_tiocgsoftcar ;(11h) Get the status of the CLOCAL flag in the c_cflag field\r
93 dw func_tiocssoftcar ;(12h) Set the CLOCAL flag when *argp is nonzero, and clear it otherwise.\r
94\r
6dd88c25
L
95IOCTL_MAX equ ($-ioctl_ftab)/2\r
96 dw nofunc\r
97\r
1c7e3963 98\r
d6829fd3 99;--------------------------------------------------------------\r
d6829fd3 100;\r
6dd88c25
L
101; b: device number\r
102; c: command\r
103; de: ioctl arg pointer\r
104; hl: ptr to driver local data\r
d6829fd3
L
105;\r
106\r
6dd88c25 107asci_ioctl:\r
72ba3737
L
108 ld a,b\r
109 cp 1\r
110 jr nz,asioc_1\r
111 ld a,(INIDONE)\r
112 and 80h\r
113 cp INIDONEVAL\r
114 ret z\r
115asioc_1:\r
6dd88c25
L
116 push hl\r
117 ex (sp),ix\r
118 ld (ix+o.absdev),b\r
119 ld hl,ioctl_ftab\r
120 ld a,IOCTL_MAX\r
121 cp c\r
122 jr c,$+3\r
123 ld a,c\r
124 add a,a\r
125 call add_hla\r
126 ld a,(hl)\r
127 inc hl\r
128 ld h,(hl)\r
129 ld l,a\r
130 call ijphl\r
131 pop ix\r
132nofunc:\r
1c7e3963 133 or a\r
6dd88c25
L
134 ret\r
135\r
6dd88c25 136;--------------------------------------------------------------\r
1c7e3963 137; CP/M 3 DEVINI function\r
6dd88c25 138; Init Serial I/O for input and output (ASCI 0/1)\r
d6829fd3 139\r
1c7e3963
L
140func_tcinit:\r
141 call asci_stop\r
142\r
143init_st:\r
144 ld c,asext0 ;Enable baud rate generator\r
145 ld a,M_BRGMOD+M_DCD0DIS ; +M_CTS0DIS +M_BREAKEN\r
146 bit CCTS_OFLOW,(ix+o.fflags)\r
147 jr nz,$+4\r
148 or M_CTS0DIS\r
149 call out_asci_reg\r
d6829fd3 150\r
6dd88c25 151 ld b,(ix+o.absdev)\r
1c7e3963
L
152 ld c,8 ;\r
153 mlt bc ;\r
154 ld hl,@ctbl+7 ;\r
155 add hl,bc ;\r
156 ld a,(hl) ;get baudrate index\r
157 call as_br_div\r
158 ld c,astc0l\r
159 ld a,l\r
160 call out_asci_reg\r
161 inc c\r
162 ld a,h\r
163 call out_asci_reg\r
164\r
165\r
166 ld c,cntlb0\r
167 ld a,M_MPBT ;No MP Mode, X16\r
168 bit PARODD,(ix+o.iflags)\r
169 jr z,$+4\r
170 or M_PEO\r
171 call out_asci_reg\r
172\r
173 ld c,cntla0\r
174 ld a,(ix+o.cflags)\r
175 srlan CS8\r
176 ld hl,mod_tab\r
177 call add_hla\r
178 ld a,(hl)\r
179 or a,M_RE+M_TE+M_RTS0+M_EFR ;Rx/Tx enable\r
180 call out_asci_reg\r
181\r
182 push ix\r
6dd88c25
L
183 bit 0,(ix+o.reldev)\r
184 jr nz,init_1\r
185 ld hl,rtxisvjmp0 ;rx/tx int vector\r
186 ld (ivtab + IV$ASCI0),hl ;\r
d6829fd3 187 ld ix,s0.outbuf\r
1c7e3963
L
188 call bufinit\r
189 ld ix,s0.inbuf\r
6dd88c25
L
190 jr init_2\r
191init_1:\r
192 ld hl,rtxisvjmp1 ;rx/tx int vector\r
193 ld (ivtab + IV$ASCI1),hl ;\r
d6829fd3 194 ld ix,s1.outbuf\r
1c7e3963
L
195 call bufinit\r
196 ld ix,s1.inbuf\r
6dd88c25 197init_2:\r
d6829fd3 198 call bufinit\r
1c7e3963
L
199 pop ix\r
200 call asci_start\r
201 ret\r
202\r
203;--------------------------------------------------------------\r
204\r
205mod_tab:\r
206 db 000B ; 7N1\r
207 db 100B ; 8N1\r
208 db 001B ; 7N2\r
209 db 101B ; 8N2\r
210 db 010B ; 7P1\r
211 db 110B ; 8P1\r
212 db 011B ; 7P2\r
213 db 111B ; 8P2\r
214\r
215\r
216;--------------------------------------------------------------\r
217; Get the current serial port settings.\r
218\r
219func_tcgeta:\r
220 ld a,d\r
221 or e\r
222 ld a,0ffh\r
223 jr z,fgeta_e\r
224\r
225 ld a,(ix+o.iflags)\r
226 call b_st_a\r
227 inc de\r
228 ld a,(ix+o.fflags)\r
229 call b_st_a\r
230 inc de\r
231\r
232 ld b,(ix+o.absdev)\r
233 ld c,8 ;\r
234 mlt bc ;\r
235 ld hl,@ctbl+7 ;\r
236 add hl,bc ;\r
237 ld a,(hl) ;get baudrate index\r
238 and M_CBAUD\r
239 ld b,a\r
240 ld a,(ix+o.cflags)\r
241 and ~M_CBAUD\r
242 or b\r
243 call b_st_a\r
244 dec de\r
245 dec de\r
246 xor a\r
247fgeta_e:\r
248 ret\r
249\r
250\r
251;--------------------------------------------------------------\r
252; Set the current serial port settings.\r
253\r
254func_tcseta:\r
255 ld a,d\r
256 or e\r
257 ld a,0ffh\r
258 jr z,fseta_e\r
259\r
260 call asci_stop\r
261\r
262 call b_ld_a\r
263 ld (ix+o.iflags),a\r
264 inc de\r
265 call b_ld_a\r
266 ld (ix+o.fflags),a\r
267 inc de\r
268\r
269 ld b,(ix+o.absdev)\r
270 ld c,8 ;\r
271 mlt bc ;\r
272 ld hl,@ctbl+7 ;\r
273 add hl,bc ;\r
274 call b_ld_a\r
275 ld (ix+o.cflags),a\r
276 and M_CBAUD\r
277 ld (hl),a ;set baudrate index\r
278 dec de\r
279 dec de\r
280 push de\r
281 call init_st\r
282 pop de\r
283 xor a\r
284fseta_e:\r
285 ret\r
286\r
287\r
288;--------------------------------------------------------------\r
289; Allow the output buffer to drain\r
290\r
291func_tcsetaw:\r
292\r
293;--------------------------------------------------------------\r
294; Allow the output buffer to drain, discard pending input\r
295\r
296func_tcsetaf:\r
297\r
298;--------------------------------------------------------------\r
299; Sending a break (250ms .. 500ms)\r
300\r
301func_tcsbrk:\r
302\r
303;--------------------------------------------------------------\r
304; arg is timeinterval in 0.1sec\r
305\r
306func_tcsbrkp:\r
307\r
308;--------------------------------------------------------------\r
309; Turn break on\r
310\r
311func_tiocsbrk:\r
312\r
313;--------------------------------------------------------------\r
314; Turn break off\r
315\r
316func_tioccbrk:\r
317\r
318;--------------------------------------------------------------\r
319; Software flow control (TCOOFF, TCOON, TCIOFF, TCION)\r
320\r
321func_tcxonc:\r
322\r
323;--------------------------------------------------------------\r
324; Flush input/output buffer (TCIFLUSH, TCOFLUSH, TCIOFLUSH)\r
325\r
326func_tcflsh:\r
327\r
328;--------------------------------------------------------------\r
329; Get the number of bytes in the input buffer.\r
330\r
331func_fionread:\r
332\r
333;--------------------------------------------------------------\r
334; Get the number of bytes in the output buffer.\r
335\r
336func_tiocoutq:\r
337\r
338;--------------------------------------------------------------\r
339; get the status of modem bits.\r
340\r
341func_tiocmget:\r
342\r
343;--------------------------------------------------------------\r
344; set the indicated modem bits.\r
345\r
346func_tiocmbis:\r
347\r
348;--------------------------------------------------------------\r
349; clear the indicated modem bits.\r
350\r
351func_tiocmbic:\r
352\r
353;--------------------------------------------------------------\r
354; set the status of modem bits.\r
355\r
356func_tiocmset:\r
357\r
358;--------------------------------------------------------------\r
359; Get the status of the CLOCAL flag in the c_cflag field\r
360\r
361func_tiocgsoftcar:\r
362\r
363;--------------------------------------------------------------\r
364; Set the CLOCAL flag when *argp is nonzero, and clear it otherwise.\r
365\r
366func_tiocssoftcar:\r
367\r
368 or 0ffh\r
369 ret\r
370\r
371;--------------------------------------------------------------\r
372\r
373asci_stop:\r
374 ld c,stat0 ;Disable rx/tx interrupts\r
375 xor a ;\r
376 call out_asci_reg\r
377\r
378 ld c,cntla0 ;Disable receiver and transmitter\r
379 ld a,M_RTS0+M_EFR ;RTS/CKA1\r
380 jr out_asci_reg\r
381\r
382;--------------------------------------------------------------\r
383\r
384asci_start:\r
385 ld c,stat0 ;\r
d6829fd3 386 ld a,M_RIE\r
1c7e3963
L
387 jr out_asci_reg\r
388\r
389;--------------------------------------------------------------\r
390; output to asci0/1 register\r
391;\r
392; c: register address\r
393; a: value\r
394;\r
395\r
396out_asci_reg:\r
397 push bc\r
398 ld b,a\r
399 ld a,c\r
400 cp astc0l ;astc0/1 are 16 bit\r
401 jr c,$+5\r
402 add a,(ix+o.reldev)\r
403 add a,(ix+o.reldev)\r
404 ld c,a\r
405 ld a,b\r
406 ld b,0\r
407 out (c),a\r
408 pop bc\r
d6829fd3
L
409 ret\r
410\r
1c7e3963
L
411;--------------------------------------------------------------\r
412; baud rate divider\r
413;\r
414; a: index\r
415; return\r
416; hl: divider\r
417\r
418as_br_div:\r
419 push de\r
420 push bc\r
421 and 0fh\r
422 add a,a ;get factor\r
423 ld hl,bd150_tab\r
424 call add_hla\r
425 ld c,(hl)\r
426 inc hl\r
427 ld b,(hl)\r
428 ld hl,(f_cpu)\r
429 ld de,(f_cpu+2)\r
430 call div32_r\r
431 ld bc,32*150\r
432 call div32_r\r
433 ld de,2\r
434 or a\r
435 sbc hl,de\r
436 pop bc\r
437 pop de\r
438 ret nc\r
439 ld hl,0\r
440 ret\r
441\r
442bd150_tab:\r
443; factor index baudrate orig. cp/m\r
444 dw 19200/150 ; 0 19200 -\r
445 dw 28800/150 ; 1 28800 50\r
446 dw 38400/150 ; 2 38400 75\r
447 dw 57600/150 ; 3 57600 110\r
448 dw 11520/15 ; 4 115200 134.5\r
449 dw 150/150 ; 5 150\r
450 dw 300/150 ; 6 300\r
451 dw 600/150 ; 7 600\r
452 dw 1200/150 ; 8 1200\r
453 dw 1800/150 ; 9 1800\r
454 dw 2400/150 ;10 2400\r
455 dw 3600/150 ;11 3600\r
456 dw 4800/150 ;12 4800\r
457 dw 7200/150 ;13 7200\r
458 dw 9600/150 ;14 9600\r
459 dw 19200/150 ;15 19200\r
460\r
461\r
462;--------------------------------------------------------------\r
463\r
464 if 0\r
465\r
466initab0:\r
467 db 1,stat0,0 ;Disable rx/tx interrupts\r
468 ;Enable baud rate generator\r
469 db 1,asext0,M_BRGMOD+M_DCD0DIS ; +M_CTS0DIS\r
470 db 2,astc0l\r
471init_br_off equ $ - initab0\r
472 dw 28\r
473 db 1,cntlb0,M_MPBT ;No MP Mode, X16\r
474 db 1,cntla0,M_RE+M_TE+M_MOD2 ;Rx/Tx enable, 8N1\r
475 db 0\r
476\r
477initab1:\r
478 db 1,stat1,0 ;Disable rx/tx ints, disable CTS1\r
479 db 1,asext1,M_BRGMOD ;Enable baud rate generator\r
480 db 2,astc1l,low 3, high 3\r
481 db 1,cntlb1,M_MPBT ;No MP Mode, X16\r
482 db 1,cntla1,M_RE+M_TE+M_MOD2 ;Rx/Tx enable, 8N1\r
483 db 0\r
484 endif\r
d6829fd3 485\r
d6829fd3
L
486;--------------------------------------------------------------\r
487\r
488 dseg\r
6dd88c25 489asci0_ista:\r
d6829fd3
L
490 push ix\r
491 ld ix,s0.inbuf ;\r
492 call ff_empty\r
493 pop ix\r
494 ret\r
495\r
496;--------------------------------------------------------------\r
497\r
6dd88c25 498asci1_ista:\r
d6829fd3
L
499 push ix\r
500 ld ix,s1.inbuf ;\r
501 call ff_empty\r
502 pop ix\r
503 ret\r
504\r
505;--------------------------------------------------------------\r
506; Get an input character\r
507\r
6dd88c25 508asci0_inp:\r
d6829fd3
L
509 push ix\r
510 ld ix,s0.inbuf ;\r
81ba3c84
L
511 call ff_gech\r
512 ld a,b\r
513 cp s0.rx_len/4\r
e827bfb9 514 jr nc,a0i_1\r
5d7663e1
L
515 bit CRTS_IFLOW,(ix+oint.fflags)\r
516 jr z,a0i_1\r
b8ad769f
L
517 di\r
518 in0 a,(cntla0)\r
46c2044d
L
519 and ~M_RTS0 ;assert RTS\r
520 or M_EFR ;don't reset error flags\r
b8ad769f 521 ei\r
46c2044d 522 out0 (cntla0),a\r
b8ad769f 523a0i_1:\r
81ba3c84 524 ld a,c\r
d6829fd3
L
525 pop ix\r
526 ret\r
527\r
528;--------------------------------------------------------------\r
529; Get an input character\r
530\r
6dd88c25 531asci1_inp:\r
d6829fd3
L
532 push ix\r
533 ld ix,s1.inbuf ;\r
81ba3c84 534 call ff_gech\r
d6829fd3
L
535 pop ix\r
536 ret\r
537\r
538;--------------------------------------------------------------\r
539; Output status\r
540\r
6dd88c25 541asci0_osta:\r
d6829fd3
L
542 push ix\r
543 ld ix,s0.outbuf ;\r
544 call ff_full\r
545 pop ix\r
546 ret\r
547\r
548;--------------------------------------------------------------\r
549; Output status\r
550\r
6dd88c25 551asci1_osta:\r
d6829fd3
L
552 push ix\r
553 ld ix,s1.outbuf ;\r
554 call ff_full\r
555 pop ix\r
556 ret\r
557\r
558;--------------------------------------------------------------\r
559; put character in c in buffer\r
560; destroys hl, bc\r
561; returns output char in a\r
562\r
6dd88c25 563asci0_out:\r
d6829fd3
L
564 push ix ;\r
565 ld ix,s0.outbuf ;\r
81ba3c84
L
566 call ff_puth\r
567 pop ix ;\r
d6829fd3
L
568 di ;\r
569 in0 c,(stat0) ;\r
570 set TIE,c ;\r
571 out0 (stat0),c ;\r
572 ei ;\r
d6829fd3
L
573 ret\r
574\r
575;--------------------------------------------------------------\r
576; put character in c in buffer\r
577; destroys hl, bc\r
578; returns output char in a\r
579\r
6dd88c25 580asci1_out:\r
d6829fd3
L
581 push ix ;\r
582 ld ix,s1.outbuf ;\r
81ba3c84
L
583 call ff_puth\r
584 pop ix ;\r
d6829fd3
L
585 di ;\r
586 in0 c,(stat1) ;\r
587 set TIE,c ;\r
588 out0 (stat1),c ;\r
589 ei ;\r
d6829fd3
L
590 ret\r
591\r
592\r
6dd88c25
L
593;--------------------------------------------------------------\r
594\r
595 cseg\r
596rtxisvjmp0:\r
597 call isv_sw\r
5d7663e1
L
598 dw asci0_int\r
599\r
6dd88c25
L
600rtxisvjmp1:\r
601 call isv_sw\r
5d7663e1 602 dw asci1_int\r
6dd88c25
L
603\r
604;--------------------------------------------------------------\r
5d7663e1
L
605; ASCI 0/1 Transmit/Receive interupt routines\r
606\r
607 .lall\r
608asci_int macro dev\r
609 local rxi_2,rxi_4\r
d6829fd3 610\r
46c2044d 611 push ix\r
5d7663e1
L
612rxtxi&dev&_lp0:\r
613 ld ix,s&dev&.inbuf ;\r
614rxtxi&dev&_lp1:\r
615 in0 a,(stat&dev) ;receive flag set?\r
616 jp p,txi&dev ;RDRF == Bit 7\r
6dd88c25
L
617 and M_OVRN+M_PERR+M_FE\r
618 ld e,a\r
81ba3c84 619\r
5d7663e1 620 in0 a,(asext&dev)\r
46c2044d
L
621 and M_BREAK\r
622 or e\r
623 ld e,a\r
d6829fd3 624\r
5d7663e1 625 in0 d,(cntla&dev) ;\r
b8ad769f 626 res EFR,d ;\r
5d7663e1 627 out0 (cntla&dev),d\r
d6829fd3 628\r
81ba3c84 629 ld c,(ix+o.in_idx) ;\r
d6829fd3 630 ld b,0\r
5d7663e1 631 ld hl,s&dev&.inbuf ;\r
d6829fd3 632 add hl,bc\r
6dd88c25 633\r
5d7663e1 634 in0 a,(rdr&dev) ;\r
b8ad769f 635 ld (hl),a\r
6dd88c25
L
636 ;todo: break detection\r
637 ;todo: parity, framing overrun error\r
638\r
1c7e3963 639 ld e,(ix+oint.fflags)\r
6dd88c25 640 bit IXON,e\r
5d7663e1 641 jr z,rxi_2\r
6dd88c25
L
642 ;todo: test XON/XOFF\r
643\r
5d7663e1 644rxi_2:\r
46c2044d
L
645\r
646 ld a,c ;increment buffer in pointer\r
647 inc a ;\r
81ba3c84
L
648 ld b,(ix+o.mask) ;\r
649 and b ;\r
b8ad769f 650 ld c,a\r
81ba3c84
L
651\r
652 sub (ix+o.out_idx) ;\r
5d7663e1 653 jr z,rxtxi&dev&_lp1 ;skip if buffer is full\r
6dd88c25
L
654\r
655 ld (ix+o.in_idx),c ;\r
656\r
81ba3c84
L
657 jr nc,$+3 ;\r
658 adc b ;\r
6dd88c25 659\r
5d7663e1
L
660 cp s&dev&.tx_len*3/4\r
661 jr c,rxi&dev&_noflow\r
6dd88c25 662\r
5d7663e1 663 if dev=0\r
6dd88c25 664 bit CRTS_IFLOW,e\r
5d7663e1 665 jr z,rxi_4\r
6dd88c25
L
666\r
667 set EFR,d\r
668 set RTS0,d ;RTS inactive\r
5d7663e1
L
669 out0 (cntla&dev),d ;\r
670 endif\r
6dd88c25 671\r
5d7663e1 672rxi_4:\r
6dd88c25 673 bit IXOFF,e\r
5d7663e1 674 jr z,rxtxi&dev&_lp1\r
6dd88c25
L
675 ;todo: send XOFF\r
676\r
5d7663e1
L
677rxi&dev&_noflow:\r
678 jr rxtxi&dev&_lp1\r
81ba3c84 679\r
d6829fd3 680\r
5d7663e1 681txi&dev:\r
6dd88c25 682 ld e,a\r
46c2044d 683 bit TDRE,e ;TX int?\r
5d7663e1
L
684 jr z,rxtxi&dev&_exit\r
685\r
686 ;todo: xon/xoff\r
687\r
688 ld hl,s&dev&.outbuf+o.in_idx ;[in]\r
689 ld a,(hl) ;\r
690 inc hl ;[out]\r
691 ld c,(hl) ;\r
692 cp c ;\r
693 jr z,txi&dev&_empty ;\r
694 inc hl ;fifo base\r
695 ld b,0 ;\r
696 add hl,bc ;\r
697 ld a,(hl) ;\r
698 out0 (tdr&dev),a ;\r
699 inc c ;\r
700 ld a,(s&dev&.outbuf+o.mask) ;\r
701 and c ;\r
702 ld (s&dev&.outbuf+o.out_idx),a ;\r
d6829fd3 703\r
5d7663e1 704 jr rxtxi&dev&_lp0\r
81ba3c84 705\r
5d7663e1 706txi&dev&_empty:\r
d6829fd3 707 res TIE,e ;disable tx-int\r
5d7663e1 708 out0 (stat&dev),e ; 5\r
46c2044d 709\r
5d7663e1 710rxtxi&dev&_exit:\r
d6829fd3
L
711 pop ix\r
712 ret\r
5d7663e1 713 endm\r
d6829fd3
L
714\r
715 dseg\r
5d7663e1
L
716;--------------------------------------------------------------\r
717; ASCI 0 Transmit/Receive interupt routines\r
d6829fd3 718\r
5d7663e1
L
719asci0_int:\r
720 asci_int 0\r
d6829fd3 721\r
5d7663e1
L
722;--------------------------------------------------------------\r
723; ASCI 1 Transmit/Receive interupt routines\r
d6829fd3 724\r
5d7663e1
L
725asci1_int:\r
726 asci_int 1\r
d6829fd3
L
727\r
728 end\r