mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-05-04 23:16:14 +00:00
sim: sim_moves: handle MOVEM, add unit test
This commit is contained in:
@@ -226,6 +226,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#104 -> sim_kernel:handle_JSYS(Core, Mem, IR, EA);
|
||||
8#200 -> sim_moves:handle_MOVE(Core, Mem, IR, EA);
|
||||
8#201 -> sim_moves:handle_MOVEI(Core, Mem, IR, EA);
|
||||
8#202 -> sim_moves:handle_MOVEM(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,
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
-export([ handle_EXCH/4
|
||||
, handle_MOVE/4
|
||||
, handle_MOVEI/4
|
||||
, handle_MOVEM/4
|
||||
]).
|
||||
|
||||
-include("sim_core.hrl").
|
||||
@@ -78,6 +79,21 @@ handle_MOVEI(Core, Mem, IR, #ea{offset = E}) ->
|
||||
AC = IR band 8#17,
|
||||
sim_core:next_pc(sim_core:set_ac(Core, AC, E), Mem).
|
||||
|
||||
-spec handle_MOVEM(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_MOVEM(Core, Mem, IR, EA) ->
|
||||
AC = IR band 8#17,
|
||||
CA = sim_core:get_ac(Core, AC),
|
||||
handle_MOVEM_1(Core, Mem, CA, EA).
|
||||
|
||||
handle_MOVEM_1(Core, Mem, Word, EA) ->
|
||||
case sim_core:cset(Core, Mem, EA, Word) of
|
||||
{ok, Core1} -> sim_core:next_pc(Core1, Mem);
|
||||
{error, Reason} ->
|
||||
sim_core:page_fault(Core, Mem, ea_address(EA), write, Reason,
|
||||
fun(Core1, Mem1) -> handle_MOVEM_1(Core1, Mem1, Word, EA) end)
|
||||
end.
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
Reference in New Issue
Block a user