Skip to content

Commit ad22507

Browse files
LeviJacoby1991LeviJacoby1991
authored andcommitted
Began work on opcodes
1 parent b7875ca commit ad22507

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

chip8.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ void chip8::loadGame(std::string game){
3838
}
3939

4040
void chip8::emulateCycle(){
41-
std::cout << memory[512];
41+
opcode = memory[PC] << 8 | memory[PC + 1];
42+
43+
//switch decodes the opcode and then executes it in case body
44+
switch(opcode & 0xF000){
45+
case 0xA000:
46+
IR = opcode & 0x0FFF;
47+
PC += 2;
48+
break;
49+
default:
50+
std::cout << "Unkown opcode: " << std::hex << opcode;
51+
}
4252
}
4353

4454
void chip8::setKeys(){

0 commit comments

Comments
 (0)