X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/blobdiff_plain/b8ad769f2e07dee7e265eebf5aa83bb53b823893..e8b62d9ac855de6439580c15ee12f496a94c5e5d:/cbios/ascii.180?ds=sidebyside diff --git a/cbios/ascii.180 b/cbios/ascii.180 index c928354..3ffa931 100644 --- a/cbios/ascii.180 +++ b/cbios/ascii.180 @@ -1,104 +1,521 @@ - page 200 ; Interrupt drivers for ASCI0 and ASCI1 - global as0init - global as0ista,as0inp - global as0osta,as0out - global as1init - global as1ista,as1inp - global as1osta,as1out + global as0_dev,as1_dev - extrn as_init - extrn ff_empty,ff_get,ff_full,ff_put,ff_cnt + extrn @ctbl,f_cpu + extrn ff_empty,ff_get,ff_full,ff_put + extrn ff_puth,ff_cnt,ff_gech extrn bufinit - extrn isv_sw + extrn isv_sw,ijphl,add_hla,div32_r + extrn b_st_a,b_ld_a - include config.inc - include z180reg.inc + maclib z180reg.inc + maclib config.inc + maclib ioctl.inc + maclib modebaud.inc + m2b mbxon_bit,mb$xon$xoff ;----------------------------------------------------- dseg + dw asci0_out + dw asci0_osta + dw asci0_inp + dw asci0_ista + dw asci_ioctl +as0_dev: + db 0 ;absolute device # + db 0 ;relative device + db 0 ;iflags + db M_CREAD+M_CRTS_IFLOW+M_CCTS_OFLOW ;fflags + db M_CS8 ;cflags +o.absdev equ 0 +o.reldev equ 1 +o.iflags equ 2 +o.fflags equ 3 +o.cflags equ 4 + + db 0 +o.stat equ 5 + b2m SXOFF,0 + b2m TDC1,1 + b2m TDC3,2 + b2m TOFF,7 + db 0 +oint.iflags equ as0_dev+o.iflags-s0.inbuf +oint.fflags equ as0_dev+o.fflags-s0.inbuf +oint.stat equ as0_dev+o.stat-s0.inbuf mkbuf s0.rx_id, s0.inbuf, s0.rx_len mkbuf s0.tx_id, s0.outbuf,s0.tx_len + + + dw asci1_out + dw asci1_osta + dw asci1_inp + dw asci1_ista + dw asci_ioctl +as1_dev: + db 0 ;absolute device # + db 1 ;relative device + db 0 ;iflags + db M_CREAD+M_IXOFF ;fflags + db M_CS8 ;cflags + + db 0 + db 0 mkbuf s1.rx_id, s1.inbuf, s1.rx_len - mkbuf s1.tx_id, s1.outbuf, s1.tx_len + mkbuf s1.tx_id, s1.outbuf,s1.tx_len dseg + +ioctl_ftab: + dw func_tcinit ;(00h) CP/M 3 DEVINI function + dw func_tcgeta ;(01h) Get the current serial port settings. + dw func_tcseta ;(02h) Set the current serial port settings. + dw func_tcsetaw ;(03h) Allow the output buffer to drain + dw func_tcsetaf ;(04h) Allow the output buffer to drain, discard pending input + dw func_tcsbrk ;(05h) Sending a break (250ms .. 500ms) + dw func_tcsbrkp ;(06h) arg is timeinterval in 0.1sec + dw func_tiocsbrk ;(07h) Turn break on + dw func_tioccbrk ;(08h) Turn break off + dw func_tcxonc ;(09h) Software flow control (TCOOFF, TCOON, TCIOFF, TCION) + dw func_tcflsh ;(0Ah) Flush input/output buffer (TCIFLUSH, TCOFLUSH, TCIOFLUSH) + dw func_fionread ;(0Bh) Get the number of bytes in the input buffer. + dw func_tiocoutq ;(0Ch) Get the number of bytes in the output buffer. + dw func_tiocmget ;(0Dh) get the status of modem bits. + dw func_tiocmbis ;(0Eh) set the indicated modem bits. + dw func_tiocmbic ;(0Fh) clear the indicated modem bits. + dw func_tiocmset ;(10h) set the status of modem bits. + dw func_tiocgsoftcar ;(11h) Get the status of the CLOCAL flag in the c_cflag field + dw func_tiocssoftcar ;(12h) Set the CLOCAL flag when *argp is nonzero, and clear it otherwise. + +IOCTL_MAX equ ($-ioctl_ftab)/2 + dw nofunc + + ;-------------------------------------------------------------- -; Init Serial I/O for input and output (ASCI 0/1) ; -; b: device number +; b: device number +; c: command +; de: ioctl arg pointer +; hl: ptr to driver local data ; +asci_ioctl: + push hl + ex (sp),ix + ld (ix+o.absdev),b + ld hl,ioctl_ftab + ld a,IOCTL_MAX + cp c + jr c,$+3 + ld a,c + add a,a + call add_hla + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call ijphl + pop ix +nofunc: + or a + ret -;ser.init: -; ld a,i -; push af ;save IFF -; di -;--- -; pop af -; ret po -; ei -; ret ; - -as0init: - xor a ; - out0 (stat0),a ;Disable rx/tx interrupts - ld c,0 ;asci channel number - call as_init - ld hl,rtxisvjmp0 ;rx/tx int vector - ld (ivtab + IV$ASCI0),hl ; +;-------------------------------------------------------------- +; CP/M 3 DEVINI function +; Init Serial I/O for input and output (ASCI 0/1) +func_tcinit: + call asci_stop + +init_st: + ld c,asext0 ;Enable baud rate generator + ld a,M_BRGMOD+M_DCD0DIS ; +M_CTS0DIS +M_BREAKEN + bit CCTS_OFLOW,(ix+o.fflags) + jr nz,$+4 + or M_CTS0DIS + call out_asci_reg + + ld b,(ix+o.absdev) + ld c,8 ; + mlt bc ; + ld hl,@ctbl+6 ; + add hl,bc ; + res IXON,(ix+o.fflags) + bit mbxon_bit,(hl) ;get cpm3 xon flag + jr z,$+6 + set IXON,(ix+o.fflags) + inc hl + ld a,(hl) ;get baudrate index + call as_br_div + ld c,astc0l + call out_asci_reg_hl + + ld c,cntlb0 + ld a,M_MPBT ;No MP Mode, X16 + bit PARODD,(ix+o.iflags) + jr z,$+4 + or M_PEO + call out_asci_reg + + ld c,cntla0 + ld a,(ix+o.cflags) + srlan CS8 + ld hl,mod_tab + call add_hla + ld a,(hl) + or a,M_RE+M_TE+M_RTS0+M_EFR ;Rx/Tx enable + call out_asci_reg + + bit 0,(ix+o.reldev) + push ix + jr nz,init_1 + ld hl,rtxisvjmp0 ;rx/tx int vector + ld (ivtab + IV$ASCI0),hl ; + ld ix,s0.outbuf + call bufinit ld ix,s0.inbuf + jr init_2 +init_1: + ld hl,rtxisvjmp1 ;rx/tx int vector + ld (ivtab + IV$ASCI1),hl ; + ld ix,s1.outbuf call bufinit - ld ix,s0.outbuf + ld ix,s1.inbuf +init_2: call bufinit - ld a,M_RIE - out0 (stat0),a ;Enable rx interrupts + pop ix + call asci_start + ret + +;-------------------------------------------------------------- + +mod_tab: + db 000B ; 7N1 + db 100B ; 8N1 + db 001B ; 7N2 + db 101B ; 8N2 + db 010B ; 7P1 + db 110B ; 8P1 + db 011B ; 7P2 + db 111B ; 8P2 + + +;-------------------------------------------------------------- +; Get the current serial port settings. + +func_tcgeta: + call chk_ptr + + ld b,(ix+o.absdev) + ld c,8 ; + mlt bc ; + ld hl,@ctbl+6 ; + add hl,bc ; + res IXON,(ix+o.fflags) + bit mbxon_bit,(hl) ;get cpm3 xon flag + jr z,$+6 + set IXON,(ix+o.fflags) + inc hl + ld a,(ix+o.iflags) + call b_st_a + inc de + ld a,(ix+o.fflags) + call b_st_a + inc de + ld a,(hl) ;get baudrate index + and M_CBAUD + ld b,a + ld a,(ix+o.cflags) + and ~M_CBAUD + or b + call b_st_a + dec de + dec de + xor a + ret + +;-------------------------------------------------------------- +; Set the current serial port settings. + +func_tcseta: + call chk_ptr + + call asci_stop + + call b_ld_a + ld (ix+o.iflags),a + inc de + call b_ld_a + ld (ix+o.fflags),a + inc de + + ld b,(ix+o.absdev) + ld c,8 ; + mlt bc ; + ld hl,@ctbl+6 ; + add hl,bc ; + res mbxon_bit,(hl) + bit IXON,a + jr z,$+4 + set mbxon_bit,(hl) + inc hl + call b_ld_a + ld (ix+o.cflags),a + and M_CBAUD + ld (hl),a ;set baudrate index + dec de + dec de + push de + call init_st + pop de + xor a + ret + +;-------------------------------------------------------------- +; Allow the output buffer to drain + +func_tcsetaw: + +;-------------------------------------------------------------- +; Allow the output buffer to drain, discard pending input + +func_tcsetaf: + +;-------------------------------------------------------------- +; Sending a break (250ms .. 500ms) + +func_tcsbrk: + +;-------------------------------------------------------------- +; arg is timeinterval in 0.1sec + +func_tcsbrkp: + +;-------------------------------------------------------------- +; Turn break on + +func_tiocsbrk: + +;-------------------------------------------------------------- +; Turn break off + +func_tioccbrk: + +;-------------------------------------------------------------- +; Software flow control (TCOOFF, TCOON, TCIOFF, TCION) + +func_tcxonc: + +;-------------------------------------------------------------- +; Flush input/output buffer (TCIFLUSH, TCOFLUSH, TCIOFLUSH) + +func_tcflsh: + +;-------------------------------------------------------------- +; Get the number of bytes in the input buffer. + +func_fionread: + +;-------------------------------------------------------------- +; Get the number of bytes in the output buffer. + +func_tiocoutq: + +;-------------------------------------------------------------- +; get the status of modem bits. + +func_tiocmget: + +;-------------------------------------------------------------- +; set the indicated modem bits. + +func_tiocmbis: + +;-------------------------------------------------------------- +; clear the indicated modem bits. + +func_tiocmbic: + +;-------------------------------------------------------------- +; set the status of modem bits. + +func_tiocmset: + +;-------------------------------------------------------------- +; Get the status of the CLOCAL flag in the c_cflag field + +func_tiocgsoftcar: + +;-------------------------------------------------------------- +; Set the CLOCAL flag when *argp is nonzero, and clear it otherwise. + +func_tiocssoftcar: + + or 0ffh + ret + +;-------------------------------------------------------------- + +chk_ptr: + ld a,e + or d + ret nz + cpl + pop hl ret -as1init: +;-------------------------------------------------------------- + +asci_stop: + ld c,stat0 ;Disable rx/tx interrupts xor a ; - out0 (stat1),a ;Disable rx/tx interrupts - ld c,1 ;asci channel number - call as_init + call out_asci_reg - ld hl,rtxisvjmp1 ;rx/tx int vector - ld (ivtab + IV$ASCI1),hl ; + ld c,cntla0 ;Disable receiver and transmitter + ld a,M_RTS0+M_EFR ;RTS/CKA1 + jr out_asci_reg - push ix - ld ix,s1.inbuf - call bufinit - ld ix,s1.outbuf - call bufinit - pop ix +;-------------------------------------------------------------- + +asci_start: + bit 0,(ix+o.reldev) + jr nz,asci_st1 + in0 a,cntla0 ;asci0 + and ~M_RTS0 ;Activate RTS + or M_EFR + out0 (cntla0),a +asci_st1: + ld c,stat0 ; ld a,M_RIE - out0 (stat1),a ;Enable rx interrupts + jr out_asci_reg + +;-------------------------------------------------------------- +; output to asci0/1 register +; +; c: register address +; a: value +; + +out_asci_reg: + push bc + bit 0,(ix+o.reldev) + jr z,$+3 + inc c + ld b,0 + out (c),a + pop bc ret +;-------------------------------------------------------------- +; output 16 bit value to asci0/1 register +; +; c: register address +; hl: value +; a destroyed + +out_asci_reg_hl: + ld a,b ;save b + bit 0,(ix+o.reldev) + jr z,$+4 + inc c + inc c + ld b,0 + out (c),l + inc c + out (c),h + ld b,a + ret - cseg -rtxisvjmp0: - call isv_sw - dw rxtxi0 -rtxisvjmp1: - call isv_sw - dw rxtxi1 +;-------------------------------------------------------------- +; baud rate divider +; +; a: index +; return +; hl: divider + +as_br_div: + push de + push bc + and 0fh + add a,a ;get factor + ld hl,bd150_tab + call add_hla + ld c,(hl) + inc hl + ld b,(hl) + ld hl,(f_cpu) + ld de,(f_cpu+2) + call div32_r + ld bc,32*150 + call div32_r + ld de,2 + or a + sbc hl,de + pop bc + pop de + ret nc + ld hl,0 + ret + +bd150_tab: +; factor index baudrate orig. cp/m + dw 19200/150 ; 0 19200 - + dw 28800/150 ; 1 28800 50 + dw 38400/150 ; 2 38400 75 + dw 57600/150 ; 3 57600 110 + dw 11520/15 ; 4 115200 134.5 + dw 150/150 ; 5 150 + dw 300/150 ; 6 300 + dw 600/150 ; 7 600 + dw 1200/150 ; 8 1200 + dw 1800/150 ; 9 1800 + dw 2400/150 ;10 2400 + dw 3600/150 ;11 3600 + dw 4800/150 ;12 4800 + dw 7200/150 ;13 7200 + dw 9600/150 ;14 9600 + dw 19200/150 ;15 19200 + + +;-------------------------------------------------------------- + + if 0 + +initab0: + db 1,stat0,0 ;Disable rx/tx interrupts + ;Enable baud rate generator + db 1,asext0,M_BRGMOD+M_DCD0DIS ; +M_CTS0DIS + db 2,astc0l +init_br_off equ $ - initab0 + dw 28 + db 1,cntlb0,M_MPBT ;No MP Mode, X16 + db 1,cntla0,M_RE+M_TE+M_MOD2 ;Rx/Tx enable, 8N1 + db 0 + +initab1: + db 1,stat1,0 ;Disable rx/tx ints, disable CTS1 + db 1,asext1,M_BRGMOD ;Enable baud rate generator + db 2,astc1l,low 3, high 3 + db 1,cntlb1,M_MPBT ;No MP Mode, X16 + db 1,cntla1,M_RE+M_TE+M_MOD2 ;Rx/Tx enable, 8N1 + db 0 + endif ;-------------------------------------------------------------- dseg -as0ista: +asci0_ista: push ix ld ix,s0.inbuf ; call ff_empty @@ -107,7 +524,7 @@ as0ista: ;-------------------------------------------------------------- -as1ista: +asci1_ista: push ix ld ix,s1.inbuf ; call ff_empty @@ -117,36 +534,83 @@ as1ista: ;-------------------------------------------------------------- ; Get an input character -as0inp: +if 0 +asci0_inp: push ix ld ix,s0.inbuf ; call ff_cnt cp 32 - jr c,a0i_1 + jr nc,a0i_1 di in0 a,(cntla0) res RTS0,a + set EFR,a out0 (cntla0),a ei a0i_1: call ff_get pop ix ret +endif + + +asci0_inp: + push ix + ld ix,s0.inbuf ; + call ff_gech + ld a,b ;remaining chrs in buffer + cp s0.rx_len/4 ; < 32? + jr nc,a0i_2 ; no, just get char + ld b,(ix+oint.fflags) ; yes, enable RTS if needed + bit CRTS_IFLOW,b ; yes, enable RTS if needed + jr z,a0i_1 ; no needed + di ; needed, enable + in0 a,(cntla0) + and ~M_RTS0 ;assert RTS + or M_EFR ;don't reset error flags + ei + out0 (cntla0),a +a0i_1: + bit IXOFF,b ; XON/XOFF on input? + jr z,a0i_2 ; no + di + set TDC1,(ix+oint.stat) ; + in0 a,(stat0) ; + or M_TIE ; + ei + out0 (stat0),a ; +a0i_2: + ld a,c + pop ix + ret ;-------------------------------------------------------------- ; Get an input character -as1inp: +asci1_inp: push ix ld ix,s1.inbuf ; - call ff_get + call ff_gech + ld a,b ; remaining chars in buffer + cp s0.rx_len/4 ; == 25% full? + jr nz,a1i_2 ; no, just get char + bit IXOFF,(ix+oint.fflags) ; XON/XOFF on input? + jr z,a1i_2 ; no + di + set TDC1,(ix+oint.stat) ; + in0 a,(stat1) ; + or M_TIE ; + out0 (stat1),a ; + ei +a1i_2: + ld a,c ; get back the char pop ix ret ;-------------------------------------------------------------- ; Output status -as0osta: +asci0_osta: push ix ld ix,s0.outbuf ; call ff_full @@ -156,7 +620,7 @@ as0osta: ;-------------------------------------------------------------- ; Output status -as1osta: +asci1_osta: push ix ld ix,s1.outbuf ; call ff_full @@ -166,165 +630,200 @@ as1osta: ;-------------------------------------------------------------- ; put character in c in buffer ; destroys hl, bc -; returns output char in a -as0out: +asci0_out: push ix ; ld ix,s0.outbuf ; - call ff_put + call ff_puth + pop ix ; + ld a,(as0_dev+o.stat) ;Transmitter stopped? + bit TOFF,a ; + ret nz ; yes di ; - in0 c,(stat0) ; - set TIE,c ; - out0 (stat0),c ; + in0 a,(stat0) ; + or M_TIE ; + out0 (stat0),a ; ei ; - pop ix ; ret ;-------------------------------------------------------------- ; put character in c in buffer ; destroys hl, bc -; returns output char in a -as1out: +asci1_out: push ix ; ld ix,s1.outbuf ; - call ff_put + call ff_puth + pop ix ; + ld a,(as1_dev+o.stat) ;Transmitter stopped? + bit TOFF,a ; + ret nz ; yes di ; - in0 c,(stat1) ; - set TIE,c ; - out0 (stat1),c ; + in0 a,(stat1) ; + or M_TIE ; + out0 (stat1),a ; ei ; - pop ix ; ret -;------------------------------------------ -; ASCI 1 Transmit/Receive interupt routines - - dseg -rxtxi0: - in0 e,(stat0) ;receive flag set? 5 - jp p,txisv0 ; - - in0 a,(rdr0) ;todo: break detection 9 - in0 d,(cntla0) ; 1 - res EFR,d ; - bit FE,e ;framing error? - jr nz,?0ri_1 +;-------------------------------------------------------------- - push ix - ld ix,s0.inbuf ; - ld hl,s0.inbuf ; - ld c,(ix+o.in_idx) ; - ld b,0 - add hl,bc - ld (hl),a + cseg +rtxisvjmp0: + call isv_sw + dw asci0_int - ld a,c ; - inc a - and (ix+o.mask) - ld c,a - sub (ix+o.out_idx) ; - jr z,$+5 ;skip if buffer is full - ld (ix+o.in_idx),c - jr nc,$+6 - add (ix+o.mask) - inc a - cp 96 - jr c,$+4 - set RTS0,d ;RTS inactive - pop ix -?0ri_1: - out0 (cntla0),d ; 1 +rtxisvjmp1: + call isv_sw + dw asci1_int -txisv0: - bit TDRE,e - ret z +;-------------------------------------------------------------- +; ASCI 0/1 Transmit/Receive interupt routines + .lall +asci_int macro dev push ix - ld ix,s0.outbuf ; - - ld a,(ix+o.out_idx) ; - cp (ix+o.in_idx) ;if index.in == index.out - jr z,?0ti_2 ; buffer empty - - ld hl,s0.outbuf ; + ld ix,s&dev&.inbuf ; + ld d,(ix+oint.fflags) +rxtxi&dev&_lp1: + in0 e,(stat&dev) ;get asci status + jp p,txi&dev ;RDRF == Bit 7 + + ; RX Interrupt + + res BREAK,e + in0 a,(asext&dev) ;get break status + and M_BREAK + or e ;merge to other error flags + ld e,a + + in0 a,(cntla&dev) ;reset all error flags + and ~M_EFR ; + out0 (cntla&dev),a ; + + ld c,(ix+o.in_idx) ;get input index + ld b,0 ; + ld hl,s&dev&.inbuf ; + base = input buffer pointer + add hl,bc ; + + in0 b,(rdr&dev) ;get char + ;todo: break detection + ;todo: parity, framing, overrun error + ld (hl),b + bit IXON,d + jr z,rxi&dev&_x3 + ;test XON/XOFF + ld a,DC3 + cp b + jr nz,rxi&dev&_x1 + set TOFF,(ix+oint.stat) ;Stop transmitter + jr rxtxi&dev&_lp1 +rxi&dev&_x1: + ld a,DC1 + cp b + jr nz,rxi&dev&_x2 + res TOFF,(ix+oint.stat) ;Enable transmitter + jr rxi&dev&_txen +rxi&dev&_x2: + bit IXANY,d + jr z,rxi&dev&_x3 + res TOFF,(ix+oint.stat) ;Enable transmitter +rxi&dev&_x3: + + ld a,c ;increment input index + inc a ; + ld b,(ix+o.mask) ; + and b ; ld c,a - ld b,0 - add hl,bc - ld l,(hl) - out0 (tdr0),l ; 7 - - inc a - and (ix+o.mask) - ld (ix+o.out_idx),a - jr ?0ti_3 -?0ti_2: - res TIE,e ;disable tx-int - out0 (stat0),e ; 5 -?0ti_3: - pop ix - ret - -;------------------------------------------ -; ASCI 1 Transmit/Receive interupt routines - - dseg -rxtxi1: - in0 e,(stat1) ;receive flag set? 5 - jp p,txisv1 ; - in0 d,(rdr1) ;todo: break detection 9 - bit FE,e ;framing error? - jr nz,??ri_1 + sub (ix+o.out_idx) ;number of free places in buffer + jr z,rxtxi&dev&_lp1 ;buffer full? + and b ; + ld (ix+o.in_idx),c ; no, update input index + + cp s&dev&.tx_len*3/4 ;buffer now 75% full? + jr nz,rxtxi&dev&_lp1 + + if dev=0 ;only channel 0 has rts line + bit CRTS_IFLOW,d + jr z,rxi0_nocrts + in0 a,(cntla&dev) ; + or M_RTS0+M_EFR ;RTS inactive + out0 (cntla0),a ; +rxi0_nocrts: + endif + + bit IXOFF,d + jr z,rxtxi&dev&_lp1 + ;send XOFF + set TDC3,(ix+oint.stat) +rxi&dev&_txen: + set TIE,e ; + out0 (stat&dev),e ; + jr rxtxi&dev&_lp1 + +txi&dev: + bit TDRE,e ;TX int? + jr z,rxtxi&dev&_exit + + ; TX Interrupt + + ld a,(ix+oint.stat) ;check whether xon/xoff should be sent + tst M_TDC1+M_TDC3 ; + jr z,txi&dev&_char ; no + + ld l,DC3 ;prepare for xoff + bit TDC1,a ;request for xon (also) set? + jr z,txi&dev&_cch ; + ld l,DC1 ; +txi&dev&_cch: + out0 (tdr&dev),l ; + and ~(M_TDC1+M_TDC3) ;reset request flags + ld (ix+oint.stat),a ; + jp rxtxi&dev&_lp1 ; + +txi&dev&_char: + bit TOFF,(ix+oint.stat) + jr nz,txi&dev&_empty ; + + ld hl,s&dev&.outbuf+o.in_idx ;[in] + ld a,(hl) ; + inc hl ;[out] + ld c,(hl) ; + cp c ; + jr z,txi&dev&_empty ; + inc hl ;fifo base + ld b,0 ; + add hl,bc ; + ld a,(hl) ; + out0 (tdr&dev),a ; + inc c ; + ld a,(s&dev&.outbuf+o.mask); + and c ; + ld (s&dev&.outbuf+o.out_idx),a ; + + jp rxtxi&dev&_lp1 + +txi&dev&_empty: + res TIE,e ;disable tx-int + out0 (stat&dev),e ; - push ix - ld ix,s1.inbuf ; - ld hl,s1.inbuf ; - ld c,(ix+o.in_idx) ; - ld b,0 - add hl,bc - ld (hl),d - - ld a,c ; - inc a - and (ix+o.mask) - cp (ix+o.out_idx) ; - jr z,$+5 ;skip if buffer is full - ld (ix+o.in_idx),a +rxtxi&dev&_exit: pop ix -??ri_1: - in0 a,(cntla1) ; 1 - res EFR,a ; - out0 (cntla1),a ; 1 ret + endm -txisv1: - push ix - ld ix,s1.outbuf ; - - ld a,(ix+o.out_idx) ; - cp (ix+o.in_idx) ;if index.in == index.out - jr z,??ti_2 ; buffer empty + dseg +;-------------------------------------------------------------- +; ASCI 0 Transmit/Receive interupt routines - ld hl,s1.outbuf ; - ld c,a - ld b,0 - add hl,bc - ld l,(hl) - out0 (tdr1),l ; 7 - - inc a - and (ix+o.mask) - ld (ix+o.out_idx),a - jr ??ti_3 -??ti_2: - res TIE,e ;disable tx-int - out0 (stat1),e ; 5 -??ti_3: - pop ix - ret +asci0_int: + asci_int 0 +;-------------------------------------------------------------- +; ASCI 1 Transmit/Receive interupt routines +asci1_int: + asci_int 1 end