English
Language : 

MC68HC16Z1CPV16 Datasheet, PDF (475/500 Pages) Freescale Semiconductor, Inc – Symbols and Operators, CPU16 Register Mnemonics
Freescale Semiconductor, Inc.
E.2.2 CPU16 Programming Example
The following programming example involves using the CPU16 indexed and extended
addressing modes.
Refer to SECTION 4 CENTRAL PROCESSOR UNIT for more information on the
CPU16.
E.2.2.1 Example 5 - Indexed and Extended Addressing
*
Description : This program demonstrates indexed and extended
*
addressing.
*****************************************************************************
****
INCLUDE
'EQUATES.ASM'
;table of EQUates for common
register addresses
INCLUDE
'ORG00000.ASM'
;initialize reset vector
INCLUDE
'ORG00008.ASM'
;initialize interrupt vectors
ORG
$0200
;start program after interrupt vectors
***** Initialization Routines *****
ZK=0
COP
INCLUDE
INCLUDE
'INITSYS.ASM'
'INITRAM.ASM'
;initially set EK=F, XK=0, YK=0,
;set sys clock at 16.78MHz, disable
;initialize and turn on SRAM
;set stack (SK=#$1, SP=#$03FE)
***** Start of main program *****
OFFSET
GO:
LDAB
TBZK
LDZ
EQU
LDAB
TBEK
LDAA
STAA
LDAA
STAA
BRA
#$00
#$FFFE
$02
#$01
#$00
$0000
#$FF
OFFSET,Z
GO
;point ZK to bank 0
;set IZ=#$FFFE
;SET OFFSET = $02
;point EK to bank 1
;write 00 to $10000 (extended)
;write ff to $10000 (indexed)
***** Exceptions/Interrupts *****
BDM:
BGND
;exception vectors point here
;and put the user in background mode
M68HC16 Z SERIES
USER’S MANUAL
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
E-23