I am converting an 68HC11F1 program written in assembler to
MC9S12XEP100 using the free Code Warrior version 5.7.0. I want to use
conditional assembly to maintain HC11 and 9S12 code in same file.
I get many errors.
I then created a new assembler project and modified the default
assembler file main.asm as attached.
I defined line 30:
VERSION_A: EQU 0
and lines 48-50:
IFEQ VERSION_A
STD FiboRes ; store result
ENDIF
I get error A12202 not a hc12 instruction or directive.
I think the VERSION _A label and IFDEF and ENDIF directives are proper.
Why am I getting this error? What am I doing wrong?
Thanks,
Steve Buckser
The entire main.asm source file is copied below
;**************************************************************
;* 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 the HC12 Program directory *
;**************************************************************
VERSION_A: EQU 0 ; added code
; export symbols
XDEF Entry, main
XDEF VERSION_A
; we use export 'Entry' as symbol. This allows us to
; reference 'Entry' either in the linker .prm file
; or from C/C++ later on
XREF __SEG_END_SSTACK ; symbol defined by the linker
for the end of the stack
; include derivative specific macros
INCLUDE 'MC9S12XEP100.inc'
; variable/data section
MY_EXTENDED_RAM: SECTION
; Insert here your data definition.
Counter ds.w 1
FiboRes ds.w 1
; code section
MyCode: SECTION
main:
Entry:
LDS #__SEG_END_SSTACK ; initialize the stack pointer
CLI ; enable interrupts
EndlessLoop:
LDX #1 ; X contains counter
CouterLoop:
STX Counter ; update global.
BSR CalcFibo
IFDEF VERSION_A == 0 ; added code
STD FiboRes ; store result
ENDIF ; added code
LDX Counter
INX
CPX #24 ; larger values cause overflow.
BNE CouterLoop
BRA EndlessLoop ; restart.
; Function to calculate fibonacci numbers. Argument is in X.
CalcFibo:
LDY #$00 ; second last
LDD #$01 ; last
DBEQ X,FiboDone ; loop once more (if X was 1,
were done already)
FiboLoop:
LEAY D,Y ; overwrite second last with
new value
EXG D,Y ; exchange them -> order is
correct again
DBNE X,FiboLoop
FiboDone:
RTS ; result in D