mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-25 03:34:05 +00:00
prevent backspace key from leaving browser page
This commit is contained in:
parent
e45806e8cf
commit
818386a5d2
@ -3,7 +3,10 @@
|
||||
|
||||
.segment "INIT"
|
||||
.segment "ONCE"
|
||||
; don't use $800-$1fff :(
|
||||
.segment "STARTUP"
|
||||
jmp Start
|
||||
; use $4000- :)
|
||||
.segment "CODE"
|
||||
|
||||
.define EQU =
|
||||
@ -146,7 +149,7 @@ PERFECT_AIM EQU $1
|
||||
;==============================
|
||||
; back up part of the zero page
|
||||
;==============================
|
||||
|
||||
Start:
|
||||
lda #>zero_page_save
|
||||
sta BASH
|
||||
lda #<zero_page_save
|
||||
@ -3029,7 +3032,7 @@ check_paddles:
|
||||
LDY #0 ;INIT COUNTER
|
||||
NOP ;COMPENSATE FOR 1ST COUNT
|
||||
NOP
|
||||
PREAD2: LDA PADDL0,X ;COUNT EVERY 11 µSEC.
|
||||
PREAD2: LDA PADDL0,X ;COUNT EVERY 11 uSEC.
|
||||
BPL RTS2D ;BRANCH WHEN TIMED OUT
|
||||
INY ;INCREMENT COUNTER
|
||||
BNE PREAD2 ;CONTINUE COUNTING
|
||||
|
@ -53,6 +53,9 @@ export enum KeyFlags {
|
||||
export function _setKeyboardEvents(canvas:HTMLElement, callback:KeyboardCallback) {
|
||||
canvas.onkeydown = (e) => {
|
||||
callback(e.which, 0, KeyFlags.KeyDown|_metakeyflags(e));
|
||||
if (e.which == 8 || e.which == 9 || e.which == 27) { // eat backspace, tab, escape keys
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
canvas.onkeyup = (e) => {
|
||||
callback(e.which, 0, KeyFlags.KeyUp|_metakeyflags(e));
|
||||
|
@ -243,7 +243,9 @@ export class AppleII extends BasicScanlineMachine {
|
||||
} else if (flags & KeyFlags.KeyDown) {
|
||||
code = 0;
|
||||
switch (key) {
|
||||
case 8: code=8; break; // left
|
||||
case 13: code=13; break; // return
|
||||
case 27: code=27; break; // escape
|
||||
case 37: code=8; break; // left
|
||||
case 39: code=21; break; // right
|
||||
case 38: code=11; break; // up
|
||||
|
Loading…
Reference in New Issue
Block a user