mov eax,0ffh
mov ecx,0ffh
div ecx
push ecx
INVOKE wsprintf,ADDR register1,ADDR DecimalFormat,eax
pop ecx
INVOKE wsprintf,ADDR register2,ADDR DecimalFormat,edx
invoke MessageBox,NULL,addr register1,addr register2,MB_OK
invoke ExitProcess,NULL
end start
this wont work how can i possibly screw up div ecx?
comment that out and it works fine. put it back in and it dosen't I just wrote it to verify that I couls do modulus division easily but it apears that i cant to division at all opcodes.hlp said that if the i divided by a byte then ah would contain the remainder if i divided by a wrod. the remainder would be in CX (in the example above) so i figured that the remainder would be in ecx if i divided a dword. so i wrote this and was going to play around with it changeing values and such untill i had it all figured out except that all it will do is crash :mad: HELP!
Hi dionysus
You forgot to clear edx.
KetilO
You forgot to clear edx.
mov eax,0ffh
mov ecx,0ffh
xor edx,edx
div ecx
push ecx
INVOKE wsprintf,ADDR register1,ADDR DecimalFormat,eax
pop ecx
INVOKE wsprintf,ADDR register2,ADDR DecimalFormat,edx
invoke MessageBox,NULL,addr register1,addr register2,MB_OK
invoke ExitProcess,NULL
end start
KetilO
WOW THX!!!! :P opcodes never said you had to clear out edx to use div but it works hehe. btw yea EDX keeps the remainder :)
You can read more about Div Here...
ok so now I can use div to divide numbers up to 64 bits.... how can i divide REALLY HUGE numbers?
Afternoon, dionysus.
ummmm...
Shouldn't that be...
Cheers,
Scronty
ummmm...
push ecx
INVOKE wsprintf,ADDR register1,ADDR DecimalFormat,eax
pop ecx
INVOKE wsprintf,ADDR register2,ADDR DecimalFormat,edx
Shouldn't that be...
push [COLOR=red]edx[/COLOR]
INVOKE wsprintf,ADDR register1,ADDR DecimalFormat,eax
pop [COLOR=red]edx[/COLOR]
INVOKE wsprintf,ADDR register2,ADDR DecimalFormat,edx
?
Cheers,
Scronty
dionysus: Although DIV divides a 64-bit number, it cannot divide any 64-bit number by any 32-bit number. The result has to fit in eax (as edx is used for the remainder), so the result has to be 32-bits at most.
You can't divide 12345678ABCDEF99h by 3. As the result would be 61172283944A533h which will never fit in eax. This will cause an integer overflow exception, just like you had when you forgot to clear eax.
Thomas
You can't divide 12345678ABCDEF99h by 3. As the result would be 61172283944A533h which will never fit in eax. This will cause an integer overflow exception, just like you had when you forgot to clear eax.
Thomas
erm yes scronty. but i didnt know for shure what register would end up with what in em... so I was checking them all.
nan sweet site has a couple of different opcodes files than what i have lol looks like the later would have saved me from this lol
thomas thx for the additional info.
oh yea any one know how to divide really huge numbers im talkin big now. REAL BIG like as in speed of light... pffft its tiny hehe
nan sweet site has a couple of different opcodes files than what i have lol looks like the later would have saved me from this lol
thomas thx for the additional info.
oh yea any one know how to divide really huge numbers im talkin big now. REAL BIG like as in speed of light... pffft its tiny hehe
oh yea any one know how to divide really huge numbers im talkin big now. REAL BIG like as in speed of light... pffft its tiny hehe
There have been some threads about this, one is:
http://www.asmcommunity.net/board/index.php?topic=2294
But I remember there was one that explained it in more detail.. can't find it anymore though.
I also believe some people have written big number libraries to handle really big numbers, do a search on bignum or biglib.
Thomas