/* Put out assembler info before any code is generated */ header() { comment(); outstr(Banner); nl(); comment(); outstr(Author); nl(); comment(); outstr(Version); nl(); comment(); nl(); if ( trace ) { ol("global ccregis"); /* declare these */ ol("global ccleavi"); /* tracing routine */ } if ( mainflg ) { /* do stuff needed for first */ ol("LD HL,(6)"); /* set up stack */ ol("LD SP,HL"); callrts("ccgo"); /* set default drive for CP/M */ zcall("main"); /* call code generated by small-c */ zcall("exit"); } else { /* not main program, output module name */ ot("module "); if ( Filename[1] == ':' ) outstr(&Filename[2]); else outstr(Filename) ; nl(); } }
int constant(LVALUE *lval) { constype=CINT; conssign=dosigned; lval->is_const = 1 ; /* assume constant will be found */ if ( fnumber(&lval->const_val) ) { lval->val_type=DOUBLE; if ( doublestrings ) { immedlit(litlab); outdec(lval->const_val); nl(); callrts("__atof2"); WriteDefined("math_atof",1); } else { immedlit(dublab); outdec(lval->const_val); nl(); callrts("dload"); } lval->is_const = 0 ; /* floating point not constant */ lval->flags=0; return(1); } else if ( number(&lval->const_val) || pstr(&lval->const_val) ) { /* Insert long stuff/long pointer here? */ if ( (unsigned long )lval->const_val >= 65536LU ) constype = LONG; lval->val_type = constype ; lval->flags = (lval->flags&MKSIGN)|conssign; if (constype == LONG) vlongconst(lval->const_val); else vconst(lval->const_val); return(1); } else if ( tstr(&lval->const_val) ) { lval->is_const = 0 ; /* string address not constant */ lval->ptr_type=CCHAR; /* djm 9/3/99 */ lval->val_type=CINT; lval->flags=0; immedlit(litlab); } else { lval->is_const = 0 ; return(0); } outdec(lval->const_val); nl(); return(1); }