-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_break.html
More file actions
65 lines (54 loc) · 1.92 KB
/
Copy pathtest_break.html
File metadata and controls
65 lines (54 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html>
<head>
<title>bwxBASIC Break Test</title>
</head>
<body>
<canvas id="main-canvas" width="640" height="400" tabindex="0"></canvas>
<input type="text" id="input-trap">
<div id="break-btn" style="display:none;">[ESC] BREAK</div>
<div id="help-overlay">
<div id="help-content"></div>
<input type="text" id="help-search">
</div>
<div id="js-overlay">
<pre id="js-content"></pre>
</div>
<script type="module">
import { CONFIG } from './js/config.js';
import { SYS } from './js/system.js';
import { IO } from './js/io.js';
import { SCREEN } from './js/screen.js';
import { GRAPHICS } from './js/graphics.js';
import { ENGINE } from './js/engine.js';
import { DEMOS } from './js/demos.js';
async function init() {
const canvas = document.getElementById('main-canvas');
const ctx = canvas.getContext('2d', { willReadFrequently: true });
const trap = document.getElementById('input-trap');
GRAPHICS.init(ctx);
SCREEN.init(canvas, ctx);
IO.init(trap);
// Mock program
SYS.program = [
{ line: 10, src: '10 PRINT "Start"' },
{ line: null, src: 'PRINT "Waiting"' },
{ line: null, src: 'DELAY 5' },
{ line: null, src: 'GOTO 10' }
];
console.log("Starting Engine...");
// Tricking engine into thinking break button was pressed
setTimeout(() => {
console.log("Triggering Break...");
SYS.break = true;
}, 100);
await ENGINE.run();
console.log("Done.");
// Re-run WHERE
IO.handleCommand('WHERE');
window.testDone = true;
}
init();
</script>
</body>
</html>