Z80 { public int getRegisterPair(final int regPair) { return this.getRegisterPair(regPair, false); } Z80(final Z80CPUBus bus);  Z80(final Z80 cpu); static int parseAndPackRegAlignValue(final String regs); Z80 fillByState(final Z80 src); int getIM(); void setIM(final int im); boolean isIFF1(); boolean isIFF2(); int getPrefixInProcessing(); int getPrevINSignals(); int getPC(); void setIFF(final boolean iff1, final boolean iff2); void setRegisterPair(final int regPair, final int value); void setRegisterPair(final int regPair, final int value, final boolean alt); int getRegisterPair(final int regPair); int getRegisterPair(final int regPair, final boolean alt); void setRegister(final int reg, final int value); void setRegister(final int reg, final int value, final boolean alt); int getRegister(final int reg); int getRegister(final int reg, final boolean alt); int getState(); Z80CPUBus getBus(); int getStepTstates(); boolean isInsideBlockLoop(); int getSP(); Z80 alignRegisterValuesWith(final Z80 src, int packedRegisterFlags); int getLastM1InstructionByte(); int getLastInstructionByte(); int nextInstruction(final int ctx, final boolean signalRESET, final boolean signalNMI,
                             final boolean signalNT); int nextInstruction_SkipBlockInstructions(final int ctx, final boolean signalRESET,
                                                   final boolean signalNMI,
                                                   final boolean signalNT); boolean step(final int ctx, final int incomingSignals); String getStateAsString(); void doReset(); boolean compareState(final Z80 other, final boolean compareExe); static final int REG_A; static final int REG_F; static final int REG_B; static final int REG_C; static final int REG_D; static final int REG_E; static final int REG_H; static final int REG_L; static final int REG_IX; static final int REG_IY; static final int REG_SP; static final int REG_PC; static final int REG_I; static final int REG_R; static final int REGPAIR_AF; static final int REGPAIR_BC; static final int REGPAIR_DE; static final int REGPAIR_HL; static final int SIGNAL_IN_nINT; static final int SIGNAL_IN_nNMI; static final int SIGNAL_IN_nRESET; static final int SIGNAL_IN_nWAIT; static final int SIGNAL_IN_ALL_INACTIVE; static final int SIGNAL_OUT_nM1; static final int SIGNAL_OUT_nHALT; static final int SIGNAL_OUT_ALL_INACTIVE; static final int FLAG_S; static final int FLAG_Z; static final int FLAG_Y; static final int FLAG_H; static final int FLAG_X; static final int FLAG_PV; static final int FLAG_N; static final int FLAG_C; }
@Test public void testCommand_INC_BC() { final Z80State state = new Z80State(); state.B = 0x10; state.C = 0x00; state.F = 0xFF; final Pair<Z80, Integer> cpu = executeCommand(state, 0x03); assertEquals(0x1001, cpu.getLeft().getRegisterPair(Z80.REGPAIR_BC)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(6, cpu.getRight().intValue()); }
@Test public void testCommand_INC_HL() { final Z80State state = new Z80State(); state.H = 0x10; state.L = 0x00; state.F = 0xFF; final Pair<Z80, Integer> cpu = executeCommand(state, 0x23); assertEquals(0x1001, cpu.getLeft().getRegisterPair(Z80.REGPAIR_HL)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(6, cpu.getRight().intValue()); }
@Test public void testCommand_DEC_BC() { final Z80State state = new Z80State(); state.B = 0x10; state.C = 0x00; state.F = 0xFF; final Pair<Z80, Integer> cpu = executeCommand(state, 0x0B); assertEquals(0x0FFF, cpu.getLeft().getRegisterPair(Z80.REGPAIR_BC)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(6, cpu.getRight().intValue()); }
@Test public void testCommand_DEC_HL() { final Z80State state = new Z80State(); state.H = 0x10; state.L = 0x00; state.F = 0xFF; final Pair<Z80, Integer> cpu = executeCommand(state, 0x2B); assertEquals(0x0FFF, cpu.getLeft().getRegisterPair(Z80.REGPAIR_HL)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(6, cpu.getRight().intValue()); }
@Test public void testCommand_OUTDR() { final TestBus tb = new TestBus(0, 0x0000); tb.writeMemory(null, 111, 0x1000, (byte) 0x51); tb.writeMemory(null, 111, 0x0FFF, (byte) 0xA9); tb.writeMemory(null, 111, 0x0FFE, (byte) 0x03); final Z80State state = new Z80State(); state.C = 0x07; state.B = 0x03; state.H = 0x10; state.L = 0x00; state.F = 0x00; final Pair<Z80, Integer> cpu = executeRepeatingBlockCommand(state, tb, 0xED, 0xBB); assertEquals(0x51, tb.readPort(cpu.getLeft(), 111, 0x0207) & 0xFF); assertEquals(0xA9, tb.readPort(cpu.getLeft(), 111, 0x0107) & 0xFF); assertEquals(0x03, tb.readPort(cpu.getLeft(), 111, 0x0007) & 0xFF); assertEquals(0x0FFD, cpu.getLeft().getRegisterPair(Z80.REGPAIR_HL)); assertEquals(0x0007, cpu.getLeft().getRegisterPair(Z80.REGPAIR_BC)); assertEquals(58, cpu.getRight().intValue()); }
@Test public void testCommand_LD_BC_nn() { final Z80State state = new Z80State(); final Pair<Z80, Integer> cpu = executeCommand(state, 0x01, 0x34, 0x12); assertEquals(0x1234, cpu.getLeft().getRegisterPair(Z80.REGPAIR_BC)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(10, cpu.getRight().intValue()); }
@Test public void testCommand_LD_DE_nn() { final Z80State state = new Z80State(); final Pair<Z80, Integer> cpu = executeCommand(state, 0x11, 0x34, 0x12); assertEquals(0x1234, cpu.getLeft().getRegisterPair(Z80.REGPAIR_DE)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(10, cpu.getRight().intValue()); }
@Test public void testCommand_LD_HL_nn() { final Z80State state = new Z80State(); final Pair<Z80, Integer> cpu = executeCommand(state, 0x21, 0x34, 0x12); assertEquals(0x1234, cpu.getLeft().getRegisterPair(Z80.REGPAIR_HL)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(10, cpu.getRight().intValue()); }
@Test public void testCommand_LD_BC_mNN() { final Z80State state = new Z80State(); this.memory[0x1234] = (byte) 0xAA; this.memory[0x1235] = (byte) 0xBB; final Pair<Z80, Integer> cpu = executeCommand(state, 0xED, 0x4B, 0x34, 0x12); assertEquals(0xBBAA, cpu.getLeft().getRegisterPair(Z80.REGPAIR_BC)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(20, cpu.getRight().intValue()); }
@Test public void testCommand_LD_DE_mNN() { final Z80State state = new Z80State(); this.memory[0x1234] = (byte) 0xAA; this.memory[0x1235] = (byte) 0xBB; final Pair<Z80, Integer> cpu = executeCommand(state, 0xED, 0x5B, 0x34, 0x12); assertEquals(0xBBAA, cpu.getLeft().getRegisterPair(Z80.REGPAIR_DE)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(20, cpu.getRight().intValue()); }
@Test public void testCommand_LD_HL_mNN() { final Z80State state = new Z80State(); this.memory[0x1234] = (byte) 0xAA; this.memory[0x1235] = (byte) 0xBB; final Pair<Z80, Integer> cpu = executeCommand(state, 0xED, 0x6B, 0x34, 0x12); assertEquals(0xBBAA, cpu.getLeft().getRegisterPair(Z80.REGPAIR_HL)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(20, cpu.getRight().intValue()); }
@Test public void testCommand_EX_DE_HL() { final Z80State state = new Z80State(); state.D = 0x28; state.E = 0x22; state.H = 0x49; state.L = 0x9A; final Pair<Z80, Integer> cpu = executeCommand(state, 0xEB); assertEquals(0x2822, cpu.getLeft().getRegisterPair(Z80.REGPAIR_HL)); assertEquals(0x499A, cpu.getLeft().getRegisterPair(Z80.REGPAIR_DE)); assertFlagsNotChanged(state, cpu.getLeft()); assertEquals(4, cpu.getRight().intValue()); }