HELLORLD 1802

Oct 28th, 2023

 

One of my favorite YouTube channels Usagi Electric recently uploaded a video asking for Hellorld programs. In the video, David asked for interesting “HELLORLD” programs, so here is my entry!

I decided that I would put one together on my trusty 1802 Membership Card Build as that would satisfy the requirements for being an interesting machine and in machine code. IN keeping with the COSMAC ELF tradition, I worked out the program by hand on paper and then toggled it in using the binary switches on the machine. This post will outline the process I used to generate the program by hand. I was succesful, as you can see in the animation at the top of this page!

When I write programs for my 1802, my weapon of choice is a clipboard, a piece of notebook paper, and my trusty reference card. I start by writing out the program in menmonics, and then I move on to writing out the machine code. If there are addressses to be computed, I write blanks where they will go. This first phase looks like this:

As you can see, this is largely a modification of the program that I wrote in my post about finishing my 1802 membership card. The main difference is that “HELLORLD” is too many characters for its 6 character display, so I added code to scroll this continuously.

Having the roughed-in code, I then counted the bytes for the program and filled in the blanks:

When I put this in, it almost worked. I had some odd artifacts and the display was going absolutely nuts! So, naturally, I had to revise the code. This is where paper coding gets a bit messy. Naturally, I had to revise, squeeze some things in with pencil marks, and some revisions I made directly on the machine. After this process was done, my code paper looked like this:

Even with my revisions, the scrolling was erratic and sometimes I was getting displays that were not characters at all. This seemed to indicate some sort of timing issue, and so I went through everything byte by byte to see where I had went wrong. While I was experimenting, I noticed the LEDs were dimming occasionally. It was then that I realized that the 3 AA batteries that power my trusty mobile blinkenlight machine were over a year old! I changed the batteries, and then everything worked as expected.

I then wrote down the finalized version of the program on another sheet of paper, and played with the numbers to produce the desired output at the desired scrolling rate. The final code is here:

This was a great program to work on, and I just love coding for the RCA 1802. When I was having problems, I briefly thought about writing the code in a text file, though I ultimately gave decided against this. For one thing, I don’t actually have an assembler for the processer. For the other, it just feels wrong. Coding for this machine should be done either in BASIC over the serial port or on paper!

Anyway, I hope you enjoyed this brief account of my HELLORLD programming experience. Be sure to check out Usagi Electric, and contribute your own program!

Computers   |   Home   |   Humor   |   Links

Visit me on Mastodon.