Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Jan 25, 2024
1 parent 662cca5 commit 363b0be
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
27 changes: 11 additions & 16 deletions Emulator/Components/C64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,9 @@ C64::getThreadMode() const
void
C64::execute()
{
cpu.debugger.watchpointPC = -1;
cpu.debugger.breakpointPC = -1;

switch ((drive8.isPoweredOn() ? 2 : 0) + (drive9.isPoweredOn() ? 1 : 0)) {

case 0b00: execute <false,false> (); break;
Expand All @@ -1026,21 +1029,20 @@ template <bool enable8, bool enable9> void
C64::execute()
{
bool exit = false;

cpu.debugger.watchpointPC = -1;
cpu.debugger.breakpointPC = -1;

//
// Run the emulator for one cycle
//

isize lastCycle = vic.getCyclesPerLine();

do {

// Emulate the (rest of the) current scanline
//
// Run the emulator for the (rest of the) current scanline
//

for (; rasterCycle <= lastCycle; rasterCycle++) {

//
// Run the emulator for one cycle
//

// <---------- o2 low phase ----------->|<- o2 high phase ->|
// | |
// ,-- C64 ------------------------------|-------------------|--,
Expand Down Expand Up @@ -1497,13 +1499,6 @@ C64::finishFrame()
while (scanline != 0 || rasterCycle > 1) executeOneCycle();
}

void
C64::beginScanline()
{
if (scanline == 0) vic.beginFrame();
vic.beginScanline(scanline);
}

void
C64::endScanline()
{
Expand Down
3 changes: 0 additions & 3 deletions Emulator/Components/C64.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,6 @@ class C64 : public Thread {

// Finishes the current frame
void finishFrame();

// Invoked before executing the first cycle of a scanline
void beginScanline();

private:

Expand Down
8 changes: 7 additions & 1 deletion Emulator/Components/VICII/VICII.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,8 +1142,14 @@ VICII::processDelayedActions()
}

void
VICII::beginScanline(u16 line)
VICII::beginScanline()
{
u16 line = c64.scanline;

// Check if a new frame begins
if (line == 0) beginFrame();

// Reset some variables
verticalFrameFFsetCond = false;

// Adjust the texture pointers
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Components/VICII/VICII.h
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ class VICII : public SubComponent {
/* Prepares VICII for drawing a new scanline. This function is called
* prior to the first cycle of each scanline.
*/
void beginScanline(u16 line);
void beginScanline();

/* Finishes up a scanline. This function is called after the last cycle
* of each scanline.
Expand Down
2 changes: 1 addition & 1 deletion Emulator/Components/VICII/VICII_cycles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace vc64 {
template <u16 flags> void
VICII::cycle1()
{
c64.beginScanline();
beginScanline();

// Phi2.5 Fetch (previous cycle)
PAL { sAccess3 <flags,2> (); }
Expand Down

0 comments on commit 363b0be

Please sign in to comment.