|   |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Home |
This page has not been adapted to SB-Assembler Version 3 yet.
The Motorola 68HC11 family of microcontrollers is a powerful addition to the 6805 family.
The most important enhancements are two 16-bit index registers with their associated addressing modes, EEPROM memory and power savings capabilities.
This processor is also equipped with a direct page addressing mode, like in most other Motorola processor families.
The programming model in the picture below shows the most important registers of the 68HC11 controller. I only include a little summary about the features of the 68HC11's programming model here. It is not my intention to make the original documentation obsolete, so please refer to the original documentation for further details.
The 68HC11 has a very powerful addressing mode called direct page addressing, which is also called zero page addressing. This way all 256 bytes of the first page in memory can be addressed with only 8 bits. These 256 addresses can be considered the "registers" of the 68HC11! The Accumulators A and B
The 68HC11 is equipped with two 8-bit accumulators.
Both Accumulators are technically the same and can both be used for a variety of arithmetic operations.
The Condition Code Register The CC register holds all the system flags. Most flags reflect the status of the machine after mathematical or logical instructions. Other flags are set or cleared under program control. The CC register contains 8 system flags:
IRQ interrupts are disabled when the I bit is set. The Index registers IX and IY
Both index registers can be used to indirectly point to data in memory.
The IX and IY registers are identical to each other.
The Stack Pointer SP The 68HC11 is equipped with a 16-bit stack pointer. This means that the stack can be placed anywhere in RAM memory. The stack grows down in memory when data is pushed on it. The stack pointer SP always points to the next free location on the stack. When a byte is pushed on the stack the data is stored in memory first, then the stack pointer is decremented. The LSB of a 16-bit register is saved first during a push instruction. Subroutine calls will save the address of the instruction following the JSR or BSR instruction on the stack. The RTS instruction simply pulls the PC from the stack, effectively continuing directly after the JSR or BSR instruction. Interrupts will push the PC on the stack and all processor registers. The order in which all data is pushed is shown below: PCL, PCH, IYL, IYH, IXL, IXH, A, B, CCR It goes without saying that the pull order is just the other way around! Please note that it is very strange that the Accu A is stacked prior to Accu B. Normal stacking occurs with LSB first, so I would expect that Accu B was stacked first being the LSB of Accu D. The Program Counter The program counter PC is normally incremented after fetching each instruction or operand byte during program execution. The only way you can change this behaviour is with the jump, subroutine and return instructions. Also interrupts can change the program counter's value.
The SB-Assembler 68HC11 cross overlay has only two reserved words. It is not very likely though that you will run into trouble if you use any of the reserved words as label names. But it is always better to be safe than sorry, so why use them when you have so many alternatives to choose from. The reserved words are: X, Y.
Indexed addressing modes The official notation of the indexed addressing mode is offset,X, where offset is an unsigned 8-bit constant value. Usually the offset value is $00 and that can be written in three different ways in the SB-Assembler:
LDAA $00,X
LDAA ,X
LDAA X
All three instructions have the same effect and all use an offset value of $00. Forced direct page and extended addressing modes
Direct page addressing mode is also called zero page addressing mode because it always uses the first 256 bytes of memory space.
The SB-Assembler automatically selects direct addressing mode when that mode is available and the high byte of the address is zero.
You may override this automatic selection of addressing mode by preceding the address field with a < or a > symbol.
Examples: 0010- LABEL .EQ $10 A direct page address 8000-96 10 LDAA LABEL Appears to be direct page 8002-96 11 LDAA <FORWARD Clearly a forward referenced label 8004-97 12 STAA $12 Is a direct page address 8006-B7 00 11 STAA >$11 Force extended addressing mode 0011- FORWARD .EQ $11 A direct page address Small difference in bit addressing notation The bit addressing notation on the SB-Assembler differs slightly from the original Motorola notation. This is because the SB-Assembler won't allow spaces in operand fields, while Motorola recommends them at that point.
All differences apply only to the bit mask operand.
With the Motorola assembler the bit mask (and the branch destination address) is preceded by a space character.
Examples:
BSET $12,%0001.1000 Almost the same as Motorola ;-)
BSET 0,X,#%0001.1000 The most obvious notation
BSET ,X,#%0001.1000 0 offset may also be like this
BSET X,#%0001.1000 or like this
BSET 0,X,%0001.1000 No immediate prefix here
Please note that the comma in front of all the bit masks would have been a space with the Motorola assembler. Extra instructions
I have added some mnemonics to the 68HC11 cross assembler, all concerning Accu D operations.
Normally the assembler isn't supposed to understand these instructions, but I have added them here for your convenience.
If you don't like them, simply don't use them.
Accumulator D compound instructions
Apart from the table above you can also use the short instruction form LDA instead of LDAA, or STB instead of STAB, etc.
Two things are set while initializing the 68HC11 overlay every time it is loaded by the .CR directive.
There are some differences between the SB-Assembler and other assemblers for the 68HC11 processor. These differences require you to adapt existing source files before they can be assembled by the SB-Assembler. This is not too difficult though, and is the (small) price you have to pay for having a very universal cross assembler.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||