From 4b7cd491e3631e7e827f7d416ef38d17ac5c341f Mon Sep 17 00:00:00 2001 From: Jesse Rosenstock Date: Mon, 24 Aug 2020 16:33:50 +0200 Subject: [PATCH 01/22] Move #1209 test from err/ to misc/ misc/ is the correct place for tests that should compile but do not. Revert err/Makefile changes from #1210. --- test/err/Makefile | 8 ++++---- test/misc/Makefile | 6 ++++++ test/{err => misc}/bug1209-ind-goto-rev.c | 0 3 files changed, 10 insertions(+), 4 deletions(-) rename test/{err => misc}/bug1209-ind-goto-rev.c (100%) diff --git a/test/err/Makefile b/test/err/Makefile index 6fa53a1db..1273bbb2c 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -23,23 +23,23 @@ ifdef QUIET NULLERR = 2>$(NULLDEV) endif -CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65) +CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65) WORKDIR = ../../testwrk/err .PHONY: all clean SOURCES := $(wildcard *.c) -TESTS = $(patsubst %.c,$(WORKDIR)/%.prg,$(SOURCES)) +TESTS = $(patsubst %.c,$(WORKDIR)/%.s,$(SOURCES)) all: $(TESTS) $(WORKDIR): $(call MKDIR,$(WORKDIR)) -$(WORKDIR)/%.prg: %.c | $(WORKDIR) +$(WORKDIR)/%.s: %.c | $(WORKDIR) $(if $(QUIET),echo err/$*.s) - $(NOT) $(CL65) -o $@ $< $(NULLERR) + $(NOT) $(CC65) -o $@ $< $(NULLERR) clean: @$(call RMDIR,$(WORKDIR)) diff --git a/test/misc/Makefile b/test/misc/Makefile index b21384b68..80cbcdf9e 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -75,6 +75,12 @@ $(WORKDIR)/bug760.$1.$2.prg: bug760.c | $(WORKDIR) $(if $(QUIET),echo misc/bug760.$1.$2.prg) $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) +# should compile, but gives an error +$(WORKDIR)/bug1209-ind-goto-rev.$1.$2.prg: bug1209-ind-goto-rev.c | $(WORKDIR) + @echo "FIXME: " $$@ "currently does not compile." + $(if $(QUIET),echo misc/bug1209-ind-goto-rev.$1.$2.prg) + $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + # should compile, but gives an error $(WORKDIR)/pptest2.$1.$2.prg: pptest2.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." diff --git a/test/err/bug1209-ind-goto-rev.c b/test/misc/bug1209-ind-goto-rev.c similarity index 100% rename from test/err/bug1209-ind-goto-rev.c rename to test/misc/bug1209-ind-goto-rev.c From d38e5858f01f67e3ad096135312de8a9e7814a74 Mon Sep 17 00:00:00 2001 From: Jesse Rosenstock Date: Mon, 24 Aug 2020 10:01:58 +0200 Subject: [PATCH 02/22] Add tests for #1211 CL_MoveRefs: Add CHECK (E->JumpTo != NULL) to make failure clearer. --- src/cc65/codelab.c | 1 + test/err/bug1211-ice-move-refs-1.c | 52 ++++++++++++++++++++++++++++++ test/err/bug1211-ice-move-refs-2.c | 51 +++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 test/err/bug1211-ice-move-refs-1.c create mode 100644 test/err/bug1211-ice-move-refs-2.c diff --git a/src/cc65/codelab.c b/src/cc65/codelab.c index f36520835..ff26645dc 100644 --- a/src/cc65/codelab.c +++ b/src/cc65/codelab.c @@ -112,6 +112,7 @@ void CL_MoveRefs (CodeLabel* OldLabel, CodeLabel* NewLabel) CodeEntry* E = CL_GetRef (OldLabel, Count); /* Change the reference to the new label */ + CHECK (E->JumpTo != NULL); CHECK (E->JumpTo == OldLabel); CL_AddRef (NewLabel, E); diff --git a/test/err/bug1211-ice-move-refs-1.c b/test/err/bug1211-ice-move-refs-1.c new file mode 100644 index 000000000..f28d1fcbc --- /dev/null +++ b/test/err/bug1211-ice-move-refs-1.c @@ -0,0 +1,52 @@ +/* + Copyright 2020 The cc65 Authors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Test of indirect goto with label merge ICE. + https://github.com/cc65/cc65/issues/1211 + This should compile and should be moved to tests/val/ when the bug is fixed. +*/ + +#include + +/* When operating correctly, f(0) = 31 and f(1) = 41. */ +int f (int x) +{ + static const void *const labels[] = {&&L0, &&L1}; + goto *labels[x]; +L0: if (labels[0] != labels[1]) return 31; + else return 13; +L1: return 41; +} + +static unsigned char failures = 0; + +int main (void) +{ + if (f (0) != 31) failures++; + + if (failures == 0) { + printf ("PASS\n"); + } else { + printf ("FAIL\n"); + } + + return failures; +} diff --git a/test/err/bug1211-ice-move-refs-2.c b/test/err/bug1211-ice-move-refs-2.c new file mode 100644 index 000000000..504433f45 --- /dev/null +++ b/test/err/bug1211-ice-move-refs-2.c @@ -0,0 +1,51 @@ +/* + Copyright 2020 The cc65 Authors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Test of indirect goto with label merge ICE. + https://github.com/cc65/cc65/issues/1211 + This should compile and should be moved to tests/val/ when the bug is fixed. +*/ + +#include + +/* When operating correctly, this returns 0. */ +int f (void) +{ + static const void *const x[2] = {&&L0, &&L1}; + goto *x[0]; +L0: +L1: return 0; +} + +static unsigned char failures = 0; + +int main (void) +{ + if (f () != 0) failures++; + + if (failures == 0) { + printf ("PASS\n"); + } else { + printf ("FAIL\n"); + } + + return failures; +} From 344aea06693130a41f348a56f3e85337b15bb96a Mon Sep 17 00:00:00 2001 From: Jesse Rosenstock Date: Sun, 23 Aug 2020 21:50:54 +0200 Subject: [PATCH 03/22] Add additional test cases for #1209 These test cases don't use dynamic labels. https://github.com/cc65/cc65/issues/1209#issuecomment-678738971 Also update the original test case for consistency: * Change failure message to just "FAIL", as there is only one failure * Outdent label definitions * Clarify description --- test/misc/Makefile | 12 +++++++ test/misc/bug1209-ind-goto-rev-2.c | 54 ++++++++++++++++++++++++++++++ test/misc/bug1209-ind-goto-rev-3.c | 52 ++++++++++++++++++++++++++++ test/misc/bug1209-ind-goto-rev.c | 6 ++-- 4 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 test/misc/bug1209-ind-goto-rev-2.c create mode 100644 test/misc/bug1209-ind-goto-rev-3.c diff --git a/test/misc/Makefile b/test/misc/Makefile index 80cbcdf9e..b28fc4d06 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -81,6 +81,18 @@ $(WORKDIR)/bug1209-ind-goto-rev.$1.$2.prg: bug1209-ind-goto-rev.c | $(WORKDIR) $(if $(QUIET),echo misc/bug1209-ind-goto-rev.$1.$2.prg) $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) +# should compile, but gives an error +$(WORKDIR)/bug1209-ind-goto-rev-2.$1.$2.prg: bug1209-ind-goto-rev-2.c | $(WORKDIR) + @echo "FIXME: " $$@ "currently does not compile." + $(if $(QUIET),echo misc/bug1209-ind-goto-rev-2.$1.$2.prg) + $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + +# should compile, but gives an error +$(WORKDIR)/bug1209-ind-goto-rev-3.$1.$2.prg: bug1209-ind-goto-rev-3.c | $(WORKDIR) + @echo "FIXME: " $$@ "currently does not compile." + $(if $(QUIET),echo misc/bug1209-ind-goto-rev-3.$1.$2.prg) + $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + # should compile, but gives an error $(WORKDIR)/pptest2.$1.$2.prg: pptest2.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." diff --git a/test/misc/bug1209-ind-goto-rev-2.c b/test/misc/bug1209-ind-goto-rev-2.c new file mode 100644 index 000000000..8918e5878 --- /dev/null +++ b/test/misc/bug1209-ind-goto-rev-2.c @@ -0,0 +1,54 @@ +/* + Copyright 2020 The cc65 Authors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Test of indirect goto without dynamic labels and order label def, label ref, goto. + https://github.com/cc65/cc65/issues/1209 + This should compile and should be moved to tests/val/ when the bug is fixed. +*/ + +#include +#include + +/* When operating correctly, this returns 0. */ +static unsigned char y = 0; +int f (void) { +L: if (y) return 0; + { + static const void *const x[1] = {&&L}; + y = 1; + goto *x[0]; + } +} + +static unsigned char failures = 0; + +int main (void) +{ + if (f () != 0) failures++; + + if (failures == 0) { + printf ("PASS\n"); + } else { + printf ("FAIL\n"); + } + + return failures; +} diff --git a/test/misc/bug1209-ind-goto-rev-3.c b/test/misc/bug1209-ind-goto-rev-3.c new file mode 100644 index 000000000..4c3268c9a --- /dev/null +++ b/test/misc/bug1209-ind-goto-rev-3.c @@ -0,0 +1,52 @@ +/* + Copyright 2020 The cc65 Authors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Test of indirect goto without dynamic labels and order label ref, label def, goto. + https://github.com/cc65/cc65/issues/1209 + This should compile and should be moved to tests/val/ when the bug is fixed. +*/ + +#include +#include + +/* When operating correctly, this returns 0. */ +static unsigned char y = 0; +int f (void) { + static const void *const x[1] = {&&L}; +L: if (y) return 0; + y = 1; + goto *x[0]; +} + +static unsigned char failures = 0; + +int main (void) +{ + if (f () != 0) failures++; + + if (failures == 0) { + printf ("PASS\n"); + } else { + printf ("FAIL\n"); + } + + return failures; +} diff --git a/test/misc/bug1209-ind-goto-rev.c b/test/misc/bug1209-ind-goto-rev.c index 39d8639bd..ab8213a30 100644 --- a/test/misc/bug1209-ind-goto-rev.c +++ b/test/misc/bug1209-ind-goto-rev.c @@ -19,7 +19,7 @@ */ /* - Tests of indirect goto with the label before the goto. + Test of indirect goto with dynamic labels and order label def, label ref, goto. https://github.com/cc65/cc65/issues/1209 This should compile and should be moved to tests/val/ when the bug is fixed. */ @@ -32,7 +32,7 @@ int f (void) { static void *x[1]; /* Define the label before referencing it with indirect label syntax. */ - L: if (x[0] != 0) return 0; +L: if (x[0] != 0) return 0; x[0] = &&L; goto *x[0]; } @@ -46,7 +46,7 @@ int main (void) if (failures == 0) { printf ("PASS\n"); } else { - printf ("FAIL: %d failures\n", failures); + printf ("FAIL\n"); } return failures; From d68925c6a8708e0bf2d4ca825bac8ded2f0af903 Mon Sep 17 00:00:00 2001 From: acqn Date: Tue, 25 Aug 2020 22:34:25 +0800 Subject: [PATCH 04/22] Bug #1113 was fixed long ago. --- test/{misc => err}/bug1113.c | 0 test/misc/Makefile | 7 ------- 2 files changed, 7 deletions(-) rename test/{misc => err}/bug1113.c (100%) diff --git a/test/misc/bug1113.c b/test/err/bug1113.c similarity index 100% rename from test/misc/bug1113.c rename to test/err/bug1113.c diff --git a/test/misc/Makefile b/test/misc/Makefile index b28fc4d06..f4beec452 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -99,13 +99,6 @@ $(WORKDIR)/pptest2.$1.$2.prg: pptest2.c | $(WORKDIR) $(if $(QUIET),echo misc/pptest2.$1.$2.prg) $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) -# this should fail to compile, because there are errors in the code -# instead, the compiler crashes -$(WORKDIR)/bug1113.$1.$2.prg: bug1113.c | $(WORKDIR) - @echo "FIXME: " $$@ "compiler crashes but should give an error." - $(if $(QUIET),echo misc/bug1113.$1.$2.prg) - $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) - # should compile, but then hangs in an endless loop $(WORKDIR)/endless.$1.$2.prg: endless.c | $(WORKDIR) $(if $(QUIET),echo misc/endless.$1.$2.prg) From c216b3534b0a419b8fcad55e0c94dca2c7705d0c Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 13:36:43 +0200 Subject: [PATCH 05/22] fix compilation, fixes issue #1184 --- testcode/lib/scanf-test.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/testcode/lib/scanf-test.c b/testcode/lib/scanf-test.c index 9fce01b77..f17b62294 100644 --- a/testcode/lib/scanf-test.c +++ b/testcode/lib/scanf-test.c @@ -14,9 +14,7 @@ /* Define USE_STDIO, when you want to use the stdio functions. ** Do not define it, when you want to use the conio functions. */ -/* #define USE_STDIO -*/ #include #include @@ -35,22 +33,23 @@ #define ARRAYSIZE(a) (sizeof (a) / sizeof (a)[0]) +typedef enum { + INT, + CHAR +} TYPE; + +typedef union { + int nvalue; + const char *svalue; +} VALUE; + static const struct { const char *input, *format; int rvalue; - enum TYPE { - INT, - CHAR - } type1; - union { - int nvalue; - const char *svalue; - } v1; - enum TYPE type2; - union { - int nvalue; - const char *svalue; - } v2; + TYPE type1; + VALUE v1; + TYPE type2; + VALUE v2; } test_data[] = { /* Input sequences for character specifiers must be less than 80 characters ** long. These format strings are allowwed a maximum of two assignment From e5a1755133b679c2cd67de9c64f0a05b7aa83b8b Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 15:08:17 +0200 Subject: [PATCH 06/22] added some ifdefs to make testcode compile for apple2 and atari targets --- testcode/lib/dir-test.c | 16 +++++++++++++--- testcode/lib/heaptest.c | 7 ++++--- testcode/lib/mouse-test.c | 2 +- testcode/lib/strdup-test.c | 6 ++++-- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/testcode/lib/dir-test.c b/testcode/lib/dir-test.c index 9102fc74d..61e42247e 100644 --- a/testcode/lib/dir-test.c +++ b/testcode/lib/dir-test.c @@ -19,9 +19,13 @@ #include #include #include -#include #include +#if defined(__CBM__) +#include +#elif defined(__APPLE2__) +#include +#endif int main(void) { @@ -51,9 +55,13 @@ int main(void) printf("contents of \"%s\":\n", name); while ((E = readdir (D)) != 0) { printf ("dirent.d_name[] : \"%s\"\n", E->d_name); +#if !defined(__ATARI__) printf ("dirent.d_blocks : %10u\n", E->d_blocks); +#endif printf ("dirent.d_type : %10d\n", E->d_type); +#if !defined(__APPLE2__) && !defined(__ATARI__) printf ("telldir() : %10lu\n", telldir (D)); +#endif printf ("---\n"); if (!go) { switch (cgetc ()) { @@ -63,14 +71,16 @@ int main(void) case 'q': goto done; - +#if !defined(__APPLE2__) && !defined(__ATARI__) case 'r': seekdir (D, E->d_off); break; - +#endif +#if !defined(__ATARI__) case 's': rewinddir (D); break; +#endif } } diff --git a/testcode/lib/heaptest.c b/testcode/lib/heaptest.c index d776e2f0c..560694bee 100644 --- a/testcode/lib/heaptest.c +++ b/testcode/lib/heaptest.c @@ -214,10 +214,10 @@ int main (void) /* Show info at start */ ShowInfo (); - +#if !defined(__APPLE2__) /* Remember the time */ T = clock (); - +#endif /* Do the tests */ Test1 (); Test2 (); @@ -226,10 +226,11 @@ int main (void) Test5 (); Test6 (); +#if !defined(__APPLE2__) /* Calculate the time and print it */ T = clock () - T; printf ("Time needed: %lu ticks\n", T); - +#endif /* Done */ return EXIT_SUCCESS; } diff --git a/testcode/lib/mouse-test.c b/testcode/lib/mouse-test.c index ea8311d19..64482b937 100644 --- a/testcode/lib/mouse-test.c +++ b/testcode/lib/mouse-test.c @@ -190,7 +190,7 @@ int main (void) #endif /* Set dark-on-light colors. Clear the screen. */ -#ifdef __CBM__ +#if defined(__CBM__) && !defined(__VIC20__) (void) bordercolor (COLOR_GRAY2); (void) bgcolor (COLOR_WHITE); (void) textcolor (COLOR_GRAY1); diff --git a/testcode/lib/strdup-test.c b/testcode/lib/strdup-test.c index e30841c3e..2fcc9816f 100644 --- a/testcode/lib/strdup-test.c +++ b/testcode/lib/strdup-test.c @@ -84,19 +84,21 @@ int main (void) /* Show info at start */ ShowInfo (); - +#if !defined(__APPLE2__) /* Remember the time */ T = clock (); - +#endif /* Do the tests */ FillArray (); ShowInfo (); FreeArray (); ShowInfo (); +#if !defined(__APPLE2__) /* Calculate the time and print it */ T = clock () - T; printf ("Time needed: %lu ticks\n", T); +#endif /* Done */ return EXIT_SUCCESS; From 83cc1151121d775cef368fffa3c15bf4b13bbf03 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 15:51:20 +0200 Subject: [PATCH 07/22] re-add define for pad bits hw address, which was accidently removed in some refactor commit --- include/gamate.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/gamate.h b/include/gamate.h index 0af21623d..8b9790e39 100644 --- a/include/gamate.h +++ b/include/gamate.h @@ -170,6 +170,8 @@ /* No support for dynamically loadable drivers */ #define DYN_DRV 0 +#define JOY_DATA 0x4400 /* hw register to read the pad bits from */ + /* Masks for joy_read */ #define JOY_UP_MASK 0x01 #define JOY_DOWN_MASK 0x02 From 4c912a0fbe3ff74be793c09d7eee9ae92fe9bbad Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 15:59:52 +0200 Subject: [PATCH 08/22] make gamate testcode compile again --- testcode/lib/gamate/ctest.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testcode/lib/gamate/ctest.c b/testcode/lib/gamate/ctest.c index 793770cee..bff3f5986 100644 --- a/testcode/lib/gamate/ctest.c +++ b/testcode/lib/gamate/ctest.c @@ -25,19 +25,19 @@ int main(int argc, char *argv[]) gotoxy(0,2);cprintf("%04x %02x %02x %02x", n, x, y, *((unsigned char*)JOY_DATA)); switch((*((unsigned char*)JOY_DATA))) { - case 0xff ^ JOY_DATA_UP: + case 0xff ^ JOY_UP_MASK: ++y; if (y == 0xc8) y = 0; break; - case 0xff ^ JOY_DATA_DOWN: + case 0xff ^ JOY_DOWN_MASK: --y; if (y == 0xff) y = 0xc7; break; - case 0xff ^ JOY_DATA_LEFT: + case 0xff ^ JOY_LEFT_MASK: ++x; break; - case 0xff ^ JOY_DATA_RIGHT: + case 0xff ^ JOY_RIGHT_MASK: --x; break; - case 0xff ^ JOY_DATA_FIRE_A: + case 0xff ^ JOY_BTN_A_MASK: break; } From c658acbf850e32508ea0e14f0f62d675a009c7d9 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 26 Aug 2020 20:37:28 +0200 Subject: [PATCH 09/22] Avoid cl65 in tests. cl65 creates intermediate files based on the source file name in the source file directory. Calling cl65 in parallel with the same source file causes those intermediate files to get overwritten. Fixes #1080 --- test/asm/Makefile | 27 ++++++++++++-------------- test/dasm/Makefile | 11 ++++------- test/misc/Makefile | 48 ++++++++++++++++++++++------------------------ test/ref/Makefile | 19 +++++++++--------- test/todo/Makefile | 11 ++++++----- test/val/Makefile | 16 ++++++---------- 6 files changed, 61 insertions(+), 71 deletions(-) diff --git a/test/asm/Makefile b/test/asm/Makefile index 94a925376..b157bb672 100644 --- a/test/asm/Makefile +++ b/test/asm/Makefile @@ -8,23 +8,22 @@ ifdef CMD_EXE EXE = .exe MKDIR = mkdir $(subst /,\,$1) RMDIR = -rmdir /s /q $(subst /,\,$1) - DEL = del /f $(subst /,\,$1) else EXE = MKDIR = mkdir -p $1 RMDIR = $(RM) -r $1 - DEL = $(RM) $1 endif ifdef QUIET .SILENT: endif -CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) +CA65 := $(if $(wildcard ../../bin/ca65*),../../bin/ca65,ca65) +LD65 := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) WORKDIR = ../../testwrk/asm -DIFF = $(WORKDIR)/isequal$(EXE) +ISEQUAL = $(WORKDIR)/isequal$(EXE) CC = gcc CFLAGS = -O2 @@ -44,29 +43,28 @@ all: $(OPCODE_BINS) $(CPUDETECT_BINS) $(WORKDIR): $(call MKDIR,$(WORKDIR)) -$(DIFF): ../isequal.c | $(WORKDIR) +$(ISEQUAL): ../isequal.c | $(WORKDIR) $(CC) $(CFLAGS) -o $@ $< define OPCODE_template -$(WORKDIR)/$1-opcodes.bin: $1-opcodes.s $(DIFF) +$(WORKDIR)/$1-opcodes.bin: $1-opcodes.s $(ISEQUAL) $(if $(QUIET),echo asm/$1-opcodes.bin) - $(CL65) --cpu $1 -t none -l $(WORKDIR)/$1-opcodes.lst -o $$@ $$< - $(DIFF) $$@ $1-opcodes.ref + $(CA65) --cpu $1 -t none -l $(WORKDIR)/$1-opcodes.lst -o $(WORKDIR)/$1-opcodes.o $$< + $(LD65) -t none -o $$@ $(WORKDIR)/$1-opcodes.o none.lib + $(ISEQUAL) $$@ $1-opcodes.ref endef # OPCODE_template $(foreach cpu,$(OPCODE_CPUS),$(eval $(call OPCODE_template,$(cpu)))) -# cpudetect.o is written by multiple rules -.NOTPARALLEL: - define CPUDETECT_template -$(WORKDIR)/$1-cpudetect.bin: cpudetect.s $(DIFF) +$(WORKDIR)/$1-cpudetect.bin: cpudetect.s $(ISEQUAL) $(if $(QUIET),echo asm/$1-cpudetect.bin) - $(CL65) --cpu $1 -t none -l $(WORKDIR)/$1-cpudetect.lst -o $$@ $$< - $(DIFF) $$@ $1-cpudetect.ref + $(CA65) --cpu $1 -t none -l $(WORKDIR)/$1-cpudetect.lst -o $(WORKDIR)/$1-cpudetect.o $$< + $(LD65) -t none -o $$@ $(WORKDIR)/$1-cpudetect.o none.lib + $(ISEQUAL) $$@ $1-cpudetect.ref endef # CPUDETECT_template @@ -74,4 +72,3 @@ $(foreach cpu,$(CPUDETECT_CPUS),$(eval $(call CPUDETECT_template,$(cpu)))) clean: @$(call RMDIR,$(WORKDIR)) - @$(call DEL,$(OPCODE_REFS:.ref=.o) cpudetect.o) diff --git a/test/dasm/Makefile b/test/dasm/Makefile index faa6b7fa0..dc0b57c76 100644 --- a/test/dasm/Makefile +++ b/test/dasm/Makefile @@ -8,12 +8,10 @@ ifdef CMD_EXE EXE = .exe MKDIR = mkdir $(subst /,\,$1) RMDIR = -rmdir /s /q $(subst /,\,$1) - DEL = del /f $(subst /,\,$1) else EXE = MKDIR = mkdir -p $1 RMDIR = $(RM) -r $1 - DEL = $(RM) $1 endif ifdef QUIET @@ -25,7 +23,7 @@ DA65 := $(if $(wildcard ../../bin/da65*),../../bin/da65,da65) WORKDIR = ../../testwrk/dasm -DIFF = $(WORKDIR)/isequal$(EXE) +ISEQUAL = $(WORKDIR)/isequal$(EXE) CC = gcc CFLAGS = -O2 @@ -44,7 +42,7 @@ all: $(BINS) $(WORKDIR): $(call MKDIR,$(WORKDIR)) -$(DIFF): ../isequal.c | $(WORKDIR) +$(ISEQUAL): ../isequal.c | $(WORKDIR) $(CC) $(CFLAGS) -o $@ $< define DISASS_template @@ -55,10 +53,10 @@ $(WORKDIR)/$1-disass.bin: $1-disass.s | $(WORKDIR) $(WORKDIR)/$1-reass.s: $(WORKDIR)/$1-disass.bin $(DA65) --cpu $1 $(START) -o $$@ $$< -$(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(DIFF) +$(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(ISEQUAL) $(if $(QUIET),echo dasm/$1-reass.bin) $(CL65) --cpu $1 -t none $(START) -o $$@ $$< - $(DIFF) $$@ $(WORKDIR)/$1-disass.bin + $(ISEQUAL) $$@ $(WORKDIR)/$1-disass.bin endef # DISASS_template @@ -66,4 +64,3 @@ $(foreach cpu,$(CPUS),$(eval $(call DISASS_template,$(cpu)))) clean: @$(call RMDIR,$(WORKDIR)) - @$(call DEL,$(SOURCES:.s=.o)) diff --git a/test/misc/Makefile b/test/misc/Makefile index f4beec452..993a46bd4 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -11,7 +11,6 @@ ifdef CMD_EXE NULLDEV = nul: MKDIR = mkdir $(subst /,\,$1) RMDIR = -rmdir /s /q $(subst /,\,$1) - DEL = del /f $(subst /,\,$1) else S = / NOT = ! @@ -19,7 +18,6 @@ else NULLDEV = /dev/null MKDIR = mkdir -p $1 RMDIR = $(RM) -r $1 - DEL = $(RM) $1 endif ifdef QUIET @@ -30,14 +28,16 @@ endif SIM65FLAGS = -x 200000000 -CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65) +CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65) +CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65) +LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65) SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65) WORKDIR = ..$S..$Stestwrk$Smisc OPTIONS = g O Os Osi Osir Osr Oi Oir Or -DIFF = $(WORKDIR)$Sisequal$(EXE) +ISEQUAL = $(WORKDIR)$Sisequal$(EXE) CC = gcc CFLAGS = -O2 @@ -50,15 +50,10 @@ TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02. all: $(TESTS) -# The same input file is processed with different cl65 args, -# but cl65 uses the input file name to make the temp file name, -# and they stomp each other. -.NOTPARALLEL: - $(WORKDIR): $(call MKDIR,$(WORKDIR)) -$(DIFF): ../isequal.c | $(WORKDIR) +$(ISEQUAL): ../isequal.c | $(WORKDIR) $(CC) $(CFLAGS) -o $@ $< define PRG_template @@ -67,61 +62,65 @@ define PRG_template $(WORKDIR)/bug250.$1.$2.prg: bug250.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/bug250.$1.$2.prg) - $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) # should compile, but gives an error $(WORKDIR)/bug760.$1.$2.prg: bug760.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/bug760.$1.$2.prg) - $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) # should compile, but gives an error $(WORKDIR)/bug1209-ind-goto-rev.$1.$2.prg: bug1209-ind-goto-rev.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/bug1209-ind-goto-rev.$1.$2.prg) - $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) # should compile, but gives an error $(WORKDIR)/bug1209-ind-goto-rev-2.$1.$2.prg: bug1209-ind-goto-rev-2.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/bug1209-ind-goto-rev-2.$1.$2.prg) - $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) # should compile, but gives an error $(WORKDIR)/bug1209-ind-goto-rev-3.$1.$2.prg: bug1209-ind-goto-rev-3.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/bug1209-ind-goto-rev-3.$1.$2.prg) - $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) # should compile, but gives an error $(WORKDIR)/pptest2.$1.$2.prg: pptest2.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/pptest2.$1.$2.prg) - $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) # should compile, but then hangs in an endless loop $(WORKDIR)/endless.$1.$2.prg: endless.c | $(WORKDIR) $(if $(QUIET),echo misc/endless.$1.$2.prg) - $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR) + $(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR) + $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR) $(NOT) $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT) $(NULLERR) # these need reference data that can't be generated by a host-compiled program, # in a useful way -$(WORKDIR)/limits.$1.$2.prg: limits.c $(DIFF) | $(WORKDIR) +$(WORKDIR)/limits.$1.$2.prg: limits.c $(ISEQUAL) | $(WORKDIR) $(if $(QUIET),echo misc/limits.$1.$2.prg) - $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR) + $(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR) + $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR) $(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/limits.$1.$2.out - $(DIFF) $(WORKDIR)/limits.$1.$2.out limits.ref + $(ISEQUAL) $(WORKDIR)/limits.$1.$2.out limits.ref -$(WORKDIR)/goto.$1.$2.prg: goto.c $(DIFF) | $(WORKDIR) +$(WORKDIR)/goto.$1.$2.prg: goto.c $(ISEQUAL) | $(WORKDIR) $(if $(QUIET),echo misc/goto.$1.$2.prg) - $(CL65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.$2.out - $(DIFF) $(WORKDIR)/goto.$1.$2.out goto.ref + $(CC65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.$2.out + $(ISEQUAL) $(WORKDIR)/goto.$1.$2.out goto.ref # the rest are tests that fail currently for one reason or another $(WORKDIR)/sitest.$1.$2.prg: sitest.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." - $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) # $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT) endef # PRG_template @@ -131,4 +130,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02))) clean: @$(call RMDIR,$(WORKDIR)) - @$(call DEL,$(SOURCES:.c=.o)) diff --git a/test/ref/Makefile b/test/ref/Makefile index f88821f64..5faf9fb19 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -11,14 +11,12 @@ ifdef CMD_EXE NULLDEV = nul: MKDIR = mkdir $(subst /,\,$1) RMDIR = -rmdir /s /q $(subst /,\,$1) - DEL = del /f $(subst /,\,$1) else S = / EXE = NULLDEV = /dev/null MKDIR = mkdir -p $1 RMDIR = $(RM) -r $1 - DEL = $(RM) $1 endif ifdef QUIET @@ -28,14 +26,16 @@ endif SIM65FLAGS = -x 200000000 -CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65) +CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65) +CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65) +LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65) SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65) WORKDIR = ..$S..$Stestwrk$Sref OPTIONS = g O Os Osi Osir Osr Oi Oir Or -DIFF = $(WORKDIR)$Sisequal$(EXE) +ISEQUAL = $(WORKDIR)$Sisequal$(EXE) CC = gcc CFLAGS = -O2 -Wall -W -Wextra -funsigned-char -fwrapv -fno-strict-overflow @@ -57,7 +57,7 @@ $(WORKDIR)/%.ref: %.c | $(WORKDIR) $(CC) $(CFLAGS) -o $(WORKDIR)/$*.host $< $(NULLERR) $(WORKDIR)$S$*.host > $@ -$(DIFF): ../isequal.c | $(WORKDIR) +$(ISEQUAL): ../isequal.c | $(WORKDIR) $(CC) $(CFLAGS) -o $@ $< # "yaccdbg.c" includes "yacc.c". @@ -68,11 +68,13 @@ $(WORKDIR)/yaccdbg.%.prg: yacc.c define PRG_template -$(WORKDIR)/%.$1.$2.prg: %.c $(WORKDIR)/%.ref $(DIFF) +$(WORKDIR)/%.$1.$2.prg: %.c $(WORKDIR)/%.ref $(ISEQUAL) $(if $(QUIET),echo ref/$$*.$1.$2.prg) - $(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$< $(NULLERR) + $(CC65) -t sim$2 $$(CC65FLAGS) -$1 -o $$(@:.prg=.s) $$< $(NULLERR) + $(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR) + $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR) $(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/$$*.$1.$2.out - $(DIFF) $(WORKDIR)/$$*.$1.$2.out $(WORKDIR)/$$*.ref + $(ISEQUAL) $(WORKDIR)/$$*.$1.$2.out $(WORKDIR)/$$*.ref endef # PRG_template @@ -81,4 +83,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02))) clean: @$(call RMDIR,$(WORKDIR)) - @$(call DEL,$(SOURCES:.c=.o)) diff --git a/test/todo/Makefile b/test/todo/Makefile index ab5eb598c..17561f8f4 100644 --- a/test/todo/Makefile +++ b/test/todo/Makefile @@ -10,14 +10,12 @@ ifdef CMD_EXE NULLDEV = nul: MKDIR = mkdir $(subst /,\,$1) RMDIR = -rmdir /s /q $(subst /,\,$1) - DEL = del /f $(subst /,\,$1) else S = / NOT = ! NULLDEV = /dev/null MKDIR = mkdir -p $1 RMDIR = $(RM) -r $1 - DEL = $(RM) $1 endif ifdef QUIET @@ -28,7 +26,9 @@ endif SIM65FLAGS = -x 200000000 -CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65) +CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65) +CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65) +LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65) SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65) WORKDIR = ../../testwrk/val @@ -50,7 +50,9 @@ define PRG_template $(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR) $(if $(QUIET),echo val/$$*.$1.$2.prg) - $(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$< $(NULLERR) + $(CC65) -t sim$2 $$(CC65FLAGS) -$1 -o $$(@:.prg=.s) $$< $(NULLERR) + $(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR) + $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR) $(NOT) $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT) endef # PRG_template @@ -60,4 +62,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02))) clean: @$(call RMDIR,$(WORKDIR)) - @$(call DEL,$(SOURCES:.c=.o)) diff --git a/test/val/Makefile b/test/val/Makefile index be63cd8da..1a9fa9a45 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -9,13 +9,11 @@ ifdef CMD_EXE NULLDEV = nul: MKDIR = mkdir $(subst /,\,$1) RMDIR = -rmdir /s /q $(subst /,\,$1) - DEL = del /f $(subst /,\,$1) else S = / NULLDEV = /dev/null MKDIR = mkdir -p $1 RMDIR = $(RM) -r $1 - DEL = $(RM) $1 endif ifdef QUIET @@ -26,7 +24,9 @@ endif SIM65FLAGS = -x 5000000000 -CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65) +CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65) +CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65) +LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65) SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65) WORKDIR = ../../testwrk/val @@ -41,11 +41,6 @@ TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02. all: $(TESTS) -# The same input file is processed with different cl65 args, -# but cl65 uses the input file name to make the temp file name, -# and they stomp each other. -.NOTPARALLEL: - $(WORKDIR): $(call MKDIR,$(WORKDIR)) @@ -53,7 +48,9 @@ define PRG_template $(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR) $(if $(QUIET),echo val/$$*.$1.$2.prg) - $(CL65) -t sim$2 $$(CC65FLAGS) -$1 -o $$@ $$< $(NULLERR) + $(CC65) -t sim$2 $$(CC65FLAGS) -$1 -o $$(@:.prg=.s) $$< $(NULLERR) + $(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR) + $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR) $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT) endef # PRG_template @@ -63,4 +60,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02))) clean: @$(call RMDIR,$(WORKDIR)) - @$(call DEL,$(SOURCES:.c=.o)) From c6adf4364fe0ce299a9ef415c3653231045560ad Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 20:53:45 +0200 Subject: [PATCH 10/22] make atari testcode compile again, added makefile --- testcode/lib/atari/Makefile | 32 ++++++++++++++++++++++++++++++++ testcode/lib/atari/multi.xex | Bin 157 -> 0 bytes testcode/lib/atari/scrcode.s | 5 +++++ testcode/lib/atari/sys.c | 2 ++ 4 files changed, 39 insertions(+) create mode 100644 testcode/lib/atari/Makefile delete mode 100644 testcode/lib/atari/multi.xex diff --git a/testcode/lib/atari/Makefile b/testcode/lib/atari/Makefile new file mode 100644 index 000000000..e9ec853b8 --- /dev/null +++ b/testcode/lib/atari/Makefile @@ -0,0 +1,32 @@ + +all: charmapping.xex defdev.xex displaylist.xex mem.xex multi.xex ostype.xex \ + scrcode.com sys.xex + +charmapping.xex: charmapping.c + cl65 -t atari -o charmapping.xex charmapping.c +defdev.xex: defdev.c + cl65 -t atari -o defdev.xex defdev.c +displaylist.xex: displaylist.c + cl65 -t atari -o displaylist.xex displaylist.c +mem.xex: mem.c ../getsp.s + cl65 -t atari -o mem.xex mem.c ../getsp.s +multi.xex: multi-xex.s multi-xex.cfg + cl65 -t atari -C multi-xex.cfg multi-xex.s -o multi.xex +ostype.xex: ostype.c + cl65 -t atari -o ostype.xex ostype.c +scrcode.com: scrcode.s + ca65 -t atari -o scrcode.o scrcode.s + ld65 -C atari-asm.cfg -o scrcode.com scrcode.o +sys.xex: sys.c + cl65 -t atari -o sys.xex sys.c + +clean: + $(RM) charmapping.xex + $(RM) defdev.xex + $(RM) displaylist.xex + $(RM) mem.xex + $(RM) multi.xex + $(RM) ostype.xex + $(RM) scrcode.o + $(RM) scrcode.com + $(RM) sys.xex diff --git a/testcode/lib/atari/multi.xex b/testcode/lib/atari/multi.xex deleted file mode 100644 index 7da39ad47af630bef4edab9f21e06b7162e98e88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 157 zcmezWzkzKz+aiXQbLP4*uVkC+%DnRbTo2~Cp3Eyb=Q=U_ggx=ePfW?oOV%(0lQ&>8 UWCEI?$E4@Op!b03Arpfh0RH4B!2kdN diff --git a/testcode/lib/atari/scrcode.s b/testcode/lib/atari/scrcode.s index cd4290781..ba778579b 100644 --- a/testcode/lib/atari/scrcode.s +++ b/testcode/lib/atari/scrcode.s @@ -43,15 +43,20 @@ key: lda CH dispdata: scrcode "fooBa", 'r', $66, 3+4 disp_len = * - dispdata +.export __AUTOSTART__: absolute = 1 .segment "AUTOSTRT" .word $02E0 .word $02E1 .word __CODE_LOAD__+1 +.export __EXEHDR__: absolute = 1 .segment "EXEHDR" .word $FFFF + +.segment "MAINHDR" + .word __CODE_LOAD__ .word __BSS_LOAD__ - 1 diff --git a/testcode/lib/atari/sys.c b/testcode/lib/atari/sys.c index 9ec7aa631..59debd758 100644 --- a/testcode/lib/atari/sys.c +++ b/testcode/lib/atari/sys.c @@ -10,6 +10,8 @@ #include <6502.h> #include +#define IOCB (OS.iocb[0]) + static struct regs regs; static struct __iocb *iocb = &IOCB; /* use IOCB #0 */ From b0d3b19a6a1c1e56589f1453ccb99dcde63257e2 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 26 Aug 2020 20:58:44 +0200 Subject: [PATCH 11/22] The bug1209 test fails at link stage. --- test/misc/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/misc/Makefile b/test/misc/Makefile index 993a46bd4..1f7a788ba 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -74,19 +74,25 @@ $(WORKDIR)/bug760.$1.$2.prg: bug760.c | $(WORKDIR) $(WORKDIR)/bug1209-ind-goto-rev.$1.$2.prg: bug1209-ind-goto-rev.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/bug1209-ind-goto-rev.$1.$2.prg) - $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR) + $(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR) + $(NOT) $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR) # should compile, but gives an error $(WORKDIR)/bug1209-ind-goto-rev-2.$1.$2.prg: bug1209-ind-goto-rev-2.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/bug1209-ind-goto-rev-2.$1.$2.prg) - $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR) + $(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR) + $(NOT) $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR) # should compile, but gives an error $(WORKDIR)/bug1209-ind-goto-rev-3.$1.$2.prg: bug1209-ind-goto-rev-3.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." $(if $(QUIET),echo misc/bug1209-ind-goto-rev-3.$1.$2.prg) - $(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) + $(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR) + $(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR) + $(NOT) $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR) # should compile, but gives an error $(WORKDIR)/pptest2.$1.$2.prg: pptest2.c | $(WORKDIR) From 8649859bc544d9ebb1c4f8215f00cd303a23438b Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 21:28:19 +0200 Subject: [PATCH 12/22] added/updated Makefiles, preparing for CI (later) --- testcode/lib/accelerator/Makefile | 31 +++++++++++++++++++- testcode/lib/apple2/Makefile | 33 +++++++++++++++++++++- testcode/lib/atari/Makefile | 47 +++++++++++++++++++++++++------ testcode/lib/atari5200/Makefile | 36 +++++++++++++++++++++++ testcode/lib/gamate/Makefile | 41 +++++++++++++++++++++++---- testcode/lib/pce/Makefile | 29 +++++++++++++++++++ 6 files changed, 200 insertions(+), 17 deletions(-) create mode 100644 testcode/lib/atari5200/Makefile diff --git a/testcode/lib/accelerator/Makefile b/testcode/lib/accelerator/Makefile index 6b90a9556..f4f651535 100644 --- a/testcode/lib/accelerator/Makefile +++ b/testcode/lib/accelerator/Makefile @@ -1,4 +1,30 @@ -CL ?= cl65 +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) +endif all: c64-scpu-test.prg c128-scpu-test.prg c64dtv-test.prg \ c64-c128-test.prg c128-test.prg chameleon-test.prg \ @@ -27,3 +53,6 @@ c65-test.prg: c65-test.c turbomaster-test.prg: turbomaster-test.c $(CL) -t c64 turbomaster-test.c -o turbomaster-test.prg + +clean: + $(RM) *.prg diff --git a/testcode/lib/apple2/Makefile b/testcode/lib/apple2/Makefile index 9d551aa62..3ea2463f1 100644 --- a/testcode/lib/apple2/Makefile +++ b/testcode/lib/apple2/Makefile @@ -1,7 +1,33 @@ # For this one see https://applecommander.github.io/ AC ?= ac.jar -CL ?= cl65 +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) +endif all: hgr.dsk dhgr.dsk @@ -35,3 +61,8 @@ dhgr.dsk: dhgrshow dhgrshow: dhgrshow.c $(CL) -Oirs -t apple2enh --start-addr 0x4000 -m dhgrshow.map $^ + +clean: + $(RM) hgr.dsk dhgr.dsk + $(RM) hgrshow hgrshow.map + $(RM) hgrtest hgrtest.map diff --git a/testcode/lib/atari/Makefile b/testcode/lib/atari/Makefile index e9ec853b8..a34a5f2d9 100644 --- a/testcode/lib/atari/Makefile +++ b/testcode/lib/atari/Makefile @@ -1,24 +1,53 @@ +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) +endif + all: charmapping.xex defdev.xex displaylist.xex mem.xex multi.xex ostype.xex \ scrcode.com sys.xex charmapping.xex: charmapping.c - cl65 -t atari -o charmapping.xex charmapping.c + $(CL) -t atari -o charmapping.xex charmapping.c defdev.xex: defdev.c - cl65 -t atari -o defdev.xex defdev.c + $(CL) -t atari -o defdev.xex defdev.c displaylist.xex: displaylist.c - cl65 -t atari -o displaylist.xex displaylist.c + $(CL) -t atari -o displaylist.xex displaylist.c mem.xex: mem.c ../getsp.s - cl65 -t atari -o mem.xex mem.c ../getsp.s + $(CL) -t atari -o mem.xex mem.c ../getsp.s multi.xex: multi-xex.s multi-xex.cfg - cl65 -t atari -C multi-xex.cfg multi-xex.s -o multi.xex + $(CL) -t atari -C multi-xex.cfg multi-xex.s -o multi.xex ostype.xex: ostype.c - cl65 -t atari -o ostype.xex ostype.c + $(CL) -t atari -o ostype.xex ostype.c scrcode.com: scrcode.s - ca65 -t atari -o scrcode.o scrcode.s - ld65 -C atari-asm.cfg -o scrcode.com scrcode.o +# ca65 -t atari -o scrcode.o scrcode.s +# ld65 -C atari-asm.cfg -o scrcode.com scrcode.o + $(CL) -t atari -C atari-asm.cfg -o scrcode.com scrcode.s sys.xex: sys.c - cl65 -t atari -o sys.xex sys.c + $(CL) -t atari -o sys.xex sys.c clean: $(RM) charmapping.xex diff --git a/testcode/lib/atari5200/Makefile b/testcode/lib/atari5200/Makefile new file mode 100644 index 000000000..990ced689 --- /dev/null +++ b/testcode/lib/atari5200/Makefile @@ -0,0 +1,36 @@ + +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) +endif + +all: hello + +hello: hello.c + $(CL) -t atari5200 -o hello hello.c + +clean: + $(RM) hello diff --git a/testcode/lib/gamate/Makefile b/testcode/lib/gamate/Makefile index 2cf98d189..d4f1b9673 100644 --- a/testcode/lib/gamate/Makefile +++ b/testcode/lib/gamate/Makefile @@ -1,14 +1,42 @@ +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) +endif + all: audiotest.bin lcdtest.bin ctest.bin audiotest.bin: audiotest.s - ../../../bin/cl65 -l audiotest.lst -t gamate -o audiotest.bin audiotest.s + $(CL) -l audiotest.lst -t gamate -o audiotest.bin audiotest.s lcdtest.bin: lcdtest.s - ../../../bin/cl65 -l lcdtest.lst -t gamate -o lcdtest.bin lcdtest.s + $(CL) -l lcdtest.lst -t gamate -o lcdtest.bin lcdtest.s ctest.bin: ctest.c - ../../../bin/cl65 -l ctest.lst -t gamate -o ctest.bin ctest.c + $(CL) -l ctest.lst -t gamate -o ctest.bin ctest.c nachtm.bin: nachtm.c - ../../../bin/cl65 -Os -l nachtm.lst -t gamate -o nachtm.bin nachtm.c + $(CL) -Os -l nachtm.lst -t gamate -o nachtm.bin nachtm.c gamate-fixcart nachtm.bin test1: lcdtest.bin @@ -21,5 +49,6 @@ testn: nachtm.bin cd ~/Desktop/mame/winmess/ && wine mess.exe gamate -window -skip_gameinfo -cart ~/Desktop/cc65/github/cc65/testcode/lib/gamate/nachtm.bin clean: - rm -f lcdtest.o audiotest.o ctest.o - rm -f lcdtest.bin audiotest.bin ctest.bin nachtm.bin + $(RM) lcdtest.o audiotest.o ctest.o + $(RM) lcdtest.bin audiotest.bin ctest.bin nachtm.bin + $(RM) audiotest.lst lcdtest.lst ctest.lst diff --git a/testcode/lib/pce/Makefile b/testcode/lib/pce/Makefile index a4a495c9a..0c41778cc 100644 --- a/testcode/lib/pce/Makefile +++ b/testcode/lib/pce/Makefile @@ -1,3 +1,32 @@ + +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) +endif + .PHONY: all clean test # Size of cartridge to generate. From f5b1b69376f978223dfabe535f23a5ec03bb3dc2 Mon Sep 17 00:00:00 2001 From: acqn Date: Sat, 15 Aug 2020 06:27:11 +0800 Subject: [PATCH 13/22] Forbid struct/union fields of incomplete types. --- src/cc65/declare.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/cc65/declare.c b/src/cc65/declare.c index ccd4e9004..6c1dbd751 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -911,8 +911,15 @@ static SymEntry* ParseUnionDecl (const char* Name) } } + /* Check for incomplete type */ + if (IsIncompleteESUType (Decl.Type)) { + Error ("Field '%s' has incomplete type '%s'", + Decl.Ident, + GetFullTypeName (Decl.Type)); + } + /* Handle sizes */ - FieldSize = CheckedSizeOf (Decl.Type); + FieldSize = SizeOf (Decl.Type); if (FieldSize > UnionSize) { UnionSize = FieldSize; } @@ -1095,6 +1102,13 @@ static SymEntry* ParseStructDecl (const char* Name) } } + /* Check for incomplete type */ + if (IsIncompleteESUType (Decl.Type)) { + Error ("Field '%s' has incomplete type '%s'", + Decl.Ident, + GetFullTypeName (Decl.Type)); + } + /* Add a field entry to the table */ if (FieldWidth > 0) { /* Full bytes have already been added to the StructSize, @@ -1119,7 +1133,7 @@ static SymEntry* ParseStructDecl (const char* Name) AddLocalSym (Decl.Ident, Decl.Type, SC_STRUCTFIELD, StructSize); } if (!FlexibleMember) { - StructSize += CheckedSizeOf (Decl.Type); + StructSize += SizeOf (Decl.Type); } } From 1957dc7a5c36bab15fd2021ce52b5b7e4f2f7479 Mon Sep 17 00:00:00 2001 From: acqn Date: Sat, 15 Aug 2020 06:27:11 +0800 Subject: [PATCH 14/22] Disallowed arrays of incomplete types. Fixed diagnostics on incomplete local arrays. --- src/cc65/compile.c | 21 +++------------ src/cc65/declare.c | 67 ++++++++++++++++++++++++++++++++++++---------- src/cc65/locals.c | 18 ++++++++++--- 3 files changed, 72 insertions(+), 34 deletions(-) diff --git a/src/cc65/compile.c b/src/cc65/compile.c index 82dc7ec63..3296968f6 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -140,19 +140,10 @@ static void Parse (void) comma = 0; while (1) { - Declaration Decl; + Declaration Decl; /* Read the next declaration */ ParseDecl (&Spec, &Decl, DM_NEED_IDENT); - if (Decl.Ident[0] == '\0') { - NextToken (); - break; - } - - if ((Decl.StorageClass & SC_FICTITIOUS) == SC_FICTITIOUS) { - /* Failed parsing */ - goto SkipOneDecl; - } /* Check if we must reserve storage for the variable. We do this, ** @@ -163,8 +154,9 @@ static void Parse (void) ** ** This means that "extern int i;" will not get storage allocated. */ - if ((Decl.StorageClass & SC_FUNC) != SC_FUNC && - (Decl.StorageClass & SC_TYPEMASK) != SC_TYPEDEF) { + if ((Decl.StorageClass & SC_FUNC) != SC_FUNC && + (Decl.StorageClass & SC_TYPEMASK) != SC_TYPEDEF && + (Decl.StorageClass & SC_FICTITIOUS) != SC_FICTITIOUS) { if ((Spec.Flags & DS_DEF_STORAGE) != 0 || (Decl.StorageClass & (SC_EXTERN|SC_STATIC)) == SC_STATIC || ((Decl.StorageClass & SC_EXTERN) != 0 && @@ -296,7 +288,6 @@ static void Parse (void) } -SkipOneDecl: /* Check for end of declaration list */ if (CurTok.Tok == TOK_COMMA) { NextToken (); @@ -452,10 +443,6 @@ void Compile (const char* FileName) } Sym = GetSymType (GetElementType (Entry->Type)); - if (Size == 0 && Sym != 0 && SymIsDef (Sym)) { - /* Array of 0-size elements */ - Warning ("Array '%s[]' has 0-sized elements", Entry->Name); - } } /* For non-ESU types, Size != 0 */ diff --git a/src/cc65/declare.c b/src/cc65/declare.c index 6c1dbd751..0bfbcedd2 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -457,6 +457,37 @@ static unsigned ParseOneStorageClass (void) +static void CheckArrayElementType (Type* DataType) +/* Check if data type consists of arrays of incomplete element types */ +{ + Type* T = DataType; + + while (T->C != T_END) { + if (IsTypeArray (T)) { + ++T; + if (IsIncompleteESUType (T)) { + /* We cannot have an array of incomplete elements */ + Error ("Array of incomplete element type '%s'", GetFullTypeName (T)); + } else if (SizeOf (T) == 0) { + /* If the array is multi-dimensional, try to get the true + ** element type. + */ + if (IsTypeArray (T)) { + continue; + } + /* We could support certain 0-size element types as an extension */ + if (!IsTypeVoid (T) || IS_Get (&Standard) != STD_CC65) { + Error ("Array of 0-size element type '%s'", GetFullTypeName (T)); + } + } + } else { + ++T; + } + } +} + + + static void ParseStorageClass (DeclSpec* D, unsigned DefStorage) /* Parse a storage class */ { @@ -956,16 +987,16 @@ NextMember: if (CurTok.Tok != TOK_COMMA) { FieldTab = GetSymTab (); LeaveStructLevel (); - /* Empty union is not supported now */ - if (UnionSize == 0) { - Error ("Empty union type '%s' is not supported", Name); - } - /* Return a fictitious symbol if errors occurred during parsing */ if (PrevErrorCount != ErrorCount) { Flags |= SC_FICTITIOUS; } + /* Empty union is not supported now */ + if (UnionSize == 0) { + Error ("Empty union type '%s' is not supported", Name); + } + /* Make a real entry from the forward decl and return it */ return AddStructSym (Name, SC_UNION | SC_DEF | Flags, UnionSize, FieldTab); } @@ -1160,16 +1191,16 @@ NextMember: if (CurTok.Tok != TOK_COMMA) { FieldTab = GetSymTab (); LeaveStructLevel (); - /* Empty struct is not supported now */ - if (StructSize == 0) { - Error ("Empty struct type '%s' is not supported", Name); - } - /* Return a fictitious symbol if errors occurred during parsing */ if (PrevErrorCount != ErrorCount) { Flags |= SC_FICTITIOUS; } + /* Empty struct is not supported now */ + if (StructSize == 0) { + Error ("Empty struct type '%s' is not supported", Name); + } + /* Make a real entry from the forward decl and return it */ return AddStructSym (Name, SC_STRUCT | SC_DEF | Flags, StructSize, FieldTab); } @@ -1922,6 +1953,9 @@ void ParseDecl (const DeclSpec* Spec, Declaration* D, declmode_t Mode) /* Do several fixes on qualifiers */ FixQualifiers (D->Type); + /* Check if the data type consists of any arrays of forbidden types */ + CheckArrayElementType (D->Type); + /* If we have a function, add a special storage class */ if (IsTypeFunc (D->Type)) { D->StorageClass |= SC_FUNC; @@ -1993,10 +2027,15 @@ void ParseDecl (const DeclSpec* Spec, Declaration* D, declmode_t Mode) Error ("Invalid size in declaration (0x%06X)", Size); } } + } - if (PrevErrorCount != ErrorCount) { - /* Don't give storage if the declaration is not parsed correctly */ - D->StorageClass |= SC_DECL | SC_FICTITIOUS; + if (PrevErrorCount != ErrorCount) { + /* Make the declaration fictitious if is is not parsed correctly */ + D->StorageClass |= SC_DECL | SC_FICTITIOUS; + + if (Mode == DM_NEED_IDENT && D->Ident[0] == '\0') { + /* Use a fictitious name for the identifier if it is missing */ + AnonName (D->Ident, "global"); } } } @@ -2242,7 +2281,7 @@ static unsigned ParseArrayInit (Type* T, int* Braces, int AllowFlexibleMembers) /* Get the array data */ Type* ElementType = GetElementType (T); - unsigned ElementSize = CheckedSizeOf (ElementType); + unsigned ElementSize = SizeOf (ElementType); long ElementCount = GetElementCount (T); /* Special handling for a character array initialized by a literal */ diff --git a/src/cc65/locals.c b/src/cc65/locals.c index a21a09e8e..4323943a1 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -172,7 +172,11 @@ static void ParseRegisterDecl (Declaration* Decl, int Reg) /* Cannot allocate a variable of zero size */ if (Size == 0) { - Error ("Variable '%s' has unknown size", Decl->Ident); + if (IsTypeArray (Decl->Type)) { + Error ("Array '%s' has unknown size", Decl->Ident); + } else { + Error ("Variable '%s' has unknown size", Decl->Ident); + } } } @@ -357,7 +361,11 @@ static void ParseAutoDecl (Declaration* Decl) /* Cannot allocate a variable of zero size */ if (Size == 0) { - Error ("Variable '%s' has unknown size", Decl->Ident); + if (IsTypeArray (Decl->Type)) { + Error ("Array '%s' has unknown size", Decl->Ident); + } else { + Error ("Variable '%s' has unknown size", Decl->Ident); + } } } @@ -411,7 +419,11 @@ static void ParseStaticDecl (Declaration* Decl) /* Cannot allocate a variable of zero size */ if (Size == 0) { - Error ("Variable '%s' has unknown size", Decl->Ident); + if (IsTypeArray (Decl->Type)) { + Error ("Array '%s' has unknown size", Decl->Ident); + } else { + Error ("Variable '%s' has unknown size", Decl->Ident); + } } } From 43cb092a68004768baa28cdb41831c1d2d1a52e7 Mon Sep 17 00:00:00 2001 From: acqn Date: Sat, 22 Aug 2020 05:56:33 +0800 Subject: [PATCH 15/22] Fixed CHECK failures on certain usage of incomplete enums. --- src/cc65/datatype.c | 14 +++++++++++--- src/cc65/loadexpr.c | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index ad008cfd3..9efb142ee 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -686,7 +686,10 @@ const Type* GetUnderlyingType (const Type* Type) Internal ("Enum tag type error in GetUnderlyingTypeCode"); } - return ((SymEntry*)Type->A.P)->V.E.Type; + /* If incomplete enum type is used, just return its raw type */ + if (((SymEntry*)Type->A.P)->V.E.Type != 0) { + return ((SymEntry*)Type->A.P)->V.E.Type; + } } return Type; @@ -1246,9 +1249,14 @@ Type* IntPromotion (Type* T) ** to unsigned int. */ return IsSignUnsigned (T) ? type_uint : type_int; - } else { - /* Otherwise, the type is not smaller than int, so leave it alone. */ + } else if (!IsIncompleteESUType (T)) { + /* The type is a complete type not smaller than int, so leave it alone. */ return T; + } else { + /* Otherwise, this is an incomplete enum, and there is expceted to be an error already. + ** Assume int to avoid further errors. + */ + return type_int; } } diff --git a/src/cc65/loadexpr.c b/src/cc65/loadexpr.c index f3a1a6add..07f88acbc 100644 --- a/src/cc65/loadexpr.c +++ b/src/cc65/loadexpr.c @@ -142,6 +142,10 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) BitFieldFullWidthFlags |= CF_UNSIGNED; } } else if ((Flags & CF_TYPEMASK) == 0) { + /* If Expr is an incomplete ESY type, bail out */ + if (IsIncompleteESUType (Expr->Type)) { + return; + } Flags |= TypeOf (Expr->Type); } From 8d225c32b194f1bb3e2c1606ec55b41b3eca6c76 Mon Sep 17 00:00:00 2001 From: acqn Date: Sat, 22 Aug 2020 05:57:12 +0800 Subject: [PATCH 16/22] Fixed checks on assignment to incomplete types. --- src/cc65/assignment.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cc65/assignment.c b/src/cc65/assignment.c index 6acab3fe8..633083669 100644 --- a/src/cc65/assignment.c +++ b/src/cc65/assignment.c @@ -156,6 +156,11 @@ void Assignment (ExprDesc* Expr) Error ("Assignment to const"); } + /* Check for assignment to incomplete type */ + if (IsIncompleteESUType (ltype)) { + Error ("Assignment to incomplete type '%s'", GetFullTypeName (ltype)); + } + /* Skip the '=' token */ NextToken (); From bb9c2032224a9abd034f8fcb17699048ac351e00 Mon Sep 17 00:00:00 2001 From: acqn Date: Sat, 15 Aug 2020 07:53:28 +0800 Subject: [PATCH 17/22] Fixed integer promotion of unary operations. --- src/cc65/expr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 12a0c0b57..9f7902284 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1856,8 +1856,8 @@ static void UnaryOp (ExprDesc* Expr) /* Value is not constant */ LoadExpr (CF_NONE, Expr); - /* Get the type of the expression */ - Flags = TypeOf (Expr->Type); + /* Adjust the type of the value */ + Flags = g_typeadjust (TypeOf (Expr->Type), TypeOf (type_int) | CF_CONST); /* Handle the operation */ switch (Tok) { @@ -1870,6 +1870,9 @@ static void UnaryOp (ExprDesc* Expr) /* The result is an rvalue in the primary */ ED_FinalizeRValLoad (Expr); } + + /* Adjust the type of the expression */ + Expr->Type = IntPromotion (Expr->Type); } From bf5384a7124de8b44847f57ae7e209e85de5cc4d Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 22:46:45 +0200 Subject: [PATCH 18/22] some more refactoring of Makefiles, preparing for CI --- testcode/assembler/Makefile | 37 ++++++++++++++++++++++ testcode/disasm/Makefile | 58 ++++++++++++++++++++++++++++++++++ testcode/disasm/sample-unix.mk | 28 ---------------- 3 files changed, 95 insertions(+), 28 deletions(-) create mode 100644 testcode/assembler/Makefile create mode 100644 testcode/disasm/Makefile delete mode 100644 testcode/disasm/sample-unix.mk diff --git a/testcode/assembler/Makefile b/testcode/assembler/Makefile new file mode 100644 index 000000000..6cb3fe1f2 --- /dev/null +++ b/testcode/assembler/Makefile @@ -0,0 +1,37 @@ + +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) +endif + +all: paramcount.o + +paramcount.o: paramcount.s + $(AS) -o paramcount.o -l paramcount.lst paramcount.s + +clean: + $(RM) paramcount.o + $(RM) paramcount.lst diff --git a/testcode/disasm/Makefile b/testcode/disasm/Makefile new file mode 100644 index 000000000..05e5b8373 --- /dev/null +++ b/testcode/disasm/Makefile @@ -0,0 +1,58 @@ +# Sample makefile using a preprocessor against info files +# and the --sync-lines option + +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 + DA = $(CC65_HOME)/bin/da65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) + DA := $(if $(wildcard ../../../bin/da65*),../../../bin/da65,da65) +endif + +CPP = env LANG=C cpp +CPPFLAGS = # -DTEST_ERROR + +ASMS = fixed.s bank0.s bank1.s +DAIS = fixed.dai bank0.dai bank1.dai + +.SUFFIXES: .da .dai .s +.PHONY: all clean maintainer-clean +.SECONDARY: $(DAIS) + +.da.dai: + $(CPP) -o $@ $(CPPFLAGS) $< + +.dai.s: + $(DA) --sync-lines -o $@ -i $< image.bin + +all: $(ASMS) + +clean: + $(RM) $(ASMS) + +maintainer-clean: clean + $(RM) $(DAIS) + +$(DAIS): fixed.da diff --git a/testcode/disasm/sample-unix.mk b/testcode/disasm/sample-unix.mk deleted file mode 100644 index 0ef64a5e5..000000000 --- a/testcode/disasm/sample-unix.mk +++ /dev/null @@ -1,28 +0,0 @@ -# Sample makefile using a preprocessor against info files -# and the --sync-lines option - -CPP = env LANG=C cpp -CPPFLAGS = # -DTEST_ERROR - -ASMS = fixed.s bank0.s bank1.s -DAIS = fixed.dai bank0.dai bank1.dai - -.SUFFIXES: .da .dai .s -.PHONY: all clean maintainer-clean -.SECONDARY: $(DAIS) - -.da.dai: - $(CPP) -o $@ $(CPPFLAGS) $< - -.dai.s: - da65 --sync-lines -o $@ -i $< image.bin - -all: $(ASMS) - -clean: - rm -f $(ASMS) - -maintainer-clean: clean - rm -f $(DAIS) - -$(DAIS): fixed.da From 39a3de3119bda406c8a51625b35f20851a02060a Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 22:47:47 +0200 Subject: [PATCH 19/22] made geoslib testcode compile again, added the required linker config and a Makefile --- testcode/grc/Makefile | 43 ++++++++++++++++ testcode/grc/geos-cbm-overlay.cfg | 84 +++++++++++++++++++++++++++++++ testcode/grc/vlir0.s | 8 +-- testcode/grc/vlir1.s | 8 +-- testcode/grc/vlir2.s | 8 +-- 5 files changed, 139 insertions(+), 12 deletions(-) create mode 100644 testcode/grc/Makefile create mode 100644 testcode/grc/geos-cbm-overlay.cfg diff --git a/testcode/grc/Makefile b/testcode/grc/Makefile new file mode 100644 index 000000000..4df2f17bc --- /dev/null +++ b/testcode/grc/Makefile @@ -0,0 +1,43 @@ + +# Just the usual way to find out if we're +# using cmd.exe to execute make rules. +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + NULLDEV = nul: + DEL = -del /f + RMDIR = rmdir /s /q +else + NULLDEV = /dev/null + DEL = $(RM) + RMDIR = $(RM) -r +endif + +ifdef CC65_HOME + AS = $(CC65_HOME)/bin/ca65 + CC = $(CC65_HOME)/bin/cc65 + CL = $(CC65_HOME)/bin/cl65 + LD = $(CC65_HOME)/bin/ld65 + GRC = $(CC65_HOME)/bin/grc65 +else + AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65) + CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65) + CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65) + LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) + GRC := $(if $(wildcard ../../../bin/grc65*),../../../bin/grc65,grc65) +endif + +all: test.s vlir.cvt + +test.s: test.grc + $(GRC) -s test.s test.grc + +vlir.cvt: vlir.grc + $(GRC) -s vlir.s test.grc + $(CL) -t geos -C geos-cbm-overlay.cfg -o vlir.cvt vlir.s vlir0.s vlir1.s vlir2.s + +clean: + $(RM) test.s test.h + $(RM) vlir.s vlir.cvt diff --git a/testcode/grc/geos-cbm-overlay.cfg b/testcode/grc/geos-cbm-overlay.cfg new file mode 100644 index 000000000..ddf1d1e1f --- /dev/null +++ b/testcode/grc/geos-cbm-overlay.cfg @@ -0,0 +1,84 @@ +FEATURES { + STARTADDRESS: default = $0400; +} +SYMBOLS { + __BACKBUFSIZE__: type = weak, value = $2000; + __HIMEM__: type = weak, value = $8000 - __BACKBUFSIZE__; + __OVERLAYSIZE__: type = weak, value = $1000; + __OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__; + __STACKSIZE__: type = weak, value = $0400; # 1k stack + __STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__; +} +MEMORY { + CVT: file = %O, start = $0, size = $40000; + ZP: define = yes, start = $58, size = $1A + $06; + VLIR0: define = yes, start = %S, size = __STACKADDR__ - %S; + VLIR1: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR2: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR3: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR4: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR5: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR6: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR7: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR8: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR9: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR10: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR11: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR12: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR13: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR14: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR15: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR16: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR17: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR18: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; + VLIR19: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; +} +SEGMENTS { + ZEROPAGE: type = zp, load = ZP; + EXTZP: type = zp, load = ZP, optional = yes; + DIRENTRY: type = ro, load = CVT, align = $FE; + FILEINFO: type = ro, load = CVT, align = $FE; + RECORDS: type = ro, load = CVT, align = $FE, optional = yes; + STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $FE, define = yes; + LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes; + ONCE: type = ro, run = VLIR0, load = CVT, optional = yes; + CODE: type = ro, run = VLIR0, load = CVT; + RODATA: type = ro, run = VLIR0, load = CVT; + DATA: type = rw, run = VLIR0, load = CVT; + INIT: type = bss, load = VLIR0, optional = yes; + BSS: type = bss, load = VLIR0, define = yes; + OVERLAY1: type = ro, run = VLIR1, load = CVT, align_load = $FE, optional = yes; + OVERLAY2: type = ro, run = VLIR2, load = CVT, align_load = $FE, optional = yes; + OVERLAY3: type = ro, run = VLIR3, load = CVT, align_load = $FE, optional = yes; + OVERLAY4: type = ro, run = VLIR4, load = CVT, align_load = $FE, optional = yes; + OVERLAY5: type = ro, run = VLIR5, load = CVT, align_load = $FE, optional = yes; + OVERLAY6: type = ro, run = VLIR6, load = CVT, align_load = $FE, optional = yes; + OVERLAY7: type = ro, run = VLIR7, load = CVT, align_load = $FE, optional = yes; + OVERLAY8: type = ro, run = VLIR8, load = CVT, align_load = $FE, optional = yes; + OVERLAY9: type = ro, run = VLIR9, load = CVT, align_load = $FE, optional = yes; + OVERLAY10: type = ro, run = VLIR10, load = CVT, align_load = $FE, optional = yes; + OVERLAY11: type = ro, run = VLIR11, load = CVT, align_load = $FE, optional = yes; + OVERLAY12: type = ro, run = VLIR12, load = CVT, align_load = $FE, optional = yes; + OVERLAY13: type = ro, run = VLIR13, load = CVT, align_load = $FE, optional = yes; + OVERLAY14: type = ro, run = VLIR14, load = CVT, align_load = $FE, optional = yes; + OVERLAY15: type = ro, run = VLIR15, load = CVT, align_load = $FE, optional = yes; + OVERLAY16: type = ro, run = VLIR16, load = CVT, align_load = $FE, optional = yes; + OVERLAY17: type = ro, run = VLIR17, load = CVT, align_load = $FE, optional = yes; + OVERLAY18: type = ro, run = VLIR18, load = CVT, align_load = $FE, optional = yes; + OVERLAY19: type = ro, run = VLIR19, load = CVT, align_load = $FE, optional = yes; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = ONCE; + CONDES: type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__, + segment = RODATA; + CONDES: type = interruptor, + label = __INTERRUPTOR_TABLE__, + count = __INTERRUPTOR_COUNT__, + segment = RODATA, + import = __CALLIRQ__; +} diff --git a/testcode/grc/vlir0.s b/testcode/grc/vlir0.s index 2e9a3ffd9..a54d406df 100644 --- a/testcode/grc/vlir0.s +++ b/testcode/grc/vlir0.s @@ -5,10 +5,10 @@ ; include some GEOS defines - .include "../../libsrc/geos/inc/const.inc" - .include "../../libsrc/geos/inc/jumptab.inc" - .include "../../libsrc/geos/inc/geossym.inc" - .include "../../libsrc/geos/inc/geosmac.inc" + .include "../../libsrc/geos-common/const.inc" + .include "../../libsrc/geos-cbm/jumptab.inc" + .include "../../libsrc/geos-cbm/geossym.inc" + .include "../../libsrc/geos-common/geosmac.inc" ; import load addresses for all VLIR chains ; these labels are defined upon linking with ld65 diff --git a/testcode/grc/vlir1.s b/testcode/grc/vlir1.s index eae34565e..6ee3cca37 100644 --- a/testcode/grc/vlir1.s +++ b/testcode/grc/vlir1.s @@ -5,10 +5,10 @@ ; include some GEOS defines - .include "../../libsrc/geos/inc/const.inc" - .include "../../libsrc/geos/inc/jumptab.inc" - .include "../../libsrc/geos/inc/geossym.inc" - .include "../../libsrc/geos/inc/geosmac.inc" + .include "../../libsrc/geos-common/const.inc" + .include "../../libsrc/geos-cbm/jumptab.inc" + .include "../../libsrc/geos-cbm/geossym.inc" + .include "../../libsrc/geos-common/geosmac.inc" ; export names of functions that will be used in the main program diff --git a/testcode/grc/vlir2.s b/testcode/grc/vlir2.s index 9d180c847..4c02983ff 100644 --- a/testcode/grc/vlir2.s +++ b/testcode/grc/vlir2.s @@ -5,10 +5,10 @@ ; similar to vlir1.s except the fact that this is chain #2 - .include "../../libsrc/geos/inc/const.inc" - .include "../../libsrc/geos/inc/jumptab.inc" - .include "../../libsrc/geos/inc/geossym.inc" - .include "../../libsrc/geos/inc/geosmac.inc" + .include "../../libsrc/geos-common/const.inc" + .include "../../libsrc/geos-cbm/jumptab.inc" + .include "../../libsrc/geos-cbm/geossym.inc" + .include "../../libsrc/geos-common/geosmac.inc" .export OVERLAY2_Function1 .export OVERLAY2_Function2 From c1a514c0f8c6a41b0b971cd772ce724f9dfc888f Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Aug 2020 23:20:28 +0200 Subject: [PATCH 20/22] added test related to issue #1201 --- test/val/bug1201.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/val/bug1201.c diff --git a/test/val/bug1201.c b/test/val/bug1201.c new file mode 100644 index 000000000..6d194fbee --- /dev/null +++ b/test/val/bug1201.c @@ -0,0 +1,25 @@ + +/* bug #1201 - The unary operators +, - and ~ should do integer promote on the result types. */ + +char a; +short b; +int c; +long d; +enum E { + Z +} e; +struct S { + int a : 1; +} f; + +_Static_assert(sizeof(+a) == sizeof(int), "Result type should be int"); +_Static_assert(sizeof(+b) == sizeof(int), "Result type should be int"); +_Static_assert(sizeof(+c) == sizeof(int), "Result type should be int"); +_Static_assert(sizeof(+d) == sizeof(long), "Result type should be long"); +_Static_assert(sizeof(+e) == sizeof(int), "Result type should be int"); +_Static_assert(sizeof(+f.a) == sizeof(int), "Result type should be int"); + +int main(void) +{ + return 0; +} From 41dbd31b02b00c3b4120b7dfafedc85b6c879dca Mon Sep 17 00:00:00 2001 From: mrdudz Date: Thu, 27 Aug 2020 00:04:34 +0200 Subject: [PATCH 21/22] fix makefile, remove the unneeded .cfg again. oops :) --- testcode/grc/Makefile | 17 +++++-- testcode/grc/geos-cbm-overlay.cfg | 84 ------------------------------- 2 files changed, 13 insertions(+), 88 deletions(-) delete mode 100644 testcode/grc/geos-cbm-overlay.cfg diff --git a/testcode/grc/Makefile b/testcode/grc/Makefile index 4df2f17bc..793506890 100644 --- a/testcode/grc/Makefile +++ b/testcode/grc/Makefile @@ -34,10 +34,19 @@ all: test.s vlir.cvt test.s: test.grc $(GRC) -s test.s test.grc -vlir.cvt: vlir.grc - $(GRC) -s vlir.s test.grc - $(CL) -t geos -C geos-cbm-overlay.cfg -o vlir.cvt vlir.s vlir0.s vlir1.s vlir2.s +vlir.cvt: vlir.grc vlir0.s vlir1.s vlir2.s +# using seperate calls here for demonstration purposes: + $(GRC) -t geos-cbm -s vlir.s vlir.grc + $(AS) -t geos-cbm vlir.s + $(AS) -t geos-cbm vlir0.s + $(AS) -t geos-cbm vlir1.s + $(AS) -t geos-cbm vlir2.s + $(LD) -t geos-cbm -o vlir.cvt vlir.o vlir0.o vlir1.o vlir2.o geos-cbm.lib + +# you can also do the above in one command: +# $(CL) -t geos-cbm -o vlir.cvt vlir.grc vlir0.s vlir1.s vlir2.s clean: $(RM) test.s test.h - $(RM) vlir.s vlir.cvt + $(RM) vlir.s vlir.cvt vlir.c vlir.h + $(RM) *.o diff --git a/testcode/grc/geos-cbm-overlay.cfg b/testcode/grc/geos-cbm-overlay.cfg deleted file mode 100644 index ddf1d1e1f..000000000 --- a/testcode/grc/geos-cbm-overlay.cfg +++ /dev/null @@ -1,84 +0,0 @@ -FEATURES { - STARTADDRESS: default = $0400; -} -SYMBOLS { - __BACKBUFSIZE__: type = weak, value = $2000; - __HIMEM__: type = weak, value = $8000 - __BACKBUFSIZE__; - __OVERLAYSIZE__: type = weak, value = $1000; - __OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__; - __STACKSIZE__: type = weak, value = $0400; # 1k stack - __STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__; -} -MEMORY { - CVT: file = %O, start = $0, size = $40000; - ZP: define = yes, start = $58, size = $1A + $06; - VLIR0: define = yes, start = %S, size = __STACKADDR__ - %S; - VLIR1: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR2: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR3: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR4: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR5: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR6: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR7: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR8: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR9: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR10: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR11: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR12: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR13: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR14: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR15: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR16: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR17: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR18: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; - VLIR19: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; -} -SEGMENTS { - ZEROPAGE: type = zp, load = ZP; - EXTZP: type = zp, load = ZP, optional = yes; - DIRENTRY: type = ro, load = CVT, align = $FE; - FILEINFO: type = ro, load = CVT, align = $FE; - RECORDS: type = ro, load = CVT, align = $FE, optional = yes; - STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $FE, define = yes; - LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes; - ONCE: type = ro, run = VLIR0, load = CVT, optional = yes; - CODE: type = ro, run = VLIR0, load = CVT; - RODATA: type = ro, run = VLIR0, load = CVT; - DATA: type = rw, run = VLIR0, load = CVT; - INIT: type = bss, load = VLIR0, optional = yes; - BSS: type = bss, load = VLIR0, define = yes; - OVERLAY1: type = ro, run = VLIR1, load = CVT, align_load = $FE, optional = yes; - OVERLAY2: type = ro, run = VLIR2, load = CVT, align_load = $FE, optional = yes; - OVERLAY3: type = ro, run = VLIR3, load = CVT, align_load = $FE, optional = yes; - OVERLAY4: type = ro, run = VLIR4, load = CVT, align_load = $FE, optional = yes; - OVERLAY5: type = ro, run = VLIR5, load = CVT, align_load = $FE, optional = yes; - OVERLAY6: type = ro, run = VLIR6, load = CVT, align_load = $FE, optional = yes; - OVERLAY7: type = ro, run = VLIR7, load = CVT, align_load = $FE, optional = yes; - OVERLAY8: type = ro, run = VLIR8, load = CVT, align_load = $FE, optional = yes; - OVERLAY9: type = ro, run = VLIR9, load = CVT, align_load = $FE, optional = yes; - OVERLAY10: type = ro, run = VLIR10, load = CVT, align_load = $FE, optional = yes; - OVERLAY11: type = ro, run = VLIR11, load = CVT, align_load = $FE, optional = yes; - OVERLAY12: type = ro, run = VLIR12, load = CVT, align_load = $FE, optional = yes; - OVERLAY13: type = ro, run = VLIR13, load = CVT, align_load = $FE, optional = yes; - OVERLAY14: type = ro, run = VLIR14, load = CVT, align_load = $FE, optional = yes; - OVERLAY15: type = ro, run = VLIR15, load = CVT, align_load = $FE, optional = yes; - OVERLAY16: type = ro, run = VLIR16, load = CVT, align_load = $FE, optional = yes; - OVERLAY17: type = ro, run = VLIR17, load = CVT, align_load = $FE, optional = yes; - OVERLAY18: type = ro, run = VLIR18, load = CVT, align_load = $FE, optional = yes; - OVERLAY19: type = ro, run = VLIR19, load = CVT, align_load = $FE, optional = yes; -} -FEATURES { - CONDES: type = constructor, - label = __CONSTRUCTOR_TABLE__, - count = __CONSTRUCTOR_COUNT__, - segment = ONCE; - CONDES: type = destructor, - label = __DESTRUCTOR_TABLE__, - count = __DESTRUCTOR_COUNT__, - segment = RODATA; - CONDES: type = interruptor, - label = __INTERRUPTOR_TABLE__, - count = __INTERRUPTOR_COUNT__, - segment = RODATA, - import = __CALLIRQ__; -} From 7a453d1f901da8d0686d30b13d6bd672e471a39c Mon Sep 17 00:00:00 2001 From: mrdudz Date: Thu, 27 Aug 2020 00:08:22 +0200 Subject: [PATCH 22/22] add a "disk" target to build the disk images as suggested by Oliver --- testcode/lib/apple2/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testcode/lib/apple2/Makefile b/testcode/lib/apple2/Makefile index 3ea2463f1..0020b4ec5 100644 --- a/testcode/lib/apple2/Makefile +++ b/testcode/lib/apple2/Makefile @@ -29,7 +29,9 @@ else LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65) endif -all: hgr.dsk dhgr.dsk +all: hgrshow hgrtest dhgrshow + +disk: hgr.dsk dhgr.dsk hgr.dsk: hgrshow hgrtest cp prodos.dsk $@ @@ -66,3 +68,4 @@ clean: $(RM) hgr.dsk dhgr.dsk $(RM) hgrshow hgrshow.map $(RM) hgrtest hgrtest.map + $(RM) dhgrshow dhgrshow.map