]> git.sesse.net Git - pistorm/commitdiff
Add command line switch to disable Gayle emulation
authorbeean <beean@DESKTOP-4SUL5CR.local>
Mon, 23 Nov 2020 09:55:15 +0000 (10:55 +0100)
committerbeean <beean@DESKTOP-4SUL5CR.local>
Mon, 23 Nov 2020 09:55:15 +0000 (10:55 +0100)
emulator.c

index 35b6b9e7847ac6044ee8ad17daa87c3086d06326..7da7d75359557705b4fb9dca244c77c38ef74fdf 100644 (file)
@@ -76,6 +76,7 @@
 
 int mem_fd;
 int mem_fd_gpclk;
+int gayle_emulation_enabled = 1;
 void *gpio_map;
 void *gpclk_map;
 
@@ -144,10 +145,17 @@ void *iplThread(void *args) {
   }
 }
 
-int main() {
+int main(int argc, char *argv[]) {
   int g;
   const struct sched_param priority = {99};
 
+  // Some command line switch stuffles
+  for (g = 1; g < argc; g++) {
+    if (strcmp(argv[g], "--disable-gayle") == 0) {
+      gayle_emulation_enabled = 0;
+    }
+  }
+
   sched_setscheduler(0, SCHED_FIFO, &priority);
   mlockall(MCL_CURRENT);  // lock in memory to keep us from paging out
 
@@ -316,8 +324,10 @@ unsigned int m68k_read_memory_8(unsigned int address) {
     }
   }
 
-  if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
-    return readGayleB(address);
+  if (gayle_emulation_enabled) {
+    if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
+      return readGayleB(address);
+    }
   }
 
   if (address < 0xffffff) {
@@ -338,8 +348,10 @@ unsigned int m68k_read_memory_16(unsigned int address) {
     }
   }
 
-  if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
-    return readGayle(address);
+  if (gayle_emulation_enabled) {
+    if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
+      return readGayle(address);
+    }
   }
 
   if (address < 0xffffff) {
@@ -360,8 +372,10 @@ unsigned int m68k_read_memory_32(unsigned int address) {
     }
   }
 
-  if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
-    return readGayleL(address);
+  if (gayle_emulation_enabled) {
+    if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
+      return readGayleL(address);
+    }
   }
 
   if (address < 0xffffff) {
@@ -379,9 +393,11 @@ void m68k_write_memory_8(unsigned int address, unsigned int value) {
     return;
   }
 
-  if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
-    writeGayleB(address, value);
-    return;
+  if (gayle_emulation_enabled) {
+    if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
+      writeGayleB(address, value);
+      return;
+    }
   }
 
   if (address == 0xbfe001) {
@@ -403,9 +419,11 @@ void m68k_write_memory_16(unsigned int address, unsigned int value) {
     return;
   }
 
-  if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
-    writeGayle(address, value);
-    return;
+  if (gayle_emulation_enabled) {
+    if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
+      writeGayle(address, value);
+      return;
+    }
   }
 
   if (address < 0xffffff) {
@@ -421,8 +439,10 @@ void m68k_write_memory_32(unsigned int address, unsigned int value) {
     return;
   }
 
-  if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
-    writeGayleL(address, value);
+  if (gayle_emulation_enabled) {
+    if (address > GAYLEBASE && address < GAYLEBASE + GAYLESIZE) {
+      writeGayleL(address, value);
+    }
   }
 
   if (address < 0xffffff) {