Cleanup and refactor I/O behavior.

This commit is contained in:
Will Scullin 2016-12-05 21:16:21 -08:00 committed by Will Scullin
parent e021c692ce
commit 0e80761a4d
14 changed files with 159 additions and 191 deletions

View File

@ -94,7 +94,7 @@ function Apple2IO(cpu, callbacks)
};
function _debug() {
debug.apply(arguments);
// debug.apply(this, arguments);
}
function _tick() {
@ -302,6 +302,7 @@ function Apple2IO(cpu, callbacks)
start: function apple2io_start() {
return 0xc0;
},
end: function apple2io_end() {
return 0xcf;
},
@ -312,17 +313,29 @@ function Apple2IO(cpu, callbacks)
result = _access(off, val);
} else {
var slot = (off & 0x70) >> 4;
if (_slot[slot]) {
result = _slot[slot].ioSwitch(off, val);
var card = _slot[slot];
if (card && card.ioSwitch) {
result = card.ioSwitch(off, val);
}
}
return result;
},
reset: function apple2io_reset() {
for (var slot = 0; slot < 8; slot++) {
var card = _slot[slot];
if (card && card.reset) {
card.reset();
}
}
},
read: function apple2io_read(page, off) {
var result = 0;
var slot;
var card;
switch (page) {
case 0xc0:
result = this.ioSwitch(off);
@ -335,9 +348,13 @@ function Apple2IO(cpu, callbacks)
case 0xc6:
case 0xc7:
slot = page & 0x0f;
_auxRom = _slot[slot];
if (_slot[slot]) {
result = _slot[slot].read(page, off);
card = _slot[slot];
if (_auxRom != card) {
// _debug('Setting auxRom to slot', slot);
_auxRom = card;
}
if (card) {
result = card.read(page, off);
}
break;
default:
@ -351,6 +368,8 @@ function Apple2IO(cpu, callbacks)
write: function apple2io_write(page, off, val) {
var slot;
var card;
switch (page) {
case 0xc0:
this.ioSwitch(off);
@ -363,9 +382,13 @@ function Apple2IO(cpu, callbacks)
case 0xc6:
case 0xc7:
slot = page & 0x0f;
_auxRom = _slot[slot];
if (_slot[slot]) {
_slot[slot].write(page, off, val);
card = _slot[slot];
if (_auxRom != card) {
// _debug('Setting auxRom to slot', slot);
_auxRom = card;
}
if (card) {
card.write(page, off, val);
}
break;
default:
@ -379,7 +402,7 @@ function Apple2IO(cpu, callbacks)
getState: function apple2io_getState() { return {}; },
setState: function apple2io_setState() { },
addSlot: function apple2io_addSlot(slot, card) {
setSlot: function apple2io_setSlot(slot, card) {
_slot[slot] = card;
},

View File

@ -9,13 +9,9 @@
* implied warranty.
*/
/*
* Text Page 1 Drawing
*/
/*globals allocMemPages: false,
base64_encode: false, base64_decode: false */
/*exported LoresPage, HiresPage, VideoModes*/
/*globals allocMemPages: false,
base64_encode: false, base64_decode: false */
/*exported LoresPage, HiresPage, VideoModes*/
var textMode = true;
var mixedMode = true;
@ -486,6 +482,10 @@ function VideoModes(gr,hgr,gr2,hgr2) {
_grs[1].green(on);
_hgrs[0].green(on);
_hgrs[1].green(on);
},
scanlines: function(on) {
scanlines = on;
_refresh();
}
};
}

View File

@ -15,7 +15,6 @@
enhanced: false */
/*exported LoresPage, HiresPage, VideoModes */
var textMode = true;
var mixedMode = false;
var hiresMode = false;
@ -586,7 +585,7 @@ function HiresPage(page)
b2 & 0x80, // 4
b3 & 0x80, // 5
b3 & 0x80, // 6
0]; // 7
0]; // 7
if (col > 0) {
c[0] = (bz & 0x78) >> 3;
hb[0] = bz & 0x80;
@ -948,6 +947,10 @@ function VideoModes(gr,hgr,gr2,hgr2) {
_grs[1].green(on);
_hgrs[0].green(on);
_hgrs[1].green(on);
},
scanlines: function(on) {
scanlines = on;
_refresh();
}
};
}

View File

@ -10,7 +10,7 @@
*/
/*exported DiskII */
/*globals bytify: false, each: false, extend: false, debug: false
/*globals bytify: false, debug: false
base64_decode: false, base64_encode: false
Uint8Array: false
*/
@ -112,9 +112,6 @@ function DiskII(io, slot, callbacks)
function _init() {
debug('Disk ][ in slot', slot);
each(LOC, function(key) {
LOC[key] += slot * 0x10;
});
}
/**
@ -162,12 +159,12 @@ function DiskII(io, slot, callbacks)
*/
checksum = volume ^ track ^ sector;
extend(buf, [0xd5, 0xaa, 0x96]); // Address Prolog D5 AA 96
extend(buf, _fourXfour(volume));
extend(buf, _fourXfour(track));
extend(buf, _fourXfour(sector));
extend(buf, _fourXfour(checksum));
extend(buf, [0xde, 0xaa, 0xeb]); // Epilog DE AA EB
buf = buf.concat([0xd5, 0xaa, 0x96]); // Address Prolog D5 AA 96
buf = buf.concat(_fourXfour(volume));
buf = buf.concat(_fourXfour(track));
buf = buf.concat(_fourXfour(sector));
buf = buf.concat(_fourXfour(checksum));
buf = buf.concat([0xde, 0xaa, 0xeb]); // Epilog DE AA EB
/*
* Gap 2 (5 bytes)
@ -181,7 +178,7 @@ function DiskII(io, slot, callbacks)
* Data Field
*/
extend(buf, [0xd5, 0xaa, 0xad]); // Data Prolog D5 AA AD
buf = buf.concat([0xd5, 0xaa, 0xad]); // Data Prolog D5 AA AD
var nibbles = [];
var ptr2 = 0;
@ -217,7 +214,7 @@ function DiskII(io, slot, callbacks)
}
buf.push(_trans[last]);
extend(buf, [0xde, 0xaa, 0xeb]); // Epilog DE AA EB
buf = buf.concat([0xde, 0xaa, 0xeb]); // Epilog DE AA EB
/*
* Gap 3
@ -261,7 +258,7 @@ function DiskII(io, slot, callbacks)
for (var s = 0; s < json.data[t].length; s++) {
var _s = 15 - s;
var d = base64_decode(json.data[t][_s]);
extend(track, _explodeSector(v, t, _DO[_s], d));
track = track.concat(_explodeSector(v, t, _DO[_s], d));
}
tracks[t] = bytify(track);
}
@ -410,7 +407,7 @@ function DiskII(io, slot, callbacks)
function _access(off, val) {
var result = 0;
switch (off) {
switch (off & 0x8f) {
case LOC.PHASE0OFF:
setPhase(0, false);
break;
@ -570,14 +567,6 @@ function DiskII(io, slot, callbacks)
_init();
return {
start: function disk2_start() {
return 0xc0 + slot;
},
end: function disk2_end() {
return 0xc0 + slot;
},
ioSwitch: function disk2_ioSwitch(off, val) {
return _access(off, val);
},
@ -697,14 +686,17 @@ function DiskII(io, slot, callbacks)
for (s = 0; s < data[t].length; s++) {
var _s = 15 - s;
if (fmt === 'po') { // ProDOS Order
extend(track,
_explodeSector(v, t, _PO[s], data[t][s]));
track = track.concat(
_explodeSector(v, t, _PO[s], data[t][s])
);
} else if (fmt === 'dsk') { // DOS Order
extend(track,
_explodeSector(v, t, _DO[_s], data[t][_s]));
track = track.concat(
_explodeSector(v, t, _DO[_s], data[t][_s])
);
} else { // flat
extend(track,
_explodeSector(v, t, s, data[t][s]));
track = track.concat(
_explodeSector(v, t, s, data[t][s])
);
}
}
}
@ -771,13 +763,15 @@ function DiskII(io, slot, callbacks)
if (fmt == 'po') { // ProDOS Order
off = (16 * t + s) * 256;
d = new Uint8Array(data.slice(off, off + 256));
extend(track,
_explodeSector(v, t, _PO[s], d));
track = track.concat(
_explodeSector(v, t, _PO[s], d)
);
} else if (fmt == 'dsk') { // DOS Order
off = (16 * t + _s) * 256;
d = new Uint8Array(data.slice(off, off + 256));
extend(track,
_explodeSector(v, t, _DO[_s], d));
track = track.concat(
_explodeSector(v, t, _DO[_s], d)
);
} else {
return false;
}

View File

@ -5,8 +5,7 @@
apple2_charset: false,
Apple2IO: false
LoresPage: false, HiresPage: false, VideoModes: false
scanlines: true,
KeyBoard: false,
KeyBoard2: false,
Parallel: false,
DiskII: false,
Printer: false,
@ -376,7 +375,7 @@ var dumper = new ApplesoftDump(cpu);
var drivelights = new DriveLights();
var io = new Apple2IO(cpu, vm);
var keyboard = new KeyBoard(io);
var keyboard = new KeyBoard2(io);
var lc = new LanguageCard(io, 0, rom);
var parallel = new Parallel(io, 1, new Printer());
var slinky = new RAMFactor(io, 2, 1024 * 1024);
@ -393,11 +392,11 @@ cpu.addPageHandler(ram3);
cpu.addPageHandler(io);
cpu.addPageHandler(lc);
io.addSlot(0, lc);
io.addSlot(1, parallel);
io.addSlot(2, slinky);
io.addSlot(6, disk2);
io.addSlot(7, clock);
io.setSlot(0, lc);
io.setSlot(1, parallel);
io.setSlot(2, slinky);
io.setSlot(6, disk2);
io.setSlot(7, clock);
var showFPS = false;
@ -805,8 +804,9 @@ function _keyup(evt) {
function updateScreen() {
var green = $('#green_screen').prop('checked');
scanlines = $('#show_scanlines').prop('checked');
var scanlines = $('#show_scanlines').prop('checked');
vm.scanlines(scanlines);
vm.green(green);
}

View File

@ -4,13 +4,11 @@
apple2e_charset: false,
Apple2IO: false
LoresPage: false, HiresPage: false, VideoModes: false,
scanlines: true,
KeyBoard: false,
KeyBoard2e: false,
Parallel: false,
DiskII: false,
Printer: false,
MMU: false,
Slot3: false,
RAMFactor: false,
Thunderclock: false,
Prefs: false,
@ -371,7 +369,7 @@ var dumper = new ApplesoftDump(cpu);
var drivelights = new DriveLights();
var io = new Apple2IO(cpu, vm);
var keyboard = new KeyBoard(io);
var keyboard = new KeyBoard2e(io);
var mmu = new MMU(cpu, gr, gr2, hgr, hgr2, io, rom);
@ -379,15 +377,13 @@ cpu.addPageHandler(mmu);
var parallel = new Parallel(io, 1, new Printer());
var slinky = new RAMFactor(io, 2, 1024 * 1024);
var slot3 = new Slot3(io, 3, rom);
var disk2 = new DiskII(io, 6, drivelights);
var clock = new Thunderclock(io, 7);
io.addSlot(1, parallel);
io.addSlot(2, slinky);
io.addSlot(3, slot3);
io.addSlot(6, disk2);
io.addSlot(7, clock);
io.setSlot(1, parallel);
io.setSlot(2, slinky);
io.setSlot(6, disk2);
io.setSlot(7, clock);
var showFPS = false;
@ -798,9 +794,10 @@ function _keyup(evt) {
function updateScreen() {
var green = $('#green_screen').prop('checked');
scanlines = $('#show_scanlines').prop('checked');
var scanlines = $('#show_scanlines').prop('checked');
vm.green(green);
vm.scanlines(scanlines);
}
var disableMouseJoystick = false;

118
js/mmu.js
View File

@ -125,7 +125,7 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
}
function _debug() {
debug.apply(arguments);
// debug.apply(this, arguments);
}
var _last = 0x00;
@ -167,20 +167,8 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
function AuxRom() {
return {
start: function() {
return 0xC1;
},
end: function() {
return 0xCF;
},
read: function(page, off) {
var result;
if (page == 0xc3) {
result = io.read(page, off);
} else {
result = rom.read(page, off);
}
return result;
return rom.read(page, off);
},
write: function() {}
};
@ -204,6 +192,8 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
new RAM(0xD0,0xDF), new RAM(0xD0,0xDF)];
var memE0_FF = [rom, new RAM(0xE0,0xFF), new RAM(0xE0,0xFF)];
io.setSlot(3, auxRom);
/*
* Initialize read/write banks
*/
@ -335,11 +325,6 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
for (idx = 0xc1; idx < 0xd0; idx++) {
_readPages[idx] = _pages[idx][0];
}
if (_slot3rom) {
_readPages[0xc3] = _pages[0xc3][1];
} else {
_readPages[0xc3] = _pages[0xc3][0];
}
}
if (_altzp) {
@ -404,84 +389,84 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
// Apple //e memory management
case LOC._80STOREOFF:
if (typeof val != 'undefined') {
if (val !== undefined) {
_80store = false;
// _debug("80 Store Off");
// _debug('80 Store Off');
} else {
// Chain to io for keyboard
result = io.ioSwitch(off, val);
}
break;
case LOC._80STOREON:
if (typeof val != 'undefined') {
if (val !== undefined) {
_80store = true;
// _debug("80 Store On");
// _debug('80 Store On');
} else
result = 0;
break;
case LOC.RAMRDOFF:
if (typeof val != 'undefined') {
if (val !== undefined) {
_auxRamRead = false;
_debug("Aux RAM Read Off");
_debug('Aux RAM Read Off');
} else
result = 0;
break;
case LOC.RAMRDON:
if (typeof val != 'undefined') {
if (val !== undefined) {
_auxRamRead = true;
_debug("Aux RAM Read On");
_debug('Aux RAM Read On');
} else
result = 0;
break;
case LOC.RAMWROFF:
if (typeof val != 'undefined') {
if (val !== undefined) {
_auxRamWrite = false;
_debug("Aux RAM Write Off");
_debug('Aux RAM Write Off');
} else
result = 0;
break;
case LOC.RAMWRON:
if (typeof val != 'undefined') {
if (val !== undefined) {
_auxRamWrite = true;
_debug("Aux RAM Write On");
_debug('Aux RAM Write On');
} else
result = 0;
break;
case LOC.INTCXROMOFF:
if (typeof val != 'undefined') {
if (val !== undefined) {
_intcxrom = false;
// _debug("Int CX ROM Off");
// _debug('Int CX ROM Off');
}
break;
case LOC.INTCXROMON:
if (typeof val != 'undefined') {
if (val !== undefined) {
_intcxrom = true;
// _debug("Int CX ROM On");
// _debug('Int CX ROM On');
}
break;
case LOC.ALTZPOFF: // 0x08
if (typeof val != 'undefined') {
if (val !== undefined) {
_altzp = false;
_debug("Alt ZP Off");
_debug('Alt ZP Off');
}
break;
case LOC.ALTZPON: // 0x09
if (typeof val != 'undefined') {
if (val !== undefined) {
_altzp = true;
_debug("Alt ZP On");
_debug('Alt ZP On');
}
break;
case LOC.SLOTC3ROMOFF:
if (typeof val != 'undefined') {
_slot3rom = false;
_debug("Slot 3 ROM Off");
_debug('Slot 3 ROM Off');
}
break;
case LOC.SLOTC3ROMON:
if (typeof val != 'undefined') {
if (val !== undefined) {
_slot3rom = true;
_debug("Slot 3 ROM On");
_debug('Slot 3 ROM On');
}
break;
@ -489,11 +474,15 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
case LOC.PAGE1:
_page2 = false;
if (!_80store) result = io.ioSwitch(off, val);
if (!_80store) {
result = io.ioSwitch(off, val);
}
break;
case LOC.PAGE2:
_page2 = true;
if (!_80store) result = io.ioSwitch(off, val);
if (!_80store) {
result = io.ioSwitch(off, val);
}
break;
// Language Card Switches
@ -503,89 +492,90 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
_bank1 = false;
_readbsr = true;
_writebsr = false;
_debug("Bank 2 Read");
_debug('Bank 2 Read');
break;
case LOC.WRITEBSR2: // 0xC081
case LOC._WRITEBSR2:
_bank1 = false;
_readbsr = false;
_writebsr = _writebsr || ((_last & 0xF3) == (off & 0xF3));
_debug("Bank 2 Write");
_debug('Bank 2 Write');
break;
case LOC.OFFBSR2: // 0xC082
case LOC._OFFBSR2:
_bank1 = false;
_readbsr = false;
_writebsr = false;
_debug("Bank 2 Off");
_debug('Bank 2 Off');
break;
case LOC.READWRBSR2: // 0xC083
case LOC._READWRBSR2:
_bank1 = false;
_readbsr = true;
_writebsr = _writebsr || ((_last & 0xF3) == (off & 0xF3));
_debug("Bank 2 Read/Write");
_debug('Bank 2 Read/Write');
break;
case LOC.READBSR1: // 0xC088
case LOC._READBSR1:
_bank1 = true;
_readbsr = true;
_writebsr = false;
_debug("Bank 1 Read");
_debug('Bank 1 Read');
break;
case LOC.WRITEBSR1: // 0xC089
case LOC._WRITEBSR1:
_bank1 = true;
_readbsr = false;
_writebsr = _writebsr || ((_last & 0xF3) == (off & 0xF3));
_debug("Bank 1 Write");
_debug('Bank 1 Write');
break;
case LOC.OFFBSR1: // 0xC08A
case LOC._OFFBSR1:
_bank1 = true;
_readbsr = false;
_writebsr = false;
_debug("Bank 1 Off");
_debug('Bank 1 Off');
break;
case LOC.READWRBSR1: // 0xC08B
case LOC._READWRBSR1:
_bank1 = true;
_readbsr = true;
_writebsr = _writebsr || ((_last & 0xF3) == (off & 0xF3));
_debug("Bank 1 Read/Write");
_debug('Bank 1 Read/Write');
break;
// Status registers
case LOC.BSRBANK2:
_debug("Bank 2 Read " + !_bank1);
_debug('Bank 2 Read ' + !_bank1);
result = !_bank1 ? 0x80 : 0x00;
break;
case LOC.BSRREADRAM:
_debug("Bank SW RAM Read " + _readbsr);
_debug('Bank SW RAM Read ' + _readbsr);
result = _readbsr ? 0x80 : 0x00;
break;
case LOC.RAMRD: // 0xC013
_debug("Aux RAM Read " + _auxRamRead);
_debug('Aux RAM Read ' + _auxRamRead);
result = _auxRamRead ? 0x80 : 0x0;
break;
case LOC.RAMWRT: // 0xC014
_debug("Aux RAM Write " + _auxRamWrite);
_debug('Aux RAM Write ' + _auxRamWrite);
result = _auxRamWrite ? 0x80 : 0x0;
break;
case LOC.INTCXROM: // 0xC015
// _debug("Int CX ROM " + _intcxrom);
// _debug('Int CX ROM ' + _intcxrom);
result = _intcxrom ? 0x80 : 0x00;
break;
case LOC.ALTZP: // 0xC016
_debug("Alt ZP " + _altzp);
_debug('Alt ZP ' + _altzp);
result = _altzp ? 0x80 : 0x0;
break;
case LOC.SLOTC3ROM: // 0xC017
_debug("Slot C3 ROM " + _slot3rom);
result = _slot3rom ? 0x00 : 0x80;
_debug('Slot C3 ROM ' + _slot3rom);
result = _slot3rom ? 0x80 : 0x00;
break;
case LOC._80STORE: // 0xC018
_debug('80 Store ' + _80store);
result = _80store ? 0x80 : 0x00;
break;
case LOC.VERTBLANK: // 0xC019
@ -594,7 +584,7 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
break;
default:
debug("MMU missing register " + toHex(off));
debug('MMU missing register ' + toHex(off));
break;
}
_last = off;
@ -622,13 +612,9 @@ function MMU(cpu, lores1, lores2, hires1, hires2, io, rom)
return 0xff;
},
reset: function() {
debug('reset');
_initSwitches();
_updateBanks();
for (idx = 0xc1; idx < 0xc8; idx++) {
if ('reset' in _pages[idx][0]) {
_pages[idx][0].reset();
}
}
},
read: function mmu_read(page, off, debug) {
return _readPages[page].read(page, off, debug);

View File

@ -58,21 +58,17 @@ function Parallel(io, slot, cbs) {
0xff,0xf0,0x03,0xfe,0x38,0x07,0x70,0x84
];
LOC.IOREG += 0x10 * slot;
function _access(off, val) {
if (off == LOC.IOREG && val && 'putChar' in cbs) {
cbs.putChar(val);
switch (off) {
case LOC.IOREG:
if (val && 'putChar' in cbs) {
cbs.putChar(val);
}
break;
}
}
return {
start: function() {
return 0xc0 + slot;
},
end: function() {
return 0xc0 + slot;
},
ioSwitch: function (off, val) {
return _access(off, val);
},

View File

@ -10,7 +10,7 @@
*/
/*exported RAMFactor */
/*globals allocMem: false, bytify: false, debug: false, each: false,
/*globals allocMem: false, bytify: false, debug: false,
base64_encode: false, base64_decode: false
*/
function RAMFactor(io, slot, size) {
@ -1068,9 +1068,6 @@ function RAMFactor(io, slot, size) {
function _init() {
debug('RAMFactor card in slot', slot);
each(LOC, function(key) {
LOC[key] += slot * 0x10;
});
mem = allocMem(size);
for (var off = 0; off < size; off++) {
mem[off] = 0;
@ -1098,7 +1095,7 @@ function RAMFactor(io, slot, size) {
function _access(off, val) {
var result = 0;
switch (off) {
switch (off & 0x8f) {
case LOC.RAMLO:
case LOC._RAMLO:
if (val !== undefined) {
@ -1159,13 +1156,6 @@ function RAMFactor(io, slot, size) {
_init();
return {
start: function ramfactor_start() {
io.registerSwitches(this, LOC);
return 0xc0 + slot;
},
end: function ramfactor_end() {
return 0xc0 + slot;
},
ioSwitch: function (off, val) {
return _access(off, val);
},

View File

@ -10,7 +10,7 @@
*/
/*exported Thunderclock */
/*global debug: false, each: false */
/*global debug: false */
function Thunderclock(io, slot)
{
@ -288,10 +288,6 @@ function Thunderclock(io, slot)
function _init() {
debug('Thunderclock card in slot', slot);
each(LOC, function(key) {
LOC[key] += slot * 0x10;
});
}
var _command = 0;
@ -327,7 +323,7 @@ function Thunderclock(io, slot)
}
function _access(off, val) {
switch (off) {
switch (off & 0x8F) {
case LOC.CONTROL:
if (val !== undefined) {
if ((val & FLAGS.STROBE) !== 0) {
@ -360,18 +356,12 @@ function Thunderclock(io, slot)
_init();
return {
start: function thunderclock_start() {
return 0xc0 + slot;
},
end: function thunderclock_end() {
return 0xc0 + slot;
},
read: function thunderclock_read(page, off) {
var result;
if (page < 0xc8) {
result = rom[off];
} else {
result = rom[(page - 0xc8) * 256 + off];
result = rom[(page - 0xc8) << 8 | off];
}
return result;
},

View File

@ -10,9 +10,9 @@
*/
/*globals debug: false, toHex: false, reset: false */
/*exported KeyBoard */
/*exported KeyBoard2 */
function KeyBoard(io) {
function KeyBoard2(io) {
// keycode: [plain, cntl, shift]
var keymap = {
// Most of these won't happen

View File

@ -1,4 +1,3 @@
/* Copyright 2010-2016 Will Scullin <scullin@scullinsteel.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -12,9 +11,9 @@
/*jshint jquery: true, browser: true */
/*globals debug: false, toHex: false */
/*exported KeyBoard */
/*exported KeyBoard2e */
function KeyBoard(io) {
function KeyBoard2e(io) {
// keycode: [plain, cntl, shift]
var keymap = {
// Most of these won't happen

View File

@ -10,7 +10,7 @@
*/
/*eslint no-console: 0*/
/*exported allocMemPages, bytify, debug, each extend, gup, hup, toBinary, toHex
/*exported allocMemPages, bytify, debug, each, gup, hup, toBinary, toHex
*/
/*global Uint8Array: false */
@ -45,13 +45,6 @@ function bytify(ary) {
return result;
}
function extend(ary1, ary2) {
ary2.forEach(function(val) {
ary1.push(val);
});
return ary1;
}
function debug() {
if (typeof console != 'undefined' && 'log' in console) {
console.log.apply(console, arguments);

View File

@ -1,6 +1,6 @@
#!/usr/bin/env perl -w
# Copyright 2010-2016 Will Scullin <scullin@scullinsteel.com>
#
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
@ -27,14 +27,11 @@ while (<json/disks/*.json>) {
open(DISK, $fn) or die $!;
while (<DISK>) {
my $line = $_;
$line =~ s/^loadJSON\(//;
$line =~ s/\);$//;
$json .= $line;
}
close(DISK);
$disk = from_json($json);
$disk->{'filename'} = $fn;
$disk->{'data'} = NULL;