Skip to content

Commit

Permalink
Fix framerate not changing when HF register changes (regression)
Browse files Browse the repository at this point in the history
  • Loading branch information
negativeExponent committed Sep 15, 2024
1 parent 8c49c1b commit 3ccf8d5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions x68k/crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ void CRTC_Init(void)

static void CRTC_ScreenChanged(void)
{
static int last_vidmode = -1;

if ((CRTC_Regs[0x29] & 0x14) == 0x10)
{
TextDotY /= 2;
Expand All @@ -183,6 +185,14 @@ static void CRTC_ScreenChanged(void)
}
else
CRTC_VStep = 2;

VID_MODE = !!(CRTC_Regs[0x29]&0x10);

if (VID_MODE != last_vidmode)
{
last_vidmode = VID_MODE;
CHANGEAV_TIMING = 1;
}
}

uint8_t FASTCALL CRTC_Read(uint32_t adr)
Expand Down Expand Up @@ -211,7 +221,6 @@ void FASTCALL CRTC_Write(uint32_t adr, uint8_t data)
};

uint8_t reg = (uint8_t)(adr&0x3f);
int old_vidmode = VID_MODE;
if (adr<0xe80400)
{
if ( reg>=0x30 ) return;
Expand Down Expand Up @@ -268,7 +277,6 @@ void FASTCALL CRTC_Write(uint32_t adr, uint8_t data)
break;
case 0x29:
HSYNC_CLK = ((CRTC_Regs[0x29]&0x10)?VSYNC_HIGH:VSYNC_NORM)/VLINE_TOTAL;
VID_MODE = !!(CRTC_Regs[0x29]&0x10);
TextDotY = CRTC_VEND-CRTC_VSTART;
CRTC_ScreenChanged();
break;
Expand Down

0 comments on commit 3ccf8d5

Please sign in to comment.