Close

Undefined opcodes

A project log for Gigatron TTL microcomputer

Just because! A home computer without microprocessor

marcel-van-kervinckMarcel van Kervinck 05/29/2017 at 04:540 Comments

From the assembler/disassembler it is easy to generate a complete instruction table. Most opcodes result in a valid instruction. Only memory writes while RAM is on the bus result in an undefined value ($??) being stored.

I found out I had some undefined instructions that are actually very useful. They store a value in memory as well as in X or Y. Their existence is entirely accidental: Unlike AC and OUT, the X and Y registers are not "muted" when we are writing to memory. The purpose of muting is solely to reuse all addressing modes in store instructions, but without destroying the contents of AC or OUT. As X and Y don't have addressing modes that AC and OUT already have as well, I didn't bother to give them an OR-gate that suppresses the enable signal to them ("you don't need these modes").

This omission turns out to be quite useful! Because X and Y are essentially "write-only" registers, each time you use them and you're not sure of their value you have to reload them. Now you can first do a computation, in AC, and then move the result both to X/Y and also back to memory. Both value transfers happen in the same clock cycle. With that, you can easily keep track of what is supposed to be in X/Y in the zero page. I suppose this will be used a lot. I already use it in the video loop.

Now they are no longer undefined. They are part of the family.

Discussions