Add support for meta key

Closes #181
Use the Open-Apple key to send meta key (alt)
This commit is contained in:
Terence Boldt 2024-08-28 18:31:19 -04:00
parent 51a64330a4
commit 2837dd3448
4 changed files with 38 additions and 28 deletions

View File

@ -47,6 +47,7 @@ body:
label: Driver Version
description: What version of the driver are you running? Check with `RPI a2version`
options:
- 0030 (add support for meta key)
- 002E (fix driver crash on null drive)
- 002D (add support for RPi Pico hardware)
- 002C (fix nano editor)
@ -69,6 +70,7 @@ body:
label: Shell Version
description: What version of the shell are you running?`
options:
- 0011 (add support for meta key)
- 0010 / 8010 (support latest firmware)
- 000F / 800F (add pico and classic hardware support)
- 000E (fix hang on exit)

View File

@ -43,6 +43,7 @@ PrintByte = $FDDA
Keyboard = $c000
ClearKeyboard = $c010
OpenApple = $c061
Home = $fc58
Wait = $fca8
PromptChar = $33
@ -232,7 +233,10 @@ keyPressed:
rol
bcs keyPressed
lda Keyboard ;send keypress to RPi
and #$7f
bit OpenApple
bmi noClearHighBit
and #$7f ; clear high bit unless Alt pressed
noClearHighBit:
sta OutputByte,x
bit ClearKeyboard
.if HW_TYPE = 0
@ -310,9 +314,9 @@ restoreChar:
Text:
.if HW_TYPE = 0
.byte "Apple2-IO-RPi Shell Version 0010 (classic)",$8d
.byte "Apple2-IO-RPi Shell Version 0011 (classic)",$8d
.else
.byte "Apple2-IO-RPi Shell Version 8010 (pico)",$8d
.byte "Apple2-IO-RPi Shell Version 8011 (pico)",$8d
.endif
.byte "(c)2020-2024 Terence J. Boldt",$8d
.byte $8d

View File

@ -223,31 +223,35 @@ func readCharacter(comm A2Io) (string, error) {
b, err := comm.ReadByte(true)
var s = string(b)
if err == nil {
if applicationMode {
switch b {
case 0x0b: // up
s = "\033OA"
case 0x0a: // down
s = "\033OB"
case 0x15: // right
s = "\033OC"
case 0x08: // left
s = "\033OD"
case 0x0d: // return
s = string(byte(0x0d))
}
if b >= 0x80 {
s = "\033" + string(b & 0x7f)
} else {
switch b {
case 0x0b: // up
s = "\033[A"
case 0x0a: // down
s = "\033[B"
case 0x15: // right
s = "\033[C"
case 0x08: // left
s = "\033[D"
case 0x0d: // return
s = string(byte(0x0d))
if applicationMode {
switch b {
case 0x0b: // up
s = "\033OA"
case 0x0a: // down
s = "\033OB"
case 0x15: // right
s = "\033OC"
case 0x08: // left
s = "\033OD"
case 0x0d: // return
s = string(byte(0x0d))
}
} else {
switch b {
case 0x0b: // up
s = "\033[A"
case 0x0a: // down
s = "\033[B"
case 0x15: // right
s = "\033[C"
case 0x08: // left
s = "\033[D"
case 0x0d: // return
s = string(byte(0x0d))
}
}
}
}

View File

@ -8,4 +8,4 @@ package info
// Version is the hexadecimal version number that
// should be incremented with each driver update
const Version = "002F"
const Version = "0030"