Skip to content

Commit 7d6d1e2

Browse files
committed
Original Notetaker files
1 parent d26a66c commit 7d6d1e2

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ which also includes links to a live version using this VM in the accompanying [S
99

1010
The [index.html][standalone] in this directory should give you a running version for testing, although the browser integration is incomplete (e.g. copy/paste or file management). Pull requests welcome!
1111

12+
By default this runs an updated image with fixes. To quote from the [paper][paper]:
13+
14+
> Smalltalk-78 was never really finished. It was completed to the point of demonstration on the few NoteTakers that were actually built, but the machines were difficult to use with their small screens and marginal performance, and it was not easy to capture changes and feed them back into new releases. Originally, the Xerox group wrote a Smalltalk-78 image from a running Smalltalk-76 system and this was then moved to the NoteTaker and tried. After several iterations, one image worked well enough for demos. While a number of fixes were made and stored on NoteTaker floppy disks, those are long gone and they were never folded back into the snapshot we have.
15+
16+
If you feel adventurous, you can run the [original, unmodified image][original] as found on the disk pack, too.
17+
1218
The full simulation environment including a graphical VM debugger is at the [Zoo's Smalltalk-78][full] page.
1319
There you can also try Adele Goldberg's SimKit and Alan Borning's Thinglab images running on this VM.
1420

@@ -17,5 +23,6 @@ All of these work best in **Google Chrome**. Again, pull requests to improve bro
1723
[zoo]: https://smalltalkzoo.thechm.org/
1824
[full]: https://smalltalkzoo.thechm.org/HOPL-St78.html
1925
[standalone]: https://codefrau.github.io/Smalltalk78/
26+
[original]: https://codefrau.github.io/Smalltalk78/?image=notetaker
2027
[paper]: https://freudenbergs.de/vanessa/publications/Ingalls-2014-Smalltalk78.pdf
2128
[hopl]: https://smalltalkzoo.thechm.org/papers/EvolutionOfSmalltalk.pdf

Smalltalk78.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,9 @@ function interpretLoop() {
368368
}
369369
}
370370

371-
function runImage(buffer, imageName, canvas) {
372-
window.localStorage['notetakerImageName'] = imageName;
373-
var display = createDisplay(canvas),
374-
image = St78.vm.Image.readFromBuffer(buffer, imageName);
371+
function runImage(image, canvas) {
372+
window.localStorage['notetakerImageName'] = image.name;
373+
var display = createDisplay(canvas);
375374
Smalltalk78.vm = new St78.vm.Interpreter(image, display);
376375
window.onbeforeunload = function() {
377376
return "Smalltalk78 is still running";
@@ -422,11 +421,29 @@ function loadImage(imageName, thenDo, elseDo) {
422421
}
423422
}
424423

424+
// It's 2024. We can use modern JS now.
425+
async function runNotetakerFiles(url, imageName, canvas) {
426+
// this is a special case for the original Notetaker files
427+
// which have a different format than the images we write
428+
const files = ["ObjectTable.nt", "ObjectSpace.nt"];
429+
const responses = await Promise.all(files.map(file => fetch(url + "/" + file)));
430+
const buffers = await Promise.all(responses.map(response => response.arrayBuffer()));
431+
const objectTable = new Uint8Array(buffers[0]);
432+
const objectSpace = new Uint8Array(buffers[1]);
433+
const reader = new St78.vm.ObjectTableReader(objectTable, objectSpace, 49152);
434+
const oopMap = reader.readObjects();
435+
const image = new St78.vm.Image(oopMap, imageName, true);
436+
runImage(image, canvas)
437+
}
438+
425439
Smalltalk78.run = function(imageUrl, canvas) {
426440
// we let ?image=... override the image name (could be a full URL too)
427441
// otherwise the last-saved image name is used
428442
// the image then is loaded from browser storage unless ?fresh is given,
429443
// in which case it's always downloaded
444+
// the special image name "notetaker" will load the original unmodified
445+
// Notetaker files from ~1978, rather than the default image, which has
446+
// been updated (implies ?fresh)
430447
var searchParams = new URLSearchParams(location.search);
431448
if (searchParams.get('image')) {
432449
imageUrl = searchParams.get('image');
@@ -436,7 +453,11 @@ Smalltalk78.run = function(imageUrl, canvas) {
436453
// now load the image, and if that fails, try to download it
437454
var url = new URL(imageUrl, document.location);
438455
var imageName = url.pathname.substring(url.pathname.lastIndexOf('/') + 1);
439-
function run(buffer) { runImage(buffer, imageName, canvas); }
456+
if (imageName == "notetaker") return runNotetakerFiles(url, imageName, canvas);
457+
function run(buffer) {
458+
var image = St78.vm.Image.readFromBuffer(buffer, imageName);
459+
runImage(image, canvas);
460+
}
440461
loadImage(imageName, run, function() {
441462
downloadImage(imageUrl, imageName, run, function() {
442463
alert("Failed to download: " + imageUrl);

notetaker/ObjectSpace.nt

169 KB
Binary file not shown.

notetaker/ObjectTable.nt

30.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)