diff --git a/README.md b/README.md
old mode 100644
new mode 100755
index 11a3c6e..379c305
--- a/README.md
+++ b/README.md
@@ -7,7 +7,11 @@ The `package.json` can install an HTTP server, just do:
npm install
-Download [`theloop.2.rom`](https://github.com/kervinck/gigatron-rom/raw/master/theloop.2.rom) into the `src` directory.
+Pick and download a [`*.rom`](https://github.com/kervinck/gigatron-rom/) file into the `src/` directory and rename it as `gigatron.rom`
+
+Direct links:
+[`ROM v1`](https://github.com/kervinck/gigatron-rom/raw/master/ROMv1.rom)
+[`ROM v2`](https://github.com/kervinck/gigatron-rom/raw/master/ROMv2.rom)
Start the HTTP server
@@ -19,4 +23,4 @@ Use the cursor keys for the D-pad.
## GT1 Files
-GT1 files can be loaded by starting the `Loader` and dropping a `.gt1` file onto the VGA display from File Explorer or Finder.
+GT1 files can be loaded by dropping a `.gt1` file onto the VGA display from File Explorer or Finder.
diff --git a/src/gamepad.js b/src/gamepad.js
index 10da3fc..296c2e7 100644
--- a/src/gamepad.js
+++ b/src/gamepad.js
@@ -60,6 +60,22 @@ export class Gamepad {
this.keyMap[key] = buttonMap[button];
}
}
+
+ /* build map of ASCII codes that the Gigatron understands as well */
+ this.asciiMap = {
+ 'Tab': 9,
+ 'Enter': 10,
+ 'Escape': 27,
+ 'Esc': 27,
+ 'Delete': 127,
+ 'Backspace': 127,
+ };
+ for (let ascii=32; ascii<127; ascii++) {
+ this.asciiMap[String.fromCharCode(ascii)] = ascii;
+ }
+ for (let fnKey=1; fnKey<=12; fnKey++) {
+ this.asciiMap['F' + fnKey] = 0xc0 + fnKey;
+ }
}
/** start handling key events */
@@ -70,14 +86,28 @@ export class Gamepad {
if (bit) {
this.pressed |= bit;
event.preventDefault();
+ } else {
+ let ascii = this.asciiMap[event.key];
+ if (ascii) {
+ if (event.ctrlKey) {
+ // Control codes (e.g. Ctrl-C for ETX or BREAK)
+ if (ascii == 63 /*'?'*/) ascii = 127;
+ else if (ascii == 32 /*' '*/) ascii = 0;
+ else ascii &= 31;
+ }
+ this.pressed = ascii ^ 0xff; /// will be inverted again in tick()
+ event.preventDefault();
+ }
}
})
.on('keyup', (event) => {
let bit = this.keyMap[event.key];
if (bit) {
this.pressed &= ~bit;
- event.preventDefault();
+ } else {
+ this.pressed = 0;
}
+ event.preventDefault();
});
this.enabled = true;
}
diff --git a/src/index.html b/src/index.html
index ae28eb6..f6884c6 100644
--- a/src/index.html
+++ b/src/index.html
@@ -54,13 +54,14 @@
-
+