Search in sources :

Example 66 with Program

use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.

the class Mos6502Test method testDEC.

@Test
public void testDEC() {
    Program program = new Program().with(LDA_I, 9, STA_Z, 0x20, DEC_Z, 0x20);
    memory.setBlock(0, program.getProgramAsByteArray());
    Registers registers = processor.getRegisters();
    processor.step(3);
    assertEquals(program.getLength(), registers.getPC());
    assertEquals(8, memory.getByte(0x20));
}
Also used : Program(com.rox.emu.processor.mos6502.util.Program) Test(org.junit.Test)

Example 67 with Program

use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.

the class Mos6502Test method testPLP.

@Test
public void testPLP() {
    Program program = new Program().with(PHP, PLP);
    memory.setBlock(0, program.getProgramAsByteArray());
    Registers registers = processor.getRegisters();
    // Load status, push to stack then clear it and pull it from stack
    registers.setRegister(Registers.Register.STATUS_FLAGS, 0b11111111);
    processor.step(1);
    registers.setRegister(Registers.Register.STATUS_FLAGS, 0b00000000);
    processor.step(1);
    assertEquals(program.getLength(), registers.getPC());
    assertEquals(0b11111111, registers.getRegister(Registers.Register.STATUS_FLAGS));
}
Also used : Program(com.rox.emu.processor.mos6502.util.Program) Test(org.junit.Test)

Example 68 with Program

use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.

the class Mos6502Test method testSTA.

@Test
public void testSTA() {
    Program program = new Program().with(LDA_I, 0xAA, STA_Z, 100);
    memory.setBlock(0, program.getProgramAsByteArray());
    processor.step(2);
    Registers registers = processor.getRegisters();
    assertEquals(program.getLength(), registers.getPC());
    assertEquals(0xAA, memory.getByte(100));
}
Also used : Program(com.rox.emu.processor.mos6502.util.Program) Test(org.junit.Test)

Example 69 with Program

use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.

the class Mos6502Test method testSTYAbsolute.

@Test
public void testSTYAbsolute() {
    Program program = new Program().with(LDY_I, 0xAA, STY_ABS, 0x02, 0x20);
    memory.setBlock(0, program.getProgramAsByteArray());
    processor.step(2);
    Registers registers = processor.getRegisters();
    assertEquals(program.getLength(), registers.getPC());
    assertEquals(0xAA, memory.getByte(0x220));
}
Also used : Program(com.rox.emu.processor.mos6502.util.Program) Test(org.junit.Test)

Example 70 with Program

use of com.rox.emu.processor.mos6502.util.Program in project emuRox by rossdrew.

the class Mos6502Test method testSTY.

@Test
public void testSTY() {
    Program program = new Program().with(LDY_I, 0xAA, STY_Z, 100);
    memory.setBlock(0, program.getProgramAsByteArray());
    processor.step(2);
    Registers registers = processor.getRegisters();
    assertEquals(program.getLength(), registers.getPC());
    assertEquals(0xAA, memory.getByte(100));
}
Also used : Program(com.rox.emu.processor.mos6502.util.Program) Test(org.junit.Test)

Aggregations

Program (com.rox.emu.processor.mos6502.util.Program)100 Test (org.junit.Test)86 Mos6502Compiler (com.rox.emu.processor.mos6502.util.Mos6502Compiler)32 Property (com.pholser.junit.quickcheck.Property)12 UnknownOpCodeException (com.rox.emu.UnknownOpCodeException)6 Memory (com.rox.emu.mem.Memory)2 SimpleMemory (com.rox.emu.mem.SimpleMemory)2 UnknownTokenException (com.rox.emu.UnknownTokenException)1 RoxWord (com.rox.emu.env.RoxWord)1 AddressingMode (com.rox.emu.processor.mos6502.op.AddressingMode)1 OpCode (com.rox.emu.processor.mos6502.op.OpCode)1 StringTokenizer (java.util.StringTokenizer)1