This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MDK-5.25 Assembler change immediate value of one assembly instruction

I am using the KEIL MDK-5.25, assembly. The project compiles without some problems, but when i see the disassembly the assembler change the inmediate value.

Assembler replace the immediate for another.

ASM code:

                        SBCS    R2,R1                                   ;R2=0xFFFFFFC7
                        SUBS    R2,#0xC7                                ;R2=0xFFFFFF00
                        LSLS    R2,#20                                  ;R2=0xF0000000

Disassembly code:


   517:                         SBCS    R2,R1                                   ;R2=0xFFFFFFC7
0x000006BA 418A      SBCS     r2,r2,r1
   518:                         SUBS    R2,#0xC7                ;R2=0xFFFFFF00
0x000006BC 3A00      SUBS     r2,r2,#0x00
   519:                         LSLS    R2,#20                  ;R2=0xF0000000
0x000006BE 0512      LSLS     r2,r2,#20
   520:                         MOVS    R4,#28

<\pre>

The value #0xC7 replaced to #0x00. And this brings a wrong result.
This only comes when i make the debugger with the microcontroller.
When i use the simulator comes right!!



   517:                         SBCS    R2,R1                                   ;R2=0xFFFFFFC7
0x000006BA 418A      SBCS     r2,r2,r1
   518:                         SUBS    R2,#0xC7                ;R2=0xFFFFFF00
0x000006BC 3AC7      SUBS     r2,r2,#0xC7
   519:                         LSLS    R2,#20                  ;R2=0xF0000000
0x000006BE 0512      LSLS     r2,r2,#20

<\pre>



Somebody saw something simlar?