rs232 interupt on old ibm pc type machines

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

Reply to
Hul Tytus
Loading thread data ...

formatting link

any help?

--
?? 100% natural 

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

Thanks Jasen, I'll take a look.

Hul

Jasen Betts wrote:

Reply to
dbr

Don't see anything wrong offhand, but I don't remember the serial port so well.

I have an XT-compatible if you'd like to test further back.

The BIOS, and DOS, have some serial drivers, but I don't remember if interrupts are offered. It's pretty standard to work directly with the serial hardware, so that doesn't matter much.

You should ask DOS to patch in the interrupt -- see INT 21h, AH = 25h. That way if your program closes abruptly, DOS knows what to fix.

You can also further use DOS to install your own CTRL+BREAK handler (INT

23h) if occasional freezes are a possibility, as sometimes happens in development.

BTW, which assembler are you using? I mostly use MASM, have you considered it? Automatic stack frames is niiice. ;-)

Tim

--
Deep Friar: a very philosophical monk. 
Website: http://seventransistorlabs.com 
 Click to see the full signature
Reply to
Tim Williams

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.