AREA LCM,CODE,READONLY EXPORT __mainnum1 EQU 0X06num2 EQU 0X018__main MOV R0,#num1 MOV R1,#num2 MOV R2,#count CMP R0,R1 BNE swap MOV R7,R0 B STOPswap BHS loop MOV R0,#num2 MOV R1,#num1loop UDIV R8,R0,R1 MUL R9,R8,R1 CMP R9,R0 BEQ lop MUL R7,R0,R1 B STOPlop MUL R3,R1,R2 UDIV R4,R3,R0 MUL R5,R4,R3 CMP R5,R0 BEQ STOP ADD R2,#1 BNE lopSTOP 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,READONLYLCM2.c(2): error: #65: expected a ";" EXPORT __mainLCM2.c(6): error: #10: "#" not expected here MOV R0,#num1LCM2.c(7): error: #10: "#" not expected here MOV R1,#num2LCM2.c(8): error: #10: "#" not expected here MOV R2,#countLCM2.c(14): error: #10: "#" not expected here MOV R0,#num2LCM2.c(15): error: #10: "#" not expected here MOV R1,#num1LCM2.c(27): error: #10: "#" not expected here ADD R2,#1LCM2.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 errorLCM2.c: 2 warnings, 8 errors".\LCM.axf" - 8 Error(s), 2 Warning(s).
Please help me try solving this
Rename as a .s file so it uses the Assembler rather than the C Compiler.