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

about if (a<= x) asm code

Hi All

In Keil C51 version 4

if (a<= 240)   will get follow asm code

MOV A,R7
SETB C
SUBB A,#0F0H

JNC ?C0001

In Keil C51 Version 5 will get follow asm code 

MOV A,R7
SETB C
SUBB A,#0F0H
MOV A,#080H
SUBB A,#080H
JNC ?C0001

Why add those two line asm code??

MOV A,#080H
SUBB A,#080H

Sorry , my poor english ^^"""

Thanks a lot 

FYR

Parents
  • Hi All 

    In the fourth edition of Keil C51,

    if you write  [if(a<=240) ] , you will get the following assembly code,

    MOV A,R7
    SETB C
    SUBB A,#0F0H

    JNC ?C0001

    but same c code in the fifth edition , you will get the following assembly code.

    MOV A,R7
    SETB C
    SUBB A,#0F0H
    MOV A,#080H
    SUBB A,#080H
    JNC ?C0001

    Why do Keil want to add those two lines?

    MOV A,#080H
    SUBB A,#080H

    Thanks a lot

Reply
  • Hi All 

    In the fourth edition of Keil C51,

    if you write  [if(a<=240) ] , you will get the following assembly code,

    MOV A,R7
    SETB C
    SUBB A,#0F0H

    JNC ?C0001

    but same c code in the fifth edition , you will get the following assembly code.

    MOV A,R7
    SETB C
    SUBB A,#0F0H
    MOV A,#080H
    SUBB A,#080H
    JNC ?C0001

    Why do Keil want to add those two lines?

    MOV A,#080H
    SUBB A,#080H

    Thanks a lot

Children
No data