1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-25 02:33:26 +00:00

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

View File

@ -352,6 +352,13 @@ impl<M: Bus> CPU<M> {
(Instruction::JMP, OpInput::UseAddress(addr)) => self.jump(addr), (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)) => { (Instruction::LDA, OpInput::UseImmediate(val)) => {
debug!("load A immediate: {}", val); debug!("load A immediate: {}", val);
self.load_accumulator(val as i8); self.load_accumulator(val as i8);