ES6 checkpoint

This commit is contained in:
Jeff 2017-09-30 19:29:24 -07:00 committed by Jeff Parsons
commit 0d6a50641b
5 changed files with 1383 additions and 1196 deletions

View file

@ -0,0 +1,127 @@
940 REM The IBM Personal Computer Music
950 REM Version 1.00 (C)Copyright IBM Corp 1981
960 REM Licensed Material - Program Property of IBM
975 DEF SEG: POKE 106,0
980 SAMPLES$ = "NO"
990 GOTO 1010
1000 SAMPLES$ = "YES"
1010 KEY OFF:SCREEN 0,1:COLOR 15,0,0:WIDTH 40:CLS:LOCATE 5,19:PRINT "IBM"
1020 LOCATE 7,12,0:PRINT "Personal Computer"
1030 COLOR 10,0:LOCATE 10,9,0:PRINT CHR$(213)+STRING$(21,205)+CHR$(184)
1040 LOCATE 11,9,0:PRINT CHR$(179)+" MUSIC "+CHR$(179)
1050 LOCATE 12,9,0:PRINT CHR$(179)+STRING$(21,32)+CHR$(179)
1060 LOCATE 13,9,0:PRINT CHR$(179)+" Version 1.00 "+CHR$(179)
1070 LOCATE 14,9,0:PRINT CHR$(212)+STRING$(21,205)+CHR$(190)
1080 COLOR 15,0:LOCATE 17,7,0:PRINT "(C) Copyright IBM Corp 1981"
1090 COLOR 14,0:LOCATE 23,7,0:PRINT "Press space bar to continue"
1100 IF INKEY$ <> "" THEN GOTO 1100
1110 CMD$ = INKEY$
1120 IF CMD$ = "" THEN GOTO 1110
1130 IF CMD$ = CHR$(27) THEN GOTO 1850
1140 IF CMD$ <> " " THEN GOTO 1110
1141 ON ERROR GOTO 1148
1142 PLAY "mf"
1143 GOTO 1149
1148 RESUME 1149
1149 ON ERROR GOTO 0
1150 SCREEN 0,1:WIDTH 40:COLOR 15,1,1:CLS
1160 LOCATE 15,7,0:PRINT " ------- selections -------"
1170 LOCATE 16,7,0:PRINT " A-MARCH E-HUMOR I-SAKURA"
1180 LOCATE 17,7,0:PRINT " B-STARS F-BUG J-BLUE "
1190 LOCATE 18,7,0:PRINT " C-FORTY G-POP K-SCALES"
1191 LOCATE 19,7,0:PRINT " D-HAT H-DANDY ESC KEY-EXIT"
1200 COLOR 15,0
1210 FOR I=0 TO 15:FOR J=0 TO 8
1220 LOCATE 5+J,5+I*2,0:PRINT CHR$(219);CHR$(221);
1230 NEXT J:NEXT I
1240 FOR I=0 TO 12:FOR J=0 TO 4
1250 IF I=2 OR I=6 OR I=9 OR I=13 THEN GOTO 1270
1260 LOCATE 5+J,8+I*2:PRINT CHR$(32);CHR$(222);
1270 NEXT J:NEXT I
1280 FOR J=0 TO 9
1290 LOCATE 4+J,4:COLOR 4,0:PRINT CHR$(221);:LOCATE 4+J,36:COLOR 15,0
1300 PRINT CHR$(221);:COLOR 4,1:PRINT CHR$(221);
1310 NEXT J
1320 COLOR 4,1:LOCATE 4,4
1330 FOR I=0 TO 32:PRINT CHR$(219);:NEXT I
1340 PRINT CHR$(221);:LOCATE 13,4
1350 FOR I=0 TO 32:PRINT CHR$(219);:NEXT I
1360 PRINT CHR$(221);:COLOR 0,7:DEFINT M,N,O,P:DIM M(88),O(70)
1370 FOR I=7 TO 88:M(I) = 36.8*(2^(1/12))^(I-6):NEXT I
1380 FOR I=0 TO 6:M(I) = 32767:NEXT I
1390 O(0) = 0
1400 O(39)=5:O(40)=7:O(41)=8:O(42)=9
1410 O(43)=10:O(44)=11:O(45)=13:O(46)=14
1420 O(47)=15:O(48)=16:O(49)=17:O(50)=18
1430 O(51)=19:O(52)=21:O(53)=22:O(54)=23
1440 O(55)=24:O(56)=25:O(57)=27:O(58)=28
1450 O(59)=29:O(60)=30:O(61)=31:O(62)=32
1460 O(63)=33:O(64)=35:O(65)=36:O(66)=37
1470 O(67)=38:O(68)=39:O(69)=40:O(70)=42
1480 GOTO 1630
1490 READ J,K
1500 CMD$ = INKEY$:IF CMD$="" THEN GOTO 1540
1510 IF CMD$=CHR$(27) THEN RETURN
1520 POKE 106,0
1530 REM
1540 IF J = -1 THEN RETURN
1550 Q = O(J)
1560 IF J>64 OR J<39 THEN GOTO 1590
1570 IF SCREEN(5,Q)<>32 THEN COLOR 0,7:LOCATE 11,Q:PRINT CHR$(14);:COLOR 15,0:GOTO 1590
1580 COLOR 15,0:LOCATE 7,Q:PRINT CHR$(14);:COLOR 0,7
1590 SOUND M(J),K:IF J=0 AND K=1 THEN GOTO 1600:'SKIP NEXT FOR STACCATTO
1595 SOUND 32767,1
1600 IF J>64 OR J<39 THEN GOTO 1490
1610 IF SCREEN(5,Q) = 32 THEN COLOR 15,0:LOCATE 7,Q:PRINT CHR$(32);:GOTO 1490
1620 COLOR 15,0:LOCATE 11,Q:PRINT CHR$(219);:GOTO 1490
1630 LOCATE 21,5:PRINT " ";
1640 LOCATE 21,5:PRINT "ENTER SELECTION ==>";
1650 IF INKEY$ <> "" THEN GOTO 1650
1660 CMD$=INKEY$:IF CMD$="" THEN GOTO 1660
1670 IF CMD$=CHR$(27) THEN GOTO 1850
1680 IF CMD$="A" THEN S$= "MARCH ":GOTO 1770
1681 IF CMD$="a" THEN S$= "MARCH ":GOTO 1770
1690 IF CMD$="B" THEN S$= "STARS ":GOTO 1770
1691 IF CMD$="b" THEN S$= "STARS ":GOTO 1770
1700 IF CMD$="C" THEN S$= "FORTY ":GOTO 1770
1701 IF CMD$="c" THEN S$= "FORTY ":GOTO 1770
1710 IF CMD$="D" THEN S$= "HAT ":GOTO 1770
1711 IF CMD$="d" THEN S$= "HAT ":GOTO 1770
1720 IF CMD$="E" THEN S$= "HUMOR ":GOTO 1770
1721 IF CMD$="e" THEN S$= "HUMOR ":GOTO 1770
1730 IF CMD$="F" THEN S$= "BUG ":GOTO 1770
1731 IF CMD$="f" THEN S$= "BUG ":GOTO 1770
1740 IF CMD$="G" THEN S$= "POP ":GOTO 1770
1741 IF CMD$="g" THEN S$= "POP ":GOTO 1770
1750 IF CMD$="H" THEN S$= "DANDY ":GOTO 1770
1751 IF CMD$="h" THEN S$= "DANDY ":GOTO 1770
1755 IF CMD$="I" THEN S$= "SAKURA":GOTO 1770
1756 IF CMD$="i" THEN S$= "SAKURA":GOTO 1770
1757 IF CMD$="J" THEN S$= "BLUE ":GOTO 1770
1758 IF CMD$="j" THEN S$= "BLUE ":GOTO 1770
1761 IF CMD$="K" THEN S$= "SCALES":GOTO 1770
1762 IF CMD$="k" THEN S$= "SCALES":GOTO 1770
1769 GOTO 1640
1770 PRINT " ";CMD$;"-";S$:CHAIN MERGE S$,1780,ALL
1780 RESTORE:READ D
1790 IF D<>-2 THEN RESTORE:GOTO 1810
1800 READ S$:LOCATE 23,1+(40.5-LEN(S$))/2
1805 COLOR 15,4:PRINT S$;:COLOR 0,7
1810 GOSUB 1490
1820 S$=STRING$(39," "):LOCATE 23,1:COLOR 4,1:PRINT S$:COLOR 0,7
1830 GOTO 1630
1840 END
1850 IF SAMPLES$="YES" THEN CHAIN "SAMPLES",1000
1860 SCREEN 0,1:COLOR 7,0,0:CLS:END
3000 REM The IBM Personal Computer Music Scroll
3010 REM Version 1.00 (C)Copyright IBM Corp 1981
3020 REM Licensed Material - Program Property of IBM
3030 DATA -2,"FUNERAL MARCH OF A MARIONETTE - GOUNOD"
3040 DATA 37,1,0,2,30,1,0,5,42,3,42,3,41,3,39,3,41,3,0,3,42,3,44,3,0,3,37,1,0,2
3050 DATA 30,1,0,5,42,3,42,3,41,3,39,3,41,3,0,3,42,3,44,3,0,3,37,3,42,3,0,3,45,3
3060 DATA 49,6,47,3,45,3,0,3,49,3,52,6,50,3,49,3,0,3,53,3,56,6,54,3,53,3,50,3
3070 DATA 49,3,47,3,45,3,44,3,30,1,0,5,42,3,42,3,41,3,39,3,41,3,0,3,42,3,44,3
3080 DATA 0,3,37,1,0,2,30,1,0,5,42,3,42,3,41,3,39,3,41,3,0,3,42,3,44,3,0,3
3090 DATA 37,3,45,3,0,3,49,3,52,6,50,3,49,3,47,3,45,3,43,3,47,3,50,3,42,3
3100 DATA 41,3,42,3,44,3,0,3,45,1,0,2,44,9,42,1
3110 DATA -1,-1

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -193,10 +193,10 @@ class Bus extends Component {
*/
initMemory()
{
var block = new Memory();
let block = new Memory();
block.copyBreakpoints(this.dbg);
this.aMemBlocks = new Array(this.nBlockTotal);
for (var iBlock = 0; iBlock < this.nBlockTotal; iBlock++) {
for (let iBlock = 0; iBlock < this.nBlockTotal; iBlock++) {
this.aMemBlocks[iBlock] = block;
}
this.cpu.initMemory(this.aMemBlocks, this.nBlockShift);
@ -270,15 +270,15 @@ class Bus extends Component {
*/
addMemory(addr, size, type, controller)
{
var addrNext = addr;
var sizeLeft = size;
var iBlock = addrNext >>> this.nBlockShift;
let addrNext = addr;
let sizeLeft = size;
let iBlock = addrNext >>> this.nBlockShift;
while (sizeLeft > 0 && iBlock < this.aMemBlocks.length) {
var block = this.aMemBlocks[iBlock];
var addrBlock = iBlock * this.nBlockSize;
var sizeBlock = this.nBlockSize - (addrNext - addrBlock);
let block = this.aMemBlocks[iBlock];
let addrBlock = iBlock * this.nBlockSize;
let sizeBlock = this.nBlockSize - (addrNext - addrBlock);
if (sizeBlock > sizeLeft) sizeBlock = sizeLeft;
if (block && block.size) {
@ -295,7 +295,7 @@ class Bus extends Component {
return true;
}
if (addrNext >= block.addr + block.used) {
var sizeAvail = block.size - (addrNext - addrBlock);
let sizeAvail = block.size - (addrNext - addrBlock);
if (sizeAvail > sizeLeft) sizeAvail = sizeLeft;
block.used = addrNext - block.addr + sizeAvail;
addrNext = addrBlock + this.nBlockSize;
@ -307,7 +307,7 @@ class Bus extends Component {
return this.reportError(Bus.ERROR.ADD_MEM_INUSE, addrNext, sizeLeft);
}
var blockNew = new Memory(addrNext, sizeBlock, this.nBlockSize, type, controller);
let blockNew = new Memory(addrNext, sizeBlock, this.nBlockSize, type, controller);
blockNew.copyBreakpoints(this.dbg, block);
this.aMemBlocks[iBlock++] = blockNew;
@ -326,8 +326,8 @@ class Bus extends Component {
*/
this.cpu.flushPageBlocks();
if (!this.cpu.isRunning()) { // allocation messages at "run time" are bit too much
var kb = (size / 1024)|0;
var sb = kb? (kb + "Kb ") : (size + " bytes ");
let kb = (size / 1024)|0;
let sb = kb? (kb + "Kb ") : (size + " bytes ");
this.status(sb + Memory.TYPE.NAMES[type] + " at " + Str.toHex(addr));
}
return true;
@ -345,9 +345,9 @@ class Bus extends Component {
*/
cleanMemory(addr, size)
{
var fClean = true;
var iBlock = addr >>> this.nBlockShift;
var sizeBlock = this.nBlockSize - (addr & this.nBlockLimit);
let fClean = true;
let iBlock = addr >>> this.nBlockShift;
let sizeBlock = this.nBlockSize - (addr & this.nBlockLimit);
while (size > 0 && iBlock < this.aMemBlocks.length) {
if (this.aMemBlocks[iBlock].fDirty) {
this.aMemBlocks[iBlock].fDirty = fClean = false;
@ -377,16 +377,16 @@ class Bus extends Component {
if (size == null) size = (this.addrTotal - addr) | 0;
if (info == null) info = {cbTotal: 0, cBlocks: 0, aBlocks: []};
var iBlock = addr >>> this.nBlockShift;
var iBlockMax = ((addr + size - 1) >>> this.nBlockShift);
let iBlock = addr >>> this.nBlockShift;
let iBlockMax = ((addr + size - 1) >>> this.nBlockShift);
info.cbTotal = 0;
info.cBlocks = 0;
while (iBlock <= iBlockMax) {
var block = this.aMemBlocks[iBlock];
let block = this.aMemBlocks[iBlock];
info.cbTotal += block.size;
if (block.size) {
var btmod = (BACKTRACK && block.modBackTrack(false)? 1 : 0);
let btmod = (BACKTRACK && block.modBackTrack(false)? 1 : 0);
info.aBlocks.push(Usr.initBitFields(Bus.BlockInfo, iBlock, 0, btmod, block.type));
info.cBlocks++
}
@ -440,7 +440,7 @@ class Bus extends Component {
}
}
else if (this.nBusWidth > 20) {
var addrMask = (this.nBusMask & ~0x100000) | (fEnable? 0x100000 : 0);
let addrMask = (this.nBusMask & ~0x100000) | (fEnable? 0x100000 : 0);
if (addrMask != this.nBusMask) {
this.nBusMask = addrMask;
if (this.cpu) this.cpu.setAddressMask(addrMask);
@ -476,9 +476,9 @@ class Bus extends Component {
setMemoryAccess(addr, size, afn, fQuiet)
{
if (!(addr & this.nBlockLimit) && size && !(size & this.nBlockLimit)) {
var iBlock = addr >>> this.nBlockShift;
let iBlock = addr >>> this.nBlockShift;
while (size > 0) {
var block = this.aMemBlocks[iBlock];
let block = this.aMemBlocks[iBlock];
if (!block.controller) {
return this.reportError(Bus.ERROR.SET_MEM_NOCTRL, addr, size, fQuiet);
}
@ -506,10 +506,10 @@ class Bus extends Component {
removeMemory(addr, size)
{
if (!(addr & this.nBlockLimit) && size && !(size & this.nBlockLimit)) {
var iBlock = addr >>> this.nBlockShift;
let iBlock = addr >>> this.nBlockShift;
while (size > 0) {
var blockOld = this.aMemBlocks[iBlock];
var blockNew = new Memory(addr);
let blockOld = this.aMemBlocks[iBlock];
let blockNew = new Memory(addr);
blockNew.copyBreakpoints(this.dbg, blockOld);
this.aMemBlocks[iBlock++] = blockNew;
addr = iBlock * this.nBlockSize;
@ -540,8 +540,8 @@ class Bus extends Component {
*/
getMemoryBlocks(addr, size)
{
var aBlocks = [];
var iBlock = addr >>> this.nBlockShift;
let aBlocks = [];
let iBlock = addr >>> this.nBlockShift;
while (size > 0 && iBlock < this.aMemBlocks.length) {
aBlocks.push(this.aMemBlocks[iBlock++]);
size -= this.nBlockSize;
@ -566,14 +566,14 @@ class Bus extends Component {
*/
setMemoryBlocks(addr, size, aBlocks, type)
{
var i = 0;
var iBlock = addr >>> this.nBlockShift;
let i = 0;
let iBlock = addr >>> this.nBlockShift;
while (size > 0 && iBlock < this.aMemBlocks.length) {
var block = aBlocks[i++];
let block = aBlocks[i++];
this.assert(block);
if (!block) break;
if (type !== undefined) {
var blockNew = new Memory(addr);
let blockNew = new Memory(addr);
blockNew.clone(block, type, this.dbg);
block = blockNew;
}
@ -621,8 +621,8 @@ class Bus extends Component {
*/
getShort(addr)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let off = addr & this.nBlockLimit;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off != this.nBlockLimit) {
return this.aMemBlocks[iBlock].readShort(off, addr);
}
@ -640,8 +640,8 @@ class Bus extends Component {
*/
getShortDirect(addr)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let off = addr & this.nBlockLimit;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off != this.nBlockLimit) {
return this.aMemBlocks[iBlock].readShortDirect(off, addr);
}
@ -659,8 +659,8 @@ class Bus extends Component {
*/
getLong(addr)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let off = addr & this.nBlockLimit;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off < this.nBlockLimit - 2) {
return this.aMemBlocks[iBlock].readLong(off, addr);
}
@ -670,9 +670,9 @@ class Bus extends Component {
* which may have also created some undesirable side-effects for custom memory controllers.
* This simpler (and probably more reliable) approach is to simply read the long as individual bytes.
*/
var l = 0;
var cb = 4, nShift = 0;
var cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
let l = 0;
let cb = 4, nShift = 0;
let cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
while (cb--) {
l |= (this.aMemBlocks[iBlock].readByte(off++, addr++) << nShift);
if (!--cbBlock) {
@ -724,8 +724,8 @@ class Bus extends Component {
*/
setShort(addr, w)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let off = addr & this.nBlockLimit;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off != this.nBlockLimit) {
this.aMemBlocks[iBlock].writeShort(off, w & 0xffff, addr);
return;
@ -746,8 +746,8 @@ class Bus extends Component {
*/
setShortDirect(addr, w)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let off = addr & this.nBlockLimit;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off != this.nBlockLimit) {
this.aMemBlocks[iBlock].writeShortDirect(off, w & 0xffff, addr);
return;
@ -767,8 +767,8 @@ class Bus extends Component {
*/
setLong(addr, l)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let off = addr & this.nBlockLimit;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off < this.nBlockLimit - 2) {
this.aMemBlocks[iBlock].writeLong(off, l);
return;
@ -779,8 +779,8 @@ class Bus extends Component {
* block), which may have also created some undesirable side-effects for custom memory controllers.
* This simpler (and probably more reliable) approach is to simply write the long as individual bytes.
*/
var cb = 4;
var cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
let cb = 4;
let cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
while (cb--) {
this.aMemBlocks[iBlock].writeByte(off++, l & 0xff, addr++);
if (!--cbBlock) {
@ -808,7 +808,7 @@ class Bus extends Component {
addBackTrackObject(obj, bto, off)
{
if (BACKTRACK && obj) {
var cbtObjects = this.abtObjects.length;
let cbtObjects = this.abtObjects.length;
if (!bto) {
/*
* Try the most recently created bto, on the off-chance it's what the caller needs
@ -819,12 +819,12 @@ class Bus extends Component {
bto = {obj: obj, off: off, slot: 0, refs: 0};
var slot;
let slot;
if (!this.cbtDeletions) {
slot = cbtObjects;
} else {
for (slot = this.ibtLastDelete; slot < cbtObjects; slot++) {
var btoTest = this.abtObjects[slot];
let btoTest = this.abtObjects[slot];
if (!btoTest || !btoTest.refs && !this.isBackTrackWeak(slot << Bus.BTINFO.SLOT_SHIFT)) {
this.ibtLastDelete = slot + 1;
this.cbtDeletions--;
@ -881,7 +881,7 @@ class Bus extends Component {
*/
getBackTrackIndex(bto, off)
{
var bti = 0;
let bti = 0;
if (BACKTRACK && bto) {
bti = (bto.slot << Bus.BTINFO.SLOT_SHIFT) | Bus.BTINFO.TYPE_DATA | (off - bto.off);
}
@ -900,7 +900,7 @@ class Bus extends Component {
{
if (BACKTRACK && bto) {
this.assert(off - bto.off >= 0 && off - bto.off < Bus.BTINFO.OFF_MAX);
var bti = (bto.slot << Bus.BTINFO.SLOT_SHIFT) | Bus.BTINFO.TYPE_DATA | (off - bto.off);
let bti = (bto.slot << Bus.BTINFO.SLOT_SHIFT) | Bus.BTINFO.TYPE_DATA | (off - bto.off);
this.writeBackTrack(addr, bti);
}
}
@ -930,14 +930,14 @@ class Bus extends Component {
writeBackTrack(addr, bti)
{
if (BACKTRACK) {
var slot = bti >>> Bus.BTINFO.SLOT_SHIFT;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
var btiPrev = this.aMemBlocks[iBlock].writeBackTrack(addr & this.nBlockLimit, bti);
var slotPrev = btiPrev >>> Bus.BTINFO.SLOT_SHIFT;
let slot = bti >>> Bus.BTINFO.SLOT_SHIFT;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let btiPrev = this.aMemBlocks[iBlock].writeBackTrack(addr & this.nBlockLimit, bti);
let slotPrev = btiPrev >>> Bus.BTINFO.SLOT_SHIFT;
if (slot != slotPrev) {
this.aMemBlocks[iBlock].modBackTrack(true);
if (btiPrev && slotPrev) {
var btoPrev = this.abtObjects[slotPrev-1];
let btoPrev = this.abtObjects[slotPrev-1];
if (!btoPrev) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(Messages.WARN)) {
this.dbg.message("writeBackTrack(%" + Str.toHex(addr) + ',' + Str.toHex(bti) + "): previous index (" + Str.toHex(btiPrev) + ") refers to empty slot (" + slotPrev + ")");
@ -979,7 +979,7 @@ class Bus extends Component {
}
}
if (bti && slot) {
var bto = this.abtObjects[slot-1];
let bto = this.abtObjects[slot-1];
if (bto) {
this.assert(slot == bto.slot);
bto.refs++;
@ -997,8 +997,8 @@ class Bus extends Component {
*/
isBackTrackWeak(bti)
{
var bt = this.cpu.backTrack;
var slot = bti >> Bus.BTINFO.SLOT_SHIFT;
let bt = this.cpu.backTrack;
let slot = bti >> Bus.BTINFO.SLOT_SHIFT;
return (bt.btiAL >> Bus.BTINFO.SLOT_SHIFT == slot ||
bt.btiAH >> Bus.BTINFO.SLOT_SHIFT == slot ||
bt.btiBL >> Bus.BTINFO.SLOT_SHIFT == slot ||
@ -1047,7 +1047,7 @@ class Bus extends Component {
getBackTrackObject(bti)
{
if (BACKTRACK) {
var slot = bti >>> Bus.BTINFO.SLOT_SHIFT;
let slot = bti >>> Bus.BTINFO.SLOT_SHIFT;
if (slot) return this.abtObjects[slot-1];
}
return null;
@ -1065,10 +1065,10 @@ class Bus extends Component {
getBackTrackInfo(bti, fSymbol, fNearest)
{
if (BACKTRACK) {
var bto = this.getBackTrackObject(bti);
let bto = this.getBackTrackObject(bti);
if (bto) {
var off = bti & Bus.BTINFO.OFF_MASK;
var file = bto.obj.file;
let off = bti & Bus.BTINFO.OFF_MASK;
let file = bto.obj.file;
if (file) {
this.assert(!bto.off);
return file.getSymbol(bto.obj.offFile + off, fNearest);
@ -1127,18 +1127,18 @@ class Bus extends Component {
*/
saveMemory(fAll)
{
var i = 0;
var a = [];
let i = 0;
let a = [];
/*
* A quick-and-dirty work-around for 32-bit bus machines, to ensure that all blocks in the 2nd Mb are
* mapped in before we save. We do this by forcing A20 on, and then turning it off again before we leave.
*/
var fA20 = this.getA20();
let fA20 = this.getA20();
if (!fA20) this.setA20(true);
for (var iBlock = 0; iBlock < this.nBlockTotal; iBlock++) {
var block = this.aMemBlocks[iBlock];
for (let iBlock = 0; iBlock < this.nBlockTotal; iBlock++) {
let block = this.aMemBlocks[iBlock];
/*
* We have to check both fDirty and fDirtyEver, because we may have called cleanMemory() on some of
* the memory blocks (eg, video memory), and while cleanMemory() will clear a dirty block's fDirty flag,
@ -1175,14 +1175,14 @@ class Bus extends Component {
*/
restoreMemory(a)
{
var i;
let i;
for (i = 0; i < a.length - 1; i += 2) {
var iBlock = a[i];
var adw = a[i+1];
let iBlock = a[i];
let adw = a[i+1];
if (adw && adw.length < this.nBlockLen) {
adw = State.decompress(adw, this.nBlockLen);
}
var block = this.aMemBlocks[iBlock];
let block = this.aMemBlocks[iBlock];
if (!block || !block.restore(adw)) {
/*
* Either the block to restore hasn't been allocated, indicating a change in the machine
@ -1230,7 +1230,7 @@ class Bus extends Component {
addPortInputNotify(start, end, fn)
{
if (fn !== undefined) {
for (var port = start; port <= end; port++) {
for (let port = start; port <= end; port++) {
if (this.aPortInputNotify[port] !== undefined) {
Component.warning("Input port " + Str.toHexWord(port) + " already registered");
continue;
@ -1254,7 +1254,7 @@ class Bus extends Component {
addPortInputTable(component, table, offset)
{
if (offset === undefined) offset = 0;
for (var port in table) {
for (let port in table) {
this.addPortInputNotify(+port + offset, +port + offset, table[port].bind(component));
}
}
@ -1287,14 +1287,14 @@ class Bus extends Component {
*/
checkPortInputNotify(port, size, addrLIP)
{
var data = 0, shift = 0;
let data = 0, shift = 0;
while (size > 0) {
var aNotify = this.aPortInputNotify[port];
var sizePort = this.aPortInputWidth[port] || 1;
var maskPort = (sizePort == 1? 0xff : (sizePort == 2? 0xffff : -1));
var dataPort = maskPort;
let aNotify = this.aPortInputNotify[port];
let sizePort = this.aPortInputWidth[port] || 1;
let maskPort = (sizePort == 1? 0xff : (sizePort == 2? 0xffff : -1));
let dataPort = maskPort;
/*
* TODO: We need to decide what to do about 8-bit I/O to a 16-bit port (ditto for 16-bit I/O
@ -1372,7 +1372,7 @@ class Bus extends Component {
addPortOutputNotify(start, end, fn)
{
if (fn !== undefined) {
for (var port = start; port <= end; port++) {
for (let port = start; port <= end; port++) {
if (this.aPortOutputNotify[port] !== undefined) {
Component.warning("Output port " + Str.toHexWord(port) + " already registered");
continue;
@ -1396,7 +1396,7 @@ class Bus extends Component {
addPortOutputTable(component, table, offset)
{
if (offset === undefined) offset = 0;
for (var port in table) {
for (let port in table) {
this.addPortOutputNotify(+port + offset, +port + offset, table[port].bind(component));
}
}
@ -1426,14 +1426,14 @@ class Bus extends Component {
*/
checkPortOutputNotify(port, size, data, addrLIP)
{
var shift = 0;
let shift = 0;
while (size > 0) {
var aNotify = this.aPortOutputNotify[port];
var sizePort = this.aPortOutputWidth[port] || 1;
var maskPort = (sizePort == 1? 0xff : (sizePort == 2? 0xffff : -1));
var dataPort = (data >>>= shift) & maskPort;
let aNotify = this.aPortOutputNotify[port];
let sizePort = this.aPortOutputWidth[port] || 1;
let maskPort = (sizePort == 1? 0xff : (sizePort == 2? 0xffff : -1));
let dataPort = (data >>>= shift) & maskPort;
/*
* TODO: We need to decide what to do about 8-bit I/O to a 16-bit port (ditto for 16-bit I/O
@ -1478,7 +1478,7 @@ class Bus extends Component {
*/
reportError(op, addr, size, fQuiet)
{
var sError = "Memory block error (" + op + ": " + Str.toHex(addr) + "," + Str.toHex(size) + ")";
let sError = "Memory block error (" + op + ": " + Str.toHex(addr) + "," + Str.toHex(size) + ")";
if (fQuiet) {
if (this.dbg) {
this.dbg.message(sError);
@ -1502,8 +1502,8 @@ class Bus extends Component {
*
getLongDirect(addr)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let off = addr & this.nBlockLimit;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off < this.nBlockLimit - 2) {
return this.aMemBlocks[iBlock].readLongDirect(off, addr);
}
@ -1513,9 +1513,9 @@ class Bus extends Component {
// which may have also created some undesirable side-effects for custom memory controllers.
// This simpler (and probably more reliable) approach is to simply read the long as individual bytes.
//
var l = 0;
var cb = 4, nShift = 0;
var cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
let l = 0;
let cb = 4, nShift = 0;
let cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
while (cb--) {
l |= (this.aMemBlocks[iBlock].readByteDirect(off++, addr++) << nShift);
if (!--cbBlock) {
@ -1540,8 +1540,8 @@ class Bus extends Component {
*
setLongDirect(addr, l)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
let off = addr & this.nBlockLimit;
let iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
if (off < this.nBlockLimit - 2) {
this.aMemBlocks[iBlock].writeLongDirect(off, l, addr);
return;
@ -1552,8 +1552,8 @@ class Bus extends Component {
// block), which may have also created some undesirable side-effects for custom memory controllers.
// This simpler (and probably more reliable) approach is to simply write the long as individual bytes.
//
var cb = 4;
var cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
let cb = 4;
let cbBlock = 4 - (off & 0x3); // (off & 0x3) will be 1, 2 or 3, so cbBlock will be 3, 2, or 1
while (cb--) {
this.aMemBlocks[iBlock].writeByteDirect(off++, l & 0xff, addr++);
if (!--cbBlock) {
@ -1602,7 +1602,7 @@ class Bus extends Component {
*
removePortInputNotify(start, end)
{
for (var port = start; port < end; port++) {
for (let port = start; port < end; port++) {
if (this.aPortInputNotify[port]) {
delete this.aPortInputNotify[port];
}
@ -1621,7 +1621,7 @@ class Bus extends Component {
*
removePortOutputNotify(start, end)
{
for (var port = start; port < end; port++) {
for (let port = start; port < end; port++) {
if (this.aPortOutputNotify[port]) {
delete this.aPortOutputNotify[port];
}

View file

@ -1038,7 +1038,10 @@ class Keyboard extends Component {
* then a delay of 1500ms, then a reversion to the default delay (normally 150ms), followed
* by "test;" and return.
*/
if (charCode >= 0xF0) {
if (charCode <= 0x1A) {
charCode = charCode + Keys.KEYCODE.FAKE;
}
else if (charCode >= 0xF0) {
this.msInjectDelay = ((charCode - 0xF0) * 100) || this.msInjectDefault;
charCode = 0;
break;
@ -1864,12 +1867,38 @@ Keyboard.SIMCODE = {
CMD: Keys.KEYCODE.CMD + Keys.KEYCODE.ONDOWN,
RCMD: Keys.KEYCODE.RCMD + Keys.KEYCODE.ONDOWN,
FF_CMD: Keys.KEYCODE.FF_CMD + Keys.KEYCODE.ONDOWN,
SYSREQ: Keys.KEYCODE.ESC + Keys.KEYCODE.FAKE,
CTRL_A: Keys.ASCII.CTRL_A + Keys.KEYCODE.FAKE,
CTRL_B: Keys.ASCII.CTRL_B + Keys.KEYCODE.FAKE,
CTRL_C: Keys.ASCII.CTRL_C + Keys.KEYCODE.FAKE,
CTRL_BREAK: Keys.KEYCODE.BS + Keys.KEYCODE.FAKE,
CTRL_D: Keys.ASCII.CTRL_D + Keys.KEYCODE.FAKE,
CTRL_E: Keys.ASCII.CTRL_E + Keys.KEYCODE.FAKE,
CTRL_F: Keys.ASCII.CTRL_F + Keys.KEYCODE.FAKE,
CTRL_G: Keys.ASCII.CTRL_G + Keys.KEYCODE.FAKE,
CTRL_H: Keys.ASCII.CTRL_H + Keys.KEYCODE.FAKE,
CTRL_I: Keys.ASCII.CTRL_I + Keys.KEYCODE.FAKE,
CTRL_J: Keys.ASCII.CTRL_J + Keys.KEYCODE.FAKE,
CTRL_K: Keys.ASCII.CTRL_K + Keys.KEYCODE.FAKE,
CTRL_L: Keys.ASCII.CTRL_L + Keys.KEYCODE.FAKE,
CTRL_M: Keys.ASCII.CTRL_M + Keys.KEYCODE.FAKE,
CTRL_N: Keys.ASCII.CTRL_N + Keys.KEYCODE.FAKE,
CTRL_O: Keys.ASCII.CTRL_O + Keys.KEYCODE.FAKE,
CTRL_P: Keys.ASCII.CTRL_P + Keys.KEYCODE.FAKE,
CTRL_Q: Keys.ASCII.CTRL_Q + Keys.KEYCODE.FAKE,
CTRL_R: Keys.ASCII.CTRL_R + Keys.KEYCODE.FAKE,
CTRL_S: Keys.ASCII.CTRL_S + Keys.KEYCODE.FAKE,
CTRL_T: Keys.ASCII.CTRL_T + Keys.KEYCODE.FAKE,
CTRL_U: Keys.ASCII.CTRL_U + Keys.KEYCODE.FAKE,
CTRL_V: Keys.ASCII.CTRL_V + Keys.KEYCODE.FAKE,
CTRL_W: Keys.ASCII.CTRL_W + Keys.KEYCODE.FAKE,
CTRL_X: Keys.ASCII.CTRL_X + Keys.KEYCODE.FAKE,
CTRL_Y: Keys.ASCII.CTRL_Y + Keys.KEYCODE.FAKE,
CTRL_Z: Keys.ASCII.CTRL_Z + Keys.KEYCODE.FAKE,
SYSREQ: Keys.KEYCODE.ESC + Keys.KEYCODE.FAKE,
CTRL_PAUSE: Keys.KEYCODE.NUM_LOCK + Keys.KEYCODE.FAKE,
CTRL_BREAK: Keys.KEYCODE.SCROLL_LOCK + Keys.KEYCODE.FAKE,
CTRL_ALT_DEL: Keys.KEYCODE.DEL + Keys.KEYCODE.FAKE,
CTRL_ALT_INS: Keys.KEYCODE.INS + Keys.KEYCODE.FAKE,
CTRL_ALT_ENTER: Keys.KEYCODE.CR + Keys.KEYCODE.FAKE
CTRL_ALT_ENTER: Keys.KEYCODE.NUM_CR + Keys.KEYCODE.FAKE
};
/*
@ -2402,7 +2431,32 @@ Keyboard.SIMCODES[Keyboard.SIMCODE.CMD] = Keyboard.SCANCODE.WIN;
Keyboard.SIMCODES[Keyboard.SIMCODE.RCMD] = Keyboard.SCANCODE.MENU;
Keyboard.SIMCODES[Keyboard.SIMCODE.FF_CMD] = Keyboard.SCANCODE.WIN;
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_A] = Keyboard.SCANCODE.A | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_B] = Keyboard.SCANCODE.B | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_C] = Keyboard.SCANCODE.C | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_D] = Keyboard.SCANCODE.D | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_E] = Keyboard.SCANCODE.E | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_F] = Keyboard.SCANCODE.F | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_G] = Keyboard.SCANCODE.G | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_H] = Keyboard.SCANCODE.H | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_I] = Keyboard.SCANCODE.I | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_J] = Keyboard.SCANCODE.J | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_K] = Keyboard.SCANCODE.K | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_L] = Keyboard.SCANCODE.L | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_M] = Keyboard.SCANCODE.M | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_N] = Keyboard.SCANCODE.N | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_O] = Keyboard.SCANCODE.O | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_P] = Keyboard.SCANCODE.P | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_Q] = Keyboard.SCANCODE.Q | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_R] = Keyboard.SCANCODE.R | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_S] = Keyboard.SCANCODE.S | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_T] = Keyboard.SCANCODE.T | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_U] = Keyboard.SCANCODE.U | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_V] = Keyboard.SCANCODE.V | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_W] = Keyboard.SCANCODE.W | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_X] = Keyboard.SCANCODE.X | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_Y] = Keyboard.SCANCODE.Y | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_Z] = Keyboard.SCANCODE.Z | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_BREAK] = Keyboard.SCANCODE.SCROLL_LOCK | (Keyboard.SCANCODE.CTRL << 8);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_ALT_DEL] = Keyboard.SCANCODE.NUM_DEL | (Keyboard.SCANCODE.CTRL << 8) | (Keyboard.SCANCODE.ALT << 16);
Keyboard.SIMCODES[Keyboard.SIMCODE.CTRL_ALT_INS] = Keyboard.SCANCODE.NUM_INS | (Keyboard.SCANCODE.CTRL << 8) | (Keyboard.SCANCODE.ALT << 16);