schmke@nntp-server.caltech.edu (Kevin Todd Schmidt) (01/24/91)
I am trying to write a simple terminal emulator in assembly language and wish to directly access the hardware registers for the serial port and the interrupt controller. What I am trying to do in the following code fragment is set up COM1 for 9600 baud, no parity, 8 data bits, 1 stop bit, with an interrupt being generated when data is received. That interrupt should then be handled by the readcom subroutine. The problem is that the interrupt is never generated when data is received. If anyone can help I would appreciate it. Please Email responses and I will summarize. ; code fragment ; mov dx, 3FBh ; set DLAB=1 mov al, 80h out dx, al mov dx, 3F8h ; low byte mov al, 0Ch ; 9600 baud out dx, al mov dx, 3F9h mov al, 0 ; high byte out dx, al l1: mov dx, 3FBh ; put port in normal mode mov al, 3 ; 8 data, 1 stop, no parity out dx, al mov dx, 3F9h ; enable interrupt when rec'd data is avail mov al, 1 out dx, al push es mov ax, 350Ch ; get int 0Ch vector int 21h mov word ptr intvec, bx ; and save it mov word ptr intvec[2], es mov dx, offset readcom ; set new vector mov ax, 250Ch int 21h pop es in al, 21h ; unmask IRQ4 and al, 0EFh out 21h, al mov al, 20h out 20h, al ; ; ; other code to receive characters from PC and send out com1 ; this part works ; ; ; this code is never reached because the interrupt is not generated ; readcom PROC FAR push ax push dx mov dx, 3FAh ; read the interrupt id register in al, dx cmp al, 2 jnz rc9 mov dx, 3F8h ; get character in al, dx mov dl, al mov ah, 02h ; and write to screen int 21h rc9: mov al, 20h out 20h, al pop dx pop ax iret readcom ENDP ______________________________________________________________________________ _ ____ _ | | / // _ \ / / | Kevin T. Schmidt | schmke@gap.cco.caltech.edu / // /_/ // / | Jet Propulsion Laboratory | schmidt@mars.jpl.nasa.gov _ / // ____// / | 4800 Oak Grove Dr. | / /_/ // / / /___ | M/S 301-355 | \____//_/ /_____/ | Pasadena, CA 91109 | -- ______________________________________________________________________________ _ ____ _ | | / // _ \ / / | Kevin T. Schmidt | schmke@gap.cco.caltech.edu / // /_/ // / | Jet Propulsion Laboratory | schmidt@mars.jpl.nasa.gov