- .386
- code segment use16
- assume cs:code,ds:code
- prog:
- cli
- xor ax,ax
- mov fs,ax
-
- in al,21h ;démasque l'IRQ4
- and al,0EFh
- out 21h,al
-
- mov ax,cs ;détourne l'IRQ4
- shl eax,16
- mov ax,offset irq4
- mov fs:[0Ch*4],eax
-
- mov al,80h ;DLAB=1
- mov dx,3FBh
- out dx,al
-
- mov dx,3F8h ;9600 bits/s
- mov al,0Ch
- out dx,al
- xor al,al
- inc dx
- out dx,al
-
- mov dx,3FBh ;8 bits de données, 1 bit d'arrêt, aucune parité, DLAB=0
- mov al,03h
- out dx,al
-
- mov dx,3FCh ;active l'irq
- mov al,8
- out dx,al
-
- mov dx,3F9h ;active l'interruption en réception de données
- mov al,1
- out dx,al
-
- dec dx
-
- sti
- loop1:
- xor ax,ax
- int 16h
- out dx,al ;envoie un caractère
-
- cmp ah,01h ;quitte si la touche ESC est pressé
- jnz loop1
- mov ax,4C00h
- int 21h
-
- irq4: ;écrit le caractère reçu
- push ax
- push dx
- mov dx,3F8h ;lit un caractère du tampon de réception
- in al,dx
- mov ah,0Eh ;l'affiche à l'écran
- int 10h
- mov al,20h ;EOI
- out 20h,al
- pop dx
- pop ax
- iret
-
- code ends
- end prog
.386
code segment use16
assume cs:code,ds:code
prog:
cli
xor ax,ax
mov fs,ax
in al,21h ;démasque l'IRQ4
and al,0EFh
out 21h,al
mov ax,cs ;détourne l'IRQ4
shl eax,16
mov ax,offset irq4
mov fs:[0Ch*4],eax
mov al,80h ;DLAB=1
mov dx,3FBh
out dx,al
mov dx,3F8h ;9600 bits/s
mov al,0Ch
out dx,al
xor al,al
inc dx
out dx,al
mov dx,3FBh ;8 bits de données, 1 bit d'arrêt, aucune parité, DLAB=0
mov al,03h
out dx,al
mov dx,3FCh ;active l'irq
mov al,8
out dx,al
mov dx,3F9h ;active l'interruption en réception de données
mov al,1
out dx,al
dec dx
sti
loop1:
xor ax,ax
int 16h
out dx,al ;envoie un caractère
cmp ah,01h ;quitte si la touche ESC est pressé
jnz loop1
mov ax,4C00h
int 21h
irq4: ;écrit le caractère reçu
push ax
push dx
mov dx,3F8h ;lit un caractère du tampon de réception
in al,dx
mov ah,0Eh ;l'affiche à l'écran
int 10h
mov al,20h ;EOI
out 20h,al
pop dx
pop ax
iret
code ends
end prog