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, COPYRIGHT and LICENCE
Copyright 2008 David Cantrell <david@cantrell.org.uk>
This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.
CONSPIRACY
This module is also free-as-in-mason software.