Author: Jonathan Harston Category: Christmas Challenge System: PDP11 running Bell Unix Language: PDP11 machine code Source length: 1945 bytes File length: 122 bytes Executable length: 106 bytes Instructions: Copy the file 'xmas2022d' to a Bell Unix PDP11 system. Ensure it is executable by setting the access with 'chmod 555 xmas2022d'. Run by typing 'xmas2022d'. At mdfs.net/tty is an online demo on an emulated ASR33 teletype. Boot unix by entering 'unix', then run the demo by typing 'xmas'. Description: The program encodes the star as a raster bitmap, as though it was an image to be displayed on a bitmapped display. Each bit of the bitmap is translated to a space for the background, and a star for the foreground. The code fetches each 16-bit bitmap, then loops through each bit converting it to a space or star by shifting each bit out and branching with the carry flag. Now, the image is 17 by 17 characters, but each 16-bit word can only represent 16 bits. So, we encode an exception in that if the first bit is set - bit 15 tested with BranchMinus - then we double the first bit, resulting in two stars. That allows use to squeeze a 17-bit bitmap into a 16-bit word. The bitmap data simply uses a zero word as a terminator. Naturally, this means we can't have a blank line in an image, but for this example this is fine. In the interests of squeezing the code down, no attempt is made to centre the star, either vertically or horizontally. The code has some boiler-plate header and interface code to run on a Bell Unix system.