Skip to content

Commit fa514c7

Browse files
committed
Squashed commit of the following:
commit e3249a2 Author: DylanSpeiser <[email protected]> Date: Tue Feb 27 16:18:32 2024 +1100 Update README.md commit 85717d3 Author: DylanSpeiser <[email protected]> Date: Tue Feb 27 12:33:05 2024 +1100 v2.10 DRAFT Hey! Love your work on this. I'm ready to merge this into main but I can't seem to get Wozmon working with the serial window. Would you be able to show your process? commit 1375dca Author: ly <[email protected]> Date: Fri Feb 9 18:29:25 2024 -0500 Create SerialInterface.java commit 2aa0803 Author: ly <[email protected]> Date: Fri Feb 9 18:29:09 2024 -0500 Update ACIA.java -serial interface commit a850afc Author: ly <[email protected]> Date: Fri Feb 9 18:28:55 2024 -0500 Update CPU.java -serial interface commit 38d65ab Author: ly <[email protected]> Date: Fri Feb 9 18:28:30 2024 -0500 Update VIA.java -fixed interupt functions commit a56b472 Author: ly <[email protected]> Date: Fri Feb 9 18:27:55 2024 -0500 Update DisplayPanel.java -serial interface -realistic keyboard commit 712f21f Author: ly <[email protected]> Date: Fri Feb 9 18:26:43 2024 -0500 Update EaterEmulator.java -reset button -show serial button -serial interface -realistic keyboard option -windowWidth & windowHeight options
1 parent 330a4a3 commit fa514c7

File tree

11 files changed

+498
-58
lines changed

11 files changed

+498
-58
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Java 6502 Emulator
22

3+
## Update: v2.10: Realistic Keyboard, Serial Emulation, and more command line args!
4+
What an update! Thanks to lythd, the emulator now supports a realistic PS/2-like keyboard mode that can be enabled in the options pane. They've also added a serial emulator that can be turned on in a separate window. It's super cool!
5+
6+
Note that Wozmon is not running correctly through this serial interface yet, but we are working on the issue and will update when it's fixed.
7+
8+
We've also added some new command line arguments:
9+
- `-windowWidth <int>` and `windowHeight <int>` do what they say on the tin, and should be a welcome change for those of you with differently sized monitors.
10+
- `-f <path to ROM file>` will pre-load the ROM with the file specified. I finally got around to adding this one, and I hope you find it useful.
11+
12+
I'd also like to take this opportunity to note that this repo is showing its age. The code is an absolute mess since I wrote it back in high school, and I'd like to take some time to completely rewrite it from the ground up using actual OOP instead of the mess of magic numbers and duplicated function calls that builds the Swing UI.<br>
13+
It will be a big undertaking, but seeing how popular this repo is getting I'm sure everyone would appreciate it.
14+
15+
(still) Coming soon!:
16+
- More bug fixes, Wozmon
17+
- Complete code refactor
18+
- Other 65C02 instructions
19+
320
## Update: v2.9: ACIA and Command line options!
421
Thanks to Steve Rubin, the emulator now supports ACIA communication through the command line! Like the VIA, the ACIA's address can be adjusted in the options menu.
522

src/ACIA.java

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,9 @@ public byte read(short address) {
3333

3434
switch (Short.toUnsignedInt(address) - Bus.ACIA_ADDRESS) {
3535
case 0x00:
36-
try {
37-
DATA = (byte) System.in.read();
38-
if (DATA == 0xa) DATA = 0xd; //convert \n to \r
39-
40-
} catch (Exception e) {
41-
System.err.println("Error reading from System.in");
42-
}
43-
return DATA; // Read Receiver Data Register
36+
return EaterEmulator.serial.getKey(); // get serial key
4437
case 0x01:
45-
try {
46-
if (System.in.available() >= 1) { // TODO: Remove this later when we go to a windowed interface
47-
STATUS = 1 << 3;
48-
} else {
49-
STATUS = 0 << 3;
50-
}
51-
} catch (Exception e) {
52-
System.err.println("Error reading from System.in");
53-
}
38+
STATUS = (byte) (EaterEmulator.serial.hasKey() ? 0x08 : 0x00);
5439
return STATUS; // Read Status Register
5540
case 0x02:
5641
return COMMAND; // Read Command Register
@@ -67,12 +52,15 @@ public byte read(short address) {
6752
public void write(short address, byte data) {
6853
switch (Short.toUnsignedInt(address) - Bus.ACIA_ADDRESS) {
6954
case 0x00:
70-
System.out.printf("%c", data); // Write Transmitter Data Register
71-
if (data == 0xd) System.out.printf("\n"); // convert \r to \n
55+
if (data != 0xd) EaterEmulator.serial.receiveKey(data); // discard \r so its just \n, send to serial interface
7256

7357
case 0x01: // Programmed Reset
7458
// Clear bits 4 through 0 in the Command Register and bit 2 in the Status
7559
// Register
60+
//COMMAND &= 0b11100000;
61+
//STATUS &= 0b11111011; //i dont remember this but just doing what was written
62+
//EaterEmulator.serial.reset();
63+
//okay this is triggering in some random places and im kinda confused why so ill just leave it empty like how it was before
7664
case 0x02:
7765
COMMAND = data;
7866
break; // Write Command Register
@@ -85,4 +73,4 @@ public void write(short address, byte data) {
8573
}
8674
}
8775

88-
}
76+
}

src/Bus.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public static byte read(short address) {
88
} else if (Short.toUnsignedInt(address) <= VIA_ADDRESS+16 && Short.toUnsignedInt(address) >= VIA_ADDRESS) {
99
return EaterEmulator.via.read(address);
1010
} else if (Short.toUnsignedInt(address) <= ACIA_ADDRESS+3 && Short.toUnsignedInt(address) >= ACIA_ADDRESS) {
11+
if (EaterEmulator.verbose) System.out.println("Read from address "+Integer.toHexString(Short.toUnsignedInt(address)));
1112
return EaterEmulator.acia.read(address);
1213
} else {
1314
return EaterEmulator.ram.read(address);
@@ -21,9 +22,10 @@ public static void write(short address, byte data) {
2122
EaterEmulator.via.write(address, data);
2223
} else if (Short.toUnsignedInt(address) <= ACIA_ADDRESS+3 && Short.toUnsignedInt(address) >= ACIA_ADDRESS) {
2324
EaterEmulator.acia.write(address, data);
25+
if (EaterEmulator.verbose) System.out.println("Wrote "+ROMLoader.byteToHexString(data)+" at "+Integer.toHexString(Short.toUnsignedInt(address)));
2426
} else {
2527
EaterEmulator.ram.write(address, data);
2628
}
27-
//if (EaterEmulator.verbose) System.out.println("Wrote "+data+" at "+address);
29+
2830
}
2931
}

src/CPU.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,9 @@ void executeOpcodeFunction(String opcode) {
624624

625625
//Input Signal Handlers
626626
void reset() {
627+
EaterEmulator.clockState = false;
628+
if (EaterEmulator.serial != null) EaterEmulator.serial.reset();
629+
627630
a = 0;
628631
x = 0;
629632
y = 0;

0 commit comments

Comments
 (0)