diff src/sdl/SDL.cpp @ 92:1ff2c546f5ad

added tick(), which allows one to step through each opcode of gameboy
author Robert McIntyre <rlm@mit.edu>
date Sun, 11 Mar 2012 19:07:31 -0500
parents ff6f1acae59e
children 95b2758dd517
line wrap: on
line diff
     1.1 --- a/src/sdl/SDL.cpp	Sun Mar 11 13:53:27 2012 -0500
     1.2 +++ b/src/sdl/SDL.cpp	Sun Mar 11 19:07:31 2012 -0500
     1.3 @@ -2062,30 +2062,18 @@
     1.4    SDL_Quit();
     1.5  }
     1.6  
     1.7 +int tick () {
     1.8 +  return theEmulator.emuMain(theEmulator.emuCount);
     1.9 +}
    1.10  
    1.11  void step () {
    1.12    if(!paused && active) {
    1.13 -    if(debugger && theEmulator.emuHasDebugger)
    1.14 -      dbgMain();
    1.15 -    else {
    1.16 -      //printf("RLM: emulator main\n");
    1.17 -      theEmulator.emuMain(theEmulator.emuCount);
    1.18 -      //printf("RLM: emulator main called\n");
    1.19 -      if(rewindSaveNeeded && rewindMemory && theEmulator.emuWriteMemState) {
    1.20 -	rewindCount++;
    1.21 -	if(rewindCount > 8)
    1.22 -	  rewindCount = 8;
    1.23 -	if(theEmulator.emuWriteMemState &&
    1.24 -	   theEmulator.emuWriteMemState(&rewindMemory[rewindPos*REWIND_SIZE], 
    1.25 -					REWIND_SIZE)) {
    1.26 -	  rewindPos = ++rewindPos & 7;
    1.27 -	  if(rewindCount == 8)
    1.28 -	    rewindTopPos = ++rewindTopPos & 7;
    1.29 -	}
    1.30 -      }
    1.31 -
    1.32 -      rewindSaveNeeded = false;
    1.33 +    //printf("RLM: emulator main\n");
    1.34 +    int frameComplete = 0;
    1.35 +    while (!(frameComplete)){
    1.36 +      frameComplete = theEmulator.emuMain(theEmulator.emuCount);
    1.37      }
    1.38 +    //printf("RLM: emulator main called\n");
    1.39    } else {
    1.40      SDL_Delay(500);
    1.41    }