September 19, 2026

Instruction Set I made when I was half sleep

So I was kinda hopped up on reading about vintage computer nonsense, specifically the Manchester Baby and it's CRT memory display, but I was also VERY tired. Like, I stayed up too late by accident tired. Like, I logged off of a debugging call because my body was hurting because I stayed up too late, TWO HOURS before actually going to bed tired. My brain is addicted to the sweet silent embrace of the moon, and so I thrive (mentally) at this time of day. Unfortunately, as an adult human with daytime responsibilites, that has lead to a situation where I waken at 11 AM and go to bed between 3AM and sunrise. It's not a good habit, BUT... pushing the limits of what is considered a "reasonable bedtime" has yeilded some interesting creative results. But Yudo, you say responsibly, depriving yourself of sleep is not a good thing! What positives could arise from torturing yourself like this? And I, dear reader, thank you for your concern, but the liminal space between wake and sleep is itself an orchard that is RIPE with ideas. Being the sinner I am, my phone's notes app are littered with their cores. Many of them are... not really for public consumption, BUT I thought that it was really funny that I was able to make a turing complete instruction set while not fully concious.

The CPU has Two Registers
  PC - Program Counter. Idk how big it is. Never defined it..
  A - General use single byte register

Yup. It has one general use register.

I clocked out when the thing was turing complete, but when I woke up and looked it over, I realized that this set kinda sucks and isn't really complete. So i've made two tables, one containing the one I made last night, and the other with some additions I made today.

Instruction What it does
Plus memloc Adds 1 to a byte at address memloc.
Minus memloc Subtracts 1 from a byte at address memloc.
Setmem memloc, val Changes the byte at address memloc to val.
SetAmem memloc Copies the byte at address memloc into Register A
SetAval val Stores a byte val into the A register.
Goto memloc Send program counter and program execution to the address memloc. basically JMP on other procesors.
JAZ memloc Jump to address memloc if A==0. Continue execution here otherwise.

Day-After Addtions
I was thinking "damn it would be a little irritating to write subroutines without some sort of return function". So, I sat my black ass down and thought about how I'd implament that. The process I came up with is pretty simple. You have ten empty bytes somewhere in memory. The first byte holds the address of the top of the stack, the following eight bytes are the stack, and the final byte is zero. This way, when we run a "GOTO", the chip will jump to the stack address, then walk from the first byte accross the list until it encounters zero, write the original PC value there, update the first byte to the last entry in the stack, and then return to execution. When we run a "RETURN" the opposite would happen: We go to the first byte, jump to the top of the stack as defined in that first byte, set that as the program counter, set that final byte equal to zero, decriment the top of the stack, and return to execution. It's a little sloppy, and I can see the holes in this logic as I'm writing this, but thats how I have it set up. And if we're storing addresses as single bytes, that means that this CPU is realistically only hitting 256 bytes of RAM at a time. You know what this means! That's right. I'm adding banking!.
  JS - the first byte in the 10 byte stack system. This is holds the address at the top of the stack. Sits at address 240, and the succeeding bytes are after it.
  B - holds the current memory bank. The bank is 240 bytes, with the last 16 bytes of memory NOT being banked. This way we can store the register, program counter, and stack in a stable place. nevermind.

Instruction What it does
Outm memloc Send byte in memloc to a character output.
OutA Send byte in register A to character output.
InA Retrive byte from character input and store it in register A.
PlusA Incrament byte stored in register A.
MinusA Decrement byte stored in register A.
Gosub memloc Stores the current PC at the top of the stack. and then jumps to memory address memloc.
return See the blurb about the stack system.
GotoA Kind of a last minute addon, but I was thinking this gosub return stuff is cool but also kind of annoying to conseceptualize. I need something lower level, so the user could implament a stack if they want to in the way that they want to. I'm not your dad. You do you, ya feel me? What if we just let the user jump to a location in a register. This treats the value in register A as a memory address, and we set the program counter to it. No questions asked.
GotoM memloc Similar to previous, treats the value at address as an address and jumps to it.
ShiftleftA; and ShiftrightA; Meant to make this last night actually but I fell asleep. This is just shifting the the register left and right. if A = 10011000, RotleftA would make A = 00110001.
halt I can't believe i forgot to add this. I'm worthless.

Closing
There's also supposed to be a binary CRT monitor portion to this, where the RAM is visible on a CRT screen. Not sure how this was going to work, other than youc an see the program running and calculating things in real time. Each bit would be a chunky pixel on the screen. Probably a subset of the computer's ram would actually be visible. Mostly for aesthetics. Could try to implament this instruction set on my TRS 80 Model 4 or on a different computer with a CRT to see how it would look. Then, we could use the serial port to interface with a terminal.

This is a very silly project but hell maybe one day I'll make an emulator + some goofy programs for it.

home