diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 04f0ff1..cd0ddfc 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index 13bf651..09f8295 100644 --- a/main.cpp +++ b/main.cpp @@ -57,6 +57,7 @@ public: std::mt19937 gen; //Standard mersenne_twister_engine seeded with rd() std::uniform_int_distribution<> distrib; std::arraykeymap{X,K1,K2,K3,Q,W,E,A,S,D,Z,C,K4,R,F,V}; + bool USE_ORIGINAL_CHIP8_SET=true; std::string Display8(int number){ std::bitset<8>numb(number); @@ -207,7 +208,14 @@ public: reg[X]-=reg[Y]; }break; case 0x6:{//Shift Right - //reg[X]=reg[Y]; + if (USE_ORIGINAL_CHIP8_SET){ + /* + In the CHIP-8 interpreter for the original COSMAC VIP, this instruction did the following: It put the value of VY into VX, and then shifted the value in VX 1 bit to the right (8XY6) or left (8XYE). VY was not affected, but the flag register VF would be set to the bit that was shifted out. + + However, starting with CHIP-48 and SUPER-CHIP in the early 1990s, these instructions were changed so that they shifted VX in place, and ignored the Y completely. + */ + reg[X]=reg[Y]; + } reg[0xF]=reg[X]&0x1; reg[X]>>=1; }break; @@ -220,12 +228,16 @@ public: }break; case 0xE:{//Shift Left //std::cout<<"Y is: "<<(int)Y<>7; - std::cout<<"Register F: "<<(int)reg[0xF]<