Disculpa mi ignorancia, no se qué es el código fuente
sin embargo, revisando algunos modos de direccionamiento, probe a crear el código mencionado con ese modo, he aquí mi resultado:
;*******************************************************************
;* This stationery serves as the framework for a user application. *
;* For a more comprehensive program that demonstrates the more *
;* advanced functionality of this processor, please see the *
;* demonstration applications, located in the examples *
;* subdirectory of the "Freescale CodeWarrior for HC08" program *
;* directory. *
;*******************************************************************
; Include derivative-specific definitions
INCLUDE 'derivative.inc'
;
; export symbols
;
XDEF _Startup
ABSENTRY _Startup
;
; variable/data section
;
ORG RAMStart ; Insert your data definition here
CNT RMB 2
;
; code section
;
ORG ROMStart
; Include device initialization code
INCLUDE 'MCUInit.inc'
_Startup:
LDHX #RAMEnd+1 ; initialize the stack pointer
TXS
; Call generated Device Initialization function
JSR MCU_init
mainLoop:
; Insert your code here
LDA SOPT1
AND #%01111111
STA SOPT1
LDA #%11111111
STA PTBDD
CLRA
STA CNT
LDA #%01010111
STA SRTISC
CLI
BRA mainLoop
SIRTI SEI
LDHX CNT
CPHX #9999
BEQ ET01
LDA #0,X
STA PTBD
INCX
STHX CNT
BRA ET02
ET01 LDA #0,X
STA PTBD
CLRX
CLRH
STHX CNT
ET02 LDA #%01010111
STA SRTISC
CLI
RTI
ORG Vrti
FDB SIrti
Ignorando casi toda la inicialización y solamente revisando a partir del mainloop, mi duda es si realmente funcionaria como deseo; que cuente de 0 a 9999?