Keil Logo

C251: INC DRK Problems With the Intel 80C251SB

Information in this article applies to:

  • C251 Version 2.14

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


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.