-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fixed disk speed-up bug (Sherwood Forest reads with the drive motor off) - added check for 2IMG header ID - fixed processor status bugs in BRK, PLP, RTI, NMI, IRQ
- Loading branch information
1 parent
add3d41
commit dc8f597
Showing
8 changed files
with
87 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* AppleIIGo | ||
* Display processing | ||
* (C) 2006 by Marc S. Ressl ([email protected]) | ||
* Copyright 2006 by Marc S. Ressl ([email protected]) | ||
* Released under the GPL | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,18 @@ | |
/** | ||
* AppleIIGo | ||
* The Java Apple II Emulator | ||
* Copyright 2011 by Nick Westgate ([email protected]) | ||
* Copyright 2014 by Nick Westgate ([email protected]) | ||
* Copyright 2006 by Marc S. Ressl ([email protected]) | ||
* Released under the GNU General Public License version 2 | ||
* See http://www.gnu.org/licenses/ | ||
* | ||
* Change list: | ||
* | ||
* Version 1.0.9 - changes by Nick: | ||
* - fixed disk speed-up bug (Sherwood Forest reads with the drive motor off) | ||
* - added check for 2IMG header ID | ||
* - fixed processor status bugs in BRK, PLP, RTI, NMI, IRQ | ||
* | ||
* Version 1.0.8 - changes by Nick: | ||
* - implemented disk writing (only in memory, not persisted) | ||
* - added support for .2MG (2IMG) disk images, including lock flag and volume number | ||
|
@@ -80,7 +85,7 @@ public class AppleIIGo extends Applet implements KeyListener, ComponentListener, | |
|
||
private static final long serialVersionUID = -3302282815441501352L; | ||
|
||
final String version = "1.0.8"; | ||
final String version = "1.0.9"; | ||
final String versionString = "AppleIIGo Version " + version; | ||
final String metaStart = "_meta_"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* AppleIIGo | ||
* Speaker processing | ||
* (C) 2006 by Marc S. Ressl([email protected]) | ||
* Copyright 2006 by Marc S. Ressl([email protected]) | ||
* Released under the GPL | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import java.io.PrintWriter; | ||
|
||
|
||
/** | ||
* AppleIIGo | ||
* Apple II Emulator for J2SE | ||
* (C) 2006 by Marc S. Ressl([email protected]) | ||
* Copyright 2006 by Marc S. Ressl([email protected]) | ||
* Released under the GPL | ||
* Adapted from code by Doug Kwan | ||
* Adapted from code by Randy Frank [email protected] | ||
* Adapted from code (C) 1989 Ben Koning [556498717 408/738-1763 [email protected]] | ||
* Adapted from code Copyright 1989 Ben Koning [556498717 408/738-1763 [email protected]] | ||
*/ | ||
|
||
public class Em6502 { | ||
|
@@ -78,6 +80,7 @@ protected void onIRQ() { | |
public static final int FLAG_I = (1 << 2); | ||
public static final int FLAG_D = (1 << 3); | ||
public static final int FLAG_B = (1 << 4); | ||
public static final int FLAG_R = (1 << 6); | ||
public static final int FLAG_V = (1 << 6); | ||
public static final int FLAG_N = (1 << 7); | ||
/* | ||
|
@@ -120,6 +123,8 @@ protected void onIRQ() { | |
* Constructor | ||
*/ | ||
public Em6502() { | ||
// createRunFile(); | ||
|
||
// Init BCD tables | ||
BCDTableAdd = new int[512]; | ||
BCDTableSub = new int[512]; | ||
|
@@ -133,6 +138,10 @@ public Em6502() { | |
BCDTableSub[i] = ((i & 0x0f) <= 0x09) ? i : (i - 0x06); | ||
BCDTableSub[i] -= ((BCDTableSub[i] & 0xf0) <= 0x90) ? 0 : 0x60; | ||
} | ||
|
||
// Init CPU | ||
S = 0xFF; | ||
P = FLAG_B | FLAG_R; | ||
} | ||
|
||
/* | ||
|
@@ -294,9 +303,39 @@ private final void branch(int operand) { | |
clock++; | ||
} | ||
|
||
// private PrintWriter runFile; | ||
// private void createRunFile() | ||
// { | ||
// try | ||
// { | ||
// runFile = new PrintWriter("C:\\Users\\Public\\AppleIIGoRun.txt"); | ||
// } | ||
// catch (Exception ex) | ||
// { | ||
// // swallow | ||
// } | ||
// } | ||
// private final void writeRunFile(int opcode) | ||
// { | ||
// if ( | ||
// (PC > 0x0500) | ||
// && | ||
// (PC < 0x0600) | ||
// ) | ||
// { | ||
// setN(getFN()); | ||
// setZ(getFZ()); | ||
// setC(getFC()); | ||
// | ||
// runFile.printf("%04X-%02X P=%02X A=%02X\r\n", PC, opcode, P, A); | ||
// runFile.flush(); | ||
// } | ||
// } | ||
|
||
/** This executes a single instruction. */ | ||
private final void executeInstruction() { | ||
opcode = memoryRead(PC); | ||
// writeRunFile(opcode); | ||
PC++; | ||
|
||
switch(opcode) { | ||
|
@@ -535,8 +574,7 @@ private final void executeInstruction() { | |
setN(getFN()); | ||
setZ(getFZ()); | ||
setC(getFC()); | ||
setB(true); | ||
push(P); | ||
push(P); // break flag is always set | ||
setI(true); | ||
PC = memoryRead(0xfffe); | ||
PC |= memoryRead(0xffff) << 8; | ||
|
@@ -1043,7 +1081,7 @@ private final void executeInstruction() { | |
break; | ||
|
||
case 0x28: // PLP | ||
P = pop() | 0x20; // fix bug in bit5 of P | ||
P = pop() | FLAG_B | FLAG_R; // fix bug in bit5 of P | ||
setFC(getC()); | ||
setFNZ(getN(), getZ()); | ||
clock += 4; | ||
|
@@ -1144,7 +1182,7 @@ private final void executeInstruction() { | |
break; | ||
|
||
case 0x40: // RTI | ||
P = pop() | 0x20; // bit 5 bug of 6502 | ||
P = pop() | FLAG_B | FLAG_R; // bit 5 bug of 6502 | ||
setFC(getC()); | ||
setFNZ(getN(), getZ()); | ||
PC = pop(); // splitting is necessary | ||
|
@@ -1570,13 +1608,13 @@ public final void checkInterrupts() { | |
if ((exceptionRegister & SIG_6502_RESET) != 0) { | ||
onReset(); | ||
|
||
PC = memoryRead(0xfffc); | ||
PC |= (memoryRead(0xfffd) << 8); | ||
S = (S - 3) & 0xff; | ||
setI(true); | ||
setD(false); // not on NMOS 6502 | ||
setFC(getC()); | ||
setFNZ(getN(), getZ()); | ||
S = (S - 3) & 0xff; | ||
setI(true); | ||
PC = memoryRead(0xfffc); | ||
PC |= (memoryRead(0xfffd) << 8); | ||
clock += 7; | ||
exceptionRegister &= ~SIG_6502_RESET; | ||
} | ||
|
@@ -1590,7 +1628,8 @@ public final void checkInterrupts() { | |
setN(getFN()); | ||
setZ(getFZ()); | ||
setC(getFC()); | ||
push(P); | ||
push(P & ~FLAG_B); | ||
setI(true); | ||
PC = memoryRead(0xfffa); | ||
PC |= memoryRead(0xfffb) << 8; | ||
clock += 7; | ||
|
@@ -1608,8 +1647,7 @@ public final void checkInterrupts() { | |
setN(getFN()); | ||
setZ(getFZ()); | ||
setC(getFC()); | ||
setB(false); | ||
push(P); | ||
push(P & ~FLAG_B); | ||
setI(true); | ||
PC = memoryRead(0xfffe); | ||
PC |= memoryRead(0xffff) << 8; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* AppleIIGo | ||
* Apple II Emulator for J2ME | ||
* (C) 2006 by Marc S. Ressl([email protected]) | ||
* Copyright 2006 by Marc S. Ressl([email protected]) | ||
* Released under the GPL | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* AppleIIGo | ||
* Apple II Emulator for J2ME | ||
* (C) 2006 by Marc S. Ressl([email protected]) | ||
* Copyright 2006 by Marc S. Ressl([email protected]) | ||
* Released under the GPL | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* AppleIIGo | ||
* Slot interface | ||
* (C) 2006 by Marc S. Ressl([email protected]) | ||
* Copyright 2006 by Marc S. Ressl([email protected]) | ||
* Released under the GPL | ||
* Based on work by Steven E. Hugg | ||
*/ | ||
|