Cleanup any warnings, update for java 11 & latest maven, Fix minor 6522 initialization issue causing NPEs

This commit is contained in:
Zachary D. Rowitsch 2019-12-31 00:31:44 -05:00
parent ee64f5aa7c
commit eaf32666c2
6 changed files with 60 additions and 29 deletions

45
pom.xml

@ -7,6 +7,9 @@
<version>1.3.0-SNAPSHOT</version>
<name>symon</name>
<url>http://www.loomcom.com/symon</url>
<prerequisites>
<maven>3.6.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>
UTF-8
@ -42,10 +45,32 @@
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-maven-3</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6.1</version>
</requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>3.2.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
@ -69,11 +94,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.8.1</version>
<configuration>
<compilerArgument>-Xlint:unchecked</compilerArgument>
<source>1.7</source>
<target>1.7</target>
<release>11</release>
</configuration>
</plugin>
@ -81,7 +105,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
@ -95,11 +119,18 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<version>1.6.0</version>
<configuration>
<mainClass>com.loomcom.symon.Simulator</mainClass>
</configuration>

@ -1927,6 +1927,9 @@ public class Cpu implements InstructionTable {
case ZPY:
sb.append(" $").append(Utils.byteToHex(args[0])).append(",Y");
break;
default:
sb.append(" ").append(instructionModes[opCode].toString());
break;
}
return sb.toString();

@ -153,7 +153,7 @@ public class Simulator {
private JButton runStopButton;
private JButton stepButton;
private JComboBox<String> stepCountBox;
private final JComboBox<String> stepCountBox = new JComboBox<String>(STEPS);;
private JFileChooser fileChooser;
private PreferencesDialog preferences;
@ -230,13 +230,11 @@ public class Simulator {
assertNmi.setToolTipText("Manually assert a non-maskable interrupt");
JButton assertIrq = new JButton("IRQ");
stepCountBox = new JComboBox<>(STEPS);
stepCountBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
try {
JComboBox cb = (JComboBox) actionEvent.getSource();
stepsPerClick = Integer.parseInt((String) cb.getSelectedItem());
stepsPerClick = Integer.parseInt((String) stepCountBox.getSelectedItem());
} catch (NumberFormatException ex) {
stepsPerClick = 1;
stepCountBox.setSelectedIndex(0);
@ -645,18 +643,19 @@ public class Simulator {
}
Scanner scanner = new Scanner(debugFile);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
//TODO I'm sure this parsing needs to be more robust, but i don't see any doc on the format
String[] lineParts = line.split(" ");
if (lineParts.length != 3)
throw new IOException("Format of debug file unrecognized for line: " + line);
String address = lineParts[1];
address = address.substring(2);
String symbol = lineParts[2];
machine.getCpu().addDebugSymbol(address, symbol);
try (Scanner scanner = new Scanner(debugFile)) {
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
//TODO I'm sure this parsing needs to be more robust, but i don't see any doc on the format
String[] lineParts = line.split(" ");
if (lineParts.length != 3)
throw new IOException("Format of debug file unrecognized for line: " + line);
String address = lineParts[1];
address = address.substring(2);
String symbol = lineParts[2];
machine.getCpu().addDebugSymbol(address, symbol);
}
}
logger.info("Debug file '{}' loaded.", debugFile.getName());

@ -3,7 +3,6 @@ package com.loomcom.symon.devices;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.loomcom.symon.Cpu;
import com.loomcom.symon.exceptions.MemoryAccessException;
import com.loomcom.symon.exceptions.MemoryRangeException;
import com.loomcom.symon.util.Utils;

@ -46,6 +46,9 @@ public class Via6522 extends Pia implements StepListener {
public Via6522(int address) throws MemoryRangeException {
super(address, address + VIA_SIZE - 1, "MOS 6522 VIA");
for( int i = 0; i < registers.length; i++) {
registers[i] = UByte.MIN;
}
}
@Override

@ -29,12 +29,11 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Observable;
/**
* Dialog window that allows the user to modify selected run-time settings of the simulator.
*/
public class PreferencesDialog extends Observable implements Preferences {
public class PreferencesDialog implements Preferences {
private final JDialog dialog;
@ -111,9 +110,6 @@ public class PreferencesDialog extends Observable implements Preferences {
haltOnBreak = haltOnBreakCheckBox.isSelected();
programLoadAddress = PreferencesDialog.this.hexToInt(programLoadAddressField.getText());
PreferencesDialog.this.updateUi();
// TODO: Actually check to see if values have changed, don't assume.
PreferencesDialog.this.setChanged();
PreferencesDialog.this.notifyObservers();
dialog.setVisible(false);
}
});