diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-04-05 19:30:59 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-04-05 19:30:59 -0500 |
commit | 2e07d46bcac1879ed39452688a3dca344ea6acf5 (patch) | |
tree | 6a8c676989d07cb81a9aed65c4b705649c7ed56a /lib/Games/Emulation/DCPU16.pm | |
parent | 88050ba38f76cc48dedef7c01902221df7991529 (diff) | |
download | games-emulation-dcpu16-2e07d46bcac1879ed39452688a3dca344ea6acf5.tar.gz games-emulation-dcpu16-2e07d46bcac1879ed39452688a3dca344ea6acf5.zip |
track clock ticks
Diffstat (limited to 'lib/Games/Emulation/DCPU16.pm')
-rw-r--r-- | lib/Games/Emulation/DCPU16.pm | 5 |
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; |