diff --git a/src/grc65/main.c b/src/grc65/main.c index 7b61ddc85..51211ddff 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -117,16 +117,16 @@ static void Usage (void) printf ( "Usage: %s [options] file\n" "Short options:\n" - " -V\t\t\tPrint the version number\n" - " -h\t\t\tHelp (this text)\n" - " -o name\t\tName the C output file\n" - " -s name\t\tName the asm output file\n" - " -t sys\t\tSet the target system\n" + " -V Print the version number\n" + " -h Help (this text)\n" + " -o name Name the C output file\n" + " -s name Name the asm output file\n" + " -t sys Set the target system\n" "\n" "Long options:\n" - " --help\t\tHelp (this text)\n" - " --target sys\t\tSet the target system\n" - " --version\t\tPrint the version number\n", + " --help Help (this text)\n" + " --target sys Set the target system\n" + " --version Print the version number\n", ProgName); } @@ -179,11 +179,11 @@ static void printCHeader (void) { fprintf (outputCFile, "//\n" - "//\tThis file was generated by the GEOS Resource Compiler\n" + "// This file was generated by the GEOS Resource Compiler\n" "//\n" - "//\tDO NOT EDIT! Any changes will be lost!\n" + "// DO NOT EDIT! Any changes will be lost!\n" "//\n" - "//\tEdit proper resource file instead.\n" + "// Edit proper resource file instead.\n" "//\n\n"); } @@ -192,11 +192,11 @@ static void printSHeader (void) { fprintf (outputSFile, ";\n" - ";\tThis file was generated by the GEOS Resource Compiler\n" + "; This file was generated by the GEOS Resource Compiler\n" ";\n" - ";\tDO NOT EDIT! Any changes will be lost!\n" + "; DO NOT EDIT! Any changes will be lost!\n" ";\n" - ";\tEdit proper resource file instead.\n" + "; Edit proper resource file instead.\n" ";\n\n"); } @@ -271,11 +271,11 @@ static void fillOut (char *name, int len, char *filler) int a; setLen (name, len); - fprintf (outputSFile, "\t.byte \"%s\"\n", name); + fprintf (outputSFile, " .byte \"%s\"\n", name); a = strlen (name); if (a < len) { - fprintf (outputSFile, "\t.res (%i - %i), %s\n", len, a, filler); + fprintf (outputSFile, " .res (%i - %i), %s\n", len, a, filler); } } @@ -391,15 +391,15 @@ static void DoMenu (void) fprintf (outputCFile, "\n" "const void %s = {\n" - "\t(char)%i, (char)%i,\n" - "\t(int)%i, (int)%i,\n" - "\t(char)(%i | %s),\n", + " (char)%i, (char)%i,\n" + " (int)%i, (int)%i,\n" + " (char)(%i | %s),\n", myMenu.name, myMenu.top, myMenu.bot, myMenu.left, myMenu.right, item, myMenu.type); curItem = myMenu.item; for (a = 0; a != item; a++) { fprintf (outputCFile, - "\t%s, (char)%s, (int)", + " %s, (char)%s, (int)", curItem->name, curItem->type); if ((strstr (curItem->type, "SUB_MENU") != NULL) && (strstr (curItem->type, "DYN_SUB_MENU") == NULL)) { fprintf (outputCFile, @@ -565,58 +565,58 @@ static void DoHeader (void) /* OK, all information is gathered, do flushout */ fprintf (outputSFile, - "\t.import __BSS_SIZE__, __STARTUP_RUN__\n" - "\t.import __VLIR0_START__, __VLIR0_LAST__\n" - "\t.import __VLIR0_BLOCKS__\n" - "\t.import __VLIR1_BLOCKS__\n" - "\t.import __VLIR2_BLOCKS__\n" - "\t.import __VLIR3_BLOCKS__\n" - "\t.import __VLIR4_BLOCKS__\n" - "\t.import __VLIR5_BLOCKS__\n" - "\t.import __VLIR6_BLOCKS__\n" - "\t.import __VLIR7_BLOCKS__\n" - "\t.import __VLIR8_BLOCKS__\n" - "\t.import __VLIR9_BLOCKS__\n" - "\t.import __VLIR10_BLOCKS__\n" - "\t.import __VLIR11_BLOCKS__\n" - "\t.import __VLIR12_BLOCKS__\n" - "\t.import __VLIR13_BLOCKS__\n" - "\t.import __VLIR14_BLOCKS__\n" - "\t.import __VLIR15_BLOCKS__\n" - "\t.import __VLIR16_BLOCKS__\n" - "\t.import __VLIR17_BLOCKS__\n" - "\t.import __VLIR18_BLOCKS__\n" - "\t.import __VLIR19_BLOCKS__\n\n" + " .import __BSS_SIZE__, __STARTUP_RUN__\n" + " .import __VLIR0_START__, __VLIR0_LAST__\n" + " .import __VLIR0_BLOCKS__\n" + " .import __VLIR1_BLOCKS__\n" + " .import __VLIR2_BLOCKS__\n" + " .import __VLIR3_BLOCKS__\n" + " .import __VLIR4_BLOCKS__\n" + " .import __VLIR5_BLOCKS__\n" + " .import __VLIR6_BLOCKS__\n" + " .import __VLIR7_BLOCKS__\n" + " .import __VLIR8_BLOCKS__\n" + " .import __VLIR9_BLOCKS__\n" + " .import __VLIR10_BLOCKS__\n" + " .import __VLIR11_BLOCKS__\n" + " .import __VLIR12_BLOCKS__\n" + " .import __VLIR13_BLOCKS__\n" + " .import __VLIR14_BLOCKS__\n" + " .import __VLIR15_BLOCKS__\n" + " .import __VLIR16_BLOCKS__\n" + " .import __VLIR17_BLOCKS__\n" + " .import __VLIR18_BLOCKS__\n" + " .import __VLIR19_BLOCKS__\n\n" ); fprintf (outputSFile, - "\t\t.segment \"DIRENTRY\"\n\n"); + " .segment \"DIRENTRY\"\n\n"); if (apple == 1) { if (myHead.structure == APPHEADER_STRUCTURE_SEQ) { fprintf (outputSFile, - "\t.import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__\n\n"); + " .import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__\n\n"); } fprintf (outputSFile, - "\t.byte %i << 4 | %u\n", + " .byte %i << 4 | %u\n", myHead.structure + 2, (unsigned)strlen (myHead.dosname)); fillOut (myHead.dosname, 15, "0"); fprintf (outputSFile, - "\t.byte $%02x\n" - "\t.word 0\n" - "\t.word 0\n" - "\t.word %s\n" - "\t.byte 0\n" - "\t.word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" - "\t.byte 0\n" - "\t.byte 0\n" - "\t.byte 0\n" - "\t.word 0\n" - "\t.word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" - "\t.word 0\n\n", + " .byte $%02x\n" + " .word 0\n" + " .word 0\n" + " .word %s\n" + " .byte 0\n" + " .word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" + " .byte 0\n" + " .byte 0\n" + " .byte 0\n" + " .word 0\n" + " .word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" + " .word 0\n\n", myHead.geostype, myHead.structure == APPHEADER_STRUCTURE_SEQ ? "__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__" : "0", @@ -626,24 +626,24 @@ static void DoHeader (void) } else { fprintf (outputSFile, - "\t.byte %i\n" - "\t.word 0\n", + " .byte %i\n" + " .word 0\n", myHead.dostype); fillOut (myHead.dosname, 16, "$a0"); fprintf (outputSFile, - "\t.word 0\n" - "\t.byte %i\n" - "\t.byte %i\n" - "\t.byte %i, %i, %i, %i, %i\n\n" + " .word 0\n" + " .byte %i\n" + " .byte %i\n" + " .byte %i, %i, %i, %i, %i\n\n" /* length in blocks: * add size of each VLIR segment, plus 1 block for the info block (icon), * plus another block for the VLIR RECORDS table (VLIR structure only) */ - "\t.word %d + __VLIR0_BLOCKS__ + __VLIR1_BLOCKS__ + __VLIR2_BLOCKS__ + __VLIR3_BLOCKS__ + __VLIR4_BLOCKS__ + __VLIR5_BLOCKS__ + __VLIR6_BLOCKS__ + __VLIR7_BLOCKS__ + __VLIR8_BLOCKS__ + __VLIR9_BLOCKS__ + __VLIR10_BLOCKS__ + __VLIR11_BLOCKS__ + __VLIR12_BLOCKS__ + __VLIR13_BLOCKS__ + __VLIR14_BLOCKS__ + __VLIR15_BLOCKS__ + __VLIR16_BLOCKS__ + __VLIR17_BLOCKS__ + __VLIR18_BLOCKS__ + __VLIR19_BLOCKS__\n" + " .word %d + __VLIR0_BLOCKS__ + __VLIR1_BLOCKS__ + __VLIR2_BLOCKS__ + __VLIR3_BLOCKS__ + __VLIR4_BLOCKS__ + __VLIR5_BLOCKS__ + __VLIR6_BLOCKS__ + __VLIR7_BLOCKS__ + __VLIR8_BLOCKS__ + __VLIR9_BLOCKS__ + __VLIR10_BLOCKS__ + __VLIR11_BLOCKS__ + __VLIR12_BLOCKS__ + __VLIR13_BLOCKS__ + __VLIR14_BLOCKS__ + __VLIR15_BLOCKS__ + __VLIR16_BLOCKS__ + __VLIR17_BLOCKS__ + __VLIR18_BLOCKS__ + __VLIR19_BLOCKS__\n" /* PRG formatted or SEQ formatted */ - "\t.byte \"%s formatted GEOS file V1.0\"\n\n", + " .byte \"%s formatted GEOS file V1.0\"\n\n", myHead.structure, myHead.geostype, myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min, (myHead.structure == APPHEADER_STRUCTURE_SEQ) ? 1 : 2, @@ -652,24 +652,24 @@ static void DoHeader (void) } fprintf (outputSFile, - "\t\t.segment \"FILEINFO\"\n\n" - "\t.byte 3, 21, 63 | $80\n"); + " .segment \"FILEINFO\"\n\n" + " .byte 3, 21, 63 | $80\n"); if (myHead.icon != NULL) { fprintf (outputSFile, - "\t.incbin \"%s\", 0, 63\n", + " .incbin \"%s\", 0, 63\n", myHead.icon); } else { for (i = 0; i != 63; i = i + 3) { fprintf (outputSFile, - "\t.byte %%%s, %%%s, %%%s\n", + " .byte %%%s, %%%s, %%%s\n", bintos (icon1[i], i1), bintos (icon1[i+1], i2), bintos (icon1[i+2], i3)); } } fprintf (outputSFile, - "\t.byte %i, %i, %i\n" - "\t.word __VLIR0_START__, __VLIR0_START__ - 1, __STARTUP_RUN__\n\n", + " .byte %i, %i, %i\n" + " .word __VLIR0_START__, __VLIR0_START__ - 1, __STARTUP_RUN__\n\n", myHead.dostype, myHead.geostype, myHead.structure); fillOut (myHead.classname, 12, "$20"); @@ -677,21 +677,21 @@ static void DoHeader (void) fillOut (myHead.version, 4, "0"); fprintf (outputSFile, - "\t.byte 0, 0, 0\n" - "\t.byte %i\n\n", + " .byte 0, 0, 0\n" + " .byte %i\n\n", myHead.mode); setLen (myHead.author, 62); fprintf (outputSFile, - "\t.byte \"%s\"\n" - "\t.byte 0\n" - "\t.res (63 - %i)\n\n", + " .byte \"%s\"\n" + " .byte 0\n" + " .res (63 - %i)\n\n", myHead.author, (int)(strlen (myHead.author) + 1)); setLen (myHead.info, 95); fprintf (outputSFile, - "\t.byte \"%s\"\n" - "\t.byte 0\n\n", + " .byte \"%s\"\n" + " .byte 0\n\n", myHead.info); if (fclose (outputSFile) != 0) { @@ -788,13 +788,13 @@ static void DoMemory (void) if (lastnumber != -1) { fprintf (outputSFile, - "\t\t.segment \"RECORDS\"\n\n"); + " .segment \"RECORDS\"\n\n"); if (apple == 1) { for (number = 0; number <= lastnumber; number++) { fprintf (outputSFile, - "\t.byte %s\n", + " .byte %s\n", overlaytable[number] == 1 ? "$00" : "$FF"); } fprintf (outputSFile, @@ -803,12 +803,12 @@ static void DoMemory (void) for (number = 0; number <= lastnumber; number++) { if (overlaytable[number] == 1) { fprintf (outputSFile, - "\t\t.segment \"VLIRIDX%i\"\n\n" - "\t.import __VLIR%i_START__, __VLIR%i_LAST__%s\n\n" - "\t.res 255\n" - "\t.byte .lobyte (__VLIR%i_LAST__ - __VLIR%i_START__%s)\n" - "\t.res 255\n" - "\t.byte .hibyte (__VLIR%i_LAST__ - __VLIR%i_START__%s)\n\n", + " .segment \"VLIRIDX%i\"\n\n" + " .import __VLIR%i_START__, __VLIR%i_LAST__%s\n\n" + " .res 255\n" + " .byte .lobyte (__VLIR%i_LAST__ - __VLIR%i_START__%s)\n" + " .res 255\n" + " .byte .hibyte (__VLIR%i_LAST__ - __VLIR%i_START__%s)\n\n", number, number, number, number == 0 ? ", __BSS_SIZE__" : "", number, number, @@ -823,7 +823,7 @@ static void DoMemory (void) for (number = 0; number <= lastnumber; number++) { if (overlaytable[number] == 1) { fprintf (outputSFile, - "\t.import __VLIR%i_START__, __VLIR%i_LAST__%s\n", + " .import __VLIR%i_START__, __VLIR%i_LAST__%s\n", number, number, number == 0 ? ", __BSS_SIZE__" : ""); } } @@ -833,14 +833,14 @@ static void DoMemory (void) for (number = 0; number <= lastnumber; number++) { if (overlaytable[number] == 1) { fprintf (outputSFile, - "\t.byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__%s - 1) / 254) + 1\n" - "\t.byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__%s - 1) .MOD 254) + 2\n", + " .byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__%s - 1) / 254) + 1\n" + " .byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__%s - 1) .MOD 254) + 2\n", number, number, number == 0 ? " - __BSS_SIZE__" : "", number, number, number == 0 ? " - __BSS_SIZE__" : ""); } else { fprintf (outputSFile, - "\t.byte $00\n" - "\t.byte $FF\n"); + " .byte $00\n" + " .byte $FF\n"); } } fprintf (outputSFile, @@ -862,19 +862,19 @@ static void DoMemory (void) if (stacksize != -1) { fprintf (outputSFile, - "\t.export __STACKSIZE__ : absolute = $%04x\n\n", + " .export __STACKSIZE__ : absolute = $%04x\n\n", stacksize); } if (overlaysize != -1) { fprintf (outputSFile, - "\t.export __OVERLAYSIZE__ : absolute = $%04x\n\n", + " .export __OVERLAYSIZE__ : absolute = $%04x\n\n", overlaysize); } if (backbuffer != -1) { fprintf (outputSFile, - "\t.export __BACKBUFSIZE__ : absolute = $%04x\n\n", + " .export __BACKBUFSIZE__ : absolute = $%04x\n\n", backbuffer ? 0x2000 : 0x0000); }