|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectca.disassembly.invaders.Z80
public class Z80
CPUZ80 emulates a Z80's behaviour Written in 2001 by E.Duijs as a part of JEmu V1.00 + Many programs run ok. + removed generic parsing by big switch/case blocks for better performance + made functions for many instructions and flags + added NMI - IM0 not ok yet (is now always RST 38) - some missing instructions - DAA not ok, probably due to missing/incorrect half-carry updates V1.1 + IM0 now also supports calls to other locations (other than 0x38) + DAA is corrected + Fixed many flagupdates + An interface 'driver' is passed to exec() instead of a class. Makes it more flexible. + Implements interface 'cpu'. - IM0 doesn't support instructions other than calls, but this is no big deal... - still some missing instructions - code needs to be cleaned up - debugger needs to be finished (mainly the opcode tables). - out & in need to be externalized (it's added in interface 'driver' already) V1.2 + Flag calculations are not done in F anymore but all flags are booleans (faster) + 1 Minor bugfix... V1.3 + Added precalculated flag tables for speed. + Removed the boolean representation for flags. + The flag arrays also fixed some issues that were apparently flag related. + Added some missing instructions. - Because of the flag tables, it takes more memory now. V1.4 + Added INI and IND opcodes V1.41 + Removed localization of PC from fetch-decode loop to support protection in for example Scramble. I'll probably remove localization of all registers later. It was a speed optimization, but the result is only a very minor speedup. Also, it makes further optimizations difficult if not impossible. V1.42 + Fixed LD D,HX / LD D,LX / LD D,HY / LD D,LY V1.5 + Restructured fetch/decode/exec loop so that it performs better on Sun JRE (HotSpot didn't compile exec() at all). + Better maintainable + Fixed one index instruction.
| Field Summary | |
|---|---|
int |
A
|
int |
A1
|
int |
B
|
int |
B1
|
int |
C
|
int |
C1
|
int |
cycle
|
int |
cycleCounter
|
int |
D
|
int |
D1
|
int |
E
|
int |
E1
|
int |
F
|
int |
F1
|
int |
H
|
int |
H1
|
int |
I
|
int |
I_Vector
|
boolean |
IFF0
|
boolean |
IFF1
|
int |
IM
|
static int |
IM0
|
static int |
IM1
|
static int |
IM2
|
static int |
INTERRUPT_TYPE_FIRQ
Interrupt type |
static int |
INTERRUPT_TYPE_IGNORE
Interrupt type |
static int |
INTERRUPT_TYPE_IRQ
Interrupt type |
static int |
INTERRUPT_TYPE_NMI
Interrupt type |
boolean |
IRQ
|
int |
IX
|
int |
IXYd
|
int |
IY
|
int |
L
|
int |
L1
|
boolean |
NMI
|
static java.lang.String[] |
opc1
|
static java.lang.String[] |
opc2
|
static java.lang.String[] |
opc3
|
int |
PC
|
static int |
PROPERTY_Z80_IRQ_VECTOR
Property type |
int |
R
|
int |
SP
|
boolean |
state_HALT
|
| Constructor Summary | |
|---|---|
Z80()
Default constructor debugging disabled Use this constructor for use in applets |
|
| Method Summary | |
|---|---|
void |
AF(int nn)
|
void |
BC(int nn)
|
void |
DE(int nn)
|
void |
ex_AF_AF()
EX AF,AF' |
void |
exec(int cycles)
Execute a number of clock cycles |
void |
exx()
EXX |
int |
getCycle()
|
long |
getInstruction()
returns the currently excecuted instruction |
int |
getPC()
returns the program counter register (PC) |
java.lang.String |
getTag()
|
void |
HL(int nn)
|
int |
inb(int port,
int hi)
|
void |
interrupt(int type,
boolean irq)
|
void |
irq()
irq request |
void |
IX(int nn)
|
void |
IY(int nn)
|
void |
nmi()
Non-Maskable irq request |
void |
outb(int port,
int value,
int status)
|
int |
peekb(int add)
|
int |
peekw(int add)
|
void |
pokeb(int add,
int value)
|
void |
pokew(int add,
int value)
|
int |
pop()
|
void |
reset()
Reset CPU - Only resets the registers |
void |
setDebug(boolean debug)
|
void |
setProperty(int property,
int value)
|
void |
setTag(java.lang.String tag)
|
void |
step()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int IM0
public static final int IM1
public static final int IM2
public static final int INTERRUPT_TYPE_IRQ
public static final int INTERRUPT_TYPE_NMI
public static final int INTERRUPT_TYPE_FIRQ
public static final int INTERRUPT_TYPE_IGNORE
public static final int PROPERTY_Z80_IRQ_VECTOR
public int A
public int F
public int B
public int C
public int D
public int E
public int H
public int L
public int I
public int R
public int A1
public int F1
public int B1
public int C1
public int D1
public int E1
public int H1
public int L1
public int PC
public int SP
public int IX
public int IY
public int IXYd
public boolean state_HALT
public int IM
public boolean IFF0
public boolean IFF1
public int I_Vector
public boolean IRQ
public boolean NMI
public int cycle
public int cycleCounter
public static final java.lang.String[] opc1
public static final java.lang.String[] opc2
public static final java.lang.String[] opc3
| Constructor Detail |
|---|
public Z80()
| Method Detail |
|---|
public void setTag(java.lang.String tag)
public java.lang.String getTag()
public final long getInstruction()
public final void interrupt(int type,
boolean irq)
public final int getPC()
public final void setDebug(boolean debug)
public final void setProperty(int property,
int value)
public final void irq()
public final void nmi()
public final void reset()
public final int getCycle()
public void step()
public final void exec(int cycles)
cycles - number of cycles to be excecutedpublic final void ex_AF_AF()
public final void exx()
public final void AF(int nn)
public final void BC(int nn)
public final void DE(int nn)
public final void IX(int nn)
public final void IY(int nn)
public final void HL(int nn)
public final int pop()
public void outb(int port,
int value,
int status)
public int inb(int port,
int hi)
public int peekb(int add)
public void pokeb(int add,
int value)
public int peekw(int add)
public void pokew(int add,
int value)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||