Skip to content

Commit

Permalink
Add support for the 68533 image format
Browse files Browse the repository at this point in the history
Closes #137.
  • Loading branch information
LinqLover committed Jul 9, 2022
1 parent f061180 commit 28709da
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tasks:
- init: nvm install && npm install && npm run build
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14.15.0
24 changes: 14 additions & 10 deletions dist/squeak_bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@
}
};
// read version and determine endianness
var versions = [6501, 6502, 6504, 6505, 6521, 68000, 68002, 68003, 68021],
var versions = [6501, 6502, 6504, 6505, 6521, 68000, 68002, 68003, 68021, 68533],
version = 0,
fileHeaderSize = 0;
while (true) { // try all four endianness + header combos
Expand All @@ -1504,9 +1504,9 @@
if (!littleEndian) fileHeaderSize += 512;
if (fileHeaderSize > 512) throw Error("bad image version");
} this.version = version;
var nativeFloats = [6505, 6521, 68003, 68021].indexOf(version) >= 0;
this.hasClosures = [6504, 6505, 6521, 68002, 68003, 68021].indexOf(version) >= 0;
this.isSpur = [6521, 68021].indexOf(version) >= 0;
var nativeFloats = [6505, 6521, 68003, 68021, 68533].indexOf(version) >= 0;
this.hasClosures = [6504, 6505, 6521, 68002, 68003, 68021, 68533].indexOf(version) >= 0;
this.isSpur = [6521, 68021, 68533].indexOf(version) >= 0;
var is64Bit = version >= 68000;
if (is64Bit && !this.isSpur) throw Error("64 bit non-spur images not supported yet");
if (is64Bit) { readWord = readWord64; wordSize = 8; }
Expand Down Expand Up @@ -5438,7 +5438,7 @@
case 175: if (this.oldPrims) return this.namedPrimitive('SoundPlugin', 'primitiveSoundPlaySilence', argCount);
else return this.popNandPushIfOK(argCount+1, this.behaviorHash(this.stackNonInteger(0)));
case 176: if (this.oldPrims) return this.namedPrimitive('SoundGenerationPlugin', 'primWaveTableSoundmixSampleCountintostartingAtpan', argCount);
break; // fail
else return this.popNandPushIfOK(argCount+1, this.vm.image.isSpur ? 0x3FFFFF : 0xFFF); // primitiveMaxIdentityHash
case 177: if (this.oldPrims) return this.namedPrimitive('SoundGenerationPlugin', 'primFMSoundmixSampleCountintostartingAtpan', argCount);
return this.popNandPushIfOK(argCount+1, this.allInstancesOf(this.stackNonInteger(0)));
case 178: if (this.oldPrims) return this.namedPrimitive('SoundGenerationPlugin', 'primPluckedSoundmixSampleCountintostartingAtpan', argCount);
Expand Down Expand Up @@ -40050,6 +40050,10 @@
from
DeflatePlugin VMMaker-bf.353 uuid: 8ae25e7e-8d2c-451e-8277-598b30e9c002
*/
/*
Manual fixes:
2022-01-15 VMMaker.oscog-mt.3135 and VMMaker.oscog-mt.3136
*/

(function ZipPlugin() {

Expand Down Expand Up @@ -40302,7 +40306,7 @@
}


/* Determine the inst size of the class above DeflateStream by
/* Determine the inst size of the class above InflateStream by
looking for the first class whose inst size is less than 13. */

function determineSizeOfReadStream(rcvr) {
Expand Down Expand Up @@ -40578,8 +40582,8 @@
/* zipWriteLimit := interpreterProxy fetchInteger: 3 ofObject: rcvr. */

zipReadLimit = interpreterProxy.fetchIntegerofObject(2, rcvr);
zipBitBuf = interpreterProxy.fetchIntegerofObject(writeStreamInstSize + 1, rcvr);
zipBitPos = interpreterProxy.fetchIntegerofObject(writeStreamInstSize + 2, rcvr);
zipBitBuf = interpreterProxy.fetchIntegerofObject(writeStreamInstSize + 0, rcvr);
zipBitPos = interpreterProxy.fetchIntegerofObject(writeStreamInstSize + 1, rcvr);
return !interpreterProxy.failed();
}

Expand Down Expand Up @@ -40888,8 +40892,8 @@
result = sendBlockwithwithwith(litStream, distStream, litTree, distTree);
if (!interpreterProxy.failed()) {
interpreterProxy.storeIntegerofObjectwithValue(1, rcvr, zipPosition);
interpreterProxy.storeIntegerofObjectwithValue(readStreamInstSize + 1, rcvr, zipBitBuf);
interpreterProxy.storeIntegerofObjectwithValue(readStreamInstSize + 2, rcvr, zipBitPos);
interpreterProxy.storeIntegerofObjectwithValue(writeStreamInstSize + 0, rcvr, zipBitBuf);
interpreterProxy.storeIntegerofObjectwithValue(writeStreamInstSize + 1, rcvr, zipBitPos);
}
if (!interpreterProxy.failed()) {
interpreterProxy.pop(5);
Expand Down
10 changes: 5 additions & 5 deletions dist/squeak_headless_bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ Object.subclass('Squeak.Image',
}
};
// read version and determine endianness
var versions = [6501, 6502, 6504, 6505, 6521, 68000, 68002, 68003, 68021],
var versions = [6501, 6502, 6504, 6505, 6521, 68000, 68002, 68003, 68021, 68533],
version = 0,
fileHeaderSize = 0;
while (true) { // try all four endianness + header combos
Expand All @@ -1501,9 +1501,9 @@ Object.subclass('Squeak.Image',
if (!littleEndian) fileHeaderSize += 512;
if (fileHeaderSize > 512) throw Error("bad image version");
} this.version = version;
var nativeFloats = [6505, 6521, 68003, 68021].indexOf(version) >= 0;
this.hasClosures = [6504, 6505, 6521, 68002, 68003, 68021].indexOf(version) >= 0;
this.isSpur = [6521, 68021].indexOf(version) >= 0;
var nativeFloats = [6505, 6521, 68003, 68021, 68533].indexOf(version) >= 0;
this.hasClosures = [6504, 6505, 6521, 68002, 68003, 68021, 68533].indexOf(version) >= 0;
this.isSpur = [6521, 68021, 68533].indexOf(version) >= 0;
var is64Bit = version >= 68000;
if (is64Bit && !this.isSpur) throw Error("64 bit non-spur images not supported yet");
if (is64Bit) { readWord = readWord64; wordSize = 8; }
Expand Down Expand Up @@ -5435,7 +5435,7 @@ Object.subclass('Squeak.Primitives',
case 175: if (this.oldPrims) return this.namedPrimitive('SoundPlugin', 'primitiveSoundPlaySilence', argCount);
else return this.popNandPushIfOK(argCount+1, this.behaviorHash(this.stackNonInteger(0)));
case 176: if (this.oldPrims) return this.namedPrimitive('SoundGenerationPlugin', 'primWaveTableSoundmixSampleCountintostartingAtpan', argCount);
break; // fail
else return this.popNandPushIfOK(argCount+1, this.vm.image.isSpur ? 0x3FFFFF : 0xFFF); // primitiveMaxIdentityHash
case 177: if (this.oldPrims) return this.namedPrimitive('SoundGenerationPlugin', 'primFMSoundmixSampleCountintostartingAtpan', argCount);
return this.popNandPushIfOK(argCount+1, this.allInstancesOf(this.stackNonInteger(0)));
case 178: if (this.oldPrims) return this.namedPrimitive('SoundGenerationPlugin', 'primPluckedSoundmixSampleCountintostartingAtpan', argCount);
Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vm.image.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Object.subclass('Squeak.Image',
}
};
// read version and determine endianness
var versions = [6501, 6502, 6504, 6505, 6521, 68000, 68002, 68003, 68021],
var versions = [6501, 6502, 6504, 6505, 6521, 68000, 68002, 68003, 68021, 68533],
version = 0,
fileHeaderSize = 0;
while (true) { // try all four endianness + header combos
Expand All @@ -126,9 +126,9 @@ Object.subclass('Squeak.Image',
if (fileHeaderSize > 512) throw Error("bad image version");
};
this.version = version;
var nativeFloats = [6505, 6521, 68003, 68021].indexOf(version) >= 0;
this.hasClosures = [6504, 6505, 6521, 68002, 68003, 68021].indexOf(version) >= 0;
this.isSpur = [6521, 68021].indexOf(version) >= 0;
var nativeFloats = [6505, 6521, 68003, 68021, 68533].indexOf(version) >= 0;
this.hasClosures = [6504, 6505, 6521, 68002, 68003, 68021, 68533].indexOf(version) >= 0;
this.isSpur = [6521, 68021, 68533].indexOf(version) >= 0;
var is64Bit = version >= 68000;
if (is64Bit && !this.isSpur) throw Error("64 bit non-spur images not supported yet");
if (is64Bit) { readWord = readWord64; wordSize = 8; }
Expand Down

0 comments on commit 28709da

Please sign in to comment.