mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-02-26 00:43:40 +00:00
sim: sim_moves: handle MOVNI, add unit test
This commit is contained in:
@@ -240,6 +240,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#206 -> sim_moves:handle_MOVSM(Core, Mem, IR, EA);
|
||||
8#207 -> sim_moves:handle_MOVSS(Core, Mem, IR, EA);
|
||||
8#210 -> sim_moves:handle_MOVN(Core, Mem, IR, EA);
|
||||
8#211 -> sim_moves:handle_MOVNI(Core, Mem, IR, EA);
|
||||
8#250 -> sim_moves:handle_EXCH(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
, handle_MOVEM/4
|
||||
, handle_MOVES/4
|
||||
, handle_MOVN/4
|
||||
, handle_MOVNI/4
|
||||
, handle_MOVS/4
|
||||
, handle_MOVSI/4
|
||||
, handle_MOVSM/4
|
||||
@@ -175,6 +176,12 @@ handle_MOVN(Core, Mem, IR, EA) ->
|
||||
fun(Core1, Mem1) -> handle_MOVN(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
-spec handle_MOVNI(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_MOVNI(Core, Mem, IR, #ea{offset = E}) ->
|
||||
AC = IR band 8#17,
|
||||
sim_core:next_pc(sim_core:set_ac(Core, AC, (-E) band ((1 bsl 36) - 1)), Mem).
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
-define(OP_MOVSM, 8#206).
|
||||
-define(OP_MOVSS, 8#207).
|
||||
-define(OP_MOVN, 8#210).
|
||||
-define(OP_MOVNI, 8#211).
|
||||
-define(OP_EXCH, 8#250).
|
||||
|
||||
%% 2.1.1 Exchange Instruction ==================================================
|
||||
@@ -224,6 +225,15 @@ movn_minint_test() ->
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, 1 bsl 35} % AC1 = 400000,,0
|
||||
]).
|
||||
|
||||
movni_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVNI, 1, 0, 0, 8#42)} % 1,,100/ MOVNI 1,42
|
||||
, {1, 8#101, ?INSN_INVALID} % 1,,101/ <invalid>
|
||||
],
|
||||
expect(Prog, [], {1, 8#101}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, (-8#42) band ((1 bsl 36) - 1)} % AC1 = -42
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Reference in New Issue
Block a user