The "10 print" maze generator in 15 bytes of x86 assembler.
thread: mov dl,'/' in al,41h aaa jp print mov dl,'\' print: mov ah,02h int 21h jmp thread
It ain't much yet this reproduces the famous
10 print program from the Commodore 64 Basic manual featured in a brilliant book 10 print by Nick Montfort et al.
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
The original Commodore 64 BASIC program consists in an infinite loop that randomly prints out the character 205 or 206, i.e. the slash or back-slash characters, which as they fill the screen form some intricate pattern akin to a maze or a weaving thread.
How does it work
There is not much science in this piece of code.
dl is first set to output the character
/, then we check the system clock, do a little BCD ( binary coded decimal ) dance around the current tick count, and either jump to output the character stored in
dl, or switch
dl to the character
\ and output it, and finaly we repeat the procedure until the user breaks the program by pressing
Kicking the ball
My x86 fu was rusty, so my only hope with this production was to get the ball rolling and see other takes on this seemingly simple problem.
About one hour after I published Thread JS on Pouet, a comment in Thread over, the 12 bytes record on C64 linked to 10 and 11 bytes versions of
10 PRINT program for DOS turning the memory into a woven maze!
init: scasb salc and al,'\'-'/' add al,'/' int 29h jmp init
The feedback to Thread on Pouet.net was positive. This took off some of the dust out of my x86 assembler fu, got some cool tricks and pointers from the best size optimizers and shed some light on even smaller renditions of the
10 PRINT program.
Other recent experiments
There are many experiments and projects like THREAD to discover other here.
- MUSIC FOR TINY AIRPORTS 2/1 🛫 Celebrating the 40 years anniversary of Brian Eno's "Ambient 1: Music for Airports" with an homage written in 256 bytes with the Web Audio API.
- THEY COME AT DUSK 👺 A survival horror game for JS1k 2018, where you run away from dead miners as you hear your heart beat. Turn around using the arrow keys until all you hear is beeeeeeeep.
- FRONTFEST MOSCOW It was an honour to be invited to Fronfest Moscow 2017 with the little family to give my first workshop; implementing a Twin-stick shooter using ES6 and Canvas, and to continue my CODE🎙ART series of talks + live coding aiming to inspire new web developer artists.
- CODING⬢ART AT SCRIPT'17 Script'17 was all kinds of awesome: Great organization, line up, venue, catering, diverse and welcoming. It was a pleasure to talk to you all and LIVE code something useless before the party. Looking forward to see useless things from you all.
- DRAGON PUNCH An itsy bitsy Dragon curve renderer in 121 bytes.
- THREAD JS Breaking the 64 bytes fronteer with the famous "10 print" maze generator.
Don't be shy; get in touch by mail, twitter, github, linkedin or pouet if you have any questions, feedback, speaking, workshop or performance opportunity.