Address IntelliJ warnings
This commit addresses a large number of IntelliJ warnings that have been left hanging around for far too long.
This commit is contained in:
1 parent
ecd4bbbd9a
commit
c317544e7b
28 files changed
+222
-408
No files matched your search
@@ -32,7 +32,7 @@ import com.loomcom.symon.exceptions.MemoryRangeException;
|
||||
|
||||
public abstract class Acia extends Device {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Register addresses
|
||||
|
||||
@@ -121,9 +121,6 @@ public class Acia6551 extends Acia {
|
||||
// Mask the lower four bits to get the baud rate.
|
||||
int baudSelector = data & 0x0f;
|
||||
switch (baudSelector) {
|
||||
case 0:
|
||||
rate = 0;
|
||||
break;
|
||||
case 1:
|
||||
rate = 50;
|
||||
break;
|
||||
@@ -169,6 +166,8 @@ public class Acia6551 extends Acia {
|
||||
case 15:
|
||||
rate = 19200;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
setBaudRate(rate);
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.loomcom.symon.exceptions.MemoryRangeException;
|
||||
/**
|
||||
* This is a simulation of the Motorola 6850 ACIA, with limited
|
||||
* functionality.
|
||||
*
|
||||
* <p>
|
||||
* Unlike a 16550 UART, the 6850 ACIA has only one-byte transmit and
|
||||
* receive buffers. It is the programmer's responsibility to check the
|
||||
* status (full or empty) for transmit and receive buffers before
|
||||
|
||||
@@ -26,8 +26,6 @@ package com.loomcom.symon.devices;
|
||||
import com.loomcom.symon.exceptions.MemoryAccessException;
|
||||
import com.loomcom.symon.exceptions.MemoryRangeException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Simulation of a 6545 CRTC and virtual CRT output.
|
||||
*/
|
||||
@@ -87,9 +85,9 @@ public class Crtc extends Device {
|
||||
private boolean displayEnableSkew = false;
|
||||
private boolean cursorSkew = false;
|
||||
|
||||
private Memory memory;
|
||||
private final Memory memory;
|
||||
|
||||
public Crtc(int deviceAddress, Memory memory) throws MemoryRangeException, IOException {
|
||||
public Crtc(int deviceAddress, Memory memory) throws MemoryRangeException {
|
||||
super(deviceAddress, deviceAddress + 2, "CRTC");
|
||||
this.memory = memory;
|
||||
|
||||
@@ -120,19 +118,17 @@ public class Crtc extends Device {
|
||||
|
||||
@Override
|
||||
public int read(int address, boolean cpuAccess) throws MemoryAccessException {
|
||||
switch (address) {
|
||||
case REGISTER_RW:
|
||||
switch (currentRegister) {
|
||||
case CURSOR_POSITION_LOW:
|
||||
return cursorPosition & 0xff;
|
||||
case CURSOR_POSITION_HIGH:
|
||||
return cursorPosition >> 8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
if (address == REGISTER_RW) {
|
||||
switch (currentRegister) {
|
||||
case CURSOR_POSITION_LOW:
|
||||
return cursorPosition & 0xff;
|
||||
case CURSOR_POSITION_HIGH:
|
||||
return cursorPosition >> 8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class Device implements Comparable<Device> {
|
||||
/**
|
||||
* The memory range for this device.
|
||||
*/
|
||||
private MemoryRange memoryRange;
|
||||
private final MemoryRange memoryRange;
|
||||
|
||||
/**
|
||||
* The name of the device.
|
||||
@@ -60,7 +60,7 @@ public abstract class Device implements Comparable<Device> {
|
||||
/**
|
||||
* Listeners to notify on update.
|
||||
*/
|
||||
private Set<DeviceChangeListener> deviceChangeListeners;
|
||||
private final Set<DeviceChangeListener> deviceChangeListeners;
|
||||
|
||||
public Device(int startAddress, int endAddress, String name) throws MemoryRangeException {
|
||||
this.memoryRange = new MemoryRange(startAddress, endAddress);
|
||||
|
||||
@@ -30,8 +30,8 @@ import com.loomcom.symon.exceptions.*;
|
||||
|
||||
public class Memory extends Device {
|
||||
|
||||
private boolean readOnly;
|
||||
private int[] mem;
|
||||
private final boolean readOnly;
|
||||
private final int[] mem;
|
||||
|
||||
/* Initialize all locations to 0x00 (BRK) */
|
||||
private static final int DEFAULT_FILL = 0x00;
|
||||
|
||||
@@ -119,7 +119,10 @@ public class SdController extends Device {
|
||||
if (sdImageFile != null) {
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream(sdImageFile);
|
||||
fis.skip(this.position);
|
||||
long bytesSkipped = fis.skip(this.position);
|
||||
if (bytesSkipped < this.position) {
|
||||
logger.log(Level.WARNING, "Failed to seek to position " + this.position);
|
||||
}
|
||||
int read = fis.read(readBuffer);
|
||||
if (read < SECTOR_SIZE) {
|
||||
logger.log(Level.WARNING, "not enough data to fill read buffer from SD image file");
|
||||
|
||||
@@ -27,83 +27,23 @@ import com.loomcom.symon.exceptions.MemoryAccessException;
|
||||
import com.loomcom.symon.exceptions.MemoryRangeException;
|
||||
|
||||
/**
|
||||
* Very basic implementation of a MOS 6522 VIA.
|
||||
*
|
||||
* TODO: Implement timers as threads.
|
||||
* Skeleton for future implementation of a MOS 6522 VIA.
|
||||
*/
|
||||
public class Via6522 extends Pia {
|
||||
public static final int VIA_SIZE = 16;
|
||||
|
||||
enum Register {
|
||||
ORB, ORA, DDRB, DDRA, T1C_L, T1C_H, T1L_L, T1L_H,
|
||||
T2C_L, T2C_H, SR, ACR, PCR, IFR, IER, ORA_H
|
||||
}
|
||||
|
||||
public Via6522(int address) throws MemoryRangeException {
|
||||
super(address, address + VIA_SIZE - 1, "MOS 6522 VIA");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int address, int data) throws MemoryAccessException {
|
||||
Register[] registers = Register.values();
|
||||
|
||||
if (address >= registers.length) {
|
||||
throw new MemoryAccessException("Unknown register: " + address);
|
||||
}
|
||||
|
||||
Register r = registers[address];
|
||||
|
||||
switch (r) {
|
||||
case ORA:
|
||||
case ORB:
|
||||
case DDRA:
|
||||
case DDRB:
|
||||
case T1C_L:
|
||||
case T1C_H:
|
||||
case T1L_L:
|
||||
case T1L_H:
|
||||
case T2C_L:
|
||||
case T2C_H:
|
||||
case SR:
|
||||
case ACR:
|
||||
case PCR:
|
||||
case IFR:
|
||||
case IER:
|
||||
case ORA_H:
|
||||
default:
|
||||
}
|
||||
// TODO: Implement write.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(int address, boolean cpuAccess) throws MemoryAccessException {
|
||||
Register[] registers = Register.values();
|
||||
|
||||
if (address >= registers.length) {
|
||||
throw new MemoryAccessException("Unknown register: " + address);
|
||||
}
|
||||
|
||||
Register r = registers[address];
|
||||
|
||||
switch (r) {
|
||||
case ORA:
|
||||
case ORB:
|
||||
case DDRA:
|
||||
case DDRB:
|
||||
case T1C_L:
|
||||
case T1C_H:
|
||||
case T1L_L:
|
||||
case T1L_H:
|
||||
case T2C_L:
|
||||
case T2C_H:
|
||||
case SR:
|
||||
case ACR:
|
||||
case PCR:
|
||||
case IFR:
|
||||
case IER:
|
||||
case ORA_H:
|
||||
default:
|
||||
}
|
||||
|
||||
// TODO: Implement read.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user