X-Git-Url: http://git.hcoop.net/clinton/Virtual-Jaguar-Rx.git/blobdiff_plain/f04df4f185ed4f3cfc805d0f61b3c019a108ae2c..0029c5072f864788020340eab0ed9600ac0f8f4a:/src/jaguar.cpp diff --git a/src/jaguar.cpp b/src/jaguar.cpp index 638cfe3..6e4b04a 100644 --- a/src/jaguar.cpp +++ b/src/jaguar.cpp @@ -15,6 +15,7 @@ // JLH 11/25/2009 Major rewrite of memory subsystem and handlers // JPM 09/04/2018 Added the new Models and BIOS handler // JPM 10/13/2018 Added breakpoints features +// JPM Aug./2019 Fix specific breakpoint for ROM cartridge or unknown memory location writing; added a specific breakpoint for the M68K illegal & unimplemented instruction, unknown exceptions and address error exceptions // @@ -1418,6 +1419,26 @@ 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; + +#if 0 + msg.sprintf("68000 exception\n%s at $%06x", text, pcQueue[pcQPtr ? (pcQPtr - 1) : 0x3FF]); +#else + msg.sprintf("68000 exception\n$%06x: %s", pcQueue[pcQPtr ? (pcQPtr - 1) : 0x3FF], text); +#endif + 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 @@ -1436,23 +1457,48 @@ unsigned int m68k_read_memory_32(unsigned int address) //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 0x0c: + m68k_read_exception_vector(address, "Address error"); + break; + + case 0x10: + m68k_read_exception_vector(address, "Illegal instruction"); + break; + + case 0x2c: + m68k_read_exception_vector(address, "Unimplemented instruction"); + break; + + default: + m68k_read_exception_vector(address, "Exception not referenced"); + 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);