It is currently Mon Dec 11, 2017 6:27 am

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sat Nov 11, 2017 12:48 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2420
The guy who programmed Toy Story used unrolled loops for 3D maze. Is that possible to do bass.exe or other assemblers?


Top
 Profile  
 
PostPosted: Sat Nov 11, 2017 12:53 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5886
Location: Canada
ca65 has the .repeat directive.


Top
 Profile  
 
PostPosted: Sat Nov 11, 2017 2:23 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2420
I looked through the documentation of bass.exe, and I figured out how to have a repeating macros.

Code:
define n(0)
while {n} < 16 {
jsr spawn_single_explosion
evaluate n({n}+1)
}


Top
 Profile  
 
PostPosted: Sat Nov 11, 2017 2:41 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10164
Location: Rio de Janeiro - Brazil
I always use macros to make unrolled loops. Doing it manually is too error-prone and difficult to maintain.


Top
 Profile  
 
PostPosted: Sat Nov 11, 2017 4:50 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5886
Location: Canada
In a situation where you have a way to define a macro (but no repeat), I've found this kind of thing to be a relatively straightforward / low risk of error way to unroll loops:
Code:
.macro THING index
   ; loop iteration here
.endmacro

THING 0
THING 1
THING 2
THING 3
THING 4
THING 5
; ...

Mostly this has come up for me in C or C++ cases where I knew an unroll was warranted but the compiler's optimizer wasn't going to do it on its own. (In a lot of cases just writing a for loop with a simple static range is enough to get the optimizer to unroll anyway, though. This is not something I've had to use frequently at all.)


Top
 Profile  
 
PostPosted: Sun Nov 12, 2017 2:08 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 598
^This, and automated with the command to print it in comments.

// for i in `seq 0 15`; do echo THING $i; done


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group