1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
| DATA SEGMENT ;Déclaration des variables
mes1 db 'TP ARCHIT','$'
mes2 db 'TP n 2','$'
mes3 db "Veuillez appuyer sur une touche pour effectuer l'operation:$"
msg_1 db "LE PROCESSEUR SIGNAL UN ETAT D'OVERFLOW$"
msg_2 db "OPERATION EFFECTUE SANS ERREUR D'OVERFLOW$"
ancien_cs dw ?
ancien_ip dw ?
x dw 0ffffh
y dw 0f00fh
DATA ENDS ;Fin du data segment
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
mov ax,3
int 10h
mov dl,70;la colonne ou on veut apparaitre mes1
mov dh,1 ;la ligne ou on veut apparaitre mes1
mov bh,0
mov ah,2
int 10h
mov ah,9
lea dx,mes1 ;mettre dans dx l'@ effective de mes1
int 21H
mov dl,35;la colonne ou on veut apparaitre mes2
mov dh,5 ;la ligne ou on veut apparaitre mes2
mov bh,0
mov ah,2
int 10h
mov ah,9
lea dx,mes2 ;mettre dans dx l'@ effective de mes2
int 21H
mov dl,0
mov dh,9
mov bh,0
mov ah,2
int 10h
mov ah,9
lea dx,mes3 ;mettre dans dx l'@ effective de mes3
int 21H
mov ah,0ah
lea dx,mes3
int 21h
LireAdd proc near
mov ah, 35h
mov al, 04h
int 21h
mov ancien_ip, bx
mov ancien_cs, es
ret
LireAdd ENDP
Overflow:
mov ax, Data
mov ds, ax
lea dx, msg_1
mov ah, 09h
int 21h
mov ah, 01h
int 21h
iret
Deroutement proc near
mov ax, Data
mov ds, ax
lea dx, Overflow
mov al, 04h
mov ah, 25h
int 21h
ret
Deroutement ENDP
non_overflow proc near
mov ax, Data
mov ds, ax
mov ah, 09h
lea dx, msg_2
int 21h
ret
non_overflow ENDP
Somme proc near
mov ax, Data
mov ds, ax
mov ax, x
mov bx, y
add ax,bx
ret
Somme ENDP
Restoration proc near
mov dx, ancien_ip
mov bx, ancien_cs
mov ds, bx
mov al, 04h
mov ah, 25h
int 21h
ret
Restoration ENDP
;progm princ
mov ax,Data
mov ds,ax
call LireAdd
call Deroutement
call Somme
jo msg
call non_overflow
msg:int 04h
call Restoration
mov ax, 4c00h ; retour au system
int 21h
code ends
end start |
Partager