jsbeeb 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "name": "jsbeeb",
8
8
  "description": "Emulate a BBC Micro",
9
9
  "repository": "git@github.com:mattgodbolt/jsbeeb.git",
10
- "version": "1.3.3",
10
+ "version": "1.4.0",
11
11
  "//": "If you change the version of Node, it must also be updated at the top of the Dockerfile.",
12
12
  "engines": {
13
13
  "node": "22"
@@ -201,6 +201,30 @@ export class MachineSession {
201
201
  });
202
202
  }
203
203
 
204
+ /**
205
+ * Press a key (by browser keyCode).
206
+ * Use utils.keyCodes for named keys, or ASCII charCode for letters/digits.
207
+ */
208
+ keyDown(keyCode, shiftDown = false) {
209
+ this._machine.processor.sysvia.keyDown(keyCode, shiftDown);
210
+ }
211
+
212
+ /**
213
+ * Release a key (by browser keyCode).
214
+ */
215
+ keyUp(keyCode) {
216
+ this._machine.processor.sysvia.keyUp(keyCode);
217
+ }
218
+
219
+ /**
220
+ * Reset the machine.
221
+ * @param {boolean} [hard=true] - true for power-on reset, false for soft reset
222
+ */
223
+ reset(hard = true) {
224
+ this._machine.processor.reset(hard);
225
+ this._pendingOutput = [];
226
+ }
227
+
204
228
  /** Tokenise BBC BASIC source and write it into PAGE */
205
229
  async loadBasic(source) {
206
230
  await this._machine.loadBasic(source);