X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fjaguar.cpp;h=0a54ea4ba1579d5d47f78b44d2e57f4bf128c030;hb=d239de704f276a75d927900e3d413a44cc87116c;hp=d2817df12e65bd301980ee76bbd4bece70037121;hpb=3580a9ef98432ed54f065f2d537d588fdc083592;p=virtualjaguar diff --git a/src/jaguar.cpp b/src/jaguar.cpp index d2817df..0a54ea4 100644 --- a/src/jaguar.cpp +++ b/src/jaguar.cpp @@ -6,15 +6,25 @@ // Cleanups and endian wrongness amelioration by James L. Hammons // Note: Endian wrongness probably stems from the MAME origins of this emu and // the braindead way in which MAME handles memory. :-) -// +// #include "jaguar.h" -#include "video.h" -#include "settings.h" -//#include "m68kdasmAG.h" -#include "clock.h" + #include #include "SDL_opengl.h" +#include "cdrom.h" +#include "dsp.h" +#include "event.h" +#include "gpu.h" +#include "gui.h" +#include "jerry.h" +#include "joystick.h" +#include "log.h" +#include "m68k.h" +#include "memory.h" +#include "settings.h" +#include "tom.h" +#include "video.h" #define CPU_DEBUG //Do this in makefile??? Yes! Could, but it's easier to define here... @@ -43,17 +53,19 @@ extern int effect_start2, effect_start3, effect_start4, effect_start5, effect_st // Memory debugging identifiers -char * whoName[9] = +const char * whoName[9] = { "Unknown", "Jaguar", "DSP", "GPU", "TOM", "JERRY", "M68K", "Blitter", "OP" }; uint32 jaguar_active_memory_dumps = 0; -uint32 jaguar_mainRom_crc32, jaguarRomSize, jaguarRunAddress; +uint32 jaguarMainRomCRC32, jaguarRomSize, jaguarRunAddress; -/*static*/ uint8 * jaguar_mainRam = NULL; -/*static*/ uint8 * jaguar_mainRom = NULL; -/*static*/ uint8 * jaguar_bootRom = NULL; -/*static*/ uint8 * jaguar_CDBootROM = NULL; +uint8 * jaguarMainRam = NULL; +uint8 * jaguarMainRom = NULL; +uint8 * jaguarBootRom = NULL; +uint8 * jaguarCDBootROM = NULL; +bool BIOSLoaded = false; +bool CDBIOSLoaded = false; #ifdef CPU_DEBUG_MEMORY uint8 writeMemMax[0x400000], writeMemMin[0x400000]; @@ -95,9 +107,9 @@ void M68KInstructionHook(void) WriteLog("M68K: Top of stack: %08X. Stack trace:\n", JaguarReadLong(topOfStack)); for(int i=0; i<10; i++) WriteLog("%06X: %08X\n", topOfStack - (i * 4), JaguarReadLong(topOfStack - (i * 4))); - WriteLog("Jaguar: VBL interrupt is %s\n", ((tom_irq_enabled(IRQ_VBLANK)) && (jaguar_interrupt_handler_is_valid(64))) ? "enabled" : "disabled"); + WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VBLANK)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled"); M68K_show_context(); - log_done(); + LogDone(); exit(0); } @@ -319,7 +331,7 @@ CD_switch:: -> $306C WriteLog("M68K: Top of stack: %08X. Stack trace:\n", JaguarReadLong(topOfStack)); for(int i=0; i<10; i++) WriteLog("%06X: %08X\n", topOfStack - (i * 4), JaguarReadLong(topOfStack - (i * 4))); - WriteLog("Jaguar: VBL interrupt is %s\n", ((tom_irq_enabled(IRQ_VBLANK)) && (jaguar_interrupt_handler_is_valid(64))) ? "enabled" : "disabled"); + WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VBLANK)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled"); M68K_show_context(); //temp @@ -328,7 +340,7 @@ CD_switch:: -> $306C // WriteLog("\n\n"); //endoftemp - log_done(); + LogDone(); exit(0); }//*/ #endif @@ -370,12 +382,12 @@ unsigned int m68k_read_memory_8(unsigned int address) unsigned int retVal = 0; if ((address >= 0x000000) && (address <= 0x3FFFFF)) - retVal = jaguar_mainRam[address]; + retVal = jaguarMainRam[address]; // else if ((address >= 0x800000) && (address <= 0xDFFFFF)) else if ((address >= 0x800000) && (address <= 0xDFFEFF)) - retVal = jaguar_mainRom[address - 0x800000]; + retVal = jaguarMainRom[address - 0x800000]; else if ((address >= 0xE00000) && (address <= 0xE3FFFF)) - retVal = jaguar_bootRom[address - 0xE00000]; + retVal = jaguarBootRom[address - 0xE00000]; else if ((address >= 0xDFFF00) && (address <= 0xDFFFFF)) retVal = CDROMReadByte(address); else if ((address >= 0xF00000) && (address <= 0xF0FFFF)) @@ -461,12 +473,12 @@ unsigned int m68k_read_memory_16(unsigned int address) if ((address >= 0x000000) && (address <= 0x3FFFFE)) // retVal = (jaguar_mainRam[address] << 8) | jaguar_mainRam[address+1]; - retVal = GET16(jaguar_mainRam, address); + retVal = GET16(jaguarMainRam, address); // else if ((address >= 0x800000) && (address <= 0xDFFFFE)) else if ((address >= 0x800000) && (address <= 0xDFFEFE)) - retVal = (jaguar_mainRom[address - 0x800000] << 8) | jaguar_mainRom[address - 0x800000 + 1]; + retVal = (jaguarMainRom[address - 0x800000] << 8) | jaguarMainRom[address - 0x800000 + 1]; else if ((address >= 0xE00000) && (address <= 0xE3FFFE)) - retVal = (jaguar_bootRom[address - 0xE00000] << 8) | jaguar_bootRom[address - 0xE00000 + 1]; + retVal = (jaguarBootRom[address - 0xE00000] << 8) | jaguarBootRom[address - 0xE00000 + 1]; else if ((address >= 0xDFFF00) && (address <= 0xDFFFFE)) retVal = CDROMReadWord(address, M68K); else if ((address >= 0xF00000) && (address <= 0xF0FFFE)) @@ -519,7 +531,7 @@ void m68k_write_memory_8(unsigned int address, unsigned int value) WriteLog("M68K: Byte %02X written at %08X by 68K\n", value, address);//*/ if ((address >= 0x000000) && (address <= 0x3FFFFF)) - jaguar_mainRam[address] = value; + jaguarMainRam[address] = value; else if ((address >= 0xDFFF00) && (address <= 0xDFFFFF)) CDROMWriteByte(address, value, M68K); else if ((address >= 0xF00000) && (address <= 0xF0FFFF)) @@ -579,7 +591,7 @@ if (address == 0xF02110) { /* jaguar_mainRam[address] = value >> 8; jaguar_mainRam[address + 1] = value & 0xFF;*/ - SET16(jaguar_mainRam, address, value); + SET16(jaguarMainRam, address, value); } else if ((address >= 0xDFFF00) && (address <= 0xDFFFFE)) CDROMWriteWord(address, value, M68K); @@ -618,18 +630,15 @@ if (address == 0xF03214 && value == 0x88E30047) } -uint32 jaguar_get_handler(uint32 i) +uint32 JaguarGetHandler(uint32 i) { return JaguarReadLong(i * 4); } -uint32 jaguar_interrupt_handler_is_valid(uint32 i) // Debug use only... +bool JaguarInterruptHandlerIsValid(uint32 i) // Debug use only... { - uint32 handler = jaguar_get_handler(i); - if (handler && (handler != 0xFFFFFFFF)) - return 1; - else - return 0; + uint32 handler = JaguarGetHandler(i); + return (handler && (handler != 0xFFFFFFFF) ? 1 : 0); } void M68K_show_context(void) @@ -643,7 +652,7 @@ void M68K_show_context(void) WriteLog("68K disasm\n"); // jaguar_dasm(s68000readPC()-0x1000,0x20000); - jaguar_dasm(m68k_get_reg(NULL, M68K_REG_PC) - 0x80, 0x200); + JaguarDasm(m68k_get_reg(NULL, M68K_REG_PC) - 0x80, 0x200); // jaguar_dasm(0x5000, 0x14414); // WriteLog("\n.......[Cart start]...........\n\n"); @@ -651,10 +660,10 @@ void M68K_show_context(void) WriteLog("..................\n"); - if (tom_irq_enabled(IRQ_VBLANK)) + if (TOMIRQEnabled(IRQ_VBLANK)) { WriteLog("vblank int: enabled\n"); - jaguar_dasm(jaguar_get_handler(64), 0x200); + JaguarDasm(JaguarGetHandler(64), 0x200); } else WriteLog("vblank int: disabled\n"); @@ -662,7 +671,7 @@ void M68K_show_context(void) WriteLog("..................\n"); for(int i=0; i<256; i++) - WriteLog("handler %03i at $%08X\n", i, (unsigned int)jaguar_get_handler(i)); + WriteLog("handler %03i at $%08X\n", i, (unsigned int)JaguarGetHandler(i)); } // @@ -691,9 +700,9 @@ void jaguar_unknown_writebyte(unsigned address, unsigned data, uint32 who/*=UNKN WriteLog("Jaguar: Unknown byte %02X written at %08X by %s (M68K PC=%06X)\n", data, address, whoName[who], m68k_get_reg(NULL, M68K_REG_PC)); #endif #ifdef ABORT_ON_UNMAPPED_MEMORY_ACCESS - extern bool finished; +// extern bool finished; finished = true; - extern bool doDSPDis; +// extern bool doDSPDis; if (who == DSP) doDSPDis = true; #endif @@ -705,9 +714,9 @@ void jaguar_unknown_writeword(unsigned address, unsigned data, uint32 who/*=UNKN WriteLog("Jaguar: Unknown word %04X written at %08X by %s (M68K PC=%06X)\n", data, address, whoName[who], m68k_get_reg(NULL, M68K_REG_PC)); #endif #ifdef ABORT_ON_UNMAPPED_MEMORY_ACCESS - extern bool finished; +// extern bool finished; finished = true; - extern bool doDSPDis; +// extern bool doDSPDis; if (who == DSP) doDSPDis = true; #endif @@ -719,9 +728,9 @@ unsigned jaguar_unknown_readbyte(unsigned address, uint32 who/*=UNKNOWN*/) WriteLog("Jaguar: Unknown byte read at %08X by %s (M68K PC=%06X)\n", address, whoName[who], m68k_get_reg(NULL, M68K_REG_PC)); #endif #ifdef ABORT_ON_UNMAPPED_MEMORY_ACCESS - extern bool finished; +// extern bool finished; finished = true; - extern bool doDSPDis; +// extern bool doDSPDis; if (who == DSP) doDSPDis = true; #endif @@ -734,9 +743,9 @@ unsigned jaguar_unknown_readword(unsigned address, uint32 who/*=UNKNOWN*/) WriteLog("Jaguar: Unknown word read at %08X by %s (M68K PC=%06X)\n", address, whoName[who], m68k_get_reg(NULL, M68K_REG_PC)); #endif #ifdef ABORT_ON_UNMAPPED_MEMORY_ACCESS - extern bool finished; +// extern bool finished; finished = true; - extern bool doDSPDis; +// extern bool doDSPDis; if (who == DSP) doDSPDis = true; #endif @@ -762,7 +771,7 @@ unsigned int m68k_read_disassembler_32(unsigned int address) return m68k_read_memory_32(address); } -void jaguar_dasm(uint32 offset, uint32 qt) +void JaguarDasm(uint32 offset, uint32 qt) { #ifdef CPU_DEBUG static char buffer[2048];//, mem[64]; @@ -789,13 +798,13 @@ uint8 JaguarReadByte(uint32 offset, uint32 who/*=UNKNOWN*/) offset &= 0xFFFFFF; if (offset < 0x400000) - data = jaguar_mainRam[offset & 0x3FFFFF]; + data = jaguarMainRam[offset & 0x3FFFFF]; else if ((offset >= 0x800000) && (offset < 0xC00000)) - data = jaguar_mainRom[offset - 0x800000]; + data = jaguarMainRom[offset - 0x800000]; else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF)) data = CDROMReadByte(offset, who); else if ((offset >= 0xE00000) && (offset < 0xE40000)) - data = jaguar_bootRom[offset & 0x3FFFF]; + data = jaguarBootRom[offset & 0x3FFFF]; else if ((offset >= 0xF00000) && (offset < 0xF10000)) data = TOMReadByte(offset, who); else if ((offset >= 0xF10000) && (offset < 0xF20000)) @@ -811,18 +820,18 @@ uint16 JaguarReadWord(uint32 offset, uint32 who/*=UNKNOWN*/) offset &= 0xFFFFFF; if (offset <= 0x3FFFFE) { - return (jaguar_mainRam[(offset+0) & 0x3FFFFF] << 8) | jaguar_mainRam[(offset+1) & 0x3FFFFF]; + return (jaguarMainRam[(offset+0) & 0x3FFFFF] << 8) | jaguarMainRam[(offset+1) & 0x3FFFFF]; } else if ((offset >= 0x800000) && (offset <= 0xBFFFFE)) { offset -= 0x800000; - return (jaguar_mainRom[offset+0] << 8) | jaguar_mainRom[offset+1]; + return (jaguarMainRom[offset+0] << 8) | jaguarMainRom[offset+1]; } // else if ((offset >= 0xDFFF00) && (offset < 0xDFFF00)) else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFE)) return CDROMReadWord(offset, who); else if ((offset >= 0xE00000) && (offset <= 0xE3FFFE)) - return (jaguar_bootRom[(offset+0) & 0x3FFFF] << 8) | jaguar_bootRom[(offset+1) & 0x3FFFF]; + return (jaguarBootRom[(offset+0) & 0x3FFFF] << 8) | jaguarBootRom[(offset+1) & 0x3FFFF]; else if ((offset >= 0xF00000) && (offset <= 0xF0FFFE)) return TOMReadWord(offset, who); else if ((offset >= 0xF10000) && (offset <= 0xF1FFFE)) @@ -841,7 +850,7 @@ void JaguarWriteByte(uint32 offset, uint8 data, uint32 who/*=UNKNOWN*/) offset &= 0xFFFFFF; if (offset < 0x400000) { - jaguar_mainRam[offset & 0x3FFFFF] = data; + jaguarMainRam[offset & 0x3FFFFF] = data; return; } else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF)) @@ -859,7 +868,7 @@ void JaguarWriteByte(uint32 offset, uint8 data, uint32 who/*=UNKNOWN*/) JERRYWriteByte(offset, data, who); return; } - + jaguar_unknown_writebyte(offset, data, who); } @@ -969,8 +978,8 @@ if (who == GPU && (gpu_pc == 0xF03604 || gpu_pc == 0xF03638)) if (offset == 0x11D31A + 0x48000 || offset == 0x11D31A) WriteLog("JWW: %s writing star %04X at %08X...\n", whoName[who], data, offset);//*/ - jaguar_mainRam[(offset+0) & 0x3FFFFF] = data >> 8; - jaguar_mainRam[(offset+1) & 0x3FFFFF] = data & 0xFF; + jaguarMainRam[(offset+0) & 0x3FFFFF] = data >> 8; + jaguarMainRam[(offset+1) & 0x3FFFFF] = data & 0xFF; return; } else if (offset >= 0xDFFF00 && offset <= 0xDFFFFE) @@ -1020,50 +1029,50 @@ void JaguarWriteLong(uint32 offset, uint32 data, uint32 who/*=UNKNOWN*/) // // Jaguar console initialization // -void jaguar_init(void) +void JaguarInit(void) { #ifdef CPU_DEBUG_MEMORY memset(readMem, 0x00, 0x400000); memset(writeMemMin, 0xFF, 0x400000); memset(writeMemMax, 0x00, 0x400000); #endif - memory_malloc_secure((void **)&jaguar_mainRam, 0x400000, "Jaguar 68K CPU RAM"); - memory_malloc_secure((void **)&jaguar_mainRom, 0x600000, "Jaguar 68K CPU ROM"); - memory_malloc_secure((void **)&jaguar_bootRom, 0x040000, "Jaguar 68K CPU BIOS ROM"); // Only uses half of this! - memory_malloc_secure((void **)&jaguar_CDBootROM, 0x040000, "Jaguar 68K CPU CD BIOS ROM"); - memset(jaguar_mainRam, 0x00, 0x400000); + memory_malloc_secure((void **)&jaguarMainRam, 0x400000, "Jaguar 68K CPU RAM"); + memory_malloc_secure((void **)&jaguarMainRom, 0x600000, "Jaguar 68K CPU ROM"); + memory_malloc_secure((void **)&jaguarBootRom, 0x040000, "Jaguar 68K CPU BIOS ROM"); // Only uses half of this! + memory_malloc_secure((void **)&jaguarCDBootROM, 0x040000, "Jaguar 68K CPU CD BIOS ROM"); + memset(jaguarMainRam, 0x00, 0x400000); // memset(jaguar_mainRom, 0xFF, 0x200000); // & set it to all Fs... // memset(jaguar_mainRom, 0x00, 0x200000); // & set it to all 0s... //NOTE: This *doesn't* fix FlipOut... //Or does it? Hmm... //Seems to want $01010101... Dunno why. Investigate! - memset(jaguar_mainRom, 0x01, 0x600000); // & set it to all 01s... + memset(jaguarMainRom, 0x01, 0x600000); // & set it to all 01s... // memset(jaguar_mainRom, 0xFF, 0x600000); // & set it to all Fs... m68k_set_cpu_type(M68K_CPU_TYPE_68000); - gpu_init(); + GPUInit(); DSPInit(); - tom_init(); - jerry_init(); + TOMInit(); + JERRYInit(); CDROMInit(); } //New timer based code stuffola... void ScanlineCallback(void); void RenderCallback(void); -extern uint32 * backbuffer; -void jaguar_reset(void) +//extern uint32 * backbuffer; +void JaguarReset(void) { //NOTE: This causes a (virtual) crash if this is set in the config but not found... !!! FIX !!! if (vjs.useJaguarBIOS) - memcpy(jaguar_mainRam, jaguar_bootRom, 8); + memcpy(jaguarMainRam, jaguarBootRom, 8); else - SET32(jaguar_mainRam, 4, jaguarRunAddress); + SET32(jaguarMainRam, 4, jaguarRunAddress); // WriteLog("jaguar_reset():\n"); - tom_reset(); - jerry_reset(); - gpu_reset(); + TOMReset(); + JERRYReset(); + GPUReset(); DSPReset(); CDROMReset(); m68k_pulse_reset(); // Reset the 68000 @@ -1078,7 +1087,7 @@ void jaguar_reset(void) // SetCallbackTime(RenderCallback, 16651.541); // # Scanlines * scanline time } -void jaguar_done(void) +void JaguarDone(void) { #ifdef CPU_DEBUG_MEMORY /* WriteLog("\nJaguar: Memory Usage Stats (return addresses)\n\n"); @@ -1153,20 +1162,20 @@ void jaguar_done(void) // WriteLog("Jaguar: CD BIOS version %04X\n", JaguarReadWord(0x3004)); WriteLog("Jaguar: Interrupt enable = %02X\n", TOMReadByte(0xF000E1) & 0x1F); - WriteLog("Jaguar: VBL interrupt is %s\n", ((tom_irq_enabled(IRQ_VBLANK)) && (jaguar_interrupt_handler_is_valid(64))) ? "enabled" : "disabled"); + WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VBLANK)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled"); M68K_show_context(); //#endif CDROMDone(); - gpu_done(); + GPUDone(); DSPDone(); - tom_done(); - jerry_done(); + TOMDone(); + JERRYDone(); - memory_free(jaguar_mainRom); - memory_free(jaguar_mainRam); - memory_free(jaguar_bootRom); - memory_free(jaguar_CDBootROM); + memory_free(jaguarMainRom); + memory_free(jaguarMainRam); + memory_free(jaguarBootRom); + memory_free(jaguarCDBootROM); } // @@ -1214,11 +1223,11 @@ if (effect_start) //Not sure if this is correct... //Seems to be, kinda. According to the JTRM, this should only fire on odd lines in non-interlace mode... //Which means that it normally wouldn't go when it's zero. - if (i == vi && i > 0 && tom_irq_enabled(IRQ_VBLANK)) // Time for Vertical Interrupt? + if (i == vi && i > 0 && TOMIRQEnabled(IRQ_VBLANK)) // Time for Vertical Interrupt? { // We don't have to worry about autovectors & whatnot because the Jaguar // tells you through its HW registers who sent the interrupt... - tom_set_pending_video_int(); + TOMSetPendingVideoInt(); m68k_set_irq(7); } @@ -1233,11 +1242,11 @@ if (effect_start) JERRYExecPIT(RISCCyclesPerScanline); //if (start_logging) // WriteLog("About to execute JERRY's SSI (%u)...\n", i); - jerry_i2s_exec(RISCCyclesPerScanline); + JERRYI2SExec(RISCCyclesPerScanline); BUTCHExec(RISCCyclesPerScanline); //if (start_logging) // WriteLog("About to execute GPU (%u)...\n", i); - gpu_exec(RISCCyclesPerScanline); + GPUExec(RISCCyclesPerScanline); if (vjs.DSPEnabled) { @@ -1263,19 +1272,21 @@ void DumpMainMemory(void) if (fp == NULL) return; - fwrite(jaguar_mainRam, 1, 0x400000, fp); + fwrite(jaguarMainRam, 1, 0x400000, fp); fclose(fp); } uint8 * GetRamPtr(void) { - return jaguar_mainRam; + return jaguarMainRam; } // // New Jaguar execution stack // +#if 0 + void JaguarExecuteNew(void) { extern bool finished, showGUI; @@ -1361,6 +1372,98 @@ joystick_exec(); SetCallbackTime(ScanlineCallback, 31.77775); } +#else + +bool frameDone; +void JaguarExecuteNew(void) +{ +// extern bool finished, showGUI; +// extern bool debounceRunKey; + // Pass a message to the "joystick" code to debounce the ESC key... +// debounceRunKey = true; +// finished = false; +/* InitializeEventList(); + TOMResetBackbuffer(backbuffer); +// SetCallbackTime(ScanlineCallback, 63.5555); + SetCallbackTime(ScanlineCallback, 31.77775); +// SetCallbackTime(RenderCallback, 33303.082); // # Scanlines * scanline time +// SetCallbackTime(RenderCallback, 16651.541); // # Scanlines * scanline time//*/ +// uint8 * keystate = SDL_GetKeyState(NULL); + frameDone = false; + + do + { + double timeToNextEvent = GetTimeToNextEvent(); +//WriteLog("JEN: Time to next event (%u) is %f usec (%u RISC cycles)...\n", nextEvent, timeToNextEvent, USEC_TO_RISC_CYCLES(timeToNextEvent)); + + m68k_execute(USEC_TO_M68K_CYCLES(timeToNextEvent)); + GPUExec(USEC_TO_RISC_CYCLES(timeToNextEvent)); + + if (vjs.DSPEnabled) + { + if (vjs.usePipelinedDSP) + DSPExecP2(USEC_TO_RISC_CYCLES(timeToNextEvent)); // Pipelined DSP execution (3 stage)... + else + DSPExec(USEC_TO_RISC_CYCLES(timeToNextEvent)); // Ordinary non-pipelined DSP + } + + HandleNextEvent(); + +// if (keystate[SDLK_ESCAPE]) +// break; + +// SDL_PumpEvents(); // Needed to keep the keystate current... + } + while (!frameDone); +} + +void ScanlineCallback(void) +{ + uint16 vc = TOMReadWord(0xF00006); + uint16 vp = TOMReadWord(0xF0003E) + 1; + uint16 vi = TOMReadWord(0xF0004E); +// uint16 vbb = TOMReadWord(0xF00040); + vc++; + + if (vc >= vp) + vc = 0; + +//WriteLog("SLC: Currently on line %u (VP=%u)...\n", vc, vp); + TOMWriteWord(0xF00006, vc); + +//This is a crappy kludge, but maybe it'll work for now... +//Maybe it's not so bad, since the IRQ happens on a scanline boundary... + if (vc == vi && vc > 0 && TOMIRQEnabled(IRQ_VBLANK)) // Time for Vertical Interrupt? + { + // We don't have to worry about autovectors & whatnot because the Jaguar + // tells you through its HW registers who sent the interrupt... + TOMSetPendingVideoInt(); + m68k_set_irq(7); + } + + TOMExecScanline(vc, true); + +//Change this to VBB??? +//Doesn't seem to matter (at least for Flip Out & I-War) + if (vc == 0) +// if (vc == vbb) + { + JoystickExec(); + RenderBackbuffer(); + TOMResetBackbuffer(backbuffer); + frameDone = true; + }//*/ + +// if (vc == 0) +// TOMResetBackbuffer(backbuffer); + +// SetCallbackTime(ScanlineCallback, 63.5555); + SetCallbackTime(ScanlineCallback, 31.77775); +} + +#endif + +// This isn't currently used, but maybe it should be... void RenderCallback(void) { RenderBackbuffer();