ROB LUND

mixing C and assembly

Discussion created by ROB LUND on Oct 30, 2006
Latest reply on Oct 31, 2006 by bigmac
Working off of my previous thread, I'm in the process of integrating C and assembly. Referring to tech note TN 15 "Mixing Assembly and ANSCI C in an Application"

reference files:
* Freescale forums thread

* ftp3.metrowerks.com/pub/dropzone/Mixing_C_and_ASM.zip

Anyway, I've copied the code out of AN1831 and using TN15, I've added some external symbol definitions/references (XREF and XDEF). I also added the assembly include file for my MCU, located by default here:

C:\Program Files\Freescale\CW08 V5.0\lib\hc08c\device\asm_include\*.inc

What I found was that the AN1831 code has some strange errors in it. For instance there are periods following all the ORA opcodes. That doesn't compile (at least on the CW5 assembler), Then there's a byte called TESTMOD with no definition anywhere. Here is the snippet:

IFEQ TESTMOD
LDA FLBPR
LDA ,X
ENDIF
IFNE TESTMOD

So what is the value of "TESTMOD"?

Also, I'm getting the error "A13003: Value is truncated to one byte" on three out of four total BRCLR lines. Example:

BRCLR FLCR_MASS_MASK,CTRLBYT,PGSTUP

I can't find any significant differences between these four BRCLR instances, including how far they branch (2-3 lines at the most).

Finally, for some reason some of the labels are followed by a colon and some are not. For example:

AMBS: STA FLCR

...or:

NOBLWR STA ,X

The compiler doesn't seem to care, but is this a problem?

Outcomes