When I try to do clear bit operation ( PORTD &= ~0x40 ) the sdcc
produces ( CLRF PORTD ) assembly code from it. The problem is only in
bit inversion because the same assembly code is produced from ( PORTD
= ~0x40) too. Is this a known bug or is there coming to fix?
Compilation command from Makefile:
sdcc -S -V -mpic14 -p16F74 $<
sdcc -v
> SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/
ds400/hc08 2.5.6 #4252 (Jul 1 2006) (UNIX)
--
Aki Penttinen
Email: aki.p.penttinen@lut.fi
Logged In: YES
user_id=1115835
You need to post some code, with
<code name="b1526968.c">
#include <pic14regs.h>
void foo(void) {
PORTD &= 0x40;
PORTD = ~0x40;
}
</code>
and
sdcc -mpic14 -p16f74 -S b1526968.c
I obtain the desired results (BCF _PORTD, 6; MOVLW 0xbf;
MOVWF _PORTD). Tested with SDCC 2.5.6 #4290 and 2.6.0 #4308.
Logged In: NO
SDCC 2.6.0 #4309, compiled with MacBook
and with your code the output is still:
; .line 3; "b1526968.c" PORTD &= 0x40;
MOVLW 0x40
BCF STATUS,5
BCF STATUS,6
ANDWF _PORTD,F
; .line 4; "b1526968.c" PORTD = ~0x40;
CLRF _PORTD
But I tried the same code with SDCC version 2.5.6 with my linux computer
and the results was:
; .line 3; "b1526968.c" PORTD &= 0x40;
MOVLW 0x40
BCF STATUS,5
BCF STATUS,6
ANDWF _PORTD,F
; .line 4; "b1526968.c" PORTD = ~0x40;
MOVLW 0xbf
MOVWF _PORTD
So now the code was as it should be. The problem seems to be my MacBook's
sdcc. By now I should atleast continue compiling code with linux machine.