From 2e07d46bcac1879ed39452688a3dca344ea6acf5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 5 Apr 2012 19:30:59 -0500 Subject: track clock ticks --- lib/Games/Emulation/DCPU16.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') 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; -- cgit v1.2.3-54-g00ecf