exo3 Programme assembleur Instruction ; IP ; AX ; BX ; FlagZ ; SP ; STACK Etat initial ; 01 00; 00 00; 00 00; 0; FF FE; 00 00 00 00 00 00 MOV AX, 0100h (B8 00 01); 01 03; 01 00; 00 00; 0; FF FE; 00 00 00 00 00 00 MOV BX, 0304h (BB 04 03); 01 06; 01 00; 03 04; 0; FF FE; 00 00 00 00 00 00 ADD AL, 1 (04 01); 01 08; 01 01; 03 04; 0; FF FE; 00 00 00 00 00 00 CMP AL, 2 (3C 02); 01 0A; 01 01; 03 04; 0; FF FE; 00 00 00 00 00 00 JNE Boucle (75 FA); 01 06; 01 01; 03 04; 0; FF FE; 00 00 00 00 00 00 ADD AL, 1 (04 01); 01 08; 01 02; 03 04; 0; FF FE; 00 00 00 00 00 00 CMP AL, 2 (3C 02); 01 0A; 01 02; 03 04; 1; FF FE; 00 00 00 00 00 00 JNE Boucle (75 FA); 01 0C; 01 02; 03 04; 1; FF FE; 00 00 00 00 00 00 PUSH AX (50); 01 0D; 01 02; 03 04; 1; FF FC; 00 00 01 02 00 00 PUSH BX (53); 01 0E; 01 02; 03 04; 1; FF FA; 00 00 01 02 03 04 dans emu 8086 #fasm# org 100h MOV AX,0100h MOV BX,0304h Boucle: ADD AL,1 CMP AL,2 JNE Boucle PUSH AX PUSH BX ret EXO3/2 @Instruction; Instruction ASM ; IP ; AX ; BX ;Etat initial ; 01 00; 00 00; 00 00 01 00 ;MOV AX,3 (B8 03 00); 01 03; 00 03; 00 00 01 03 ;DEC AX (48); 01 04; 00 02; 00 00 01 04 ;MOV BX,AX (8B D8); 01 06; 00 02; 00 02 01 06 ;DEC AX (48); 01 07; 00 01; 00 02 01 07 ;ADD BX,AX (03 D8); 01 09; 00 01; 00 03 01 09 ;CMP AX,0 (3D 00 00); 01 0C; 00 01; 00 03 01 0C ;JNE Boucle (75 F8); 01 06; 00 01; 00 03 01 06 ;DEC AX (48); 01 07; 00 00; 00 03 01 07 ;ADD BX,AX (03 D8); 01 09; 00 00; 00 03 01 09 ;CMP AX,0 (3D 00 00); 01 0C; 00 00; 00 03 01 0C ;JNE Boucle (75 F8); 01 0E; 00 00; 00 03 01 0E ;RET (C3); 01 0F; 00 00; 00 03 Dans emu8086: #fasm# org 0100h MOV AX,3 DEC AX MOV BX,AX Boucle: DEC AX ADD BX,AX CMP AX,0 JNE Boucle ret Exo supplémentaire: Additionner 36 et 15 ->D'abord placer 40 dans AX ->Décrementer jusqu'a 36 ->Placer 10 dans BX ->Incrementer jusqua 15 ->Ajouter BX a AX ->Push AX Resultat: #fasm# org 0100h MOV AX,40 decA: DEC AX CMP AX,36 JNE decA MOV BX,10 incB:INC BX CMP BX,15 JNE incB PUSH AX PUSH BX POP AX POP BX ADD AX,BX PUSH AX ret