CPU::Emulator::Z80::Register8R - the R register for a Z80


CPU-Emulator-Z80 documentation Contained in the CPU-Emulator-Z80 distribution.

Index


Code Index:

NAME

Top

CPU::Emulator::Z80::Register8R - the R register for a Z80

DESCRIPTION

Top

This class is a ...::Register8 with a weird inc() method

METHODS

Top

It has the same methods as its parent, with the following changes:

inc

The inc() method operates on the least significant 7 bits of the register only.

BUGS/WARNINGS/LIMITATIONS

Top

None known.

AUTHOR, COPYRIGHT and LICENCE

Top

CONSPIRACY

Top

This module is also free-as-in-mason software.


CPU-Emulator-Z80 documentation Contained in the CPU-Emulator-Z80 distribution.
# $Id: Register8R.pm,v 1.2 2008/02/22 02:08:08 drhyde Exp $

package CPU::Emulator::Z80::Register8R;

use strict;
use warnings;

use vars qw($VERSION $AUTOLOAD);

use base qw(CPU::Emulator::Z80::Register8);

$VERSION = '1.0';

sub inc {
    my $self = shift;
    my $r = $self->get();
    $self->set(($r & 0b10000000) | (($r + 1) & 0b01111111));
}

1;