


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture handout was provided at Quaid-i-Azam University for Microprocessor and Assembly Language Programming course by Prof. Saleem Raza. Its main points are: Serial, Port, Indicator, Communication, jump, Transmitted, Received, Carrier
Typology: Study notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



AH = 00h AL = port parameters DX = port number (00h-03h) Return: AH = line status AL = modem status
AH = 01h AL = character to write DX = port number (00h-03h) Return: AH bit 7 = error flag AH bits 6-0 = port status INT 14 - SERIAL - READ CHARACTER FROM PORT AH = 02h DX = port number (00h-03h) Return: AH = line status AL = received character if AH bit 7 clear INT 14 - SERIAL - GET PORT STATUS AH = 03h DX = port number (00h-03h) Return: AH = line status AL = modem status
110 (16550, 82510) timeout interrupt pending 101 (82510) timer interrupt 100 (82510) transmit machine 011 receiver line status interrupt. priority=highest 010 received data available register interrupt. priority=second 001 transmitter holding register empty interrupt. priority=third 000 modem status interrupt. priority=fourth
start: call clrscr ; clear the screen
mov ah, 0 ; initialize port service mov al, 0xE3 ; line settings = 9600, 8, N, 1 xor dx, dx ; port = COM int 0x14 ; BIOS serial port services
xor ax, ax mov es, ax ; point es to IVT base mov word [es:0x0C4], serial mov [es:0x0C4+2], cs ; hook serial port interrupt
mov dx, 0x3FC ; modem control register in al, dx ; read register or al, 8 ; enable bit 3 (OUT2) out dx, al ; write back to register
mov dx, 0x3F9 ; interrupt enable register in al, dx ; read register or al, 1 ; receiver data interrupt enable out dx, al ; write back to register
in al, 0x21 ; read interrupt mask register and al, 0xEF ; enable IRQ 4 out 0x21, al ; write back to register
main: mov ah, 0 ; read key service int 0x16 ; BIOS keybaord services push ax ; save key for later use
retest: mov ah, 3 ; get line status xor dx, dx ; port = COM int 0x14 ; BIOS keyboard services and ah, 32 ; trasmitter holding register empty jz retest ; no, test again
pop ax ; load saved key mov dx, 0x3F8 ; data port out dx, al ; send on serial port
jmp main