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,#080HSUBB A,#080H
Sorry , my poor english ^^"""
Thanks a lot
FYR
In the fourth edition of Keil C51,
if you write [if(a<=240) ] , you will get the following assembly code,
MOV A,R7SETB CSUBB A,#0F0H
but same c code in the fifth edition , you will get the following assembly code.
MOV A,R7SETB CSUBB A,#0F0HMOV A,#080HSUBB A,#080HJNC ?C0001
Why do Keil want to add those two lines?
I don't know, signed / unsigned treatment of a char perhaps?
There is also the option to disable standard 'C' integer promotion.
The optimisation level may also be significant.
M8051Ask said:C51 version 4
M8051Ask said:C51 Version 5
What's with all the ancient history?
Current version is 9.6 !!