Errors in “10 PRINT CHR$(205.5+RND(1)); : GOTO 10″

I should start this by saying I love the book 10 PRINT; reading it was a great way to start 2014 and inspired some creativity in me that you can read about here.

It was written by ten or so people, a smart bunch it seems. So I was really surprised when I was reading the chapter about the Commodore 64, page 229 in particular, to find several errors. I was even more surprised to find no one discussing these errors online, and the errors remain in the .pdf version available on their website as of this writing. I tried to contact a couple of the authors (Ian Bogost in particular, because I’m a fan and I found him on Twitter easily) but didn’t catch his attention. I realize he’s a busy guy. So I’ll blog about it, in the hopes it’ll be corrected before the paperback version is released.

Error 1: “1,000 characters do fill the entire screen—in what might be considered an illusory consummation of the maze—before the text scrolls upward, leaving two more twenty-five-character rows to fill.”

This should, of course, be “two more forty-character rows to fill”. The Commodore 64 screen is 40 characters wide, and 25 characters tall; 1000 characters in total. When the screen scrolls upward, the bottom two rows are left empty, requiring 80 new characters of maze to be filled in.

Error 2: “While the code for 10 PRINT specifies one of two characters to display on the screen, it says nothing about where on the screen the chosen character should appear. That placement is defined by the VIC-II chip.”

This statement is sufficiently vague that perhaps it’s not in error, but to be clear: the VIC-II chip has no control over where a PRINTed character will appear on the screen in 10 PRINT; it simply provides the 40×25 character screen that BASIC accesses through the PRINT command, which in turn uses the C-64′s KERNAL operating system. Zero page locations $D6 (line number) and $D3 (column number) are used by the KERNAL to calculate where the character will be plotted in memory.

Error 3: “The large border that surrounds the maze is not addressable by the VIC-II; the thirty-two pixel borders on the left and right and thirty-five pixel borders on the top and bottom were created in consideration of the wide variation within cathode ray tube televisions of the era.”

I’m guessing that these numbers were obtained from an emulator screenshot, but they don’t at all represent what the VIC-II does. Depending on the version of the VIC-II, there are between 403 and 411 pixels visible per scanline (as per the famous VIC-II document); subtracting the 320 pixels of the 40 column screen, we’re left with between 83 and 91 border pixels viewable, if your monitor/TV will show them. I don’t know how they’re split between the left and right sides, but as an odd number, it probably isn’t evenly! The top/bottom values are also incorrect; the VIC-II (again, depending on version) produces between 234 and 284 visible scanlines per frame; subtracting the 200 pixels of the 25 row screen leaves between 34 and 84 potentially viewable pixels worth of border.

Error 4: “Running 10 PRINT in a software emulator, of course, eliminates the need for such a border, though the Commodore 64’s KERNAL nevertheless draws it.”

The KERNAL has no part in drawing the border; this is solely an automatic function of the VIC-II chip. Interestingly, through precise and active manipulation of the VIC-II’s registers, the borders can be prevented from appearing, revealing sprites placed behind that area. This has been used in games to display information (such as scores) in otherwise unusable display space.

Error 5: “In addition to wrapping text automatically, the VIC-II also automatically scrolls the contents of the screen when the cursor is on the bottom row and attempts to move down.”

The VIC-II plays no role in scrolling the contents of the screen in _10 PRINT_. That is done by the BASIC and KERNAL software.

I welcome any corrections to my corrections!

2 Responses to “Errors in “10 PRINT CHR$(205.5+RND(1)); : GOTO 10″”

  1. Tim Says:

    Nice work. Reminded me of happy times programming my Atari 600XL. Hopefully the authors/publishers read this. :)

  2. //\\/\/\\\/\/\\/ Says:

    \\///////// ///// \/////// \/// \\/// \\
    \\/// \\\\\\\/// \/// \\\\\\/// \\/// \\
    \\/////// \\\/// \\/////// \///////// \\
    \\/// \\\\\\\/// \\\\\\\/// /// \\/// \\
    \\/// \\\\\\///// \/////// \/// \\/// \\

Leave a Reply