Work In Progress: CPU behavior, UI changes
This is something of a "Work in Progress" checkpoint of several features that are all half baked: 1. Allow loading of 16KB ROM files at address $C000 at run-time, not just at startup. See the "Load ROM..." File menu item. 2. Introduces the notion of "CPU Behaviors", so the core 6502 CPU implementation can match the behavior of either an early NMOS 6502, late NMOS 6502, or CMOS 65C02. Very little of this is actually implemented so far. 3. Adds a completely bogus implementation of the 6522 VIA (it does absolutely nothing right now). 4. Changes the address of the ACIA in the simulated system to match a real hardware implementation I put together.
This commit is contained in:
1 parent
795ccfde5d
commit
2ebdd254b3
33 files changed
+822
-443
No files matched your search
@@ -4,6 +4,8 @@ import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.grahamedgecombe.jterminal.JTerminal;
|
||||
import com.grahamedgecombe.jterminal.vt100.Vt100TerminalModel;
|
||||
@@ -21,15 +23,18 @@ import javax.swing.border.Border;
|
||||
|
||||
public class Console extends JTerminal implements KeyListener, MouseListener {
|
||||
|
||||
private static final int DEFAULT_COLUMNS = 80;
|
||||
private static final int DEFAULT_ROWS = 24;
|
||||
private static final int DEFAULT_BORDER_WIDTH = 10;
|
||||
// If true, swap CR and LF characters
|
||||
private static final boolean SWAP_CR_AND_LF = true;
|
||||
private static final int DEFAULT_COLUMNS = 80;
|
||||
private static final int DEFAULT_ROWS = 24;
|
||||
private static final int DEFAULT_BORDER_WIDTH = 10;
|
||||
// If true, swap CR and LF characters.
|
||||
private static final boolean SWAP_CR_AND_LF = true;
|
||||
// If true, send CRLF (0x0d 0x0a) whenever CR is typed
|
||||
private static final boolean SEND_CR_LF_FOR_CR = false;
|
||||
private static final boolean SEND_CR_LF_FOR_CR = false;
|
||||
|
||||
private FifoRingBuffer typeAheadBuffer;
|
||||
// If true, the console is actively listening for key input.
|
||||
private boolean isListening;
|
||||
|
||||
private FifoRingBuffer<Character> typeAheadBuffer;
|
||||
|
||||
public Console() {
|
||||
this(DEFAULT_COLUMNS, DEFAULT_ROWS);
|
||||
@@ -39,7 +44,8 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
|
||||
super(new Vt100TerminalModel(columns, rows));
|
||||
// A small type-ahead buffer, as might be found in any real
|
||||
// VT100-style serial terminal.
|
||||
this.typeAheadBuffer = new FifoRingBuffer(128);
|
||||
this.typeAheadBuffer = new FifoRingBuffer<Character>(128);
|
||||
this.isListening = false;
|
||||
setBorderWidth(DEFAULT_BORDER_WIDTH);
|
||||
addKeyListener(this);
|
||||
addMouseListener(this);
|
||||
@@ -52,7 +58,6 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
|
||||
/**
|
||||
* Reset the console. This will cause the console to be cleared and the cursor returned to the
|
||||
* home position.
|
||||
*
|
||||
*/
|
||||
public void reset() {
|
||||
typeAheadBuffer.reset();
|
||||
@@ -62,6 +67,14 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void startListening() {
|
||||
this.isListening = true;
|
||||
}
|
||||
|
||||
public void stopListening() {
|
||||
this.isListening = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a key has been pressed since the last time input was read.
|
||||
*
|
||||
@@ -77,22 +90,23 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
|
||||
* @param keyEvent The key event.
|
||||
*/
|
||||
public void keyTyped(KeyEvent keyEvent) {
|
||||
char keyTyped = keyEvent.getKeyChar();
|
||||
if (isListening) {
|
||||
char keyTyped = keyEvent.getKeyChar();
|
||||
|
||||
if (SWAP_CR_AND_LF) {
|
||||
if (keyTyped == 0x0a) {
|
||||
keyTyped = 0x0d;
|
||||
if (SWAP_CR_AND_LF) {
|
||||
if (keyTyped == 0x0a) {
|
||||
keyTyped = 0x0d;
|
||||
} else if (keyTyped == 0x0d) {
|
||||
keyTyped = 0x0a;
|
||||
}
|
||||
}
|
||||
else if (keyTyped == 0x0d) {
|
||||
keyTyped = 0x0a;
|
||||
}
|
||||
}
|
||||
|
||||
if (SEND_CR_LF_FOR_CR && keyTyped == 0x0d) {
|
||||
typeAheadBuffer.push(0x0d);
|
||||
typeAheadBuffer.push(0x0a);
|
||||
} else {
|
||||
typeAheadBuffer.push(keyTyped);
|
||||
if (SEND_CR_LF_FOR_CR && keyTyped == 0x0d) {
|
||||
typeAheadBuffer.push((char) 0x0d);
|
||||
typeAheadBuffer.push((char) 0x0a);
|
||||
} else {
|
||||
typeAheadBuffer.push(keyTyped);
|
||||
}
|
||||
}
|
||||
|
||||
keyEvent.consume();
|
||||
@@ -113,7 +127,7 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
|
||||
* @return The character typed.
|
||||
*/
|
||||
public char readInputChar() throws FifoUnderrunException {
|
||||
return (char)typeAheadBuffer.pop();
|
||||
return typeAheadBuffer.pop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2012 Seth J. Morabito <sethm@loomcom.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.loomcom.symon.ui;
|
||||
|
||||
import com.loomcom.symon.util.FifoRingBuffer;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* This frame displays a trace of CPU execution. The most recent TRACE_LENGTH lines
|
||||
* are captured in a buffer and rendered to the JFrame's main text area upon request.
|
||||
*/
|
||||
public class TraceLog extends JFrame {
|
||||
|
||||
private FifoRingBuffer<String> traceLog;
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user