mirror of
https://codeberg.org/sethm/symon.git
synced 2026-11-07 19:12:23 +00:00
- 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:
1 parent
a01090a16e
commit
ac88786df7
21 files changed
+465
-446
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user