Reputation: 17
I Writing a code that loops 1000 times in assembly language, although I keep getting these errors:
main.s(48): error: A1137E: Unexpected characters at end of line
main.s(53): error: A1137E: Unexpected characters at end of line
main.s(55): error: A1163E: Unknown opcode endloop , expecting opcode or Macro
".\SimpleProject.axf" - 3 Error(s), 0 Warning(s).
Here is an Example of my code:
MOV R0, #1, i = 1;
startloop
cmp R0, #1000
BGT endloop
ADD R1, R1, R0
ADD R0, R0, #1, i++;
B startloop
endloop
line (48) refers to:
MOV R0, #1, i = 1;
Upvotes: 0
Views: 782
Reputation: 76
The move instruction (MOV) takes two parameters: either two registers, or a register and an immediate value. Thus, (MOV R0, #1, i = 1;)
is invalid. Also, you don't need semi-colon at the end of each instruction. A comment can be made with double forward slashes. So, try this:
MOV R0, #1 //i = 1;
You can learn more from the ARM Compiler toolchain Assembler Reference, and/or watching some tutorials on YT such as ARM instructions tutorial, or sample loop program in assembly
Good luck!
Upvotes: 1
Reputation: 87426
Try changing the erroneous line to:
MOV R0, #1
Clearly i = 1;
was supposed to be a comment, but you accidentally typed a comma instead of whatever comment character is supported by your assembler. Read the documentation of your assembler to learn comment syntax.
Upvotes: 1