uk.co.javagear
Class Accumulator

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

public final class Accumulator
extends java.lang.Object

Zilog Z80 CPU accumulator register emulation.

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

Field Summary
private static Flag f
          Flag register.
private static int reg
          First register of the accumulator's bank.
private static int reg2
          Second register of the accumulator's bank.
 
Constructor Summary
Accumulator(Flag fl)
          Accumulator constructor.
 
Method Summary
 void adc(int value)
          ADC 8 BIT - Add with carry.
 void add(int value)
          ADD 8 BIT.
 void and(int value)
          AND Operation.
 void clear()
          Clear register.
 void cp(int value)
          CP Operation - Compare with Accumulator.
 void cpl()
          CPL Operation - Complement Accumulator.
 void dec()
          Decrement register.
 void ex()
          Exchange register banks.
 int get()
          Get value of accumulator.
 void inc()
          Increment register.
 void or(int value)
          OR Operation.
 void rla()
          RLA Operation - Rotate Left Accumulator.
 void rlca()
          RLCA Operation - Rotate Left With Carry Accumulator.
 void rra()
          RRA Operation - Rotate Right Accumulator.
 void rrca()
          RRCA Operation - Rotate Right With Carry Accumulator.
 void sbc(int value)
          SBC 8 BIT.
 void set(int value)
          Set register.
 void sub(int value)
          SUB 8 BIT.
 void xor(int value)
          XOR Operation (Bitwise Exclusive OR).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reg

private static int reg
First register of the accumulator's bank.


reg2

private static int reg2
Second register of the accumulator's bank.


f

private static Flag f
Flag register.

Constructor Detail

Accumulator

public Accumulator(Flag fl)
Accumulator constructor.

Parameters:
fl - pointer to flag register.
Method Detail

clear

public void clear()
Clear register.


get

public int get()
Get value of accumulator.

Returns:
value stored in register.

set

public void set(int value)
Set register.

Parameters:
value - value to set register (0 - 0xFF).

inc

public void inc()
Increment register.


dec

public void dec()
Decrement register.


ex

public void ex()
Exchange register banks.


add

public void add(int value)
ADD 8 BIT.

Parameters:
value - value to add.

adc

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

Parameters:
value - value to add.

sub

public void sub(int value)
SUB 8 BIT.

Parameters:
value - value to subtract.

sbc

public void sbc(int value)
SBC 8 BIT.

Parameters:
value - subtract with carry.

and

public void and(int value)
AND Operation.

Parameters:
value - value to &.

or

public void or(int value)
OR Operation.

Parameters:
value - Value to |

xor

public void xor(int value)
XOR Operation (Bitwise Exclusive OR).

Parameters:
value - Value to ^

cp

public void cp(int value)
CP Operation - Compare with Accumulator.

Parameters:
value - Value to compare

cpl

public void cpl()
CPL Operation - Complement Accumulator.


rra

public void rra()
RRA Operation - Rotate Right Accumulator.


rla

public void rla()
RLA Operation - Rotate Left Accumulator.


rlca

public void rlca()
RLCA Operation - Rotate Left With Carry Accumulator.


rrca

public void rrca()
RRCA Operation - Rotate Right With Carry Accumulator.



Copyright © 2007 JavaGear. All Rights Reserved.