first stab at implementing the JSR instruction

This commit is contained in:
Sam M W 2023-04-15 20:58:31 +01:00
parent 8e797b70fa
commit 239992ea6c
1 changed files with 7 additions and 0 deletions

View File

@ -352,6 +352,13 @@ impl<M: Bus> CPU<M> {
(Instruction::JMP, OpInput::UseAddress(addr)) => self.jump(addr),
(Instruction::JSR, OpInput::UseAddress(addr)) => {
for b in self.registers.program_counter.wrapping_sub(1).to_le_bytes() {
self.push_on_stack(b);
}
self.jump(addr);
}
(Instruction::LDA, OpInput::UseImmediate(val)) => {
debug!("load A immediate: {}", val);
self.load_accumulator(val as i8);