atfximen14 | Salut à tous. Je dois, pour l'école, programmer un petit "os" (rire) sur 8086. Pour
cela, j'ai mon main (modification des vecteurs d'interruptions), deux
processus (un qui affiche les lettres de a à z, l'autre qui affiche les
chiffres de 0 à 9) et un dispatcher qui donne le temps processeur à un
processus puis à l'autre. Jusqu'à présent, j'ai du le faire à
l'aide d'interruption logicielle. La prochaine étape est la
modification de ces interruption en interruptions matérielles (08h) Cependant, je n'ai aucune idée comment intégrer cela dans mon code. Le voici, si cela peut vous aider. Code :
- .Model Small
- .Stack
- .Code
- acLettres db "A*"
- acNombres db "0*"
- awAX dw 0,0,0
- awBX dw 0,0,0
- awCX dw 0,0,0
- awDX dw 0,0,0
- awDI dw 0,0,0
- awSI dw 0,0,0
- awBP dw 0,0,0
- awIndic dw 0,1100000000b,1100000000b
- awIP dw 0,OFFSET nbrProcess,OFFSET clock
- wpscour dw 0
- wAdrEffective34 DW ?
- wAdrSegment34 DW ?
- wAdrEffective35 DW ?
- wAdrSegment35 DW ?
- wAdrEffective36 DW ?
- wAdrSegment36 DW ?
- dispatcher PROC
- ;1) Sauvegarde des registres
- push bx
- mov bx,CS:wpscour
- mov CS:awAX[bx],ax
- pop ax
- mov CS:awBX[bx],ax
- mov CS:awCX[bx],cx
- mov CS:awDX[bx],dx
- mov CS:awBP[bx],bp
- mov CS:awDI[bx],di
- mov CS:awSI[bx],si
- mov bp,sp
- ;2) Sauvegarde d'IP et des INDICATEURS
- mov ax,[bp+0]
- mov CS:awIP[bx],ax
- mov ax,[bp+2]
- mov CS:awIndic[bx],ax
- add CS:wpscour,2
- cmp CS:wpscour,4
- jne suite
- mov CS:wpscour,0
- suite:
- mov bx,CS:wpscour
- ;3) Modification d'IP et des INDICATEURS pour le processus suivant
- mov ax,CS:awIP[bx]
- mov [bp+0],ax
- mov ax,CS:awIndic[bx]
- mov [bp+2],ax
- ;4) Restitution des registres
- mov ax,CS:awAX[bx]
- mov bx,CS:awBX[bx]
- mov cx,CS:awCX[bx]
- mov dx,CS:awDX[bx]
- mov bp,CS:awBP[bx]
- mov di,CS:awDI[bx]
- mov si,CS:awSI[bx]
- cmp CS:wpscour,0
- je caracteres
- call nbrprocess
- caracteres:
- call charprocess
- iret
- dispatcher ENDP
- mon_gest PROC
- ;1) Sauvegarde des registres
- push ax
- push cx
- push dx
- push es
- push di
- push si
- ;2) Calcul de l'adresse effective du premier char
- mov ch, 0h
- add cx, cx ;X*2
- mov al, 160
- mul dl ;Y*160
- add cx, ax
- mov bp, cx
- mov cx, 0B800h
- mov es, cx
- mov si, 0h;decalage dans le tableau
- mov di, 0h;decalage dans la mem video: Si*2
- deb_while:
- mov al, [bx+si]
- cmp al, '*'
- je fin_while
- mov BYTE PTR es:[bp+di],al
- add di, 2h
- inc si
- jmp deb_while
- fin_while:
- ;4) Restitution des registres
- pop ax
- pop cx
- pop dx
- pop es
- pop di
- pop si
- iret
- mon_gest ENDP
- charProcess PROC
- lea bx,CS:acLettres
- mov cl,40
- mov dl,5
- mov CS:acLettres,'A'
- mov CS:acLettres+1,'*'
- charwhile_deb:
- int 34h
- inc CS:acLettres
- cmp CS:acLettres, 'Z'
- je finchar
- cmp CS:acLettres, 'z'
- jbe charwhile_deb
- mov CS:acLettres, 'A'
- jmp charwhile_deb
- finchar:
- int 36h
- jmp charwhile_deb
- charProcess ENDP
- nbrProcess PROC
- lea bx,CS:acNombres
- mov cl,40
- mov dl,20
- mov CS:acNombres,'0'
- mov CS:acNombres+1,'*'
- nbrwhile_deb:
- int 34h
- inc CS:acNombres
- cmp CS:acNombres, '9'
- jbe nbrwhile_deb
- int 36h
- jmp nbrwhile_deb
- nbrProcess ENDP
- clock PROC
- clock ENDP
- main:
- ;1) Dfinition des adr de l'intr 34h
- ;1a) Sauvegarde des anciennes adresses de l'intr 34h
- mov ah,35h
- mov al,34h
- int 21h
- mov CS:wAdrSegment34,es
- mov CS:wAdrEffective34,bx
- ;1b) Modification des adresses de l'intr 34h
- mov ah,25h
- mov al,34h
- lea dx,mon_gest
- push cs
- pop ds
- int 21h
- ;2) Dfinition des adr de l'intr 35h
- ;2a) Sauvegarde des anciennes adr de l'intr 35h
- mov ah,35h
- mov al,35h
- int 21h
- mov CS:wAdrSegment35,es
- mov CS:wAdrEffective35,bx
- ;2b) Modifiaction des adresses de l'intr 35h
- mov ah,25h
- mov al,35h
- lea dx,clock
- push cs
- pop ds
- int 21h
- ;3) Dfinition des adr de l'intr 36h
- ;3a) Sauvegarde des anciennes adresses de l'intr 36h
- mov ah,35h
- mov al,36h
- int 21h
- mov CS:wAdrSegment36,es
- mov CS:wAdrEffective36,bx
- ;3b) Modification des adresses de l'intr 36h
- mov ah,25h
- mov al,36h
- lea dx,dispatcher
- push cs
- pop ds
- int 21h
- mov ax,3;vidage d'cran
- int 10h
- call charProcess
- ;Restitution des parametres initiaux
- mov ah,25h
- mov al,34h
- mov ds,CS:wAdrSegment34
- mov bx,CS:wAdrEffective34
- int 21h
- mov ah,25h
- mov al,35h
- mov ds,CS:wAdrSegment35
- mov bx,Cs:wAdrEffective35
- int 21h
- mov ah, 4ch
- int 21h
- end main
| Merci à tous.
|