gnupic: Questions about SDCC PIC code gen
Subject:
Re: Questions about SDCC PIC code gen
From:
Samuel Tardieu ####@####.####
Date:
22 Oct 2002 11:59:31 -0000
Message-Id: <2002-10-22-13-55-46+trackit+sam@rfc1149.net>
Rogier> Is there a workaround? Is there an optimization that we can
Rogier> turn off to prevent this from occurring? (-> Hint:
Rogier> optimizations need to be switchable, because sometimes you
Rogier> find out later that it's buggy in some situations!)
I know I will look like "selling" my own (free) stuff, but have you
considered using Forth?
I tried your code fragment on my PicForth compiler:
| variable girstate
|
| : initports
| begin
| gie bit-clr
| gie bit-set? while
| repeat
| 0 trisd ! 1 girstate ! ;
|
| : main initports $a portd ! ;
and it produces the expected result:
| ; name: initports
| ; max return-stack depth: 0
| 0x0003 138B bcf 0x0B,7
| 0x0004 1B8B btfsc 0x0B,7
| 0x0005 2803 goto 0x003 ; initports
| 0x0006 1683 bsf 0x03,5
| 0x0007 0188 clrf 0x08
| 0x0008 1283 bcf 0x03,5
| 0x0009 3001 movlw 0x01
| 0x000A 00B3 movwf 0x33
| 0x000B 0008 return
| ; name: main
| ; max return-stack depth: 1
| 0x000C 2003 call 0x003 ; initports
| 0x000D 300A movlw 0x0A
| 0x000E 0088 movwf 0x08
| 0x000F 0008 return
Sam
--
Samuel Tardieu -- ####@####.#### -- http://www.rfc1149.net/sam