mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-02-12 19:17:16 +00:00
sim: sim_boolean: handle SETOM, add unit test
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
, handle_SETMI/4
|
||||
, handle_SETMM/4
|
||||
, handle_SETO/4
|
||||
, handle_SETOM/4
|
||||
, handle_SETZ/4
|
||||
, handle_SETZB/4
|
||||
, handle_SETZM/4
|
||||
@@ -771,6 +772,12 @@ handle_SETO(Core, Mem, IR, _EA) ->
|
||||
Word = (1 bsl 36) - 1,
|
||||
sim_core:next_pc(sim_core:set_ac(Core, AC, Word), Mem).
|
||||
|
||||
-spec handle_SETOM(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_SETOM(Core, Mem, _IR, EA) ->
|
||||
Word = (1 bsl 36) - 1,
|
||||
handle_ANDM_1(Core, Mem, EA, Word).
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@@ -315,6 +315,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#473 -> sim_boolean:handle_ORCBB(Core, Mem, IR, EA);
|
||||
8#474 -> sim_boolean:handle_SETO(Core, Mem, IR, EA);
|
||||
8#475 -> sim_boolean:handle_SETO(Core, Mem, IR, EA); % SETOI = SETO
|
||||
8#476 -> sim_boolean:handle_SETOM(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
-define(OP_ORCBB, 8#473).
|
||||
-define(OP_SETO, 8#474).
|
||||
-define(OP_SETOI, 8#475).
|
||||
-define(OP_SETOM, 8#476).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@@ -841,6 +842,16 @@ setoi_test() ->
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, -1)} % AC1 = -1,,-1
|
||||
]).
|
||||
|
||||
setom_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_SETOM, 0, 0, 0, 8#200)} % 1,,100/ SETOM 200
|
||||
, {1, 8#101, ?INSN_INVALID} % 1,,101/ <invalid>
|
||||
, {1, 8#200, 0} % 1,,200/ 0
|
||||
],
|
||||
expect(Prog, [], {1, 8#101}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, -1)} % C(1,,200) = -1,,-1
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Reference in New Issue
Block a user