diff --git a/basic/src/bin/valida.rs b/basic/src/bin/valida.rs index 5e4eff8..71aa70e 100644 --- a/basic/src/bin/valida.rs +++ b/basic/src/bin/valida.rs @@ -147,7 +147,7 @@ fn show_frame(args: ArgMatches, context: &mut Context) -> Result> let offset = i * -4; let read_addr = (fp + offset) as u32; let string_val = context.machine_.mem().examine(read_addr); - let frameslot_addr = format!("{}(fp)", offset); + let frameslot_addr = format!("0x{:8} | {:3}(fp)", read_addr, offset); let frameslot = format!("{:>7}", frameslot_addr); let frame_str = format!("\n{} : {}", frameslot, string_val); frame += &frame_str; diff --git a/cpu/src/lib.rs b/cpu/src/lib.rs index cbbcd89..2273f2c 100644 --- a/cpu/src/lib.rs +++ b/cpu/src/lib.rs @@ -521,7 +521,8 @@ where .mem_mut() .read(clk, read_addr, true, pc, opcode, 2, "") .into(); - state.cpu_mut().fp += cell; + let offset: i32 = cell as i32; + state.cpu_mut().fp = (state.cpu().fp as i32 + offset) as u32; state.cpu_mut().push_op(Operation::Jalv, opcode, ops); } }