void doload_backgroundstatement(void) { /* syntax is name of the beginning of the data pattern : identifier name of the 16 palettes : identifier name of the bat : identifier width (in tiles [8x8] ) : integer height (in tiles [8x8] ) : integer */ flush_ins(); /* David, optimize.c related */ ot("_load_background\t"); if (outnameunderline()) return; if (outcomma()) return; if (outnameunderline()) return; if (outcomma()) return; if (outnameunderline()) return; if (outcomma()) return; if (outconst()) return; if (outcomma()) return; if (outconst()) return; newl(); needbrack(")"); }
void doload_spritesstatement(void) { /* syntax is offset in vram to load data at : integer name of the data to transfert : identifier number of sprites (of size 32x64) to load : integer */ flush_ins(); /* David, optimize.c related */ ot("load_sprites\t"); outconst(); if (outcomma()) return; if (outnameunderline()) return; if (!match(",")) { outstr(",#"); outdec(1); } else { outbyte(','); outconst(); } newl(); needbrack(")"); }
void doset_sprpalstatement(void) { /* syntax is number of the first palette to alter : integer name of the data for loading palettes : identifier [ number of palette to load : integer ] if last argument is missing, 1 is assumed */ flush_ins(); /* David, optimize.c related */ ot("_set_sprpal\t"); outconst(); if (outcomma()) return; if (outnameunderline()) return; if (!match(",")) { outstr(",#"); outdec(1); } else { outbyte(','); outconst(); } newl(); needbrack(")"); }
/* * gnlabel - generate numeric label */ void gnlabel (INTPTR_T nlab) /*int nlab; */ { flush_ins(); /* David - optimize.c related */ outlabel (nlab); col (); newl (); }
/* * glabel - generate label */ void glabel (char *lab) /*char *lab;*/ { flush_ins(); /* David - optimize.c related */ prefix (); outstr (lab); col (); newl (); }
/* * process all input text * * at this level, only static declarations, defines, includes, * and function definitions are legal. * */ void parse (void) { if (!startup_incl) { inc_startup(); incl_globals(); } while (1) { blanks(); if (feof(input)) break; // Note: // At beginning of 'parse' call, the header has been output to '.s' // file, as well as all the -Asym=val operands from command line. // // But initial '#include "startup.asm"' statement was not yet output // (allowing for additional asm define's to be parsed and output first. // // We can parse some trivial tokens first (including the asmdef...), // but the #include "startup.asm" line must be output before actual code // (And only once...) // if (amatch("#asmdef", 7)) { doasmdef(); continue; } if (amatch("extern", 6)) dodcls(EXTERN, NULL_TAG, 0); else if (amatch("static", 6)) { if (amatch("const", 5)) { /* XXX: what about the static part? */ dodcls(CONST, NULL_TAG, 0); } else dodcls(STATIC, NULL_TAG, 0); } else if (amatch("const", 5)) dodcls(CONST, NULL_TAG, 0); else if (amatch("typedef", 7)) dotypedef(); else if (dodcls(PUBLIC, NULL_TAG, 0)) ; else if (match("#asm")) doasm(); else if (match("#include")) doinclude(); else if (match("#inc")) dopsdinc(); else if (match("#def")) dopsddef(); else newfunc(NULL, 0, 0, 0, 0); } if (optimize) flush_ins(); }
void readline (void) { int k; FILE *unit; FOREVER { if (feof (input)) return; if ((unit = input2) == NULL) unit = input; kill_line (); while ((k = fgetc (unit)) != EOF) { if ((k == '\r') | (k == EOL) | (lptr >= LINEMAX)) break; line[lptr++] = k; } line_number++; line[lptr] = 0; if (k <= 0) if (input2 != NULL) { if (globals_h_in_process) { /* Add special treatment to ensure globals.h stuff appears at the beginning */ dumpglbs(); ol(".code"); globals_h_in_process = 0; } input2 = inclstk[--inclsp]; line_number = inclstk_line[inclsp]; fclose (unit); } if (lptr) { if ((ctext) & (cmode)) { flush_ins(); comment (); outstr (line); newl (); } lptr = 0; return; } } }