[cpu] Add Decode for keypress instructions

This commit is contained in:
2024-03-04 19:46:15 +05:30
parent 69dc84d1c5
commit 9329d4e51a
2 changed files with 127 additions and 71 deletions

View File

@@ -103,9 +103,32 @@ impl Device {
let toggle_state = self.draw_sprite_at_location(x, y, n);
self.set_flag_register(toggle_state);
},
remaining=>{
log::error!("Unimplemented instruction {:?}",remaining);
Instruction::JumpAndLink(jump_location) => {
self.stack.push(self.registers.pc);
self.registers.pc = jump_location;
}
Instruction::ReturnFromProcedure =>{
let old_pc = self.stack.pop().expect("Expected value on stack pop");
self.registers.pc = old_pc;
}
Instruction::ConditionalEqSkipNext(_, _) => {}
Instruction::ConditionalInEqSkipNext(_, _) => {}
Instruction::ConditionalEqRegisterSkipNext(_, _) => {}
Instruction::ConditionalInEqRegisterSkipNext(_, _) => {}
Instruction::JumpWithOffset(_, _) => {}
Instruction::RandomOr(_, _) => {}
Instruction::SkipIfKeyPressed(_) => {}
Instruction::SkipIfKeyNotPressed(_) => {}
Instruction::Set(_, _) => {}
Instruction::Or(_, _) => {}
Instruction::And(_, _) => {}
Instruction::Xor(_, _) => {}
Instruction::Add(_, _) => {}
Instruction::Sub(_, _) => {}
Instruction::RShift(_, _) => {}
Instruction::RSub(_, _) => {}
Instruction::LShift(_, _) => {}
};
}
///