General RAMblings on Micro-processors

Ramblings directed at people working on the Geocaching puzzle GC7GK7F – Peculiar Processor.

Microprocessors are small computers, in general, with a few differences. They typically don’t run operating systems, but just one piece of software. If you want to change programs, you typically have to reprogram the microprocessor. Operating systems allow you to do many things at once – Microprocessors only do one thing at a time. This is usually a trade off between an entire computer costing hundreds of dollars vs a $9 microprocessor that monitors a piece of equipment or communicates with a remote site.

Typically Microprocessors have just a few parts – Memory, Registers, a Central processing unit and some ability to read and write to the device they are attached to. And they are also typically programmed in Assembly Language.


This is where the program might be stored. The processor will start at the first memory location, do whatever the the instruction there says, move to the next location, do what that says….and on and on and on. Of course each memory location is stored in binary. If the processor is a 8 bit processor, each memory location can store up to 256 values – 0 to 255. We often represent this memory location as two Hexadecimal digits. In Hexadecimal we count from 0-9 normally, but 10 is the letter A, 11 is the letter B…
0123456789ABCDEF with each letter being the entire contents of one 4 bit memory location. FF would be the number 255.

Memory can contain either CODE(instructions) or DATA. In our example, instructions are always 3 hex digits.


These are special memory locations that can be referenced in instructions. The instruction might say put a value in Register #1, put another value in Register #2, and then ADD the two registers together. Where that is in reality isn’t important – its a place the Processor knows to access when you say do something with a Register. Perhaps there are 8 registers in a typical Microprocessor and they would be numbered 0-7.

Central Processing Unit (CPU) or Arithmetic Logic Unit (ALU)

The CPU is the “Brains” of the Microprocessor. It will start with the first instruction, and keep reading and doing whatever its told! This requires a programmer familiar with the microprocessor to properly write a program of instructions for the CPU to follow.

Assembly Language

Assembly Language is how the Microprocessor gets its instructions. In our little example of a 8 bit processor, we can have a maximum of 256 different types of instructions for the CPU. Each instruction defines something the CPU must do. Each instruction may have one or two memory locations that follow to give further information – these are called Operands.

Instructions are always the command, and one or two operands. In the first Example, the First complete instruction, is “700” – the Command is 7 – the operands are either “00” which would be data, or 0, 0 – which would be two pieces of data. The context is based on the command. Although we could have 256 commands, commands in this case are always less than 16, so can reliably be considered only and always just the first hex digit.

As an Example – If a command with the number value “1” is STORE IN REGISTER #1, the processor needs to know WHAT Value to store – Lets say STORE IN REGISTER #1, the number 61 Decimal. 61 Decimal is 3D in hex, so the whole instruction might look like 1,3,D, and might be written 13D as the whole instruction with the operand. Again the command is always the first digit. What follows varies based on the command.

Command, Operand
Command, Operand, Operand

CPU Revisited

We have covered storing data in Registers.

However the CPU thinks entirely in binary. Instructions like ADD and SUBTRACT are of course available – Where two registers get added together and the result is stored in the first register. However in the binary world, you must also consider binary operations like AND and OR, which deal with the values of the individual bits of two registers to produce a new number. The result is stored in the first register.

INVERSE would produce a number where all the bits of the Register are opposite of the starting number. INCREMENT AND DECREMENT are fancy ways of saying add 1 to a register, or subtract 1.

BIT-WISE SHIFT LEFT and BIT-WISE SHIFT RIGHT are the equivalent of multiply by 2 and divide by 2…by shifting digits in the number left or right one place. We do exactly the same thing in the decimal system to multiply by 10 or divide by 10…we shift the decimal place one over.

Results are stored in the first register.


Talking with the outside world

In our case the output is to a series of 8 segment LEDS. 8 Segments – exactly the same number of bits in a register of our little device. Something that communicated with the LEDS would have to specify a register that contained a number – that would be WHICH LED position – the first LED? The Second? and then specify another Register that contains the binary value to copy to the LED. Then MOVE the data to the LED and the display lights up. You don’t have to figure out how the LED does that, but the relationship between the register bits and which segment of the LED lights up may be interesting.


Get started

The first 3 examples STORE values into two registers and then use those two registers to light up the LED board with a MOVE command. Use the binary to find the relationship between the LED segments and the bits in the binary and the values used for the STORE and MOVE commands.

Reverse the LEDS into Binary

After you understand how to light the LEDS (The first three examples) you will be comparing the LED binary to the Register binary to find out how new commands transform the registers.

As an Example, you will have a binary value before some unknown new command, and you should be able to look at the LED’s and write down what binary value would be used to make them light up like the example.

If the before is 11011010 and the LED’s are 11011011…What does the command do?

UNKNOWN COMMAND 11011010 – Result 11011011, hmm its either ADD 1 or INCREMENT.

Solving for Coordinates

The examples expose all of the commands and operands that the processor can handle. Once you have a full command set for the Microprocessor, work through the final program for the result. Use the Geochecker.

Leave a Reply

Your email address will not be published. Required fields are marked *



Proudly powered by WordPress   Premium Style Theme by