flat assembler
Message board for the users of flat assembler.

 Index > Main > Recursion
Author
Custodian

Joined: 08 Jun 2004
Posts: 10
Location: Russia
Custodian 15 Jun 2004, 09:38
Does anybody know, how organize recursion?
I know a method, but if we cannot analize our recursion calls (how many times we would call our function), it won't work.

thx...

_________________
--- Line of Cut ---
15 Jun 2004, 09:38
pelaillo
Missing in inaction

Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 15 Jun 2004, 12:55
The following is a useful example of recursion:
A very nice implementation of QuickSort by BitRAKE.

15 Jun 2004, 12:55
Matrix

Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 23 Oct 2004, 05:58
pelaillo wrote:
The following is a useful example of recursion:
A very nice implementation of QuickSort by BitRAKE.

Hello Pelailo,
i see bitrake can copy c quicksort routines , but can he convert it to assembly ?
23 Oct 2004, 05:58
Matrix

Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 23 Oct 2004, 07:37
However here's a Bubble sort, its working all right:

Code:
```bubblesort:
lea     ebx,[edi+ecx*4]
mov     eax,[edi]
.cmploop:sub     ebx,4
cmp     eax,[ebx]
jle     .again
xchg    eax,[ebx]
.again:  cmp     ebx,edi
jnz     .cmploop
stosd
loop bubblesort
ret
```
23 Oct 2004, 07:37
roticv

Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 23 Oct 2004, 11:40
Matrix wrote:
pelaillo wrote:
The following is a useful example of recursion:
A very nice implementation of QuickSort by BitRAKE.

Hello Pelailo,
i see bitrake can copy c quicksort routines , but can he convert it to assembly ?

I doubt you have the rights to insult BitRake.

Btw Matrix, your code is not a recurisive function.
23 Oct 2004, 11:40
Matrix

Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 23 Oct 2004, 11:59
I don't know him, i can only guess where did he got his codes.
Anyway i whouldn't post something that i have not tested to work and is causing an exception.
23 Oct 2004, 11:59

Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
calm down
23 Oct 2004, 13:58
Matrix

Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 23 Oct 2004, 14:06
i'm always calm
23 Oct 2004, 14:06
beppe85

Joined: 23 Oct 2004
Posts: 181
beppe85 26 Oct 2004, 11:40
Why bother with recursion?

You just use as if it were other function, the only thing you must remember is that you get a new set of locals at each invocation. So you must (generally) implement reentrant code, and care of memory usage.
26 Oct 2004, 11:40

Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
recursion is elegant, beppe85
26 Oct 2004, 15:21
beppe85

Joined: 23 Oct 2004
Posts: 181
beppe85 26 Oct 2004, 15:49
conrade, I'd agree with you. I'm refering to the "way to use", not "to use or not to use".
26 Oct 2004, 15:49
veach1

Joined: 16 Jul 2004
Posts: 165
veach1 26 Oct 2004, 21:05
Quote:
Does anybody know, how organize recursion?

...to understand recursion you must understand recursion...

26 Oct 2004, 21:05
pelaillo
Missing in inaction

Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 26 Oct 2004, 21:29
MATRIX wrote:
I don't know him, i can only guess where did he got his codes.

BitRAKE is a known and knowledgeable assembly programmer. I don't imagine how can be possible that you didn't hear about him.
However, if you are intersted in the writing process of this snippet, give a look here: http://board.win32asmcommunity.net/topic.php?t=2361

Quote:
Anyway i whouldn't post something that i have not tested to work and is causing an exception.

Do you have a fact to give such assertion? Because I've used this code in many situations and always worked flawlessly.
26 Oct 2004, 21:29
Matrix

Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 26 Oct 2004, 21:57
I don't know
what programs did he wrote?
or he is developing quicksort routines?
26 Oct 2004, 21:57

Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
yes, he is developing quicksort routines for a living

frankly, I wouldn't have heard of bitRAKE unless I was a visitor on win32asmcommunity board
Randall Hyde would be more of a character you would certainly hear about it if you were doing assembly
27 Oct 2004, 02:46
pelaillo
Missing in inaction

Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 27 Oct 2004, 13:29
This is becoming useless ranting.

What about the exception matter?? I am more interested in debugging a useful routine.
27 Oct 2004, 13:29
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum