Renamed project to "Symon".
This commit is contained in:
1 parent
9a6a256073
commit
3f74489757
20 files changed
+102
-42
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package com.loomcom.symon.devices;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.loomcom.symon.*;
|
||||
import com.loomcom.symon.exceptions.*;
|
||||
|
||||
public class Memory extends Device {
|
||||
|
||||
private boolean readOnly;
|
||||
private int[] mem;
|
||||
|
||||
public Memory(int address, int size, boolean readOnly)
|
||||
throws MemoryRangeException {
|
||||
super(address, size, "RW Memory");
|
||||
this.readOnly = readOnly;
|
||||
this.mem = new int[size];
|
||||
// Initialize all locations to 0xff
|
||||
Arrays.fill(this.mem, 0xff);
|
||||
}
|
||||
|
||||
public Memory(int address, int size)
|
||||
throws MemoryRangeException {
|
||||
this(address, size, false);
|
||||
}
|
||||
|
||||
public void write(int address, int data) {
|
||||
this.mem[address] = data;
|
||||
}
|
||||
|
||||
public int read(int address) {
|
||||
return this.mem[address];
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Memory: " + getMemoryRange().toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user