Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
  You are not logged in - nap
Smallest Endless Loop Without "GOTO"   [2011]

Smallest Endless Loop Without Released by :
Monte Carlos

Release Date :
7 September 2011

Type :
C64 Basic Demo

User rating:awaiting 8 votes (8 left)

Credits :
Code .... Monte Carlos of Cascade

Download :

Look for downloads on external sites:
 Pokefinder.org


User Comment
Submitted by Jak T Rip on 11 September 2011
Wow, thanks for the explanation on GoTo / JMP! I was not aware of JMPs being an indication for badly structured code, but yes, it makes sense!
User Comment
Submitted by TheRyk on 8 September 2011
"If you need to JMP around all crazy you have structured your code wrong in the first place and you'll have a nightmare finding bugs."

So true :) Being an ASM beginner I messed up NeoTunes so badly back then with JMP/JSR/RTS that I couldn't find the bug anymore and only patching by copying the stack helped. Bad style, of course ^^
User Comment
Submitted by Monte Carlos on 8 September 2011
@Perplex: RUN is lame because it clears all variables. ;)
User Comment
Submitted by JackAsser on 8 September 2011
@DeeKay: Because in a structured environment you could jmp in and out of different nesting levels and stack levels causing all kinds of weird bugs.

Jumping out from a different nesting level is not so bad (i.e. c/c++ et al's break). Jumping out from a stack frame all of a sudden is not so bad either (i.e. return etc).

However jumping directly into a different nesting level, f.e. straight into a for-loop is bad. You will jump past the looping-variable initialization making it alot harder to debug and predict.

Jumping directly into another stack level (like JMPing into a subroutine that ends with an RTS) will make the stack pointer go crazy.

So, avoiding JMPs all together makes the code easier to predict and debug. As Oswald said, JMPs on the C64 is most often used to extend the range of the branches, or for endless loops, or for JMP-tables etc.

If you need to JMP around all crazy you have structured your code wrong in the first place and you'll have a nightmare finding bugs.
User Comment
Submitted by DeeKay on 8 September 2011
funny. I had no idea you could write it "go to" instead of "goto", and I also thought that goto without anything would result in and undef'd statement error...
i played around with it a bit and it seems that for any NaN it does a GOTO 0, and *only* 0, it gives a shit about variables (as expected, always buggered me that you couldn't do GOTO A....)

BTW: Can anyone explain to me why just about every coding authority (Dijkstra etc) hates GOTO so much? 8) it's just the same as JMP in assembly, and I don't think any CPU exists that does not have this command...
User Comment
Submitted by Skate on 8 September 2011
i think this one is the shortest infinite loop possible (3 bytes) and it doesn't include "goto" :p

http://www.akaydin.com/c64/codes/skate/shortest_infinite_loop.p..
User Comment
Submitted by TheRyk on 7 September 2011
Fun. I don't see it as a cheat. :) Wouldn't have been illegal in that competition (which was also fun but also a little strange, not using GOTO was the smallest issue, because too many other commands were allowed. It was rather about how to design a nice listing - whatever that means - and how to use the remaining 800 bytes to do sth beautiful on the screen or even with SID). A pity you didn't join in time, Monte!
User Comment
Submitted by Jak T Rip on 7 September 2011
0 R ╮
User Comment
Submitted by Perplex on 7 September 2011
Actually "0 RUN" would be 2 bytes shorter (and less of a cheat.)
Search CSDb
Advanced
Navigate
Prev - Random - Next
Detailed Info
· Summaries
· User Comments (9)
· Production Notes
Fun Stuff
· Goofs
· Hidden Parts
· Trivia
Forum
· Discuss this release
Support CSDb
Help keep CSDb running:



Funding status:




About this site:
CSDb (Commodore 64 Scene Database) is a website which goal is to gather as much information and material about the scene around the commodore 64 computer - the worlds most popular home computer throughout time. Here you can find almost anything which was ever made for the commodore 64, and more is being added every day. As this website is scene related, you can mostly find demos, music and graphics made by the people who made the scene (the sceners), but you can also find a lot of the old classic games here. Try out the search box in the top right corner, or check out the CSDb main page for the latest additions.
Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.083 sec.