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. (This is a very stupid program). byte PORTA,PORTB; void interrupt () {} void incPortA (byte a,byte b) { PORTA+=a; if (PORTA) PORTA++; else PORTA+=10; } void main () { byte c1,c2; PORTA=12; PORTB=12; c1=0; c2=0; c1=c2+3+(c1-1); incPortA(c2,c1); } Output of compiler: upt interrupt: ; Function definition retfie ; End Function definition: interrupt incPortA: ; Function definition ; Expression: PORTA+=a; movf incPortA_a,0 addwf PORTA,0 ; Make: PORTA+=a movwf PORTA ifSt0: ; if (PORTA) movf PORTA,0 sublw d'0' ; Test if condition btfsc _z goto ifSt0else ; Expression: PORTA++; movf PORTA,0 incf PORTA,1 ; Make: PORTA++ goto ifSt0end ifSt0else: ; Expression: PORTA+=10; movlw d'10' addwf PORTA,0 ; Make: PORTA+=10 movwf PORTA ifSt0end: return ; End Function definition: incPortA main: ; Function definition ; Expression: PORTA=12; movlw d'12' movwf PORTA ; Save result of: PORTA=12 ; Expression: PORTB=12; movlw d'12' movwf PORTB ; Save result of: PORTB=12 ; Expression: c1=0; movlw d'0' movwf main_c1 ; Save result of: c1=0 ; Expression: c2=0; movlw d'0' movwf main_c2 ; Save result of: c2=0 ; Expression: c1=c2+3+(c1-1); movlw d'3' addwf main_c2,0 ; Make: c2+3 movwf __CCTemp1 ; Save result of: c2+3 movlw d'1' subwf main_c1,0 ; Make: c1-1 addwf __CCTemp1,0 ; Make: c2+3+(c1-1) movwf main_c1 ; Save result of: c1=c2+3+(c1-1) ; Expression: incPortA(c2,c1); movf main_c2,0 mowf main_a movf main_c1,0 mowf main_b call incPortA ; Make function call: incPortA(c 2,c1) _endPrg goto _endPrg ; End Function definition: main If there is someone interested at this program, please contact me. It's free. Thank's for your time. =================================================== Alboni Giorgio Faenza (Ra) ITALY E-Mail: rac1337@racine.ravenna.it http://www.geocities.com/SiliconValley/Heights/5444 (Last Update: 29/09/97) ===================================================