From cc4b960b9627714d26ae9ec622f7668915c2b40e Mon Sep 17 00:00:00 2001 From: "ol.sc" Date: Thu, 9 Feb 2012 21:23:24 +0000 Subject: [PATCH] Added support for Apple GEOS VLIR programs. git-svn-id: svn://svn.cc65.org/cc65/trunk@5519 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/grc65/main.c | 80 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 22 deletions(-) diff --git a/src/grc65/main.c b/src/grc65/main.c index c0d9923a8..95c168d78 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -563,8 +563,11 @@ static void DoHeader (void) if (apple == 1) { + if (myHead.structure == 0) { + fprintf (outputSFile, + "\t.import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__\n\n"); + } fprintf (outputSFile, - "\t.import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__\n\n" "\t.byte %i << 4 | %u\n", myHead.structure + 2, (unsigned)strlen (myHead.dosname)); @@ -574,7 +577,7 @@ static void DoHeader (void) "\t.byte $%02x\n" "\t.word 0\n" "\t.word 0\n" - "\t.word __VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__\n" + "\t.word %s\n" "\t.byte 0\n" "\t.word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" "\t.byte 0\n" @@ -582,8 +585,10 @@ static void DoHeader (void) "\t.byte 0\n" "\t.word 0\n" "\t.word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" - "\t.word 0\n", + "\t.word 0\n\n", myHead.geostype, + myHead.structure == 0 ? + "__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__" : "0", myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min, myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min); @@ -747,30 +752,61 @@ static void DoMemory (void) fprintf (outputSFile, "\t\t.segment \"RECORDS\"\n\n"); - for (number = 0; number <= lastnumber; number++) { - if (overlaytable[number] == 1) { + if (apple == 1) { + + for (number = 0; number <= lastnumber; number++) { fprintf (outputSFile, - "\t.import __VLIR%i_START__, __VLIR%i_LAST__\n", - number, number); + "\t.byte %s\n", + overlaytable[number] == 1 ? "$00" : "$FF"); + } + fprintf (outputSFile, + "\n"); + + 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", + number, number, number, + number == 0 ? ", __BSS_SIZE__" : "", + number, number, + number == 0 ? " - __BSS_SIZE__" : "", + number, number, + number == 0 ? " - __BSS_SIZE__" : ""); + } } - } - fprintf (outputSFile, - "\n"); - for (number = 0; number <= lastnumber; number++) { - if (overlaytable[number] == 1) { - fprintf (outputSFile, - "\t.byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__ - 1) / 254) + 1\n" - "\t.byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__ - 1) .MOD 254) + 2\n", - number, number, number, number); - } else { - fprintf (outputSFile, - "\t.byte $00\n" - "\t.byte $FF\n"); + } else { + + for (number = 0; number <= lastnumber; number++) { + if (overlaytable[number] == 1) { + fprintf (outputSFile, + "\t.import __VLIR%i_START__, __VLIR%i_LAST__\n", + number, number); + } } + fprintf (outputSFile, + "\n"); + + for (number = 0; number <= lastnumber; number++) { + if (overlaytable[number] == 1) { + fprintf (outputSFile, + "\t.byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__ - 1) / 254) + 1\n" + "\t.byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__ - 1) .MOD 254) + 2\n", + number, number, number, number); + } else { + fprintf (outputSFile, + "\t.byte $00\n" + "\t.byte $FF\n"); + } + } + fprintf (outputSFile, + "\n"); } - fprintf (outputSFile, - "\n"); openCFile (); -- 2.39.5