small fixes

This commit is contained in:
2024-02-05 23:35:04 -08:00
parent 2809dbfca8
commit a16a74f146
2 changed files with 9 additions and 8 deletions

View File

@@ -44,15 +44,15 @@ void GameBoy::start(std::string bootrom, std::string game) {
addressSpace.loadGame(game); addressSpace.loadGame(game);
bool quit = false; bool quit = false;
uint32_t cyclesSince = 0;
while (!quit) { while (!quit) {
// Event loop: Check and handle SDL events // Event loop: Check and handle SDL events
// if(SDL_PollEvent(&event)) if (SDL_PollEvent(&event)) {
// { if (event.type == SDL_QUIT) {
// if(event.type == SDL_QUIT) quit = true; // Set the quit flag when the close button is hit
// { }
// quit = true; // Set the quit flag when the close button is hit }
// }
// }
opcodeHandler(); opcodeHandler();
interruptHandler(); interruptHandler();
@@ -61,7 +61,7 @@ void GameBoy::start(std::string bootrom, std::string game) {
if (PC > 0xFF && addressSpace.getBootromState()) { if (PC > 0xFF && addressSpace.getBootromState()) {
addressSpace.unmapBootrom(); addressSpace.unmapBootrom();
} }
int cyclesSince = cyclesSinceLastRefresh(); cyclesSince = cyclesSinceLastRefresh();
if (cyclesSince > FRAME_DURATION) { if (cyclesSince > FRAME_DURATION) {
lastRefresh = cycles; lastRefresh = cycles;
SDL2present(); SDL2present();

View File

@@ -388,6 +388,7 @@ void GameBoy::opcodeHandler() {
//printf("PC:0x%.2x, Opcode:0x%.2x\n", PC, addressSpace[PC]); //printf("PC:0x%.2x, Opcode:0x%.2x\n", PC, addressSpace[PC]);
if (PC == 0x100) { if (PC == 0x100) {
printf("LY:0x%.2x\n", (*LY)); printf("LY:0x%.2x\n", (*LY));
exit(1);
// printf("PC:0x%.2x, Opcode:0x%.2x\n", PC, addressSpace[PC]); // printf("PC:0x%.2x, Opcode:0x%.2x\n", PC, addressSpace[PC]);
// printf("IME:%b IF:0x%.2x IE:0x%.2x\n", IME, (*IF), (*IE)); // printf("IME:%b IF:0x%.2x IE:0x%.2x\n", IME, (*IF), (*IE));
} }