NAME
CPU::Emulator::Z80::Register - a register for a Z80
DESCRIPTION
This is a base class that defines some useful routines for registers of any size.
METHODS
The following methods exist in the base class:
getsigned
Decodes the register 2s-complement-ly and return a signed value.
cpu
Return a reference to the CPU this object lives in.
inc
Increment the register. But note that if incrementing means you need to do anything else, such as set flags, you will need to override this.
dec
Decrement the register, again without bothering with flags and stuff so override if necessary.
and the following methods need to be defined in all sub-classes:
get, set
Must be over-ridden in sub-classes such that setting stores a value, truncated to the right length, and getting retrieves a value, truncated to the right length.
The set() method must accept -ve values and store them in 2s-complement. Its behaviour is undefined if the user is foolish enough to store too large a -ve value.
The get() method must return the value assuming it to be unsigned.
FIELDS
All subclasses must have the following fields:
bits
The number of bits in the register
cpu
A reference to the CPU this register resides in - this is so that mathemagical operators can get at the flags register.
AUTHOR, LICENCE and COPYRIGHT
Copyright 2008 David Cantrell <david@cantrell.org.uk>
This module is free-as-in-speech software, and may be used, distributed, and modified under the same terms as Perl itself.
CONSPIRACY
This module is also free-as-in-mason software.