Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

Commit

Permalink
Fixed Daedalean Opus.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bezier89 committed Oct 26, 2009
1 parent df27068 commit cd32ea8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions CPU.java
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,7 @@ public void run()

case 0x02: // RLC D
numCycles+=2;
DREG = (DREG & BIT7) >> 3;
FREG = (DREG & BIT7) >> 3;
DREG = ((DREG << 1) | (DREG >> 7)) & 0xFF;
if (DREG == 0)
FREG |= ZERO;
Expand All @@ -1969,7 +1969,7 @@ public void run()

case 0x05: // RLC L
numCycles+=2;
LREG = (LREG & BIT7) >> 3;
FREG = (LREG & BIT7) >> 3;
LREG = ((LREG << 1) | (LREG >> 7)) & 0xFF;
if (LREG == 0)
FREG |= ZERO;
Expand Down Expand Up @@ -4045,13 +4045,9 @@ else if ((IE & BIT4) != 0 && (IF & BIT4) != 0)
}
// Finished drawing current scanline

nextHBlank += CYCLES_PER_LINE;

LY = ++scanline;
if (scanline == LYC)
{
STAT |= BIT2;
// To-do: Currently breaks Pipe Dream (not that it worked before), need to figure out why...
//System.out.printf("%d scanline, LYC interrupt\n", scanline);
if ((STAT & BIT6) != 0)
IF |= BIT1;
Expand All @@ -4061,8 +4057,8 @@ else if ((IE & BIT4) != 0 && (IF & BIT4) != 0)

//System.out.println(PC);

if (numCycles >= nextVBlank)
{
if (scanline == GUI.screenHeight)
{
IF |= BIT0; // Request VBLANK
STAT = (STAT & 0xFC) | 0x01;
if ((STAT & BIT4) != 0) // LCDC V-Blank
Expand All @@ -4071,6 +4067,9 @@ else if ((IE & BIT4) != 0 && (IF & BIT4) != 0)
nextVBlank += CYCLES_PER_LINE*154;
}

LY = ++scanline;
nextHBlank += CYCLES_PER_LINE;

if (numCycles >= 0x100000)
{
numCycles &= 0xFFFFF;
Expand Down

0 comments on commit cd32ea8

Please sign in to comment.