Talk:The Commodore 64

From Maze

Current revision as of 20:58, 25 July 2011 by Nickm (Talk | contribs) (→[Removed] Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I was wondering if anyone knew about the origins of the question mark as a substitute for the PRINT command in BASIC?

The C64 Programmer's Reference Manual explains why you'd want to use abbreviations (to squeeze more commands on a 80-character line, see pp. 24-25 of the PRM), but not why a question mark is used for PRINT. The only other info I found is here: http://www.classiccmp.org/pipermail/cctech/2005-November/053488.html.

BTW, the PRM (obviously) has some other good stuff to include in the C64 chapter. There's a whole section on "crunching" BASIC programs, i.e. squeezing in as much as possible on a single line. These methods include abbreviations, the colon, and shortening line numbers. The fact that the C64 so explicitly encouraged crunching programs is another great example of how the C64 encouraged programming and experimentation.--MarkSample 20:29, 10 July 2011 (UTC)

NOTE: Discuss graphics for different characters sets - SCIIs. Atari, IBM, etc?

Section Below Moved from Intro to Chapter

Imagine it's 1982 and you've just sat down in front of your Commodore 64. As you stare at the television set attached to this small computer-in-a-keyboard object, you see the word "READY" and a blinking cursor. Earlier in the day a "neat little program"[1] in the Random Graphics section of the manual caught your eye:

 10 PRINT "{SHIFT-CLR/HOME}"
 20 PRINT CHR$(205.5 + RND(1));
 40 GOTO 20 
 

Like many microcomputers of its day, the C64 came with a BASIC interpreter built in so that once you could begin writing programs right out of the box. After you carefully type in the program from the manual[2], you input "RUN". The screen erupts into motion as lines flow onto the screen. As each row fills with symbols, it starts drawing on the next line. When the screen is full, the entire maze moves up and leaves space at the bottom for new characters to fill. The result is a dynamic maze. The three-line program introduced here is nearly equivalent to the one-line namesake of this book with the only difference being that the condensed version doesn't clear the screen as in the first line of the expanded code.

[tk-Photos of the program running on an actual C64, since we have screenshots of it all over the place before now]

The three lines of code that create this continually generating maze do so because of the specific design of the C64, paired with the design of the BASIC language in which the program is written. The manual explains the code element by element, first introducing the idea of a character code and then pointing out the importance of the number 205.5 specifically. The explanation of how the code works is followed by something even more valuable: an invitation to modify the code, change it, and make it your own based on what you've read.


[Removed] Notes

[1] Commodore 64 User's Guide, p 53. [2] It's unclear why the lines are ordered 10, 20, 40, but the omission of 30 is likely a copy error in the manual and therefore not of importance in discussing the code.

[By the way, I don't think [2] is particularly true. I think the program may have simply been numbered 10, 20, 40 and copied faithfully into the manual. Many BASIC programming books have programs with irregular line numbers. Programmers probably just didn't care to renumber them in steps of 10, and only worried about whether they were in the right order and the program worked. -nm]

Personal tools