mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Enforce strict equality (#115)
This commit is contained in:
parent
41015864f2
commit
2bd7fa59b7
@ -17,6 +17,7 @@
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"eqeqeq": ["error", "smart"],
|
||||
"prefer-const": [
|
||||
"error"
|
||||
],
|
||||
|
@ -217,7 +217,7 @@ export default class Apple2IO implements MemoryPages, Restorable<Apple2IOState>
|
||||
}
|
||||
break;
|
||||
case LOC.TAPEIN:
|
||||
if (this._tapeOffset == -1) {
|
||||
if (this._tapeOffset === -1) {
|
||||
this._tapeOffset = 0;
|
||||
this._tapeNext = now;
|
||||
}
|
||||
@ -248,7 +248,7 @@ export default class Apple2IO implements MemoryPages, Restorable<Apple2IOState>
|
||||
}
|
||||
if (this._buffer.length > 0) {
|
||||
let val = this._buffer.shift() as string;
|
||||
if (val == '\n') {
|
||||
if (val === '\n') {
|
||||
val = '\r';
|
||||
}
|
||||
this._key = val.charCodeAt(0) | 0x80;
|
||||
@ -343,7 +343,7 @@ export default class Apple2IO implements MemoryPages, Restorable<Apple2IOState>
|
||||
case 0xc7:
|
||||
slot = page & 0x0f;
|
||||
card = this._slot[slot];
|
||||
if (this._auxRom != card) {
|
||||
if (this._auxRom !== card) {
|
||||
// _debug('Setting auxRom to slot', slot);
|
||||
this._auxRom = card;
|
||||
}
|
||||
@ -379,7 +379,7 @@ export default class Apple2IO implements MemoryPages, Restorable<Apple2IOState>
|
||||
case 0xc7:
|
||||
slot = page & 0x0f;
|
||||
card = this._slot[slot];
|
||||
if (this._auxRom != card) {
|
||||
if (this._auxRom !== card) {
|
||||
// _debug('Setting auxRom to slot', slot);
|
||||
this._auxRom = card;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ export default class ApplesoftCompiler {
|
||||
let foundToken = '';
|
||||
let tokenIdx = -1;
|
||||
for (const possibleToken in TOKENS) {
|
||||
if (possibleToken.charAt(0) == character) {
|
||||
if (possibleToken.charAt(0) === character) {
|
||||
tokenIdx = curChar + 1;
|
||||
let idx = 1;
|
||||
while (idx < possibleToken.length) {
|
||||
@ -234,7 +234,7 @@ export default class ApplesoftCompiler {
|
||||
break;
|
||||
case STATES.STRING:
|
||||
result.push(character.charCodeAt(0));
|
||||
if (character == '"') {
|
||||
if (character === '"') {
|
||||
state = STATES.NORMAL;
|
||||
}
|
||||
curChar++;
|
||||
|
@ -111,10 +111,10 @@ export function base64_decode(data: string | null | undefined): memory | undefin
|
||||
o3 = bits & 0xff;
|
||||
|
||||
tmp_arr[ac++] = o1;
|
||||
if (h3 != 64) {
|
||||
if (h3 !== 64) {
|
||||
tmp_arr[ac++] = o2;
|
||||
}
|
||||
if (h4 != 64) {
|
||||
if (h4 !== 64) {
|
||||
tmp_arr[ac++] = o3;
|
||||
}
|
||||
} while (i < data.length);
|
||||
|
44
js/canvas.ts
44
js/canvas.ts
@ -148,7 +148,7 @@ export class LoresPage2D implements LoresPage {
|
||||
let inverse = false;
|
||||
if (this.e) {
|
||||
if (!this.vm._80colMode && !this.vm.altCharMode) {
|
||||
inverse = ((val & 0xc0) == 0x40) && this._blink;
|
||||
inverse = ((val & 0xc0) === 0x40) && this._blink;
|
||||
}
|
||||
} else {
|
||||
inverse = !((val & 0x80) || (val & 0x40) && this._blink);
|
||||
@ -192,7 +192,7 @@ export class LoresPage2D implements LoresPage {
|
||||
const base = addr & 0x3FF;
|
||||
let fore, back;
|
||||
|
||||
if (this._buffer[bank][base] == val && !this._refreshing) {
|
||||
if (this._buffer[bank][base] === val && !this._refreshing) {
|
||||
return;
|
||||
}
|
||||
this._buffer[bank][base] = val;
|
||||
@ -288,7 +288,7 @@ export class LoresPage2D implements LoresPage {
|
||||
let color;
|
||||
if (colorMode) {
|
||||
if (b & 0x80) {
|
||||
if ((b & 0x1c0) != 0x80) {
|
||||
if ((b & 0x1c0) !== 0x80) {
|
||||
color = whiteCol;
|
||||
} else {
|
||||
color = odd ? violetCol : greenCol;
|
||||
@ -395,7 +395,7 @@ export class LoresPage2D implements LoresPage {
|
||||
this._blink = !this._blink;
|
||||
for (let idx = 0; idx < 0x400; idx++, addr++) {
|
||||
const b = this._buffer[0][idx];
|
||||
if ((b & 0xC0) == 0x40) {
|
||||
if ((b & 0xC0) === 0x40) {
|
||||
this._write(addr >> 8, addr & 0xff, this._buffer[0][idx], 0);
|
||||
}
|
||||
}
|
||||
@ -575,7 +575,7 @@ export class HiresPage2D implements HiresPage {
|
||||
const addr = (page << 8) | off;
|
||||
const base = addr & 0x1FFF;
|
||||
|
||||
if (this._buffer[bank][base] == val && !this._refreshing) {
|
||||
if (this._buffer[bank][base] === val && !this._refreshing) {
|
||||
return;
|
||||
}
|
||||
this._buffer[bank][base] = val;
|
||||
@ -695,16 +695,16 @@ export class HiresPage2D implements HiresPage {
|
||||
} else if (this.colorDHRMode) {
|
||||
this._drawHalfPixel(data, offset, dcolor);
|
||||
} else if (
|
||||
((c[idx] != c[idx - 1]) && (c[idx] != c[idx + 1])) &&
|
||||
(((bits & 0x1c) == 0x1c) ||
|
||||
((bits & 0x70) == 0x70) ||
|
||||
((bits & 0x38) == 0x38))
|
||||
((c[idx] !== c[idx - 1]) && (c[idx] !== c[idx + 1])) &&
|
||||
(((bits & 0x1c) === 0x1c) ||
|
||||
((bits & 0x70) === 0x70) ||
|
||||
((bits & 0x38) === 0x38))
|
||||
) {
|
||||
this._drawHalfPixel(data, offset, whiteCol);
|
||||
} else if (
|
||||
(bits & 0x38) ||
|
||||
(c[idx] == c[idx + 1]) ||
|
||||
(c[idx] == c[idx - 1])
|
||||
(c[idx] === c[idx + 1]) ||
|
||||
(c[idx] === c[idx - 1])
|
||||
) {
|
||||
this._drawHalfPixel(data, offset, dcolor);
|
||||
} else if (bits & 0x28) {
|
||||
@ -786,9 +786,9 @@ export class HiresPage2D implements HiresPage {
|
||||
|
||||
refresh() {
|
||||
this.highColorHGRMode = !this.vm.an3State && this.vm.hiresMode && !this.vm._80colMode;
|
||||
this.oneSixtyMode = this.vm.flag == 1 && this.vm.doubleHiresMode;
|
||||
this.mixedDHRMode = this.vm.flag == 2 && this.vm.doubleHiresMode;
|
||||
this.monoDHRMode = this.vm.flag == 3 && this.vm.doubleHiresMode;
|
||||
this.oneSixtyMode = this.vm.flag === 1 && this.vm.doubleHiresMode;
|
||||
this.mixedDHRMode = this.vm.flag === 2 && this.vm.doubleHiresMode;
|
||||
this.monoDHRMode = this.vm.flag === 3 && this.vm.doubleHiresMode;
|
||||
|
||||
let addr = 0x2000 * this.page;
|
||||
this._refreshing = true;
|
||||
@ -922,7 +922,7 @@ export class VideoModes2D implements VideoModes {
|
||||
if (on) {
|
||||
this.flag = 0;
|
||||
}
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -933,7 +933,7 @@ export class VideoModes2D implements VideoModes {
|
||||
const old = this._80colMode;
|
||||
this._80colMode = on;
|
||||
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -943,7 +943,7 @@ export class VideoModes2D implements VideoModes {
|
||||
|
||||
const old = this.altCharMode;
|
||||
this.altCharMode = on;
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -955,7 +955,7 @@ export class VideoModes2D implements VideoModes {
|
||||
this.flag = 0;
|
||||
}
|
||||
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -970,7 +970,7 @@ export class VideoModes2D implements VideoModes {
|
||||
this.flag = ((this.flag << 1) | (this._80colMode ? 0x0 : 0x1)) & 0x3;
|
||||
}
|
||||
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -982,7 +982,7 @@ export class VideoModes2D implements VideoModes {
|
||||
mixed(on: boolean) {
|
||||
const old = this.mixedMode;
|
||||
this.mixedMode = on;
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -990,7 +990,7 @@ export class VideoModes2D implements VideoModes {
|
||||
page(pageNo: pageNo) {
|
||||
const old = this.pageMode;
|
||||
this.pageMode = pageNo;
|
||||
if (old != pageNo) {
|
||||
if (old !== pageNo) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -1004,7 +1004,7 @@ export class VideoModes2D implements VideoModes {
|
||||
}
|
||||
|
||||
isPage2() {
|
||||
return this.pageMode == 2;
|
||||
return this.pageMode === 2;
|
||||
}
|
||||
|
||||
isHires() {
|
||||
|
@ -387,8 +387,8 @@ export default class DiskII implements Card {
|
||||
this.debug('Disk ][');
|
||||
|
||||
this.lastCycles = this.io.cycles();
|
||||
this.bootstrapRom = this.sectors == 16 ? BOOTSTRAP_ROM_16 : BOOTSTRAP_ROM_13;
|
||||
this.sequencerRom = this.sectors == 16 ? SEQUENCER_ROM_16 : SEQUENCER_ROM_13;
|
||||
this.bootstrapRom = this.sectors === 16 ? BOOTSTRAP_ROM_16 : BOOTSTRAP_ROM_13;
|
||||
this.sequencerRom = this.sectors === 16 ? SEQUENCER_ROM_16 : SEQUENCER_ROM_13;
|
||||
|
||||
this.initWorker();
|
||||
}
|
||||
@ -413,7 +413,7 @@ export default class DiskII implements Card {
|
||||
|
||||
while (workCycles-- > 0) {
|
||||
let pulse: number = 0;
|
||||
if (this.clock == 4) {
|
||||
if (this.clock === 4) {
|
||||
pulse = track[this.cur.head];
|
||||
if (!pulse) {
|
||||
// More that 2 zeros can not be read reliably.
|
||||
@ -463,7 +463,7 @@ export default class DiskII implements Card {
|
||||
}
|
||||
this.state = (command >> 4 & 0xF) as nibble;
|
||||
|
||||
if (this.clock == 4) {
|
||||
if (this.clock === 4) {
|
||||
if (this.on) {
|
||||
if (this.q7) {
|
||||
track[this.cur.head] = this.state & 0x8 ? 0x01 : 0x00;
|
||||
|
@ -125,7 +125,7 @@ export default class SmartPort implements Card, MassStorage, Restorable<SmartPor
|
||||
|
||||
constructor(private cpu: CPU6502, options: SmartPortOptions) {
|
||||
if (options?.block) {
|
||||
const dumbPortRom = new Uint8Array(smartPortRom);
|
||||
const dumbPortRom = new Uint8Array(smartPortRom);
|
||||
dumbPortRom[0x07] = 0x3C;
|
||||
this.rom = dumbPortRom;
|
||||
debug('DumbPort card');
|
||||
@ -152,7 +152,7 @@ export default class SmartPort implements Card, MassStorage, Restorable<SmartPor
|
||||
result += toHex(idx << 4, 4) + ': ';
|
||||
for (jdx = 0; jdx < 16; jdx++) {
|
||||
b = this.disks[drive].blocks[block][idx * 16 + jdx];
|
||||
if (jdx == 8) {
|
||||
if (jdx === 8) {
|
||||
result += ' ';
|
||||
}
|
||||
result += toHex(b) + ' ';
|
||||
@ -160,7 +160,7 @@ export default class SmartPort implements Card, MassStorage, Restorable<SmartPor
|
||||
result += ' ';
|
||||
for (jdx = 0; jdx < 16; jdx++) {
|
||||
b = this.disks[drive].blocks[block][idx * 16 + jdx] & 0x7f;
|
||||
if (jdx == 8) {
|
||||
if (jdx === 8) {
|
||||
result += ' ';
|
||||
}
|
||||
if (b >= 0x20 && b < 0x7f) {
|
||||
@ -355,7 +355,7 @@ export default class SmartPort implements Card, MassStorage, Restorable<SmartPor
|
||||
this.formatDevice(state, unit);
|
||||
break;
|
||||
}
|
||||
} else if (off == smartOff && this.cpu.getSync()) {
|
||||
} else if (off === smartOff && this.cpu.getSync()) {
|
||||
this.debug('smartport entry');
|
||||
const stackAddr = new Address(this.cpu, state.sp + 1, 0x01);
|
||||
let blocks;
|
||||
@ -521,7 +521,7 @@ export default class SmartPort implements Card, MassStorage, Restorable<SmartPor
|
||||
setBinary(drive: number, name: string, fmt: string, rawData: ArrayBuffer) {
|
||||
const volume = 254;
|
||||
const readOnly = false;
|
||||
if (fmt == '2mg') {
|
||||
if (fmt === '2mg') {
|
||||
const { bytes, offset } = read2MGHeader(rawData);
|
||||
rawData = rawData.slice(offset, offset + bytes);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ export default class Videoterm implements Card, Restorable<VideotermState> {
|
||||
const startPos =
|
||||
this.regs[REGS.STARTPOS_HI] << 8 |
|
||||
this.regs[REGS.STARTPOS_LO];
|
||||
if (this.startPos != startPos) {
|
||||
if (this.startPos !== startPos) {
|
||||
this.startPos = startPos;
|
||||
this.shouldRefresh = true;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ export function createDiskFromJsonDisk(disk: JSONDisk): FloppyDisk | null {
|
||||
|
||||
if (includes(NIBBLE_FORMATS, fmt)) {
|
||||
let trackData: memory[][];
|
||||
if (disk.encoding == 'base64') {
|
||||
if (disk.encoding === 'base64') {
|
||||
trackData = [];
|
||||
for (let t = 0; t < disk.data.length; t++) {
|
||||
trackData[t] = [];
|
||||
|
@ -330,7 +330,7 @@ export function explodeSector13(volume: byte, track: byte, sector: byte, data: m
|
||||
* @returns An array of sector data bytes.
|
||||
*/
|
||||
export function readSector(disk: NibbleDisk, track: byte, sector: byte): memory {
|
||||
const _sector = disk.format == 'po' ? _PO[sector] : _DO[sector];
|
||||
const _sector = disk.format === 'po' ? _PO[sector] : _DO[sector];
|
||||
let val, state = 0;
|
||||
let idx = 0;
|
||||
let retry = 0;
|
||||
@ -372,7 +372,7 @@ export function readSector(disk: NibbleDisk, track: byte, sector: byte): memory
|
||||
t = defourXfour(_readNext(), _readNext());
|
||||
s = defourXfour(_readNext(), _readNext());
|
||||
checkSum = defourXfour(_readNext(), _readNext());
|
||||
if (checkSum != (v ^ t ^ s)) {
|
||||
if (checkSum !== (v ^ t ^ s)) {
|
||||
debug('Invalid header checksum:', toHex(v), toHex(t), toHex(s), toHex(checkSum));
|
||||
}
|
||||
_skipBytes(3); // Skip footer
|
||||
@ -471,7 +471,7 @@ export function jsonDecode(data: string): NibbleDisk {
|
||||
for (let t = 0; t < json.data.length; t++) {
|
||||
let track: byte[] = [];
|
||||
for (let s = 0; s < json.data[t].length; s++) {
|
||||
const _s = json.type == 'po' ? PO[s] : DO[s];
|
||||
const _s = json.type === 'po' ? PO[s] : DO[s];
|
||||
const sector: string = json.data[t][_s];
|
||||
const d = base64_decode(sector);
|
||||
track = track.concat(explodeSector16(v, t, s, d));
|
||||
@ -532,7 +532,7 @@ export function analyseDisk(disk: NibbleDisk) {
|
||||
t = defourXfour(_readNext(), _readNext());
|
||||
s = defourXfour(_readNext(), _readNext());
|
||||
checkSum = defourXfour(_readNext(), _readNext());
|
||||
if (checkSum != (v ^ t ^ s)) {
|
||||
if (checkSum !== (v ^ t ^ s)) {
|
||||
debug('Invalid header checksum:', toHex(v), toHex(t), toHex(s), toHex(checkSum));
|
||||
} else {
|
||||
outStr += toHex(s, 1);
|
||||
|
26
js/gl.ts
26
js/gl.ts
@ -75,7 +75,7 @@ export class LoresPageGL implements LoresPage {
|
||||
let inverse = false;
|
||||
if (this.e) {
|
||||
if (!this.vm._80colMode && !this.vm.altCharMode) {
|
||||
inverse = ((val & 0xc0) == 0x40) && this._blink;
|
||||
inverse = ((val & 0xc0) === 0x40) && this._blink;
|
||||
}
|
||||
} else {
|
||||
inverse = !((val & 0x80) || (val & 0x40) && this._blink);
|
||||
@ -119,7 +119,7 @@ export class LoresPageGL implements LoresPage {
|
||||
const base = addr & 0x3FF;
|
||||
let fore, back;
|
||||
|
||||
if (this._buffer[bank][base] == val && !this._refreshing) {
|
||||
if (this._buffer[bank][base] === val && !this._refreshing) {
|
||||
return;
|
||||
}
|
||||
this._buffer[bank][base] = val;
|
||||
@ -264,7 +264,7 @@ export class LoresPageGL implements LoresPage {
|
||||
this._blink = !this._blink;
|
||||
for (let idx = 0; idx < 0x400; idx++, addr++) {
|
||||
const b = this._buffer[0][idx];
|
||||
if ((b & 0xC0) == 0x40) {
|
||||
if ((b & 0xC0) === 0x40) {
|
||||
this._write(addr >> 8, addr & 0xff, this._buffer[0][idx], 0);
|
||||
}
|
||||
}
|
||||
@ -418,7 +418,7 @@ export class HiresPageGL implements HiresPage {
|
||||
const addr = (page << 8) | off;
|
||||
const base = addr & 0x1FFF;
|
||||
|
||||
if (this._buffer[bank][base] == val && !this._refreshing) {
|
||||
if (this._buffer[bank][base] === val && !this._refreshing) {
|
||||
return;
|
||||
}
|
||||
this._buffer[bank][base] = val;
|
||||
@ -476,7 +476,7 @@ export class HiresPageGL implements HiresPage {
|
||||
}
|
||||
let bits = val;
|
||||
for (let idx = 0; idx < 7; idx++, offset += 8) {
|
||||
const drawPixel = cropLastPixel && idx == 6
|
||||
const drawPixel = cropLastPixel && idx === 6
|
||||
? this._drawHalfPixel
|
||||
: this._drawPixel;
|
||||
if (bits & 0x01) {
|
||||
@ -666,7 +666,7 @@ export class VideoModesGL implements VideoModes {
|
||||
const old = this.textMode;
|
||||
this.textMode = on;
|
||||
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -677,7 +677,7 @@ export class VideoModesGL implements VideoModes {
|
||||
const old = this._80colMode;
|
||||
this._80colMode = on;
|
||||
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -687,7 +687,7 @@ export class VideoModesGL implements VideoModes {
|
||||
|
||||
const old = this.altCharMode;
|
||||
this.altCharMode = on;
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -696,7 +696,7 @@ export class VideoModesGL implements VideoModes {
|
||||
const old = this.hiresMode;
|
||||
this.hiresMode = on;
|
||||
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -707,7 +707,7 @@ export class VideoModesGL implements VideoModes {
|
||||
const old = this.an3State;
|
||||
this.an3State = on;
|
||||
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -719,7 +719,7 @@ export class VideoModesGL implements VideoModes {
|
||||
mixed(on: boolean) {
|
||||
const old = this.mixedMode;
|
||||
this.mixedMode = on;
|
||||
if (old != on) {
|
||||
if (old !== on) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -727,7 +727,7 @@ export class VideoModesGL implements VideoModes {
|
||||
page(pageNo: pageNo) {
|
||||
const old = this.pageMode;
|
||||
this.pageMode = pageNo;
|
||||
if (old != pageNo) {
|
||||
if (old !== pageNo) {
|
||||
this._refresh();
|
||||
}
|
||||
}
|
||||
@ -741,7 +741,7 @@ export class VideoModesGL implements VideoModes {
|
||||
}
|
||||
|
||||
isPage2() {
|
||||
return this.pageMode == 2;
|
||||
return this.pageMode === 2;
|
||||
}
|
||||
|
||||
isHires() {
|
||||
|
@ -179,7 +179,7 @@ export default class IntBasicDump
|
||||
}
|
||||
else if (val > 0x80)
|
||||
str += LETTERS[val - 0x80];
|
||||
} while (val != 0x01);
|
||||
} while (val !== 0x01);
|
||||
str += '\n';
|
||||
} while (addr < himem);
|
||||
|
||||
|
@ -101,11 +101,11 @@ class AuxRom implements Memory {
|
||||
private readonly rom: ROM) { }
|
||||
|
||||
_access(page: byte, off: byte) {
|
||||
if (page == 0xc3) {
|
||||
if (page === 0xc3) {
|
||||
this.mmu._setIntc8rom(true);
|
||||
this.mmu._updateBanks();
|
||||
}
|
||||
if (page == 0xcf && off == 0xff) {
|
||||
if (page === 0xcf && off === 0xff) {
|
||||
this.mmu._setIntc8rom(false);
|
||||
this.mmu._updateBanks();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ export default class ROM implements MemoryPages, Restorable<ROMState> {
|
||||
private readonly endPage: byte,
|
||||
private readonly rom: rom) {
|
||||
const expectedLength = (endPage-startPage+1) * 256;
|
||||
if (rom.length != expectedLength) {
|
||||
if (rom.length !== expectedLength) {
|
||||
throw Error(`rom does not have the correct length: expected ${expectedLength} was ${rom.length}`);
|
||||
}
|
||||
}
|
||||
|
@ -181,10 +181,10 @@ export function handleDrop(drive: number, event: DragEvent) {
|
||||
}
|
||||
}
|
||||
const dt = event.dataTransfer!;
|
||||
if (dt.files.length == 1) {
|
||||
if (dt.files.length === 1) {
|
||||
const runOnLoad = event.shiftKey;
|
||||
doLoadLocal(drive as DriveNumber, dt.files[0], { runOnLoad });
|
||||
} else if (dt.files.length == 2) {
|
||||
} else if (dt.files.length === 2) {
|
||||
doLoadLocal(1, dt.files[0]);
|
||||
doLoadLocal(2, dt.files[1]);
|
||||
} else {
|
||||
@ -255,7 +255,7 @@ export function doLoad(event: MouseEvent|KeyboardEvent) {
|
||||
const urls = select.value;
|
||||
let url;
|
||||
if (urls && urls.length) {
|
||||
if (typeof (urls) == 'string') {
|
||||
if (typeof (urls) === 'string') {
|
||||
url = urls;
|
||||
} else {
|
||||
url = urls[0];
|
||||
@ -264,15 +264,15 @@ export function doLoad(event: MouseEvent|KeyboardEvent) {
|
||||
|
||||
const localFile = document.querySelector<HTMLInputElement>('#local_file')!;
|
||||
const files = localFile.files;
|
||||
if (files && files.length == 1) {
|
||||
if (files && files.length === 1) {
|
||||
const runOnLoad = event.shiftKey;
|
||||
doLoadLocal(_currentDrive, files[0], { runOnLoad });
|
||||
} else if (url) {
|
||||
let filename;
|
||||
MicroModal.close('load-modal');
|
||||
if (url.substr(0, 6) == 'local:') {
|
||||
if (url.substr(0, 6) === 'local:') {
|
||||
filename = url.substr(6);
|
||||
if (filename == '__manage') {
|
||||
if (filename === '__manage') {
|
||||
openManage();
|
||||
} else {
|
||||
loadLocalStorage(_currentDrive, filename);
|
||||
@ -711,7 +711,7 @@ function buildDiskIndex() {
|
||||
if (file.e && !_e) {
|
||||
continue;
|
||||
}
|
||||
if (cat != oldCat) {
|
||||
if (cat !== oldCat) {
|
||||
option = document.createElement('option');
|
||||
option.value = cat;
|
||||
option.innerText = cat;
|
||||
@ -751,7 +751,7 @@ function processHash(hash: string) {
|
||||
if (file.indexOf('://') > 0) {
|
||||
const parts = file.split('.');
|
||||
const ext = parts[parts.length - 1].toLowerCase();
|
||||
if (ext == 'json') {
|
||||
if (ext === 'json') {
|
||||
loadAjax(drive, file);
|
||||
} else {
|
||||
doLoadHTTP(drive, file);
|
||||
@ -763,7 +763,7 @@ function processHash(hash: string) {
|
||||
}
|
||||
|
||||
export function updateUI() {
|
||||
if (document.location.hash != hashtag) {
|
||||
if (document.location.hash !== hashtag) {
|
||||
hashtag = document.location.hash;
|
||||
const hash = hup();
|
||||
if (hash) {
|
||||
|
@ -24,13 +24,13 @@ export class JoyStick implements OptionHandler {
|
||||
document.querySelectorAll('canvas').forEach((canvas) => {
|
||||
canvas.addEventListener('mousedown', (evt) => {
|
||||
if (!this.gamepad && !mouseMode) {
|
||||
io.buttonDown(evt.which == 1 ? 0 : 1);
|
||||
io.buttonDown(evt.which === 1 ? 0 : 1);
|
||||
}
|
||||
evt.preventDefault();
|
||||
});
|
||||
canvas.addEventListener('mouseup', (evt) => {
|
||||
if (!this.gamepad && !mouseMode) {
|
||||
io.buttonUp(evt.which == 1 ? 0 : 1);
|
||||
io.buttonUp(evt.which === 1 ? 0 : 1);
|
||||
}
|
||||
});
|
||||
canvas.addEventListener('contextmenu', (evt) => {
|
||||
|
@ -240,7 +240,7 @@ export default class KeyBoard {
|
||||
} else if (isKeyboardCode(code)) {
|
||||
key = keymap[code][evt.shiftKey ? 2 : (evt.ctrlKey ? 1 : 0)];
|
||||
|
||||
if (code != 20 && this.capslockKeyUsed) {
|
||||
if (code !== 20 && this.capslockKeyUsed) {
|
||||
this.capslockKey(evt.getModifierState('CapsLock'));
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ export default class KeyBoard {
|
||||
debug('Unhandled key = ' + toHex(code));
|
||||
}
|
||||
|
||||
if (key == 0x7F && evt.shiftKey && evt.ctrlKey) {
|
||||
if (key === 0x7F && evt.shiftKey && evt.ctrlKey) {
|
||||
this.cpu.reset();
|
||||
key = 0xff;
|
||||
}
|
||||
@ -321,7 +321,7 @@ export default class KeyBoard {
|
||||
capslockKey(down?: boolean | undefined) {
|
||||
const capsLock = this.kb.querySelector('.key-LOCK');
|
||||
|
||||
if (arguments.length == 0) {
|
||||
if (arguments.length === 0) {
|
||||
if (this.capslockKeyUsed) {
|
||||
this.capslocked = !this.capslocked;
|
||||
} else {
|
||||
@ -354,7 +354,7 @@ export default class KeyBoard {
|
||||
const buildLabel = (k: string) => {
|
||||
const span = document.createElement('span');
|
||||
span.innerHTML = k;
|
||||
if (k.length > 1 && k.substr(0, 1) != '&')
|
||||
if (k.length > 1 && k.substr(0, 1) !== '&')
|
||||
span.classList.add('small');
|
||||
return span;
|
||||
};
|
||||
@ -377,17 +377,17 @@ export default class KeyBoard {
|
||||
key.classList.add('key-' + key1.replace(/[&#;]/g, ''));
|
||||
|
||||
if (key1.length > 1) {
|
||||
if (key1 == 'LOCK')
|
||||
if (key1 === 'LOCK')
|
||||
key.classList.add('v-center2');
|
||||
else
|
||||
key.classList.add('v-center');
|
||||
}
|
||||
if (key1 != key2) {
|
||||
if (key1 !== key2) {
|
||||
key.classList.add('key-' + key2.replace(/[&;]/g, ''));
|
||||
label.append(label2);
|
||||
label.append(document.createElement('br'));
|
||||
}
|
||||
if (key1 == 'LOCK') {
|
||||
if (key1 === 'LOCK') {
|
||||
key.classList.add('active');
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ export default class Tape {
|
||||
datum = data[idx];
|
||||
if ((datum > 0.1) || (datum < -0.1)) {
|
||||
current = (datum > 0.0);
|
||||
if (current != old) {
|
||||
if (current !== old) {
|
||||
delta = idx - last;
|
||||
if (delta > 2000000) {
|
||||
delta = 2000000;
|
||||
|
@ -12,7 +12,7 @@ describe('CPU', function () {
|
||||
|
||||
function traceCB() {
|
||||
const pc = cpu.getPC();
|
||||
done = lastPC == pc;
|
||||
done = lastPC === pc;
|
||||
lastPC = pc;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ describe('DOS-13 format', () => {
|
||||
// From Beneith Apple DOS, GAP 1 should have 12-85 0xFF bytes
|
||||
const track = disk.tracks[0];
|
||||
let numFF = 0;
|
||||
while (track[numFF] == 0xFF && numFF < 0x100) {
|
||||
while (track[numFF] === 0xFF && numFF < 0x100) {
|
||||
numFF++;
|
||||
}
|
||||
expect(numFF).toBeGreaterThanOrEqual(40);
|
||||
|
@ -58,7 +58,7 @@ describe('DOS format', () => {
|
||||
// From Beneith Apple DOS, GAP 1 should have 12-85 0xFF bytes
|
||||
const track = disk.tracks[0];
|
||||
let numFF = 0;
|
||||
while (track[numFF] == 0xFF && numFF < 0x100) {
|
||||
while (track[numFF] === 0xFF && numFF < 0x100) {
|
||||
numFF++;
|
||||
}
|
||||
expect(numFF).toBeGreaterThanOrEqual(40);
|
||||
|
@ -58,7 +58,7 @@ describe('ProDOS format', () => {
|
||||
// From Beneith Apple DOS, GAP 1 should have 12-85 0xFF bytes
|
||||
const track = disk.tracks[0];
|
||||
let numFF = 0;
|
||||
while (track[numFF] == 0xFF && numFF < 0x100) {
|
||||
while (track[numFF] === 0xFF && numFF < 0x100) {
|
||||
numFF++;
|
||||
}
|
||||
expect(numFF).toBeGreaterThanOrEqual(40);
|
||||
|
@ -3,10 +3,10 @@ import { memory } from 'js/types';
|
||||
export function skipGap(track: memory, start: number = 0): number {
|
||||
const end = start + 0x100; // no gap is this big
|
||||
let i = start;
|
||||
while (i < end && track[i] == 0xFF) {
|
||||
while (i < end && track[i] === 0xFF) {
|
||||
i++;
|
||||
}
|
||||
if (i == end) {
|
||||
if (i === end) {
|
||||
fail(`found more than 0x100 0xFF bytes after ${start}`);
|
||||
}
|
||||
return i;
|
||||
@ -14,7 +14,7 @@ export function skipGap(track: memory, start: number = 0): number {
|
||||
|
||||
export function compareSequences(track: memory, bytes: number[], pos: number): boolean {
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
if (track[i + pos] != bytes[i]) {
|
||||
if (track[i + pos] !== bytes[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ describe('allocMem', () => {
|
||||
it('has garbage in the right places', () => {
|
||||
const memory = allocMem(0x800);
|
||||
for (let i = 0; i < 0x800; i += 0x200) {
|
||||
const passed = memory[i + 0x28] != 0xff
|
||||
&& memory[i + 0x29] != 0xff
|
||||
&& memory[i + 0x68] != 0xff
|
||||
&& memory[i + 0x69] != 0xff;
|
||||
const passed = memory[i + 0x28] !== 0xff
|
||||
&& memory[i + 0x29] !== 0xff
|
||||
&& memory[i + 0x68] !== 0xff
|
||||
&& memory[i + 0x69] !== 0xff;
|
||||
if (passed) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user