10 PRINT on the Model T

Last year, MIT Press released a book that examines computing through a miniature art form: the BASIC-language one-liner, or one-line program, and the subculture surrounding it. The title of the book is 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (or 10 PRINT for short). You can buy a paper copy or download a free ebook from 10print.org.

The unusual title of the book is the one-liner itself, a famous one for the Commodore 64 computer that draws an hypnotic, flowing maze pattern on the screen. This maze is the starting point for all the authors’ speculations and essays, and they range widely.

For context, here is a video of the 10 PRINT pattern in action.

As an example of what is to be found in the book, there is a history of mazes and labyrinths; a survey of repeating mathematical shapes in modern art such as dance; and a couple of chapters devoted to porting the one-liner to other platforms. I found that the Applesoft BASIC version given (for the Apple II+ and later) works just the same on my Model T (TRS-80 Model 100 / Tandy 102), because both BASICs are typical Microsoft implementations of the era. However, because both the Apple and the T lack the special graphic characters that make up the maze on the C64, this version uses slash and backslash characters instead (/ and \), and the result is a little unsatisfying.

10 PRINT CHR$(47+(INT(RND(1)*2)*45)); : GOTO 10

Here is a screenshot of this Applesoft code running on the Model T (actually the Virtual T 1.5 emulator running on my Ubuntu netbook). Note that this pattern, and all the others, is moving and constantly growing. (Click to enlarge.)


I decided to see if I could improve on the canonical Applesoft version with some of the Model T’s own graphic characters, and used 4 of them instead of 2 (characters 251 through 254). My one-liner is shorter than the Applesoft version, and the result is more graphically striking, but it doesn’t generate a maze so much as an irregular network of caves. Not quite what I was going for, but if the Model T used screensavers, this would be a pretty good one, I think. Note that this Model T pattern and some of the others below can be duplicated fairly closely on the Commodore 64 as well (see the “Variations in Basic” chapter).

10 PRINT CHR$(251+(INT(RND(1)*4))); : GOTO 10


I wondered if any M100 mailing list members  who’d worked with the graphics characters on the Model T would like to try improving my version and posting their code back to the list, and several did. Jan VANDEN BOSSCHE was the first to respond, saying, “I don’t have a Model T handy – not even an emulator – but what about this?”

10 PRINT CHR$(229.5+RND(1)); : GOTO 10


A nice pattern, especially for writing it in his head. I also like how he managed to keep the “char.5” trick from the original. Jan said, “I could keep the .5 trick because these characters are also next to each other, just like the original C=64 ones.”

Willard Goosey’s judgment was, “Neat pattern, but too closed in to be a maze.” Next, Donald Kyllo offered the following one-liner, to which Willard responded, “Now that’s a maze generator!” I concur.

10 PRINTCHR$(240+INT(RND(1)*10));:GOTO10


Finally, Ken Pettit, a VIP in the Model T community (he runs the Club100 user group and invented the popular NADSBox storage device for the Model T), had more or less the last word. He wrote, ‘Okay, well this sorta breaks the spirit of “10 PRINT”, but I have a one-liner that produces very similar graphics to the C64’s one-liner.  I make the first statement a “10 PRINT” by printing a CHR$(12) (clear screen) in an attempt to keep with tradition of “10 PRINT”.  Otherwise this uses the line command.  Take it for what it is.’

10 PRINTCHR$(12):FORC%=0TO5000:V%=INT(RND(1)+.5):X%=(C%MOD30)*8:Y%=INT((C%/30)MOD8)*8:LINE(X%,Y%)-(X%+7,Y%+7),0,BF:LINE(X%,Y%+7*V%)-(X%+7,Y%+7*(1-V%)):NEXT


I think this and Don Kyllo’s are my favorites. Don’s is more elegant, more in keeping with the original code, but Ken reproduces the original Commodore graphics better. It doesn’t scroll like the others, but fills the screen and starts at the top again with an intriguing ripple effect.

I don’t think that Ken breaks the spirit of 10 PRINT entirely. At least it’s a one-liner, unlike most of the Processing ports in the book, which take a page. On the other hand, the Processing programmers were trying to reproduce the Commodore 64 experience as exactly as possible, as Ken was. At the other extreme, one of the 10 PRINT authors has a student who ported 10 PRINT to (if I recall correctly) 8 bytes of assembly language.

Juan Castro spoke up with a Mattel Aquarius port (!). He remarked, “[The Aquarius] has the convenient ‘spans all character cell’ slashes.” That’s not a port I expected to see.

To my remark that unlike the Aquarius, the Model T doesn’t seem to have graphics characters that fill their cells, John R. Hogerhuis responded, “Alphanumeric and punctuation characters generally don’t fill the cell because of the reserved ‘descender’ line. But the line drawing and block  graphics characters fill the cell.”

Apart from the usual retrotechnical knowhow on the list, there was an unusual amount of artistic and cultural back-and-forth, as well as a fair amount of negative reaction. Paper copies of 10 PRINT have been selling very well, but it has been a little controversial. Some people think it’s pointlessly academic. I read it from front to back and enjoyed it a great deal, and I will point out that some of the authors of the book are technically adept professional developers of games and other applications for platforms as diverse as Facebook and the Atari 2600, not atechnical pomo flyweights.

Books recommended on-list for people who enjoy 10 PRINT include:

And that is where we left the conversation, Reader, but it’s not over. Please leave a comment with your own perspective on the 10 PRINT phenomenon. Have a port to an obscure platform, a link to a video of one, a favorite one-liner with a different purpose, news about a similar project, or hate mail? As long as it’s not pink and doesn’t come in a can, please comment away.


5 thoughts on “10 PRINT on the Model T

  1. Fun! Just gave this a try on one of my favorite retro machines (and the one I cut my teeth on), the TI-99/4A. You’ll need the Extended BASIC cartridge for this one, as the build-in TI BASIC language doesn’t support multiple commands on a single line. It actually just fits within four lines, which was the entry limit for the line editor (even though you could cram more in by entering the end of the line, recalling it in the editor, and then inserting more at the beginning.

    10 PRINT CHR$(INT(128.5+RND));::CALL CHAR(128,”83070E1C3870E0C1″)::CALL CHAR(129,”C1E070381C0E0783″)::GOTO 10

    The TI-99/4A had an interesting character-oriented graphics mode, providing a basic ASCII character set, with the upper ranges available to the user for definition as 8×8 bitmaps. Given the hardware support for graphics of this type (and lack of any convenient ability to address the entire screen as a bitmap), this was the normal approach taken.

    This is what’s being done in the ‘CALL CHAR’ lines, which redefine character codes 128 and 129 as bitmaps. I took a liberty with the graphics relative to the original to make the lines smooth (the ’83’ and ‘C1′ at the ends of each string), which also results in little standalone dots in the center of empty squares. The PETSCII-style graphics can be reproduced by changing those to ’03’ and ‘C0’ in each string. In a real program, the CALL CHARs would have been executed just once, at the start of the program, and wouldn’t be iterated over repeatedly.

    Character codes greater than 127 were used, as the normal ASCII ranges revert to the regular characters when the program ends. At first I tried to use 205 (in order to stick as close to the original as possible), but Extended BASIC saves memory by only allowing codes up to 144.

    To give this a try on Windows, I’d recommend the Classic99 emulator (http://www.harmlesslion.com/cgi-bin/showprog.cgi?search=Classic99); the only Linux one I’ve used is MESS, which can be a bit annoying. In Classic99, select Cartridge|Apps|Extended BASIC from the menu, press any key once it boots, and then press ‘2’ to launch the cartridge. You can then key in the program and run it using ‘RUN’. To break out, the CLEAR key-combo needs to be pressed. On original hardware, this would have been done using FCTN+4; in Classic99, this is mapped to ALT+4. (The keymap can be viewed from the help menu.)

    The TI-99/4A is a fun machine, and still one of my favorites. If you want to check out some of my favorite games that I played the most during that period, take a look at Munch Man and Hunt the Wumpus (which is different than the classic text-based version). Tunnels of Doom is the all-time best, a first-person dungeon adventure with top-down combat (Classic 99 auto-populates the disk drive, so just load data from disk 1 and type ‘QUEST’ when prompted for a filename.

    Thanks for an excuse for an enjoyable diversion!


  2. Great comments so far! I look forward to trying the TI/99 version on an emulator soon. (Zenoli, did I fix your typos correctly?)

    Juan, please keep trying with the Fujitsu. Maybe at least something like the Applesoft version will work.

    Here’s some good info about Juan’s Fujitsu FM-7: http://www.nausicaa.net/~lgreenf/fm7page.htm

    And I forgot to link to the Virtual T emulator so people can try the code for themselves. http://virtualt.sourceforge.net/


    • Cheers, Ron…wish that WP would just allow comment editing, but I suppose I can see why it’s not allowed by default. Unfortunately, though, the fix isn’t quite right…the strings in the one-liner were correct as they stood (“8307…E0C1” and “C1E0…0783”). The fix should actually be applied to the text explaining CALL CHAR, two paragraphs below…that’s where the ‘0E’ should have been a ’03’.

      As bitmaps (and, as did any TI-99/4A owner, I went through a LOT of graph paper on these as a kid)…the version in the code is:

      1000 0011 = 83
      0000 0111 = 07
      0000 1110 = 0E
      0001 1100 = 1C
      0011 1000 = 38
      0111 0000 = E0
      1110 0001 = C1

      And the PETSCII imitation changes the first and last lines, removing the extra pixel in the corner that smooths out the lines.

      0000 0011 = 03

      1100 0000 = C0

      The typo had meant that the first line would have been

      0000 1110 = 0E

      which would be pretty darned ugly!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s