Search the web
Sign In
New User? Sign Up
68HC12
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
CodeWarrior Conditional Assembly Problem   Message List  
Reply | Forward Message #15910 of 16521 |
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





Tue May 6, 2008 4:41 pm

sbuckser
Offline Offline
Send Email Send Email

Forward
Message #15910 of 16521 |
Expand Messages Author Sort by Date

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...
sbuckser
Offline Send Email
May 6, 2008
4:41 pm

Use just "IF VERSION_A==0" ... From: "sbuckser" <s.buckser@...> To: <68HC12@yahoogroups.com> Sent: Tuesday, May 06, 2008 11:41 AM Subject:...
Michael Huslig
mjhuslig
Offline Send Email
May 6, 2008
4:52 pm

The problem was my error and has been fixed. The IFEQ and ENDIF were placed to starting in the leftmost column of their text lines. Everything works when an...
sbuckser
Offline Send Email
May 6, 2008
9:30 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help