Congratulations!

[Valid RSS] This is a valid RSS feed.

Recommendations

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Source: http://feeds.feedburner.com/ReidsForFun

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <rss version="2.0"
  3. xmlns:atom="http://www.w3.org/2005/Atom"
  4. xmlns:dc="http://purl.org/dc/elements/1.1/"
  5. >
  6. <channel>
  7.  <title>Reid’s For Fun</title>
  8.  <link>https://www.reids4fun.com</link>
  9.  <atom:link href="https://feeds.feedburner.com/ReidsForFun" rel="self" type="application/rss+xml"/>
  10.  <description>Reid’s For Fun - Latest News</description>
  11.  <language>en-us</language>
  12.  <lastBuildDate>Sun, 29 Jun 2025 11:21:00 -0600</lastBuildDate>
  13.  <image>
  14.    <title>Reid’s For Fun</title>
  15.    <link>https://www.reids4fun.com</link>
  16.    <url>https://www.reids4fun.com/images/r-badge.png</url>
  17.  </image>
  18. <item>
  19.    <title>Recreating Font Art on the ZX81—With Some Limits</title>
  20.    <link>https://www.reids4fun.com/578/recreating-font-art-on-the-zx81with-some-limits</link>
  21.    <dc:creator>Steven Reid</dc:creator>
  22.    <pubDate>Sun, 29 Jun 2025 11:06:00 -0600</pubDate>
  23.     <category>ZX81 Computer</category>
  24.     <category>zx81</category>
  25.     <category>monthly</category>
  26.     <category>retro</category>
  27.     <category>fonts</category>
  28.     <category>ascii</category>
  29.     <category>art</category>
  30.    <guid>https://www.reids4fun.com/578/recreating-font-art-on-the-zx81with-some-limits</guid>
  31.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/funfonts-2025-3-d-zx81-screenshot-by-steven-reid-320x240.png&quot; alt=&quot;Fun Fonts: 3-D, 2025 by Steven Reid&quot; style=&quot;float:left;margin-right:10px&quot;&gt;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: &lt;a href="https://www.reids4fun.com/zx81/funfonts/play" target="_blank" rel="noopener"&gt;a simple banner program&lt;/a&gt; using different fonts. How fun!&lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; The Idea&lt;/strong&gt;&lt;br&gt;
  32. &lt;br&gt;
  33. 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&amp;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.&lt;br&gt;
  34. &lt;br&gt;
  35. 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.&lt;br&gt;
  36. &lt;br&gt;
  37. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Fast Forward&lt;/strong&gt;&lt;br&gt;
  38. &lt;br&gt;
  39. 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 &lt;a href="https://patorjk.com/software/taag/#p=about&amp;f=BlurVision%20ASCII&amp;t=ZX81" target="_blank" rel="noopener"&gt;FIGlet Fonts&lt;/a&gt;, which got me thinking about using them in a program.&lt;br&gt;
  40. &lt;br&gt;
  41. &lt;div class="text-center"&gt;&lt;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"&gt;Fun Fonts: 3-D, 2025 by Steven Reid&lt;/div&gt;
  42. &lt;br&gt;
  43. &lt;br&gt;
  44. 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.&lt;br&gt;
  45. &lt;br&gt;
  46. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Making Do&lt;/strong&gt;&lt;br&gt;
  47. &lt;br&gt;
  48. Not to be deterred, I decided to give a few of the fonts a try. &lt;a href="https://www.reids4fun.com/zx81/funfonts/list" target="_blank" rel="noopener"&gt;Creating a simple font display program&lt;/a&gt;, 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.&lt;br&gt;
  49. &lt;br&gt;
  50. &lt;div class="text-center"&gt;&lt;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"&gt;Fun Fonts: Alligator 2, 2025 by Steven Reid&lt;/div&gt;
  51. &lt;br&gt;
  52. &lt;br&gt;
  53. 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.&lt;br&gt;
  54. &lt;br&gt;
  55. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; All Done&lt;/strong&gt;&lt;br&gt;
  56. &lt;br&gt;
  57. 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.&lt;br&gt;
  58. &lt;br&gt;
  59. &lt;div class="text-center"&gt;&lt;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"&gt;Fun Fonts: USA Flag, 2025 by Steven Reid&lt;/div&gt;
  60. &lt;br&gt;
  61. &lt;br&gt;
  62. 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.&lt;br&gt;
  63. &lt;br&gt;
  64. What ideas do you have?</description>
  65. </item>
  66.  <item>
  67.    <title>A ZX81 Puzzle Makeover: No More INPUT Drama</title>
  68.    <link>https://www.reids4fun.com/577/a-zx81-puzzle-makeover-no-more-input-drama</link>
  69.    <dc:creator>Steven Reid</dc:creator>
  70.    <pubDate>Fri, 30 May 2025 16:35:00 -0600</pubDate>
  71.     <category>ZX81 Computer</category>
  72.     <category>zx81</category>
  73.     <category>monthly</category>
  74.     <category>retro</category>
  75.    <guid>https://www.reids4fun.com/577/a-zx81-puzzle-makeover-no-more-input-drama</guid>
  76.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/wgc-1982-2024-zx81-starting-updated-by-steven-reid-320x240.png&quot; alt=&quot;Wolf, Goat Cabbage: starting the puzzle&quot; style=&quot;float:left;margin-right:10px&quot;&gt;This month’s program is a bit of a departure. It is a take on the classic &quot;Wolf, Goat, Cabbage&quot; puzzle. The twist is, I didn’t write this one. Instead, I decided to &lt;a href="https://www.reids4fun.com/zx81/wgc/play" target="_blank" rel="noopener"&gt;update it to make the interface a bit easier to use&lt;/a&gt;. Let’s dive into the code.&lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; The puzzle.&lt;/strong&gt;&lt;br&gt;
  77. &lt;br&gt;
  78. 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&#39;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.&lt;br&gt;
  79. &lt;br&gt;
  80. &lt;div class="text-center"&gt;&lt;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."&gt;Wolf, Goat Cabbage: starting the puzzle.&lt;/div&gt;
  81. &lt;br&gt;
  82. &lt;br&gt;
  83. This ZX81 version of the  puzzle comes from the book ”Computer Puzzles: For Spectrum &amp; ZX81,” by Ian Stewart &amp; 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.&lt;br&gt;
  84. &lt;br&gt;
  85. &lt;div class="text-center"&gt;&lt;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."&gt;Wolf, Goat Cabbage: puzzle failed.&lt;/div&gt;
  86. &lt;br&gt;
  87. &lt;br&gt;
  88. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Wonky controls.&lt;/strong&gt;&lt;br&gt;
  89. &lt;br&gt;
  90. Although not as graphically interesting, the puzzler works well enough. But, for some reason, it used &lt;code&gt;INPUT&lt;/code&gt; 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.&lt;br&gt;
  91. &lt;br&gt;
  92. &lt;div class="text-center"&gt;&lt;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."&gt;Wolf, Goat Cabbage: boat moving across the river.&lt;/div&gt;
  93. &lt;br&gt;
  94. &lt;br&gt;
  95. As such, I decided to fix it! The program used variables to make it easier &lt;a href="https://www.reids4fun.com/zx81/wgc/list" target="_blank" rel="noopener"&gt;to read the code&lt;/a&gt;. I followed suit and added in two routines. One gets a key using &lt;code&gt;INKEY$&lt;/code&gt;.  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.&lt;br&gt;
  96. &lt;br&gt;
  97. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Easy to solve.&lt;/strong&gt;&lt;br&gt;
  98. &lt;br&gt;
  99. 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.&lt;br&gt;
  100. &lt;br&gt;
  101. &lt;div class="text-center"&gt;&lt;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."&gt;Wolf, Goat Cabbage: puzzle completed.&lt;/div&gt;
  102. &lt;br&gt;
  103. &lt;br&gt;
  104. 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>
  105. </item>
  106.  <item>
  107.    <title>Castle Quest Was My Late-Night ZX81 Adventure with AI</title>
  108.    <link>https://www.reids4fun.com/576/castle-quest-was-my-late-night-zx81-adventure-with-ai</link>
  109.    <dc:creator>Steven Reid</dc:creator>
  110.    <pubDate>Wed, 30 Apr 2025 23:46:00 -0600</pubDate>
  111.     <category>ZX81 Computer</category>
  112.     <category>zx81</category>
  113.     <category>retro</category>
  114.     <category>monthly</category>
  115.     <category>genai</category>
  116.    <guid>https://www.reids4fun.com/576/castle-quest-was-my-late-night-zx81-adventure-with-ai</guid>
  117.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/cq-2025-zx81-start-screenshot-by-steven-reid-320x240.png&quot; alt=&quot;Castle Quest, ZX81 Start Screenshot, 2025 by Steven Reid&quot; style=&quot;float:left;margin-right:10px&quot;&gt;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 &lt;a href="https://www.reids4fun.com/zx81/cq/play" target="_blank" rel="noopener"&gt;Castle Quest&lt;/a&gt;, a small text adventure for the ZX81.&lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Finding the vibe.&lt;/strong&gt;&lt;br&gt;
  118. &lt;br&gt;
  119. I find the whole concept of &lt;a href="https://en.wikipedia.org/wiki/Vibe_coding" target="_blank" rel="noopener"&gt;vibe coding&lt;/a&gt; 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.&lt;br&gt;
  120. &lt;br&gt;
  121. 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.&lt;br&gt;
  122. &lt;br&gt;
  123. &lt;div class="text-center"&gt;&lt;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"&gt;Castle Quest, ZX81 Start Screenshot, 2025 by Steven Reid&lt;/div&gt;
  124. &lt;br&gt;
  125. &lt;br&gt;
  126. 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.&lt;br&gt;
  127. &lt;br&gt;
  128. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Building the game.&lt;/strong&gt;&lt;br&gt;
  129. &lt;br&gt;
  130. 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.&lt;br&gt;
  131. &lt;br&gt;
  132. 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.&lt;br&gt;
  133. &lt;br&gt;
  134. &lt;div class="text-center"&gt;&lt;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"&gt;Castle Quest, ZX81 Take Action Screenshot, 2025 by Steven Reid&lt;/div&gt;
  135. &lt;br&gt;
  136. &lt;br&gt;
  137. 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.&lt;br&gt;
  138. &lt;br&gt;
  139. 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.&lt;br&gt;
  140. &lt;br&gt;
  141. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; But is it yours?&lt;/strong&gt;&lt;br&gt;
  142. &lt;br&gt;
  143. 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.&lt;br&gt;
  144. &lt;br&gt;
  145. &lt;a href="https://www.reids4fun.com/zx81/cq/list" target="_blank" rel="noopener"&gt;Looking at the code&lt;/a&gt;, 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.&lt;br&gt;
  146. &lt;br&gt;
  147. 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.&lt;br&gt;
  148. &lt;br&gt;
  149. &lt;div class="text-center"&gt;&lt;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"&gt;Castle Quest, ZX81 East Action Screenshot, 2025 by Steven Reid&lt;/div&gt;
  150. &lt;br&gt;
  151. &lt;br&gt;
  152. 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.&lt;br&gt;
  153. &lt;br&gt;
  154. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; More to it.&lt;/strong&gt;&lt;br&gt;
  155. &lt;br&gt;
  156. 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.&lt;br&gt;
  157. &lt;br&gt;
  158. 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>
  159. </item>
  160.  <item>
  161.    <title>A New Take on the Infinite Maze for the ZX81</title>
  162.    <link>https://www.reids4fun.com/575/a-new-take-on-the-infinite-maze-for-the-zx81</link>
  163.    <dc:creator>Steven Reid</dc:creator>
  164.    <pubDate>Sat, 15 Mar 2025 03:45:00 -0600</pubDate>
  165.     <category>ZX81 Computer</category>
  166.     <category>zx81</category>
  167.     <category>retro</category>
  168.     <category>monthly</category>
  169.    <guid>https://www.reids4fun.com/575/a-new-take-on-the-infinite-maze-for-the-zx81</guid>
  170.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/ps2infmaze-2024-zx81-maze-screenshot-by-steven-reid-320x240.png&quot; alt=&quot;PS2 Infinite Maze, ZX81 Screenshot, 2024 by Steven Reid&quot; style=&quot;float:left;margin-right:10px&quot;&gt;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. &lt;a href="https://www.reids4fun.com/zx81/ps2infmaze/play" target="_blank" rel="noopener"&gt;This new version&lt;/a&gt; takes a different approach, using alternate graphics to build a more visually interesting maze while leveraging a better machine scrolling routine.&lt;br&gt;
  171. &lt;br&gt;
  172. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; A new look, but not a new idea.&lt;/strong&gt;&lt;br&gt;
  173. &lt;br&gt;
  174. 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 &lt;a href="https://www.reids4fun.com/569/print-like-a-pro-on-the-zx81-with-this-updated-smooth-scroll-routine" target="_blank" rel="noopener"&gt;print scroll 2&lt;/a&gt; routine, I don’t have to handle scrolling manually. Instead, the maze builds naturally from the top of the screen down.&lt;br&gt;
  175. &lt;br&gt;
  176. &lt;div class="text-center"&gt;&lt;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"&gt;PS2 Infinite Maze, ZX81 Screenshot, 2024 by Steven Reid&lt;/div&gt;
  177. &lt;br&gt;
  178. &lt;br&gt;
  179. 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.&lt;br&gt;
  180. &lt;br&gt;
  181. 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.&lt;br&gt;
  182. &lt;br&gt;
  183. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; The BASIC code couldn&#39;t be much simpler.&lt;/strong&gt;&lt;br&gt;
  184. &lt;br&gt;
  185. Since the Print Scroll 2 machine code routine handles scrolling, the &lt;a href="https://www.reids4fun.com/zx81/ps2infmaze/list" target="_blank" rel="noopener"&gt;BASIC code itself is minimal&lt;/a&gt;—just two lines:&lt;br&gt;
  186. &lt;br&gt;
  187. &lt;pre&gt;&#160;&#160;20&#160;PRINT&#160;USR&#160;16514;&#160;&amp;quot;&#91;5&#93;&#91;6&#93;&amp;quot;&#40;RND+1&#41;;
  188. &#160;&#160;30&#160;GOTO&#160;20&lt;/pre&gt;&lt;br&gt;
  189. &lt;br&gt;
  190. Here, &lt;code&gt;[5]&lt;/code&gt; represents Shift Graphics 5 (the vertical left bar), and &lt;code&gt;[6]&lt;/code&gt; 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.&lt;br&gt;
  191. &lt;br&gt;
  192. &lt;div class="text-center"&gt;&lt;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"&gt;PS2 Infinite Maze, ZX81 Listing, 2024 by Steven Reid&lt;/div&gt;
  193. &lt;br&gt;
  194. &lt;br&gt;
  195. Looking at the code, I realized I could have simplified it further by omitting the &lt;code&gt;CLS&lt;/code&gt;. The &lt;code&gt;RUN&lt;/code&gt; command already clears the screen, making line 10 redundant. Simplicity at its best!&lt;br&gt;
  196. &lt;br&gt;
  197. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Need more ideas.&lt;/strong&gt;&lt;br&gt;
  198. &lt;br&gt;
  199. 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.&lt;br&gt;
  200. &lt;br&gt;
  201. As a side note, I toyed with the idea of calling &lt;code&gt;USR&lt;/code&gt; 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:&lt;br&gt;
  202. &lt;br&gt;
  203. &lt;pre&gt;&#160;&#160;10&#160;PRINT&#160;&amp;quot;&#91;5&#93;&#91;6&#93;&amp;quot;&#40;RND+NOT&#160;PEEK&#160;USR
  204. &#160;&#40;3085+ABS&#160;&#40;PEEK&#160;16441-17&#41;=16&#41;&#41;
  205. *USR&#160;3663&#41;;&lt;/pre&gt;&lt;br&gt;
  206. &lt;br&gt;
  207. I wish I’d thought of that! It works well, and no, I won’t try to explain it. At least not today.&lt;br&gt;
  208. &lt;br&gt;
  209. Enjoy!</description>
  210. </item>
  211.  <item>
  212.    <title>Making Time for a Little Life on the ZX81</title>
  213.    <link>https://www.reids4fun.com/574/making-time-for-a-little-life-on-the-zx81</link>
  214.    <dc:creator>Steven Reid</dc:creator>
  215.    <pubDate>Fri, 28 Feb 2025 01:05:00 -0600</pubDate>
  216.     <category>ZX81 Computer</category>
  217.     <category>zx81</category>
  218.     <category>monthly</category>
  219.     <category>retro</category>
  220.     <category>simulation</category>
  221.     <category>assembly</category>
  222.     <category>z80</category>
  223.    <guid>https://www.reids4fun.com/574/making-time-for-a-little-life-on-the-zx81</guid>
  224.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/life-2024-zx81-screenshot-by-steven-reid-320x240.png&quot; alt=&quot;Life, ZX81 Screenshot, 2024 by Steven Reid&quot; style=&quot;float:left;margin-right:10px&quot;&gt;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. &lt;a href="https://www.reids4fun.com/zx81/life/play" target="_blank" rel="noopener"&gt;My version aims to correct that&lt;/a&gt;.&lt;br&gt;
  225. &lt;br&gt;
  226. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Getting started.&lt;/strong&gt;&lt;br&gt;
  227. &lt;br&gt;
  228. The first simulation I tried was actually a more generic version from “&lt;a href="https://archive.org/details/Creating_Simulation_Games_on_Your_Computer_1986_Ballantine_Books/page/n41/mode/2up" target="_blank" rel="noopener"&gt;Creating Simulation Games on Your Computer&lt;/a&gt;,” 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.&lt;br&gt;
  229. &lt;br&gt;
  230. 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 &lt;code&gt;FAST&lt;/code&gt; mode. This helped, but I felt I could do better. So, I wrote my own version in assembly.&lt;br&gt;
  231. &lt;br&gt;
  232. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Making a faster simulation.&lt;/strong&gt;&lt;br&gt;
  233. &lt;br&gt;
  234. Writing &lt;a href="https://www.reids4fun.com/zx81/life/asm" target="_blank" rel="noopener"&gt;a machine code version of Life&lt;/a&gt; was straightforward. I initialize the screen and then loop through each generation. The core code looks like this:&lt;br&gt;
  235. &lt;br&gt;
  236. &lt;pre&gt;main_loop&#58;
  237.  
  238. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;call&#160;init_life&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Initialize&#160;Game&#160;of&#160;Life
  239.  
  240. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Run&#160;simulation
  241. life_loop&#58;
  242.  
  243. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;call&#160;live_or_die&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Run&#160;life&#160;simulation
  244. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;call&#160;copy_to_screen&#160;&#160;&#160;&#160;&#160;;&#160;Copy&#160;new&#160;life&#160;to&#160;screen
  245. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;call&#160;delay_and_test&#160;&#160;&#160;&#160;&#160;;&#160;Test&#160;for&#160;break&#160;key&#160;or&#160;gen&#160;&amp;amp;gt;&#160;100
  246.  
  247. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Was&#160;a&#160;key&#160;pressed&#160;or&#160;generations&#160;hit&#160;100?
  248. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;or&#160;a
  249. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jp&#160;z,life_loop&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;No,&#160;display&#160;next&#160;generation
  250.  
  251. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jp&#160;main_loop&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Otherwise,&#160;start&#160;again!&lt;/pre&gt;&lt;br&gt;
  252. &lt;br&gt;
  253. 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.&lt;br&gt;
  254. &lt;br&gt;
  255. &lt;div class="text-center"&gt;&lt;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"&gt;Life, ZX81 Busy Screenshot, 2024 by Steven Reid&lt;/div&gt;
  256. &lt;br&gt;
  257. &lt;br&gt;
  258. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Making life run.&lt;/strong&gt;&lt;br&gt;
  259. &lt;br&gt;
  260. 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.&lt;br&gt;
  261. &lt;br&gt;
  262. 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.&lt;br&gt;
  263. &lt;br&gt;
  264. 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.&lt;br&gt;
  265. &lt;br&gt;
  266. &lt;pre&gt;count_life&#58;
  267. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;a,&#40;hl&#41;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Get&#160;cell
  268. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;or&#160;a&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Is&#160;it&#160;alive?
  269. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ret&#160;z&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;No,&#160;return
  270. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;inc&#160;c&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Yes,&#160;increment&#160;count
  271. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ret&lt;/pre&gt;&lt;br&gt;
  272. &lt;br&gt;
  273. 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:&lt;br&gt;
  274. &lt;br&gt;
  275. &lt;pre&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Check&#160;if&#160;cell&#160;dies&#160;&#40;c&#160;&amp;amp;lt;&amp;amp;gt;&#160;2&#160;and&#160;c&#160;&amp;amp;lt;&amp;amp;gt;&#160;3&#41;
  276. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cp&#160;2&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Check&#160;if&#160;2
  277. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jr&#160;z,lod_alive&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;If&#160;2,&#160;stays&#160;alive!
  278. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cp&#160;3&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Check&#160;if&#160;3
  279. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jr&#160;z,lod_alive&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;If&#160;3,&#160;stays&#160;alive!
  280. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;xor&#160;a&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Otherwise,&#160;cell&#160;dies
  281. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jr&#160;lod_skip&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Done&lt;/pre&gt;&lt;br&gt;
  282. &lt;br&gt;
  283. But if the cell is empty and exactly 3 neighbors are alive, a new cell is born. This code is even simpler:&lt;br&gt;
  284. &lt;br&gt;
  285. &lt;pre&gt;lod_empty&#58;
  286. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Check&#160;if&#160;lives
  287. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cp&#160;3&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Check&#160;if&#160;3
  288. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;a,0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Assume&#160;empty&#160;cell
  289. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jr&#160;nz,lod_skip&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Not&#160;3,&#160;skip&#160;ahead
  290. lod_alive&#58;
  291. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;a,$80&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Yes,&#160;cell&#160;is&#160;born&lt;/pre&gt;&lt;br&gt;
  292. &lt;br&gt;
  293. 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.&lt;br&gt;
  294. &lt;br&gt;
  295. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Enjoying simulations.&lt;/strong&gt;&lt;br&gt;
  296. &lt;br&gt;
  297. 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.&lt;br&gt;
  298. &lt;br&gt;
  299. 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.&lt;br&gt;
  300. &lt;br&gt;
  301. 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.&lt;br&gt;
  302. &lt;br&gt;
  303. 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.&lt;br&gt;
  304. &lt;br&gt;
  305. As always, comments and ideas are welcome!</description>
  306. </item>
  307.  <item>
  308.    <title>A Present On The ZX81 For VC3 2024</title>
  309.    <link>https://www.reids4fun.com/573/a-present-on-the-zx81-for-vc3-2024</link>
  310.    <dc:creator>Steven Reid</dc:creator>
  311.    <pubDate>Wed, 01 Jan 2025 20:17:00 -0600</pubDate>
  312.     <category>ZX81 Computer</category>
  313.     <category>zx81</category>
  314.     <category>retro</category>
  315.     <category>monthly</category>
  316.     <category>vc3</category>
  317.     <category>challenge</category>
  318.     <category>z80</category>
  319.    <guid>https://www.reids4fun.com/573/a-present-on-the-zx81-for-vc3-2024</guid>
  320.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/present-2024-zx81-screenshot-by-steven-reid-320x240.png&quot; alt=&quot;Present, ZX81 ScreenShot, 2024 by Steven Reid&quot; style=&quot;float:left;margin-right:10px&quot;&gt;Another year and another Vintage Computing Christmas Challenge  (VC&lt;sup&gt;3&lt;/sup&gt; 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 &lt;a href="https://www.reids4fun.com/zx81/present/play" target="_blank" rel="noopener"&gt;an auto-run version for Present&lt;/a&gt; so you could see it in action.&lt;br&gt;
  321. &lt;br&gt;
  322. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; This year’s VC&lt;sup&gt;3&lt;sup&gt;.&lt;/strong&gt;&lt;br&gt;
  323. &lt;br&gt;
  324. For 2024 &lt;a href="https://logiker.com/Vintage-Computing-Christmas-Challenge-2024" target="_blank" rel="noopener"&gt;lthe challenge was to display a Christmas present&lt;/a&gt;. 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.&lt;br&gt;
  325. &lt;br&gt;
  326. 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.&lt;br&gt;
  327. &lt;br&gt;
  328. &lt;/p&gt;&lt;blockquote&gt;&lt;hr&gt;&lt;cite&gt;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&#39;t influence the code. At any time, I could replace the o with O or the C64 Backslash with its counterpart on the C64.&lt;/cite&gt;&lt;hr&gt;&lt;/blockquote&gt;&lt;p class="hyphenate"&gt;&lt;br&gt;
  329. &lt;br&gt;
  330. The harder part  was deciding how to create the present.&lt;br&gt;
  331. &lt;br&gt;
  332. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; My Approach.&lt;/strong&gt;&lt;br&gt;
  333. &lt;br&gt;
  334. 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.&lt;br&gt;
  335. &lt;br&gt;
  336. 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.&lt;br&gt;
  337. &lt;br&gt;
  338. 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.&lt;br&gt;
  339. &lt;br&gt;
  340. &lt;pre&gt;&#160;
  341. 1&#160;FOR&#160;X=1&#160;TO&#160;10&#160;STEP&#160;9
  342. 2&#160;FOR&#160;Y=1&#160;TO&#160;10&#160;STEP&#160;9
  343. 3&#160;FOR&#160;B=1&#160;T0&#160;8
  344. 4&#160;PRINT&#160;AT&#160;0,9;&amp;quot;\O/&amp;quot;;AT&#160;X+B,Y;&amp;quot;&#58;&amp;quot;;AT&#160;X+B,Y+9;&amp;quot;&#58;&amp;quot;;AT&#160;X,Y;&amp;quot;+&amp;quot;;AT&#160;X+9,Y;&amp;quot;+&amp;quot;;AT&#160;X,Y+B;&amp;quot;-+&amp;quot;;AT&#160;X+9,Y+B;&amp;quot;-+&amp;quot;
  345. 5&#160;NEXT&#160;B
  346. 6&#160;NEXT&#160;Y
  347. 7&#160;NEXT&#160;X&lt;/pre&gt;&lt;br&gt;
  348. &lt;br&gt;
  349. I will say that it probably took a couple of hours to get &lt;a href="https://www.reids4fun.com/zx81/present/list" target="_blank" rel="noopener"&gt;the code right&lt;/a&gt;. 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.&lt;br&gt;
  350. &lt;br&gt;
  351. 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 &lt;code&gt;LEN STR$ PI&lt;/code&gt; (which is 9) into a variable sped the program back up at the cost of that  byte. Worth it.&lt;br&gt;
  352. &lt;br&gt;
  353. &lt;div class="text-center"&gt;&lt;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"&gt;Present, ZX81 ScreenShot, 2024 by Steven Reid&lt;/div&gt;
  354. &lt;br&gt;
  355. &lt;br&gt;
  356. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Counting things up.&lt;/strong&gt;&lt;br&gt;
  357. &lt;br&gt;
  358. 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.&lt;br&gt;
  359. &lt;br&gt;
  360. 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.&lt;br&gt;
  361. &lt;br&gt;
  362. 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.&lt;br&gt;
  363. &lt;br&gt;
  364. &lt;pre&gt;1&#160;PRINT&#160;TAB&#160;8;&amp;quot;\O/&amp;quot;
  365. 2&#160;FOR&#160;Y=-9&#160;TO&#160;9
  366. 3&#160;FOR&#160;X=-9&#160;TO&#160;9
  367. PRINT&#160;&amp;quot;-+&amp;quot;&#40;1+&#40;X=9*SGN&#160;X&#41;+2*NOT&#160;Y=9*SGN&#160;Y&#41;;
  368. 4&#160;NEXT&#160;X
  369. 5&#160;PRINT
  370. 6&#160;NEXT&#160;Y&#160;&lt;/pre&gt; &lt;br&gt;
  371. &lt;br&gt;
  372. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Would Assembly have helped?&lt;/strong&gt;&lt;br&gt;
  373. &lt;br&gt;
  374. 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.&lt;br&gt;
  375. &lt;br&gt;
  376. 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.&lt;br&gt;
  377. &lt;br&gt;
  378. I did use a a couple of ROM routines to help reduce some code. The print return call at &lt;code&gt;CALL $0b87&lt;/code&gt; and the print character at &lt;code&gt;RST $10&lt;/code&gt;. But the screen display of the ZX81 ultimately became the limiting factor.&lt;br&gt;
  379. &lt;br&gt;
  380. &lt;pre&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;get&#160;ready&#160;to&#160;print
  381. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;hl,&#40;d_file&#41;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;3&#160;-&#160;get&#160;screen&#160;location
  382. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;bc,9&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;3&#160;-&#160;get&#160;to&#160;position&#160;on&#160;screen
  383. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;add&#160;hl,bc&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1&#160;-&#160;move&#160;to&#160;position
  384. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;7&#160;bytes
  385.  
  386. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;print&#160;bow&#160;-&#160;\O/&#160;=&#160;$86,$34,$06
  387. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;&#40;hl&#41;,$86&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;load&#160;\
  388. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;inc&#160;hl&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1
  389. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;&#40;hl&#41;,$34&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;load&#160;O
  390. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;inc&#160;hl&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1
  391. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;&#40;hl&#41;,$06&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;load&#160;/
  392. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;8&#160;bytes&#160;&#40;15&#41;
  393.  
  394. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;print&#160;present
  395. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;c,19&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;y&#160;loop
  396. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;e,1&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;row&#160;pattern
  397. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;4&#160;bytes&#160;&#40;19&#41;
  398.  
  399. ylp&#58;
  400. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;call&#160;$0b87&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;3&#160;-&#160;print&#160;return&#160;ROM&#160;routine
  401. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;hl,$0e00&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;3&#160;-&#160;box&#160;line&#160;&#39;&#58;&#160;&#39;
  402. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;6&#160;bytes&#160;&#40;25&#41;
  403.  
  404. ty&#58;
  405. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dec&#160;e&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1&#160;-&#160;subtract&#160;1
  406. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jr&#160;nz,dox&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;if&#160;not&#160;0,&#160;then&#160;print&#160;box&#160;&#40;&#58;&#160;&#58;&#41;
  407. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;e,9&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;otherwise,&#160;reset&#160;e
  408. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;hl,$1516&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;3&#160;-&#160;ribbon&#160;line&#160;&#39;+-&#39;
  409. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;8&#160;bytes&#160;&#40;33&#41;
  410.  
  411. dox&#58;
  412. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;d,1&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;column&#160;pattern
  413. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;bytes&#160;&#40;34&#41;
  414.  
  415. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;b,19&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;x&#160;loop
  416. xlp&#58;
  417. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;a,l&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1&#160;-&#160;set&#160;a&#160;to&#160;char&#160;in&#160;l
  418. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dec&#160;d&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1&#160;-&#160;subtract&#160;1
  419. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jr&#160;nz,draw&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;of&#160;not&#160;0,&#160;print&#160;char
  420. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;d,9&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;otherwise,&#160;reset&#160;d
  421. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;a,h&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1&#160;-&#160;set&#160;a&#160;to&#160;char&#160;in&#160;h
  422. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;9&#160;bytes&#160;&#40;44&#41;
  423.  
  424. draw&#58;
  425. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rst&#160;$10&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1&#160;-&#160;print&#160;char
  426. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;djnz&#160;xlp&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;next&#160;x
  427. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dec&#160;c&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1
  428. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jr&#160;nz,ylp&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;2&#160;-&#160;next&#160;y
  429. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;6&#160;bytes&#160;&#40;50&#41;
  430.  
  431. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ret&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1
  432. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;1&#160;bytes&#160;&#40;51&#41;&lt;/pre&gt;&lt;br&gt;
  433. &lt;br&gt;
  434. If you can find any additional optimizations, let me know.&lt;br&gt;
  435. &lt;br&gt;
  436. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; A lot of fun.&lt;/strong&gt;&lt;br&gt;
  437. &lt;br&gt;
  438. In the end, the challenge was a lot of fun. I liked  my entry, even if not the smallest. I learned a lot &lt;a href="https://www.youtube.com/watch?v=kJYbIC-14s4" target="_blank" rel="noopener"&gt;from looking at what others were doing&lt;/a&gt;. The wild entries were fun to watch.&lt;br&gt;
  439. &lt;br&gt;
  440. 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.&lt;br&gt;
  441. &lt;br&gt;
  442. Sigh. At least I got to code a bit.&lt;br&gt;
  443. &lt;br&gt;
  444. Happy New Year!</description>
  445. </item>
  446.  <item>
  447.    <title>Turning Hello World into a Creative ZX81 BASIC Program</title>
  448.    <link>https://www.reids4fun.com/572/turning-hello-world-into-a-creative-zx81-basic-program</link>
  449.    <dc:creator>Steven Reid</dc:creator>
  450.    <pubDate>Sat, 28 Dec 2024 11:46:00 -0600</pubDate>
  451.     <category>ZX81 Computer</category>
  452.     <category>zx81</category>
  453.     <category>monthly</category>
  454.     <category>retro</category>
  455.    <guid>https://www.reids4fun.com/572/turning-hello-world-into-a-creative-zx81-basic-program</guid>
  456.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/hw-2024-zx81-end-screenshot-by-steven-reid-320x240.png&quot; alt=&quot;Hello World, ZX81 Screenshot, 2024 by Steven Reid&quot; style=&quot;float:left;margin-right:10px&quot;&gt;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 &lt;a href="https://www.reids4fun.com/zx81/hw/play" target="_blank" rel="noopener"&gt;Hello World&lt;/a&gt;. This version scrolls through a stream of random digits until the message is displayed. How fun is that?&lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; An old favorite.&lt;/strong&gt;&lt;br&gt;
  457. &lt;br&gt;
  458. 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?&lt;br&gt;
  459. &lt;br&gt;
  460. 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 &lt;code&gt;PRINT&lt;/code&gt; command. A such it was a good starting point.&lt;br&gt;
  461. &lt;br&gt;
  462. &lt;pre&gt;10&#160;PRINT&#160;&amp;quot;HELLO&#160;WORLD&amp;quot;
  463. 20&#160;GOTO&#160;10&lt;/pre&gt;&lt;br&gt;
  464. &lt;br&gt;
  465. Of course, this introduces the controversy of the time which is how BASIC managed flow control. The &lt;code&gt;GOTO&lt;/code&gt; keeps the program running and accounts for all those &lt;i&gt;bad programmers&lt;i&gt; from that time. Probably not, but it did tend to label BASIC as a toy language. Sad times.&lt;br&gt;
  466. &lt;br&gt;
  467. 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 &lt;code&gt;CONT&lt;/code&gt; to continue the program. This would clear the screen and keep going, but it would only end again when it reached the bottom.&lt;br&gt;
  468. &lt;br&gt;
  469. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Doing something better.&lt;/strong&gt;&lt;br&gt;
  470. &lt;br&gt;
  471. When I saw a different approach to printing “Hello World,” I’m all in. &lt;a href="https://www.reids4fun.com/zx81/hw/list" target="_blank" rel="noopener"&gt;My version&lt;/a&gt; isn’t much longer, but it is more interesting.&lt;br&gt;
  472. &lt;br&gt;
  473. To start, the program uses two strings. The first, &lt;var&gt;A$&lt;/var&gt;, defines what will be printed. You can actually change this to just about any string you want. I stuck with the classic. The second, &lt;var&gt;C$&lt;/var&gt;, uses &lt;code&gt;DIM&lt;/code&gt; to create an empty string with it’s size defined by &lt;var&gt;A$&lt;/var&gt;.&lt;br&gt;
  474. &lt;br&gt;
  475. &lt;pre&gt;&#160;&#160;20&#160;LET&#160;A$=&amp;quot;HELLO&#160;WORLD/&amp;quot;
  476. &#160;&#160;30&#160;DIM&#160;C$&#40;LEN&#160;A$&#41;&lt;/pre&gt;&lt;br&gt;
  477. &lt;br&gt;
  478. With that, the code gets a bit more esoteric, but not overly so. This time, flow control is provided using a loop. The &lt;var&gt;L&lt;/var&gt; determine what character will be updated. Line 50 then sets the character &lt;var&gt;C$(L)&lt;/var&gt; 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 &lt;code&gt;RND&lt;/code&gt; and would mess up the display.&lt;br&gt;
  479. &lt;br&gt;
  480. &lt;pre&gt;&#160;&#160;40&#160;FOR&#160;L=1&#160;TO&#160;LEN&#160;A$
  481. &#160;&#160;50&#160;LET&#160;C$&#40;L&#41;=CHR$&#160;INT&#160;&#40;RND*64&#41;&lt;/pre&gt;&lt;br&gt;
  482. &lt;br&gt;
  483. Lines 60 and 70 scroll the display and print the current contents of &lt;var&gt;C$&lt;/var&gt;. The use of &lt;code&gt;SCROLL&lt;/code&gt; 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.&lt;br&gt;
  484. &lt;br&gt;
  485. &lt;pre&gt;&#160;&#160;60&#160;SCROLL
  486. &#160;&#160;70&#160;PRINT&#160;C$&lt;/pre&gt;&lt;br&gt;
  487. &lt;br&gt;
  488. Last two lines of the routine are both flow control. Line 80 checks if the random character matches the one in &lt;var&gt;A$&lt;/var&gt;. If not, it jumps back to 50 (that pesky &lt;code&gt;GOTO&lt;/code&gt; again) to try a different character. If it does match, it goes to the next character to test.&lt;br&gt;
  489. &lt;br&gt;
  490. &lt;pre&gt;&#160;&#160;80&#160;IF&#160;C$&#40;L&#41;&amp;amp;lt;&amp;amp;gt;A$&#40;L&#41;&#160;THEN&#160;GOTO&#160;50
  491. &#160;&#160;90&#160;NEXT&#160;L&lt;/pre&gt;&lt;br&gt;
  492. &lt;br&gt;
  493. The rest of the code pauses for a short time before clearing the display and restarting,&lt;br&gt;
  494. &lt;br&gt;
  495. &lt;div class="text-center"&gt;&lt;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"&gt;Hello World, ZX81 Screenshot, 2024 by Steven Reid&lt;/div&gt;
  496. &lt;br&gt;
  497. &lt;br&gt;
  498. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; A fancier beginner’s program.&lt;/strong&gt;&lt;br&gt;
  499. &lt;br&gt;
  500. 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.&lt;br&gt;
  501. &lt;br&gt;
  502. 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:&lt;br&gt;
  503. &lt;br&gt;
  504. &lt;pre&gt;&#160;&#160;60&#160;PRINT&#160;AT&#160;21,0;C$
  505. &#160;&#160;70&#160;IF&#160;C$&#40;L&#41;&amp;amp;lt;&amp;amp;gt;A$&#40;L&#41;&#160;THEN&#160;GOTO&#160;50
  506. &#160;&#160;80&#160;SCROLL&lt;/pre&gt;&lt;br&gt;
  507. &lt;br&gt;
  508. 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>
  509. </item>
  510.  <item>
  511.    <title>Celebrating 40 Years of Dune (1984)</title>
  512.    <link>https://www.reids4fun.com/571/celebrating-40-years-of-dune-1984</link>
  513.    <dc:creator>Steven Reid</dc:creator>
  514.    <pubDate>Sun, 15 Dec 2024 13:38:00 -0600</pubDate>
  515.     <category>Mind the Gap</category>
  516.     <category>dune</category>
  517.     <category>movie</category>
  518.     <category>toto</category>
  519.     <category>frank herbert</category>
  520.    <guid>https://www.reids4fun.com/571/celebrating-40-years-of-dune-1984</guid>
  521.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/uploads/Dune-movie-1984.jpg&quot; alt=&quot;Dune, 1984&quot; style=&quot;float:left;margin-right:10px&quot;&gt;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.&lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Frank Herbert.&lt;/strong&gt;&lt;br&gt;
  522. &lt;br&gt;
  523. 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.&lt;br&gt;
  524. &lt;br&gt;
  525. 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.&lt;br&gt;
  526. &lt;br&gt;
  527. 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.&lt;br&gt;
  528. &lt;br&gt;
  529. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Toto.&lt;/strong&gt;&lt;br&gt;
  530. &lt;br&gt;
  531. 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.&lt;br&gt;
  532. &lt;br&gt;
  533. 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.&lt;br&gt;
  534. &lt;br&gt;
  535. 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.&lt;br&gt;
  536. &lt;br&gt;
  537. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Dune Movie (1984).&lt;/strong&gt;&lt;br&gt;
  538. &lt;br&gt;
  539. 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.&lt;br&gt;
  540. &lt;br&gt;
  541. 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.&lt;br&gt;
  542. &lt;br&gt;
  543. 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.&lt;br&gt;
  544. &lt;br&gt;
  545. 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>
  546. </item>
  547.  <item>
  548.    <title>Making a better Mandelbrot Set on the ZX81 using High Resolution Graphics</title>
  549.    <link>https://www.reids4fun.com/570/making-a-better-mandelbrot-set-on-the-zx81-using-high-resolution-graphics</link>
  550.    <dc:creator>Steven Reid</dc:creator>
  551.    <pubDate>Sat, 30 Nov 2024 12:50:00 -0600</pubDate>
  552.     <category>ZX81 Computer</category>
  553.     <category>zx81</category>
  554.     <category>retro</category>
  555.     <category>monthly</category>
  556.     <category>mandelbrot</category>
  557.     <category>hi-res</category>
  558.     <category>graphics</category>
  559.    <guid>https://www.reids4fun.com/570/making-a-better-mandelbrot-set-on-the-zx81-using-high-resolution-graphics</guid>
  560.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/mbsarx-2024-zx81-pic01-screenshot-by-steven-reid-320x240.png&quot; alt=&quot;Mandelbrot Set in ARX HIRES, 2024 by Steven Reid&quot; style=&quot;float:left;margin-right:10px&quot;&gt;One thing I hadn’t done before on the ZX81 was hires graphics. There are numerous reasons, but in general it was because I hadn’t tried. That changed after being encouraged in my ZX81 group to use with with Mandelbrot Set program. &lt;a href="https://www.reids4fun.com/zx81/mbsarx/play" target="_blank" rel="noopener"&gt;So I did&lt;/a&gt;.&lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Coding ahead.&lt;/strong&gt;&lt;br&gt;
  561. &lt;br&gt;
  562. Okay, let’s talk with about that encouragement. Wayne was playing around with &lt;a href="http://www.swatosch.de/zx81/" target="_blank" rel="noopener"&gt; HRG-MS&lt;/a&gt; or High Resolution Graphics (HRG) for the ZX81. As the ZX81 doesn’t have native HIRES graphics, you need a graphics capable RAM pack for this to work. Now, in doing so, he also made sure to tag me in a comment:&lt;br&gt;
  563. &lt;br&gt;
  564. &lt;img src="https://www.reids4fun.com/images/uploads/wayne-zx81-comment.png" alt="[Image]"&gt;&lt;br&gt;
  565. &lt;br&gt;
  566. His idea was for me to convert my Mandelbrot Set program into hires. After noting that I hadn’t programed in HRG before, Wyane prodded me further. Sometimes you need a push. After some pondering, I decided “why not?” and promptly got to coding.&lt;br&gt;
  567. &lt;br&gt;
  568. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Starting down a path, but not the one intended.&lt;/strong&gt;&lt;br&gt;
  569. &lt;br&gt;
  570. Now part of the reason I hadn’t used HRG before was because you need a driver for it. As noted, the ZX81 doesn’t do HRG natively. The display routine built into the machine is designed for static characters in a 32x24 grid. Given there is no dedicated display chip like many other computers, this results in the CPU spending a lot of time printing the display.&lt;br&gt;
  571. &lt;br&gt;
  572. Now, there are a few tricks to get this to work. When you run in &lt;code&gt;FAST&lt;/code&gt; mode, that display routine is turned off. When that happens, you could use your own display routine and quite a few folks have done just that. Some use what is called pseudo-hires where the display routine uses existing blocks in memory to display more granular patterns. This works, but often leaves artifacts.&lt;br&gt;
  573. &lt;br&gt;
  574. HRG-MS, as noted above, uses a different approach by using a hardware approach. Although I like this approach, the drivers are often designed to be loaded first. You do this by adjusting RAMTOP, loading in the code for HRG, then loading your BASIC or other program. This works great, but I wanted a self-contained program.&lt;br&gt;
  575. &lt;br&gt;
  576. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Heading to the left.&lt;/strong&gt;&lt;br&gt;
  577. &lt;br&gt;
  578. Doing some searching, &lt;a href="https://www.sinclairzxworld.com/viewtopic.php?t=5448" target="_blank" rel="noopener"&gt;I ran across another this article&lt;/a&gt; for using ARX to do high resolution graphics on the ZX81. Originally designed by Andy Rea in 2006, hires graphics are displayed using user defined graphics (UDG) memory. Like other HRG routines, it does require some RAM mapping.&lt;br&gt;
  579. &lt;br&gt;
  580. Now the reason for ARX was because Paul Farrow provided a modified display driver that I could easily include into my program. Before I could do anything with my Mandelbrot program, I needed to understand how to use it. To do that, I took a look at Paul’s demo code which was similar to how I write code for the ZX81. To test it out, I shoe horned the code into one of my templates. This gave me an opportunity to understand how to use ARX while also making sure it compiled correctly.&lt;br&gt;
  581. &lt;br&gt;
  582. The last step was to ensure the code worked in my emulators. EightOne was pretty straight forward, which was good as I use that emulator for all my pictures. ZXSP worked after testing a few different RAM packs. The last, and arguable the most important, was to get it work in JSZeddy.&lt;br&gt;
  583. &lt;br&gt;
  584. JSZeddy does support ARX. I was able to get the program to run great in the emulator on the site, but it required the user to change graphics modes. I didn’t want the user to have to do anything, so I started to hack the javascript to see if I could force it. Then, after reading the manual, I realized ARX would load by default if the file had ARX in the name. After a quick check, I had the demo program running perfectly. I was now ready to do some coding.&lt;br&gt;
  585. &lt;br&gt;
  586. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Making a hires Mandelbrot Set.&lt;/strong&gt;&lt;br&gt;
  587. &lt;br&gt;
  588. Fortunately, &lt;a href="https://www.reids4fun.com/zx81/mbsarx/asm" target="_blank" rel="noopener"&gt;converting MBS would be straightforward&lt;/a&gt;. The program was already modular given the three different versions I had written. I started by adding in the initialization code and including the plot routine from the demo program. After a recompile, I had the program running.&lt;br&gt;
  589. &lt;br&gt;
  590. There was, however, a minor issue. The Mandelbrot Set was tiny! This required me to adjust the scaling factors in my program. Although the math is faster in assembly, it is still pretty slow. Fortunately, I could run the emulator faster making testing a little easier. With the scale done, I had my first image an it looked great.&lt;br&gt;
  591. &lt;br&gt;
  592. &lt;div class="text-center"&gt;&lt;img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/mbsarx-2024-zx81-pic01-screenshot-by-steven-reid-320x240.png" alt="Mandelbrot Set in ARX HIRES, 2024 by Steven Reid"&gt;Mandelbrot Set in ARX HIRES, 2024 by Steven Reid&lt;/div&gt;
  593. &lt;br&gt;
  594. &lt;br&gt;
  595. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; The Plot Routine&lt;/strong&gt;&lt;br&gt;
  596. &lt;br&gt;
  597. Although the plot routine worked great, I did have one challenge. My code also un-plotted pixels. This required me to read up a bit on how the ARX routine was painted in memory and then how the plot routine worked.&lt;br&gt;
  598. &lt;br&gt;
  599. I won’t go through all the details as you can review them in the code. But the gist is that the routine has to compute the pixel location based on a column and row format. The plot routine computes the location which is held in HL. The pixel location is stored in register B and the bit is then shifted into location in register A.&lt;br&gt;
  600. &lt;br&gt;
  601. At this point, we know what pixel to set or unset. The exiting plot routine takes the pixel in register A and combines it with the exiting pixels at memory local HL. This is done withe following code:&lt;br&gt;
  602. &lt;br&gt;
  603. &lt;pre&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;plot_pixel&#58;
  604. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;or&#160;&#40;hl&#41;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Combine&#160;the&#160;pixel&#160;with&#160;the&#160;current&#160;display&#160;file&#160;location&#160;byte.
  605. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;&#40;hl&#41;,a&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Write&#160;the&#160;new&#160;pixel&#160;pattern&#160;back&#160;into&#160;the&#160;display&#160;file.
  606. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ret
  607. &#160;&#160;&#160;&lt;/pre&gt;&lt;br&gt;
  608. &lt;br&gt;
  609. To remove a pixel, I needed to do a little bitwise math. To erase a pixel, I had to figure out how to invert only the specific bit corresponding to the pixel, leaving the rest untouched. This required a combination of XOR to flip the bit and AND to mask it out. The final code looks like this:&lt;br&gt;
  610. &lt;br&gt;
  611. &lt;pre&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;unplot_pixel&#58;
  612. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;b,255
  613. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;xor&#160;b&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Convert&#160;to&#160;a&#160;mask&#160;to&#160;remove&#160;a&#160;pixel
  614. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;and&#160;&#40;hl&#41;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;And&#160;the&#160;mask&#160;with&#160;the&#160;current&#160;display&#160;file&#160;location&#160;byte.
  615. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ld&#160;&#40;hl&#41;,a&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;Write&#160;the&#160;new&#160;pixel&#160;pattern&#160;back&#160;into&#160;the&#160;display&#160;file.
  616. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ret&lt;/pre&gt;&lt;br&gt;
  617. &lt;br&gt;
  618. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; A fun exercise.&lt;/strong&gt;&lt;br&gt;
  619. &lt;br&gt;
  620. Thanks to Wayne, I now had a much more interesting version of my Mandelbrot Set program. It was a fun experiment that wasn’t as hard I thought it would be. The ZX81 is still slow for this kind of stuff, but it works. &lt;br&gt;
  621. &lt;br&gt;
  622. &lt;div class="text-center"&gt;&lt;img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/mbsarx-2024-zx81-pic02-screenshot-by-steven-reid-320x240.png" alt="Mandelbrot Set in ARX HIRES, 2024 by Steven Reid"&gt;Mandelbrot Set in ARX HIRES, 2024 by Steven Reid&lt;/div&gt;
  623. &lt;br&gt;
  624. &lt;br&gt;
  625. Now that I have working routine, it would be fun to find new ways to use it. I’ve had a few ideas of creating a graphic adventure game. I’d need to add in line and circle routines, but shouldn’t be too hard. I had thought of doing this with regular graphics, but HRG would allow more details.&lt;br&gt;
  626. &lt;br&gt;
  627. &lt;div class="text-center"&gt;&lt;img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/mbsarx-2024-zx81-pic03-screenshot-by-steven-reid-320x240.png" alt="Mandelbrot Set in ARX HIRES, 2024 by Steven Reid"&gt;Mandelbrot Set in ARX HIRES, 2024 by Steven Reid&lt;/div&gt;
  628. &lt;br&gt;
  629. &lt;br&gt;
  630. More interesting would be to add in pattern fill. This would allow more interesting visuals given the higher resolution. Adding to the challenge, I haven’t done a fill routine yet. Together I could envision a decent little graphics engine. The challenge is writing a program around it. The one thing I haven’t figure out yet is adding in text. That might require another routine.&lt;br&gt;
  631. &lt;br&gt;
  632. &lt;div class="text-center"&gt;&lt;img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/mbsarx-2024-zx81-pic04-screenshot-by-steven-reid-320x240.png" alt="Mandelbrot Set in ARX HIRES, 2024 by Steven Reid"&gt;Mandelbrot Set in ARX HIRES, 2024 by Steven Reid&lt;/div&gt;
  633. &lt;br&gt;
  634. &lt;br&gt;
  635. Sticking with the current, I’m happy to have a better looking Mandelbrot Set on the ZX81 and a better understanding of how high resolution works on the ZX81. Thanks, Wayne.&lt;br&gt;
  636. &lt;br&gt;
  637. &lt;div class="text-center"&gt;&lt;img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/mbsarx-2024-zx81-pic05-screenshot-by-steven-reid-320x240.png" alt="Mandelbrot Set in ARX HIRES, 2024 by Steven Reid"&gt;Mandelbrot Set in ARX HIRES, 2024 by Steven Reid&lt;/div&gt;</description>
  638. </item>
  639.  <item>
  640.    <title>Print Like a Pro on the ZX81 with This Updated Smooth Scroll Routine</title>
  641.    <link>https://www.reids4fun.com/569/print-like-a-pro-on-the-zx81-with-this-updated-smooth-scroll-routine</link>
  642.    <dc:creator>Steven Reid</dc:creator>
  643.    <pubDate>Sun, 27 Oct 2024 19:41:00 -0600</pubDate>
  644.     <category>ZX81 Computer</category>
  645.     <category>zx81</category>
  646.     <category>monthly</category>
  647.     <category>retro</category>
  648.     <category>print</category>
  649.     <category>scroll</category>
  650.    <guid>https://www.reids4fun.com/569/print-like-a-pro-on-the-zx81-with-this-updated-smooth-scroll-routine</guid>
  651.    <description>&lt;img src=&quot;https://www.reids4fun.com/images/zx81/prtscrl2-2024-zx81-screenshot-by-steven-reid-320x240.png&quot; alt=&quot;Print Scroll 2, ZX81 Screenshot, 2024 by Steven Reid&quot; style=&quot;float:left;margin-right:10px&quot;&gt;After wrapping up the last print scroll routine, I immediately dove into improving it. While functional, the original version felt a bit limited. With this update, you’ll find &lt;a href="https://www.reids4fun.com/zx81/prtscrl2/play" target="_blank" rel="noopener"&gt;more flexibility in printing displays&lt;/a&gt;, though at a slight cost to speed.&lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Let’s dive into the enhancements.&lt;/strong&gt;&lt;br&gt;
  652. &lt;br&gt;
  653. The biggest drawback of the previous version was how purpose-built it was, assuming continuous printing. While flexible in what it could print, it wasn’t ideal for general use. This update makes it operate more like the familiar &lt;code&gt;PRINT&lt;/code&gt; command on other computers, giving you a lot more options.&lt;br&gt;
  654. &lt;br&gt;
  655. In this version, printing will automatically move to a new line unless you end with a semicolon, mimicking the ZX81’s &lt;code&gt;PRINT&lt;/code&gt; behavior. This makes it easy to mix into existing code. Unlike before, it will also autoscroll; if you fill the last line, the display scrolls up for a smoother experience.&lt;br&gt;
  656. &lt;br&gt;
  657. Another improvement is that you can now use a semicolon to concatenate multiple statements, just as with the usual &lt;code&gt;PRINT&lt;/code&gt; command. Previously, concatenation required a plus symbol. Now, you can print with the flow and convenience of standard syntax.&lt;br&gt;
  658. &lt;br&gt;
  659. &lt;div class="text-center"&gt;&lt;img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/prtscrl2-2024-zx81-screenshot-by-steven-reid-320x240.png" alt="Print Scroll 2, ZX81 Screenshot, 2024 by Steven Reid"&gt;Print Scroll 2, ZX81 Screenshot, 2024 by Steven Reid&lt;/div&gt;
  660. &lt;br&gt;
  661. &lt;br&gt;
  662. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Limitations and Caveats&lt;/strong&gt;&lt;br&gt;
  663. &lt;br&gt;
  664. While more flexible, there are still a few limitations. As before, &lt;code&gt;TAB&lt;/code&gt; or &lt;code&gt;AT&lt;/code&gt; functions aren’t supported. Technically, you can mix in regular &lt;code&gt;PRINT&lt;/code&gt; statements as long as you don’t need them to scroll. For instance, you can use &lt;kbd&gt;PRINT AT&lt;/kbd&gt; to move the cursor, then call the print scroll routine.&lt;br&gt;
  665. &lt;br&gt;
  666. Additionally, while you can use commas, they won’t print spaces. You could use a comma as a substitute for a semicolon, but note that the routine doesn’t print numbers by itself; you’ll need to use &lt;code&gt;STR$&lt;/code&gt; to convert numbers if needed. If you rely on this behavior, you’ll need to stick with the standard &lt;code&gt;PRINT&lt;/code&gt; command and its quirks.&lt;br&gt;
  667. &lt;br&gt;
  668. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; A Quick Test Program&lt;/strong&gt;&lt;br&gt;
  669. &lt;br&gt;
  670. To troubleshoot, I created a small test program to confirm things were working. It doesn’t explore every possible use, so if you’re adventurous, you can tweak it to try different options. Here are a few examples to get you started:&lt;br&gt;
  671. &lt;br&gt;
  672. &lt;pre&gt;PRINT&#160;USR&#160;16514&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;scrolls
  673. PRINT&#160;USR&#160;16514;&amp;quot;HI&amp;quot;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;prints&#160;HI&#160;+&#160;newline
  674. PRINT&#160;USR&#160;16514;&amp;quot;HI&#160;&amp;quot;;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;prints&#160;HI
  675. PRINT&#160;USR&#160;16514;&amp;quot;$&amp;quot;;A$&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;;&#160;prints&#160;$&#160;+&#160;A$&#160;+&#160;newline
  676. PRINT&#160;USR&#160;16514;&amp;quot;$&amp;quot;;A$;&amp;quot;&#160;&amp;quot;;&#160;&#160;&#160;;&#160;prints&#160;$&#160;+&#160;A$&lt;/pre&gt;&lt;br&gt;
  677. &lt;br&gt;
  678. I tried to replicate the &lt;code&gt;PRINT&lt;/code&gt; command’s behavior as closely as possible. So, the routine no longer scrolls unless a character forces it to. For instance, if you print with a semicolon and are on the last character, it won’t scroll, but printing without a semicolon will. To test this, modify the demo program and remove the semicolon on line 30.&lt;br&gt;
  679. &lt;br&gt;
  680. &lt;div class="text-center"&gt;&lt;img style="display: block; margin-left: auto; margin-right: auto" src="https://www.reids4fun.com/images/zx81/prtscrl2-2024-zx81-listing-screenshot-by-steven-reid-320x240.png" alt="Print Scroll 2, ZX81 Listing Screenshot, 2024 by Steven Reid"&gt;Print Scroll 2, ZX81 Listing Screenshot, 2024 by Steven Reid&lt;/div&gt;
  681. &lt;br&gt;
  682. &lt;br&gt;
  683. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; Sprinkling in Some New Code&lt;/strong&gt;&lt;br&gt;
  684. &lt;br&gt;
  685. With the added functionality, &lt;a href="https://www.reids4fun.com/zx81/prtscrl2/asm" target="_blank" rel="noopener"&gt;the routine is a bit longer&lt;/a&gt;. While it works similarly to before, a few extra checks were needed. For example, checking for the trailing semicolon at the end of the routine now requires determining if we’re on the last line.&lt;br&gt;
  686. &lt;br&gt;
  687. To accomplish this, I use the &lt;code&gt;S_POSN&lt;/code&gt; address, which tracks the cursor’s screen position. If already at line 4—the last printable line—the routine will scroll; otherwise, it adds a return. To prevent newline interference, I use a ROM routine for tidy handling.&lt;br&gt;
  688. &lt;br&gt;
  689. To preserve cursor position, I’ve slightly modified the scroll routine. First, I reordered it to check for a scroll line before printing each character. Then, I set &lt;code&gt;S_POSN&lt;/code&gt; to correct values after scrolling, ensuring end-of-line checks behave as expected.&lt;br&gt;
  690. &lt;br&gt;
  691. &lt;strong&gt;&lt;span style="color:gray;font-size:1.2em"&gt;#&lt;/span&gt; More to Do?&lt;/strong&gt;&lt;br&gt;
  692. &lt;br&gt;
  693. This updated print scroll works significantly better than the first version, providing a consistent experience similar to BASIC’s &lt;code&gt;PRINT&lt;/code&gt; command. There’s still room for improvement, though. The comma behavior, for instance, could be more flexible.&lt;br&gt;
  694. &lt;br&gt;
  695. Default comma behavior is mostly unhelpful, but a version that inserts eight spaces, mimicking a tab, could be a nice enhancement. Better still, a customizable tab option could open up new possibilities for text-based programs.&lt;br&gt;
  696. &lt;br&gt;
  697. Ultimately, I wonder how useful others might find this routine. It’s relatively easy to work around scrolling behavior, and a machine-language routine could achieve even more. Still, I had fun experimenting with print scroll in a few BASIC programs. You can easily adapt the demo program for your own projects, and I’d love to see what others come up with!</description>
  698. </item>
  699.    </channel>
  700. </rss>

If you would like to create a banner that links to this page (i.e. this validation result), do the following:

  1. Download the "valid RSS" banner.

  2. Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)

  3. 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

Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda