2004-06-12 23:34:04 +02:00
|
|
|
|
;Adresses de port du contr<74>leur IRQ
|
2007-03-13 21:56:55 +01:00
|
|
|
|
MASTERPIC = 020h ;Adresse de base du PIC ma<6D>tre
|
|
|
|
|
SLAVEPIC = 0A0h ;Adresse de base du PIC esclave
|
|
|
|
|
IRQMASK = 001h ;Offset sur port de masquage
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;Commandes IRQ OCW2
|
2007-03-13 21:56:55 +01:00
|
|
|
|
DISABLEROTATION = 000h ;Desactiver la rotation de priorit<69>s en mode EOI automatique
|
|
|
|
|
EOI = 020h ;End of Interrupt non sp<73>cifi<66>
|
2004-06-12 23:34:04 +02:00
|
|
|
|
COMMANDEOI = 060h ;Commande EOI particuli<6C>re
|
|
|
|
|
ENABLEROTATION = 080h ;Activer la rotation de priorit<69>s en mode EOI automatique
|
|
|
|
|
ROTATIONNOSPEC = 0A0h ;Rotation des priorit<69>s en mode EOI automatique
|
|
|
|
|
SETPRIORITY = 0C0h ;Definir la priorit<69>
|
|
|
|
|
ROTATIONSPEC = 0E0h ;Rotation des priorit<69>s en mode EOI sp<73>cifi<66>
|
|
|
|
|
|
|
|
|
|
;Position des vecteurs d'interruptions
|
2007-03-13 21:56:55 +01:00
|
|
|
|
MASTERFIRSTVECTOR = 008h ;Vecteurs logiciels des interruptions
|
|
|
|
|
SLAVEFIRSTVECTOR = 070h ;<3B>lectroniques
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;OCW3 codes registres
|
|
|
|
|
IRR = 002h ;Interrupt Request Register
|
|
|
|
|
ISR = 003h ;In Service Register
|
2007-03-13 21:56:55 +01:00
|
|
|
|
;OCW3 et modes
|
2004-06-12 23:34:04 +02:00
|
|
|
|
OCW3 = 008h ;OCW3
|
|
|
|
|
POLLING = 004h ;Polling bit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ISR = 0Bh ; Pas d'op<6F>ration, pas de Poll, lire ISR OCW3
|
2007-03-13 21:56:55 +01:00
|
|
|
|
IRR = 0Ah ; Pas d'op<6F>ration, pas de Poll, lire IRR
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;Autorise une interruption <20>lectronique
|
2005-12-05 09:16:09 +01:00
|
|
|
|
;Entr<74>e : %1 - Num<75>ro de l'interruption (0-15) <20> autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
2007-03-13 21:56:55 +01:00
|
|
|
|
PROC enableirq FAR
|
2005-12-05 09:16:09 +01:00
|
|
|
|
ARG @irq:word
|
|
|
|
|
USES ax,cx,dx
|
|
|
|
|
mov ax,[@irq]
|
|
|
|
|
mov dx,MASTERPIC+IRQMASK
|
|
|
|
|
cmp al,7
|
|
|
|
|
jbe @@master
|
|
|
|
|
mov dx,SLAVEPIC+IRQMASK
|
|
|
|
|
@@master:
|
|
|
|
|
mov cl,al
|
|
|
|
|
and cl,7
|
|
|
|
|
mov al,1
|
|
|
|
|
shl al,cl
|
|
|
|
|
not al
|
|
|
|
|
mov ah,al
|
|
|
|
|
in al,dx
|
|
|
|
|
and al,ah
|
|
|
|
|
out dx,al
|
|
|
|
|
ret
|
2007-03-13 21:56:55 +01:00
|
|
|
|
endp enableirq
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
;Desactive une interruption <20>lectronique
|
2005-12-05 09:16:09 +01:00
|
|
|
|
;Entr<74>e : %0 - Num<75>ro de l'interruption (0-15) <20> desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
2007-03-13 21:56:55 +01:00
|
|
|
|
PROC disableirq FAR
|
2005-12-05 09:16:09 +01:00
|
|
|
|
ARG @irq:word
|
|
|
|
|
USES ax,cx,dx
|
|
|
|
|
mov ax,[@irq]
|
|
|
|
|
mov dx,MASTERPIC+IRQMASK
|
|
|
|
|
cmp al,7
|
|
|
|
|
jbe @@master
|
|
|
|
|
mov dx,SLAVEPIC+IRQMASK
|
|
|
|
|
@@master:
|
|
|
|
|
mov cl,al
|
|
|
|
|
and cl,7
|
|
|
|
|
mov al,1
|
|
|
|
|
shl al,cl
|
|
|
|
|
not al
|
|
|
|
|
mov ah,al
|
|
|
|
|
in al,dx
|
|
|
|
|
or al,ah
|
|
|
|
|
out dx,al
|
|
|
|
|
ret
|
2007-03-13 21:56:55 +01:00
|
|
|
|
endp disableirq
|
2005-12-05 09:16:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Signale "End Of Interrupt" de l'interruption %0
|
2007-03-13 21:56:55 +01:00
|
|
|
|
PROC seteoi FAR
|
2005-12-05 09:16:09 +01:00
|
|
|
|
ARG @irq:word
|
|
|
|
|
USES ax,dx
|
|
|
|
|
mov ax,[@irq]
|
|
|
|
|
cmp al,7
|
|
|
|
|
jbe @@master
|
|
|
|
|
mov al,EOI
|
|
|
|
|
out SLAVEPIC,al
|
|
|
|
|
@@master:
|
|
|
|
|
mov al,EOI
|
|
|
|
|
out MASTERPIC,al
|
|
|
|
|
ret
|
2007-03-13 21:56:55 +01:00
|
|
|
|
endp seteoi
|
2005-12-05 09:16:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Lit les masques d'un contr<74>leur IRQ dans ax, 0 master ou slave 1 ds %1
|
2007-03-13 21:56:55 +01:00
|
|
|
|
PROC readmaskirq FAR
|
2005-12-05 09:16:09 +01:00
|
|
|
|
ARG @controleur:word
|
|
|
|
|
USES bx,dx
|
|
|
|
|
mov bx,[@controleur]
|
|
|
|
|
mov dx,MASTERPIC+ IRQMASK
|
|
|
|
|
cmp bl,0
|
|
|
|
|
jne @@master
|
|
|
|
|
mov dx,SLAVEPIC+ IRQMASK
|
|
|
|
|
@@master:
|
|
|
|
|
xor ah,ah
|
|
|
|
|
in al,dx
|
|
|
|
|
pop dx
|
|
|
|
|
ret
|
2007-03-13 21:56:55 +01:00
|
|
|
|
endp readmaskirq
|
2005-12-05 09:16:09 +01:00
|
|
|
|
|
|
|
|
|
;Lit le registre d'<27>tat d'un contr<74>leur IRQ dans ax, 0 master ou slave 1 ds %1
|
2007-03-13 21:56:55 +01:00
|
|
|
|
PROC readisr FAR
|
2005-12-05 09:16:09 +01:00
|
|
|
|
ARG @controleur:word
|
|
|
|
|
USES bx,dx
|
|
|
|
|
mov bx,[@controleur]
|
|
|
|
|
mov dx,MASTERPIC
|
|
|
|
|
cmp bh,0
|
|
|
|
|
jne @@master
|
|
|
|
|
mov dx,SLAVEPIC
|
|
|
|
|
@@master:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov al,ISR
|
2005-12-05 09:16:09 +01:00
|
|
|
|
out dx,al
|
|
|
|
|
xor ah,ah
|
|
|
|
|
in al,dx
|
|
|
|
|
ret
|
2007-03-13 21:56:55 +01:00
|
|
|
|
endp readisr
|
2004-06-12 23:34:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Lit le registre d'<27>tat d'un contr<74>leur IRQ dans al, 0 master ou slave 1 ds bh
|
2007-03-13 21:56:55 +01:00
|
|
|
|
PROC readirr FAR
|
2005-12-05 09:16:09 +01:00
|
|
|
|
ARG @controleur:word
|
|
|
|
|
USES bx,dx
|
|
|
|
|
mov bx,[@controleur]
|
|
|
|
|
mov dx,MASTERPIC
|
|
|
|
|
cmp bh,0
|
|
|
|
|
jne @@master
|
|
|
|
|
mov dx,SLAVEPIC
|
|
|
|
|
@@master:
|
2007-03-13 21:56:55 +01:00
|
|
|
|
mov al,IRR
|
2005-12-05 09:16:09 +01:00
|
|
|
|
out dx,al
|
|
|
|
|
xor ah,ah
|
|
|
|
|
in al,dx
|
|
|
|
|
ret
|
2007-03-13 21:56:55 +01:00
|
|
|
|
endp readirr
|