
Application Note
AN1218 Rev. 2
36
*********************************
* HC05 code *
* CPU05 has to address the table in a section-like
* fashion. Section 0 is between $400 and $4FF.
* Section 1 is between $500 and $5FF.
* The 16-bit address is stored in RAM location TBL_A.
* This is the offset to the table starting
* at $400, TBL_ST0.
* Example: Address is $520 = $400 + $120
* TBL_A = $01
* TBL_A+1 = $20
START LDX TBL_A+1 ;3,2 X
←
(TBL_A+1)
LDA TBL_A ;3,2 A
←
(TBL_A)
BEQ TBL0 ;3,2 branch to section 0 if 0
LDA TBL_ST1,X ;5,3 A
←
(X+TBL_ST1)
BRA NEXT ;3,2 branch when done to
; the CPU08 example
TBL0 LDA TBL_ST0,X ;5,3 A
←
(X+TBL_ST0)
* Total # CPU05 cycles = 17 (max)
* Total # bytes = 11 (max)
*********************************
*********************************
* HC08 code *
* CPU08 has full 16-bit indexed addressing so the
* table address is loaded from TBL_A in RAM. No
* memory table sectioning is needed.
NEXT LDHX TBL_A ;4,2 H:X
←
(TBL_A)
LDA TBL_ST0,X ;4,3 A
←
(X+TBL_ST0)
* Total # CPU08 cycles = 8
* Total # bytes = 5
*********************************
DONE NOP
BRA DONE
***** Initialize the reset vector
ORG $FFFE
DW START
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.