diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 340731a..8bfa3b1 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index 895f917..ebf58f6 100644 --- a/main.cpp +++ b/main.cpp @@ -9,7 +9,7 @@ using namespace olc; -bool USE_DEBUG_DISPLAY=false; +bool USE_DEBUG_DISPLAY=true; int EMULATOR_SCREEN_WIDTH = 64; int EMULATOR_SCREEN_HEIGHT = 32; int EMULATOR_PIXEL_SIZE=5; @@ -154,12 +154,23 @@ public: advanceTimers(); //After 10 instructions, 1/60th of a second has passed. } DrawDisplay(); + } else + if (GetKey(END).bHeld){ + for (int i=0;i<10;i++){ + RunInstruction(); + instructionCount++; + } + advanceTimers(); //After 10 instructions, 1/60th of a second has passed. + DrawDisplay(); } } } if (IsTextEntryEnabled()){ DrawStringDecal({2,2},"Goto Memory Address: "+TextEntryGetString()); } + if (GetKey(F12).bPressed){ + PAUSED=!PAUSED; + } std::stringstream s; s<<"PC: 0x"<reg[Y]){ + bool carryFlag=false; + if (reg[X]>=reg[Y]){ //reg[0xF]=1; - carryFlag=1; + carryFlag=true; } reg[X]-=reg[Y]; reg[0xF]=carryFlag; @@ -527,7 +542,7 @@ public: case 0x7:{//sets VX to the result of VY - VX. It's a reverse subtraction. //reg[0xF]=0; bool carryFlag=false; - if (reg[Y]>reg[X]){ + if (reg[Y]>=reg[X]){ //reg[0xF]=1; carryFlag=true; } @@ -612,13 +627,13 @@ public: }break; case 0x1E:{//The index register I will get the value in VX added to it. //reg[0xF]=0; - bool carryFlag=false; + /*bool carryFlag=false; if (index+reg[X]>=0x1000){ //reg[0xF]=1; carryFlag=true; - } + }*/ index+=reg[X]; - reg[0xF]=carryFlag; + //reg[0xF]=carryFlag; }break; case 0x0A:{//This instruction “blocks”; it stops executing instructions and waits for key input for (int i=0;i