aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-04-06 03:16:49 -0500
committerJesse Luehrs <doy@tozt.net>2012-04-06 03:16:49 -0500
commit62c36e6e09bd939c02d575396fc9cde1f50e9838 (patch)
treedc20a6f97a85228715b79a7f8134a6e7f8505105
parent3394c2ace3a2c555cce22095f66cfc258873d8c0 (diff)
downloadgames-emulation-dcpu16-62c36e6e09bd939c02d575396fc9cde1f50e9838.tar.gz
games-emulation-dcpu16-62c36e6e09bd939c02d575396fc9cde1f50e9838.zip
don't increment pc until the op finishes executing
-rw-r--r--lib/Games/Emulation/DCPU16.pm30
-rw-r--r--t/pc.t373
-rw-r--r--t/spec.t114
3 files changed, 449 insertions, 68 deletions
diff --git a/lib/Games/Emulation/DCPU16.pm b/lib/Games/Emulation/DCPU16.pm
index 78081ba..4bd97f5 100644
--- a/lib/Games/Emulation/DCPU16.pm
+++ b/lib/Games/Emulation/DCPU16.pm
@@ -37,6 +37,8 @@ sub new {
value1 => undef,
value2 => undef,
next_word => undef,
+ pc_offset => 0,
+ jumped => undef,
basic_opcode_map => [
undef,
@@ -102,7 +104,9 @@ sub step {
while (1) {
my $state = $self->{state};
if ($state == STATE_NEW_OP) {
- $self->{state} = $self->_parse_op($self->{memory}[$self->{PC}++]);
+ $self->{state} = $self->_parse_op($self->{memory}[$self->{PC}]);
+ $self->{pc_offset} = 1;
+ undef $self->{jumped};
}
elsif ($state == STATE_READ_ARG_1) {
$self->{state} = $self->_parse_value($self->{value1})
@@ -126,7 +130,7 @@ sub _op_length {
my $self = shift;
my $length = 1;
- $self->_parse_op($self->{memory}[$self->{PC}]);
+ $self->_parse_op($self->{memory}[$self->{PC} + $self->{pc_offset}]);
for my $value ($self->{value1}, $self->{value2}) {
next unless defined $value;
@@ -243,6 +247,8 @@ sub _execute_current_op {
return $self->{state} if $self->{time_taken} != TIME_TAKEN_WORK;
+ $self->{PC} += $self->{pc_offset}
+ unless $self->{jumped};
$self->{lvalue} = undef;
return STATE_NEW_OP;
@@ -255,7 +261,8 @@ sub _next_word {
return 1 if $self->_delay(1);
- $self->{next_word} = $self->{memory}[$self->{PC}++];
+ $self->{next_word} = $self->{memory}[$self->{PC} + $self->{pc_offset}];
+ $self->{pc_offset}++;
return;
}
@@ -290,6 +297,9 @@ sub _op_SET {
my $lvalue = $self->{lvalue};
return unless $lvalue;
+ $self->{jumped} = 1
+ if $lvalue == \$self->{PC};
+
${ $self->{lvalue} } = $b;
}
@@ -446,7 +456,7 @@ sub _op_IFE {
else {
return if $self->_delay(3);
- $self->{PC} += $self->_op_length;
+ $self->{pc_offset} += $self->_op_length;
}
}
@@ -460,7 +470,7 @@ sub _op_IFN {
else {
return if $self->_delay(3);
- $self->{PC} += $self->_op_length;
+ $self->{pc_offset} += $self->_op_length;
}
}
@@ -474,7 +484,7 @@ sub _op_IFG {
else {
return if $self->_delay(3);
- $self->{PC} += $self->_op_length;
+ $self->{pc_offset} += $self->_op_length;
}
}
@@ -488,7 +498,7 @@ sub _op_IFB {
else {
return if $self->_delay(3);
- $self->{PC} += $self->_op_length;
+ $self->{pc_offset} += $self->_op_length;
}
}
@@ -498,9 +508,10 @@ sub _op_JSR {
return if $self->_delay(2);
- $self->{memory}[(--$self->{SP} & 0xffff)] = $self->{PC};
+ $self->{memory}[(--$self->{SP} & 0xffff)] = $self->{PC} + $self->{pc_offset};
$self->{SP} &= 0xffff;
$self->{PC} = $a;
+ $self->{jumped} = 1;
}
sub _op_HLT {
@@ -512,9 +523,6 @@ sub _op_HLT {
=for notes
-is PC incremented for success of the test ops during execution of the test op,
-or before execution of the next op? really, when is PC incremented in general?
-
what happens when an invalid op is read?
=cut
diff --git a/t/pc.t b/t/pc.t
new file mode 100644
index 0000000..156b165
--- /dev/null
+++ b/t/pc.t
@@ -0,0 +1,373 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Games::Emulation::DCPU16;
+
+=begin assembly_code
+
+ SET [0x0002],PC
+
+=end assembly_code
+
+=cut
+
+{
+ my $cpu = Games::Emulation::DCPU16->new;
+ $cpu->load("\x71\xe1\x00\x02");
+
+ $cpu->step; # load 0x0002
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x71e1, 0x0002,
+ (0) x (0x10000 - 2)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0000);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 1);
+
+ $cpu->step; # execute SET [0x0002], PC
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x71e1, 0x0002,
+ (0) x (0x10000 - 2)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0002);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 2);
+}
+
+=begin assembly_code
+
+ SET [0x0006], 0x02
+ :loop SET [0x0007], PC
+ SET PC, loop
+
+=end assembly_code
+
+=cut
+
+{
+ my $cpu = Games::Emulation::DCPU16->new;
+ $cpu->load("\x89\xe1\x00\x06\x71\xe1\x00\x07\x7d\xc1\x00\x02");
+
+ $cpu->step; # load 0x0006
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002,
+ (0) x (0x10000 - 6)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0000);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 1);
+
+ $cpu->step; # execute SET [0x0006], 0x02
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002,
+ (0) x (0x10000 - 7)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0002);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 2);
+
+ $cpu->step; # load 0x0007
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002,
+ (0) x (0x10000 - 7)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0002);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 3);
+
+ $cpu->step; # execute SET [0x0007], PC
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002, 0x0002,
+ (0) x (0x10000 - 8)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0004);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 4);
+
+ $cpu->step; # load 0x0002
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002, 0x0002,
+ (0) x (0x10000 - 8)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0004);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 5);
+
+ $cpu->step; # execute SET [0x0007], PC
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002, 0x0002,
+ (0) x (0x10000 - 8)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0002);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 6);
+
+ $cpu->step; # load 0x0007
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002, 0x0002,
+ (0) x (0x10000 - 8)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0002);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 7);
+
+ $cpu->step; # execute SET [0x0007], PC
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002, 0x0002,
+ (0) x (0x10000 - 8)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0004);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 8);
+
+ $cpu->step; # load 0x0002
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002, 0x0002,
+ (0) x (0x10000 - 8)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0004);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 9);
+
+ $cpu->step; # execute SET [0x0007], PC
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x89e1, 0x0006, 0x71e1, 0x0007, 0x7dc1, 0x0002, 0x0002, 0x0002,
+ (0) x (0x10000 - 8)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0002);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 10);
+}
+
+=begin assembly_code
+
+ :loop SET PC, loop
+
+=end assembly_code
+
+=cut
+
+{
+ my $cpu = Games::Emulation::DCPU16->new;
+ $cpu->load("\x7d\xc1\x00\x00");
+
+ $cpu->step; # load 0x0000
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x7dc1,
+ (0) x (0x10000 - 1)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0000);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 1);
+
+ $cpu->step; # execute SET PC, loop
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x7dc1,
+ (0) x (0x10000 - 1)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0000);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 2);
+
+ $cpu->step; # load 0x0000
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x7dc1,
+ (0) x (0x10000 - 1)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0000);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 3);
+
+ $cpu->step; # execute SET PC, loop
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x7dc1,
+ (0) x (0x10000 - 1)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0000);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 4);
+
+ $cpu->step; # load 0x0000
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x7dc1,
+ (0) x (0x10000 - 1)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0000);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 5);
+
+ $cpu->step; # execute SET PC, loop
+
+ is_deeply(
+ $cpu->memory,
+ [
+ 0x7dc1,
+ (0) x (0x10000 - 1)
+ ]
+ );
+ is_deeply(
+ $cpu->registers,
+ [ (0x0000) x 8 ],
+ );
+ is($cpu->PC, 0x0000);
+ is($cpu->SP, 0x0000);
+ is($cpu->O, 0x0000);
+ is($cpu->clock, 6);
+}
+
+done_testing;
diff --git a/t/spec.t b/t/spec.t
index 4c858ec..d6eb00c 100644
--- a/t/spec.t
+++ b/t/spec.t
@@ -88,7 +88,7 @@ is_deeply(
$cpu->registers,
[ (0x0000) x 8 ],
);
-is($cpu->PC, 0x0002);
+is($cpu->PC, 0x0000);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 1);
@@ -130,7 +130,7 @@ is_deeply(
$cpu->registers,
[ 0x0030, (0x0000) x 7 ],
);
-is($cpu->PC, 0x0004);
+is($cpu->PC, 0x0002);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 3);
@@ -151,7 +151,7 @@ is_deeply(
$cpu->registers,
[ 0x0030, (0x0000) x 7 ],
);
-is($cpu->PC, 0x0005);
+is($cpu->PC, 0x0002);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 4);
@@ -197,7 +197,7 @@ is_deeply(
$cpu->registers,
[ 0x0030, (0x0000) x 7 ],
);
-is($cpu->PC, 0x0007);
+is($cpu->PC, 0x0005);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 6);
@@ -220,7 +220,7 @@ is_deeply(
$cpu->registers,
[ 0x0030, (0x0000) x 7 ],
);
-is($cpu->PC, 0x0007);
+is($cpu->PC, 0x0005);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 7);
@@ -266,7 +266,7 @@ is_deeply(
$cpu->registers,
[ 0x0010, (0x0000) x 7 ],
);
-is($cpu->PC, 0x0008);
+is($cpu->PC, 0x0007);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 9);
@@ -289,7 +289,7 @@ is_deeply(
$cpu->registers,
[ 0x0010, (0x0000) x 7 ],
);
-is($cpu->PC, 0x0008);
+is($cpu->PC, 0x0007);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 10);
@@ -358,7 +358,7 @@ is_deeply(
$cpu->registers,
[ 0x0010, (0x0000) x 5, 0x000a, 0x0000 ],
);
-is($cpu->PC, 0x000d);
+is($cpu->PC, 0x000b);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 13);
@@ -404,7 +404,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x000a, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 15);
@@ -450,7 +450,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x000a, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 17);
@@ -496,7 +496,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 19);
@@ -542,7 +542,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 21);
@@ -588,7 +588,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 23);
@@ -634,7 +634,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0009, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 25);
@@ -680,7 +680,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 27);
@@ -726,7 +726,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 29);
@@ -772,7 +772,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 31);
@@ -818,7 +818,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0008, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 33);
@@ -864,7 +864,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 35);
@@ -910,7 +910,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 37);
@@ -956,7 +956,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 39);
@@ -1002,7 +1002,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0007, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 41);
@@ -1048,7 +1048,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 43);
@@ -1094,7 +1094,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 45);
@@ -1140,7 +1140,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 47);
@@ -1186,7 +1186,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0006, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 49);
@@ -1232,7 +1232,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 51);
@@ -1278,7 +1278,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 53);
@@ -1324,7 +1324,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 55);
@@ -1370,7 +1370,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0005, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 57);
@@ -1416,7 +1416,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 59);
@@ -1462,7 +1462,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 61);
@@ -1508,7 +1508,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 63);
@@ -1554,7 +1554,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0004, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 65);
@@ -1600,7 +1600,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 67);
@@ -1646,7 +1646,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 69);
@@ -1692,7 +1692,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 71);
@@ -1738,7 +1738,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0003, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 73);
@@ -1784,7 +1784,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 75);
@@ -1830,7 +1830,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 77);
@@ -1876,7 +1876,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 79);
@@ -1922,7 +1922,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0002, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 81);
@@ -1968,7 +1968,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 83);
@@ -2014,7 +2014,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
);
-is($cpu->PC, 0x0013);
+is($cpu->PC, 0x0011);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 85);
@@ -2060,7 +2060,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
);
-is($cpu->PC, 0x000f);
+is($cpu->PC, 0x000d);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 87);
@@ -2106,7 +2106,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 5, 0x0001, 0x0000 ],
);
-is($cpu->PC, 0x0010);
+is($cpu->PC, 0x000f);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 89);
@@ -2152,7 +2152,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 7 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 91);
@@ -2175,7 +2175,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 7 ],
);
-is($cpu->PC, 0x0011);
+is($cpu->PC, 0x0010);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 92);
@@ -2244,7 +2244,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0004, (0x0000) x 4 ],
);
-is($cpu->PC, 0x0016);
+is($cpu->PC, 0x0014);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 95);
@@ -2267,7 +2267,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0004, (0x0000) x 4 ],
);
-is($cpu->PC, 0x0016);
+is($cpu->PC, 0x0014);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 96);
@@ -2315,7 +2315,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0004, (0x0000) x 4 ],
);
-is($cpu->PC, 0x0019);
+is($cpu->PC, 0x0018);
is($cpu->SP, 0xffff);
is($cpu->O, 0x0000);
is($cpu->clock, 98);
@@ -2387,7 +2387,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
);
-is($cpu->PC, 0x0018);
+is($cpu->PC, 0x0016);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 101);
@@ -2435,7 +2435,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
);
-is($cpu->PC, 0x001c);
+is($cpu->PC, 0x001a);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 103);
@@ -2483,7 +2483,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
);
-is($cpu->PC, 0x001c);
+is($cpu->PC, 0x001a);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 105);
@@ -2531,7 +2531,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
);
-is($cpu->PC, 0x001c);
+is($cpu->PC, 0x001a);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 107);
@@ -2579,7 +2579,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
);
-is($cpu->PC, 0x001c);
+is($cpu->PC, 0x001a);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 109);
@@ -2627,7 +2627,7 @@ is_deeply(
$cpu->registers,
[ 0x2000, (0x0000) x 2, 0x0040, (0x0000) x 4 ],
);
-is($cpu->PC, 0x001c);
+is($cpu->PC, 0x001a);
is($cpu->SP, 0x0000);
is($cpu->O, 0x0000);
is($cpu->clock, 111);