From 2837dd34488a999953276b013847fc068c2875ea Mon Sep 17 00:00:00 2001 From: Terence Boldt Date: Wed, 28 Aug 2024 18:31:19 -0400 Subject: [PATCH] Add support for meta key Closes #181 Use the Open-Apple key to send meta key (alt) --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 + Apple2/Shell.asm | 10 +++-- RaspberryPi/apple2driver/a2io/vt100.go | 52 +++++++++++++----------- RaspberryPi/apple2driver/info/version.go | 2 +- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 416106a..3651c88 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -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) diff --git a/Apple2/Shell.asm b/Apple2/Shell.asm index 4fe7e21..98172f5 100755 --- a/Apple2/Shell.asm +++ b/Apple2/Shell.asm @@ -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 diff --git a/RaspberryPi/apple2driver/a2io/vt100.go b/RaspberryPi/apple2driver/a2io/vt100.go index b64e5e7..6c18631 100644 --- a/RaspberryPi/apple2driver/a2io/vt100.go +++ b/RaspberryPi/apple2driver/a2io/vt100.go @@ -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)) + } } } } diff --git a/RaspberryPi/apple2driver/info/version.go b/RaspberryPi/apple2driver/info/version.go index 9d39966..007d9ea 100644 --- a/RaspberryPi/apple2driver/info/version.go +++ b/RaspberryPi/apple2driver/info/version.go @@ -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"