Whitespace and indentation canonicalization. That's what I get for using two editors.

This commit is contained in:
Seth J. Morabito committed 2008-12-27 21:09:47 -08:00
1 parent d54ad18b17
commit 8bcd8a4a75
18 files changed
+5249 -5250

No files matched your search

+86 -86
View File
@@ -8,107 +8,107 @@ import com.loomcom.symon.exceptions.*;
*/
public class Simulator {
/**
* Command-line parser used by this simulator.
*/
private CommandParser parser;
/**
* Command-line parser used by this simulator.
*/
private CommandParser parser;
/**
* The CPU itself.
*/
private Cpu cpu;
/**
* The CPU itself.
*/
private Cpu cpu;
/**
* The Bus responsible for routing memory read/write requests to the
* correct IO devices.
*/
private Bus bus;
/**
* The Bus responsible for routing memory read/write requests to the
* correct IO devices.
*/
private Bus bus;
public Simulator() throws MemoryRangeException {
cpu = new Cpu();
bus = new Bus(0x0000, 0xffff);
bus.addCpu(cpu);
bus.addDevice(new Memory(0x0000, 0x10000));
parser = new CommandParser(System.in, System.out, this);
}
public Simulator() throws MemoryRangeException {
cpu = new Cpu();
bus = new Bus(0x0000, 0xffff);
bus.addCpu(cpu);
bus.addDevice(new Memory(0x0000, 0x10000));
parser = new CommandParser(System.in, System.out, this);
}
public void run() {
parser.run();
}
public void run() {
parser.run();
}
public void step() {
}
public void step() {
}
public int read(int address) {
return 0;
}
public int read(int address) {
return 0;
}
public void write(int address, int value) {
}
public void write(int address, int value) {
}
public void loadProgram(int address, int[] program) {
// Reset interrupt vector
int hi = (address&0xff00)>>>8;
int lo = address&0x00ff;
bus.write(0xfffc, lo);
bus.write(0xfffd, hi);
public void loadProgram(int address, int[] program) {
// Reset interrupt vector
int hi = (address&0xff00)>>>8;
int lo = address&0x00ff;
bus.write(0xfffc, lo);
bus.write(0xfffd, hi);
int i = 0;
for (int d : program) {
bus.write(address + i++, d);
}
}
int i = 0;
for (int d : program) {
bus.write(address + i++, d);
}
}
/**
* A test method.
*/
/**
* A test method.
*/
public void runTest() {
int[] program = {
0xa9, // LDA #$FF
0xff,
0xa0, // LDY #$1A
0x1a,
0xa2, // LDX #$90
0x90,
0xa2, // LDX #$02
0x02,
0x49, // EOR #$FF
0xff,
0xa9, // LDA #$00
0x00,
0xa2, // LDX #$00
0x00,
0x29, // AND #$FF
0xff,
0xa0, // LDY #$00
0x00,
0x4c, // JMP #$0300
0x00,
0x03
};
public void runTest() {
int[] program = {
0xa9, // LDA #$FF
0xff,
0xa0, // LDY #$1A
0x1a,
0xa2, // LDX #$90
0x90,
0xa2, // LDX #$02
0x02,
0x49, // EOR #$FF
0xff,
0xa9, // LDA #$00
0x00,
0xa2, // LDX #$00
0x00,
0x29, // AND #$FF
0xff,
0xa0, // LDY #$00
0x00,
0x4c, // JMP #$0300
0x00,
0x03
};
loadProgram(0x0300, program);
cpu.reset();
loadProgram(0x0300, program);
cpu.reset();
int steps = program.length;
int steps = program.length;
for (int i = 0; i <= steps; i++) {
cpu.step();
System.out.println(cpu.toString());
}
for (int i = 0; i <= steps; i++) {
cpu.step();
System.out.println(cpu.toString());
}
}
}
/**
* Main simulator routine.
*/
public static void main(String[] args) {
try {
new Simulator().runTest();
} catch (MemoryRangeException ex) {
System.err.println("Error: " + ex.toString());
}
}
/**
* Main simulator routine.
*/
public static void main(String[] args) {
try {
new Simulator().runTest();
} catch (MemoryRangeException ex) {
System.err.println("Error: " + ex.toString());
}
}
}