- Continued refactoring of address decoding.

- Device read and write may now throw MemoryAccessException, and appropriate
  throws clauses have been added throughout the code.
This commit is contained in:
Seth J. Morabito committed 2010-01-09 16:53:04 -08:00
1 parent a01090a16e
commit ac88786df7
21 files changed
+465 -446

No files matched your search

+3 -3
View File
@@ -98,7 +98,7 @@ public class Bus {
return true;
}
public int read(int address) {
public int read(int address) throws MemoryAccessException {
for (Device d : devices) {
MemoryRange range = d.getMemoryRange();
if (range.includes(address)) {
@@ -111,7 +111,7 @@ public class Bus {
throw new RuntimeException("Read failed! Device not found.");
}
public void write(int address, int value) {
public void write(int address, int value) throws MemoryAccessException {
for (Device d : devices) {
MemoryRange range = d.getMemoryRange();
if (range.includes(address)) {
@@ -134,7 +134,7 @@ public class Bus {
return cpu;
}
public void loadProgram(int... program) {
public void loadProgram(int... program) throws MemoryAccessException {
int address = getCpu().getProgramCounter();
int i = 0;
for (int d : program) {