1
0
mirror of https://github.com/sethm/symon.git synced 2024-06-01 08:41:32 +00:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Maik Merten 2014-08-12 11:48:47 +02:00
commit 5d488bbcd2
27 changed files with 81 additions and 54 deletions

View File

@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2008-2013 Seth J. Morabito <web@loomcom.com>
Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,19 +1,9 @@
SYMON - A 6502 System Simulator
===============================
**NOTE: THIS SOFTWARE IS UNDER ACTIVE DEVELOPMENT. Feedback is welcome!**
**Version:** 1.0.0
**Version:** 1.0.0-SNAPSHOT
**Last Updated:** 10 August, 2014
**Copyright (c) 2014 Seth J. Morabito &lt;web@loomcom.com&gt;**
Portions Copyright (c) 2014 Maik Merten &lt;maikmerten@googlemail.com&gt;
Enhanced 6502 BASIC (c) Lee Davison
6502 Functional Tests (c) Klaus Dormann
**Last Updated:** 11 August, 2014
See the file COPYING for license.
@ -35,6 +25,9 @@ Klaus Dormann's 6502 Functional Test Suite as of version 0.8.2
(See [this thread on the 6502.org Forums] (http://forum.6502.org/viewtopic.php?f=2&t=2241)
for more information about this functional test suite).
Symon is under constant, active development. Feedback and patches
are always welcome.
## 2.0 Requirements
- Java 1.7 or higher
@ -288,13 +281,20 @@ running.
- Symbolic debugging.
## 7.0 Acknowledgements
## 7.0 Copyright and Acknowledgements
**Copyright (c) 2014 Seth J. Morabito &lt;web@loomcom.com&gt;**
Portions Copyright (c) 2014 Maik Merten &lt;maikmerten@googlemail.com&gt;
Additional components used in this project are copyright their respective owners.
- Enhanced 6502 BASIC Copyright (c) Lee Davison
- 6502 Functional Tests Copyright (c) Klaus Dormann
- JTerminal Copyright (c) Graham Edgecombe
This project would not have been possible without the following resources:
- [Graham Edgecombe's JTerminal project] (https://github.com/grahamedgecombe/jterminal),
which forms the core of Symon's console.
- [Andrew Jacobs' 6502 Pages] (http://www.obelisk.demon.co.uk/6502/), for
wonderfully detailed information about the 6502

View File

@ -4,7 +4,7 @@
<groupId>com.loomcom.symon</groupId>
<artifactId>symon</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<name>symon</name>
<url>http://www.loomcom.com/symon</url>
<properties>

View File

@ -150,7 +150,7 @@ END_CODE
; sign on string
LAB_mess
.byte $0D,$0A,"Symon (c) 2008-2013, Seth Morabito"
.byte $0D,$0A,"Symon (c) 2008-2014, Seth Morabito"
.byte $0D,$0A,"Enhanced 6502 BASIC 2.22 (c) Lee Davison"
.byte $0D,$0A,"[C]old/[W]arm ?",$00

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2012 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2012 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -55,10 +55,6 @@ public class Cpu implements InstructionTable {
public static final int IRQ_VECTOR_L = 0xfffe;
public static final int IRQ_VECTOR_H = 0xffff;
// The delay in microseconds between steps.
// TODO: Make configurable
private static final int CLOCK_IN_NS = 1000;
/* Simulated behavior */
private static CpuBehavior behavior;
@ -872,7 +868,7 @@ public class Cpu implements InstructionTable {
*/
private int lsr(int m) {
setCarryFlag((m & 0x01) != 0);
return (m >>> 1) & 0xff;
return (m & 0xff) >>> 1;
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2012 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2012 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
* Maik Merten <maikmerten@googlemail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -354,7 +354,6 @@ public class Simulator {
}
// If a key has been pressed, fill the ACIA.
// TODO: Interrupt handling.
try {
if (machine.getAcia() != null && console.hasInput()) {
machine.getAcia().rxWrite((int) console.readInputChar());
@ -463,7 +462,6 @@ public class Simulator {
}
menuBar.simulatorDidStop();
traceLog.simulatorDidStop();
// TODO: Update memory window, if frame is visible.
}
});
@ -488,7 +486,6 @@ public class Simulator {
}
public void actionPerformed(ActionEvent actionEvent) {
// TODO: Error dialogs on failure.
try {
int retVal = fileChooser.showOpenDialog(mainWindow);
if (retVal == JFileChooser.APPROVE_OPTION) {
@ -497,11 +494,10 @@ public class Simulator {
long fileSize = f.length();
if (fileSize > machine.getMemorySize()) {
throw new IOException("Program of size $" +
Integer.toString((int)fileSize, 16) +
" will not fit in available memory of size $" +
throw new IOException("File will not fit in " +
"available memory ($" +
Integer.toString(machine.getMemorySize(), 16) +
".");
" bytes)");
} else {
byte[] program = new byte[(int) fileSize];
int i = 0;
@ -520,13 +516,21 @@ public class Simulator {
// Now load the program at the starting address.
loadProgram(program, preferences.getProgramStartAddress());
// TODO: "Don't Show Again" checkbox
JOptionPane.showMessageDialog(mainWindow,
"Loaded Successfully At " +
String.format("$%04X", preferences.getProgramStartAddress()),
"OK",
JOptionPane.PLAIN_MESSAGE);
}
}
}
} catch (IOException ex) {
logger.log(Level.SEVERE, "Unable to read program file: " + ex.getMessage());
JOptionPane.showMessageDialog(mainWindow, ex.getMessage(), "Failure", JOptionPane.ERROR_MESSAGE);
} catch (MemoryAccessException ex) {
logger.log(Level.SEVERE, "Memory access error loading program: " + ex.getMessage());
JOptionPane.showMessageDialog(mainWindow, ex.getMessage(), "Failure", JOptionPane.ERROR_MESSAGE);
}
}
}
@ -539,7 +543,6 @@ public class Simulator {
}
public void actionPerformed(ActionEvent actionEvent) {
// TODO: Error dialogs on failure.
try {
int retVal = fileChooser.showOpenDialog(mainWindow);
if (retVal == JFileChooser.APPROVE_OPTION) {
@ -560,15 +563,24 @@ public class Simulator {
logger.log(Level.INFO, "ROM File `" + romFile.getName() + "' loaded at " +
String.format("0x%04X", machine.getRomBase()));
// TODO: "Don't Show Again" checkbox
JOptionPane.showMessageDialog(mainWindow,
"Loaded Successfully At " +
String.format("$%04X", machine.getRomBase()),
"OK",
JOptionPane.PLAIN_MESSAGE);
}
}
}
} catch (IOException ex) {
logger.log(Level.SEVERE, "Unable to read ROM file: " + ex.getMessage());
JOptionPane.showMessageDialog(mainWindow, ex.getMessage(), "Failure", JOptionPane.ERROR_MESSAGE);
} catch (MemoryRangeException ex) {
logger.log(Level.SEVERE, "Memory range error while loading ROM file: " + ex.getMessage());
JOptionPane.showMessageDialog(mainWindow, ex.getMessage(), "Failure", JOptionPane.ERROR_MESSAGE);
} catch (MemoryAccessException ex) {
logger.log(Level.SEVERE, "Memory access error while loading ROM file: " + ex.getMessage());
JOptionPane.showMessageDialog(mainWindow, ex.getMessage(), "Failure", JOptionPane.ERROR_MESSAGE);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
* Maik Merten <maikmerten@googlemail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2014 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
* Maik Merten <maikmerten@googlemail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2014 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
* Maik Merten <maikmerten@googlemail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2014 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
* Maik Merten <maikmerten@googlemail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2013 Seth J. Morabito <sethm@loomcom.com>
* Copyright (c) 2008-2014 Seth J. Morabito <web@loomcom.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -583,4 +583,23 @@ public class CpuTest extends TestCase {
cpu.setYRegister(0x95);
assertEquals(0x15, cpu.zpyAddress(0x80));
}
// Test for GitHub symon issue #9, "LSR can yield wrong result"
public void testRightShiftMasksBitsCorrectly() throws Exception {
// Illegal value, the accumulator should only care about the low 8 bytes.
// I'm a little uncomfortable with this test because really, setAccumulator should
// defensively mask the value, but does not. Is this relying on a bug to test another bug?
cpu.setAccumulator(0xff8);
// Sanity check, in case I ever change my mind on setAccumulator's behavior
assertEquals(0xff8, cpu.getAccumulator());
bus.loadProgram(0x4a, // LSR
0x4a); // LSR
cpu.step();
assertEquals(0x7C, cpu.getAccumulator());
cpu.step();
assertEquals(0x3E, cpu.getAccumulator());
}
}