CPU::Emulator::Z80::Register - a register for a Z80


CPU-Emulator-Z80 documentation  | view source Contained in the CPU-Emulator-Z80 distribution.

Index


NAME

Top

CPU::Emulator::Z80::Register - a register for a Z80

DESCRIPTION

Top

This is a base class that defines some useful routines for registers of any size.

METHODS

Top

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

Top

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

Top

CONSPIRACY

Top

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


CPU-Emulator-Z80 documentation  | view source Contained in the CPU-Emulator-Z80 distribution.