Added a specific breakpoint for the M68K illegal instruction exception
authorJean-Paul Mari <djipi.mari@gmail.com>
Sat, 17 Aug 2019 21:14:56 +0000 (17:14 -0400)
committerJean-Paul Mari <djipi.mari@gmail.com>
Sat, 17 Aug 2019 21:14:56 +0000 (17:14 -0400)
.gitignore
docs/vj_HistoryNotes.txt
src/jaguar.cpp

index ffc38f5..d3a73c2 100644 (file)
@@ -31,5 +31,6 @@ Win-VS2017/virtualjaguar.VC.VC.opendb
 Win-VS2017/virtualjaguar.sdf\r
 Win-VS2017/virtualjaguar.vcxproj.user\r
 Win-VS2017/GeneratedFiles/\r
 Win-VS2017/virtualjaguar.sdf\r
 Win-VS2017/virtualjaguar.vcxproj.user\r
 Win-VS2017/GeneratedFiles/\r
+Win-VS2017/GeneratedFiles/qrc_virtualjaguar.cpp\r
 Win-VS2015/\r
 Win-VS2015/\r
-Win-VS2019/\r
+Win-VS2019/
index 87d145b..ecefb68 100644 (file)
@@ -2,6 +2,8 @@ Release 5 (TBA)
 ---------------
 0) Added a date creation stamp in the application command line information
 - This date already appears in the Release 4 executable but was not referenced in his history note
 ---------------
 0) Added a date creation stamp in the application command line information
 - This date already appears in the Release 4 executable but was not referenced in his history note
+1) Added a specific breakpoint for the M68K illegal instruction exception
+-- Alert box will display a message and then the code will stop
 
 Release 4a (15th August 2019)
 -----------------------------
 
 Release 4a (15th August 2019)
 -----------------------------
index 638cfe3..69a22d5 100644 (file)
@@ -1418,6 +1418,22 @@ unsigned int m68k_read_memory_16(unsigned int address)
 }
 
 
 }
 
 
+// Alert message in case of exception vector request
+bool m68k_read_exception_vector(unsigned int address, char *text)
+{
+       QString msg;
+       QMessageBox msgBox;
+
+       msg.sprintf("$%06x: %s", pcQueue[pcQPtr ? (pcQPtr - 1) : 0x3FF], text);
+       msgBox.setText(msg);
+       msgBox.setStandardButtons(QMessageBox::Abort);
+       msgBox.setDefaultButton(QMessageBox::Abort);
+       msgBox.exec();
+       return M68KDebugHalt();
+}
+
+
+// Read 4 bytes from memory
 unsigned int m68k_read_memory_32(unsigned int address)
 {
 #ifdef ALPINE_FUNCTIONS
 unsigned int m68k_read_memory_32(unsigned int address)
 {
 #ifdef ALPINE_FUNCTIONS
@@ -1436,23 +1452,36 @@ unsigned int m68k_read_memory_32(unsigned int address)
 
 //WriteLog("--> [RM32]\n");
 #ifndef USE_NEW_MMU
 
 //WriteLog("--> [RM32]\n");
 #ifndef USE_NEW_MMU
-       uint32_t retVal = 0;
+       //uint32_t retVal = 0;
 
 
-       if ((address >= 0x800000) && (address <= 0xDFFEFE))
+       // check exception vectors access
+       if ((address >= 0x8) && (address <= 0x7c))
        {
        {
-               // Memory Track reading...
-               if (((TOMGetMEMCON1() & 0x0006) == (2 << 1)) && (jaguarMainROMCRC32 == 0xFDF37F47))
+               switch (address)
                {
                {
-                       retVal = MTReadLong(address);
+               case 0x10:
+                       m68k_read_exception_vector(address, "Illegal instruction");
+                       break;
                }
                }
-               else
+       }
+       else
+       {
+               // check ROM or Memory Track access
+               if ((address >= 0x800000) && (address <= 0xDFFEFE))
                {
                {
-                       retVal = GET32(jaguarMainROM, address - 0x800000);
+                       // Memory Track reading...
+                       if (((TOMGetMEMCON1() & 0x0006) == (2 << 1)) && (jaguarMainROMCRC32 == 0xFDF37F47))
+                       {
+                               return MTReadLong(address);
+                       }
+                       else
+                       {
+                               return GET32(jaguarMainROM, address - 0x800000);
+                       }
                }
                }
-
-               return retVal;
        }
 
        }
 
+       // return value from memory
        return (m68k_read_memory_16(address) << 16) | m68k_read_memory_16(address + 2);
 #else
        return MMURead32(address, M68K);
        return (m68k_read_memory_16(address) << 16) | m68k_read_memory_16(address + 2);
 #else
        return MMURead32(address, M68K);