Syntax Error in Line 1 with PIC Simulator IDE

Thread Starter

jlaverty

Joined Mar 22, 2020
13
Hello,
I keep getting an error when trying to Compile any program in PIC Simulator IDE \, no matter how simple it is. Im trying to write a program that adds 7F9AH to BC48H and save the result in RAM memory locations starting at 40H. Here is my code:

org 0;
clr C
mov A, #48h
add A, #9ah ; 48h + 9ah
mov r0, A
mov A, #0bch
addc A, #7fh ; bc + 7f
mov r1, A
mov 40h, r1 ;storing into 40h
mov 41h, r0

End

What am I missing here?
 

Thread Starter

jlaverty

Joined Mar 22, 2020
13
Neither - Oshonsoft PIC Simulator. I do have MPLABX IDE, but I just downloaded it and haven't really set it up yet.
 

Thread Starter

jlaverty

Joined Mar 22, 2020
13
To be honest, I'm fumbling my way through this course. I think I was able to figure it out. By loading the code into the assembler, I was able to get a little further. Now I'm getting an "Unrecognized instruction" error for line 2 and on. I've added ; to each line, made sure they are all lined up by using the TAB, and nothing seems to work.
 

jpanhalt

Joined Jan 18, 2008
11,087
Have you looked at the instruction set for your device and IDE? As Ian also pointed out, the mnemonics are different than what your code uses. Of course, an assembler might be built that converts the mnemonics you use to the proper instructions, e.g., "addc" could translate to a macro or to "addwfc," but whether that is what you have is unclear.

1584907057731.png

I know what I copied is not the same chip, but it is the same family.
 

djsfantasi

Joined Apr 11, 2010
9,163
It is...
My code is at the top - first post.
Just to clarify. The posted code is NOT BASIC. It’s assembler. Unless you use directives to tell the compiler that the following code is assembler and NOT BASIC, I would assume that you are assembling the code and not compiling BASIC.

I hope that you’ve realized this point and are using assembler rather than BASIC.
 
Top