At 16.35 22/01/98 EST, you wrote: > >On Thu, 22 Jan 1998 18:02:20 +0100 Giorgio Alboni > writes: >>I'm writing a C compiler fo microchip 16C84. The output is a full >>commented >>MPLAB assembler file. I just made the parser and a part of compiler. >>Give a look at this code (c -> asm) and tell me what do you think. > > > That looks pretty neat! The case where you're setting a variable >to zero could be a special case. Instead of using movlw 0, movwf >variable, you could just do clrf variable. This can be made in a optimization fase. > Also, where is the variable >memory allocation being done? In writing asm code, I tend to do it >inside the subroutine using cbank and endc. If no address is given for >the cbank, it uses the next available address. Your right, I don't now how but in my letter I forget the begin of asm file, it's: LIST P=PIC16C84 include include "16Cxx.h" CBLOCK 0x0C incPortA_b incPortA_a main_c2 main_c1 __CCTemp1 main_c2 main_c1 PORTB PORTA ENDC ORG 0 goto main nop nop nop goto interrupt > Then there's the issue of >ram re-use. I generally haven't dealt with it, but local automatic >variables could be released from ram on exit of the subroutine (easy with >a stack... but we don't have one unless you want to build one using FSR). This is a big problem. I think that PIc have a lot of ram location. I want to make a C compiler thats help in writing asm code. The pic programmer must know what the C compiler do so he can write a simple mix of C and asm code (with asm {} primitive). The pics are too small for support a run time C support and in the most case it's no necessary. > I'd like to see the compiler. Is it available on the web? If >not, you can email it to me at harold@hallikainen.com . > For now no, in the next day (i think 26-1). Bye. Giorgio Alboni. =================================================== Alboni Giorgio Faenza (Ra) ITALY E-Mail: rac1337@racine.ravenna.it http://www.geocities.com/SiliconValley/Heights/5444 (Last Update: 29/09/97) ===================================================