uk.co.javagear
Class Registers

java.lang.Object
  extended by uk.co.javagear.Registers

public final class Registers
extends java.lang.Object

Zilog Z80 CPU BC, DE, HL, IX, IY register pair emulation.

Version:
18th January 2003
Author:
Copyright (C) 2002-2003 Chris White
See Also:
"JavaGear Final Project Report"

Field Summary
private  Flag f
          Flag register.
private  int high
          The register pair's high byte.
private  int high2
          The high byte of the second register of the pair.
private  int low
          The register pair's low byte.
private  int low2
          The low byte of the second register of the pair.
 
Constructor Summary
Registers(Flag fl)
          Register pair constructor.
 
Method Summary
 void adc(int value)
          ADC 16 BIT - Add with carry.
 void add(int value)
          ADD 16 BIT (Verified with ZEXALL).
 void clear()
          Clear register.
 void dec()
          Decrement register pair.
private  int dec8(int value)
          Used to decrement the high or low bytes of the register pair.
 void decH()
          Decrement high byte of pair.
 void decL()
          Decrement low byte of pair.
 void ex()
          Exchange register banks.
 int get()
          Get value of register pair.
 int getH()
          Get high byte of pair.
 int getL()
          Get low byte of pair.
 void inc()
          Increment register pair.
private  int inc8(int value)
          Used to increment the high or low bytes of the register pair.
 void incH()
          Increment high byte of pair.
 void incL()
          Increment low byte of pair.
 void sbc(int value)
          SBC 16 BIT - Subtract with carry.
 void set(int value)
          Set register pair.
 void setH(int value)
          Set high byte of register pair.
 void setL(int value)
          Set low byte of register pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

high

private int high
The register pair's high byte.


low

private int low
The register pair's low byte.


high2

private int high2
The high byte of the second register of the pair.


low2

private int low2
The low byte of the second register of the pair.


f

private Flag f
Flag register.

Constructor Detail

Registers

public Registers(Flag fl)
Register pair constructor.

Parameters:
fl - pointer to flag register.
Method Detail

clear

public void clear()
Clear register.


get

public int get()
Get value of register pair.

Returns:
value stored in the register pair.

getH

public int getH()
Get high byte of pair.

Returns:
value of the register's high byte.

getL

public int getL()
Get low byte of pair.

Returns:
value of the register's low byte.

set

public void set(int value)
Set register pair.

Parameters:
value - the value to set the register to (0 - 0xFFFF).

setH

public void setH(int value)
Set high byte of register pair.

Parameters:
value - value to set the high byte of the register to (0 - 0xFF).

setL

public void setL(int value)
Set low byte of register pair.

Parameters:
value - value to set the low byte of the register to (0 - 0xFF).

inc

public void inc()
Increment register pair.


incL

public void incL()
Increment low byte of pair.


incH

public void incH()
Increment high byte of pair.


inc8

private int inc8(int value)
Used to increment the high or low bytes of the register pair.

Parameters:
value - the value of the register pair's byte.
Returns:
the byte's new value.

dec

public void dec()
Decrement register pair.


decL

public void decL()
Decrement low byte of pair.


decH

public void decH()
Decrement high byte of pair.


dec8

private int dec8(int value)
Used to decrement the high or low bytes of the register pair.

Parameters:
value - the value of the register pair's byte.
Returns:
the byte's new value.

ex

public void ex()
Exchange register banks.


add

public void add(int value)
ADD 16 BIT (Verified with ZEXALL).

Parameters:
value - value to add.

adc

public void adc(int value)
ADC 16 BIT - Add with carry.

Parameters:
value - value to add.

sbc

public void sbc(int value)
SBC 16 BIT - Subtract with carry.

Parameters:
value - value to subtract.


Copyright © 2007 JavaGear. All Rights Reserved.