mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-23 02:49:07 +00:00
sim: sim_moves: handle MOVSI, add unit test
This commit is contained in:
parent
3b96e2333c
commit
6561814cd8
@ -229,6 +229,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#202 -> sim_moves:handle_MOVEM(Core, Mem, IR, EA);
|
||||
8#203 -> sim_moves:handle_MOVES(Core, Mem, IR, EA);
|
||||
8#204 -> sim_moves:handle_MOVS(Core, Mem, IR, EA);
|
||||
8#205 -> sim_moves:handle_MOVSI(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_MOVS/4
|
||||
, handle_MOVSI/4
|
||||
]).
|
||||
|
||||
-include("sim_core.hrl").
|
||||
@ -131,6 +132,12 @@ handle_MOVS(Core, Mem, IR, EA) ->
|
||||
fun(Core1, Mem1) -> handle_MOVS(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
-spec handle_MOVSI(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_MOVSI(Core, Mem, IR, #ea{offset = E}) ->
|
||||
AC = IR band 8#17,
|
||||
sim_core:next_pc(sim_core:set_ac(Core, AC, E bsl 18), Mem).
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@ -48,6 +48,7 @@
|
||||
-define(OP_MOVEM, 8#202).
|
||||
-define(OP_MOVES, 8#203).
|
||||
-define(OP_MOVS, 8#204).
|
||||
-define(OP_MOVSI, 8#205).
|
||||
-define(OP_EXCH, 8#250).
|
||||
|
||||
%% 2.1.1 Exchange Instruction ==================================================
|
||||
@ -144,6 +145,15 @@ movs_test() ->
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(8#42, 8#27)} % AC1 = 42,,27
|
||||
]).
|
||||
|
||||
movsi_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVSI, 1, 0, 0, -1)} % 1,,100/ MOVSI 1,-1
|
||||
, {1, 8#101, ?INSN_INVALID} % 1,,101/ <invalid>
|
||||
],
|
||||
expect(Prog, [], {1, 8#101}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, 0)} % AC1 = -1,,0
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user