BruNews
Messages postés
21040
Date d'inscription
jeudi 23 janvier 2003
Statut
Modérateur
Dernière intervention
21 août 2019
3 août 2004 à 00:05
ben faut juste additionner et soustraire, c'est cela ?
Alors fais dans le simple.
C'est quoi tous ces 'dumpregs', servent a quoi ?
.586
.model flat, stdcall
option casemap :none
option prologue:none
option epilogue:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.data
val1 DD 8
val2 DD -15
val3 DD 20
szbuff DB 24 dup(0)
szappname DB "Test",0
.code
start:
ALIGN 4
mov eax, val2
neg eax
add eax, 7
sub eax, val3
add eax, val1
mov ecx, offset szbuff
call itoa
push 0
push offset szappname
push offset szbuff
push 0
call MessageBox
progEnd:
push 0
call ExitProcess
itoa PROC ; IN: EAX INT32, ECX *psz
push edi
test eax, eax
mov edi, ecx
jnz short noZero
lea eax, [ecx+1]
mov byte ptr[ecx], '0'
pop edi
mov byte ptr[eax], 0
ret 0
noZero:
jge short supEgZero
mov byte ptr [edi], '-'
neg eax
inc edi
supEgZero:
push esi
mov ecx, eax
mov esi, edi
supZero:
mov eax, -858993459
mul ecx
mov eax, edx
shr eax, 3
mov edx, ecx
lea ecx, [eax+eax*4]
add ecx, ecx
sub edx, ecx
add dl, '0'
mov [edi], dl
mov ecx, eax
inc edi
test eax, eax
jnz short supZero
mov byte ptr[edi], 0
mov eax, edi
reverStr:
cmp esi, edi
jae i32toaExit
dec edi
mov cl, [esi]
mov dl, [edi]
mov [edi], cl
mov [esi], dl
inc esi
jmp short reverStr
i32toaExit:
pop esi
pop edi
ret 0
itoa ENDP
end start
ciao...
BruNews, Admin CS, MVP Visual C++