Hi Everyone
I wonder if anyone knows how to list the
contents of an array in Masm32, but I guess
you need to look at is my source
What I mean is that it only lists one element of the array and then crashes, I'm using
StdOut to show my contents.
I also changed the code so it won't lock up on my host's server, but I have arrows pointing
to where it crashes,
If I get past this hurdle, I want to do a bubblesort
CGI
http://busybeesolutions.com/cgi-bin/intro/cgidemo2.exe
Source
http://busybeesolutions.com/sourcefiles/cgidemo2.asm
Here is the problem code
lea edx,nums
topp:
inc num1
mov eax, ; <-------- This is what makes it crash
invoke wsprintf,ADDR sizeBuffer,ADDR printint,eax
invoke StdOut,ADDR br
invoke StdOut,ADDR sizeBuffer
add edx,4 ; <-----The Increment
invoke StdOut,ADDR lf
cmp num1,5
jl plopy
:stupid:
I wonder if anyone knows how to list the
contents of an array in Masm32, but I guess
you need to look at is my source
What I mean is that it only lists one element of the array and then crashes, I'm using
StdOut to show my contents.
I also changed the code so it won't lock up on my host's server, but I have arrows pointing
to where it crashes,
If I get past this hurdle, I want to do a bubblesort
CGI
http://busybeesolutions.com/cgi-bin/intro/cgidemo2.exe
Source
http://busybeesolutions.com/sourcefiles/cgidemo2.asm
Here is the problem code
lea edx,nums
topp:
inc num1
mov eax, ; <-------- This is what makes it crash
invoke wsprintf,ADDR sizeBuffer,ADDR printint,eax
invoke StdOut,ADDR br
invoke StdOut,ADDR sizeBuffer
add edx,4 ; <-----The Increment
invoke StdOut,ADDR lf
cmp num1,5
jl plopy
:stupid:
topp:
inc num1
mov eax,num1 ; This way it prints 0 tru 4
invoke wsprintf,ADDR sizeBuffer,ADDR printint,eax
invoke StdOut,ADDR br
invoke StdOut,ADDR sizeBuffer
add edx,4 ; <-----The Increment
invoke StdOut,ADDR lf
cmp num1,5
jl topp
I at first thought it was
invoke wsprintf,ADDR sizeBuffer,ADDR printint,eax
but has to do with array contents
of
lea edx,nums
mov eax,
inc num1
mov eax,num1 ; This way it prints 0 tru 4
invoke wsprintf,ADDR sizeBuffer,ADDR printint,eax
invoke StdOut,ADDR br
invoke StdOut,ADDR sizeBuffer
add edx,4 ; <-----The Increment
invoke StdOut,ADDR lf
cmp num1,5
jl topp
I at first thought it was
invoke wsprintf,ADDR sizeBuffer,ADDR printint,eax
but has to do with array contents
of
lea edx,nums
mov eax,
First of all, EDX is not preserved by the API functions in the loop, so after these functions it can be anything... The only registers that are saved are ebx, esi and edi (and ebp, esp of course)..
An easier solution is this:
Thomas
An easier solution is this:
xor ebx, ebx
topp:
invoke wsprintf,ADDR sizeBuffer,ADDR printint, dword ptr [offset nums + 4 * ebx]
invoke StdOut,ADDR br
invoke StdOut,ADDR sizeBuffer
invoke StdOut,ADDR lf
inc ebx
cmp ebx, 5
jl topp
Thomas
Thank You Thomas
I got it working, that was big help!, Now I got digest it and make a
bubble sort.
And make a way to parse post info, and break characters into
numbers
CGI
http://busybeesolutions.com/cgi-bin/intro/cgidemo3.exe
Source
http://busybeesolutions.com/sourcefiles/cgidemo3.asm
:alright:
I got it working, that was big help!, Now I got digest it and make a
bubble sort.
And make a way to parse post info, and break characters into
numbers
CGI
http://busybeesolutions.com/cgi-bin/intro/cgidemo3.exe
Source
http://busybeesolutions.com/sourcefiles/cgidemo3.asm
:alright:
There is a bubble sort in the algo section...
invoke wsprintf,ADDR sizeBuffer,ADDR printint,eax
I gotta ask: shouldn't you clean up the stack after that wsprintf call?
wsprintf is declared as C function in windows.inc, and then masm cleans up the stack for you.
Thomas
Thomas