- AUTHOR, COPYRIGHT and LICENCE
CPU::Emulator::Z80::Register - a register for a Z80
This is a base class that defines some useful routines for registers of any size.
The following methods exist in the base class:
Decodes the register 2s-complement-ly and return a signed value.
Return a reference to the CPU this object lives in.
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.
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:
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.
All subclasses must have the following fields:
The number of bits in the register
A reference to the CPU this register resides in - this is so that mathemagical operators can get at the flags register.
Copyright 2008 David Cantrell <firstname.lastname@example.org>
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.
This module is also free-as-in-mason software.