We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
According to K&R: x *= y + 1 is equivalent to: x = x * ( y + 1 ) And other assignment operators including modulo should be handled similarly. However, the following function does not work as I expected.
void test() small { unsigned char x,y; x = 7; y = 7; x++; x %= 256; y = ( y + 1 ) % 256; }
; FUNCTION test (BEGIN) ; SOURCE LINE # 1002 ; SOURCE LINE # 1006 ;---- Variable 'x' assigned to Register 'R7' ---- 0000 7F07 MOV R7,#07H ; SOURCE LINE # 1007 ;---- Variable 'y' assigned to Register 'R6' ---- 0002 7E07 MOV R6,#07H ; SOURCE LINE # 1009 0004 0F INC R7 ; SOURCE LINE # 1010 0005 EF MOV A,R7 0006 75F000 MOV B,#00H 0009 84 DIV AB 000A AFF0 MOV R7,B ; SOURCE LINE # 1012 000C EE MOV A,R6 000D 04 INC A 000E FD MOV R5,A 000F 0E INC R6 ; SOURCE LINE # 1014 0010 22 RET ; FUNCTION test (END)