Hardware Reference
In-Depth Information
the user-supplied code may occupy all of the on-chip flash memory except the address range
from $F000 to $FFFF in the fixed flash memory page that begins at $C000. To begin execution
of the user's application program, both the PAD0 and PAD1 pins must have jumpers placed in
the 0, or off, position. This will cause the bootloader startup code to jump to the address in the
alternate reset vector at $EFFE. When the user code is programmed into flash, an address must
be placed in the reset vector position ($EFFE) of the alternate interrupt vector table.
3.7 Tips for Assembly Program Debugging
Assembly program errors can be classified into two categories:
Syntax errors
Logical errors
3.7.1 Syntax Errors
Syntax errors are common for beginners. Syntax errors can be divided into following
categories:
Misspelling of instruction mnemonics. This type of error will be highlighted by the
assembler and can be fixed easily.
Starting the assembly program from column 1. If a line of the assembly program
has a label, then this does not cause any error. However, if a line of the assembly
program does not have a label, then the instruction mnemonic is treated as a label
by the assembler, whereas the operand (represented in one of the addressing modes)
is treated as the instruction mnemonics. This will always cause the undefined
mnemonic error!
Missing operands. Depending on what is missing, the error message will vary. For
example, for the instruction
brclr PORTA,$04
the resultant error message is “Missing target address.” For the instruction
ldaa
the assembler outputs the message “Inherent addressing illegal.”
As time goes on and you gain experience and also memorize the instruction mnemonics
better, this type of error will reduce and even disappear.
3.7.2 Logical Errors
Beginners make many logical errors. The most common ones are as follows:
U SING E XTENDED ( OR D IRECT ) M ODE INSTEAD OF I MMEDIATE M ODE
This error is very common for beginners. The following assembly program is written to
compute the sum of an array of N 8-bit elements:
N
equ
20
; array count
org
$1000
array
dc.b
2,4,6,8,10,12,14,16,18,20
dc.b
22,24,26,28,30,32,34,36,38,40
sum
ds.w
1
org
$1500
 
Search WWH ::




Custom Search