Retro Festivities Abound in Creating a Christmas Scene on the ZX81


Bringing yuletide cheer to the ZX81 screen, one line of code at a time.

For December, I decided to embrace the Christmas spirit. Inspired by group posts, I created a Christmas tree and snow scene. It needed a little flair, so I added an animated message to the scene. Very retro program for my ZX81.

# Generating Christmas spirt.

Fitting the mood, I started with the tree. Based on a routine posted for the tree compilation a few years ago, I modified it to work on the ZX81. The ZX81 can't execute multiple commands on a single line. This required me to expand the routine a bit and center it on the page. Done, right?

Well, not quite. I liked an idea from another post that used varying snowflake sizes. I refactored the program into logical sections and added a new routine to display the snowfall. It's similar to how I’ve generated stars in other programs. In this case, I used RND and a string to print the flakes.

Christmas Tree, ZX81 Screenshot, 2023 by Steven ReidChristmas Tree, ZX81 Screenshot, 2023 by Steven Reid

With that look done, I then worked on the message. Again, it’s much like other animations I’d done as a teenager. I went through a few iterations until I settled on the final message. The message is in inverted characters with rotating stars. Simple enough to make using a pair of print statements.

# Comments and structure.

For some reason, I decided to focus on program structure. Something that is very different than most of my programs. I have built programs with aesthetics before, but rarely. I was in the mood.

After getting the tree to work, I moved the routine to a subroutine. The initial section of the program consists of a list of routine calls using GOSUB. I reordered things a bit, first printing the screen, then the snow, followed by the tree, and finally the message.

Christmas Tree, ZX81 Animation, 2023 by Steven ReidChristmas Tree, ZX81 Animation, 2023 by Steven Reid

There is one I don’t call directly. That one saves the program so that it will run when loaded. I used RUN 70 to start the saved program. Once the message loop finishes, the program restarts with another RUN. It looks repetitive, but I don’t have many options in ZX81 BASIC.

# Merry belated Christmas.

And with that, I've conveyed my message. It’s late as I was busy spending time with the family and doing other things. Better late than never. I still like the look, but I would have liked to animate the snow a bit. The ZX81 would be pretty slow with that. It gives me something to work on next year.



Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive