Full disclosure: [Óscar] isn’t nine now, but he was in 1988 when he wrote LOCS, a drawing program in Z80 assembly modeled after Logo. You can see a demo of the system in the video below. You might wonder why you’d want to study a three-decade-old program written for a CPU by a nine-year-old almost five decades ago. Well, honestly, we aren’t sure either. But it did get us thinking.
Kids today are computer savvy and have hardware that would seem to be alien tech in 1988. How many of them could duplicate this feat? Now, how many could do it in assembly language?
LOCS had a few simple commands and was sort of a stripped-down scripting language. The BORRA command clears the screen. TORTUGA centers the turtle. PT (pone tortuga) moves the turtle to any spot on the screen. Then SM, AM, DM, and IM move the turtle up, down, right, and left. Probably helps if you speak a little Spanish.
The program fits on three pages of handwritten code. When was the last time you wrote code on paper? [Óscar] revisits the program to run it on an MSX. The original program was under 500 bytes but adding the code for MSX balloons it to 589 bytes. Gotta love assembly language.
You could argue that LOCS isn’t a language because it doesn’t have variables, expressions, or looping. [Óscar] retorts that HTML doesn’t have those things either, and yet some call it a language. Honestly, if a 9-year-old can create this, we think they can call it anything they want to!
By 1990, he’d graduated to full-blown games. If turtle graphics are too abstract for you, try a Big Trak.
Just a nit: what is on that paper is not assembly code. Assembly code is what you pass to an assembler to get machine code. What’s on that paper is machine code – the numbers that get passed across a data bus from program memory to the CPU. Now, it could be that he did write it in assembly on a separate piece of paper, but like I said, it’s not assembly. Just a nit.
I built my first computer starting with a Z-80A that I think cost me about $60, and 6kB of SRAM in the form of 48 Intel 2102 chips that were close to $1 each, along with a handful of TTL counters and gates. Of course, I did not have any software for it, and initially the programs I wrote for it had to be entered with toggle switches on a “front panel” that was as big as the rest of the computer. That panel could be plugged into the computer’s bus (through a 28 pin DIP socket on the computer board), and soon thereafter I built an EPROM programmer that the panel could also plug into, so that I could program each byte just as I would enter the program into the computer. The same switch that generated a write pulse on the computer’s bus generated the program pulse on the programmer.
But I didn’t have an assembler either, because what would I run that on? I would have to toggle the assembler in, same as any other program. What I ended up writing as soon as I had the EPROM programmer running, was a monitor, that read the keyboard ($30 from Radio Shack, and by “keyboard” I mean about 80 switches in one injection molded piece, no electronics at all, and a bag full of diodes to generate the codes that each switch produced), and allowed me to enter an address, which it would then display the current contents of that address, and then I could write a different value to store at that address. Output was on a 5″ monitor made from a portable TV I bought for the purpose (about $100), and all of the hardware went into a plastic file box and looked a bit like the Commodore SX-64. Or more accurately, the Commodore SX-64 looked a bit like my computer, since that came out several years later.
But I still didn’t have any programming language. I assembled everything by hand.
“By hand” evolved into a pretty streamlined process, where I used a steno pad with a wide margin, and wrote the assembly code to the right of the margin, complete with labels, opcodes, and operands. Most Z-80 instructions took one, two, or three bytes, but many that were extensions beyond the original 8080 instruction set required a prefix byte, which gets you to 4 bytes, and IIRC there were some instructions that could be 5 bytes, but I don’t recall why. Anyway, there was room in the margin to put the full code for any single instruction. These were coded in octal, because the structure of the 8080/Z-80 instruction set was in most cases in one of two formats: two-operand instructions with 2 bits of opcode, 3 bits of destination register, and 3 bits of source register, and single-operand instructions with 5 bits of opcode and 3 bits of register. So in a short while I was able to memorize all of the opcodes and which registers were “special”. So even though I made a cheat sheet that I kept in front of me, I seldom had to refer to it. There just weren’t that many instructions. I see that Oscar assembled in hexadecimal, which probably means he was looking at his cheat sheet a lot more often, as the hex digits don’t correspond to simple meanings like the octal ones do.
But wait, there’s more: any instruction that needed a memory address, I would just draw underlines for the bytes for that address, since I didn’t know on the first pass what any of the addresses but the first would be. For relative branch instructions, these only took an 8-bit address offset, so these only got one underscore byte.
Then, once I was finished, I would count the addresses (in octal, of course), and put an address above the label. Then I would do the second pass, which just involved filling in the blanks left on the first pass. The tricky part was the relative branches, where I would count bytes forward or backward (starting at 400 when counting backward, which would give me the proper 2’s complement value for negative offsets, which was a very common requirement for loops).
Eventually I bought a computer that had a lot more memory, and bought an editor & assembler for it, but those months of hand assembling made it a breeze for me to write an assembler for the 8048 years later, for my first project with an embedded microcontroller.
No, I wasn’t nine when I did all of this, I was more like 20, but I did it with almost no formal training in digital electronics, computers, or software, and as you can see, I’m still quite proud of bootstrapping myself this way. Which might explain why Oscar still keeps his work from when he was nine. Bravo, Oscar!
Thank you for taking the time to share.
Wonderful story, but I suspect your memory of back then is slightly faulty. No Z80 opcode takes 5 bytes. Even the currently documented “undocumented” opcodes are 4 bytes or shorter. Now, with that said, it’s rather trivial to write a program where a function expects its parameters to immediately follow the call. Just pop the return address, grab the parameters pointed to by that address and finally push a new return address just past the parameters. Saves a bit of code and creates headaches for anyone disassembling the program in the future. But those headaches exist already via common tricks to save a byte or two here and there. How many people have seen code like this when examining a disassembly?
LD A,01H
LD DE,023EH
LD DE,033EH
LD DE,043EH
LD DE,083EH
or
OR 37H
Ah, memories…
As I recall, an assembler was available at the release of the Z80. From Wikipedia: “The first samples were returned from Mostek on 9 March 1976. By the end of the month, they had also completed an assembler-based development system.”
If [blank] created it, they can call it whatever they want…
No.
Absolutely not.
Words have meaning.
Using the wrong words to name something is at best confusing, and at worst, it’s fraudulent.
Either way it contributes to the corruption of whatever words got used, robbing them of their usefulness to covey ideas.
Change is inevitable.
But unchecked change is not a good thing for anyone.
Oh, the pointless ranting of old guys. Don’t ask me how I know. I mean, I agree with you, but you can’t stop newer generations from fouling things up, which is why living languages are so horrible. People today don’t know, for example, the differences between “transparent”, “translucent”, and “opaque”. And what the hell is “10 times less” supposed to mean? What can you do? Rant and Rave? Fat lot of good that does. The dictionaries get rewritten to reflect current usage, at the cost of utility and precision. The old meanings get noted as “archaic” or “obsolete”.
‘ And what the hell is “10 times less” supposed to mean? ‘
Obviously it’s -9 times the original amount.
It’s worse in places where English isn’t the first language, but people still insist on using it because access to information online is being dominated by English. Existing terminology is replaced with new ad-hoc pidgin made out of English words, which then gets replaced by contractions and abbreviations of the same. Any point of using foreign terminology is lost on the fact that the users are so bad at it, the words become unrecognizable and nearly incomprehensible.
So while you may complain about the finer points of “transparent” vs. “translucent”, imagine if people suddenly started saying “durchsichtig” instead, but not in a German accent.
durchfall…literal translation: falls through.
On topic: Adapting languages you barely understand is just ‘doing the needful’.
“Must a name mean something?”
“When *I* use a word… it means just what I choose it to mean – neither more nor less.”
Sure, but Alice was not convinced.
Well I’ve never heard that a “language” has to be Turing complete to be called a “language”. In the aforementioned HTML, for example, the L is literally for Language.
Definitely. A language is just a set of protocols for communicating. There’s nothing that says a computer language has to do anything other than that.
“a three-decade-old program written for a CPU by a nine-year-old almost five decades ago”
I’ve given it a lot of thought, and I think the intended clause was something like:
“a four-decade-old program written by a nine-year-old for a CPU from five decades ago”
Anyway, salute to Óscar; I’m the same age and in 1988 I was more at the 10 PRINT “BOOBS” / 20 GOTO 10 stage.
Made me lawl pretty hard
Laugh Awful Wretched Loud?
Back in the day we had far less distractions. Either crappie TV, hanging out with the local kids, or filling your time doing other things you enjoyed. Just so happened a computer was incredibly fascinating.
You don’t get to say “LOCS is a drawing program” then turn around and say “LOCS is a language.” I will fix it for you: LOCS is not a language.
So you are saying that the same name cannot be applied to both a language and a program that uses that language? Tell that to half the interpreter and compiler developers who have named their programs with the name of the language. And yes, LOCS is a protocol for facilitating the exchange of ideas between one entity and another; a language.
Kids today are not computer savvy. Far from it, they are more like fish who don’t notice water. The fish doesn’t really understand the water, but it can swim in it. We’re going to have a terrible batch of CS people in 20 years.
I hate to be the one who breaks this to you, but the embedded space is already there.
The same percentage of technically interested children exist now as they did back in the day. The only difference is that everyone else is using computers too. If you’re basing your opinion on “I know a kid now who uses a computer but he’s an idiot” then your logic has a bug in it.
In 1975 I was a sophomore Physics major, living at home. I had a “Digital Group” Z80 machine, the only one in my lower middle class Chicago neighborhood. Word got around, and a 6th grader approached me, and asked to use the computer for his science project. It was to do 1-bit sampling of speech, and 1-bit playback, at the fastest speed the (1 MHz?) Z80 could do. He was already familiar with op amps, and had no difficulty explaining to me what his interfaces and power supply needs would look like.
By that time, I had hand-written a couple of programs; a music interpreter/synthesizer and a meeting schedule display system. I had the mimeo’d sheets for writing the op codes, with a column for the hex values, and handed the 6th grader a stack of blank ones for his use.
Some years later, I bought a shortwave receiver kit, and spent a lovely weekend with my 4yo daughter and 7yo son, teaching them to solder, to read resistor codes, and to run coax through our home’s attic. They’re now in their mid-30s, both are fearless in attacking new projects, both have PhDs in the hard sciences, and both are successful in their careers.