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

why such code sequence?

A simple program, compiled on C51 ver. 7.07:

#include <reg51.h>

unsigned char mparity(unsigned char arg) {

 ACC=arg;
 return P?arg|0x80:arg;
}

void main () {
unsigned char t;

 t=0x3e;
 t=mparity(t);
}

compiles on assembly language:
             ; FUNCTION _mparity (BEGIN)
                                           ; SOURCE LINE # 3
;---- Variable 'arg' assigned to Register 'R7' ----
                                           ; SOURCE LINE # 5
0000 EF                MOV     A,R7
                                           ; SOURCE LINE # 6
0001 30D005            JNB     P,?C0001
0004 4480              ORL     A,#080H
0006 FF                MOV     R7,A
0007 8000              SJMP    ?C0002
0009         ?C0001:
0009         ?C0002:
                                           ; SOURCE LINE # 7
0009         ?C0003:
0009 22                RET
             ; FUNCTION _mparity (END)

The instruction of the processor to the address 0007 (sjmp) obviously superfluous.

0