forked from jeffpar/pcjs.v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathram.js
55 lines (51 loc) · 1.27 KB
/
ram.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
/**
* @fileoverview Simulates RAM
* @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";
/**
* @typedef {Config} RAMConfig
* @property {number} addr
* @property {number} size
* @property {number} [type]
*/
/**
* @class {RAM}
* @unrestricted
* @property {RAMConfig} config
* @property {number} addr
* @property {number} size
* @property {number} type
* @property {Array.<number>} values
*/
class RAM extends Memory {
/**
* RAM(idMachine, idDevice, config)
*
* Sample config:
*
* "ram": {
* "class": "RAM",
* "addr": 8192,
* "size": 1024,
* "bus": "busMemory"
* }
*
* @this {RAM}
* @param {string} idMachine
* @param {string} idDevice
* @param {RAMConfig} [config]
*/
constructor(idMachine, idDevice, config)
{
config['type'] = Memory.TYPE.NONE;
super(idMachine, idDevice, config);
this.bus.addBlocks(this.config['addr'], this.config['size'], Memory.TYPE.READWRITE);
this.whenReady(this.onReset.bind(this));
}
}
Defs.CLASSES["RAM"] = RAM;