From 229509bc3b94fb481af65585ceb910db6d02bdec Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Fri, 6 Jan 2023 00:26:15 -0600 Subject: [PATCH] Included original chipset functionality Co-authored-by: sigonasr2 --- C++ProjectTemplate | Bin 585008 -> 585008 bytes main.cpp | 30 +++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 04f0ff12b2a48f68a30dfbeebee7cd7b76fa55fc..cd0ddfca8daa2719b738c839363ed6ecbca0982f 100755 GIT binary patch delta 517 zcmdmROL+qjRWOUhiCRWm3q8I4;M9Jn7(Z{PjjWQZHuo^EUCwxWveoKz#^T9~R{!Fy zdBVid&BEj{!=qQUVDri~2bsj)JwymS0c$O}5`Wm2uDH ztD8$1gExC`(P!nAx`EKbx4C`i6)wie%`r#L3NY?&*1FoRb(L|u)>S6A-P|Rq#U=6i z1p#{|F`>0 WVg_OsAZ7((HXvr-?lXzwNfZFe0~1{U delta 517 zcmdmROL+qjRWOT0#1tNB5cJl@svu{@Nq0c0bZth`TyPWazWUJNbjM7dx#La1!Q|LUanh`Rt*cCKyV;YH<4aPD zOQu&(V78pTV*+zZ{XFTv|EpyF{_g|gZ$NA>`}cnb5WfXtA-TW*ZGd>9GEfePxm5oC zw*}%3ApWEF_rIpb-~T#5`79t_3&bCQ*jWDW{~tiSN#XB*Va31y>vgc>=Ri3=jlcE( zJ%I{9*g+FQ!}$1UE1<p?B#tLh0I6FO;s5{u 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]<