mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-22 02:26:24 +00:00
sim: sim_boolean: handle SETOB, add unit test
This commit is contained in:
parent
c37ac68082
commit
23f1c5ec34
@ -71,6 +71,7 @@
|
||||
, handle_SETMI/4
|
||||
, handle_SETMM/4
|
||||
, handle_SETO/4
|
||||
, handle_SETOB/4
|
||||
, handle_SETOM/4
|
||||
, handle_SETZ/4
|
||||
, handle_SETZB/4
|
||||
@ -778,6 +779,13 @@ handle_SETOM(Core, Mem, _IR, EA) ->
|
||||
Word = (1 bsl 36) - 1,
|
||||
handle_ANDM_1(Core, Mem, EA, Word).
|
||||
|
||||
-spec handle_SETOB(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_SETOB(Core, Mem, IR, EA) ->
|
||||
AC = IR band 8#17,
|
||||
Word = (1 bsl 36) - 1,
|
||||
handle_ANDB(Core, Mem, AC, EA, Word).
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@ -316,6 +316,7 @@ dispatch(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);
|
||||
8#477 -> sim_boolean:handle_SETOB(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@ -107,6 +107,7 @@
|
||||
-define(OP_SETO, 8#474).
|
||||
-define(OP_SETOI, 8#475).
|
||||
-define(OP_SETOM, 8#476).
|
||||
-define(OP_SETOB, 8#477).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@ -852,6 +853,17 @@ setom_test() ->
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, -1)} % C(1,,200) = -1,,-1
|
||||
]).
|
||||
|
||||
setob_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_SETOB, 1, 0, 0, 8#200)} % 1,,100/ SETOB 1,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
|
||||
, {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, -1)} % AC1 = -1,,-1
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user