Better linting, tests, fix text buffer, ROR.

This commit is contained in:
Will Scullin
2019-10-16 20:18:53 -07:00
parent e2c615f20b
commit 37a6efc661
10 changed files with 72 additions and 37 deletions

View File

@@ -636,7 +636,7 @@ export default function CPU6502(options)
function ror(readAddrFn) {
var addr = readAddrFn({rwm: true});
var oldVal = readByte(addr);
writeByte(addr, val);
writeByte(addr, oldVal);
var val = rotateRight(oldVal);
writeByte(addr, val);
}

View File

@@ -286,7 +286,7 @@ export function explodeSector13(volume, track, sector, data) {
}
export function readSector(drive, track, sector) {
var _sector = cur.fmt == 'po' ? _PO[sector] : _DO[sector];
var _sector = drive.fmt == 'po' ? _PO[sector] : _DO[sector];
var val, state = 0;
var idx = 0;
var retry = 0;

View File

@@ -54,6 +54,9 @@ var disk_sets = {};
var disk_cur_name = [];
var disk_cur_cat = [];
var tape;
var disk2;
var driveLights;
var _currentDrive = 1;
export function openLoad(drive, event)
@@ -252,7 +255,9 @@ function doLoadHTTP(drive, _url) {
var name = decodeURIComponent(fileParts.join('.'));
if (disk2.setBinary(drive, name, ext, req.response)) {
driveLights.label(drive, name);
MicroModal.close('http-modal');
if (!_url) {
MicroModal.close('http-modal');
}
initGamepad();
}
};
@@ -338,18 +343,18 @@ var vm = new VideoModes(gr, hgr, gr2, hgr2, false);
vm.multiScreen(multiScreen);
var dumper = new ApplesoftDump(cpu);
var driveLights = new DriveLights();
var io = new Apple2IO(cpu, vm);
driveLights = new DriveLights();
export var io = new Apple2IO(cpu, vm);
var keyboard = new KeyBoard(cpu, io);
var audio = new Audio(io);
var tape = new Tape(io);
tape = new Tape(io);
var printer = new Printer('#printer-modal .paper');
var lc = new LanguageCard(io, 0, rom);
var parallel = new Parallel(io, 1, printer);
var slinky = new RAMFactor(io, 2, 1024 * 1024);
var videoterm = new Videoterm(io, 3, context1);
var disk2 = new DiskII(io, 6, driveLights);
disk2 = new DiskII(io, 6, driveLights);
var clock = new Thunderclock(io, 7);
cpu.addPageHandler(ram1);
@@ -538,6 +543,11 @@ function stop() {
runTimer = null;
}
export function reset()
{
cpu.reset();
}
var state = null;
function storeStateLocal() {
@@ -910,8 +920,12 @@ document.addEventListener('DOMContentLoaded', function() {
document.body.addEventListener('mousemove', _mousemove);
document.querySelectorAll('input,textarea').forEach(function(input) {
input.addEventListener('input', function() { focused = true; });
input.addEventListener('blur', function() { focused = false; });
input.addEventListener('focus', function() {
focused = true;
});
input.addEventListener('blur', function() {
focused = false;
});
});
keyboard.create('#keyboard');
@@ -995,7 +1009,7 @@ document.addEventListener('DOMContentLoaded', function() {
reptKey.addEventListener('click', function() {
document.querySelector('#keyboard').style.display = 'none';
document.querySelector('#textarea').style.display = 'block';
document.querySelector.focus();
document.querySelector('#textarea').focus();
});
document.querySelector('#text_input').addEventListener('keydown', function() {
focused = document.querySelector('#buffering').checked;

View File

@@ -39,7 +39,7 @@ var paused = false;
var hashtag;
var DEBUG = false;
var DEBUG = true;
var TRACE = false;
var MAX_TRACE = 256;
var trace = [];
@@ -49,8 +49,20 @@ var disk_sets = {};
var disk_cur_name = [];
var disk_cur_cat = [];
var tape;
var disk2;
var driveLights;
var _currentDrive = 1;
export function setTrace(debug, trace) {
DEBUG = debug;
TRACE = trace;
}
export function getTrace() {
return trace;
}
export function openLoad(drive, event)
{
_currentDrive = parseInt(drive, 10);
@@ -241,6 +253,9 @@ function doLoadHTTP(drive, _url) {
req.responseType = 'arraybuffer';
req.onload = function() {
if (req.status !== 200) {
return window.alert('Unable to load "' + url + '"');
}
var urlParts = url.split('/');
var file = urlParts.pop();
var fileParts = file.split('.');
@@ -248,7 +263,9 @@ function doLoadHTTP(drive, _url) {
var name = decodeURIComponent(fileParts.join('.'));
if (disk2.setBinary(drive, name, ext, req.response)) {
driveLights.label(drive, name);
MicroModal.close('http-modal');
if (!_url) {
MicroModal.close('http-modal');
}
initGamepad();
}
};
@@ -323,11 +340,11 @@ vm.enhanced(enhanced);
vm.multiScreen(multiScreen);
var dumper = new ApplesoftDump(cpu);
var driveLights = new DriveLights();
driveLights = new DriveLights();
var io = new Apple2IO(cpu, vm);
var keyboard = new KeyBoard(cpu, io, true);
var audio = new Audio(io);
var tape = new Tape(io);
tape = new Tape(io);
var printer = new Printer('#printer-modal .paper');
var mmu = new MMU(cpu, vm, gr, gr2, hgr, hgr2, io, rom);
@@ -336,7 +353,7 @@ cpu.addPageHandler(mmu);
var parallel = new Parallel(io, 1, printer);
var slinky = new RAMFactor(io, 2, 1024 * 1024);
var disk2 = new DiskII(io, 6, driveLights);
disk2 = new DiskII(io, 6, driveLights);
var clock = new Thunderclock(io, 7);
io.setSlot(1, parallel);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff