Application Note
Appendix H — CPU05 and CPU08 Search Code
AN1218 Rev. 2
49
Appendix H — CPU05 and CPU08 Search Code
************************************************************
*
* File : BRANCHX.ASM
* Description :
* This code shows an example of using branch
* algorithms to search for a number in a
* table. The code will search for $FF in
* a table. This would signify that in a
* table of A/D values, an A/D reading
* was saturated.
* Notes: Comments to the right of some instructions
* give numbers.
* CPU05 - 1st # is CPU05 cycle count
* 2nd # is instruction byte count
* CPU08 - 1st # is CPU08 cycle count
* 2nd # is instruction byte count
* Please consult the CPU08 Reference Manual
* for further details on these instructions
* Code is written for educational
* purposes only
*
************************************************************
TABLE EQU $400 ; starting address of the
; A/D table
ORG $50
TBL_LEN RMB 1 ; memory value containing
; the number of values in
; a the A/D table
ORG $200
***** Search for $FF (saturation) in a table of A/D values
* TBL_LEN is predefined at $08 for this example
* Therefore the table is defined from $400 to $407
* The values given for the total # of cycles and bytes
* reflect an absolute count with no looping involved
* An accurate account of the cycle count would involve
* the table length and whether or not a comparison
* was made.
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.