mirror of
https://codeberg.org/sethm/symon.git
synced 2026-11-09 03:22:24 +00:00
Minor whitespace cleanup
This commit is contained in:
1 parent
da88aadda2
commit
5a2e057e69
1 file changed
+10
-9
@@ -26,6 +26,7 @@ package com.loomcom.symon;
|
|||||||
import com.loomcom.symon.devices.Device;
|
import com.loomcom.symon.devices.Device;
|
||||||
import com.loomcom.symon.exceptions.MemoryAccessException;
|
import com.loomcom.symon.exceptions.MemoryAccessException;
|
||||||
import com.loomcom.symon.exceptions.MemoryRangeException;
|
import com.loomcom.symon.exceptions.MemoryRangeException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -80,9 +81,9 @@ public class Bus {
|
|||||||
deviceAddressArray = new Device[size];
|
deviceAddressArray = new Device[size];
|
||||||
|
|
||||||
// getDevices() provides an OrderedSet with devices ordered by priorities
|
// getDevices() provides an OrderedSet with devices ordered by priorities
|
||||||
for(Device device : getDevices()) {
|
for (Device device : getDevices()) {
|
||||||
MemoryRange range = device.getMemoryRange();
|
MemoryRange range = device.getMemoryRange();
|
||||||
for(int address = range.startAddress; address <= range.endAddress; ++address) {
|
for (int address = range.startAddress; address <= range.endAddress; ++address) {
|
||||||
deviceAddressArray[address - this.startAddress] = device;
|
deviceAddressArray[address - this.startAddress] = device;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +93,7 @@ public class Bus {
|
|||||||
/**
|
/**
|
||||||
* Add a device to the bus.
|
* Add a device to the bus.
|
||||||
*
|
*
|
||||||
* @param device Device to add
|
* @param device Device to add
|
||||||
* @param priority Bus prioirity.
|
* @param priority Bus prioirity.
|
||||||
* @throws MemoryRangeException
|
* @throws MemoryRangeException
|
||||||
*/
|
*/
|
||||||
@@ -137,7 +138,7 @@ public class Bus {
|
|||||||
* @param device Device to remove
|
* @param device Device to remove
|
||||||
*/
|
*/
|
||||||
public void removeDevice(Device device) {
|
public void removeDevice(Device device) {
|
||||||
for(SortedSet<Device> deviceSet : deviceMap.values()) {
|
for (SortedSet<Device> deviceSet : deviceMap.values()) {
|
||||||
deviceSet.remove(device);
|
deviceSet.remove(device);
|
||||||
}
|
}
|
||||||
buildDeviceAddressArray();
|
buildDeviceAddressArray();
|
||||||
@@ -154,12 +155,12 @@ public class Bus {
|
|||||||
* device.
|
* device.
|
||||||
*/
|
*/
|
||||||
public boolean isComplete() {
|
public boolean isComplete() {
|
||||||
if(deviceAddressArray == null) {
|
if (deviceAddressArray == null) {
|
||||||
buildDeviceAddressArray();
|
buildDeviceAddressArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int address = startAddress; address <= endAddress; ++address) {
|
for (int address = startAddress; address <= endAddress; ++address) {
|
||||||
if(deviceAddressArray[address - startAddress] == null) {
|
if (deviceAddressArray[address - startAddress] == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +170,7 @@ public class Bus {
|
|||||||
|
|
||||||
public int read(int address) throws MemoryAccessException {
|
public int read(int address) throws MemoryAccessException {
|
||||||
Device d = deviceAddressArray[address - this.startAddress];
|
Device d = deviceAddressArray[address - this.startAddress];
|
||||||
if(d != null) {
|
if (d != null) {
|
||||||
MemoryRange range = d.getMemoryRange();
|
MemoryRange range = d.getMemoryRange();
|
||||||
int devAddr = address - range.startAddress();
|
int devAddr = address - range.startAddress();
|
||||||
return d.read(devAddr) & 0xff;
|
return d.read(devAddr) & 0xff;
|
||||||
@@ -180,7 +181,7 @@ public class Bus {
|
|||||||
|
|
||||||
public void write(int address, int value) throws MemoryAccessException {
|
public void write(int address, int value) throws MemoryAccessException {
|
||||||
Device d = deviceAddressArray[address - this.startAddress];
|
Device d = deviceAddressArray[address - this.startAddress];
|
||||||
if(d != null) {
|
if (d != null) {
|
||||||
MemoryRange range = d.getMemoryRange();
|
MemoryRange range = d.getMemoryRange();
|
||||||
int devAddr = address - range.startAddress();
|
int devAddr = address - range.startAddress();
|
||||||
d.write(devAddr, value);
|
d.write(devAddr, value);
|
||||||
|
|||||||
Reference in new issue
Block a user