diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 557cf5d..e1f8673 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index 130303a..b1584f5 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,6 @@ #include "pixelGameEngine.h" #include "Polygon.h" +#include #include #include @@ -26,7 +27,6 @@ public: 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, //Font starts at 0x50 0xF0,0x90,0x90,0x90,0xF0, // 0 0x20,0x60,0x20,0x20,0x70, // 1 @@ -65,12 +65,24 @@ public: bool OnUserCreate() override { - memory[0x200]=0x60; - memory[0x201]=0x0A; - memory[0x202]=0x70; - memory[0x203]=0x04; - memory[0x204]=0x12; - memory[0x205]=0x00; + /*std::ifstream file("IBM Logo.ch8",std::ios_base::binary); + uint16_t counter=0x200; + while (file.good()){ + int val = file.get(); + if (val!=-1){ + memory[counter++]=val; + } + }*/ + memory[0x200]=0x00; + memory[0x201]=0xE0; + memory[0x202]=0xA0; + memory[0x203]=0x50; + memory[0x204]=0x60; + memory[0x205]=0x04; + memory[0x206]=0xD0; + memory[0x207]=0x05; + memory[0x208]=0x12; + memory[0x209]=0x08; //0x200 program start return true; } @@ -100,7 +112,7 @@ public: uint8_t N = opcode&0xF; uint8_t NN = opcode&0x00FF; uint16_t NNN = opcode&0x0FFF; - std::cout<<"Opcode 0x"<>(8-x-1)&0x1; + if (display[(start_Y+y)*ScreenWidth()+(start_X+x)]&&pixel){ + reg[0xF]=0; + } + display[(start_Y+y)*ScreenWidth()+(start_X+x)]^=pixel; + if (pixel){ + std::cout<<"X"; + } else { + std::cout<<" "; + } + } + } + std::cout<