This function always returns even parity:
bit getParity(char c)
ACC = c;
return !P; or return !(!P); works well.
Compiled with SDCC Version 2.6.3 #4543 (Dec 31 2006) invoked by command sdcc -c test.c.
The Parity flag is overwritten by clearing accumulator before it is used.
; test.c:6: return P;
clr a <--- the P flag is overwritten here
; Peephole 500 removed redundant label 00101$
Log in to post a comment.