December 2, 2018
The Motorola MC6809 -- registers
Every microprocessor has a small collection of things called "registers".
These can be viewed as tiny bits of high speed memory, but they are more
than that. They are the heart of the microprocessor itself.
Undestanding the registers and how to use them is pretty much the crux
of assembly language programming, and is certainly a good starting point.
Here is a quick introduction to the registers in the MC6809.
- A - the 8 bit "accumulator"
- B - another 8 bit "accumulator"
- D - this is A and B taken together as a 16 bit register
- X - a 16 bit "index register"
- Y - another 16 bit "index register"
- U (or USP) - the 16 bit user stack pointer
- S (or SSP) - the 16 bit system stack pointer
- DP - the 8 bit "direct page pointer"
- PC - the 16 bit program counter
- CC - 8 condition code (and interrupt mask) bits
And there you have it! A birds eye view of the MC6809 as seen by the programmer.
If you are new to assembly language programming, this won't make a lot of sense
right now. You need to understand addressing modes, as well as having a general
idea of how some of the instructions work before this will come into focus.
That is in fact the nature of learning how a processor works. You have to
understand many things to get the whole picture, but this is a good place to
start, so this is where we are starting.
The MC6809 can address 64K of memory (it has 16 address bits).
In a typical system, some of this will be ROM, some will be RAM, and other
parts will be IO devices. It is fairly unusual for the entire 64K address
space to be populated, so some addresses will yield nothing at all.
When the MC6809 addresses memory, it reads or writes 8 bits at a time.
It provides a 16 bit address to specify what part of memory is being read
or written. The processor has a variety of ways to specify these 16
address bits, and that is the subject of the next section.