mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-02-17 13:17:34 +00:00
sim: sim_boolean: handle IORM, add unit test
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
, handle_ANDM/4
|
||||
, handle_IOR/4
|
||||
, handle_IORI/4
|
||||
, handle_IORM/4
|
||||
, handle_SETMB/4
|
||||
, handle_SETMI/4
|
||||
, handle_SETMM/4
|
||||
@@ -371,6 +372,20 @@ handle_IORI(Core, Mem, IR, EA) ->
|
||||
Word = CA bor EA#ea.offset,
|
||||
sim_core:next_pc(sim_core:set_ac(Core, AC, Word), Mem).
|
||||
|
||||
-spec handle_IORM(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_IORM(Core, Mem, IR, EA) ->
|
||||
case sim_core:c(Core, Mem, EA) of
|
||||
{ok, CE} ->
|
||||
AC = IR band 8#17,
|
||||
CA = sim_core:get_ac(Core, AC),
|
||||
Word = CE bor CA,
|
||||
handle_ANDM_1(Core, Mem, EA, Word);
|
||||
{error, Reason} ->
|
||||
sim_core:page_fault(Core, Mem, ea_address(EA), read, Reason,
|
||||
fun(Core1, Mem1) -> handle_IORM(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@@ -283,6 +283,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#433 -> sim_boolean:handle_XORB(Core, Mem, IR, EA);
|
||||
8#434 -> sim_boolean:handle_IOR(Core, Mem, IR, EA);
|
||||
8#435 -> sim_boolean:handle_IORI(Core, Mem, IR, EA);
|
||||
8#436 -> sim_boolean:handle_IORM(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
-define(OP_XORB, 8#433).
|
||||
-define(OP_IOR, 8#434).
|
||||
-define(OP_IORI, 8#435).
|
||||
-define(OP_IORM, 8#436).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@@ -449,6 +450,17 @@ iori_test() ->
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, 8#777777} % AC1 = 0,,-1
|
||||
]).
|
||||
|
||||
iorm_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
|
||||
, {1, 8#101, ?INSN(?OP_IORM, 1, 0, 0, 8#200)} % 1,,101/ IORM 1,200
|
||||
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
|
||||
, {1, 8#200, ?COMMA2(0, 8#070707)} % 1,,200/ 0,,070707
|
||||
],
|
||||
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, 8#777777} % C(1,,200) = 0,,-1
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Reference in New Issue
Block a user