enforce indent case like vscode prefers
This commit is contained in:
parent
1e58e2c1b8
commit
1aaa94a8ed
|
@ -4,7 +4,10 @@
|
|||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
4
|
||||
4,
|
||||
{
|
||||
"SwitchCase": 1
|
||||
}
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
|
|
370
js/apple2io.ts
370
js/apple2io.ts
|
@ -141,148 +141,148 @@ export default class Apple2IO implements PageHandler {
|
|||
const now = this.cpu.getCycles();
|
||||
const delta = now - this._trigger;
|
||||
switch (off) {
|
||||
case LOC.CLRTEXT:
|
||||
this._debug('Graphics Mode');
|
||||
this.vm.text(false);
|
||||
break;
|
||||
case LOC.SETTEXT:
|
||||
this._debug('Text Mode');
|
||||
this.vm.text(true);
|
||||
break;
|
||||
case LOC.CLRMIXED:
|
||||
this._debug('Mixed Mode off');
|
||||
this.vm.mixed(false);
|
||||
break;
|
||||
case LOC.SETMIXED:
|
||||
this._debug('Mixed Mode on');
|
||||
this.vm.mixed(true);
|
||||
break;
|
||||
case LOC.CLRHIRES:
|
||||
this._debug('LoRes Mode');
|
||||
this.vm.hires(false);
|
||||
break;
|
||||
case LOC.SETHIRES:
|
||||
this._debug('HiRes Mode');
|
||||
this.vm.hires(true);
|
||||
break;
|
||||
case LOC.PAGE1:
|
||||
this.vm.page(1);
|
||||
break;
|
||||
case LOC.PAGE2:
|
||||
this.vm.page(2);
|
||||
break;
|
||||
case LOC.SETAN0:
|
||||
this._debug('Annunciator 0 on');
|
||||
this._annunciators[0] = true;
|
||||
break;
|
||||
case LOC.SETAN1:
|
||||
this._debug('Annunciator 1 on');
|
||||
this._annunciators[1] = true;
|
||||
break;
|
||||
case LOC.SETAN2:
|
||||
this._debug('Annunciator 2 on');
|
||||
this._annunciators[2] = true;
|
||||
break;
|
||||
case LOC.SETAN3:
|
||||
this._debug('Annunciator 3 on');
|
||||
this._annunciators[3] = true;
|
||||
break;
|
||||
case LOC.CLRAN0:
|
||||
this._debug('Annunciator 0 off');
|
||||
this._annunciators[0] = false;
|
||||
break;
|
||||
case LOC.CLRAN1:
|
||||
this._debug('Annunciator 1 off');
|
||||
this._annunciators[1] = false;
|
||||
break;
|
||||
case LOC.CLRAN2:
|
||||
this._debug('Annunciator 2 off');
|
||||
this._annunciators[2] = false;
|
||||
break;
|
||||
case LOC.CLRAN3:
|
||||
this._debug('Annunciator 3 off');
|
||||
this._annunciators[3] = false;
|
||||
break;
|
||||
case LOC.PB0:
|
||||
result = this._button[0] ? 0x80 : 0;
|
||||
break;
|
||||
case LOC.PB1:
|
||||
result = this._button[1] ? 0x80 : 0;
|
||||
break;
|
||||
case LOC.PB2:
|
||||
result = this._button[2] ? 0x80 : 0;
|
||||
break;
|
||||
case LOC.PADDLE0:
|
||||
result = (delta < (this._paddle[0] * 2756) ? 0x80 : 0x00);
|
||||
break;
|
||||
case LOC.PADDLE1:
|
||||
result = (delta < (this._paddle[1] * 2756) ? 0x80 : 0x00);
|
||||
break;
|
||||
case LOC.PADDLE2:
|
||||
result = (delta < (this._paddle[2] * 2756) ? 0x80 : 0x00);
|
||||
break;
|
||||
case LOC.PADDLE3:
|
||||
result = (delta < (this._paddle[3] * 2756) ? 0x80 : 0x00);
|
||||
break;
|
||||
case LOC.ACCEL:
|
||||
if (val !== undefined) {
|
||||
this._updateKHz(val & 0x01 ? 1023 : 4096);
|
||||
}
|
||||
break;
|
||||
case LOC.TAPEIN:
|
||||
if (this._tapeOffset == -1) {
|
||||
this._tapeOffset = 0;
|
||||
this._tapeNext = now;
|
||||
}
|
||||
case LOC.CLRTEXT:
|
||||
this._debug('Graphics Mode');
|
||||
this.vm.text(false);
|
||||
break;
|
||||
case LOC.SETTEXT:
|
||||
this._debug('Text Mode');
|
||||
this.vm.text(true);
|
||||
break;
|
||||
case LOC.CLRMIXED:
|
||||
this._debug('Mixed Mode off');
|
||||
this.vm.mixed(false);
|
||||
break;
|
||||
case LOC.SETMIXED:
|
||||
this._debug('Mixed Mode on');
|
||||
this.vm.mixed(true);
|
||||
break;
|
||||
case LOC.CLRHIRES:
|
||||
this._debug('LoRes Mode');
|
||||
this.vm.hires(false);
|
||||
break;
|
||||
case LOC.SETHIRES:
|
||||
this._debug('HiRes Mode');
|
||||
this.vm.hires(true);
|
||||
break;
|
||||
case LOC.PAGE1:
|
||||
this.vm.page(1);
|
||||
break;
|
||||
case LOC.PAGE2:
|
||||
this.vm.page(2);
|
||||
break;
|
||||
case LOC.SETAN0:
|
||||
this._debug('Annunciator 0 on');
|
||||
this._annunciators[0] = true;
|
||||
break;
|
||||
case LOC.SETAN1:
|
||||
this._debug('Annunciator 1 on');
|
||||
this._annunciators[1] = true;
|
||||
break;
|
||||
case LOC.SETAN2:
|
||||
this._debug('Annunciator 2 on');
|
||||
this._annunciators[2] = true;
|
||||
break;
|
||||
case LOC.SETAN3:
|
||||
this._debug('Annunciator 3 on');
|
||||
this._annunciators[3] = true;
|
||||
break;
|
||||
case LOC.CLRAN0:
|
||||
this._debug('Annunciator 0 off');
|
||||
this._annunciators[0] = false;
|
||||
break;
|
||||
case LOC.CLRAN1:
|
||||
this._debug('Annunciator 1 off');
|
||||
this._annunciators[1] = false;
|
||||
break;
|
||||
case LOC.CLRAN2:
|
||||
this._debug('Annunciator 2 off');
|
||||
this._annunciators[2] = false;
|
||||
break;
|
||||
case LOC.CLRAN3:
|
||||
this._debug('Annunciator 3 off');
|
||||
this._annunciators[3] = false;
|
||||
break;
|
||||
case LOC.PB0:
|
||||
result = this._button[0] ? 0x80 : 0;
|
||||
break;
|
||||
case LOC.PB1:
|
||||
result = this._button[1] ? 0x80 : 0;
|
||||
break;
|
||||
case LOC.PB2:
|
||||
result = this._button[2] ? 0x80 : 0;
|
||||
break;
|
||||
case LOC.PADDLE0:
|
||||
result = (delta < (this._paddle[0] * 2756) ? 0x80 : 0x00);
|
||||
break;
|
||||
case LOC.PADDLE1:
|
||||
result = (delta < (this._paddle[1] * 2756) ? 0x80 : 0x00);
|
||||
break;
|
||||
case LOC.PADDLE2:
|
||||
result = (delta < (this._paddle[2] * 2756) ? 0x80 : 0x00);
|
||||
break;
|
||||
case LOC.PADDLE3:
|
||||
result = (delta < (this._paddle[3] * 2756) ? 0x80 : 0x00);
|
||||
break;
|
||||
case LOC.ACCEL:
|
||||
if (val !== undefined) {
|
||||
this._updateKHz(val & 0x01 ? 1023 : 4096);
|
||||
}
|
||||
break;
|
||||
case LOC.TAPEIN:
|
||||
if (this._tapeOffset == -1) {
|
||||
this._tapeOffset = 0;
|
||||
this._tapeNext = now;
|
||||
}
|
||||
|
||||
if (this._tapeOffset < this._tape.length) {
|
||||
this._tapeCurrent = this._tape[this._tapeOffset][1];
|
||||
while (now >= this._tapeNext) {
|
||||
if ((this._tapeOffset % 1000) === 0) {
|
||||
debug('Read ' + (this._tapeOffset / 1000));
|
||||
}
|
||||
if (this._tapeOffset < this._tape.length) {
|
||||
this._tapeCurrent = this._tape[this._tapeOffset][1];
|
||||
this._tapeNext += this._tape[this._tapeOffset++][0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
result = this._tapeCurrent ? 0x80 : 0x00;
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (off & 0xf0) {
|
||||
case LOC.KEYBOARD: // C00x
|
||||
result = this._key;
|
||||
break;
|
||||
case LOC.STROBE: // C01x
|
||||
this._key &= 0x7f;
|
||||
if (this._buffer.length > 0) {
|
||||
let val = this._buffer.shift() as string;
|
||||
if (val == '\n') {
|
||||
val = '\r';
|
||||
while (now >= this._tapeNext) {
|
||||
if ((this._tapeOffset % 1000) === 0) {
|
||||
debug('Read ' + (this._tapeOffset / 1000));
|
||||
}
|
||||
this._tapeCurrent = this._tape[this._tapeOffset][1];
|
||||
this._tapeNext += this._tape[this._tapeOffset++][0];
|
||||
}
|
||||
this._key = val.charCodeAt(0) | 0x80;
|
||||
|
||||
}
|
||||
result = (this._keyDown ? 0x80 : 0x00) | this._key;
|
||||
|
||||
result = this._tapeCurrent ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.TAPEOUT: // C02x
|
||||
this._phase = -this._phase;
|
||||
this._didAudio = true;
|
||||
this._tick();
|
||||
break;
|
||||
case LOC.SPEAKER: // C03x
|
||||
this._phase = -this._phase;
|
||||
this._didAudio = true;
|
||||
this._tick();
|
||||
break;
|
||||
case LOC.C040STB: // C04x
|
||||
// I/O Strobe
|
||||
break;
|
||||
case LOC.PDLTRIG: // C07x
|
||||
this._trigger = this.cpu.getCycles();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
switch (off & 0xf0) {
|
||||
case LOC.KEYBOARD: // C00x
|
||||
result = this._key;
|
||||
break;
|
||||
case LOC.STROBE: // C01x
|
||||
this._key &= 0x7f;
|
||||
if (this._buffer.length > 0) {
|
||||
let val = this._buffer.shift() as string;
|
||||
if (val == '\n') {
|
||||
val = '\r';
|
||||
}
|
||||
this._key = val.charCodeAt(0) | 0x80;
|
||||
}
|
||||
result = (this._keyDown ? 0x80 : 0x00) | this._key;
|
||||
break;
|
||||
case LOC.TAPEOUT: // C02x
|
||||
this._phase = -this._phase;
|
||||
this._didAudio = true;
|
||||
this._tick();
|
||||
break;
|
||||
case LOC.SPEAKER: // C03x
|
||||
this._phase = -this._phase;
|
||||
this._didAudio = true;
|
||||
this._tick();
|
||||
break;
|
||||
case LOC.C040STB: // C04x
|
||||
// I/O Strobe
|
||||
break;
|
||||
case LOC.PDLTRIG: // C07x
|
||||
this._trigger = this.cpu.getCycles();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (val !== undefined) {
|
||||
|
@ -339,31 +339,31 @@ export default class Apple2IO implements PageHandler {
|
|||
let card;
|
||||
|
||||
switch (page) {
|
||||
case 0xc0:
|
||||
result = this.ioSwitch(off, undefined);
|
||||
break;
|
||||
case 0xc1:
|
||||
case 0xc2:
|
||||
case 0xc3:
|
||||
case 0xc4:
|
||||
case 0xc5:
|
||||
case 0xc6:
|
||||
case 0xc7:
|
||||
slot = page & 0x0f;
|
||||
card = this._slot[slot];
|
||||
if (this._auxRom != card) {
|
||||
case 0xc0:
|
||||
result = this.ioSwitch(off, undefined);
|
||||
break;
|
||||
case 0xc1:
|
||||
case 0xc2:
|
||||
case 0xc3:
|
||||
case 0xc4:
|
||||
case 0xc5:
|
||||
case 0xc6:
|
||||
case 0xc7:
|
||||
slot = page & 0x0f;
|
||||
card = this._slot[slot];
|
||||
if (this._auxRom != card) {
|
||||
// _debug('Setting auxRom to slot', slot);
|
||||
this._auxRom = card;
|
||||
}
|
||||
if (card) {
|
||||
result = card.read(page, off);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (this._auxRom) {
|
||||
result = this._auxRom.read(page, off);
|
||||
}
|
||||
break;
|
||||
this._auxRom = card;
|
||||
}
|
||||
if (card) {
|
||||
result = card.read(page, off);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (this._auxRom) {
|
||||
result = this._auxRom.read(page, off);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -373,31 +373,31 @@ export default class Apple2IO implements PageHandler {
|
|||
let card;
|
||||
|
||||
switch (page) {
|
||||
case 0xc0:
|
||||
this.ioSwitch(off, val);
|
||||
break;
|
||||
case 0xc1:
|
||||
case 0xc2:
|
||||
case 0xc3:
|
||||
case 0xc4:
|
||||
case 0xc5:
|
||||
case 0xc6:
|
||||
case 0xc7:
|
||||
slot = page & 0x0f;
|
||||
card = this._slot[slot];
|
||||
if (this._auxRom != card) {
|
||||
case 0xc0:
|
||||
this.ioSwitch(off, val);
|
||||
break;
|
||||
case 0xc1:
|
||||
case 0xc2:
|
||||
case 0xc3:
|
||||
case 0xc4:
|
||||
case 0xc5:
|
||||
case 0xc6:
|
||||
case 0xc7:
|
||||
slot = page & 0x0f;
|
||||
card = this._slot[slot];
|
||||
if (this._auxRom != card) {
|
||||
// _debug('Setting auxRom to slot', slot);
|
||||
this._auxRom = card;
|
||||
}
|
||||
if (card) {
|
||||
card.write(page, off, val);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (this._auxRom) {
|
||||
this._auxRom.write(page, off, val);
|
||||
}
|
||||
break;
|
||||
this._auxRom = card;
|
||||
}
|
||||
if (card) {
|
||||
card.write(page, off, val);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (this._auxRom) {
|
||||
this._auxRom.write(page, off, val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -167,76 +167,76 @@ export default function ApplesoftCompiler(mem)
|
|||
while (curChar < line.length) {
|
||||
character = line.charAt(curChar).toUpperCase();
|
||||
switch (state) {
|
||||
case STATES.NORMAL:
|
||||
if (character !== ' ') {
|
||||
if (character === '"') {
|
||||
result.push(character.charCodeAt(0));
|
||||
state = STATES.STRING;
|
||||
curChar++;
|
||||
} else {
|
||||
var foundToken = '';
|
||||
for (var possibleToken in TOKENS) {
|
||||
if (possibleToken.charAt(0) == character) {
|
||||
var tokenIdx = curChar + 1;
|
||||
var idx = 1;
|
||||
while (idx < possibleToken.length) {
|
||||
if (line.charAt(tokenIdx) !== ' ') {
|
||||
if (line.charAt(tokenIdx).toUpperCase() !== possibleToken.charAt(idx)) {
|
||||
break;
|
||||
case STATES.NORMAL:
|
||||
if (character !== ' ') {
|
||||
if (character === '"') {
|
||||
result.push(character.charCodeAt(0));
|
||||
state = STATES.STRING;
|
||||
curChar++;
|
||||
} else {
|
||||
var foundToken = '';
|
||||
for (var possibleToken in TOKENS) {
|
||||
if (possibleToken.charAt(0) == character) {
|
||||
var tokenIdx = curChar + 1;
|
||||
var idx = 1;
|
||||
while (idx < possibleToken.length) {
|
||||
if (line.charAt(tokenIdx) !== ' ') {
|
||||
if (line.charAt(tokenIdx).toUpperCase() !== possibleToken.charAt(idx)) {
|
||||
break;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
idx++;
|
||||
tokenIdx++;
|
||||
}
|
||||
tokenIdx++;
|
||||
}
|
||||
if (idx === possibleToken.length) {
|
||||
if (idx === possibleToken.length) {
|
||||
// Found a token
|
||||
if (possibleToken === 'AT') {
|
||||
var lookAhead = line.charAt(tokenIdx + 1).toUpperCase();
|
||||
// ATN takes precedence over AT
|
||||
if (lookAhead === 'N') {
|
||||
foundToken = 'ATN';
|
||||
tokenIdx++;
|
||||
}
|
||||
// TO takes precedence over AT
|
||||
if (lookAhead === 'O') {
|
||||
result.push(lookAhead.charCodeAt(0));
|
||||
foundToken = 'TO';
|
||||
tokenIdx++;
|
||||
if (possibleToken === 'AT') {
|
||||
var lookAhead = line.charAt(tokenIdx + 1).toUpperCase();
|
||||
// ATN takes precedence over AT
|
||||
if (lookAhead === 'N') {
|
||||
foundToken = 'ATN';
|
||||
tokenIdx++;
|
||||
}
|
||||
// TO takes precedence over AT
|
||||
if (lookAhead === 'O') {
|
||||
result.push(lookAhead.charCodeAt(0));
|
||||
foundToken = 'TO';
|
||||
tokenIdx++;
|
||||
}
|
||||
}
|
||||
foundToken = possibleToken;
|
||||
}
|
||||
foundToken = possibleToken;
|
||||
}
|
||||
if (foundToken) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundToken) {
|
||||
break;
|
||||
result.push(TOKENS[foundToken]);
|
||||
curChar = tokenIdx;
|
||||
if (foundToken === 'REM') {
|
||||
state = STATES.COMMENT;
|
||||
}
|
||||
} else {
|
||||
result.push(character.charCodeAt(0));
|
||||
curChar++;
|
||||
}
|
||||
}
|
||||
if (foundToken) {
|
||||
result.push(TOKENS[foundToken]);
|
||||
curChar = tokenIdx;
|
||||
if (foundToken === 'REM') {
|
||||
state = STATES.COMMENT;
|
||||
}
|
||||
} else {
|
||||
result.push(character.charCodeAt(0));
|
||||
curChar++;
|
||||
}
|
||||
} else {
|
||||
curChar++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
case STATES.COMMENT:
|
||||
result.push(character.charCodeAt(0));
|
||||
curChar++;
|
||||
}
|
||||
break;
|
||||
case STATES.COMMENT:
|
||||
result.push(character.charCodeAt(0));
|
||||
curChar++;
|
||||
break;
|
||||
case STATES.STRING:
|
||||
result.push(character.charCodeAt(0));
|
||||
if (character == '"') {
|
||||
state = STATES.NORMAL;
|
||||
}
|
||||
curChar++;
|
||||
break;
|
||||
break;
|
||||
case STATES.STRING:
|
||||
result.push(character.charCodeAt(0));
|
||||
if (character == '"') {
|
||||
state = STATES.NORMAL;
|
||||
}
|
||||
curChar++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
12
js/base64.ts
12
js/base64.ts
|
@ -50,12 +50,12 @@ export function base64_encode(data: memory) {
|
|||
enc = tmp_arr.join('');
|
||||
|
||||
switch (data.length % 3) {
|
||||
case 1:
|
||||
enc = enc.slice(0, -2) + '==';
|
||||
break;
|
||||
case 2:
|
||||
enc = enc.slice(0, -1) + '=';
|
||||
break;
|
||||
case 1:
|
||||
enc = enc.slice(0, -2) + '==';
|
||||
break;
|
||||
case 2:
|
||||
enc = enc.slice(0, -1) + '=';
|
||||
break;
|
||||
}
|
||||
|
||||
return enc;
|
||||
|
|
250
js/cards/cffa.js
250
js/cards/cffa.js
|
@ -209,55 +209,55 @@ export default function CFFA() {
|
|||
|
||||
if (readMode) {
|
||||
switch (off & 0x8f) {
|
||||
case LOC.ATADataHigh: // 0x00
|
||||
retVal = _dataHigh;
|
||||
break;
|
||||
case LOC.SetCSMask: // 0x01
|
||||
_disableSignalling = true;
|
||||
break;
|
||||
case LOC.ClearCSMask: // 0x02
|
||||
_disableSignalling = false;
|
||||
break;
|
||||
case LOC.WriteEEPROM: // 0x03
|
||||
_writeEEPROM = true;
|
||||
break;
|
||||
case LOC.NoWriteEEPROM: // 0x04
|
||||
_writeEEPROM = false;
|
||||
break;
|
||||
case LOC.ATAAltStatus: // 0x06
|
||||
retVal = _altStatus;
|
||||
break;
|
||||
case LOC.ATADataLow: // 0x08
|
||||
_dataHigh = _curSector[_curWord] >> 8;
|
||||
retVal = _curSector[_curWord] & 0xff;
|
||||
if (!_disableSignalling) {
|
||||
_curWord++;
|
||||
}
|
||||
break;
|
||||
case LOC.AError: // 0x09
|
||||
retVal = _error;
|
||||
break;
|
||||
case LOC.ASectorCnt: // 0x0A
|
||||
retVal = _sectorCnt;
|
||||
break;
|
||||
case LOC.ASector: // 0x0B
|
||||
retVal = _sector;
|
||||
break;
|
||||
case LOC.ATACylinder: // 0x0C
|
||||
retVal = _cylinder;
|
||||
break;
|
||||
case LOC.ATACylinderH: // 0x0D
|
||||
retVal = _cylinderH;
|
||||
break;
|
||||
case LOC.ATAHead: // 0x0E
|
||||
retVal = _head | (_lba ? 0x40 : 0) | (_drive ? 0x10 : 0) | 0xA0;
|
||||
break;
|
||||
case LOC.ATAStatus: // 0x0F
|
||||
retVal = _sectors[_drive].length > 0 ? STATUS.DRDY | STATUS.DSC : 0;
|
||||
_debug('returning status', _statusString(retVal));
|
||||
break;
|
||||
default:
|
||||
debug('read unknown soft switch', toHex(off));
|
||||
case LOC.ATADataHigh: // 0x00
|
||||
retVal = _dataHigh;
|
||||
break;
|
||||
case LOC.SetCSMask: // 0x01
|
||||
_disableSignalling = true;
|
||||
break;
|
||||
case LOC.ClearCSMask: // 0x02
|
||||
_disableSignalling = false;
|
||||
break;
|
||||
case LOC.WriteEEPROM: // 0x03
|
||||
_writeEEPROM = true;
|
||||
break;
|
||||
case LOC.NoWriteEEPROM: // 0x04
|
||||
_writeEEPROM = false;
|
||||
break;
|
||||
case LOC.ATAAltStatus: // 0x06
|
||||
retVal = _altStatus;
|
||||
break;
|
||||
case LOC.ATADataLow: // 0x08
|
||||
_dataHigh = _curSector[_curWord] >> 8;
|
||||
retVal = _curSector[_curWord] & 0xff;
|
||||
if (!_disableSignalling) {
|
||||
_curWord++;
|
||||
}
|
||||
break;
|
||||
case LOC.AError: // 0x09
|
||||
retVal = _error;
|
||||
break;
|
||||
case LOC.ASectorCnt: // 0x0A
|
||||
retVal = _sectorCnt;
|
||||
break;
|
||||
case LOC.ASector: // 0x0B
|
||||
retVal = _sector;
|
||||
break;
|
||||
case LOC.ATACylinder: // 0x0C
|
||||
retVal = _cylinder;
|
||||
break;
|
||||
case LOC.ATACylinderH: // 0x0D
|
||||
retVal = _cylinderH;
|
||||
break;
|
||||
case LOC.ATAHead: // 0x0E
|
||||
retVal = _head | (_lba ? 0x40 : 0) | (_drive ? 0x10 : 0) | 0xA0;
|
||||
break;
|
||||
case LOC.ATAStatus: // 0x0F
|
||||
retVal = _sectors[_drive].length > 0 ? STATUS.DRDY | STATUS.DSC : 0;
|
||||
_debug('returning status', _statusString(retVal));
|
||||
break;
|
||||
default:
|
||||
debug('read unknown soft switch', toHex(off));
|
||||
}
|
||||
|
||||
if (off & 0x7) { // Anything but data high/low
|
||||
|
@ -269,85 +269,85 @@ export default function CFFA() {
|
|||
}
|
||||
|
||||
switch (off & 0x8f) {
|
||||
case LOC.ATADataHigh: // 0x00
|
||||
_dataHigh = val;
|
||||
break;
|
||||
case LOC.SetCSMask: // 0x01
|
||||
_disableSignalling = true;
|
||||
break;
|
||||
case LOC.ClearCSMask: // 0x02
|
||||
_disableSignalling = false;
|
||||
break;
|
||||
case LOC.WriteEEPROM: // 0x03
|
||||
_writeEEPROM = true;
|
||||
break;
|
||||
case LOC.NoWriteEEPROM: // 0x04
|
||||
_writeEEPROM = false;
|
||||
break;
|
||||
case LOC.ATADevCtrl: // 0x06
|
||||
_debug('devCtrl:', toHex(val));
|
||||
_interruptsEnabled = (val & 0x04) ? true : false;
|
||||
_debug('Interrupts', _interruptsEnabled ? 'enabled' : 'disabled');
|
||||
if (val & 0x02) {
|
||||
_reset();
|
||||
}
|
||||
break;
|
||||
case LOC.ATADataLow: // 0x08
|
||||
_curSector[_curWord] = _dataHigh << 8 | val;
|
||||
_curWord++;
|
||||
break;
|
||||
case LOC.ASectorCnt: // 0x0a
|
||||
_debug('setting sector count', val);
|
||||
_sectorCnt = val;
|
||||
break;
|
||||
case LOC.ASector: // 0x0b
|
||||
_debug('setting sector', toHex(val));
|
||||
_sector = val;
|
||||
break;
|
||||
case LOC.ATACylinder: // 0x0c
|
||||
_debug('setting cylinder', toHex(val));
|
||||
_cylinder = val;
|
||||
break;
|
||||
case LOC.ATACylinderH: // 0x0d
|
||||
_debug('setting cylinder high', toHex(val));
|
||||
_cylinderH = val;
|
||||
break;
|
||||
case LOC.ATAHead:
|
||||
_head = val & 0xf;
|
||||
_lba = val & 0x40 ? true : false;
|
||||
_drive = val & 0x10 ? 1 : 0;
|
||||
_debug('setting head', toHex(val & 0xf), 'drive', _drive);
|
||||
if (!_lba) {
|
||||
console.error('CHS mode not supported');
|
||||
}
|
||||
break;
|
||||
case LOC.ATACommand: // 0x0f
|
||||
_debug('command:', toHex(val));
|
||||
sector = _head << 24 | _cylinderH << 16 | _cylinder << 8 | _sector;
|
||||
_dumpSector(sector);
|
||||
case LOC.ATADataHigh: // 0x00
|
||||
_dataHigh = val;
|
||||
break;
|
||||
case LOC.SetCSMask: // 0x01
|
||||
_disableSignalling = true;
|
||||
break;
|
||||
case LOC.ClearCSMask: // 0x02
|
||||
_disableSignalling = false;
|
||||
break;
|
||||
case LOC.WriteEEPROM: // 0x03
|
||||
_writeEEPROM = true;
|
||||
break;
|
||||
case LOC.NoWriteEEPROM: // 0x04
|
||||
_writeEEPROM = false;
|
||||
break;
|
||||
case LOC.ATADevCtrl: // 0x06
|
||||
_debug('devCtrl:', toHex(val));
|
||||
_interruptsEnabled = (val & 0x04) ? true : false;
|
||||
_debug('Interrupts', _interruptsEnabled ? 'enabled' : 'disabled');
|
||||
if (val & 0x02) {
|
||||
_reset();
|
||||
}
|
||||
break;
|
||||
case LOC.ATADataLow: // 0x08
|
||||
_curSector[_curWord] = _dataHigh << 8 | val;
|
||||
_curWord++;
|
||||
break;
|
||||
case LOC.ASectorCnt: // 0x0a
|
||||
_debug('setting sector count', val);
|
||||
_sectorCnt = val;
|
||||
break;
|
||||
case LOC.ASector: // 0x0b
|
||||
_debug('setting sector', toHex(val));
|
||||
_sector = val;
|
||||
break;
|
||||
case LOC.ATACylinder: // 0x0c
|
||||
_debug('setting cylinder', toHex(val));
|
||||
_cylinder = val;
|
||||
break;
|
||||
case LOC.ATACylinderH: // 0x0d
|
||||
_debug('setting cylinder high', toHex(val));
|
||||
_cylinderH = val;
|
||||
break;
|
||||
case LOC.ATAHead:
|
||||
_head = val & 0xf;
|
||||
_lba = val & 0x40 ? true : false;
|
||||
_drive = val & 0x10 ? 1 : 0;
|
||||
_debug('setting head', toHex(val & 0xf), 'drive', _drive);
|
||||
if (!_lba) {
|
||||
console.error('CHS mode not supported');
|
||||
}
|
||||
break;
|
||||
case LOC.ATACommand: // 0x0f
|
||||
_debug('command:', toHex(val));
|
||||
sector = _head << 24 | _cylinderH << 16 | _cylinder << 8 | _sector;
|
||||
_dumpSector(sector);
|
||||
|
||||
switch (val) {
|
||||
case COMMANDS.ATAIdentify:
|
||||
_debug('ATA identify');
|
||||
_curSector = _identity[_drive];
|
||||
_curWord = 0;
|
||||
break;
|
||||
case COMMANDS.ATACRead:
|
||||
_debug('ATA read sector', toHex(_cylinderH), toHex(_cylinder), toHex(_sector), sector);
|
||||
_curSector = _sectors[_drive][sector];
|
||||
_curWord = 0;
|
||||
break;
|
||||
case COMMANDS.ATACWrite:
|
||||
_debug('ATA write sector', toHex(_cylinderH), toHex(_cylinder), toHex(_sector), sector);
|
||||
_curSector = _sectors[_drive][sector];
|
||||
_curWord = 0;
|
||||
switch (val) {
|
||||
case COMMANDS.ATAIdentify:
|
||||
_debug('ATA identify');
|
||||
_curSector = _identity[_drive];
|
||||
_curWord = 0;
|
||||
break;
|
||||
case COMMANDS.ATACRead:
|
||||
_debug('ATA read sector', toHex(_cylinderH), toHex(_cylinder), toHex(_sector), sector);
|
||||
_curSector = _sectors[_drive][sector];
|
||||
_curWord = 0;
|
||||
break;
|
||||
case COMMANDS.ATACWrite:
|
||||
_debug('ATA write sector', toHex(_cylinderH), toHex(_cylinder), toHex(_sector), sector);
|
||||
_curSector = _sectors[_drive][sector];
|
||||
_curWord = 0;
|
||||
break;
|
||||
default:
|
||||
debug('unknown command', toHex(val));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debug('unknown command', toHex(val));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debug('write unknown soft switch', toHex(off), toHex(val));
|
||||
debug('write unknown soft switch', toHex(off), toHex(val));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -179,27 +179,27 @@ export default function DiskII(io, callbacks, sectors = 16)
|
|||
}
|
||||
|
||||
switch (command & 0xf) {
|
||||
case 0x0: // CLR
|
||||
_latch = 0;
|
||||
break;
|
||||
case 0x8: // NOP
|
||||
break;
|
||||
case 0x9: // SL0
|
||||
_latch = (_latch << 1) & 0xff;
|
||||
break;
|
||||
case 0xA: // SR
|
||||
_latch >>= 1;
|
||||
if (_cur.readOnly) {
|
||||
_latch |= 0x80;
|
||||
}
|
||||
break;
|
||||
case 0xB: // LD
|
||||
_latch = _bus;
|
||||
debug('Loading', toHex(_latch), 'from bus');
|
||||
break;
|
||||
case 0xD: // SL1
|
||||
_latch = ((_latch << 1) | 0x01) & 0xff;
|
||||
break;
|
||||
case 0x0: // CLR
|
||||
_latch = 0;
|
||||
break;
|
||||
case 0x8: // NOP
|
||||
break;
|
||||
case 0x9: // SL0
|
||||
_latch = (_latch << 1) & 0xff;
|
||||
break;
|
||||
case 0xA: // SR
|
||||
_latch >>= 1;
|
||||
if (_cur.readOnly) {
|
||||
_latch |= 0x80;
|
||||
}
|
||||
break;
|
||||
case 0xB: // LD
|
||||
_latch = _bus;
|
||||
debug('Loading', toHex(_latch), 'from bus');
|
||||
break;
|
||||
case 0xD: // SL1
|
||||
_latch = ((_latch << 1) | 0x01) & 0xff;
|
||||
break;
|
||||
}
|
||||
_state = command >> 4;
|
||||
|
||||
|
@ -295,115 +295,115 @@ export default function DiskII(io, callbacks, sectors = 16)
|
|||
var readMode = val === undefined;
|
||||
|
||||
switch (off & 0x8f) {
|
||||
case LOC.PHASE0OFF: // 0x00
|
||||
setPhase(0, false);
|
||||
break;
|
||||
case LOC.PHASE0ON: // 0x01
|
||||
setPhase(0, true);
|
||||
break;
|
||||
case LOC.PHASE1OFF: // 0x02
|
||||
setPhase(1, false);
|
||||
break;
|
||||
case LOC.PHASE1ON: // 0x03
|
||||
setPhase(1, true);
|
||||
break;
|
||||
case LOC.PHASE2OFF: // 0x04
|
||||
setPhase(2, false);
|
||||
break;
|
||||
case LOC.PHASE2ON: // 0x05
|
||||
setPhase(2, true);
|
||||
break;
|
||||
case LOC.PHASE3OFF: // 0x06
|
||||
setPhase(3, false);
|
||||
break;
|
||||
case LOC.PHASE3ON: // 0x07
|
||||
setPhase(3, true);
|
||||
break;
|
||||
case LOC.PHASE0OFF: // 0x00
|
||||
setPhase(0, false);
|
||||
break;
|
||||
case LOC.PHASE0ON: // 0x01
|
||||
setPhase(0, true);
|
||||
break;
|
||||
case LOC.PHASE1OFF: // 0x02
|
||||
setPhase(1, false);
|
||||
break;
|
||||
case LOC.PHASE1ON: // 0x03
|
||||
setPhase(1, true);
|
||||
break;
|
||||
case LOC.PHASE2OFF: // 0x04
|
||||
setPhase(2, false);
|
||||
break;
|
||||
case LOC.PHASE2ON: // 0x05
|
||||
setPhase(2, true);
|
||||
break;
|
||||
case LOC.PHASE3OFF: // 0x06
|
||||
setPhase(3, false);
|
||||
break;
|
||||
case LOC.PHASE3ON: // 0x07
|
||||
setPhase(3, true);
|
||||
break;
|
||||
|
||||
case LOC.DRIVEOFF: // 0x08
|
||||
if (!_offTimeout) {
|
||||
if (_on) {
|
||||
_offTimeout = window.setTimeout(function() {
|
||||
_debug('Drive Off');
|
||||
_on = false;
|
||||
if (callbacks.driveLight) { callbacks.driveLight(_drive, false); }
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LOC.DRIVEON: // 0x09
|
||||
if (_offTimeout) {
|
||||
window.clearTimeout(_offTimeout);
|
||||
_offTimeout = null;
|
||||
}
|
||||
if (!_on) {
|
||||
_debug('Drive On');
|
||||
_on = true;
|
||||
_lastCycles = io.cycles();
|
||||
if (callbacks.driveLight) { callbacks.driveLight(_drive, true); }
|
||||
}
|
||||
break;
|
||||
|
||||
case LOC.DRIVE1: // 0x0a
|
||||
_debug('Disk 1');
|
||||
_drive = 1;
|
||||
_cur = _drives[_drive - 1];
|
||||
if (_on && callbacks.driveLight) {
|
||||
callbacks.driveLight(2, false);
|
||||
callbacks.driveLight(1, true);
|
||||
}
|
||||
break;
|
||||
case LOC.DRIVE2: // 0x0b
|
||||
_debug('Disk 2');
|
||||
_drive = 2;
|
||||
_cur = _drives[_drive - 1];
|
||||
if (_on && callbacks.driveLight) {
|
||||
callbacks.driveLight(1, false);
|
||||
callbacks.driveLight(2, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LOC.DRIVEREAD: // 0x0c (Q6L) Shift
|
||||
_q6 = 0;
|
||||
if (_writeMode) {
|
||||
_debug('clearing _q6/SHIFT');
|
||||
}
|
||||
if (!_cur.rawTracks) {
|
||||
_readWriteNext();
|
||||
}
|
||||
break;
|
||||
|
||||
case LOC.DRIVEWRITE: // 0x0d (Q6H) LOAD
|
||||
_q6 = 1;
|
||||
if (_writeMode) {
|
||||
_debug('setting _q6/LOAD');
|
||||
}
|
||||
if (!_cur.rawTracks) {
|
||||
if (readMode && !_writeMode) {
|
||||
if (_cur.readOnly) {
|
||||
_latch = 0xff;
|
||||
_debug('Setting readOnly');
|
||||
} else {
|
||||
_latch = _latch >> 1;
|
||||
_debug('Clearing readOnly');
|
||||
case LOC.DRIVEOFF: // 0x08
|
||||
if (!_offTimeout) {
|
||||
if (_on) {
|
||||
_offTimeout = window.setTimeout(function() {
|
||||
_debug('Drive Off');
|
||||
_on = false;
|
||||
if (callbacks.driveLight) { callbacks.driveLight(_drive, false); }
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case LOC.DRIVEON: // 0x09
|
||||
if (_offTimeout) {
|
||||
window.clearTimeout(_offTimeout);
|
||||
_offTimeout = null;
|
||||
}
|
||||
if (!_on) {
|
||||
_debug('Drive On');
|
||||
_on = true;
|
||||
_lastCycles = io.cycles();
|
||||
if (callbacks.driveLight) { callbacks.driveLight(_drive, true); }
|
||||
}
|
||||
break;
|
||||
|
||||
case LOC.DRIVEREADMODE: // 0x0e (Q7L)
|
||||
_debug('Read Mode');
|
||||
_q7 = 0;
|
||||
_writeMode = false;
|
||||
break;
|
||||
case LOC.DRIVEWRITEMODE: // 0x0f (Q7H)
|
||||
_debug('Write Mode');
|
||||
_q7 = 1;
|
||||
_writeMode = true;
|
||||
break;
|
||||
case LOC.DRIVE1: // 0x0a
|
||||
_debug('Disk 1');
|
||||
_drive = 1;
|
||||
_cur = _drives[_drive - 1];
|
||||
if (_on && callbacks.driveLight) {
|
||||
callbacks.driveLight(2, false);
|
||||
callbacks.driveLight(1, true);
|
||||
}
|
||||
break;
|
||||
case LOC.DRIVE2: // 0x0b
|
||||
_debug('Disk 2');
|
||||
_drive = 2;
|
||||
_cur = _drives[_drive - 1];
|
||||
if (_on && callbacks.driveLight) {
|
||||
callbacks.driveLight(1, false);
|
||||
callbacks.driveLight(2, true);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
case LOC.DRIVEREAD: // 0x0c (Q6L) Shift
|
||||
_q6 = 0;
|
||||
if (_writeMode) {
|
||||
_debug('clearing _q6/SHIFT');
|
||||
}
|
||||
if (!_cur.rawTracks) {
|
||||
_readWriteNext();
|
||||
}
|
||||
break;
|
||||
|
||||
case LOC.DRIVEWRITE: // 0x0d (Q6H) LOAD
|
||||
_q6 = 1;
|
||||
if (_writeMode) {
|
||||
_debug('setting _q6/LOAD');
|
||||
}
|
||||
if (!_cur.rawTracks) {
|
||||
if (readMode && !_writeMode) {
|
||||
if (_cur.readOnly) {
|
||||
_latch = 0xff;
|
||||
_debug('Setting readOnly');
|
||||
} else {
|
||||
_latch = _latch >> 1;
|
||||
_debug('Clearing readOnly');
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LOC.DRIVEREADMODE: // 0x0e (Q7L)
|
||||
_debug('Read Mode');
|
||||
_q7 = 0;
|
||||
_writeMode = false;
|
||||
break;
|
||||
case LOC.DRIVEWRITEMODE: // 0x0f (Q7H)
|
||||
_debug('Write Mode');
|
||||
_q7 = 1;
|
||||
_writeMode = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_moveHead();
|
||||
|
@ -576,21 +576,21 @@ export default function DiskII(io, callbacks, sectors = 16)
|
|||
};
|
||||
|
||||
switch (fmt) {
|
||||
case 'd13':
|
||||
disk = new D13(options);
|
||||
break;
|
||||
case 'do':
|
||||
case 'dsk':
|
||||
disk = new DOS(options);
|
||||
break;
|
||||
case 'nib':
|
||||
disk = new Nibble(options);
|
||||
break;
|
||||
case 'po':
|
||||
disk = new ProDOS(options);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
case 'd13':
|
||||
disk = new D13(options);
|
||||
break;
|
||||
case 'do':
|
||||
case 'dsk':
|
||||
disk = new DOS(options);
|
||||
break;
|
||||
case 'nib':
|
||||
disk = new Nibble(options);
|
||||
break;
|
||||
case 'po':
|
||||
disk = new ProDOS(options);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Object.assign(cur, disk);
|
||||
|
@ -621,27 +621,27 @@ export default function DiskII(io, callbacks, sectors = 16)
|
|||
};
|
||||
|
||||
switch (fmt) {
|
||||
case '2mg':
|
||||
disk = new _2MG(options);
|
||||
break;
|
||||
case 'd13':
|
||||
disk = new D13(options);
|
||||
break;
|
||||
case 'do':
|
||||
case 'dsk':
|
||||
disk = new DOS(options);
|
||||
break;
|
||||
case 'nib':
|
||||
disk = new Nibble(options);
|
||||
break;
|
||||
case 'po':
|
||||
disk = new ProDOS(options);
|
||||
break;
|
||||
case 'woz':
|
||||
disk = new Woz(options);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
case '2mg':
|
||||
disk = new _2MG(options);
|
||||
break;
|
||||
case 'd13':
|
||||
disk = new D13(options);
|
||||
break;
|
||||
case 'do':
|
||||
case 'dsk':
|
||||
disk = new DOS(options);
|
||||
break;
|
||||
case 'nib':
|
||||
disk = new Nibble(options);
|
||||
break;
|
||||
case 'po':
|
||||
disk = new ProDOS(options);
|
||||
break;
|
||||
case 'woz':
|
||||
disk = new Woz(options);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Object.assign(cur, disk);
|
||||
|
|
|
@ -85,73 +85,73 @@ export default function LanguageCard(io, rom) {
|
|||
var readMode = val === undefined;
|
||||
var result = 0;
|
||||
switch (off & 0x8B) {
|
||||
case LOC.READBSR2: // 0xC080
|
||||
_readbsr = true;
|
||||
_writebsr = false;
|
||||
_bsr2 = true;
|
||||
_prewrite = false;
|
||||
_debug('Bank 2 Read');
|
||||
break;
|
||||
case LOC.WRITEBSR2: // 0xC081
|
||||
_readbsr = false;
|
||||
if (readMode) {
|
||||
_writebsr = _prewrite;
|
||||
}
|
||||
_bsr2 = true;
|
||||
_prewrite = readMode;
|
||||
_debug('Bank 2 Write');
|
||||
break;
|
||||
case LOC.OFFBSR2: // 0xC082
|
||||
_readbsr = false;
|
||||
_writebsr = false;
|
||||
_bsr2 = true;
|
||||
_prewrite = false;
|
||||
_debug('Bank 2 Off');
|
||||
break;
|
||||
case LOC.READWRBSR2: // 0xC083
|
||||
_readbsr = true;
|
||||
if (readMode) {
|
||||
_writebsr = _prewrite;
|
||||
}
|
||||
_bsr2 = true;
|
||||
_prewrite = readMode;
|
||||
_debug('Bank 2 Read/Write');
|
||||
break;
|
||||
case LOC.READBSR2: // 0xC080
|
||||
_readbsr = true;
|
||||
_writebsr = false;
|
||||
_bsr2 = true;
|
||||
_prewrite = false;
|
||||
_debug('Bank 2 Read');
|
||||
break;
|
||||
case LOC.WRITEBSR2: // 0xC081
|
||||
_readbsr = false;
|
||||
if (readMode) {
|
||||
_writebsr = _prewrite;
|
||||
}
|
||||
_bsr2 = true;
|
||||
_prewrite = readMode;
|
||||
_debug('Bank 2 Write');
|
||||
break;
|
||||
case LOC.OFFBSR2: // 0xC082
|
||||
_readbsr = false;
|
||||
_writebsr = false;
|
||||
_bsr2 = true;
|
||||
_prewrite = false;
|
||||
_debug('Bank 2 Off');
|
||||
break;
|
||||
case LOC.READWRBSR2: // 0xC083
|
||||
_readbsr = true;
|
||||
if (readMode) {
|
||||
_writebsr = _prewrite;
|
||||
}
|
||||
_bsr2 = true;
|
||||
_prewrite = readMode;
|
||||
_debug('Bank 2 Read/Write');
|
||||
break;
|
||||
|
||||
case LOC.READBSR1: // 0xC088
|
||||
_readbsr = true;
|
||||
_writebsr = false;
|
||||
_bsr2 = false;
|
||||
_prewrite = false;
|
||||
_debug('Bank 1 Read');
|
||||
break;
|
||||
case LOC.WRITEBSR1: // 0xC089
|
||||
_readbsr = false;
|
||||
if (readMode) {
|
||||
_writebsr = _prewrite;
|
||||
}
|
||||
_bsr2 = false;
|
||||
_prewrite = readMode;
|
||||
_debug('Bank 1 Write');
|
||||
break;
|
||||
case LOC.OFFBSR1: // 0xC08A
|
||||
_readbsr = false;
|
||||
_writebsr = false;
|
||||
_bsr2 = false;
|
||||
_prewrite = false;
|
||||
_debug('Bank 1 Off');
|
||||
break;
|
||||
case LOC.READWRBSR1: // 0xC08B
|
||||
_readbsr = true;
|
||||
if (readMode) {
|
||||
_writebsr = _prewrite;
|
||||
}
|
||||
_bsr2 = false;
|
||||
_prewrite = readMode;
|
||||
_debug('Bank 1 Read/Write');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case LOC.READBSR1: // 0xC088
|
||||
_readbsr = true;
|
||||
_writebsr = false;
|
||||
_bsr2 = false;
|
||||
_prewrite = false;
|
||||
_debug('Bank 1 Read');
|
||||
break;
|
||||
case LOC.WRITEBSR1: // 0xC089
|
||||
_readbsr = false;
|
||||
if (readMode) {
|
||||
_writebsr = _prewrite;
|
||||
}
|
||||
_bsr2 = false;
|
||||
_prewrite = readMode;
|
||||
_debug('Bank 1 Write');
|
||||
break;
|
||||
case LOC.OFFBSR1: // 0xC08A
|
||||
_readbsr = false;
|
||||
_writebsr = false;
|
||||
_bsr2 = false;
|
||||
_prewrite = false;
|
||||
_debug('Bank 1 Off');
|
||||
break;
|
||||
case LOC.READWRBSR1: // 0xC08B
|
||||
_readbsr = true;
|
||||
if (readMode) {
|
||||
_writebsr = _prewrite;
|
||||
}
|
||||
_bsr2 = false;
|
||||
_prewrite = readMode;
|
||||
_debug('Bank 1 Read/Write');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_updateBanks();
|
||||
|
|
|
@ -22,13 +22,13 @@ export default function Parallel(io, cbs) {
|
|||
|
||||
function _access(off, val) {
|
||||
switch (off & 0x8f) {
|
||||
case LOC.IOREG:
|
||||
if (cbs.putChar && val) {
|
||||
cbs.putChar(val);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debug('Parallel card unknown softswitch', off);
|
||||
case LOC.IOREG:
|
||||
if (cbs.putChar && val) {
|
||||
cbs.putChar(val);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debug('Parallel card unknown softswitch', off);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,49 +66,49 @@ export default function RAMFactor(io, size) {
|
|||
function _access(off, val) {
|
||||
var result = 0;
|
||||
switch (off & 0x8f) {
|
||||
case LOC.RAMLO:
|
||||
case LOC._RAMLO:
|
||||
if (val !== undefined) {
|
||||
_setlo(val);
|
||||
} else {
|
||||
result = _ramlo;
|
||||
}
|
||||
break;
|
||||
case LOC.RAMMID:
|
||||
case LOC._RAMMID:
|
||||
if (val !== undefined) {
|
||||
_setmid(val);
|
||||
} else {
|
||||
result = _rammid;
|
||||
}
|
||||
break;
|
||||
case LOC.RAMHI:
|
||||
case LOC._RAMHI:
|
||||
if (val !== undefined) {
|
||||
_sethi(val);
|
||||
} else {
|
||||
result = _ramhi;
|
||||
result |= 0xf0;
|
||||
}
|
||||
break;
|
||||
case LOC.RAMDATA:
|
||||
case LOC._RAMDATA:
|
||||
if (val !== undefined) {
|
||||
mem[_loc % mem.length] = val;
|
||||
} else {
|
||||
result = mem[_loc % mem.length];
|
||||
}
|
||||
_setlo(_ramlo + 1);
|
||||
break;
|
||||
case LOC.BANK:
|
||||
if (val !== undefined) {
|
||||
_firmware = val & 0x01;
|
||||
} else {
|
||||
result = _firmware;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case LOC.RAMLO:
|
||||
case LOC._RAMLO:
|
||||
if (val !== undefined) {
|
||||
_setlo(val);
|
||||
} else {
|
||||
result = _ramlo;
|
||||
}
|
||||
break;
|
||||
case LOC.RAMMID:
|
||||
case LOC._RAMMID:
|
||||
if (val !== undefined) {
|
||||
_setmid(val);
|
||||
} else {
|
||||
result = _rammid;
|
||||
}
|
||||
break;
|
||||
case LOC.RAMHI:
|
||||
case LOC._RAMHI:
|
||||
if (val !== undefined) {
|
||||
_sethi(val);
|
||||
} else {
|
||||
result = _ramhi;
|
||||
result |= 0xf0;
|
||||
}
|
||||
break;
|
||||
case LOC.RAMDATA:
|
||||
case LOC._RAMDATA:
|
||||
if (val !== undefined) {
|
||||
mem[_loc % mem.length] = val;
|
||||
} else {
|
||||
result = mem[_loc % mem.length];
|
||||
}
|
||||
_setlo(_ramlo + 1);
|
||||
break;
|
||||
case LOC.BANK:
|
||||
if (val !== undefined) {
|
||||
_firmware = val & 0x01;
|
||||
} else {
|
||||
result = _firmware;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
_loc = (_ramhi << 16) | (_rammid << 8) | (_ramlo);
|
||||
|
||||
|
|
|
@ -230,17 +230,17 @@ export default function SmartPort(io, cpu, options ) {
|
|||
var readMode = val === undefined;
|
||||
|
||||
switch (off & 0x8f) {
|
||||
case 0x80:
|
||||
if (readMode) {
|
||||
result = 0;
|
||||
for (var idx = 0; idx < disks.length; idx++) {
|
||||
result <<= 1;
|
||||
if (disks[idx]) {
|
||||
result |= 0x01;
|
||||
case 0x80:
|
||||
if (readMode) {
|
||||
result = 0;
|
||||
for (var idx = 0; idx < disks.length; idx++) {
|
||||
result <<= 1;
|
||||
if (disks[idx]) {
|
||||
result |= 0x01;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -285,21 +285,21 @@ export default function SmartPort(io, cpu, options ) {
|
|||
_debug('buffer=' + toHex(buffer) + ' block=' + toHex(block));
|
||||
|
||||
switch (cmd) {
|
||||
case 0: // INFO
|
||||
getDeviceInfo(state, drive);
|
||||
break;
|
||||
case 0: // INFO
|
||||
getDeviceInfo(state, drive);
|
||||
break;
|
||||
|
||||
case 1: // READ
|
||||
readBlock(state, drive, block, buffer);
|
||||
break;
|
||||
case 1: // READ
|
||||
readBlock(state, drive, block, buffer);
|
||||
break;
|
||||
|
||||
case 2: // WRITE
|
||||
writeBlock(state, drive, block, buffer);
|
||||
break;
|
||||
case 2: // WRITE
|
||||
writeBlock(state, drive, block, buffer);
|
||||
break;
|
||||
|
||||
case 3: // FORMAT
|
||||
formatDevice(state, unit);
|
||||
break;
|
||||
case 3: // FORMAT
|
||||
formatDevice(state, unit);
|
||||
break;
|
||||
}
|
||||
} else if (off == smartOff && cpu.getSync()) {
|
||||
_debug('smartport entry');
|
||||
|
@ -326,81 +326,81 @@ export default function SmartPort(io, cpu, options ) {
|
|||
|
||||
_debug('parameterCount=' + parameterCount);
|
||||
switch (cmd) {
|
||||
case 0x00: // INFO
|
||||
status = cmdListAddr.inc(4).readByte();
|
||||
_debug('info unit=' + unit);
|
||||
_debug('info buffer=' + buffer);
|
||||
_debug('info status=' + status);
|
||||
switch (unit) {
|
||||
case 0:
|
||||
switch (status) {
|
||||
case 0:
|
||||
buffer.writeByte(1); // one device
|
||||
buffer.inc(1).writeByte(1 << 6); // no interrupts
|
||||
buffer.inc(2).writeByte(0); // reserved
|
||||
buffer.inc(3).writeByte(0); // reserved
|
||||
buffer.inc(4).writeByte(0); // reserved
|
||||
buffer.inc(5).writeByte(0); // reserved
|
||||
buffer.inc(6).writeByte(0); // reserved
|
||||
buffer.inc(7).writeByte(0); // reserved
|
||||
state.x = 8;
|
||||
state.y = 0;
|
||||
state.a = 0;
|
||||
state.s &= 0xfe;
|
||||
break;
|
||||
case 0x00: // INFO
|
||||
status = cmdListAddr.inc(4).readByte();
|
||||
_debug('info unit=' + unit);
|
||||
_debug('info buffer=' + buffer);
|
||||
_debug('info status=' + status);
|
||||
switch (unit) {
|
||||
case 0:
|
||||
switch (status) {
|
||||
case 0:
|
||||
buffer.writeByte(1); // one device
|
||||
buffer.inc(1).writeByte(1 << 6); // no interrupts
|
||||
buffer.inc(2).writeByte(0); // reserved
|
||||
buffer.inc(3).writeByte(0); // reserved
|
||||
buffer.inc(4).writeByte(0); // reserved
|
||||
buffer.inc(5).writeByte(0); // reserved
|
||||
buffer.inc(6).writeByte(0); // reserved
|
||||
buffer.inc(7).writeByte(0); // reserved
|
||||
state.x = 8;
|
||||
state.y = 0;
|
||||
state.a = 0;
|
||||
state.s &= 0xfe;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default: // Unit 1
|
||||
switch (status) {
|
||||
case 0:
|
||||
var blocks = disks[unit].length;
|
||||
buffer.writeByte(0xf0); // W/R Block device in drive
|
||||
buffer.inc(1).writeByte(blocks & 0xff); // 1600 blocks
|
||||
buffer.inc(2).writeByte((blocks & 0xff00) >> 8);
|
||||
buffer.inc(3).writeByte((blocks & 0xff0000) >> 16);
|
||||
state.x = 4;
|
||||
state.y = 0;
|
||||
state.a = 0;
|
||||
state.s &= 0xfe;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
state.a = 0;
|
||||
state.s &= 0xfe;
|
||||
break;
|
||||
default: // Unit 1
|
||||
switch (status) {
|
||||
case 0:
|
||||
var blocks = disks[unit].length;
|
||||
buffer.writeByte(0xf0); // W/R Block device in drive
|
||||
buffer.inc(1).writeByte(blocks & 0xff); // 1600 blocks
|
||||
buffer.inc(2).writeByte((blocks & 0xff00) >> 8);
|
||||
buffer.inc(3).writeByte((blocks & 0xff0000) >> 16);
|
||||
state.x = 4;
|
||||
state.y = 0;
|
||||
state.a = 0;
|
||||
state.s &= 0xfe;
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x01: // READ BLOCK
|
||||
block = cmdListAddr.inc(4).readWord();
|
||||
readBlock(state, unit, block, buffer);
|
||||
break;
|
||||
}
|
||||
state.a = 0;
|
||||
state.s &= 0xfe;
|
||||
break;
|
||||
|
||||
case 0x01: // READ BLOCK
|
||||
block = cmdListAddr.inc(4).readWord();
|
||||
readBlock(state, unit, block, buffer);
|
||||
break;
|
||||
case 0x02: // WRITE BLOCK
|
||||
block = cmdListAddr.inc(4).readWord();
|
||||
writeBlock(state, unit, block, buffer);
|
||||
break;
|
||||
|
||||
case 0x02: // WRITE BLOCK
|
||||
block = cmdListAddr.inc(4).readWord();
|
||||
writeBlock(state, unit, block, buffer);
|
||||
break;
|
||||
case 0x03: // FORMAT
|
||||
formatDevice(state, unit);
|
||||
break;
|
||||
|
||||
case 0x03: // FORMAT
|
||||
formatDevice(state, unit);
|
||||
break;
|
||||
case 0x04: // CONTROL
|
||||
break;
|
||||
|
||||
case 0x04: // CONTROL
|
||||
break;
|
||||
case 0x05: // INIT
|
||||
break;
|
||||
|
||||
case 0x05: // INIT
|
||||
break;
|
||||
case 0x06: // OPEN
|
||||
break;
|
||||
|
||||
case 0x06: // OPEN
|
||||
break;
|
||||
case 0x07: // CLOSE
|
||||
break;
|
||||
|
||||
case 0x07: // CLOSE
|
||||
break;
|
||||
case 0x08: // READ
|
||||
break;
|
||||
|
||||
case 0x08: // READ
|
||||
break;
|
||||
|
||||
case 0x09: // WRITE
|
||||
break;
|
||||
case 0x09: // WRITE
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,46 +90,46 @@ export default function Thunderclock()
|
|||
|
||||
function _access(off, val) {
|
||||
switch (off & 0x8F) {
|
||||
case LOC.CONTROL:
|
||||
if (val !== undefined) {
|
||||
var strobe = val & FLAGS.STROBE ? true : false;
|
||||
if (strobe !== _strobe) {
|
||||
_debug('strobe', _strobe ? 'high' : 'low');
|
||||
if (strobe) {
|
||||
_command = val & COMMANDS.MASK;
|
||||
switch (_command) {
|
||||
case COMMANDS.TIMED:
|
||||
_debug('TIMED');
|
||||
_calcBits();
|
||||
break;
|
||||
case COMMANDS.REGSHIFT:
|
||||
_debug('REGSHIFT');
|
||||
_shiftMode = true;
|
||||
case LOC.CONTROL:
|
||||
if (val !== undefined) {
|
||||
var strobe = val & FLAGS.STROBE ? true : false;
|
||||
if (strobe !== _strobe) {
|
||||
_debug('strobe', _strobe ? 'high' : 'low');
|
||||
if (strobe) {
|
||||
_command = val & COMMANDS.MASK;
|
||||
switch (_command) {
|
||||
case COMMANDS.TIMED:
|
||||
_debug('TIMED');
|
||||
_calcBits();
|
||||
break;
|
||||
case COMMANDS.REGSHIFT:
|
||||
_debug('REGSHIFT');
|
||||
_shiftMode = true;
|
||||
_shift();
|
||||
break;
|
||||
case COMMANDS.REGHOLD:
|
||||
_debug('REGHOLD');
|
||||
_shiftMode = false;
|
||||
break;
|
||||
default:
|
||||
_debug('Unknown command', toHex(_command));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var clock = val & FLAGS.CLOCK ? true : false;
|
||||
|
||||
if (clock !== _clock) {
|
||||
_clock = clock;
|
||||
_debug('clock', _clock ? 'high' : 'low');
|
||||
if (clock) {
|
||||
_shift();
|
||||
break;
|
||||
case COMMANDS.REGHOLD:
|
||||
_debug('REGHOLD');
|
||||
_shiftMode = false;
|
||||
break;
|
||||
default:
|
||||
_debug('Unknown command', toHex(_command));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var clock = val & FLAGS.CLOCK ? true : false;
|
||||
|
||||
if (clock !== _clock) {
|
||||
_clock = clock;
|
||||
_debug('clock', _clock ? 'high' : 'low');
|
||||
if (clock) {
|
||||
_shift();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LOC.AUX:
|
||||
break;
|
||||
break;
|
||||
case LOC.AUX:
|
||||
break;
|
||||
}
|
||||
return _register;
|
||||
}
|
||||
|
|
|
@ -190,34 +190,34 @@ export default function Videoterm(io, context) {
|
|||
var writeMode = val !== undefined;
|
||||
var result = undefined;
|
||||
switch (off & 0x81) {
|
||||
case LOC.IOREG:
|
||||
if (writeMode) {
|
||||
_curReg = val;
|
||||
} else {
|
||||
result = _curReg;
|
||||
}
|
||||
break;
|
||||
case LOC.IOVAL:
|
||||
if (writeMode) {
|
||||
_regs[_curReg] = val;
|
||||
switch (_curReg) {
|
||||
case REGS.CURSOR_UPPER:
|
||||
case REGS.CURSOR_LOWER:
|
||||
_refreshCursor(true);
|
||||
break;
|
||||
case REGS.CURSOR_HI:
|
||||
case REGS.CURSOR_LO:
|
||||
_refreshCursor(true);
|
||||
break;
|
||||
case REGS.STARTPOS_HI:
|
||||
case REGS.STARTPOS_LO:
|
||||
_updateStartPos();
|
||||
break;
|
||||
case LOC.IOREG:
|
||||
if (writeMode) {
|
||||
_curReg = val;
|
||||
} else {
|
||||
result = _curReg;
|
||||
}
|
||||
} else {
|
||||
result = _regs[_curReg];
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case LOC.IOVAL:
|
||||
if (writeMode) {
|
||||
_regs[_curReg] = val;
|
||||
switch (_curReg) {
|
||||
case REGS.CURSOR_UPPER:
|
||||
case REGS.CURSOR_LOWER:
|
||||
_refreshCursor(true);
|
||||
break;
|
||||
case REGS.CURSOR_HI:
|
||||
case REGS.CURSOR_LO:
|
||||
_refreshCursor(true);
|
||||
break;
|
||||
case REGS.STARTPOS_HI:
|
||||
case REGS.STARTPOS_LO:
|
||||
_updateStartPos();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
result = _regs[_curReg];
|
||||
}
|
||||
break;
|
||||
}
|
||||
_bank = (off & 0x0C) >> 2;
|
||||
return result;
|
||||
|
|
118
js/cpu6502.ts
118
js/cpu6502.ts
|
@ -1008,68 +1008,68 @@ export default class CPU6502 {
|
|||
let off, val;
|
||||
let result = '';
|
||||
switch (m) {
|
||||
case 'implied':
|
||||
break;
|
||||
case 'immediate':
|
||||
result = '#' + toHexOrSymbol(this.readByteDebug(addr));
|
||||
break;
|
||||
case 'absolute':
|
||||
result = '' + toHexOrSymbol(this.readWordDebug(addr), 4);
|
||||
break;
|
||||
case 'zeroPage':
|
||||
result = '' + toHexOrSymbol(this.readByteDebug(addr));
|
||||
break;
|
||||
case 'relative':
|
||||
{
|
||||
let off = this.readByteDebug(addr);
|
||||
case 'implied':
|
||||
break;
|
||||
case 'immediate':
|
||||
result = '#' + toHexOrSymbol(this.readByteDebug(addr));
|
||||
break;
|
||||
case 'absolute':
|
||||
result = '' + toHexOrSymbol(this.readWordDebug(addr), 4);
|
||||
break;
|
||||
case 'zeroPage':
|
||||
result = '' + toHexOrSymbol(this.readByteDebug(addr));
|
||||
break;
|
||||
case 'relative':
|
||||
{
|
||||
let off = this.readByteDebug(addr);
|
||||
if (off > 127) {
|
||||
off -= 256;
|
||||
}
|
||||
addr += off + 1;
|
||||
result = '' + toHexOrSymbol(addr, 4) + ' (' + off + ')';
|
||||
}
|
||||
break;
|
||||
case 'absoluteX':
|
||||
result = '' + toHexOrSymbol(this.readWordDebug(addr), 4) + ',X';
|
||||
break;
|
||||
case 'absoluteY':
|
||||
result = '' + toHexOrSymbol(this.readWordDebug(addr), 4) + ',Y';
|
||||
break;
|
||||
case 'zeroPageX':
|
||||
result = '' + toHexOrSymbol(this.readByteDebug(addr)) + ',X';
|
||||
break;
|
||||
case 'zeroPageY':
|
||||
result = '' + toHexOrSymbol(this.readByteDebug(addr)) + ',Y';
|
||||
break;
|
||||
case 'absoluteIndirect':
|
||||
result = '(' + toHexOrSymbol(this.readWordDebug(addr), 4) + ')';
|
||||
break;
|
||||
case 'zeroPageXIndirect':
|
||||
result = '(' + toHexOrSymbol(this.readByteDebug(addr)) + ',X)';
|
||||
break;
|
||||
case 'zeroPageIndirectY':
|
||||
result = '(' + toHexOrSymbol(this.readByteDebug(addr)) + '),Y';
|
||||
break;
|
||||
case 'accumulator':
|
||||
result = 'A';
|
||||
break;
|
||||
case 'zeroPageIndirect':
|
||||
result = '(' + toHexOrSymbol(this.readByteDebug(addr)) + ')';
|
||||
break;
|
||||
case 'absoluteXIndirect':
|
||||
result = '(' + toHexOrSymbol(this.readWordDebug(addr), 4) + ',X)';
|
||||
break;
|
||||
case 'zeroPage_relative':
|
||||
val = this.readByteDebug(addr);
|
||||
off = this.readByteDebug(addr + 1);
|
||||
if (off > 127) {
|
||||
off -= 256;
|
||||
}
|
||||
addr += off + 1;
|
||||
result = '' + toHexOrSymbol(addr, 4) + ' (' + off + ')';
|
||||
}
|
||||
break;
|
||||
case 'absoluteX':
|
||||
result = '' + toHexOrSymbol(this.readWordDebug(addr), 4) + ',X';
|
||||
break;
|
||||
case 'absoluteY':
|
||||
result = '' + toHexOrSymbol(this.readWordDebug(addr), 4) + ',Y';
|
||||
break;
|
||||
case 'zeroPageX':
|
||||
result = '' + toHexOrSymbol(this.readByteDebug(addr)) + ',X';
|
||||
break;
|
||||
case 'zeroPageY':
|
||||
result = '' + toHexOrSymbol(this.readByteDebug(addr)) + ',Y';
|
||||
break;
|
||||
case 'absoluteIndirect':
|
||||
result = '(' + toHexOrSymbol(this.readWordDebug(addr), 4) + ')';
|
||||
break;
|
||||
case 'zeroPageXIndirect':
|
||||
result = '(' + toHexOrSymbol(this.readByteDebug(addr)) + ',X)';
|
||||
break;
|
||||
case 'zeroPageIndirectY':
|
||||
result = '(' + toHexOrSymbol(this.readByteDebug(addr)) + '),Y';
|
||||
break;
|
||||
case 'accumulator':
|
||||
result = 'A';
|
||||
break;
|
||||
case 'zeroPageIndirect':
|
||||
result = '(' + toHexOrSymbol(this.readByteDebug(addr)) + ')';
|
||||
break;
|
||||
case 'absoluteXIndirect':
|
||||
result = '(' + toHexOrSymbol(this.readWordDebug(addr), 4) + ',X)';
|
||||
break;
|
||||
case 'zeroPage_relative':
|
||||
val = this.readByteDebug(addr);
|
||||
off = this.readByteDebug(addr + 1);
|
||||
if (off > 127) {
|
||||
off -= 256;
|
||||
}
|
||||
addr += off + 2;
|
||||
result = '' + toHexOrSymbol(val) + ',' + toHexOrSymbol(addr, 4) + ' (' + off + ')';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
addr += off + 2;
|
||||
result = '' + toHexOrSymbol(val) + ',' + toHexOrSymbol(addr, 4) + ' (' + off + ')';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -65,16 +65,16 @@ export default function _2MG(options) {
|
|||
// Check image format.
|
||||
// Sure, it's really 64 bits. But only 2 are actually used.
|
||||
switch (format) {
|
||||
case 1: // PO
|
||||
disk = new ProDOS(options);
|
||||
break;
|
||||
case 2: // NIB
|
||||
disk = new Nibble(options);
|
||||
break;
|
||||
case 0: // dsk
|
||||
default: // Something hinky, assume 'dsk'
|
||||
disk = new DOS(options);
|
||||
break;
|
||||
case 1: // PO
|
||||
disk = new ProDOS(options);
|
||||
break;
|
||||
case 2: // NIB
|
||||
disk = new Nibble(options);
|
||||
break;
|
||||
case 0: // dsk
|
||||
default: // Something hinky, assume 'dsk'
|
||||
disk = new DOS(options);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -319,70 +319,70 @@ export function readSector(drive: Drive, track: byte, sector: byte) {
|
|||
const data = [];
|
||||
while (retry < 4) {
|
||||
switch (state) {
|
||||
case 0:
|
||||
val = _readNext();
|
||||
state = (val === 0xd5) ? 1 : 0;
|
||||
break;
|
||||
case 1:
|
||||
val = _readNext();
|
||||
state = (val === 0xaa) ? 2 : 0;
|
||||
break;
|
||||
case 2:
|
||||
val = _readNext();
|
||||
state = (val === 0x96) ? 3 : (val === 0xad ? 4 : 0);
|
||||
break;
|
||||
case 3: // Address
|
||||
v = defourXfour(_readNext(), _readNext()); // Volume
|
||||
t = defourXfour(_readNext(), _readNext());
|
||||
s = defourXfour(_readNext(), _readNext());
|
||||
checkSum = defourXfour(_readNext(), _readNext());
|
||||
if (checkSum != (v ^ t ^ s)) {
|
||||
debug('Invalid header checksum:', toHex(v), toHex(t), toHex(s), toHex(checkSum));
|
||||
}
|
||||
_skipBytes(3); // Skip footer
|
||||
state = 0;
|
||||
break;
|
||||
case 4: // Data
|
||||
if (s === _sector && t === track) {
|
||||
const data2 = [];
|
||||
let last = 0;
|
||||
for (let jdx = 0x55; jdx >= 0; jdx--) {
|
||||
val = detrans62[_readNext() - 0x80] ^ last;
|
||||
data2[jdx] = val;
|
||||
last = val;
|
||||
case 0:
|
||||
val = _readNext();
|
||||
state = (val === 0xd5) ? 1 : 0;
|
||||
break;
|
||||
case 1:
|
||||
val = _readNext();
|
||||
state = (val === 0xaa) ? 2 : 0;
|
||||
break;
|
||||
case 2:
|
||||
val = _readNext();
|
||||
state = (val === 0x96) ? 3 : (val === 0xad ? 4 : 0);
|
||||
break;
|
||||
case 3: // Address
|
||||
v = defourXfour(_readNext(), _readNext()); // Volume
|
||||
t = defourXfour(_readNext(), _readNext());
|
||||
s = defourXfour(_readNext(), _readNext());
|
||||
checkSum = defourXfour(_readNext(), _readNext());
|
||||
if (checkSum != (v ^ t ^ s)) {
|
||||
debug('Invalid header checksum:', toHex(v), toHex(t), toHex(s), toHex(checkSum));
|
||||
}
|
||||
for (let jdx = 0; jdx < 0x100; jdx++) {
|
||||
val = detrans62[_readNext() - 0x80] ^ last;
|
||||
data[jdx] = val;
|
||||
last = val;
|
||||
}
|
||||
checkSum = detrans62[_readNext() - 0x80] ^ last;
|
||||
if (checkSum) {
|
||||
debug('Invalid data checksum:', toHex(v), toHex(t), toHex(s), toHex(checkSum));
|
||||
}
|
||||
for (let kdx = 0, jdx = 0x55; kdx < 0x100; kdx++) {
|
||||
data[kdx] <<= 1;
|
||||
if ((data2[jdx] & 0x01) !== 0) {
|
||||
data[kdx] |= 0x01;
|
||||
_skipBytes(3); // Skip footer
|
||||
state = 0;
|
||||
break;
|
||||
case 4: // Data
|
||||
if (s === _sector && t === track) {
|
||||
const data2 = [];
|
||||
let last = 0;
|
||||
for (let jdx = 0x55; jdx >= 0; jdx--) {
|
||||
val = detrans62[_readNext() - 0x80] ^ last;
|
||||
data2[jdx] = val;
|
||||
last = val;
|
||||
}
|
||||
data2[jdx] >>= 1;
|
||||
|
||||
data[kdx] <<= 1;
|
||||
if ((data2[jdx] & 0x01) !== 0) {
|
||||
data[kdx] |= 0x01;
|
||||
for (let jdx = 0; jdx < 0x100; jdx++) {
|
||||
val = detrans62[_readNext() - 0x80] ^ last;
|
||||
data[jdx] = val;
|
||||
last = val;
|
||||
}
|
||||
data2[jdx] >>= 1;
|
||||
checkSum = detrans62[_readNext() - 0x80] ^ last;
|
||||
if (checkSum) {
|
||||
debug('Invalid data checksum:', toHex(v), toHex(t), toHex(s), toHex(checkSum));
|
||||
}
|
||||
for (let kdx = 0, jdx = 0x55; kdx < 0x100; kdx++) {
|
||||
data[kdx] <<= 1;
|
||||
if ((data2[jdx] & 0x01) !== 0) {
|
||||
data[kdx] |= 0x01;
|
||||
}
|
||||
data2[jdx] >>= 1;
|
||||
|
||||
if (--jdx < 0) jdx = 0x55;
|
||||
data[kdx] <<= 1;
|
||||
if ((data2[jdx] & 0x01) !== 0) {
|
||||
data[kdx] |= 0x01;
|
||||
}
|
||||
data2[jdx] >>= 1;
|
||||
|
||||
if (--jdx < 0) jdx = 0x55;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
else
|
||||
_skipBytes(0x159); // Skip data, checksum and footer
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
else
|
||||
_skipBytes(0x159); // Skip data, checksum and footer
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
|
|
|
@ -199,14 +199,14 @@ export default function Woz(options) {
|
|||
var wozSignature = dv.getUint32(WOZ_HEADER_START + 0, true);
|
||||
|
||||
switch (wozSignature) {
|
||||
case WOZ1_SIGNATURE:
|
||||
wozVersion = 1;
|
||||
break;
|
||||
case WOZ2_SIGNATURE:
|
||||
wozVersion = 2;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
case WOZ1_SIGNATURE:
|
||||
wozVersion = 1;
|
||||
break;
|
||||
case WOZ2_SIGNATURE:
|
||||
wozVersion = 2;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dv.getUint32(WOZ_HEADER_START + 4, true) !== WOZ_INTEGRITY_CHECK) {
|
||||
|
@ -238,27 +238,27 @@ export default function Woz(options) {
|
|||
var chunk = readChunk();
|
||||
while (chunk) {
|
||||
switch (chunk.type) {
|
||||
case 0x4F464E49: // INFO
|
||||
chunks.info = new InfoChunk(chunk.data);
|
||||
break;
|
||||
case 0x50414D54: // TMAP
|
||||
chunks.tmap = new TMapChunk(chunk.data);
|
||||
break;
|
||||
case 0x534B5254: // TRKS
|
||||
if (wozVersion === 1) {
|
||||
chunks.trks = new TrksChunk(chunk.data);
|
||||
} else {
|
||||
chunks.trks = new TrksChunk2(chunk.data);
|
||||
}
|
||||
break;
|
||||
case 0x4154454D: // META
|
||||
chunks.meta = new MetaChunk(chunk.data);
|
||||
break;
|
||||
case 0x54495257: // WRIT
|
||||
case 0x4F464E49: // INFO
|
||||
chunks.info = new InfoChunk(chunk.data);
|
||||
break;
|
||||
case 0x50414D54: // TMAP
|
||||
chunks.tmap = new TMapChunk(chunk.data);
|
||||
break;
|
||||
case 0x534B5254: // TRKS
|
||||
if (wozVersion === 1) {
|
||||
chunks.trks = new TrksChunk(chunk.data);
|
||||
} else {
|
||||
chunks.trks = new TrksChunk2(chunk.data);
|
||||
}
|
||||
break;
|
||||
case 0x4154454D: // META
|
||||
chunks.meta = new MetaChunk(chunk.data);
|
||||
break;
|
||||
case 0x54495257: // WRIT
|
||||
// Ignore
|
||||
break;
|
||||
default:
|
||||
debug('Unsupported chunk', toHex(chunk.type, 8));
|
||||
break;
|
||||
default:
|
||||
debug('Unsupported chunk', toHex(chunk.type, 8));
|
||||
}
|
||||
chunk = readChunk();
|
||||
}
|
||||
|
|
48
js/main2.js
48
js/main2.js
|
@ -32,30 +32,30 @@ var characterRom = apple2_charset;
|
|||
var sectors = 16;
|
||||
|
||||
switch (romVersion) {
|
||||
case 'apple2':
|
||||
rom = new IntBASIC();
|
||||
break;
|
||||
case 'apple213':
|
||||
rom = new IntBASIC();
|
||||
sectors = 13;
|
||||
break;
|
||||
case 'original':
|
||||
rom = new OriginalROM();
|
||||
break;
|
||||
case 'apple2jplus':
|
||||
rom = new Apple2jROM();
|
||||
characterRom = apple2j_charset;
|
||||
break;
|
||||
case 'apple2pig':
|
||||
rom = new Apple2ROM();
|
||||
characterRom = pigfont_charset;
|
||||
break;
|
||||
case 'apple2lc':
|
||||
rom = new Apple2ROM();
|
||||
characterRom = apple2lc_charset;
|
||||
break;
|
||||
default:
|
||||
rom = new Apple2ROM();
|
||||
case 'apple2':
|
||||
rom = new IntBASIC();
|
||||
break;
|
||||
case 'apple213':
|
||||
rom = new IntBASIC();
|
||||
sectors = 13;
|
||||
break;
|
||||
case 'original':
|
||||
rom = new OriginalROM();
|
||||
break;
|
||||
case 'apple2jplus':
|
||||
rom = new Apple2jROM();
|
||||
characterRom = apple2j_charset;
|
||||
break;
|
||||
case 'apple2pig':
|
||||
rom = new Apple2ROM();
|
||||
characterRom = pigfont_charset;
|
||||
break;
|
||||
case 'apple2lc':
|
||||
rom = new Apple2ROM();
|
||||
characterRom = apple2lc_charset;
|
||||
break;
|
||||
default:
|
||||
rom = new Apple2ROM();
|
||||
}
|
||||
|
||||
var options = {
|
||||
|
|
24
js/main2e.js
24
js/main2e.js
|
@ -27,18 +27,18 @@ var rom;
|
|||
var characterRom = apple2e_charset;
|
||||
|
||||
switch (romVersion) {
|
||||
case 'apple2e':
|
||||
rom = new Apple2eROM();
|
||||
break;
|
||||
case 'apple2rm':
|
||||
rom = new Apple2eEnhancedROM();
|
||||
characterRom = rmfont_charset;
|
||||
enhanced = true;
|
||||
break;
|
||||
default:
|
||||
rom = new Apple2eEnhancedROM();
|
||||
characterRom = apple2enh_charset;
|
||||
enhanced = true;
|
||||
case 'apple2e':
|
||||
rom = new Apple2eROM();
|
||||
break;
|
||||
case 'apple2rm':
|
||||
rom = new Apple2eEnhancedROM();
|
||||
characterRom = rmfont_charset;
|
||||
enhanced = true;
|
||||
break;
|
||||
default:
|
||||
rom = new Apple2eEnhancedROM();
|
||||
characterRom = apple2enh_charset;
|
||||
enhanced = true;
|
||||
}
|
||||
|
||||
var options = {
|
||||
|
|
560
js/mmu.ts
560
js/mmu.ts
|
@ -486,302 +486,302 @@ export default class MMU implements Memory {
|
|||
const writeMode = val !== undefined;
|
||||
switch (off) {
|
||||
|
||||
// Apple //e memory management
|
||||
// Apple //e memory management
|
||||
|
||||
case LOC._80STOREOFF:
|
||||
if (writeMode) {
|
||||
this._80store = false;
|
||||
this._debug('80 Store Off');
|
||||
this.vm.page(this._page2 ? 2 : 1);
|
||||
} else {
|
||||
case LOC._80STOREOFF:
|
||||
if (writeMode) {
|
||||
this._80store = false;
|
||||
this._debug('80 Store Off');
|
||||
this.vm.page(this._page2 ? 2 : 1);
|
||||
} else {
|
||||
// Chain to io for keyboard
|
||||
result = this.io.ioSwitch(off, val);
|
||||
}
|
||||
break;
|
||||
case LOC._80STOREON:
|
||||
if (writeMode) {
|
||||
this._80store = true;
|
||||
this._debug('80 Store On');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
case LOC.RAMRDOFF:
|
||||
if (writeMode) {
|
||||
this._auxRamRead = false;
|
||||
this._debug('Aux RAM Read Off');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
case LOC.RAMRDON:
|
||||
if (writeMode) {
|
||||
this._auxRamRead = true;
|
||||
this._debug('Aux RAM Read On');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
case LOC.RAMWROFF:
|
||||
if (writeMode) {
|
||||
this._auxRamWrite = false;
|
||||
this._debug('Aux RAM Write Off');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
case LOC.RAMWRON:
|
||||
if (writeMode) {
|
||||
this._auxRamWrite = true;
|
||||
this._debug('Aux RAM Write On');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
|
||||
case LOC.INTCXROMOFF:
|
||||
if (writeMode) {
|
||||
this._intcxrom = false;
|
||||
this._intc8rom = false;
|
||||
this._debug('Int CX ROM Off');
|
||||
}
|
||||
break;
|
||||
case LOC.INTCXROMON:
|
||||
if (writeMode) {
|
||||
this._intcxrom = true;
|
||||
this._debug('Int CX ROM On');
|
||||
}
|
||||
break;
|
||||
case LOC.ALTZPOFF: // 0x08
|
||||
if (writeMode) {
|
||||
this._altzp = false;
|
||||
this._debug('Alt ZP Off');
|
||||
}
|
||||
break;
|
||||
case LOC.ALTZPON: // 0x09
|
||||
if (writeMode) {
|
||||
this._altzp = true;
|
||||
this._debug('Alt ZP On');
|
||||
}
|
||||
break;
|
||||
case LOC.SLOTC3ROMOFF: // 0x0A
|
||||
if (writeMode) {
|
||||
this._slot3rom = false;
|
||||
this._debug('Slot 3 ROM Off');
|
||||
}
|
||||
break;
|
||||
case LOC.SLOTC3ROMON: // 0x0B
|
||||
if (writeMode) {
|
||||
this._slot3rom = true;
|
||||
this._debug('Slot 3 ROM On');
|
||||
}
|
||||
break;
|
||||
|
||||
// Graphics Switches
|
||||
|
||||
case LOC.CLR80VID:
|
||||
if (writeMode) {
|
||||
this._debug('80 Column Mode off');
|
||||
this.vm._80col(false);
|
||||
}
|
||||
break;
|
||||
case LOC.SET80VID:
|
||||
if (writeMode) {
|
||||
this._debug('80 Column Mode on');
|
||||
this.vm._80col(true);
|
||||
}
|
||||
break;
|
||||
case LOC.CLRALTCH:
|
||||
if (writeMode) {
|
||||
this._debug('Alt Char off');
|
||||
this.vm.altchar(false);
|
||||
}
|
||||
break;
|
||||
case LOC.SETALTCH:
|
||||
if (writeMode) {
|
||||
this._debug('Alt Char on');
|
||||
this.vm.altchar(true);
|
||||
}
|
||||
break;
|
||||
case LOC.PAGE1:
|
||||
this._page2 = false;
|
||||
if (!this._80store) {
|
||||
result = this.io.ioSwitch(off, val);
|
||||
}
|
||||
this._debug('Page 2 off');
|
||||
break;
|
||||
case LOC.PAGE2:
|
||||
this._page2 = true;
|
||||
if (!this._80store) {
|
||||
result = this.io.ioSwitch(off, val);
|
||||
}
|
||||
this._debug('Page 2 on');
|
||||
break;
|
||||
|
||||
case LOC.RESET_HIRES:
|
||||
this._hires = false;
|
||||
result = this.io.ioSwitch(off, val);
|
||||
}
|
||||
break;
|
||||
case LOC._80STOREON:
|
||||
if (writeMode) {
|
||||
this._80store = true;
|
||||
this._debug('80 Store On');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
case LOC.RAMRDOFF:
|
||||
if (writeMode) {
|
||||
this._auxRamRead = false;
|
||||
this._debug('Aux RAM Read Off');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
case LOC.RAMRDON:
|
||||
if (writeMode) {
|
||||
this._auxRamRead = true;
|
||||
this._debug('Aux RAM Read On');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
case LOC.RAMWROFF:
|
||||
if (writeMode) {
|
||||
this._auxRamWrite = false;
|
||||
this._debug('Aux RAM Write Off');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
case LOC.RAMWRON:
|
||||
if (writeMode) {
|
||||
this._auxRamWrite = true;
|
||||
this._debug('Aux RAM Write On');
|
||||
} else
|
||||
result = 0;
|
||||
break;
|
||||
this._debug('Hires off');
|
||||
break;
|
||||
|
||||
case LOC.INTCXROMOFF:
|
||||
if (writeMode) {
|
||||
this._intcxrom = false;
|
||||
this._intc8rom = false;
|
||||
this._debug('Int CX ROM Off');
|
||||
}
|
||||
break;
|
||||
case LOC.INTCXROMON:
|
||||
if (writeMode) {
|
||||
this._intcxrom = true;
|
||||
this._debug('Int CX ROM On');
|
||||
}
|
||||
break;
|
||||
case LOC.ALTZPOFF: // 0x08
|
||||
if (writeMode) {
|
||||
this._altzp = false;
|
||||
this._debug('Alt ZP Off');
|
||||
}
|
||||
break;
|
||||
case LOC.ALTZPON: // 0x09
|
||||
if (writeMode) {
|
||||
this._altzp = true;
|
||||
this._debug('Alt ZP On');
|
||||
}
|
||||
break;
|
||||
case LOC.SLOTC3ROMOFF: // 0x0A
|
||||
if (writeMode) {
|
||||
this._slot3rom = false;
|
||||
this._debug('Slot 3 ROM Off');
|
||||
}
|
||||
break;
|
||||
case LOC.SLOTC3ROMON: // 0x0B
|
||||
if (writeMode) {
|
||||
this._slot3rom = true;
|
||||
this._debug('Slot 3 ROM On');
|
||||
}
|
||||
break;
|
||||
case LOC.DHIRESON:
|
||||
if (this._iouDisable) {
|
||||
this.vm.doubleHires(true);
|
||||
} else {
|
||||
result = this.io.ioSwitch(off, val); // an3
|
||||
}
|
||||
break;
|
||||
|
||||
// Graphics Switches
|
||||
case LOC.DHIRESOFF:
|
||||
if (this._iouDisable) {
|
||||
this.vm.doubleHires(false);
|
||||
} else {
|
||||
result = this.io.ioSwitch(off, val); // an3
|
||||
}
|
||||
break;
|
||||
|
||||
case LOC.CLR80VID:
|
||||
if (writeMode) {
|
||||
this._debug('80 Column Mode off');
|
||||
this.vm._80col(false);
|
||||
}
|
||||
break;
|
||||
case LOC.SET80VID:
|
||||
if (writeMode) {
|
||||
this._debug('80 Column Mode on');
|
||||
this.vm._80col(true);
|
||||
}
|
||||
break;
|
||||
case LOC.CLRALTCH:
|
||||
if (writeMode) {
|
||||
this._debug('Alt Char off');
|
||||
this.vm.altchar(false);
|
||||
}
|
||||
break;
|
||||
case LOC.SETALTCH:
|
||||
if (writeMode) {
|
||||
this._debug('Alt Char on');
|
||||
this.vm.altchar(true);
|
||||
}
|
||||
break;
|
||||
case LOC.PAGE1:
|
||||
this._page2 = false;
|
||||
if (!this._80store) {
|
||||
case LOC.SET_HIRES:
|
||||
this._hires = true;
|
||||
result = this.io.ioSwitch(off, val);
|
||||
}
|
||||
this._debug('Page 2 off');
|
||||
break;
|
||||
case LOC.PAGE2:
|
||||
this._page2 = true;
|
||||
if (!this._80store) {
|
||||
result = this.io.ioSwitch(off, val);
|
||||
}
|
||||
this._debug('Page 2 on');
|
||||
break;
|
||||
this._debug('Hires on');
|
||||
break;
|
||||
|
||||
case LOC.RESET_HIRES:
|
||||
this._hires = false;
|
||||
result = this.io.ioSwitch(off, val);
|
||||
this._debug('Hires off');
|
||||
break;
|
||||
case LOC.IOUDISON:
|
||||
if (writeMode) {
|
||||
this._iouDisable = true;
|
||||
}
|
||||
result = this._iouDisable ? 0x00 : 0x80;
|
||||
break;
|
||||
|
||||
case LOC.DHIRESON:
|
||||
if (this._iouDisable) {
|
||||
this.vm.doubleHires(true);
|
||||
} else {
|
||||
result = this.io.ioSwitch(off, val); // an3
|
||||
}
|
||||
break;
|
||||
case LOC.IOUDISOFF:
|
||||
if (writeMode) {
|
||||
this._iouDisable = false;
|
||||
}
|
||||
result = this.vm.isDoubleHires() ? 0x80 : 0x00;
|
||||
break;
|
||||
|
||||
case LOC.DHIRESOFF:
|
||||
if (this._iouDisable) {
|
||||
this.vm.doubleHires(false);
|
||||
} else {
|
||||
result = this.io.ioSwitch(off, val); // an3
|
||||
}
|
||||
break;
|
||||
// Language Card Switches
|
||||
|
||||
case LOC.SET_HIRES:
|
||||
this._hires = true;
|
||||
result = this.io.ioSwitch(off, val);
|
||||
this._debug('Hires on');
|
||||
break;
|
||||
case LOC.READBSR2: // 0xC080
|
||||
case LOC._READBSR2: // 0xC084
|
||||
this._bank1 = false;
|
||||
this._readbsr = true;
|
||||
this._writebsr = false;
|
||||
this._prewrite = false;
|
||||
// _debug('Bank 2 Read');
|
||||
break;
|
||||
case LOC.WRITEBSR2: // 0xC081
|
||||
case LOC._WRITEBSR2: // 0xC085
|
||||
this._bank1 = false;
|
||||
this._readbsr = false;
|
||||
if (readMode) { this._writebsr = this._prewrite; }
|
||||
this._prewrite = readMode;
|
||||
// _debug('Bank 2 Write');
|
||||
break;
|
||||
case LOC.OFFBSR2: // 0xC082
|
||||
case LOC._OFFBSR2: // 0xC086
|
||||
this._bank1 = false;
|
||||
this._readbsr = false;
|
||||
this._writebsr = false;
|
||||
this._prewrite = false;
|
||||
// _debug('Bank 2 Off');
|
||||
break;
|
||||
case LOC.READWRBSR2: // 0xC083
|
||||
case LOC._READWRBSR2: // 0xC087
|
||||
this._bank1 = false;
|
||||
this._readbsr = true;
|
||||
if (readMode) { this._writebsr = this._prewrite; }
|
||||
this._prewrite = readMode;
|
||||
// _debug('Bank 2 Read/Write');
|
||||
break;
|
||||
case LOC.READBSR1: // 0xC088
|
||||
case LOC._READBSR1: // 0xC08c
|
||||
this._bank1 = true;
|
||||
this._readbsr = true;
|
||||
this._writebsr = false;
|
||||
this._prewrite = false;
|
||||
// _debug('Bank 1 Read');
|
||||
break;
|
||||
case LOC.WRITEBSR1: // 0xC089
|
||||
case LOC._WRITEBSR1: // 0xC08D
|
||||
this._bank1 = true;
|
||||
this._readbsr = false;
|
||||
if (readMode) { this._writebsr = this._prewrite; }
|
||||
this._prewrite = readMode;
|
||||
// _debug('Bank 1 Write');
|
||||
break;
|
||||
case LOC.OFFBSR1: // 0xC08A
|
||||
case LOC._OFFBSR1: // 0xC08E
|
||||
this._bank1 = true;
|
||||
this._readbsr = false;
|
||||
this._writebsr = false;
|
||||
this._prewrite = false;
|
||||
// _debug('Bank 1 Off');
|
||||
break;
|
||||
case LOC.READWRBSR1: // 0xC08B
|
||||
case LOC._READWRBSR1: // 0xC08F
|
||||
this._bank1 = true;
|
||||
this._readbsr = true;
|
||||
if (readMode) { this._writebsr = this._prewrite; }
|
||||
this._prewrite = readMode;
|
||||
//_debug('Bank 1 Read/Write');
|
||||
break;
|
||||
|
||||
case LOC.IOUDISON:
|
||||
if (writeMode) {
|
||||
this._iouDisable = true;
|
||||
}
|
||||
result = this._iouDisable ? 0x00 : 0x80;
|
||||
break;
|
||||
// Status registers
|
||||
|
||||
case LOC.IOUDISOFF:
|
||||
if (writeMode) {
|
||||
this._iouDisable = false;
|
||||
}
|
||||
result = this.vm.isDoubleHires() ? 0x80 : 0x00;
|
||||
break;
|
||||
|
||||
// Language Card Switches
|
||||
|
||||
case LOC.READBSR2: // 0xC080
|
||||
case LOC._READBSR2: // 0xC084
|
||||
this._bank1 = false;
|
||||
this._readbsr = true;
|
||||
this._writebsr = false;
|
||||
this._prewrite = false;
|
||||
// _debug('Bank 2 Read');
|
||||
break;
|
||||
case LOC.WRITEBSR2: // 0xC081
|
||||
case LOC._WRITEBSR2: // 0xC085
|
||||
this._bank1 = false;
|
||||
this._readbsr = false;
|
||||
if (readMode) { this._writebsr = this._prewrite; }
|
||||
this._prewrite = readMode;
|
||||
// _debug('Bank 2 Write');
|
||||
break;
|
||||
case LOC.OFFBSR2: // 0xC082
|
||||
case LOC._OFFBSR2: // 0xC086
|
||||
this._bank1 = false;
|
||||
this._readbsr = false;
|
||||
this._writebsr = false;
|
||||
this._prewrite = false;
|
||||
// _debug('Bank 2 Off');
|
||||
break;
|
||||
case LOC.READWRBSR2: // 0xC083
|
||||
case LOC._READWRBSR2: // 0xC087
|
||||
this._bank1 = false;
|
||||
this._readbsr = true;
|
||||
if (readMode) { this._writebsr = this._prewrite; }
|
||||
this._prewrite = readMode;
|
||||
// _debug('Bank 2 Read/Write');
|
||||
break;
|
||||
case LOC.READBSR1: // 0xC088
|
||||
case LOC._READBSR1: // 0xC08c
|
||||
this._bank1 = true;
|
||||
this._readbsr = true;
|
||||
this._writebsr = false;
|
||||
this._prewrite = false;
|
||||
// _debug('Bank 1 Read');
|
||||
break;
|
||||
case LOC.WRITEBSR1: // 0xC089
|
||||
case LOC._WRITEBSR1: // 0xC08D
|
||||
this._bank1 = true;
|
||||
this._readbsr = false;
|
||||
if (readMode) { this._writebsr = this._prewrite; }
|
||||
this._prewrite = readMode;
|
||||
// _debug('Bank 1 Write');
|
||||
break;
|
||||
case LOC.OFFBSR1: // 0xC08A
|
||||
case LOC._OFFBSR1: // 0xC08E
|
||||
this._bank1 = true;
|
||||
this._readbsr = false;
|
||||
this._writebsr = false;
|
||||
this._prewrite = false;
|
||||
// _debug('Bank 1 Off');
|
||||
break;
|
||||
case LOC.READWRBSR1: // 0xC08B
|
||||
case LOC._READWRBSR1: // 0xC08F
|
||||
this._bank1 = true;
|
||||
this._readbsr = true;
|
||||
if (readMode) { this._writebsr = this._prewrite; }
|
||||
this._prewrite = readMode;
|
||||
//_debug('Bank 1 Read/Write');
|
||||
break;
|
||||
|
||||
// Status registers
|
||||
|
||||
case LOC.BSRBANK2:
|
||||
this._debug('Bank 2 Read ' + !this._bank1);
|
||||
result = !this._bank1 ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.BSRREADRAM:
|
||||
this._debug('Bank SW RAM Read ' + this._readbsr);
|
||||
result = this._readbsr ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.RAMRD: // 0xC013
|
||||
this._debug('Aux RAM Read ' + this._auxRamRead);
|
||||
result = this._auxRamRead ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RAMWRT: // 0xC014
|
||||
this._debug('Aux RAM Write ' + this._auxRamWrite);
|
||||
result = this._auxRamWrite ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.INTCXROM: // 0xC015
|
||||
case LOC.BSRBANK2:
|
||||
this._debug('Bank 2 Read ' + !this._bank1);
|
||||
result = !this._bank1 ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.BSRREADRAM:
|
||||
this._debug('Bank SW RAM Read ' + this._readbsr);
|
||||
result = this._readbsr ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.RAMRD: // 0xC013
|
||||
this._debug('Aux RAM Read ' + this._auxRamRead);
|
||||
result = this._auxRamRead ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RAMWRT: // 0xC014
|
||||
this._debug('Aux RAM Write ' + this._auxRamWrite);
|
||||
result = this._auxRamWrite ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.INTCXROM: // 0xC015
|
||||
// _debug('Int CX ROM ' + _intcxrom);
|
||||
result = this._intcxrom ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.ALTZP: // 0xC016
|
||||
this._debug('Alt ZP ' + this._altzp);
|
||||
result = this._altzp ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.SLOTC3ROM: // 0xC017
|
||||
this._debug('Slot C3 ROM ' + this._slot3rom);
|
||||
result = this._slot3rom ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC._80STORE: // 0xC018
|
||||
this._debug('80 Store ' + this._80store);
|
||||
result = this._80store ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.VERTBLANK: // 0xC019
|
||||
result = this._intcxrom ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.ALTZP: // 0xC016
|
||||
this._debug('Alt ZP ' + this._altzp);
|
||||
result = this._altzp ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.SLOTC3ROM: // 0xC017
|
||||
this._debug('Slot C3 ROM ' + this._slot3rom);
|
||||
result = this._slot3rom ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC._80STORE: // 0xC018
|
||||
this._debug('80 Store ' + this._80store);
|
||||
result = this._80store ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.VERTBLANK: // 0xC019
|
||||
// result = cpu.getCycles() % 20 < 5 ? 0x80 : 0x00;
|
||||
result = (this.cpu.getCycles() < this._vbEnd) ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.RDTEXT:
|
||||
result = this.vm.isText() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RDMIXED:
|
||||
result = this.vm.isMixed() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RDPAGE2:
|
||||
result = this.vm.isPage2() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RDHIRES:
|
||||
result = this.vm.isHires() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RD80VID:
|
||||
result = this.vm.is80Col() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RDALTCH:
|
||||
result = this.vm.isAltChar() ? 0x80 : 0x0;
|
||||
break;
|
||||
result = (this.cpu.getCycles() < this._vbEnd) ? 0x80 : 0x00;
|
||||
break;
|
||||
case LOC.RDTEXT:
|
||||
result = this.vm.isText() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RDMIXED:
|
||||
result = this.vm.isMixed() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RDPAGE2:
|
||||
result = this.vm.isPage2() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RDHIRES:
|
||||
result = this.vm.isHires() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RD80VID:
|
||||
result = this.vm.is80Col() ? 0x80 : 0x0;
|
||||
break;
|
||||
case LOC.RDALTCH:
|
||||
result = this.vm.isAltChar() ? 0x80 : 0x0;
|
||||
break;
|
||||
|
||||
default:
|
||||
debug('MMU missing register ' + toHex(off));
|
||||
break;
|
||||
default:
|
||||
debug('MMU missing register ' + toHex(off));
|
||||
break;
|
||||
}
|
||||
|
||||
if (result !== undefined)
|
||||
|
|
|
@ -362,23 +362,23 @@ export function updateKHz() {
|
|||
var khz;
|
||||
|
||||
switch (showStats) {
|
||||
case 0: {
|
||||
delta = cycles - lastCycles;
|
||||
khz = parseInt(delta/ms);
|
||||
document.querySelector('#khz').innerText = khz + ' kHz';
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
delta = stats.renderedFrames - lastRenderedFrames;
|
||||
fps = parseInt(delta/(ms/1000), 10);
|
||||
document.querySelector('#khz').innerText = fps + ' rps';
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
delta = stats.frames - lastFrames;
|
||||
fps = parseInt(delta/(ms/1000), 10);
|
||||
document.querySelector('#khz').innerText = fps + ' fps';
|
||||
}
|
||||
case 0: {
|
||||
delta = cycles - lastCycles;
|
||||
khz = parseInt(delta/ms);
|
||||
document.querySelector('#khz').innerText = khz + ' kHz';
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
delta = stats.renderedFrames - lastRenderedFrames;
|
||||
fps = parseInt(delta/(ms/1000), 10);
|
||||
document.querySelector('#khz').innerText = fps + ' rps';
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
delta = stats.frames - lastFrames;
|
||||
fps = parseInt(delta/(ms/1000), 10);
|
||||
document.querySelector('#khz').innerText = fps + ' fps';
|
||||
}
|
||||
}
|
||||
|
||||
startTime = now;
|
||||
|
|
|
@ -338,68 +338,68 @@ export default function KeyBoard(cpu, io, e) {
|
|||
this.classList.add('pressed');
|
||||
var key = this.dataset[shifted ? 'key2' : 'key1'];
|
||||
switch (key) {
|
||||
case 'BELL':
|
||||
key = 'G';
|
||||
break;
|
||||
case 'RETURN':
|
||||
key = '\r';
|
||||
break;
|
||||
case 'TAB':
|
||||
key = '\t';
|
||||
break;
|
||||
case 'DELETE':
|
||||
key = '\x7F';
|
||||
break;
|
||||
case '←':
|
||||
key = '\x08';
|
||||
break;
|
||||
case '→':
|
||||
key = '\x15';
|
||||
break;
|
||||
case '↓':
|
||||
key = '\x0A';
|
||||
break;
|
||||
case '↑':
|
||||
key = '\x0B';
|
||||
break;
|
||||
case ' ':
|
||||
key = ' ';
|
||||
break;
|
||||
case 'ESC':
|
||||
key = '\x1B';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 'BELL':
|
||||
key = 'G';
|
||||
break;
|
||||
case 'RETURN':
|
||||
key = '\r';
|
||||
break;
|
||||
case 'TAB':
|
||||
key = '\t';
|
||||
break;
|
||||
case 'DELETE':
|
||||
key = '\x7F';
|
||||
break;
|
||||
case '←':
|
||||
key = '\x08';
|
||||
break;
|
||||
case '→':
|
||||
key = '\x15';
|
||||
break;
|
||||
case '↓':
|
||||
key = '\x0A';
|
||||
break;
|
||||
case '↑':
|
||||
key = '\x0B';
|
||||
break;
|
||||
case ' ':
|
||||
key = ' ';
|
||||
break;
|
||||
case 'ESC':
|
||||
key = '\x1B';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (key.length > 1) {
|
||||
switch (key) {
|
||||
case 'SHIFT':
|
||||
self.shiftKey(!shifted);
|
||||
break;
|
||||
case 'CTRL':
|
||||
self.controlKey(!controlled);
|
||||
break;
|
||||
case 'CAPS':
|
||||
case 'LOCK':
|
||||
self.capslockKey(undefined);
|
||||
break;
|
||||
case 'POW':
|
||||
case 'POWER':
|
||||
if (window.confirm('Power Cycle?'))
|
||||
window.location.reload();
|
||||
break;
|
||||
case 'RESET':
|
||||
cpu.reset();
|
||||
break;
|
||||
case 'OPEN_APPLE':
|
||||
self.commandKey(!commanded);
|
||||
break;
|
||||
case 'CLOSED_APPLE':
|
||||
self.optionKey(!optioned);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 'SHIFT':
|
||||
self.shiftKey(!shifted);
|
||||
break;
|
||||
case 'CTRL':
|
||||
self.controlKey(!controlled);
|
||||
break;
|
||||
case 'CAPS':
|
||||
case 'LOCK':
|
||||
self.capslockKey(undefined);
|
||||
break;
|
||||
case 'POW':
|
||||
case 'POWER':
|
||||
if (window.confirm('Power Cycle?'))
|
||||
window.location.reload();
|
||||
break;
|
||||
case 'RESET':
|
||||
cpu.reset();
|
||||
break;
|
||||
case 'OPEN_APPLE':
|
||||
self.commandKey(!commanded);
|
||||
break;
|
||||
case 'CLOSED_APPLE':
|
||||
self.optionKey(!optioned);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (controlled && key >= '@' && key <= '_') {
|
||||
|
|
Loading…
Reference in New Issue