feat: passage a la convention d'appel stdcall
BREAKING CHANGE: attention modification majeure du code
This commit is contained in:
parent
8c1701b5af
commit
8db2a163d4
272
noyau/8259a.asm
272
noyau/8259a.asm
|
@ -1,55 +1,39 @@
|
|||
.model tiny
|
||||
.model tiny,StdCall
|
||||
.486
|
||||
smart
|
||||
.code
|
||||
Locals
|
||||
jumps
|
||||
|
||||
org 0h
|
||||
|
||||
include ..\include\mem.h
|
||||
include ..\include\bmp.h
|
||||
|
||||
start:
|
||||
jmp tsr
|
||||
db 'PIC8259A'
|
||||
Tsr:
|
||||
cli
|
||||
cmp ax,1234h
|
||||
jne nomore
|
||||
mov ax,4321h
|
||||
jmp itsok
|
||||
nomore:
|
||||
push bx
|
||||
mov bl,ah
|
||||
xor bh,bh
|
||||
shl bx,1
|
||||
mov bx,cs:[bx].tables
|
||||
mov cs:current,bx
|
||||
pop bx
|
||||
call cs:current
|
||||
itsok:
|
||||
jnc noerror
|
||||
push bp
|
||||
mov bp,sp
|
||||
or byte ptr [bp+6],1b
|
||||
pop bp
|
||||
mov ax,cs
|
||||
shl eax,16
|
||||
mov ax,cs:current
|
||||
jmp endofint
|
||||
noerror:
|
||||
push bp
|
||||
mov bp,sp
|
||||
and byte ptr [bp+6],0FEh
|
||||
pop bp
|
||||
endofint:
|
||||
sti
|
||||
iret
|
||||
current dw 0
|
||||
tables dw enableirq
|
||||
dw disableirq
|
||||
dw readmaskirq
|
||||
dw readirr
|
||||
dw readisr
|
||||
dw installhandler
|
||||
dw replacehandler
|
||||
dw getint
|
||||
dw setint
|
||||
dw seteoi
|
||||
header exe <,1,0,,,,offset exports,>
|
||||
|
||||
exports:
|
||||
db "enableirq",0
|
||||
dw enableirq
|
||||
db "disableirq",0
|
||||
dw enableirq
|
||||
db "readmaskirq",0
|
||||
dw readmaskirq
|
||||
db "readirr",0
|
||||
dw readirr
|
||||
db "readisr",0
|
||||
dw readisr
|
||||
db "installhandler",0
|
||||
dw installhandler
|
||||
db "replacehandler",0
|
||||
dw replacehandler
|
||||
db "getint",0
|
||||
dw getint
|
||||
db "setint",0
|
||||
dw setint
|
||||
db "seteoi",0
|
||||
dw seteoi
|
||||
dw 0
|
||||
|
||||
;Adresses de port du contr“leur IRQ
|
||||
MASTERPIC = 020h ;Adresse de base du PIC maŒtre
|
||||
|
@ -82,98 +66,118 @@ IRR = 0Ah ; Pas d'op
|
|||
|
||||
|
||||
;Autorise une interruption ‚lectronique
|
||||
;Entr‚e : AL - Num‚ro de l'interruption (0-15) … autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
||||
EnableIRQ:
|
||||
push ax cx dx
|
||||
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
|
||||
pop dx cx ax
|
||||
ret
|
||||
;Entr‚e : %1 - Num‚ro de l'interruption (0-15) … autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
||||
EnableIRQ PROC FAR
|
||||
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
|
||||
EnableIRQ endp
|
||||
|
||||
;Desactive une interruption ‚lectronique
|
||||
;Entr‚e : AL - Num‚ro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
||||
DisableIRQ:
|
||||
push ax cx dx
|
||||
mov dx,MASTERPIC+IRQMASK
|
||||
cmp al,7
|
||||
jbe master2
|
||||
mov dx,SLAVEPIC+IRQMASK
|
||||
master2:
|
||||
mov cl,al
|
||||
and cl,7
|
||||
mov al,1
|
||||
shl al,cl
|
||||
mov ah,al
|
||||
in al,dx
|
||||
or al,ah
|
||||
out dx,al
|
||||
pop dx cx ax
|
||||
ret
|
||||
;Entr‚e : %0 - Num‚ro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
||||
DisableIRQ PROC FAR
|
||||
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
|
||||
DisableIRQ endp
|
||||
|
||||
;Signale "End Of Interrupt" de l'interruption al
|
||||
SetEOI:
|
||||
push ax dx
|
||||
cmp al,7
|
||||
jbe master3
|
||||
mov al,EOI
|
||||
out SLAVEPIC,al
|
||||
master3:
|
||||
mov al,EOI
|
||||
out MASTERPIC,al
|
||||
pop dx ax
|
||||
ret
|
||||
|
||||
;Lit les masques d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh
|
||||
ReadmaskIrq:
|
||||
push dx
|
||||
mov dx,MASTERPIC+ IRQMASK
|
||||
cmp bh,0
|
||||
jne Master5
|
||||
mov dx,SLAVEPIC+ IRQMASK
|
||||
master5:
|
||||
in al,dx
|
||||
pop dx
|
||||
ret
|
||||
;Signale "End Of Interrupt" de l'interruption %0
|
||||
SetEOI PROC FAR
|
||||
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
|
||||
DisableIRQ endp
|
||||
|
||||
|
||||
;Lit les masques d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
|
||||
ReadmaskIrq PROC FAR
|
||||
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
|
||||
ReadmaskIrq endp
|
||||
|
||||
;Lit le registre d'‚tat d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
|
||||
ReadISR PROC FAR
|
||||
ARG @controleur:word
|
||||
USES bx,dx
|
||||
mov bx,[@controleur]
|
||||
mov dx,MASTERPIC
|
||||
cmp bh,0
|
||||
jne @@master
|
||||
mov dx,SLAVEPIC
|
||||
@@master:
|
||||
mov al,isr
|
||||
out dx,al
|
||||
xor ah,ah
|
||||
in al,dx
|
||||
ret
|
||||
ReadISR endp
|
||||
|
||||
|
||||
;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh
|
||||
ReadISR:
|
||||
push dx
|
||||
mov dx,MASTERPIC
|
||||
cmp bh,0
|
||||
jne Master6
|
||||
mov dx,SLAVEPIC
|
||||
master6:
|
||||
mov al,isr
|
||||
out dx,al
|
||||
in al,dx
|
||||
pop dx
|
||||
ret
|
||||
|
||||
;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh
|
||||
ReadIRR:
|
||||
push dx
|
||||
mov dx,MASTERPIC
|
||||
cmp bh,0
|
||||
jne Master7
|
||||
mov dx,SLAVEPIC
|
||||
master7:
|
||||
mov al,irr
|
||||
out dx,al
|
||||
in al,dx
|
||||
pop dx
|
||||
ret
|
||||
ReadIRR PROC FAR
|
||||
ARG @controleur:word
|
||||
USES bx,dx
|
||||
mov bx,[@controleur]
|
||||
mov dx,MASTERPIC
|
||||
cmp bh,0
|
||||
jne @@master
|
||||
mov dx,SLAVEPIC
|
||||
@@master:
|
||||
mov al,irr
|
||||
out dx,al
|
||||
xor ah,ah
|
||||
in al,dx
|
||||
ret
|
||||
ReadIRR endp
|
||||
|
||||
;remplace le handler pointer par ds:si en bx:100h interruption ax
|
||||
replacehandler:
|
||||
|
|
Loading…
Reference in New Issue