[ prog / sol / mona ]

prog


What are you working on?

183 2023-01-25 21:39

The first group of Gens 2.14 >>182 make errors is in this style:

gens_core/cpu/68k/cpu_68k.c:27:24: error: initializer element is not constant

https://sourceforge.net/p/gens/bugs/27/
#27 failure to compile with gcc 3.4

The non-constant initializers can be put into some convenient place. From the cpu_68k.h functions the one that is invoked first by src/gens/emulator/g_main.c:main is M68K_Init. Hopefully moving the non-constant initializers into M68K_Init will prevent the rest of the code from seeing constant placeholder values in the initializers. Changes:

--- cpu_68k.c.original
+++ cpu_68k.c
@@ -24,9 +24,9 @@
 
 struct STARSCREAM_PROGRAMREGION M68K_Fetch[] = {
   {0x000000, 0x3FFFFF, (unsigned) 0x000000},
-  {0xFF0000, 0xFFFFFF, (unsigned) &Ram_68k[0] - 0xFF0000},
-  {0xF00000, 0xF0FFFF, (unsigned) &Ram_68k[0] - 0xF00000},
-  {0xEF0000, 0xEFFFFF, (unsigned) &Ram_68k[0] - 0xEF0000},
+  {0xFF0000, 0xFFFFFF, (unsigned) NULL},
+  {0xF00000, 0xF0FFFF, (unsigned) NULL},
+  {0xEF0000, 0xEFFFFF, (unsigned) NULL},
   {-1, -1, (unsigned) NULL},
   {-1, -1, (unsigned) NULL},
   {-1, -1, (unsigned) NULL}
@@ -60,7 +60,7 @@
 
 
 struct STARSCREAM_PROGRAMREGION S68K_Fetch[] = {
-  {0x000000, 0x07FFFF, (unsigned) &Ram_Prg[0]},
+  {0x000000, 0x07FFFF, (unsigned) NULL},
   {-1, -1, (unsigned) NULL},
   {-1, -1, (unsigned) NULL}
 };
@@ -109,6 +109,15 @@
 int
 M68K_Init (void)
 {
+
+//gens_core/cpu/68k/cpu_68k.c:27:24: error: initializer element is not constant
+M68K_Fetch[1].offset = (unsigned) &Ram_68k[0] - 0xFF0000;
+M68K_Fetch[2].offset = (unsigned) &Ram_68k[0] - 0xF00000;
+M68K_Fetch[3].offset = (unsigned) &Ram_68k[0] - 0xEF0000;
+
+S68K_Fetch[0].offset = (unsigned) &Ram_Prg[0];
+
+
   memset (&Context_68K, 0, sizeof (Context_68K));
 
   Context_68K.s_fetch = Context_68K.u_fetch = Context_68K.fetch = M68K_Fetch;

Updated cpu_68k.c: http://paste.textboard.org/52abf18f/raw

This allows make to move past the initializer element is not constant errors to other errors.

199


VIP:

do not edit these