diff --git a/erlang/apps/sim/src/sim_core.erl b/erlang/apps/sim/src/sim_core.erl index 4afe08c..6914464 100644 --- a/erlang/apps/sim/src/sim_core.erl +++ b/erlang/apps/sim/src/sim_core.erl @@ -275,6 +275,8 @@ dispatch(Core, Mem, IR, EA) -> 8#423 -> sim_boolean:handle_ANDCMB(Core, Mem, IR, EA); 8#424 -> next_pc(Core, Mem); % SETA = no-op 8#425 -> next_pc(Core, Mem); % SETAI = no-op + 8#426 -> sim_moves:handle_MOVEM(Core, Mem, IR, EA); % SETAM = MOVEM + 8#427 -> sim_moves:handle_MOVEM(Core, Mem, IR, EA); % SETAB = MOVEM _ -> PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset, {Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}} diff --git a/erlang/apps/sim/test/sim_boolean_tests.erl b/erlang/apps/sim/test/sim_boolean_tests.erl index 7dbed3a..ee4a850 100644 --- a/erlang/apps/sim/test/sim_boolean_tests.erl +++ b/erlang/apps/sim/test/sim_boolean_tests.erl @@ -66,6 +66,8 @@ -define(OP_ANDCMB, 8#423). -define(OP_SETA, 8#424). -define(OP_SETAI, 8#425). +-define(OP_SETAM, 8#426). +-define(OP_SETAB, 8#426). %% 2.4 Boolean Functions ======================================================= @@ -350,6 +352,28 @@ setai_test() -> ], expect(Prog, [], {1, 8#101}, ?DEFAULT_FLAGS, []). +setam_test() -> + Prog = + [ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#42)} % 1,,100/ MOVEI 1,42 + , {1, 8#101, ?INSN(?OP_SETAM, 1, 0, 0, 8#150)} % 1,,101/ SETAM 1,150 + , {1, 8#102, ?INSN_INVALID} % 1,,102/ + , {1, 8#150, 8#27} % 1,,150/ 0,,27 + ], + expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS, + [ {#ea{section = 1, offset = 8#150, islocal = false}, 8#42} % C(1,,150) = 42 + ]). + +setab_test() -> + Prog = + [ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#42)} % 1,,100/ MOVEI 1,42 + , {1, 8#101, ?INSN(?OP_SETAB, 1, 0, 0, 8#150)} % 1,,101/ SETAB 1,150 + , {1, 8#102, ?INSN_INVALID} % 1,,102/ + , {1, 8#150, 8#27} % 1,,150/ 0,,27 + ], + expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS, + [ {#ea{section = 1, offset = 8#150, islocal = false}, 8#42} % C(1,,150) = 42 + ]). + %% Common code to run short sequences ========================================== expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->