gnupic: sdcc bug (rigth posting, previous got sent incomplete)


Previous by date: 14 Oct 2002 17:02:31 -0000 sdcc bug, Ricardo Amezquita Orozco
Next by date: 14 Oct 2002 17:02:31 -0000 'gpsim' 16f877 newbee questions, Tom Alldread, VA7TA
Previous in thread:
Next in thread: 14 Oct 2002 17:02:31 -0000 Re: sdcc bug (rigth posting, previous got sent incomplete), Scott Dattalo

Subject: sdcc bug (rigth posting, previous got sent incomplete)
From: "Ricardo Amezquita Orozco" ####@####.####
Date: 14 Oct 2002 17:02:31 -0000
Message-Id: <HDOPDGAEONOCIAAA@mailcity.com>

Hello

I wrote a small program, to test some things in the pic port of the sdcc compiler, and I think I found a bug.

The C source is the folowing

#include "p16f877.h"
#define __16F877
BIT_AT (PORTA_ADDR,0)  PA;
BIT_AT (PORTB_ADDR,0)  PB;

int main()
{
  int i;
  int j;
  
  TRISB=255;
  ADCON1=0x06;
  TRISA=0x00;
  while(1)
    {
      if(PB==0)PA=1;
      else PA=0;
  
    }
  
}

the generated asm is the following
.......
;; Starting pCode block
_main	;Function start
; 2 exit points
;#CSRC	test.c 11
;  TRISB=255;
	MOVLW	0xff
	BSF	_STATUS,5 # change to bank 1
	MOVWF	_TRISB
;#CSRC	test.c 12
;  ADCON1=0x06;
	MOVLW	0x06
	MOVWF	_ADCON1
;#CSRC	test.c 13
;  TRISA=0x00;
	CLRF	_TRISA
_00109_DS_
;#CSRC	test.c 14
;  while(1)
        BTFSC	(_PB >> 3), (_PB & 7) # still in bank 1 
                                      # PB is in bank 0
	GOTO	_00106_DS_
	BCF	_STATUS,5
;#CSRC	test.c 16
;  if(PB==0)PA=1;
	BSF	(_PA >> 3), (_PA & 7)
	GOTO	_00109_DS_
_00106_DS_
;#CSRC	test.c 17
;  else PA=0;
	BCF	(_PA >> 3), (_PA & 7)
	GOTO	_00109_DS_
	RETURN	
; exit point of _main
	end

The asm file is triying to check if PB==0 in the wrong bank


Thanks

Ricardo

ps: Sorry for the other posting


____________________________________________________________
Watch a championship game with Elway or McGwire.
Enter Now at http://champions.lycos.com 

Previous by date: 14 Oct 2002 17:02:31 -0000 sdcc bug, Ricardo Amezquita Orozco
Next by date: 14 Oct 2002 17:02:31 -0000 'gpsim' 16f877 newbee questions, Tom Alldread, VA7TA
Previous in thread:
Next in thread: 14 Oct 2002 17:02:31 -0000 Re: sdcc bug (rigth posting, previous got sent incomplete), Scott Dattalo


Powered by ezmlm-browse 0.20.