Hey guys. I'm just learning the basis of embedded with Keil. I'm working on the 8051. Doing this program to find the factorial of a number. Got the code online and I can't understand why it won't run. Help me out, guys.
1.ORG 0000H 2.MOV R0, #05H 3.MOV A, R0 4.ACALL FACT 5.FACT: DEC R0 6. CJNE R0, #1, REL 7. SJMP STOP 8.REL: MOV B,R0 9. MUL AB 10. ACALL FACT 11.STOP: END 12.END
I added the last END after it showed a warning about missing END statement. I get the following errors/warnings: Q3.s(0): error A21: EXPRESSION WITH FORWARD REFERENCE NOT PERMITTED Q3.s(11) SYNTAX ERROR Target not created.
If you don't know what a "forward reference" is, then look it up.
Otherwise, that error message seems pretty clear.
For learning, there are plenty of resources; eg,
http://www.keil.com/books/
http://www.keil.com/support/man_c51.htm
http://www.keil.com/support/man/docs/uv4cl/uv4cl_examples.htm
http://www.keil.com/appnotes/list/c51.htm
http://www.keil.com/download/list/c51.htm
Leading spaces and separation are important. Review other working and assembling code and emulate style and formatting more exactly.
and Please read the manual for specific details: http://www.keil.com/support/man/docs/a51/a51_wp_statements.htm