sci.electronics.design rs232 interupt on old ibm pc type machines
Below are an rs232 initialization and a handler routine that work well on later vintage ibm pc types, roughly 200 mc and above. The AT vintage types however are a bust. The 8250 registers and the interupt mask register in the interupt controller appear as expected in both cases. Anyone have an idea what is missing for the older machines?
Hul
_____________________________________________________ ; interupt enable bits DATAIN equ 1 ; data availalbe TRANEMP equ 2 ; transmit holding reg empty RECLINE equ 4 ; receive line status MODSTAT equ 8 ; modem status
ptype rsinit ; rsinit(port) -- port assumed 0 for now ; initialize interupt req #4 (int 0c) for rs232 line push bx push cx push dx push ds mov ax, DDDTA ; base of data mov ds, ax
mov dx, 0 call irsadd ; return port address for '0' port (com1) inc dx in al, dx or al, DATAIN ; enable incoming data interupt out dx, al
add dx, 3 in al, dx or al, 8 ; set out2 bit in uart to enable interupts out dx, al
push cs pop cx mov dx, offset rs4hand ; new address for irq 4 handler ; see below push ds mov bx, 0 mov ds, bx mov bx, 2ch cli mov ax, [bx] ; read old address and mov [bx], dx ; place the new one add bx, 2 mov dx, [bx] ; ditto mov [bx], cx sti pop ds mov word ptr ds:[intcadd], ax mov word ptr ds:[intcadd+2], dx ; the org address has been saved
mov dx, 21h ; interrupt control reg in al, dx ; read current interrupt mask register and al, 0FFh-10h ; allow interrupts from COM1 out dx, al
pop ds pop dx pop cx pop bx ret rsinit endp
rs4hand proc near ; handler for interrupt #4 sti ;Allow interrupts ? push ax push bx push dx push ds mov ax, DGROUP mov ds, ax
mov dx, 20h ; System interrupt controller mov al, 20h ; Reset interrupt pending out dx, al ; Put back to system controller
mov dx, 0 ; assume port 0 -- ie COM1 call irsadd ; returns address for passed port inc dx inc dx ; point at interrupt id reg
in al, dx ; get interrupt type test al, 1 ; any interrupt pending? jnz rs4hnd1 ; no - return cmp al, 4 jnz rs4hnd1 dec dx dec dx in al, dx call rsinplc ; places al in recieved data buffer
rs4hnd1: pop ds pop dx pop bx pop ax iret rs4hand Endp