ARM Technical Support Knowledge Articles

INC DRK PROBLEMS WITH THE INTEL 80C251SB

Applies to: C251 C Compiler

Answer

Information in this article applies to:


QUESTION

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?

ANSWER

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.

SEE ALSO

Article last edited on: 2000-01-18 00:00:00

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential