aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-04-05 19:30:59 -0500
committerJesse Luehrs <doy@tozt.net>2012-04-05 19:30:59 -0500
commit2e07d46bcac1879ed39452688a3dca344ea6acf5 (patch)
tree6a8c676989d07cb81a9aed65c4b705649c7ed56a /lib
parent88050ba38f76cc48dedef7c01902221df7991529 (diff)
downloadgames-emulation-dcpu16-2e07d46bcac1879ed39452688a3dca344ea6acf5.tar.gz
games-emulation-dcpu16-2e07d46bcac1879ed39452688a3dca344ea6acf5.zip
track clock ticks
Diffstat (limited to 'lib')
-rw-r--r--lib/Games/Emulation/DCPU16.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Games/Emulation/DCPU16.pm b/lib/Games/Emulation/DCPU16.pm
index bec7b44..78081ba 100644
--- a/lib/Games/Emulation/DCPU16.pm
+++ b/lib/Games/Emulation/DCPU16.pm
@@ -24,6 +24,8 @@ sub new {
SP => 0x0000,
O => 0x0000,
+ clock => 0,
+
halt => undef,
delay => 0,
time_taken => TIME_TAKEN_NONE,
@@ -68,6 +70,7 @@ sub registers { shift->{registers} }
sub PC { shift->{PC} }
sub SP { shift->{SP} }
sub O { shift->{O} }
+sub clock { shift->{clock} }
sub load {
my $self = shift;
@@ -88,6 +91,8 @@ sub run {
sub step {
my $self = shift;
+ $self->{clock}++;
+
if ($self->{delay}) {
$self->{delay}--;
return;