Add bootstrapping stub

This commit is contained in:
Joshua Bell 2018-10-27 20:40:01 -07:00
parent 16af1e5a24
commit 899a1a4722
4 changed files with 32 additions and 0 deletions

View File

@ -7,5 +7,6 @@ video, canvas { border: 2px dotted black; }
<canvas id=quant width=140 height=192 style="width: 280px; height: 192px;"></canvas>
<br>
<button id=save>Save</button>
<button id=bootstrap>Bootstrap</button>
<script src="server.js"></script>

BIN
res/SPLASH.PIC.BIN Normal file

Binary file not shown.

BIN
res/icon128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -237,4 +237,35 @@
}
}
}
$('#bootstrap').addEventListener('click', async e => {
const CLIENT_ADDR = 0x6000;
const CLIENT_FILE = 'client/client.bin';
function send(str) {
// TODO: Send this over serial, obviously...
console.log(str);
}
send('CALL -151'); // Enter Monitor
const response = await fetch(CLIENT_FILE);
if (!response.ok)
throw new Error(response.statusText);
const bytes = new Uint8Array(await response.arrayBuffer());
let addr = CLIENT_ADDR;
for (let offset = 0; offset < bytes.length; offset += 8) {
const str = addr.toString(16).toUpperCase() + ': ' +
[...bytes.slice(offset, offset + 8)]
.map(b => ('00' + b.toString(16).toUpperCase()).substr(-2))
.join(' ');
send(str);
}
send('\x03'); // Ctrl+C - Exit Monitor
send(`CALL ${CLIENT_ADDR}`); // Execute client
});
})();