This repository has been archived by the owner on Dec 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathdefs.js
150 lines (137 loc) · 4.06 KB
/
defs.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
* @fileoverview Basic definitions
* @author <a href="mailto:[email protected]">Jeff Parsons</a>
* @copyright © 2012-2020 Jeff Parsons
* @license MIT
*
* This file is part of PCjs, a computer emulation software project at <https://www.pcjs.org>.
*/
"use strict";
/* eslint no-var: 0 */
/**
* COMMAND is the default name of the global command handler we will define, to provide
* the same convenient access to all the WebIO COMMAND handlers that the Debugger enjoys.
*
* @define {string}
*/
var COMMAND = "command";
/**
* COMPILED is false by default; overridden with true in the Closure Compiler release.
*
* @define {boolean}
*/
var COMPILED = false;
/**
* DEBUG is true by default, enabling assertions and other runtime checks; overridden with false
* in the Closure Compiler release, which generally results in the removal of any DEBUG code. Our
* gulpfile, however, takes the extra precaution of physically removing all "assert" method calls
* from the concatenated file that is generated for the Closure Compiler.
*
* @define {boolean}
*/
var DEBUG = true;
/**
* FACTORY is "Machine" by default; overridden with the machine's "factory" string in machines.json
* to ensure unique factories.
*
* @define {string}
*/
var FACTORY = "Machine";
/**
* MAXDEBUG is false by default; overridden with false in the Closure Compiler release. Set it to
* true to manually to enable any hyper-aggressive DEBUG checks.
*
* @define {boolean}
*/
var MAXDEBUG = false;
/**
* VERSION is the current PCjs Project release number, updated somewhat arbitrarily and usually only after
* significant changes. It will be overriden the machine's "version" string in machines.json.
*
* @define {string}
*/
var VERSION = "2.00";
/*
* The following globals CANNOT be overridden.
*
* LITTLE_ENDIAN is true if the browser's ArrayBuffer storage is little-endian. If LITTLE_ENDIAN matches
* the endian-ness of a machine being emulated, then that machine can use ArrayBuffers for Memory buffers as-is.
*/
var LITTLE_ENDIAN = function() {
let buffer = new ArrayBuffer(2);
new DataView(buffer).setUint16(0, 256, true);
return new Uint16Array(buffer)[0] === 256;
}();
/*
* List of standard message groups. The messages properties defines the set of active message
* groups, and their names are defined by MESSAGE_NAMES. See the Device class for more message
* group definitions.
*
* NOTE: To support more than 32 message groups, be sure to use "+", not "|", when concatenating.
*/
var MESSAGE = {
ALL: 0xffffffffffff,
NONE: 0x000000000000,
DEFAULT: 0x000000000000,
BUFFER: 0x800000000000,
};
/*
* RS-232 DB-25 Pin Definitions, mapped to bits 1-25 in a 32-bit status value.
*
* Serial devices in PCjs machines are considered DTE (Data Terminal Equipment), which means they should be "virtually"
* connected to each other via a null-modem cable, which assumes the following cross-wiring:
*
* G 1 <-> 1 G (Ground)
* TD 2 <-> 3 RD (Received Data)
* RD 3 <-> 2 TD (Transmitted Data)
* RTS 4 <-> 5 CTS (Clear To Send)
* CTS 5 <-> 4 RTS (Request To Send)
* DSR 6+8 <-> 20 DTR (Data Terminal Ready)
* SG 7 <-> 7 SG (Signal Ground)
* DTR 20 <-> 6+8 DSR (Data Set Ready + Carrier Detect)
* RI 22 <-> 22 RI (Ring Indicator)
*
* TODO: Move these definitions to a more appropriate shared file at some point.
*/
var RS232 = {
RTS: {
PIN: 4,
MASK: 0x00000010
},
CTS: {
PIN: 5,
MASK: 0x00000020
},
DSR: {
PIN: 6,
MASK: 0x00000040
},
CD: {
PIN: 8,
MASK: 0x00000100
},
DTR: {
PIN: 20,
MASK: 0x00100000
},
RI: {
PIN: 22,
MASK: 0x00400000
}
};
/**
* @class {Defs}
* @unrestricted
*/
class Defs {
/**
* Defs()
*
* @this {Defs}
*/
constructor()
{
}
}
Defs.CLASSES = {};
Defs.CLASSES["Defs"] = Defs;