;Hi.
;Actually why did you compare eax with -9999 ?
cmp eax,-9999 ;?
----------------------------------------------------------------
;stdcall is pushing on the stack values in the opposite order:
push val2
push val1
call myfunc
low_coder
Junior Poster in Training
55 posts since Nov 2008
Reputation Points: 40
Solved Threads: 4
Not to be nit-picky, but void really don't have a "return".
And since maxInt never really had an input, perhaps there should
be two functions since maxInt just checks the comparisons.
bool maxInt(int, int, int&)
{
...return true if x and y have a diffrence...
}
void printInt(int x, int y, int big)
{
if(x == -9999) { ...set kill signal... }
bool difference = maxInt(x, y, big);
if(!diffrence) { cout << "They were the same" << endl; }
else
{
cout << "Big is: " << big << endl;
}
}
I suppose it doesn't matter if you have it all in one function or not. Personal preference in design.
MosaicFuneral
Posting Virtuoso
1,691 posts since Nov 2008
Reputation Points: 888
Solved Threads: 116
INCLUDE Irvine32.inc
maxInt proto xVal:DWORD, yVal:DWORD
;.....................
push 2 ; yVal
push 3 ; xVal
call maxInt
;.....................
maxInt proc xVal:DWORD, yVal:DWORD
mov eax, xVal
cmp eax, yVal
jl lbl1
jg lbl2
cmp eax, -9999
jne lbl3
;exit
lbl3:
;they are equal
;exit
lbl1:
;yVal more
;exit
lbl2:
;xVal more
;exit
maxInt endp
;didnt try must work.
low_coder
Junior Poster in Training
55 posts since Nov 2008
Reputation Points: 40
Solved Threads: 4
INCLUDE Irvine32.inc
maxInt proto xVal:DWORD, yVal:DWORD
;.....................
push 2 ; yVal
push 3 ; xVal
call maxInt
;.....................
maxInt proc xVal:DWORD, yVal:DWORD
mov eax, xVal
cmp eax, yVal
jl lbl1
jg lbl2
cmp eax, -9999
jne lbl3
;exit
lbl3:
;they are equal
;exit
lbl1:
;yVal more
;exit
lbl2:
;xVal more
;exit
maxInt endp
;didnt try must work.
low_coder
Junior Poster in Training
55 posts since Nov 2008
Reputation Points: 40
Solved Threads: 4