Login Join Maker Pro
Or sign in with

# Assembly code for arm

#### vead

Nov 27, 2011
473
I am beginner for arm I just want to learn assembly for arm keil software
I have written code for addition
Code:
Area   example , code  readonly
entry

start
mov R0 #5
mov R1#3
add R0, R0,R1
stop B stop
End
I am seeing 7 error massage
assembling lcd.asm...
lcd.asm(1): error A9: SYNTAX ERROR
lcd.asm(2): error A9: SYNTAX ERROR
lcd.asm(3): error A9: SYNTAX ERROR
lcd.asm(4): error A9: SYNTAX ERROR
lcd.asm(5): error A9: SYNTAX ERROR
lcd.asm(6): error A38: NUMBER OF OPERANDS DOES NOT MATCH INSTRUCTION
lcd.asm(7): error A9: SYNTAX ERROR
lcd.asm - 7 Error(s), 0 Warning(s).

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
Odd that the assembler is reporting a syntax error for line 3, which is blank!

Are your directives and instructions indented from the left column?

Is "start" a label? Usually these need a colon at the end. (Where they're defined, not where they're referenced.)

Find some sample code and compare it to your code. The problem should become obvious.

#### vead

Nov 27, 2011
473
Odd that the assembler is reporting a syntax error for line 3, which is blank!

Are your directives and instructions indented from the left column?

Is "start" a label? Usually these need a colon at the end. (Where they're defined, not where they're referenced.)

Find some sample code and compare it to your code. The problem should become obvious.
Code:
Area   example , code  readonly
entry

start
mov R0, #5    ;  load value into R0
mov R1,#3   ;   load value into R1
add R0, R0,R1
stop
B stop     ; I don't what is this
End

why does we use this line
Area example , code readonly

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
I don't know. I don't know ARM assembly language. What does the assembler manual say about it? Have you checked my other suggestions?

#### gorgon

Jun 6, 2011
603
As far as I can see from comparing your code with an example in the 'ARM Assembly Language - an Introduction' by J.R. Gibson, the only actual fault you have, is to use a mixed upper/ lower case to the directive Area,. You can use either upper OR lower case, but NOT a mix. Since the AREA directive is the first directive for the program block, it is natural that all the rest of the code is not recognized after missing the directive.
The case rules are the same for mnemonics too, select the case you want to use, and no mixing upper / lower case.

why does we use this line
Area example , code readonly

This line tells the assembler that AREA is a section of the program with additional options. CODE and READONLY indicate that the section contain instructions and that code produced may be put in readonly memory. 'example' is the title of the program, chosen by the programmer.

The B stop is an instruction to branch always to 'stop'. The effect is to let the program loop until the operator break from the IDE.

Last edited:

#### Fahid Bin Tariq

Oct 14, 2017
1
dear first of all you are making two labels then assign colon) in-front of them
like
start:

stop:

2nd syntax error is in add command!
this is correct one.
ADD Rd,Rr
similarly,
MOV R , value

Replies
17
Views
2K
Replies
4
Views
2K
Replies
11
Views
2K
R
Replies
3
Views
1K
Marra
M
W
Replies
1
Views
5K
Tim Daneliuk
T