Does anyone have a simple console Masm32 QuickSort example they might share.
I just wondering, I seem to be having a hard time with it
It's the morning here in the USA, I guess
I just want to see it sort, I'm trying to make a Quick Sort version
of my BubbleSort I posted in Algorithms a few days ago
Thanks Andy
:stupid:
I just wondering, I seem to be having a hard time with it
It's the morning here in the USA, I guess
I just want to see it sort, I'm trying to make a Quick Sort version
of my BubbleSort I posted in Algorithms a few days ago
Thanks Andy
:stupid:
Here is the part I've tried using it in
Main proc
LOCAL Buffer[128]:BYTE
invoke ClearScreen
invoke StdOut,ADDR content
invoke StdOut,ADDR mytop
invoke StdOut,ADDR mytitle
invoke StdOut,ADDR centertop
invoke StdOut,ADDR before
lea eax,nums
push len
push eax
call print
invoke StdOut,ADDR br
invoke StdOut,ADDR after
invoke nrQsortA, Addr nums,Addr count <-------right here
lea eax,nums
push len
push eax
call print
invoke StdOut,ADDR centerb
ret
Main endp
But it just crashes , I just don't know,
I thought it might be as simple as StdOut
I also added the extra lib it needed too
does anyone have a sample
of using Quicksort
Thanks Andy
:stupid:
Main proc
LOCAL Buffer[128]:BYTE
invoke ClearScreen
invoke StdOut,ADDR content
invoke StdOut,ADDR mytop
invoke StdOut,ADDR mytitle
invoke StdOut,ADDR centertop
invoke StdOut,ADDR before
lea eax,nums
push len
push eax
call print
invoke StdOut,ADDR br
invoke StdOut,ADDR after
invoke nrQsortA, Addr nums,Addr count <-------right here
lea eax,nums
push len
push eax
call print
invoke StdOut,ADDR centerb
ret
Main endp
But it just crashes , I just don't know,
I thought it might be as simple as StdOut
I also added the extra lib it needed too
does anyone have a sample
of using Quicksort
Thanks Andy
:stupid:
I don't think you pass the ADDR of count, but the value itself.
You were right,
where i had gone wrong was i used count instead of
11.
like
invoke nrQsortA, nums,count
but I should
have kept the addr for the array and, used a number for count,
like
invoke nrQsortA,Addr nums,11
I'm sure a register should work too, but I'll have too try it.
Do you know much about,
include \masm32\include\oleaut32.inc
includelib \masm32\lib\oleaut32.lib
invoke SysAllocStringByteLen,0,bLen
invoke SysFreeString,hMem
Do they have an Visual C equvalent or well Masm API, I can incorporate in a asm procedure in C,
I know why not all in ASM, but I Love the power of it all
there like big lightning bolts in your C program
Anyway, I did discover the light today of
.data
thisisasmtoo db "This is Great and real ASM too",0ah,0
.code
mov eax,7
mov edx, 9
.if eax == 7 && edx == 9
invoke StdOut, addr thisisrealasmtoo
.endif
I think that is cool, that will lead to a lot better asm programs
and, I read the assembler will optimise it too!
THanks Andy
Oh here's the program
where i had gone wrong was i used count instead of
11.
like
invoke nrQsortA, nums,count
but I should
have kept the addr for the array and, used a number for count,
like
invoke nrQsortA,Addr nums,11
I'm sure a register should work too, but I'll have too try it.
Do you know much about,
include \masm32\include\oleaut32.inc
includelib \masm32\lib\oleaut32.lib
invoke SysAllocStringByteLen,0,bLen
invoke SysFreeString,hMem
Do they have an Visual C equvalent or well Masm API, I can incorporate in a asm procedure in C,
I know why not all in ASM, but I Love the power of it all
there like big lightning bolts in your C program
Anyway, I did discover the light today of
.data
thisisasmtoo db "This is Great and real ASM too",0ah,0
.code
mov eax,7
mov edx, 9
.if eax == 7 && edx == 9
invoke StdOut, addr thisisrealasmtoo
.endif
I think that is cool, that will lead to a lot better asm programs
and, I read the assembler will optimise it too!
THanks Andy
Oh here's the program
I don't have anything against other languages. Your doing very well and should learn many things while your at it. :) All those APIs should be usable from ASM or C.
Is there a site
where you can get the APIs?
Is there anywhere you can see the code of some of the
compliled MASM32 libarys
particularly
oleaut32.lib
Thanks Andy
where you can get the APIs?
Is there anywhere you can see the code of some of the
compliled MASM32 libarys
particularly
oleaut32.lib
Thanks Andy
Don't quite underestand what you mean?
oleaut32.lib is the library file for oleaut32.dll - which should be in your windows directory.
Are you saying you'd like to see usage of the functions within that lib, or the source code to the DLL (ask M$)? Usually, I search this board, or the source code I've downloaded from here for the API function I'm having problems with. If that doesn't work I google. This board and the code posted here is the best resource I know of for ASM, but for C/C++ there are code examples everywhere.
Please, explain more if I missed the broad side of the barn. :tongue:
oleaut32.lib is the library file for oleaut32.dll - which should be in your windows directory.
Are you saying you'd like to see usage of the functions within that lib, or the source code to the DLL (ask M$)? Usually, I search this board, or the source code I've downloaded from here for the API function I'm having problems with. If that doesn't work I google. This board and the code posted here is the best resource I know of for ASM, but for C/C++ there are code examples everywhere.
Please, explain more if I missed the broad side of the barn. :tongue:
I wish I knew how to make the Make a C version
of
invoke SysAllocStringByteLen,0,bLen
and
invoke SysFreeString,hMem
to access
oleaut32.dll
like I did for
EXTERN strcmp:NEAR
mov ebx,dword ptr ;this is sptr->lastname
push ebx
mov edx,dword ptr ;this is sptr->lastname
push edx
call strcmp
Anyway I made a procedure with Hutch's QuickSort
from the M32LIB
But it Crashes when it hits,
this part that deals with the memory section
cmp ecx, Last ; If ecx < Last jump over
jg iNxt
; =========================
; mov eax, cntr
; mov , ecx ;<-- Area it Crashes at
; mov ebx, Last
; mov , ebx
; =========================
; add cntr, 2
iNxt:
I omitted the memory function, because I don't know how to add
those libraries
I guess that's what I need to learn to do, be able to add external libraries for my Visual C ASM procedures
And learn more about what function I have internally available
But were getting there
Andy
:)
of
invoke SysAllocStringByteLen,0,bLen
and
invoke SysFreeString,hMem
to access
oleaut32.dll
like I did for
EXTERN strcmp:NEAR
mov ebx,dword ptr ;this is sptr->lastname
push ebx
mov edx,dword ptr ;this is sptr->lastname
push edx
call strcmp
Anyway I made a procedure with Hutch's QuickSort
from the M32LIB
But it Crashes when it hits,
this part that deals with the memory section
cmp ecx, Last ; If ecx < Last jump over
jg iNxt
; =========================
; mov eax, cntr
; mov , ecx ;<-- Area it Crashes at
; mov ebx, Last
; mov , ebx
; =========================
; add cntr, 2
iNxt:
I omitted the memory function, because I don't know how to add
those libraries
I guess that's what I need to learn to do, be able to add external libraries for my Visual C ASM procedures
And learn more about what function I have internally available
But were getting there
Andy
:)
You add the LIB in the project settings.
I wonder where you put it, and what else you must add to it
like
/c /Cx /coff $(InputPath)
like
/c /Cx /coff $(InputPath)
Project Setting -> Link?? -> Libraries...
I've been using VS.NET beta 2, and have totally forgot VS6. :)
What are you using? The LIB doesn't need options on it, just
add it to the link process. It is more involved to access the
functions from C/C++ though -- the names of the functions
might need to start with an underscore? Others around here
have more experience at this than I. Or, just play with -- it's
hard to break anything too bad. :grin:
I've been using VS.NET beta 2, and have totally forgot VS6. :)
What are you using? The LIB doesn't need options on it, just
add it to the link process. It is more involved to access the
functions from C/C++ though -- the names of the functions
might need to start with an underscore? Others around here
have more experience at this than I. Or, just play with -- it's
hard to break anything too bad. :grin: