Overclocking. Implemented by adding extra scanlines to PPU loop. Disabled (optionally) while 7-bit samples are playing (as they can't be worked around otherwise).
This commit is contained in:
parent
e71e32ceb7
commit
72f2d47f3a
|
@ -45,7 +45,7 @@ static void COOLBOYCW(uint32 A, uint8 V) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void COOLBOYPW(uint32 A, uint8 V) {
|
static void COOLBOYPW(uint32 A, uint8 V) {
|
||||||
uint32 mask, shift;
|
uint32 mask;
|
||||||
uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
|
uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
|
||||||
switch(EXPREGS[0] & 0xC0) {
|
switch(EXPREGS[0] & 0xC0) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
|
|
@ -197,7 +197,7 @@ static void UNROM512LSync() {
|
||||||
}
|
}
|
||||||
else if (latche==0x10)
|
else if (latche==0x10)
|
||||||
{
|
{
|
||||||
for(int i=0;i<(ROM_size*4);i++)
|
for(uint32 i=0;i<(ROM_size*4);i++)
|
||||||
inc_flash_write_count(i>>2,i<<12);
|
inc_flash_write_count(i>>2,i<<12);
|
||||||
memset(flashdata,0xFF,ROM_size*0x4000); //Erasing the rom chip as instructed. Crash rate calulated to be 99.9% :)
|
memset(flashdata,0xFF,ROM_size*0x4000); //Erasing the rom chip as instructed. Crash rate calulated to be 99.9% :)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,6 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
/* FCE Ultra */
|
|
||||||
/* */
|
|
||||||
/* This file contains code to interface to the standard */
|
|
||||||
/* FCE Ultra configuration file saving/loading code. */
|
|
||||||
/* */
|
|
||||||
/****************************************************************/
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
@ -184,6 +176,9 @@ static CFGSTRUCT fceuconfig[] =
|
||||||
AC(ntsccol),AC(ntsctint),AC(ntschue),
|
AC(ntsccol),AC(ntsctint),AC(ntschue),
|
||||||
AC(force_grayscale),
|
AC(force_grayscale),
|
||||||
AC(dendy),
|
AC(dendy),
|
||||||
|
AC(extrascanlines),
|
||||||
|
AC(overclocked),
|
||||||
|
AC(skip_7bit_overclocking),
|
||||||
|
|
||||||
NAC("palyo",pal_emulation),
|
NAC("palyo",pal_emulation),
|
||||||
NAC("genie",genie),
|
NAC("genie",genie),
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#define INVALID_BREAKPOINT_CONDITION 3
|
#define INVALID_BREAKPOINT_CONDITION 3
|
||||||
|
|
||||||
//extern volatile int userpause; //mbg merge 7/18/06 removed for merging
|
//extern volatile int userpause; //mbg merge 7/18/06 removed for merging
|
||||||
extern int scanline; //current scanline! :D
|
|
||||||
extern HWND hDebug;
|
extern HWND hDebug;
|
||||||
|
|
||||||
extern int childwnd,numWPs; //mbg merge 7/18/06 had to make extern
|
extern int childwnd,numWPs; //mbg merge 7/18/06 had to make extern
|
||||||
|
|
|
@ -147,6 +147,12 @@ int genie = 0;
|
||||||
int pal_emulation = 0;
|
int pal_emulation = 0;
|
||||||
int pal_setting_specified = 0;
|
int pal_setting_specified = 0;
|
||||||
int dendy = 0;
|
int dendy = 0;
|
||||||
|
// overclock the console by adding dummy scanlines to PPU loop
|
||||||
|
// disables DMC DMA and WaveHi filling for these dummies
|
||||||
|
// doesn't work with new PPU
|
||||||
|
bool overclocked = 0;
|
||||||
|
// 7-bit samples have priority over overclocking
|
||||||
|
bool skip_7bit_overclocking = 1;
|
||||||
bool swapDuty = 0; // some Famicom and NES clones had duty cycle bits swapped
|
bool swapDuty = 0; // some Famicom and NES clones had duty cycle bits swapped
|
||||||
int ntsccol = 0, ntsctint, ntschue;
|
int ntsccol = 0, ntsctint, ntschue;
|
||||||
std::string BaseDirectory;
|
std::string BaseDirectory;
|
||||||
|
|
|
@ -57,6 +57,11 @@ extern int EnableBackgroundInput;
|
||||||
extern int AFon;
|
extern int AFon;
|
||||||
extern int AFoff;
|
extern int AFoff;
|
||||||
extern int AutoFireOffset;
|
extern int AutoFireOffset;
|
||||||
|
extern int normalscanlines;
|
||||||
|
extern int extrascanlines;
|
||||||
|
extern int totalscanlines;
|
||||||
|
extern bool overclocked;
|
||||||
|
extern bool skip_7bit_overclocking;
|
||||||
|
|
||||||
extern int vmod;
|
extern int vmod;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
extern int PPUViewScanline;
|
extern int PPUViewScanline;
|
||||||
extern int PPUViewer;
|
extern int PPUViewer;
|
||||||
extern int scanline;
|
|
||||||
void DoPPUView();
|
void DoPPUView();
|
||||||
void PPUViewDoBlit();
|
void PPUViewDoBlit();
|
||||||
|
|
||||||
|
|
|
@ -559,15 +559,19 @@ BEGIN
|
||||||
PUSHBUTTON "Enter",400,444,107,16,28
|
PUSHBUTTON "Enter",400,444,107,16,28
|
||||||
END
|
END
|
||||||
|
|
||||||
TIMINGCONFIG DIALOGEX 23, 157, 203, 60
|
TIMINGCONFIG DIALOGEX 23, 157, 203, 83
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION "Timing Configuration"
|
CAPTION "Timing Configuration"
|
||||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Close",1,137,38,56,14
|
DEFPUSHBUTTON "Close",1,137,61,56,14
|
||||||
CONTROL "Disable speed throttling used when sound is disabled.",CB_DISABLE_SPEED_THROTTLING,
|
CONTROL "Disable speed throttling used when sound is disabled.",CB_DISABLE_SPEED_THROTTLING,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,8,183,12
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,8,183,12
|
||||||
CONTROL "Set high-priority thread.",CB_SET_HIGH_PRIORITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,24,146,12
|
CONTROL "Set high-priority thread.",CB_SET_HIGH_PRIORITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,24,102,12
|
||||||
|
CONTROL "Overclocking (old PPU only).",CB_OVERCLOCKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,42,101,10
|
||||||
|
EDITTEXT IDC_EXTRA_SCANLINES,122,38,61,14,ES_AUTOHSCROLL
|
||||||
|
LTEXT "Extra scanlines:",IDC_STATIC,127,26,51,8
|
||||||
|
CONTROL "Don't overclock 7-bit samples.",CB_SKIP_7BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,58,111,10
|
||||||
END
|
END
|
||||||
|
|
||||||
MOVIEOPTIONS DIALOGEX 65520, 76, 147, 222
|
MOVIEOPTIONS DIALOGEX 65520, 76, 147, 222
|
||||||
|
|
|
@ -577,6 +577,7 @@
|
||||||
#define IDC_SELECTION_MARKER_EDIT 1147
|
#define IDC_SELECTION_MARKER_EDIT 1147
|
||||||
#define IDC_NOTE_TO_FIND 1147
|
#define IDC_NOTE_TO_FIND 1147
|
||||||
#define IDC_AUTOSAVE_PERIOD 1147
|
#define IDC_AUTOSAVE_PERIOD 1147
|
||||||
|
#define IDC_EXTRA_SCANLINES 1147
|
||||||
#define IDC_BUTTON9 1148
|
#define IDC_BUTTON9 1148
|
||||||
#define TASEDITOR_FIND_NEXT_SIMILAR_MARKER 1148
|
#define TASEDITOR_FIND_NEXT_SIMILAR_MARKER 1148
|
||||||
#define IDC_SYMBOLIC_ADDRESS 1148
|
#define IDC_SYMBOLIC_ADDRESS 1148
|
||||||
|
@ -636,6 +637,7 @@
|
||||||
#define IDC_MASK_UNUSED_GRAPHICS 1203
|
#define IDC_MASK_UNUSED_GRAPHICS 1203
|
||||||
#define CHECK_SOUND_SWAPDUTY 1203
|
#define CHECK_SOUND_SWAPDUTY 1203
|
||||||
#define CHECK_PALETTE_MONOCHROME 1203
|
#define CHECK_PALETTE_MONOCHROME 1203
|
||||||
|
#define CB_OVERCLOCKING 1203
|
||||||
#define IDC_VOLUMEGROUP 1204
|
#define IDC_VOLUMEGROUP 1204
|
||||||
#define IDC_OMITBLANK 1204
|
#define IDC_OMITBLANK 1204
|
||||||
#define IDC_CHECK3 1204
|
#define IDC_CHECK3 1204
|
||||||
|
@ -762,6 +764,7 @@
|
||||||
#define CTL_PALHUE_TRACKBAR 1291
|
#define CTL_PALHUE_TRACKBAR 1291
|
||||||
#define CHECK_PALETTE_HDTV 1292
|
#define CHECK_PALETTE_HDTV 1292
|
||||||
#define STATIC_HUEVALUE 1293
|
#define STATIC_HUEVALUE 1293
|
||||||
|
#define CB_SKIP_7BIT 1294
|
||||||
#define MENU_NETWORK 40040
|
#define MENU_NETWORK 40040
|
||||||
#define MENU_PALETTE 40041
|
#define MENU_PALETTE 40041
|
||||||
#define MENU_SOUND 40042
|
#define MENU_SOUND 40042
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
char str[5];
|
||||||
|
extern int newppu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called when the dialog closes.
|
* This function is called when the dialog closes.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +31,27 @@ void CloseTimingDialog(HWND hwndDlg)
|
||||||
eoptions &= ~EO_NOTHROTTLE;
|
eoptions &= ~EO_NOTHROTTLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
overclocked = (IsDlgButtonChecked(hwndDlg, CB_OVERCLOCKING) == BST_CHECKED);
|
||||||
|
skip_7bit_overclocking = (IsDlgButtonChecked(hwndDlg, CB_SKIP_7BIT) == BST_CHECKED);
|
||||||
|
|
||||||
|
GetDlgItemText(hwndDlg, IDC_EXTRA_SCANLINES, str, 4);
|
||||||
|
sscanf(str,"%d",&extrascanlines);
|
||||||
|
|
||||||
|
if (extrascanlines < 0)
|
||||||
|
{
|
||||||
|
extrascanlines = 0;
|
||||||
|
MessageBox(hwndDlg, "Overclocking is when you speed up your CPU, not slow it down!", "Error", MB_OK);
|
||||||
|
sprintf(str,"%d",extrascanlines);
|
||||||
|
SetDlgItemText(hwndDlg,IDC_EXTRA_SCANLINES,str);
|
||||||
|
}
|
||||||
|
else if (overclocked && newppu)
|
||||||
|
{
|
||||||
|
MessageBox(hwndDlg, "Overclocking doesn't work with new PPU!", "Error", MB_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
EndDialog(hwndDlg, 0);
|
EndDialog(hwndDlg, 0);
|
||||||
|
|
||||||
|
totalscanlines = normalscanlines + (overclocked ? extrascanlines : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,6 +74,17 @@ BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
CheckDlgButton(hwndDlg, CB_DISABLE_SPEED_THROTTLING, BST_CHECKED);
|
CheckDlgButton(hwndDlg, CB_DISABLE_SPEED_THROTTLING, BST_CHECKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(overclocked)
|
||||||
|
CheckDlgButton(hwndDlg, CB_OVERCLOCKING, BST_CHECKED);
|
||||||
|
|
||||||
|
if(skip_7bit_overclocking)
|
||||||
|
CheckDlgButton(hwndDlg, CB_SKIP_7BIT, BST_CHECKED);
|
||||||
|
|
||||||
|
SendDlgItemMessage(hwndDlg,IDC_EXTRA_SCANLINES,EM_SETLIMITTEXT,3,0);
|
||||||
|
|
||||||
|
sprintf(str,"%d",extrascanlines);
|
||||||
|
SetDlgItemText(hwndDlg,IDC_EXTRA_SCANLINES,str);
|
||||||
|
|
||||||
CenterWindowOnScreen(hwndDlg);
|
CenterWindowOnScreen(hwndDlg);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -135,10 +135,12 @@ void FCEU_TogglePPU(void) {
|
||||||
if (newppu) {
|
if (newppu) {
|
||||||
FCEU_DispMessage("New PPU loaded", 0);
|
FCEU_DispMessage("New PPU loaded", 0);
|
||||||
FCEUI_printf("New PPU loaded");
|
FCEUI_printf("New PPU loaded");
|
||||||
|
overclocked = 0;
|
||||||
} else {
|
} else {
|
||||||
FCEU_DispMessage("Old PPU loaded", 0);
|
FCEU_DispMessage("Old PPU loaded", 0);
|
||||||
FCEUI_printf("Old PPU loaded");
|
FCEUI_printf("Old PPU loaded");
|
||||||
}
|
}
|
||||||
|
normalscanlines = (dendy ? 290 : 240)+newppu; // use flag as number!
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
SetMainWindowText();
|
SetMainWindowText();
|
||||||
#endif
|
#endif
|
||||||
|
@ -856,6 +858,11 @@ void FCEU_ResetVidSys(void) {
|
||||||
|
|
||||||
PAL = w ? 1 : 0;
|
PAL = w ? 1 : 0;
|
||||||
|
|
||||||
|
if (newppu)
|
||||||
|
overclocked = 0;
|
||||||
|
|
||||||
|
normalscanlines = (dendy ? 290 : 240)+newppu; // use flag as number!
|
||||||
|
totalscanlines = normalscanlines + (overclocked ? extrascanlines : 0);
|
||||||
FCEUPPU_SetVideoSystem(w || dendy);
|
FCEUPPU_SetVideoSystem(w || dendy);
|
||||||
SetSoundVariables();
|
SetSoundVariables();
|
||||||
}
|
}
|
||||||
|
@ -921,18 +928,23 @@ int FCEUI_GetCurrentVidSystem(int *slstart, int *slend) {
|
||||||
void FCEUI_SetRegion(int region) {
|
void FCEUI_SetRegion(int region) {
|
||||||
switch (region) {
|
switch (region) {
|
||||||
case 0: // NTSC
|
case 0: // NTSC
|
||||||
|
normalscanlines = 240;
|
||||||
pal_emulation = 0;
|
pal_emulation = 0;
|
||||||
dendy = 0;
|
dendy = 0;
|
||||||
break;
|
break;
|
||||||
case 1: // PAL
|
case 1: // PAL
|
||||||
|
normalscanlines = 240;
|
||||||
pal_emulation = 1;
|
pal_emulation = 1;
|
||||||
dendy = 0;
|
dendy = 0;
|
||||||
break;
|
break;
|
||||||
case 2: // Dendy
|
case 2: // Dendy
|
||||||
|
normalscanlines = 290;
|
||||||
pal_emulation = 0;
|
pal_emulation = 0;
|
||||||
dendy = 1;
|
dendy = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
normalscanlines += newppu;
|
||||||
|
totalscanlines = normalscanlines + (overclocked ? extrascanlines : 0);
|
||||||
FCEUI_SetVidSystem(pal_emulation);
|
FCEUI_SetVidSystem(pal_emulation);
|
||||||
RefreshThrottleFPS();
|
RefreshThrottleFPS();
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
|
@ -343,6 +343,9 @@ static int maxsprites = 8;
|
||||||
|
|
||||||
//scanline is equal to the current visible scanline we're on.
|
//scanline is equal to the current visible scanline we're on.
|
||||||
int scanline;
|
int scanline;
|
||||||
|
int normalscanlines;
|
||||||
|
int extrascanlines = 0;
|
||||||
|
int totalscanlines;
|
||||||
int g_rasterpos;
|
int g_rasterpos;
|
||||||
static uint32 scanlines_per_frame;
|
static uint32 scanlines_per_frame;
|
||||||
|
|
||||||
|
@ -1759,7 +1762,7 @@ int FCEUPPU_Loop(int skip) {
|
||||||
kook ^= 1;
|
kook ^= 1;
|
||||||
}
|
}
|
||||||
if (GameInfo->type == GIT_NSF)
|
if (GameInfo->type == GIT_NSF)
|
||||||
X6502_Run((256 + 85) * (dendy ? 290 : 240));
|
X6502_Run((256 + 85) * normalscanlines);
|
||||||
#ifdef FRAMESKIP
|
#ifdef FRAMESKIP
|
||||||
else if (skip) {
|
else if (skip) {
|
||||||
int y;
|
int y;
|
||||||
|
@ -1786,14 +1789,22 @@ int FCEUPPU_Loop(int skip) {
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
int x, max, maxref;
|
int x, max, maxref;
|
||||||
|
|
||||||
deemp = PPU[1] >> 5;
|
deemp = PPU[1] >> 5;
|
||||||
for (scanline = 0; scanline < (dendy ? 290 : 240); ) { //scanline is incremented in DoLine. Evil. :/
|
|
||||||
|
// manual samples can't play correctly with overclocking
|
||||||
|
if (DMC_7bit && skip_7bit_overclocking)
|
||||||
|
totalscanlines = normalscanlines;
|
||||||
|
else
|
||||||
|
totalscanlines = normalscanlines + (overclocked ? extrascanlines : 0);
|
||||||
|
|
||||||
|
for (scanline = 0; scanline < totalscanlines; ) { //scanline is incremented in DoLine. Evil. :/
|
||||||
deempcnt[deemp]++;
|
deempcnt[deemp]++;
|
||||||
if (scanline < 240)
|
if (scanline < normalscanlines)
|
||||||
DEBUG(FCEUD_UpdatePPUView(scanline, 1));
|
DEBUG(FCEUD_UpdatePPUView(scanline, 1));
|
||||||
DoLine();
|
DoLine();
|
||||||
}
|
}
|
||||||
|
DMC_7bit = 0;
|
||||||
|
|
||||||
if (MMC5Hack) MMC5_hb(scanline);
|
if (MMC5Hack) MMC5_hb(scanline);
|
||||||
for (x = 1, max = 0, maxref = 0; x < 7; x++) {
|
for (x = 1, max = 0, maxref = 0; x < 7; x++) {
|
||||||
if (deempcnt[x] > max) {
|
if (deempcnt[x] > max) {
|
||||||
|
@ -2032,7 +2043,8 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
//capture the initial xscroll
|
//capture the initial xscroll
|
||||||
//int xscroll = ppur.fh;
|
//int xscroll = ppur.fh;
|
||||||
//render 241/291 scanlines (1 dummy at beginning, dendy's 50 at the end)
|
//render 241/291 scanlines (1 dummy at beginning, dendy's 50 at the end)
|
||||||
for (int sl = 0; sl < (dendy ? 291 : 241); sl++) {
|
//ignore overclocking!
|
||||||
|
for (int sl = 0; sl < normalscanlines; sl++) {
|
||||||
spr_read.start_scanline();
|
spr_read.start_scanline();
|
||||||
|
|
||||||
g_rasterpos = 0;
|
g_rasterpos = 0;
|
||||||
|
@ -2318,6 +2330,8 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
runppu(1);
|
runppu(1);
|
||||||
} //scanline loop
|
} //scanline loop
|
||||||
|
|
||||||
|
DMC_7bit = 0;
|
||||||
|
|
||||||
if (MMC5Hack) MMC5_hb(240);
|
if (MMC5Hack) MMC5_hb(240);
|
||||||
|
|
||||||
//idle for one line
|
//idle for one line
|
||||||
|
|
|
@ -34,9 +34,11 @@ extern void (*FFCEUX_PPUWrite)(uint32 A, uint8 V);
|
||||||
extern uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A);
|
extern uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A);
|
||||||
void FFCEUX_PPUWrite_Default(uint32 A, uint8 V);
|
void FFCEUX_PPUWrite_Default(uint32 A, uint8 V);
|
||||||
|
|
||||||
extern int scanline;
|
|
||||||
extern int g_rasterpos;
|
extern int g_rasterpos;
|
||||||
extern uint8 PPU[4];
|
extern uint8 PPU[4];
|
||||||
|
extern bool overclocked;
|
||||||
|
extern bool skip_7bit_overclocking;
|
||||||
|
extern bool DMC_7bit;
|
||||||
|
|
||||||
enum PPUPHASE {
|
enum PPUPHASE {
|
||||||
PPUPHASE_VBL, PPUPHASE_BG, PPUPHASE_OBJ
|
PPUPHASE_VBL, PPUPHASE_BG, PPUPHASE_OBJ
|
||||||
|
|
|
@ -58,6 +58,7 @@ uint8 EnabledChannels=0; // $4015 / Sound channels enable and status
|
||||||
uint8 IRQFrameMode=0; // $4017 / Frame counter control / xx000000
|
uint8 IRQFrameMode=0; // $4017 / Frame counter control / xx000000
|
||||||
|
|
||||||
uint8 InitialRawDALatch=0; // used only for lua
|
uint8 InitialRawDALatch=0; // used only for lua
|
||||||
|
bool DMC_7bit = 0; // used to skip overclocking
|
||||||
ENVUNIT EnvUnits[3];
|
ENVUNIT EnvUnits[3];
|
||||||
|
|
||||||
static const int RectDuties[4]={1,2,4,6};
|
static const int RectDuties[4]={1,2,4,6};
|
||||||
|
@ -311,7 +312,8 @@ static DECLFW(Write_DMCRegs)
|
||||||
|
|
||||||
switch(A)
|
switch(A)
|
||||||
{
|
{
|
||||||
case 0x00:DoPCM();
|
case 0x00:
|
||||||
|
DoPCM();
|
||||||
LoadDMCPeriod(V&0xF);
|
LoadDMCPeriod(V&0xF);
|
||||||
|
|
||||||
if(SIRQStat&0x80)
|
if(SIRQStat&0x80)
|
||||||
|
@ -325,15 +327,24 @@ static DECLFW(Write_DMCRegs)
|
||||||
}
|
}
|
||||||
DMCFormat=V;
|
DMCFormat=V;
|
||||||
break;
|
break;
|
||||||
case 0x01:DoPCM();
|
case 0x01:
|
||||||
|
DoPCM();
|
||||||
InitialRawDALatch=V&0x7F;
|
InitialRawDALatch=V&0x7F;
|
||||||
RawDALatch=InitialRawDALatch;
|
RawDALatch=InitialRawDALatch;
|
||||||
|
if (RawDALatch)
|
||||||
|
DMC_7bit = 1;
|
||||||
|
break;
|
||||||
|
case 0x02:
|
||||||
|
DMCAddressLatch=V;
|
||||||
|
if (V)
|
||||||
|
DMC_7bit = 0;
|
||||||
|
break;
|
||||||
|
case 0x03:
|
||||||
|
DMCSizeLatch=V;
|
||||||
|
if (V)
|
||||||
|
DMC_7bit = 0;
|
||||||
break;
|
break;
|
||||||
case 0x02:DMCAddressLatch=V;break;
|
|
||||||
case 0x03:DMCSizeLatch=V;break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(StatusWrite)
|
static DECLFW(StatusWrite)
|
||||||
|
@ -345,6 +356,7 @@ static DECLFW(StatusWrite)
|
||||||
DoTriangle();
|
DoTriangle();
|
||||||
DoNoise();
|
DoNoise();
|
||||||
DoPCM();
|
DoPCM();
|
||||||
|
|
||||||
for(x=0;x<4;x++)
|
for(x=0;x<4;x++)
|
||||||
if(!(V&(1<<x))) lengthcount[x]=0; /* Force length counters to 0. */
|
if(!(V&(1<<x))) lengthcount[x]=0; /* Force length counters to 0. */
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ void (*MapIRQHook)(int a);
|
||||||
int __x=x; \
|
int __x=x; \
|
||||||
_tcount+=__x; \
|
_tcount+=__x; \
|
||||||
_count-=__x*48; \
|
_count-=__x*48; \
|
||||||
timestamp+=__x; \
|
if (scanline < normalscanlines || scanline == totalscanlines) timestamp+=__x; \
|
||||||
}
|
}
|
||||||
|
|
||||||
//normal memory read
|
//normal memory read
|
||||||
|
@ -493,6 +493,8 @@ extern int test; test++;
|
||||||
temp=_tcount;
|
temp=_tcount;
|
||||||
_tcount=0;
|
_tcount=0;
|
||||||
if(MapIRQHook) MapIRQHook(temp);
|
if(MapIRQHook) MapIRQHook(temp);
|
||||||
|
|
||||||
|
if (scanline < normalscanlines || scanline == totalscanlines)
|
||||||
FCEU_SoundCPUHook(temp);
|
FCEU_SoundCPUHook(temp);
|
||||||
#ifdef _S9XLUA_H
|
#ifdef _S9XLUA_H
|
||||||
CallRegisteredLuaMemHook(_PC, 1, 0, LUAMEMHOOK_EXEC);
|
CallRegisteredLuaMemHook(_PC, 1, 0, LUAMEMHOOK_EXEC);
|
||||||
|
|
|
@ -47,8 +47,9 @@ void X6502_RunDebug(int32 cycles);
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
extern uint32 timestamp;
|
extern uint32 timestamp;
|
||||||
|
extern int scanline;
|
||||||
|
extern int normalscanlines;
|
||||||
|
extern int totalscanlines;
|
||||||
|
|
||||||
#define N_FLAG 0x80
|
#define N_FLAG 0x80
|
||||||
#define V_FLAG 0x40
|
#define V_FLAG 0x40
|
||||||
|
|
Loading…
Reference in New Issue