//Do this in makefile??? Yes! Could, but it's easier to define here...
//#define LOG_UNMAPPED_MEMORY_ACCESSES
//#define ABORT_ON_UNMAPPED_MEMORY_ACCESS
-#define ABORT_ON_ILLEGAL_INSTRUCTIONS
+//#define ABORT_ON_ILLEGAL_INSTRUCTIONS
//#define ABORT_ON_OFFICIAL_ILLEGAL_INSTRUCTION
#define CPU_DEBUG_MEMORY
//#define LOG_CD_BIOS_CALLS
+#define CPU_DEBUG_TRACING
// Private function prototypes
uint32 pcQueue[0x400];
uint32 pcQPtr = 0;
+bool startM68KTracing = false;
//
// Callback function to detect illegal instructions
instSeen++;
#endif
+// For code tracing...
+#ifdef CPU_DEBUG_TRACING
+ if (startM68KTracing)
+ {
+ static char buffer[2048];
+
+ m68k_disassemble(buffer, m68kPC, 0);
+ WriteLog("%06X: %s\n", m68kPC, buffer);
+ }
+#endif
+
// For tracebacks...
// Ideally, we'd save all the registers as well...
pcQueue[pcQPtr++] = m68kPC;
m68k_get_reg(NULL, M68K_REG_A0), m68k_get_reg(NULL, M68K_REG_A1),
m68k_get_reg(NULL, M68K_REG_D0), m68k_get_reg(NULL, M68K_REG_D1), m68k_get_reg(NULL, M68K_REG_D2));
}//*/
- if (m68kPC == 0x82E1A)
+/* if (m68kPC == 0x82E1A)
{
static char buffer[2048];
m68k_disassemble(buffer, m68kPC, 0);//M68K_CPU_TYPE_68000);
m68k_get_reg(NULL, M68K_REG_A0), m68k_get_reg(NULL, M68K_REG_A1),
m68k_get_reg(NULL, M68K_REG_D0), m68k_get_reg(NULL, M68K_REG_D1), m68k_get_reg(NULL, M68K_REG_D2));
}//*/
- if (m68kPC == 0x82E58)
+/* if (m68kPC == 0x82E58)
WriteLog("--> [Routine end]\n");
if (m68kPC == 0x80004)
{
#endif
int irq_ack_handler(int level)
{
+#ifdef CPU_DEBUG_TRACING
+ if (startM68KTracing)
+ {
+ WriteLog("irq_ack_handler: M68K PC=%06X\n", m68k_get_reg(NULL, M68K_REG_PC));
+ }
+#endif
+
// Tracing the IPL lines on the Jaguar schematic yields the following:
// IPL1 is connected to INTL on TOM (OUT to 68K)
// IPL0-2 are also tied to Vcc via 4.7K resistors!
uint8 JaguarReadByte(uint32 offset, uint32 who/*=UNKNOWN*/)
{
uint8 data = 0x00;
-
offset &= 0xFFFFFF;
- if (offset < 0x200000)
- data = jaguarMainRAM[offset & 0x3FFFFF];
- else if ((offset >= 0x800000) && (offset < 0xC00000))
+
+ // First 2M is mirrored in the $0 - $7FFFFF range
+ if (offset < 0x800000)
+ data = jaguarMainRAM[offset & 0x1FFFFF];
+ else if ((offset >= 0x800000) && (offset < 0xDFFF00))
data = jaguarMainROM[offset - 0x800000];
else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF))
data = CDROMReadByte(offset, who);
uint16 JaguarReadWord(uint32 offset, uint32 who/*=UNKNOWN*/)
{
offset &= 0xFFFFFF;
- if (offset <= 0x1FFFFE)
+
+ // First 2M is mirrored in the $0 - $7FFFFF range
+ if (offset < 0x800000)
{
return (jaguarMainRAM[(offset+0) & 0x1FFFFF] << 8) | jaguarMainRAM[(offset+1) & 0x1FFFFF];
}
- else if ((offset >= 0x800000) && (offset <= 0xBFFFFE))
+ else if ((offset >= 0x800000) && (offset < 0xDFFF00))
{
offset -= 0x800000;
return (jaguarMainROM[offset+0] << 8) | jaguarMainROM[offset+1];
WriteLog("JWB: Byte %02X written at %08X by %s\n", data, offset, whoName[who]);//*/
offset &= 0xFFFFFF;
- if (offset < 0x200000)
+
+ // First 2M is mirrored in the $0 - $7FFFFF range
+ if (offset < 0x800000)
{
jaguarMainRAM[offset & 0x1FFFFF] = data;
return;
offset &= 0xFFFFFF;
- if (offset <= 0x1FFFFE)
+ // First 2M is mirrored in the $0 - $7FFFFF range
+ if (offset <= 0x7FFFFE)
{
/*
GPU Table (CD BIOS)
// it will be half this number for a half frame. BUT, since we're counting
// HALF lines, we double this number and we're back at 525 for NTSC, 625 for PAL.
//
-// Scanline times are 63.5555... \0s in NTSC and 64 \0s in PAL
+// Scanline times are 63.5555... μs in NTSC and 64 μs in PAL
// Half line times are, naturally, half of this. :-P
void HalflineCallback(void)
{