flat assembler
Message board for the users of flat assembler.

 Index > Macroinstructions > Tower of Hanoi
Author
quiveror

Joined: 20 Jun 2003
Posts: 34
quiveror 11 Jun 2006, 10:56
This is how I waste my time during long holiday. Change no_disk to 16 to make fasm produce 65535 lines of output

Code:
```no_disk fix 5
iterator equ
rept no_disk x { iterator equ x }
macro define_solve {
macro solve src,dst \{
match x,iterator \\{
temp equ iterator
restore iterator
define_solve
match =a =b,src dst \\\{ solve a,c \\\}
match =a =c,src dst \\\{ solve a,b \\\}
match =b =a,src dst \\\{ solve b,c \\\}
match =b =c,src dst \\\{ solve b,a \\\}
match =c =a,src dst \\\{ solve c,b \\\}
match =c =b,src dst \\\{ solve c,a \\\}
purge solve
display 'move a disk from ',\\`src,' to ',\\`dst,13,10
define_solve
match =a =b,src dst \\\{ solve c,b \\\}
match =a =c,src dst \\\{ solve b,c \\\}
match =b =a,src dst \\\{ solve c,a \\\}
match =b =c,src dst \\\{ solve a,c \\\}
match =c =a,src dst \\\{ solve b,a \\\}
match =c =b,src dst \\\{ solve a,b \\\}
purge solve
iterator equ temp
restore temp
\\}
\}
}
define_solve
solve a,c
purge solve,define_solve
rept no_disk { restore iterator }
restore iterator
```
11 Jun 2006, 10:56
daluca

Joined: 05 Nov 2005
Posts: 86
daluca 20 Aug 2006, 06:11
well I tried with 16 and it just give me an Error: out of memory message
even with the maximum memory :65536
20 Aug 2006, 06:11
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8039
Location: Kraków, Poland
Tomasz Grysztar 20 Aug 2006, 09:18
65536 isn't a maximum, you can write there 700000 or so if you wish.
20 Aug 2006, 09:18
daluca

Joined: 05 Nov 2005
Posts: 86
daluca 21 Aug 2006, 01:31
oh i didn't know that: is it measured in bytes or kilobytes?
21 Aug 2006, 01:31

Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
65536 means kilobytes so its 64MB. 700MB would be 716800
21 Aug 2006, 07:09
UCM

Joined: 25 Feb 2005
Posts: 285
UCM 21 Aug 2006, 13:54
Hmm, I had to set the memory to 20485760 to get 16 disks. If it were KB it would be 20GB (previously 10GB); I doubt that that's possible!
21 Aug 2006, 13:54
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8039
Location: Kraków, Poland
Tomasz Grysztar 21 Aug 2006, 14:06
If you set too large value, the lower amount is actually allocated. Trying anything more than 4 GB makes no sense at all, the 32-bit addressing space wouldn't be able to contain it.
You may experiment also with the "-m" switch of command line version, as the latest releases show you how much memory got really allocated.
PS.600000 kilobytes was enough for me to get 16 disks.
21 Aug 2006, 14:06
cod3b453

Joined: 25 Aug 2004
Posts: 618
cod3b453 21 Aug 2006, 20:51
wow that's amazing! pity i dunno how it works

As Tomasz said, 600MB
21 Aug 2006, 20:51
UCM

Joined: 25 Feb 2005
Posts: 285
UCM 21 Aug 2006, 21:15
I probably ran out of swap space
21 Aug 2006, 21:15

Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
maybe it can be optimized to take less! Tomasz - you know the internals - are there any alternative commands that by replacing eat up less memory (even if they are i.e. slower)?
22 Aug 2006, 07:14
daluca

Joined: 05 Nov 2005
Posts: 86
daluca 23 Aug 2006, 20:33
could be included in the compilation result display,along with
the time,passes and number of bytes, the actual amount of memory
that was required to assemble the files?
23 Aug 2006, 20:33
 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