This is a valid RSS feed.
This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<channel>
<title>Reid’s For Fun</title>
<link>https://www.reids4fun.com</link>
<atom:link href="https://feeds.feedburner.com/ReidsForFun" rel="self" type="application/rss+xml"/>
<description>Reid’s For Fun - Latest News</description>
<language>en-us</language>
<lastBuildDate>Sun, 31 Aug 2025 10:34:00 -0600</lastBuildDate>
<image>
<title>Reid’s For Fun</title>
<link>https://www.reids4fun.com</link>
<url>https://www.reids4fun.com/images/r-badge.png</url>
</image>
<item>
<title>Speeding Up Truchet Tiles on My ZX81 with Machine Code</title>
<link>https://www.reids4fun.com/580/speeding-up-truchet-tiles-on-my-zx81-with-machine-code</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Sun, 31 Aug 2025 10:34:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>monthly</category>
<category>retro</category>
<category>truchet</category>
<category>assembly</category>
<category>z80</category>
<guid>https://www.reids4fun.com/580/speeding-up-truchet-tiles-on-my-zx81-with-machine-code</guid>
<description><img src="https://www.reids4fun.com/images/zx81/truchet-ml-2025-zx81-starting-screenshot-by-steven-reid-320x240.png" alt="Truchet ML, ZX81 Starting Screenshot, 2025 by Steven Reid" style="float:left;margin-right:10px">Having finished my last Truchet tiles program in BASIC, I wondered how fast it would run in machine code. Soon afterward, <a href="https://www.reids4fun.com/zx81/truchetml/play" target="_blank" rel="noopener">I gave it a try</a>, writing a version that runs significantly faster than the BASIC one. Let’s dive in and see how it works. <br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Setting things up.</strong><br>
<br>
Turning Truchet into <a href="https://www.reids4fun.com/zx81/truchetml/asm" target="_blank" rel="noopener">a machine language program</a> was straightforward enough. After copying in my standard template, I stuck with the same looping concept I had originally used. The main loop of the program does just that—setting up the display locations and using the <var>BC</var> register as the <var>X</var> and <var>Y</var> loops.<br>
<br>
<pre>mainloop:
ld de,(d_file)          ; grab display file
inc de                  ; add one
ld b,12                 ; height x 2
y_loop:
ld c,16                 ; width x 2
x_loop:</pre><br>
<br>
With that done, I randomly print a tile—more on that in a bit. The rest of the <var>X</var> loop looks like this:<br>
<br>
<pre>push bc                 ; save loop
call print_a_tile
pop bc                  ; restore loop
call delay
; done with x?
dec c
jp nz,x_loop</pre><br>
<br>
Before closing out the <var>Y</var> loop, I need to shift the display down a row. I could have optimized this a bit to remove the <code>push</code> and <code>pop</code>, but it keeps things more readable. Notice that I jump ahead 34. That’s because each tile is 2×2 and I have to move past the end-of-line return character on the first row, plus the row beneath it (33 with return).<br>
<br>
<pre>push bc
ld bc,34                ; jump ahead
ex de,hl
add hl,bc               ; to next row
ex de,hl
pop bc
; de at start of next row
; done with y?
djnz y_loop
jp mainloop             ; start again!</pre><br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/truchet-ml-2025-zx81-starting-screenshot-by-steven-reid-320x240.png" alt="Truchet ML, ZX81 Starting Screenshot, 2025 by Steven Reid">Truchet ML, ZX81 Starting Screenshot, 2025 by Steven Reid</div>
<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Printing the tiles.</strong><br>
<br>
With the setup complete, now I need to print the tile. First, I have the tile patterns defined later in the program:<br>
<br>
<pre>; Truchet tile patterns
tile_1: db $06,$00,$00,$06
tile_2: db $00,$86,$86,$00</pre><br>
<br>
The <code>print_a_tile</code> routine uses these locations to decide which tile to print. After setting <var>HL</var> to point to the first tile, the program calls a simple 8-bit random number generator. I then compare the result with 127 to decide if I’ll print a different tile.<br>
<br>
<pre>print_a_tile:
; get tile
ld hl,tile_1            ; set to 1st tile data
call rnd                ; get which tile
cp 127                  ; compare to 50%
jp m, print_tile        ; print first tile
ld hl,tile_2            ; set to 2nd tile data</pre><br>
<br>
At this point, <var>DE</var> points at the screen location of the tile, while <var>HL</var> points at the tile data. This is important since I’m going to use the <code>ldi</code> instruction to copy the contents at <var>HL</var> directly to the screen.<br>
<br>
<pre>print_tile:
        ; de = display file location
        ; hl = tile pattern data
        ld bc,33        ; next row
       ; print 1st row
        ldi             ; print 1st char
        ldi             ; print 2nd char</pre><br>
<br>
At this point, half the Truchet tile is displayed. To print the bottom half, I move the display pointer down a line. Before I do that, I save <var>DE</var> since it’s already pointing to the correct location for the next tile, thanks to how <code>ldi</code> works. This is also why I set <var>BC</var> to 33 instead of 31. Here’s the code for the second row:<br>
<br>
<pre>        push de         ; save display location
        ex de,hl
        add hl,bc       ; move to print tile
        ex de,hl
        ; print 2nd row
        ldi             ; print 1st char
        ldi             ; print 2nd char
        pop de          ; restore location
        ret</pre><br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/truchet-2025-zx81-screenshot-by-steven-reid-320x240.png" alt="Truchet ML, ZX81 Screenshot, 2025 by Steven Reid">Truchet ML, ZX81 Screenshot, 2025 by Steven Reid</div>
<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> It’s so fast!</strong><br>
<br>
With the primary routines complete, running the program uncovered a bit of a problem. It was too fast! Odd to say on the ZX81, I know, but I needed to slow things down a bit. I added my default delay routine, along with a break check, to finish the program. The final version was still faster than the BASIC one and very pleasant to watch.<br>
<br>
Now that it’s running smoothly, I’ve been thinking about ways to use it. With a less random routine—say, a memory pointer to ROM—I could make this into a scrolling background. That would fit nicely in a shooting or jumping game. Fun for another day.<br>
<br>
---<br>
<br>
Want to try it out? <a href="https://www.reids4fun.com/zx81/truchetml/play" target="_blank" rel="noopener">You can run the program</a>, or <a href="https://www.reids4fun.com/zx81/truchetml/asm" target="_blank" rel="noopener">view the code</a> if you’d like to see how it works.</description>
</item>
<item>
<title>Exploring Truchet Tiles on the ZX81 with BASIC</title>
<link>https://www.reids4fun.com/579/exploring-truchet-tiles-on-the-zx81-with-basic</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Sun, 13 Jul 2025 23:40:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>retro</category>
<category>monthly</category>
<category>truchet</category>
<category>tiles</category>
<guid>https://www.reids4fun.com/579/exploring-truchet-tiles-on-the-zx81-with-basic</guid>
<description><img src="https://www.reids4fun.com/images/zx81/truchet-2025-zx81-screenshot-by-steven-reid-320x240.png" alt="Truchet, ZX81 Screenshot, 2025 by Steven Reid" style="float:left;margin-right:10px">Sometimes ideas drop right into your lap. In the case of this month’s program, it was a mix of a post and a video that led me to this <a href="https://www.reids4fun.com/zx81/truchet/play" target="_blank" rel="noopener">Truchet animation</a>. A simple concept, but it worked way better on the ZX81 than I expected.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> So those diagonal lines were Truchet tiles.</strong><br>
<br>
I’d read and <a href="https://www.reids4fun.com/553/how-to-create-an-infinite-maze-on-the-zx81" target="_blank" rel="noopener">written here before</a> about the single-line “10 PRINT” program. What I didn’t realize was that the diagonal lines used in the Commodore version were actually the Labyrinth variation of <a href="https://en.wikipedia.org/wiki/Truchet_tiles" target="_blank" rel="noopener">Truchet tiles</a>. <a href="https://youtu.be/MVQJykMJSH0" target="_blank" rel="noopener">The video I watched</a> opened my eyes, and I was intrigued to do something similar—but with my own twist!<br>
<br>
Since the ZX81 doesn’t natively support user-defined graphics (UDGs), I took a different approach. This is where the BASIC program that was shared sparked an idea. Instead of a single character like before, I decided to use a 2x2 tile. This gave me a bit more flexibility… but only a little. The ZX81’s character set is still pretty limited.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> I kept the code simple and fast.</strong><br>
<br>
Using the quarter-circle form of Truchet decoration, I landed on using two different tiles. In real life, it would just be a single tile rotated. I thought of a couple different ways to print the design, but ultimately went with the straightforward approach: generate a random number and use a conditional. Here’s the rough code used:<br>
<br>
<pre>LET R=INT (RND*2)
IF R=0 THEN PRINT AT X,Y;”/ “;AT X+1,Y;” /”;
IF R=1 THEN PRINT AT X,Y;” &quot;;AT X+1,Y;”\ “;</pre><br>
<br>
I used the ZX81’s graphics characters instead of the slashes, but you get the idea. The <a href="https://www.reids4fun.com/zx81/truchet/list" target="_blank" rel="noopener">rest of the program</a> is a loop that fills the display with tiles. I would’ve preferred more circular graphics, but had to work with what was available. To my surprise, the patterns looked really good.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/truchet-2025-zx81-screenshot-by-steven-reid-320x240.png" alt="Truchet, ZX81 Screenshot, 2025 by Steven Reid">Truchet, ZX81 Screenshot, 2025 by Steven Reid</div>
<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Why those last two lines had to go.</strong><br>
<br>
Unlike some of my previous programs that scrolled the display, this one redraws the entire screen with new random tiles each time through the loop. The result is an ever-changing pattern, an idea I borrowed from the example I saw. I hadn’t tried that before, and it worked well with the simplicity of the design.<br>
<br>
The two blank lines at the bottom of the screen bugged me. There is a way to remove them, but I usually don’t bother. This time, though, filling the screen felt important. I considered poking the display memory with tile characters, but discarded that idea—it would have required math that would slow things down.<br>
<br>
Fortunately, there’s another way.<br>
<br>
On the ZX81, there’s a system variable that controls how many lines are reserved at the bottom of the screen. Setting that variable to zero with <code>POKE 16418,0</code> effectively expands the vertical display by two lines. I hardly ever use this trick in BASIC since it can cause issues with scrolling. But in this case, scrolling wasn’t a problem.<br>
<br>
This solution was elegant: the only change I had to make was adjusting the <code>FOR</code> loop range. I ran a few tests to see if breaking out of the program would crash the system. It didn’t—and I decided it was worth using. This trick has been around since I was a teenager and shows up in a few of my old books.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Wrapping up with more tile ideas.</strong><br>
<br>
And with that, I had a very simple tile program. I did try a few other designs just to see what worked. It’s not overly hard to add more tiles—I even made a version with four—but the ZX81’s limited character set didn’t play nicely with most of them. Feel free to try your own variations!<br>
<br>
As mentioned earlier, I could’ve also used an array to avoid the <code>IF</code> conditionals. I didn’t go that route, but I’ll leave it as a challenge for someone else.<br>
<br>
Now, something I might do is convert this into a machine language version. Not only would it run faster, but I could use it inside a larger, more complex game. Interestingly, I learned after the fact that a few strategy games have used these same quarter-circle Truchet tiles. The patterns also seem like they’d make great backgrounds for other games.<br>
<br>
I’ll end this one with more ideas running through my head. Let me know what you’d like to see me build next!<br>
<br>
Want to try it out? <a href="https://www.reids4fun.com/zx81/truchet/play" target="_blank" rel="noopener">You can run the program</a>, or <a href="https://www.reids4fun.com/zx81/truchet/list" target="_blank" rel="noopener">view the code</a> if you’d like to see how it works.</description>
</item>
<item>
<title>Recreating Font Art on the ZX81—With Some Limits</title>
<link>https://www.reids4fun.com/578/recreating-font-art-on-the-zx81with-some-limits</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Sun, 29 Jun 2025 11:06:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>monthly</category>
<category>retro</category>
<category>fonts</category>
<category>ascii</category>
<category>art</category>
<guid>https://www.reids4fun.com/578/recreating-font-art-on-the-zx81with-some-limits</guid>
<description><img src="https://www.reids4fun.com/images/zx81/funfonts-2025-3-d-zx81-screenshot-by-steven-reid-320x240.png" alt="Fun Fonts: 3-D, 2025 by Steven Reid" style="float:left;margin-right:10px">It’s funny how a random video can spark an idea. One moment I’m watching someone play around with ASCII art, and the next I’m thinking, “Hey, I could make something like that on the ZX81.” That little spark turned into a weekend project: <a href="https://www.reids4fun.com/zx81/funfonts/play" target="_blank" rel="noopener">a simple banner program</a> using different fonts. How fun!<strong><span style="color:gray;font-size:1.2em">#</span> The Idea</strong><br>
<br>
I have fond memories of creating art using typewriters and characters. We had a typewriter in our house when I was around 8 or 9, and I remember spending hours just typing on it. Once I got into D&D, I used it extensively to write up character sheets and campaign ideas. But I also used it to generate doodles and art—TIE Fighters and cartoons were a staple.<br>
<br>
It should be no surprise that some of my first computer programs were character art. I still have a Medusa head lying around somewhere from the PDP my school had. Terminals and consoles notoriously lacked graphics—or at least support from most programs for them. As such, ASCII art became a common way to create doodles and fun images.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Fast Forward</strong><br>
<br>
In the ’90s, there was a resurgence—or perhaps an organization—of online ASCII art creation. During this time, entire fonts were created using basic characters and symbols. I came across a great example of these <a href="https://patorjk.com/software/taag/#p=about&f=BlurVision%20ASCII&t=ZX81" target="_blank" rel="noopener">FIGlet Fonts</a>, which got me thinking about using them in a program.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/funfonts-2025-3-d-zx81-screenshot-by-steven-reid-320x240.png" alt="Fun Fonts: 3-D, 2025 by Steven Reid">Fun Fonts: 3-D, 2025 by Steven Reid</div>
<br>
<br>
The ZX81, with its blocky characters, was ripe for this kind of art—especially if you wanted to do anything visually interesting. Sadly, it lacks many of the standard characters that FIGlet fonts use, such as the backslash and apostrophe. Even the hash symbol (often called pound) and the exclamation mark are absent from the ZX81’s character set. Sad times.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Making Do</strong><br>
<br>
Not to be deterred, I decided to give a few of the fonts a try. <a href="https://www.reids4fun.com/zx81/funfonts/list" target="_blank" rel="noopener">Creating a simple font display program</a>, I was able to recreate a few using “ZX81” as the sample text. Some fit nicely on screen, but others required scrolling to get the full effect. To save space, I only reproduced the letters and numbers needed. Maybe a full-font program will be a future project.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/funfonts-2025-alligator2-zx81-screenshot-by-steven-reid-320x240.png" alt="Fun Fonts: Alligator 2, 2025 by Steven Reid">Fun Fonts: Alligator 2, 2025 by Steven Reid</div>
<br>
<br>
I tried to use fonts with characters already available. For a few, I adjusted the characters where needed—for example, swapping out the hash symbol for the literal pound symbol. I think the fonts worked pretty well and look decent overall. A few spacing issues popped up since the ZX81’s pixels are more square than rectangular. I adjusted a few fonts to make the letters cleaner.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> All Done</strong><br>
<br>
The program itself is modular. You could easily add more examples or swap in different display techniques. I used string slicing for much of the display. The effect is slow in BASIC—so slow that I moved from printing each line individually to using a buffer technique to avoid jarring lag during rendering.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/funfonts-2025-usa-flag-zx81-screenshot-by-steven-reid-320x240.png" alt="Fun Fonts: USA Flag, 2025 by Steven Reid">Fun Fonts: USA Flag, 2025 by Steven Reid</div>
<br>
<br>
A more practical use for this program might be as an intro screen for a game. That said, I’d probably redo it in assembly for better speed. Having a complete font set could be fun for a banner program, but memory constraints would be a challenge. Alternatively, you could use the ZX81’s graphic symbols to make something even more visually compelling.<br>
<br>
What ideas do you have?</description>
</item>
<item>
<title>A ZX81 Puzzle Makeover: No More INPUT Drama</title>
<link>https://www.reids4fun.com/577/a-zx81-puzzle-makeover-no-more-input-drama</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Fri, 30 May 2025 16:35:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>monthly</category>
<category>retro</category>
<guid>https://www.reids4fun.com/577/a-zx81-puzzle-makeover-no-more-input-drama</guid>
<description><img src="https://www.reids4fun.com/images/zx81/wgc-1982-2024-zx81-starting-updated-by-steven-reid-320x240.png" alt="Wolf, Goat Cabbage: starting the puzzle" style="float:left;margin-right:10px">This month’s program is a bit of a departure. It is a take on the classic "Wolf, Goat, Cabbage" puzzle. The twist is, I didn’t write this one. Instead, I decided to <a href="https://www.reids4fun.com/zx81/wgc/play" target="_blank" rel="noopener">update it to make the interface a bit easier to use</a>. Let’s dive into the code.<strong><span style="color:gray;font-size:1.2em">#</span> The puzzle.</strong><br>
<br>
The puzzle isn’t too hard. You have a wolf, goat and a cabbage. The goal is to move all three across the river. The problem is you can't leave the wolf with the goat or it will eat it. Same for the goat and cabbage who can’t be left alone with it. Fortunately, the wolf doesn’t care of the cabbage much.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/wgc-1982-2024-zx81-starting-updated-by-steven-reid-320x240.png" alt="Wolf, Goat Cabbage: starting the puzzle.">Wolf, Goat Cabbage: starting the puzzle.</div>
<br>
<br>
This ZX81 version of the puzzle comes from the book ”Computer Puzzles: For Spectrum & ZX81,” by Ian Stewart & Robert Jones. Written in 1982, it came out right as the Spectrum was released which is probably why it still had ZX81 programs in it. Sadly, the ZX81 version wouldn’t be able to take advantage of the user defined characters that the Spectrum did.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/wgc-1982-2024-zx81-eaten-updated-by-steven-reid-320x240.png" alt="Wolf, Goat Cabbage: puzzle failed.">Wolf, Goat Cabbage: puzzle failed.</div>
<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Wonky controls.</strong><br>
<br>
Although not as graphically interesting, the puzzler works well enough. But, for some reason, it used <code>INPUT</code> commands for the movement. To be honest, it is one of my least favorite ways to handle input on the ZX81. It breaks up the flow of the game and just doesn’t look great.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/wgc-1982-2024-zx81-moving-updated-by-steven-reid-320x240.png" alt="Wolf, Goat Cabbage: boat moving across the river.">Wolf, Goat Cabbage: boat moving across the river.</div>
<br>
<br>
As such, I decided to fix it! The program used variables to make it easier <a href="https://www.reids4fun.com/zx81/wgc/list" target="_blank" rel="noopener">to read the code</a>. I followed suit and added in two routines. One gets a key using <code>INKEY$</code>. The other waits for a key after the game is done. Both changes remove the clunky input method, making for a smoother, more natural experience.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Easy to solve.</strong><br>
<br>
With the changes in place, the puzzle is much easier to play. You simply hit the key of the item you want to place in or take out of the boat. Hitting any other key sends the boat back. The overall program was quite fun to type in and the subtle changes make it just more enjoyable.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/wgc-1982-2024-zx81-done-updated-by-steven-reid-320x240.png" alt="Wolf, Goat Cabbage: puzzle completed.">Wolf, Goat Cabbage: puzzle completed.</div>
<br>
<br>
Sadly, once you figure out the solution there isn’t a lot of replayability. I’m sure someone could come up with an increasingly harder version of the puzzle. I’m happy with the small but meaningful changes I made.</description>
</item>
<item>
<title>Castle Quest Was My Late-Night ZX81 Adventure with AI</title>
<link>https://www.reids4fun.com/576/castle-quest-was-my-late-night-zx81-adventure-with-ai</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Wed, 30 Apr 2025 23:46:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>retro</category>
<category>monthly</category>
<category>genai</category>
<guid>https://www.reids4fun.com/576/castle-quest-was-my-late-night-zx81-adventure-with-ai</guid>
<description><img src="https://www.reids4fun.com/images/zx81/cq-2025-zx81-start-screenshot-by-steven-reid-320x240.png" alt="Castle Quest, ZX81 Start Screenshot, 2025 by Steven Reid" style="float:left;margin-right:10px">With little time lately, I decided to explore some Generative AI ideas to flesh out new concepts. I’ve dabbled in vibe coding for some time now and thought I’d see how the models would do with adventure-style games. One of the results of that was <a href="https://www.reids4fun.com/zx81/cq/play" target="_blank" rel="noopener">Castle Quest</a>, a small text adventure for the ZX81.<strong><span style="color:gray;font-size:1.2em">#</span> Finding the vibe.</strong><br>
<br>
I find the whole concept of <a href="https://en.wikipedia.org/wiki/Vibe_coding" target="_blank" rel="noopener">vibe coding</a> a bit funny. For me, getting into a vibe is when coding comes naturally. It’s the feeling you get when your program comes together. You forget the time and just code. Last night was one of those times.<br>
<br>
This was actually my second program. I first started with ChatGPT, playing with a more RPG-style game. Although I was making progress, I kept losing the code I was building, and it got annoying trying to piece it all together. I decided to shift gears and use Gemini to build an Infocom-like text adventure instead.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/cq-2025-zx81-start-screenshot-by-steven-reid-320x240.png" alt="Castle Quest, ZX81 Start Screenshot, 2025 by Steven Reid">Castle Quest, ZX81 Start Screenshot, 2025 by Steven Reid</div>
<br>
<br>
Using more guided prompts and carefully tracking the code, I was more successful this time. Usually, my forays into ZX81 coding involved Z80 assembly. A great way to test an LLM’s capabilities, but not a great way to code — there’s just not enough code to build real proficiency. This time, I stuck to BASIC, and it worked better.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Building the game.</strong><br>
<br>
With this different approach, I focused on building something that worked. My prompts focused on generating code that ran correctly. The game, small and light, wasn’t fully ZX81 BASIC-specific — it was just BASIC code. That worked well enough, though not perfectly.<br>
<br>
My biggest challenge is that Sinclair BASIC is much simpler than other BASICs — and in other ways, more complex. Once you get comfortable with how it works, you can do some pretty crazy stuff. With the ZX81, just because you can do something doesn’t mean you should.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/cq-2025-zx81-take-screenshot-by-steven-reid-320x240.png" alt="Castle Quest, ZX81 Take Action Screenshot, 2025 by Steven Reid">Castle Quest, ZX81 Take Action Screenshot, 2025 by Steven Reid</div>
<br>
<br>
Because of that, I spent a good amount of time correcting and adjusting the code. I’d iterate on the data structures to get to a workable solution. Along the way, I also fixed syntax issues and worked around how the ZX81 managed variables. It might not sound like fun, but it was. I got into it, lost track of time, and stayed up way too late.<br>
<br>
In the end, however, I had a game. I kept a lot of the original logic that was generated. Although simplistic, it fits the style of the vintage ZX81. Not only does it work, but it is playable. There’s something to be said for focusing on form over function. Castle Quest works for what it is.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> But is it yours?</strong><br>
<br>
For the purist, you might say it isn’t my game. To an extent, that’s true for most ideas. I wrote a lot of programs based on other ideas. I built plenty of games that were my versions of Pac-Man or Dragon’s Lair. Even for my original programs, they borrowed elements I learned from others. That’s the nature of coding. There is balance. The fun is in the doing. How you get there doesn’t matter as much.<br>
<br>
<a href="https://www.reids4fun.com/zx81/cq/list" target="_blank" rel="noopener">Looking at the code</a>, you’ll see flavors of others. There are parts where I would have taken a different approach. A good portion, though, is still me. I’d tweak and rewrite sections to fix issues. I’d get Gemini to build a routine for me that I would then adjust to my needs. That was the way to make things work.<br>
<br>
Much of the evening, after getting the first code base to run, was spent polishing it. I spent a good amount of time tweaking the output. I like to focus on look and feel. Although the LLM did okay, it needed some personal touch. I spent much of that evening making things work well and feel right.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/cq-2025-zx81-east-screenshot-by-steven-reid-320x240.png" alt="Castle Quest, ZX81 East Action Screenshot, 2025 by Steven Reid">Castle Quest, ZX81 East Action Screenshot, 2025 by Steven Reid</div>
<br>
<br>
In the end, that makes this program mine. The game may seem weak or simple, but it is functional and playable. It looks and plays well. I had fun fixing little challenges around the string arrays. Castle Quest is a collaboration.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> More to it.</strong><br>
<br>
I’ve written text games before. As such, it’s easy to say there’s a better way. With the ZX81’s limited memory and the speed of BASIC, an assembly version would be better. But that wasn’t the point. I wanted to build something I’d have fun with. Mission accomplished.<br>
<br>
If I had more time, I’d redo the room structure and add more detailed descriptions. I thought about building a more Infocom-like display engine. That would be a fun challenge on the ZX81, but not overly hard. I got to the point last night that I needed to wrap up. There is always tomorrow. But this program is done.</description>
</item>
<item>
<title>A New Take on the Infinite Maze for the ZX81</title>
<link>https://www.reids4fun.com/575/a-new-take-on-the-infinite-maze-for-the-zx81</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Sat, 15 Mar 2025 03:45:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>retro</category>
<category>monthly</category>
<guid>https://www.reids4fun.com/575/a-new-take-on-the-infinite-maze-for-the-zx81</guid>
<description><img src="https://www.reids4fun.com/images/zx81/ps2infmaze-2024-zx81-maze-screenshot-by-steven-reid-320x240.png" alt="PS2 Infinite Maze, ZX81 Screenshot, 2024 by Steven Reid" style="float:left;margin-right:10px">After updating my print scroll routine, I started thinking about how I could use it to create a different version of my infinite maze program. The original used graphic characters and spaces since the ZX81 lacked a backslash. <a href="https://www.reids4fun.com/zx81/ps2infmaze/play" target="_blank" rel="noopener">This new version</a> takes a different approach, using alternate graphics to build a more visually interesting maze while leveraging a better machine scrolling routine.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> A new look, but not a new idea.</strong><br>
<br>
This version of Infinite Maze only uses two characters to create a more structured maze pattern: a left horizontal bar and a bottom horizontal bar. Together, they form a visually appealing maze that fills the screen. Thanks to the <a href="https://www.reids4fun.com/569/print-like-a-pro-on-the-zx81-with-this-updated-smooth-scroll-routine" target="_blank" rel="noopener">print scroll 2</a> routine, I don’t have to handle scrolling manually. Instead, the maze builds naturally from the top of the screen down.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/ps2infmaze-2024-zx81-maze-screenshot-by-steven-reid-320x240.png" alt="PS2 Infinite Maze, ZX81 Screenshot, 2024 by Steven Reid">PS2 Infinite Maze, ZX81 Screenshot, 2024 by Steven Reid</div>
<br>
<br>
The result is a nice little screen saver for your ZX81 (whether hardware or emulator) that doesn’t require much memory. However, since it fills the entire screen with characters, I still recommend a 16K memory pack. Otherwise, it’s a simple and efficient program.<br>
<br>
An interesting note: the characters can actually form a few different configurations by alternating vertical and horizontal graphics. There are four variations that look good. I considered adding more variety, but the program works well as is.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> The BASIC code couldn't be much simpler.</strong><br>
<br>
Since the Print Scroll 2 machine code routine handles scrolling, the <a href="https://www.reids4fun.com/zx81/ps2infmaze/list" target="_blank" rel="noopener">BASIC code itself is minimal</a>—just two lines:<br>
<br>
<pre>  20 PRINT USR 16514; &quot;[5][6]&quot;(RND+1);
  30 GOTO 20</pre><br>
<br>
Here, <code>[5]</code> represents Shift Graphics 5 (the vertical left bar), and <code>[6]</code> is Shift Graphics 6 (the horizontal bottom bar). The code randomly selects one of these two characters and prints it, then repeats. Simple and effective.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/ps2infmaze-2024-zx81-list-screenshot-by-steven-reid-320x240.png" alt="PS2 Infinite Maze, ZX81 Listing, 2024 by Steven Reid">PS2 Infinite Maze, ZX81 Listing, 2024 by Steven Reid</div>
<br>
<br>
Looking at the code, I realized I could have simplified it further by omitting the <code>CLS</code>. The <code>RUN</code> command already clears the screen, making line 10 redundant. Simplicity at its best!<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Need more ideas.</strong><br>
<br>
With this complete, I think I’m done playing with the print scroll code. I set aside modifying it further—sure, I could add more variety to the maze generation or refine the PS2 routines even more, but no, this is enough fun for now.<br>
<br>
As a side note, I toyed with the idea of calling <code>USR</code> routines to create a one-liner similar to the C64’s classic “10 PRINT” maze code. While digging around, I found someone else had already done it. Sigh. For completeness, here’s the routine:<br>
<br>
<pre>  10 PRINT &quot;[5][6]&quot;(RND+NOT PEEK USR
 (3085+(ABS (PEEK 16441-17)=16))
*USR 3663);</pre><br>
<br>
I wish I’d thought of that! It works well, and no, I won’t try to explain it. At least not today.<br>
<br>
Enjoy!</description>
</item>
<item>
<title>Making Time for a Little Life on the ZX81</title>
<link>https://www.reids4fun.com/574/making-time-for-a-little-life-on-the-zx81</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Fri, 28 Feb 2025 01:05:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>monthly</category>
<category>retro</category>
<category>simulation</category>
<category>assembly</category>
<category>z80</category>
<guid>https://www.reids4fun.com/574/making-time-for-a-little-life-on-the-zx81</guid>
<description><img src="https://www.reids4fun.com/images/zx81/life-2024-zx81-screenshot-by-steven-reid-320x240.png" alt="Life, ZX81 Screenshot, 2024 by Steven Reid" style="float:left;margin-right:10px">I’d read about and studied cellular automata but had never programmed any simulations for them. Conway’s Game of Life is the go-to simulation and something others had already implemented on the ZX81, even when I was a kid. I finally got around to typing in some of those programs but found them slow. <a href="https://www.reids4fun.com/zx81/life/play" target="_blank" rel="noopener">My version aims to correct that</a>.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Getting started.</strong><br>
<br>
The first simulation I tried was actually a more generic version from “<a href="https://archive.org/details/Creating_Simulation_Games_on_Your_Computer_1986_Ballantine_Books/page/n41/mode/2up" target="_blank" rel="noopener">Creating Simulation Games on Your Computer</a>,” 1986 by Tim Hartnell. It was designed to run on multiple computers and didn’t require much work to get running on the ZX81. However, it was incredibly slow. Written in BASIC and looping through all the cells, it took quite some time to execute.<br>
<br>
Tim’s version cheated a bit by mirroring the image, keeping the array small, but it was still slow. An obvious speed-up on the ZX81 was to use <code>FAST</code> mode. This helped, but I felt I could do better. So, I wrote my own version in assembly.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Making a faster simulation.</strong><br>
<br>
Writing <a href="https://www.reids4fun.com/zx81/life/asm" target="_blank" rel="noopener">a machine code version of Life</a> was straightforward. I initialize the screen and then loop through each generation. The core code looks like this:<br>
<br>
<pre>main_loop:
        call init_life          ; Initialize Game of Life
        ; Run simulation
life_loop:
        call live_or_die        ; Run life simulation
        call copy_to_screen     ; Copy new life to screen
        call delay_and_test     ; Test for break key or gen &amp;gt; 100
        ; Was a key pressed or generations hit 100?
        or a
        jp z,life_loop          ; No, display next generation
        jp main_loop            ; Otherwise, start again!</pre><br>
<br>
I had to write a small random routine to create the initial culture, ensuring each run differs from the last, making the program more like a screensaver. A counter resets each run, limiting it to 100 generations. This ensures a good simulation cycle without getting stuck in a loop. You can also press a key to exit early.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/life-2024-zx81-busy-screenshot-by-steven-reid-320x240.png" alt="Life, ZX81 Busy Screenshot, 2024 by Steven Reid">Life, ZX81 Busy Screenshot, 2024 by Steven Reid</div>
<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Making life run.</strong><br>
<br>
The live-or-die routine is the heart of the program, handling all the heavy lifting. To keep things simple, I use the primary screen for the current generation and a buffer for the next. The program loops through the screen, testing each location—sort of.<br>
<br>
You may have noticed an unused line around the screen. That’s intentional. I need to count all the live cells surrounding the current cell, and leaving those edge cells blank simplifies the code, keeping it fast.<br>
<br>
The counting routine actually shifts around the screen address, pushes a copy to the stack, and then moves to check all adjacent cells. I reuse a simple test routine that increments a counter if the cell isn’t zero.<br>
<br>
<pre>count_life:
        ld a,(hl)               ; Get cell
        or a                    ; Is it alive?
        ret z                   ; No, return
        inc c                   ; Yes, increment count
        ret</pre><br>
<br>
Once that’s done, the actual simulation begins. The rules of Life are simple: If the current cell is occupied and has exactly 2 or 3 live neighbors, it survives. Otherwise, it dies. Here’s the code:<br>
<br>
<pre>        ; Check if cell dies (c &amp;lt;&amp;gt; 2 and c &amp;lt;&amp;gt; 3)
        cp 2                    ; Check if 2
        jr z,lod_alive          ; If 2, stays alive!
        cp 3                    ; Check if 3
        jr z,lod_alive          ; If 3, stays alive!
        xor a                   ; Otherwise, cell dies
        jr lod_skip             ; Done</pre><br>
<br>
But if the cell is empty and exactly 3 neighbors are alive, a new cell is born. This code is even simpler:<br>
<br>
<pre>lod_empty:
        ; Check if lives
        cp 3                    ; Check if 3
        ld a,0                  ; Assume empty cell
        jr nz,lod_skip          ; Not 3, skip ahead
lod_alive:
        ld a,$80                ; Yes, cell is born</pre><br>
<br>
After that, the new cell is stored in the buffer. This repeats for all rows and columns. The game then copies the buffer to the screen. All of this happens quickly, producing a smooth animation.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Enjoying simulations.</strong><br>
<br>
After finishing my program, I found other versions of Life in ZX81 books I owned. They were also in BASIC and used relatively small grids. I like where I landed in terms of speed and presentation.<br>
<br>
That said, there’s always room for improvement. An obvious enhancement would be using different characters or graphics—perhaps even randomizing them—for added visual appeal. I could also make the program more interactive by allowing variable generation limits.<br>
<br>
If I were really ambitious, I could create a “paint your own simulation” feature, letting users experiment with different configurations. I could even include stamps for common patterns like spinners. But those are enhancements few would take advantage of.<br>
<br>
The only real change I need to make is adding a splash screen requiring a button press to start. One issue with emulators is that they don’t vary the machine state, which affects the randomness of the number generator—a problem that doesn’t occur on a real ZX81.<br>
<br>
As always, comments and ideas are welcome!</description>
</item>
<item>
<title>A Present On The ZX81 For VC3 2024</title>
<link>https://www.reids4fun.com/573/a-present-on-the-zx81-for-vc3-2024</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Wed, 01 Jan 2025 20:17:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>retro</category>
<category>monthly</category>
<category>vc3</category>
<category>challenge</category>
<category>z80</category>
<guid>https://www.reids4fun.com/573/a-present-on-the-zx81-for-vc3-2024</guid>
<description><img src="https://www.reids4fun.com/images/zx81/present-2024-zx81-screenshot-by-steven-reid-320x240.png" alt="Present, ZX81 ScreenShot, 2024 by Steven Reid" style="float:left;margin-right:10px">Another year and another Vintage Computing Christmas Challenge (VC<sup>3</sup> for 2024). I rushed a bit to get mine in so I do feel it wasn’t as short as possible. I did take a somewhat unique route to solving the problem which makes the build more interesting. I made <a href="https://www.reids4fun.com/zx81/present/play" target="_blank" rel="noopener">an auto-run version for Present</a> so you could see it in action.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> This year’s VC<sup>3<sup>.</strong><br>
<br>
For 2024 <a href="https://logiker.com/Vintage-Computing-Christmas-Challenge-2024" target="_blank" rel="noopener">lthe challenge was to display a Christmas present</a>. To add to the challenge, the present had different characters used in the corners, top and sides. To top it off, a bow was added.<br>
<br>
Part of my problem was that the ZX81 doesn’t have all the characters used. Namely the backslash and exclamation mark. For my version, I had to replace those with ones I did have. For the slashes, I used graphic characters. Instead of an exclamation mark, I used a colon. Fortunately, the rules allowed this substitution.<br>
<br>
</p><blockquote><hr><cite>All characters can be replaced with another character if this does NOT influence the code. E.g. backslash on the C64 gets replaced by chr$(205). Or on the right-hand side I replaced the big O by a smaller one, as it looks nicer, but it didn't influence the code. At any time, I could replace the o with O or the C64 Backslash with its counterpart on the C64.</cite><hr></blockquote><p class="hyphenate"><br>
<br>
The harder part was deciding how to create the present.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> My Approach.</strong><br>
<br>
For my entry, I decided to go with ZX81 BASIC even though I from the start that it wouldn’t be the smallest due its limitations. Working late at night, I went through various options in my head but didn’t like the methods I came up with.<br>
<br>
Playing around with progressive prints, I landed on a way to build the present using loops. With that working, I added a pair of loops to basically print each quadrant of the present.<br>
<br>
I used a series of loops to basically build the square. This allowed a bit of symatry to the program and it looks neat when building out. The code ultimately looks like this before I started to compress anything.<br>
<br>
<pre> 
1 FOR X=1 TO 10 STEP 9
2 FOR Y=1 TO 10 STEP 9
3 FOR B=1 T0 8
4 PRINT AT 0,9;&quot;\O/&quot;;AT X+B,Y;&quot;:&quot;;AT X+B,Y+9;&quot;:&quot;;AT X,Y;&quot;+&quot;;AT X+9,Y;&quot;+&quot;;AT X,Y+B;&quot;-+&quot;;AT X+9,Y+B;&quot;-+&quot;
5 NEXT B
6 NEXT Y
7 NEXT X</pre><br>
<br>
I will say that it probably took a couple of hours to get <a href="https://www.reids4fun.com/zx81/present/list" target="_blank" rel="noopener">the code right</a>. For as small as it is, I kept trying different options which took longer than I planned. Once it was working, I started refactoring to reduce memory consumption.<br>
<br>
Due to the peculiarities of the ZX81, I could make a smaller version of the binary by not using numbers. This is due to the way the ZX81 stores floating point numbers. I actually have a version that is 1 byte smaller, but it is super slow to run. Converting <code>LEN STR$ PI</code> (which is 9) into a variable sped the program back up at the cost of that byte. Worth it.<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/present-2024-zx81-screenshot-by-steven-reid-320x240.png" alt="Present, ZX81 ScreenShot, 2024 by Steven Reid">Present, ZX81 ScreenShot, 2024 by Steven Reid</div>
<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Counting things up.</strong><br>
<br>
With the program complete, I had a binary of of about 1078 bytes. Much of that is overhead as the ZX81 saves its state with the program. The system variables and screen add up to about 910 bytes of code. This meant that my memory optimized program came to about 168 bytes.<br>
<br>
Although it worked, it wasn’t close to the smallest it could be. Other dialects could remove extra lines, something the ZX81 wasn’t good at. Once the competition was over, I realized that could have taken a different approach that would have yielded a smaller file.<br>
<br>
This version would use some math to eliminate a loop as well as reduce the character size. With some memory optimization, the final BASIC code size was 111 bytes. A decent optimization, but still over twice as large as the BBC Micro version which was 53 bytes. Still, my reduced version (below without memory optimizations) was much slower and not nearly as interesting to watch.<br>
<br>
<pre>1 PRINT TAB 8;&quot;\O/&quot;
2 FOR Y=-9 TO 9
3 FOR X=-9 TO 9
PRINT &quot;-+&quot;(1+(X=9*SGN X)+2*NOT Y=9*SGN Y);
4 NEXT X
5 PRINT
6 NEXT Y </pre> <br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Would Assembly have helped?</strong><br>
<br>
Of course, I could get even smaller using Z80 machine code. I decided to hack together a few versions to see how far I could get. This burned quite a few more hours as I tried out different hacks to see how small I could get the code.<br>
<br>
After about dozen or so versions, I got down to about 51 bytes of code. This was less than the BASIC size of the BBC, but was about 10 bytes larger than the smallest assembly version which was 41 bytes. Finding 10 bytes would be hard pressed on the ZX81.<br>
<br>
I did use a a couple of ROM routines to help reduce some code. The print return call at <code>CALL $0b87</code> and the print character at <code>RST $10</code>. But the screen display of the ZX81 ultimately became the limiting factor.<br>
<br>
<pre>        ; get ready to print
        ld hl,(d_file)          ; 3 - get screen location
        ld bc,9                 ; 3 - get to position on screen
        add hl,bc               ; 1 - move to position
                                ; 7 bytes
        ; print bow - \O/ = $86,$34,$06
        ld (hl),$86             ; 2 - load \
        inc hl                  ; 1
        ld (hl),$34             ; 2 - load O
        inc hl                  ; 1
        ld (hl),$06             ; 2 - load /
                                ; 8 bytes (15)
        ; print present
        ld c,19                 ; 2 - y loop
        ld e,1                  ; 2 - row pattern
                                ; 4 bytes (19)
ylp:
        call $0b87              ; 3 - print return ROM routine
        ld hl,$0e00             ; 3 - box line ': '
                                ; 6 bytes (25)
ty:
        dec e                   ; 1 - subtract 1
        jr nz,dox               ; 2 - if not 0, then print box (: :)
        ld e,9                  ; 2 - otherwise, reset e
        ld hl,$1516             ; 3 - ribbon line '+-'
                                ; 8 bytes (33)
dox:
        ld d,1                  ; 2 - column pattern
                                ; 2 bytes (34)
        ld b,19                 ; 2 - x loop
xlp:
        ld a,l                  ; 1 - set a to char in l
        dec d                   ; 1 - subtract 1
        jr nz,draw              ; 2 - of not 0, print char
        ld d,9                  ; 2 - otherwise, reset d
        ld a,h                  ; 1 - set a to char in h
                                ; 9 bytes (44)
draw:
        rst $10                 ; 1 - print char
        djnz xlp                ; 2 - next x
        dec c                   ; 1
        jr nz,ylp               ; 2 - next y
                                ; 6 bytes (50)
        ret                     ; 1
                                ; 1 bytes (51)</pre><br>
<br>
If you can find any additional optimizations, let me know.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> A lot of fun.</strong><br>
<br>
In the end, the challenge was a lot of fun. I liked my entry, even if not the smallest. I learned a lot <a href="https://www.youtube.com/watch?v=kJYbIC-14s4" target="_blank" rel="noopener">from looking at what others were doing</a>. The wild entries were fun to watch.<br>
<br>
I didn’t realize how much I enjoyed trying to find different ways to do things. I even dug through the ZX81 ROM again. Explains why my Gem Quest program still isn’t done as I spend more time refactoring code than finishing the game.<br>
<br>
Sigh. At least I got to code a bit.<br>
<br>
Happy New Year!</description>
</item>
<item>
<title>Turning Hello World into a Creative ZX81 BASIC Program</title>
<link>https://www.reids4fun.com/572/turning-hello-world-into-a-creative-zx81-basic-program</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Sat, 28 Dec 2024 11:46:00 -0600</pubDate>
<category>ZX81 Computer</category>
<category>zx81</category>
<category>monthly</category>
<category>retro</category>
<guid>https://www.reids4fun.com/572/turning-hello-world-into-a-creative-zx81-basic-program</guid>
<description><img src="https://www.reids4fun.com/images/zx81/hw-2024-zx81-end-screenshot-by-steven-reid-320x240.png" alt="Hello World, ZX81 Screenshot, 2024 by Steven Reid" style="float:left;margin-right:10px">The year is almost over and time to close out the year with a short program. Watching some videos on character displays in UNIX, I was inspired to create my own version of <a href="https://www.reids4fun.com/zx81/hw/play" target="_blank" rel="noopener">Hello World</a>. This version scrolls through a stream of random digits until the message is displayed. How fun is that?<strong><span style="color:gray;font-size:1.2em">#</span> An old favorite.</strong><br>
<br>
Back in the eighties, “Hello World” was often the first program you would write when purchasing a home computer. Note that I said write, not play. As many of us simply loaded up a game to play first. I mean, why else would you buy a computer?<br>
<br>
In any case, the first program usually introduced the user to the syntax of the BASIC language for that computer. This was a time when each computer came with its own dialect. Line numbers were common and almost every computer came with the <code>PRINT</code> command. A such it was a good starting point.<br>
<br>
<pre>10 PRINT &quot;HELLO WORLD&quot;
20 GOTO 10</pre><br>
<br>
Of course, this introduces the controversy of the time which is how BASIC managed flow control. The <code>GOTO</code> keeps the program running and accounts for all those <i>bad programmers<i> from that time. Probably not, but it did tend to label BASIC as a toy language. Sad times.<br>
<br>
On the ZX81, the program above wouldn’t run forever. When the bottom of the screen was reached, the ZX81 would halt. You could use <code>CONT</code> to continue the program. This would clear the screen and keep going, but it would only end again when it reached the bottom.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Doing something better.</strong><br>
<br>
When I saw a different approach to printing “Hello World,” I’m all in. <a href="https://www.reids4fun.com/zx81/hw/list" target="_blank" rel="noopener">My version</a> isn’t much longer, but it is more interesting.<br>
<br>
To start, the program uses two strings. The first, <var>A$</var>, defines what will be printed. You can actually change this to just about any string you want. I stuck with the classic. The second, <var>C$</var>, uses <code>DIM</code> to create an empty string with it’s size defined by <var>A$</var>.<br>
<br>
<pre>  20 LET A$=&quot;HELLO WORLD/&quot;
  30 DIM C$(LEN A$)</pre><br>
<br>
With that, the code gets a bit more esoteric, but not overly so. This time, flow control is provided using a loop. The <var>L</var> determine what character will be updated. Line 50 then sets the character <var>C$(L)</var> with a random character. On the ZX81, the first 64 characters (0-63) are all printable single letters or graphics. Going higher gets you to the ZX81 BASIC tokens. For example, character 64 is <code>RND</code> and would mess up the display.<br>
<br>
<pre>  40 FOR L=1 TO LEN A$
  50 LET C$(L)=CHR$ INT (RND*64)</pre><br>
<br>
Lines 60 and 70 scroll the display and print the current contents of <var>C$</var>. The use of <code>SCROLL</code> ensures the ZX81 doesn’t stop the display. If you wanted to get fancy, you could change up when you scroll and what is printed.<br>
<br>
<pre>  60 SCROLL
  70 PRINT C$</pre><br>
<br>
Last two lines of the routine are both flow control. Line 80 checks if the random character matches the one in <var>A$</var>. If not, it jumps back to 50 (that pesky <code>GOTO</code> again) to try a different character. If it does match, it goes to the next character to test.<br>
<br>
<pre>  80 IF C$(L)&amp;lt;&amp;gt;A$(L) THEN GOTO 50
  90 NEXT L</pre><br>
<br>
The rest of the code pauses for a short time before clearing the display and restarting,<br>
<br>
<div class="text-center"><img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/hw-2024-zx81-end-screenshot-by-steven-reid-320x240.png" alt="Hello World, ZX81 Screenshot, 2024 by Steven Reid">Hello World, ZX81 Screenshot, 2024 by Steven Reid</div>
<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> A fancier beginner’s program.</strong><br>
<br>
The result is a fancier display of “Hello World” than most first timers would have attempted. To be honest, I wish this was what was use. In a few lines of code you could teach a lot of coding techniques that would aid in future programming. Bit late to attempt writing my own BASIC book.<br>
<br>
After writing this program, I had a thought of changing up the print routine a bit to only scroll when the letter was found. This more closely matches the demo I was inspire by. If you want to try yourself, change lines 60-70 to this:<br>
<br>
<pre>  60 PRINT AT 21,0;C$
  70 IF C$(L)&amp;lt;&amp;gt;A$(L) THEN GOTO 50
  80 SCROLL</pre><br>
<br>
I’m sure you could come up with other variations based on code I’ve written before. I’d love to see what others come up with. Please share if you do!</description>
</item>
<item>
<title>Celebrating 40 Years of Dune (1984)</title>
<link>https://www.reids4fun.com/571/celebrating-40-years-of-dune-1984</link>
<dc:creator>Steven Reid</dc:creator>
<pubDate>Sun, 15 Dec 2024 13:38:00 -0600</pubDate>
<category>Mind the Gap</category>
<category>dune</category>
<category>movie</category>
<category>toto</category>
<category>frank herbert</category>
<guid>https://www.reids4fun.com/571/celebrating-40-years-of-dune-1984</guid>
<description><img src="https://www.reids4fun.com/images/uploads/Dune-movie-1984.jpg" alt="Dune, 1984" style="float:left;margin-right:10px">Today marks the 40th anniversary of the 1984 Dune movie, a film that still holds a special place in my heart. Don’t get me wrong—I thoroughly enjoy Denis Villeneuve’s stunning adaptations, and I admire how he’s brought Frank Herbert’s world to life for a new generation. But for me, the original remains unique. It’s tied to so many of my childhood memories and the passions I cultivated during those years.<strong><span style="color:gray;font-size:1.2em">#</span> Frank Herbert.</strong><br>
<br>
In the early eighties, I discovered Frank Herbert’s books. No, not Dune. My first introduction to his writing was The Dosadi Experiment. Growing up on the Hardy Boys and Perry Mason, Dosadi was a thrilling leap into Herbert’s intricate world-building. A galactic lawyer merging with another consciousness? It was unlike anything I’d read before.<br>
<br>
Though Dosadi belongs to a completely different universe, you can spot echoes of Herbert’s themes that are more famously explored in Dune: power, survival, and the delicate balance of ecosystems. It didn’t take long before I was devouring Dune and its sequels, along with Herbert’s other works. I’m pretty sure I’ve read them all, even tracking down his contributions to short story anthologies.<br>
<br>
Frank Herbert wasn’t my only favorite author, but he was definitely one of the most influential. Summers traveling with my family became synonymous with his books. I distinctly remember one vacation to South Carolina, where I spent the week immersed in God Emperor of Dune. It’s still my favorite in the series, with its profound reflections on humanity and governance.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Toto.</strong><br>
<br>
Music was a huge part of my life back then. I spent hours creating mixtapes from the weekly radio countdown, carefully recording songs onto cassette to enjoy later on my Walkman. Around this time, Toto was skyrocketing in popularity, and I was hooked. They quickly became my favorite band, and I started collecting their records.<br>
<br>
When I heard Toto would be scoring the Dune movie, it was like two of my worlds colliding. Of course, I had to grab the soundtrack. Star Wars had already sparked my love of movie scores, and adding Dune to my collection was a no-brainer.<br>
<br>
Recently, I’ve been reliving those memories. My wife surprised me with a record player for my birthday, and digging out my old vinyl has been a nostalgic joy. Naturally, Toto’s Dune soundtrack has been on repeat—it still holds up beautifully.<br>
<br>
<strong><span style="color:gray;font-size:1.2em">#</span> Dune Movie (1984).</strong><br>
<br>
Long before the Dune movie hit theaters, I was soaking in every detail about its production. I pored over movie magazines and even picked up an interview with Frank Herbert discussing the set designs and his involvement. And then there was the music—Toto’s score only heightened my anticipation.<br>
<br>
When the movie finally arrived, I was there opening night with friends, ready for the spectacle. The 70mm presentation was awe-inspiring, and the theater buzzed with excitement. We were rowdy before the lights dimmed, tossing popcorn and cracking jokes, but as soon as the film began, we were spellbound.<br>
<br>
The pageantry and imagery were breathtaking. Sure, some elements of the adaptation were strange—like the addition of the “weirding modules” as voice-activated weapons—but my 14-year-old self loved it anyway. My friends and I agreed it helped to have read the book first, but even the odd choices didn’t ruin the experience for us.<br>
<br>
The movie has stuck with me ever since. I never expected Dune to be adapted again—it felt like lightning in a bottle. Of course, Denis Villeneuve has proven me wrong, but for me, the 1984 version still holds a special place in my life.</description>
</item>
</channel>
</rss>
If you would like to create a banner that links to this page (i.e. this validation result), do the following:
Download the "valid RSS" banner.
Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)
Add this HTML to your page (change the image src
attribute if necessary):
If you would like to create a text link instead, here is the URL you can use:
http://www.feedvalidator.org/check.cgi?url=http%3A//feeds.feedburner.com/ReidsForFun