aboutsummaryrefslogtreecommitdiffstats
path: root/t/spec.t
diff options
context:
space:
mode:
Diffstat (limited to 't/spec.t')
-rw-r--r--t/spec.t2545
1 files changed, 2545 insertions, 0 deletions
diff --git a/t/spec.t b/t/spec.t
new file mode 100644
index 0000000..9945780
--- /dev/null
+++ b/t/spec.t
@@ -0,0 +1,2545 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Games::Emulation::DCPU16;
+
+=begin assembly_code
+
+ ; Try some basic stuff
+ SET A, 0x30 ; 7c01 0030
+ SET [0x1000], 0x20 ; 7de1 1000 0020
+ SUB A, [0x1000] ; 7803 1000
+ IFN A, 0x10 ; c00d
+ SET PC, crash ; 7dc1 001a [*]
+
+ ; Do a loopy thing
+ SET I, 10 ; a861
+ SET A, 0x2000 ; 7c01 2000
+ :loop SET [0x2000+I], [A] ; 2161 2000
+ SUB I, 1 ; 8463
+ IFN I, 0 ; 806d
+ SET PC, loop ; 7dc1 000d [*]
+
+ ; Call a subroutine
+ SET X, 0x4 ; 9031
+ JSR testsub ; 7c10 0018 [*]
+ SET PC, crash ; 7dc1 001a [*]
+
+ :testsub SHL X, 4 ; 9037
+ SET PC, POP ; 61c1
+
+ ; Hang forever. X should now be 0x40 if everything went right.
+ :crash SET PC, crash ; 7dc1 001a [*]
+
+ ; [*]: Note that these can be one word shorter and one cycle faster by using the short form (0x00-0x1f) of literals,
+ ; but my assembler doesn't support short form labels yet.
+
+=end assembly_code
+
+=cut
+
+my $bytecode = "\x7c\x01\x00\x30\x7d\xe1\x10\x00\x00\x20\x78\x03\x10\x00\xc0\x0d\x7d\xc1\x00\x1a\xa8\x61\x7c\x01\x20\x00\x21\x61\x20\x00\x84\x63\x80\x6d\x7d\xc1\x00\x0d\x90\x31\x7c\x10\x00\x18\x7d\xc1\x00\x1a\x90\x37\x61\xc1\x7d\xc1\x00\x1a";
+
+my $cpu = Games::Emulation::DCPU16->new;
+isa_ok($cpu, 'Games::Emulation::DCPU16');
+is_deeply($cpu->memory, [(0) x 0x10000]);
+is_deeply($cpu->registers, [ (0x0000) x 8 ]);
+is($cpu->PC, 0x0000);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->load($bytecode);
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x10000 - 28)
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+);
+is($cpu->PC, 0x0000);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x0030
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x10000 - 28)
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+);
+is($cpu->PC, 0x0002);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET A, 0x30
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x10000 - 28)
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0030, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0002);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x1000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x10000 - 28)
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0030, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0004);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x0020
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x10000 - 28)
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0030, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0005);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x1000], 0x20
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0030, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0005);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x1000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0030, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0007);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0030, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0007);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB A, [0x1000]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0010, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0007);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0010, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0008);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0010, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0008);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN A, 0x10
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0010, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x000a);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET I, 10
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0010, (0x0000) x 5, 0x000a, 0x0000 ],
+);
+is($cpu->PC, 0x000b);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x0010, (0x0000) x 5, 0x000a, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET A, 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x000a, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x000a, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x000a, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x000a, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x000d
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, loop
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
+);
+is($cpu->PC, 0x000d);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x2000
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET [0x2000+I], [A]
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
+);
+is($cpu->PC, 0x000f);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SUB I, 1
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0010);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0011);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute IFN I, 0
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 7 ],
+);
+is($cpu->PC, 0x0013);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET X, 0x4
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0004, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x0014);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x0018
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0004, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x0016);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 1),
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0004, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x0016);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute JSR testsub
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0004, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x0018);
+is($cpu->SP, 0xfffe);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execution delay
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0004, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x0019);
+is($cpu->SP, 0xfffe);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SHL X, 4
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x0019);
+is($cpu->SP, 0xfffe);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, POP
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x0016);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x001a
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x0018);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, crash
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001a);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x001a
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001c);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, crash
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001a);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x001a
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001c);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, crash
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001a);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x001a
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001c);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, crash
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001a);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x001a
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001c);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, crash
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001a);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # load 0x001a
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001c);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+$cpu->step; # execute SET PC, crash
+
+is_deeply(
+ $cpu->memory,
+ [
+ 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a,
+ (0) x (0x1000 - 28),
+ 0x0020,
+ (0) x (0x10000 - 0x1000 - 2),
+ 0x0016,
+ ]
+);
+is_deeply(
+ $cpu->registers,
+ [ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
+);
+is($cpu->PC, 0x001a);
+is($cpu->SP, 0xffff);
+is($cpu->O, 0x0000);
+
+done_testing;