We're tasked to identify the problem in next code:
ORG 0000H
MAIN:
CLR A
MOV A, FFFFH
MOV B, FFH
AGAIN: DEC A
DJNZ B, AGAIN
END
On MOV A, FFFFH
and MOV B, FFH
EdSim51 is having an
unknow label on both FFFFH and FFH.
I don't have any experience on this type of code. I think it's on the amount of bits each register holds, but I'm not sure. Can someone explain it to me.
The instruction MOV
can be used with different operands. In your case, the assembler looks for an "immediate value". This could be given as a label or a literal number.
For us humans, both FFFFH
and FFH
look as literal numbers because we recognize the hexadecimal digits and the "H" at the end.
But the software uses a most simple method: If the first character is a decimal digit, the operand is a literal number. If it is a letter, it is a label.
That's why EdSim51 (or its assembler, respectively) takes them as labels. And since none of the labels is defined, it reports the error you get.
However, if you put a zero "0" in front of both, resulting in 0FFFFH
and 0FFH
, the first instruction might give you another error: The value is too large for the instruction, which expects an 8-bit width.