Author: Jonathan Harston Category: Christmas Challenge System: PDP11 running Bell Unix Language: PDP11 machine code Source length: 1477 bytes File length: 141 bytes Executable length: 125 bytes Instructions: Copy the file 'xmas2024c' to a Bell Unix PDP11 system. Ensure it is executable by setting the access with 'chmod 555 xmas2024c'. Run by typing 'xmas2024c'. The image shows the program running on an emulated PDP11 with an ASR33 teletype at mdfs.net/tty. Boot unix by entering 'unix', then run the demo by typing 'xmas2024'. Description: The program is four nested loops, looping between each block of characters, each line of characters, each line, and each block of lines. The output counter is toggled between 0 and 7 to output either 1 or 8 copies of each loop: either a character horizontally or a line vertically. The two characters used on a line are both held in a single 16-bit register, and SWAB is used to toggle between which one is output. At the end of each set of lines the "+-" and "! " characters are toggled between. It turns out that to toggle between "+-" and "! " you can XOR with &0D0A, which just happens to be the CR/LF sequence used at the end of each line, so this is used on the return from printing the end-of-line sequence to swap between the two character pairs. Space is also saved by using the 'ribbon' string as the character output workspace. Interesting that the code ends up 5*5*5 bytes long. The code has the standard 16-byte boiler-plate header to run on a Bell Unix system.