Identifier error and ; required errors

AREA LCM,CODE,READONLY
EXPORT __main
num1 EQU 0X06
num2 EQU 0X018
__main
MOV R0,#num1
MOV R1,#num2
MOV R2,#count
CMP R0,R1
BNE swap
MOV R7,R0
B STOP
swap BHS loop
MOV R0,#num2
MOV R1,#num1
loop UDIV R8,R0,R1
MUL R9,R8,R1
CMP R9,R0
BEQ lop
MUL R7,R0,R1
B STOP
lop MUL R3,R1,R2
UDIV R4,R3,R0
MUL R5,R4,R3
CMP R5,R0
BEQ STOP
ADD R2,#1
BNE lop
STOP B STOP
END

This is a code written for finding LCM of two numbers

These are the errors obtained

LCM2.c(1): error: #20: identifier "AREA" is undefined
AREA LCM,CODE,READONLY
LCM2.c(2): error: #65: expected a ";"
EXPORT __main
LCM2.c(6): error: #10: "#" not expected here
MOV R0,#num1
LCM2.c(7): error: #10: "#" not expected here
MOV R1,#num2
LCM2.c(8): error: #10: "#" not expected here
MOV R2,#count
LCM2.c(14): error: #10: "#" not expected here
MOV R0,#num2
LCM2.c(15): error: #10: "#" not expected here
MOV R1,#num1
LCM2.c(27): error: #10: "#" not expected here
ADD R2,#1
LCM2.c(31): warning: #1-D: last line of file ends without a newline

LCM2.c(31): warning: At end of source: #12-D: parsing restarts here after previous syntax error
LCM2.c: 2 warnings, 8 errors
".\LCM.axf" - 8 Error(s), 2 Warning(s).

Please help me try solving this

Parents Reply Children
No data
More questions in this forum