flat assembler
Message board for the users of flat assembler.

Index > Main > Recursion

Author
Thread Post new topic Reply to topic
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.
Please help...

thx...

_________________
--- Line of Cut ---
Post 15 Jun 2004, 09:38
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
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.


Description:
Download
Filename: qsort.inc
Filesize: 2.98 KB
Downloaded: 825 Time(s)

Post 15 Jun 2004, 12:55
View user's profile Send private message Yahoo Messenger Reply with quote
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 Smile , but can he convert it to assembly ?
Post 23 Oct 2004, 05:58
View user's profile Send private message Visit poster's website Reply with quote
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
    
Post 23 Oct 2004, 07:37
View user's profile Send private message Visit poster's website Reply with quote
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 Smile , 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.
Post 23 Oct 2004, 11:40
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
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.
Post 23 Oct 2004, 11:59
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 23 Oct 2004, 13:58
calm down
Post 23 Oct 2004, 13:58
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 23 Oct 2004, 14:06
Hello Comrade,
i'm always calm Smile
Post 23 Oct 2004, 14:06
View user's profile Send private message Visit poster's website Reply with quote
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.
Post 26 Oct 2004, 11:40
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 26 Oct 2004, 15:21
recursion is elegant, beppe85
Post 26 Oct 2004, 15:21
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
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".
Post 26 Oct 2004, 15:49
View user's profile Send private message Reply with quote
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...

Smile
Post 26 Oct 2004, 21:05
View user's profile Send private message Reply with quote
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.
Post 26 Oct 2004, 21:29
View user's profile Send private message Yahoo Messenger Reply with quote
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?
Post 26 Oct 2004, 21:57
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 27 Oct 2004, 02:46
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
Post 27 Oct 2004, 02:46
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
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. Smile
Post 27 Oct 2004, 13:29
View user's profile Send private message Yahoo Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.