// V-Int Callback void _vint_callback() { u16 vintp; intTrace |= IN_VINT; vtimer++; // call user callback (pre V-Int) if (VIntCBPre) VIntCBPre(); vintp = VIntProcess; // may worth it if (vintp) { // xgm processing (have to be done first !) if (vintp & PROCESS_XGM_TASK) XGM_doVBlankProcess(); // dma processing if (vintp & PROCESS_DMA_TASK) { // DMA protection for XGM driver if (currentZ80Driver == Z80_DRIVER_XGM) { SND_set68KBUSProtection_XGM(TRUE); // delay enabled ? --> wait a bit to improve PCM playback (test on SOR2) if (SND_getForceDelayDMA_XGM()) waitSubTick(10); DMA_flushQueue(); SND_set68KBUSProtection_XGM(FALSE); } else DMA_flushQueue(); // always clear process vintp &= ~PROCESS_DMA_TASK; } // tile cache processing if (vintp & PROCESS_TILECACHE_TASK) TC_doVBlankProcess(); // bitmap processing if (vintp & PROCESS_BITMAP_TASK) BMP_doVBlankProcess(); // palette fading processing if (vintp & PROCESS_PALETTE_FADING) { if (!VDP_doStepFading(FALSE)) vintp &= ~PROCESS_PALETTE_FADING; } VIntProcess = vintp; } // then call user callback if (VIntCB) VIntCB(); // joy state refresh (better to do it after user's callback as it can eat some time) JOY_update(); intTrace &= ~IN_VINT; }
static void vintEvent() { u16 i; u16 in, out; char strNum[8]; char str[40]; // set BUS protection for XGM driver if (driver->id == Z80_DRIVER_XGM) SND_set68KBUSProtection_XGM(TRUE); in = GET_VCOUNTER; if ((in >= 224) && (in <= 230)) { switch(dmaMethod) { case 1: VDP_doDMAEx(VDP_DMA_VRAM, 0, 0x8000, (6 * 1024) / 2, 2); break; case 2: for(i = 0; i < 4; i++) { VDP_doDMAEx(VDP_DMA_VRAM, 0, 0x8000, 1024 / 2, 2); waitSubTick(0); } break; case 3: for(i = 0; i < 8; i++) { VDP_doDMAEx(VDP_DMA_VRAM, 0, 0x8000, 256 / 2, 2); waitSubTick(0); } break; } } out = GET_VCOUNTER; if (driver->id == Z80_DRIVER_XGM) { u16 load; // remove BUS protection for XGM driver SND_set68KBUSProtection_XGM(FALSE); // get Z80 cpu estimated load load = SND_getCPULoad_XGM(); uintToStr(load, str, 3); strcat(str, " %"); VDP_clearText(16, 21, 10); VDP_drawText(str, 16, 21); // { // u8 debugValues[12]; // // getZ80Debug(debugValues); // // strcpy(str, "4 PCM mixing: "); // // uintToStr(debugValues[0], strNum, 3); // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[4], strNum, 3); // strcat(str, strNum); // // VDP_drawText(str, 1, 22); // // strcpy(str, "XGM prep & parse: "); // // uintToStr(debugValues[5], strNum, 3); // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[6], strNum, 3); // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[7], strNum, 3); // strcat(str, strNum); // // VDP_drawText(str, 1, 23); // // strcpy(str, "Ext com & sync: "); // // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[8], strNum, 3); // strcat(str, strNum); // strcat(str, " "); // uintToStr(debugValues[9], strNum, 3); // strcat(str, strNum); // // VDP_drawText(str, 1, 24); // } } else { VDP_clearTextLine(22); VDP_clearTextLine(23); VDP_clearTextLine(24); } if ((in >= 224) && (in <= 230)) { switch(dmaMethod) { case 0: VDP_drawText("NONE ", 13, 26); break; case 1: VDP_drawText("1 x 6KB ", 13, 26); break; case 2: VDP_drawText("4 x 1KB ", 13, 26); break; case 3: VDP_drawText("8 x 256B", 13, 26); break; } } else VDP_drawText("NOT DONE", 13, 26); if (dmaMethod) { strcpy(str, "DMA start at "); uintToStr(in, strNum, 3); strcat(str, strNum); strcat(str, " - end at "); uintToStr(out, strNum, 3); strcat(str, strNum); VDP_drawText(str, 1, 27); } else VDP_clearTextLine(27); }