BASIC CHR 205.5
From Maze
Jump to:
navigation
,
search
This wiki is a read-only archive; the page source is shown below.
10 PRINT CHR$(205.5+RND(1)); : GOTO 10 This is a one-line adaptation that uses the same method as the [[media:C64 Users Guide 53.png|three-line version in the ''Commodore 64 User's Guide'']], which is from 1982 and is the earliest known published version of the program. == How long is this program? == Thirty-nine characters, as written above. The C64 supports abbreviations for keywords -- "?" for "PRINT" and generally unshifted first letter shifted second letter for other keywords. You also don't have to use spaces in a C64 BASIC program unless you want to print a space. And, any line number, including 1, is as good as 10. So if you type this on a C64, you'll input the program using only 22 keystrokes (plus the return that you need at the end): <code>1?cH(205.5+rN(1));:gO1</code> (Note that "c" will appear as the uppercase letter "C" and "H" will appear as a |-like symbol. "N" will appear as /-like symbol that is output by the program.) If you list this, the representation that is produced is 32 characters long: <code>1 PRINTCHR$(205.5+RND(1));:GOTO1</code> <b>Update, 17 July 2011:</b> Actually it is possible to trim the compressed version by one character (21 characters long): <code>0?cH(205.5+rN(1));:gO</code> Since "GOTO" by itself will jump to line 0. Also, "RUN" can be used instead of "GOTO," so that the expanded listing is a mere 30 characters long: <code>1 PRINTCHR$(205.5+RND(1));:RUN</code> RUN is [http://www.lemon64.com/forum/viewtopic.php?t=34879&sid=9526087188346ea3450fe0568566466b reported online] to be slower than GOTO, which makes sense as there should be some overhead to RUN and not just an unconditional jump. == Runs on the Commodore PET == This program runs unmodified on a PET (released in 1977). To run it on the VICE PET emulator (xpet), you should first change to the "shifted" text mode by typing: poke 59468,12 [[Image:CHR_205_Running_on_a_PET.png]]
Views
Page
Discussion
View source
History
Personal tools
Log in / create account
Navigation
Main page
Recent changes
Help
Search
Toolbox
What links here
Special pages
Permanent link