The news service of my school at MIT, the School of Humanities, Arts, and Social Sciences, has an article about 10 PRINT CHR$(205.5+RND(1)); : GOTO 10.
Also, there has been some furious and pretty amazing program creation and compaction going on in DOS/x86 land. It all seems to have started when demoscener Trixter (a.k.a. Jim Leonard) decided to port 10 PRINT to x86 assembly. His first, straightforward version was 42 bytes long, but he was quickly able to chop it down by replacing the random number generator with a single instruction: 25 bytes. Getting ready of some of the nice and tidy but strictly unnecessary startup and shutdown code brought the program down to 15 bytes. Then, thanks to the clever use of an opcode that I’d never heard of before which is meant for string comparison and is called SCAS, he was able to trim the code to 13 bytes — the shortest he thought it could ever be.
Of course, someone (Peter Ferrie) found a way to get rid of another byte, so the program sat at 12 bytes long.
herm1t came along to provide an optimization that assumed DOS was loaded, reducing the program to 11 bytes.
And, most recently, Peter Ferrie returned to lop off another byte, showing that the program (on Intel CPUs, at least) need only be 10 bytes long.
Trixter provides the full story (so far!) on his blog, Oldskooler Ramblings.
My joke about this is that the shortest possible 10-PRINT-like program will be a single jmp instruction to a run of 8 or 9 bytes that happen to already be in memory. However, this is probably only a joke: the number of possible 8-byte combinations of bits are 256^8 = 18446744073709551616, so it really isn’t very likely, even for an extremely short program of this sort, that it will just happen to be lying around somewhere in memory initially.
Speaking of the demoscene, I mentioned in my last post that viznut has checked out the book. He’s also written a very nice VIC-20 version of the program that uses two of the tiles from the Black Path Game instead of the original diagonal lines:
Finally, we had a great time exhibiting the 10 PRINT program and the 10 PRINT book at the 2013 MLA’s electronic literature exhibit and presenting the program and modifications of it at the MLA offsite electronic literature reading. Thanks to Dene Grigar and Kathi Inman Berens for curating the exhibit and the reading. And, thanks to Patsy Baudoin, Mark C. Marino, and Mark Sample for joining me for that presentation and for offering commentary (play-by-play and color) as I coded on the Commodore 64.
One Reply to “10 PRINT Marches on”
I did have a Commodore 116/16 in the 80’s as a boy, but I haven’t known the 10 PRINT program until recently. I used to draw the pattern on a graph paper, though, when I was bored at school. Later, I implemented a program in Perl that tries to change the maze to eliminate its unreachable parts by connecting them to the existing path. You can view the code at PerlMonks [http://www.perlmonks.org/?node_id=843144] and watch a screencast at Youtube [https://www.youtube.com/watch?v=HqyeksHSoRo].