Firstly, I am new to the community as well as Assembly language.

I am attempting to write my first code, and I received an error.


ORG  4000

LDAA $10  ;loads A with the value in memory location 10
ADDA #3  ;add the value 3 to the value loaded into A
STAA $10  ;store the sum back into memory location $10
CLRA      ;clear A
LDAA $15
ADDA $3
STAA $15
SWI


The error is:

Error  : A1603: Directive, instruction or macro name expected:  4000 detected

MCUInit.inc line 28 

Error  : A1603: Directive, instruction or macro name expected:  $10  detected

MCUInit.inc line 30 

Error  : A1603: Directive, instruction or macro name expected:  #3  detected

MCUInit.inc line 31 

Error  : A1603: Directive, instruction or macro name expected:  $10  detected

MCUInit.inc line 32 

Error  : A1603: Directive, instruction or macro name expected:  $15 detected

MCUInit.inc line 34 

Error  : A1103: Illegal redefinition of label

MCUInit.inc line 34 

Error  : A1603: Directive, instruction or macro name expected:  $3 detected

MCUInit.inc line 35 

Error  : A1103: Illegal redefinition of label

MCUInit.inc line 35 

Error  : A1603: Directive, instruction or macro name expected:  $15 detected

MCUInit.inc line 36 

Error  : A1103: Illegal redefinition of label

MCUInit.inc line 36 

Error  : Compile failed

I tried to search for how to start a program, but I dont even know what to call the start of the program...  I apologize for being a newbie, but I was hoping this forum and some effort could change that.

My chip is the MC68HC12.
Posted on 2010-11-17 21:39:37 by battlehands
Welcome to the community.

What assembler are you using for this code?

I have never seen this format before.
Posted on 2010-11-18 05:26:07 by skywalker
Freescale Codewarrior
Posted on 2010-11-18 06:21:56 by battlehands
Is it possible that the memory locations that I am loading are too "low" in the memory?  I have no idea if this contributes to the problem... Im just trying things out.
Posted on 2010-11-18 06:23:25 by battlehands
I am unfamiliar with both your CPU and your assembler. In googling around to see "what it is", I came across the factlette that this thing is sensitive to which column your code starts in. You might try starting each line (except labels?) with a space or tab. If all else fails, you may have to RTFM (I assume there is one). Hang in there: getting started is the hardest part!

Best,
Frank

Posted on 2010-11-18 08:12:45 by fbkotler