File Coverage

blib/lib/CPU/Emulator/Z80/Register8R.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             # $Id: Register8R.pm,v 1.2 2008/02/22 02:08:08 drhyde Exp $
2              
3             package CPU::Emulator::Z80::Register8R;
4              
5 14     14   56701 use strict;
  14         26  
  14         929  
6 14     14   74 use warnings;
  14         28  
  14         926  
7              
8 14     14   76 use vars qw($VERSION $AUTOLOAD);
  14         22  
  14         1372  
9              
10 14     14   99 use base qw(CPU::Emulator::Z80::Register8);
  14         36  
  14         8141  
11              
12             $VERSION = '1.0';
13              
14             =head1 NAME
15              
16             CPU::Emulator::Z80::Register8R - the R register for a Z80
17              
18             =head1 DESCRIPTION
19              
20             This class is a ...::Register8 with a weird inc() method
21              
22             =head1 METHODS
23              
24             It has the same methods as its parent, with the following changes:
25              
26             =head2 inc
27              
28             The inc() method operates on the least significant 7 bits of the
29             register only.
30              
31             =cut
32              
33             sub inc {
34 2562     2562 1 31312 my $self = shift;
35 2562         8773 my $r = $self->get();
36 2562         13720 $self->set(($r & 0b10000000) | (($r + 1) & 0b01111111));
37             }
38              
39             =head1 BUGS/WARNINGS/LIMITATIONS
40              
41             None known.
42              
43             =head1 AUTHOR, COPYRIGHT and LICENCE
44              
45             Copyright 2008 David Cantrell EFE
46              
47             This software is free-as-in-speech software, and may be used,
48             distributed, and modified under the terms of either the GNU
49             General Public Licence version 2 or the Artistic Licence. It's
50             up to you which one you use. The full text of the licences can
51             be found in the files GPL2.txt and ARTISTIC.txt, respectively.
52              
53             =head1 CONSPIRACY
54              
55             This module is also free-as-in-mason software.
56              
57             =cut
58              
59             1;