forked from lkesteloot/turbopascal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrt.js
55 lines (42 loc) · 1.84 KB
/
crt.js
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
// The CRT sub-system.
if (typeof define !== 'function') { var define = require('amdefine')(module) };
define(["./Node"], function (Node) {
var importSymbols = function (symbolTable) {
// Keyboard functions.
symbolTable.addNativeFunction("KeyPressed", Node.booleanType, [], function (ctl) {
return ctl.keyPressed();
});
symbolTable.addNativeFunction("ReadKey", Node.charType, [], function (ctl) {
return ctl.readKey();
});
// Sound functions.
symbolTable.addNativeFunction("Sound", Node.voidType, [Node.integerType],
function (ctl, hz) {
// Not implemented.
});
symbolTable.addNativeFunction("NoSound", Node.voidType, [], function (ctl) {
// Not implemented.
});
symbolTable.addNativeVariable("CheckSnow", false, Node.booleanType);
symbolTable.addNativeVariable("DirectVideo", false, Node.booleanType);
symbolTable.addNativeVariable("TextAttr", 7, Node.integerType);
symbolTable.addNativeFunction("ClrScr", Node.voidType, [], function (ctl) {
// Not implemented.
});
symbolTable.addNativeFunction("ClrEOL", Node.voidType, [], function (ctl) {
// Not implemented.
});
symbolTable.addNativeFunction("NormVideo", Node.voidType, [], function (ctl) {
// Not implemented.
});
symbolTable.addNativeFunction("Window", Node.voidType, [Node.integerType, Node.integerType, Node.integerType, Node.integerType], function (ctl, x1, y1, x2, y2) {
// Not implemented.
});
symbolTable.addNativeFunction("GotoXY", Node.voidType, [Node.integerType, Node.integerType], function (ctl, x, y) {
ctl.ansi().goto(x, y);
});
};
return {
importSymbols: importSymbols
};
});