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
| BITS 32
section .data
buff dd 10
section .text
global main
main:
push ebp
mov ebp, esp
mov edi, buff
xor ecx, ecx
xor eax, eax
mov al, 0
remplir: ; REMPLIR
mov byte [edi], al
inc edi
inc eax
inc ecx
cmp ecx, 10
jne remplir
mov eax, buff
xor edx, edx
xor esi, esi
affiche_entier: ; AFFICHE L'ENTIER DANS EAX
mov ecx, 10
div ecx
cmp edx, 0
je fin_affiche
call affiche_chiffre
jmp calcul
end: ; END
mov esp, ebp
pop ebp
mov eax, 0
ret
fin_affiche: ; AFFICHE LE CHIFFRE DANS EAX(QUOTIENT)
push eax
push ebx
push ecx
push edx
mov esi, [eax] ; ICI JE PENSE QUE SA VA SEG_FAULT
add byte [esi], 48
mov eax, 4
mov ebx, 1
mov ecx, esi
mov edx, 1
int 0x80
pop edx
pop ecx
pop ebx
pop eax
jmp end
affiche_chiffre: ; AFFICHE LE CHIFFRE DANS EDX(RESTE)
push eax
push ebx
push ecx
push edx
mov esi, [edx] ; ICI SA SEG_FAULT
add byte [esi], 48
mov eax, 4
mov ebx, 1
mov ecx, esi
mov edx, 1
int 0x80
pop edx
pop ecx
pop ebx
pop eax
ret |
Partager