|ARM Technical Support Knowledge Articles|
Applies to: C251 C Compiler
Information in this article applies to:
I'm using 80C251SB C-step device and have just discovered the "INC DR?,#2" problem. Is there an assembler or compiler directive to substitute ADD DR?,#2 automatically?
YES, there is. It is FIXDRK. You may use this directive with the A251 assembler and the C251 compiler.
For example, the following assembly code:
cseg at 0 inc DR0, #2 end
when assembled normally in source mode generates the following output:
LOC OBJ LINE SOURCE 000000 1 cseg at 0 000000 0B0D 2 inc DR0, #2 3 end 4
Note that the OBJect code generated is 0x0B and 0x0D. This decodes to...INC DR0, #2.
When you assemble the same code using the FIXDRK directive, the assembler generates the following output:
000000 1 cseg at 0 000000 2E080002 2 inc DR0, #2 3 end
And, when you decode the 0x2E, 0x08, 0x00, 0x02, you get ADD DR0, #0002h.
Even though the ADD instruction is generated, the assembler listing file still shows INC DR0, #2. Don't let this confuse you.
Note that the INC instruction only affects the N and Z flags while the ADD instruction affects N, Z, CY, AC, and OV. You may need to modify your assembly source code accordingly. This situation is handled in the compiler automatically.
Article last edited on: 2000-01-18 00:00:00
Did you find this article helpful? Yes No
How can we improve this article?