Skip to content

Commit

Permalink
change semantics of Store32: write to address stored at first argument
Browse files Browse the repository at this point in the history
  • Loading branch information
morganthomas committed Nov 13, 2023
1 parent b4b46bc commit ae464cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,11 @@ where
let opcode = <Self as Instruction<M>>::OPCODE;
let clk = state.cpu().clock;
let read_addr = (state.cpu().fp as i32 + ops.c()) as u32;
let write_addr = (state.cpu().fp as i32 + ops.b()) as u32;
let write_addr_loc = (state.cpu().fp as i32 + ops.b()) as u32;
let pc = state.cpu().pc;
let cell = state.mem_mut().read(clk, read_addr, true, pc, opcode, 0, "");
state.mem_mut().write(clk, write_addr, cell, true);
let write_addr = state.mem_mut().read(clk, write_addr_loc.into(), true, pc, opcode, 0, "");
let cell = state.mem_mut().read(clk, read_addr, true, pc, opcode, 1, "");
state.mem_mut().write(clk, write_addr.into(), cell, true);
state.cpu_mut().pc += 1;
state
.cpu_mut()
Expand Down

0 comments on commit ae464cf

Please sign in to comment.