Hi can someone please help with the explanation of this code below, more importantly how does the uC 'see' the Sqrs: line at the end of the code
I am interested in something similar in a project i am currently doing whereby the input data of a PORT is compared to certain values and the the result stored in a register.
What function does PC have in the code?
org 0 ljmp Main
Main:
mov P3, #0xFF ; Port 3 is an input
loop: mov a, P3
anl a, #0x0F ; Clear bits 7..4 of A
lcall sqrt
mov P1, a
sjmp loop
sqrt: inc a
movc a, @a + PC
ret
Sqrs: db 0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3
Actually, the processor never "sees" any source code - all it ever sees is the content of memory that results from that source code.
The so-called "bible" tells you how the processor will react to the contents of memory;
The Manuals for your assembler tell you how it will interpret the source code:
http://www.keil.com/support/man/docs/a51/
thanks everyone
i've seemed to grasp is now after a good bit of simulation and debugging:)
"i've seemed to grasp is now after a good bit of simulation and debugging"
You really need to study those documents to lay a proper Foundation - otherwise (to use a truly Biblical metaphor) you are building on sand...