-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard mapping on emulators #226
Comments
I put out a question on the Apple II Slack to see if any of the emulators handles this properly. The two GS emulators I use (MAME and GSPort) don't simulate the ADB extended function keys as far as I know. I must admit I didn't test with teh keypad on the real GS, just the F-keys. (KEGS is the parent of GSPlus, and is now being actively maintained again, so it's generally a good one.) |
Some KEGS info ... |
Maybe you want to try an emulator called Crossrunner. Just had someone check, and the ADB function keys are emulated there. |
Crossrunner: Oh and it is for Windows >= 7 |
The IIgs numeric keypad (and Apple Extended I) looks like:
where C = clear, 0 is double-width, and Enter is double-height. The platinum IIe is identical, but Clear is called "Esc". The Apple Extended Keyboard II (and most modern mac-centric keyboards?) have the + and - keys swapped. Windows looks like:
Where N = num lock, + is double height, Enter is double height, and 0 is double width. I think that's one reason emulators tend to get it wrong. |
On 27-12-2022 00:27, ksherlock wrote:
* Keypad enter generates a $0d key code.
* Keypad Clear generates a $1b key code.
* (in both cases the keypad is set. shift/option/etc modifiers
should work as well)
Ta, that makes sense. I coded defensively, and I think it will
work straight off.
…--
J.G.Harston - ***@***.*** - mdfs.net/jgh
|
Not sure what you are intending with the numeric pad but results of testing here on GS + Wombat + USB keyboard are that the function keys work (including with modifiers), but numpad does nothing. |
On 27-12-2022 00:27, ksherlock wrote:
* Keypad enter generates a $0d key code.
* Keypad Clear generates a $1b key code.
So, now updated, this should be correct:
https://mdfs.net/Software/BBCBasic/Apple/docs/Keyboard.txt
…--
J.G.Harston - ***@***.*** - mdfs.net/jgh
|
I should run your |
On 27-12-2022 03:58, Bobbi Webber-Manners wrote:
Not sure what you are intending with the numeric pad but results of
testing here on GS + Wombat + USB keyboard are that the function keys
work (including with modifiers), but numpad does nothing.
Hmm. Can you test on real hardware (doesn't need to be right now, I'm
off to bed soon) with Apple Basic something like:
10 LET A=PEEK($C000)
20 IF A<128 THEN GOTO 10
30 LET B=PEEK($C025)
40 PRINT A,B
50 GOTO 10
and report what pressing keypad keys and function keys does. Try both
the USB keyboard, and the native keyboard.
Ta.
KEGS gives, eg:
48 16 for keypad0
49 16 for keypad1
50 16 for keypad2
51 16 for keypad3
52 16 for keypad4
etc.
48 0 for main0
49 0 for main1
50 0 for main2
51 0 for main3
52 0 for main4
etc.
…--
J.G.Harston - ***@***.*** - mdfs.net/jgh
|
KEGS is probably right. If the KEYPAD bit is set (I assume that is the 16 above, without checking), is the keyboard driver supposed to accept it or filter it out if not an f-key? I think my code only allowed f-keys through, but in principle we could have the number pad work also. Right now it doesn't on my setup at least. |
On 27-12-2022 04:12, Bobbi Webber-Manners wrote:
KEGS is probably right. If the KEYPAD bit is set (I assume that is the
16 above, without checking), is the keyboard driver supposed to accept
it or filter it out if not an f-key? I think my code only allowed
f-keys through, but in principle we could have the number pad work
also. Right now it doesn't on my setup at least.
I've written the keyboard driver to follow the Acorn methodology of
the base of the keypad being set with *FX238, so it can be function
keys (*FX238,128) or it can be digits (*FX238,48), or anything else.
Trawlling through documentation and photographs, I believe this is
now correct documentation of AppleII keyboard keycodes:
https://mdfs.net/Docs/Comp/Keyboard/Apple/AppleIIkey
Is it me, or is this documentation really hard to track down? For the
Beeb you just turn to page 495/511 of the User Guide.
…--
J.G.Harston - ***@***.*** - mdfs.net/jgh
|
Ah I have to play with *FX238 then :) The Beeb documentation is more centralized and better organized I think. Every generation of Apple II had its own docs (][/}{+, //e, //c and GS) and each has its own quirks. There are also a pile of Apple 'Tech Notes' to clarify various corner cases. The Apple docs are generally pretty good but there are too many of them, and it is hard to know if you are looking in the right place. For the //e the Technical Reference Manual is the most useful. The GS splits this into a Hardware Reference Manual and a Firmware Reference Manual. The ProDOS Technical Reference manual is also very useful. Let me know if there is anything in particular you are looking for. I have a folder of handy PDFs! |
Something that would be useful is to run in Apple Basic on real hardware: And tell me what pressing Ctrl-( |
Will do that right now. |
On the GS, Ctrl-~ gives me 96 (same as ~ with no modifiers) |
And I get 48 for keypad 0, same as 0 on the main keyboard. |
On 28-12-2022 03:48, Bobbi Webber-Manners wrote:
And I get 48 for keypad 0, same as 0 on the main keyboard.
What machine/keyboard is this?
What does this give for the keypad keys?
REPEAT:PRINT ~GET,~?&C025:UNTIL FALSE
On KEGS it gives me:
30 10
31 10
32 10
33 10
34 10
etc for the keypad and
30 0
31 0
32 0
33 0
34 0
for the main keyboard.
…--
J.G.Harston - ***@***.*** - mdfs.net/jgh
|
This is my ROM01 GS, which has a Wombat and a USB keyboard (Mac USB keyboard circa 2005). I don't have an actual ADB keyboard, but the Wombat is equivalent to an ADB Extended keyboard. I can ask other people on the Apple II Slack to test on with various keyboards if need be. Running your one-liner, I get this for the main keyboard number keys: And for the keypad, I get: |
A bit more testing info for you from my GS. I was playing with View and noticed that the numpad is working as F-keys, so that is good. However, the arrow keys no longer seem to be working on the GS at least. |
Had a quick test in MAME using the (simulated) //e, and arrow keys don't work in View there either. However they do work in BBC BASIC both in MAME and on my (real) GS. |
Weird. It looks like oddities of emulator implementation. On my desktop, but not my laptop, Applecorn doesn't give anything from Ctrl-digit, but KEGS gives digits from Ctrl-digit, which is a bugger because the Windows UK keyboard driver translates RightAlt into ALT+CTRL. |
I spent yesterday frustatedly trying to get my Android tablet to re-install KEGS and Apple2ix. I think it's near death, and at this rate if it doesn't behave it's going to be percussively punished over the edge of the table. |
Yes, not sure what the deal is with the arrow keys. They did used to work prior to refactoring, so I guess we can see what it was doing then and compare. |
This:
https://mdfs.net/Docs/Comp/Keyboard/Apple/AppleIIkey
is updated from documantation and testing to be what various AppleII
keyboards keypresses "should" return. A perennial problem is that
emulators tend to omit corner cases, or things the writers just never
thought would happen - such as a keyboard with a keypad.
It would be worth getting a community effort to get people to use
real hardware and tabulate all 16 combinations of each keypress:
| key | shift | ctrl | shift+ctrl
----------------+-----+-------+------+------------
key | | | |
left apple | | | |
right apple | | | |
left+right apple| | | |
10 LET A=PEEK(49152)
20 IF A<128 THEN GOTO 10
30 POKE 49152+16,A
40 PRINT A,PEEK(49152+37)
50 GOTO 10
If I lived nearer a hand-on computer museum I'd spend an afternoon
testing.
…--
J.G.Harston - ***@***.*** - mdfs.net/jgh
|
The non functioning arrow keys in View or ISO Pascal editor is reproducible in MAME. Tried it the other day. |
Apple IIgs, ROM 1, original keyboard (the ADB code to key code translation is handled by the ADB glu code which differs between ROM versions. Modifier bits always reflect shift/ctrl/etc status.
Shift doesn't affect the above control codes. This looks consistent with your keycode chart. MAME (250) doesn't handle control-6 or control-- correctly. MAME also loses the keypad modifier bit when shift/control are used with keypad entry (eg, shift-keypad 4 generates modifier 1 instead of modifier 17). MAME is switching to proper ADB next month which should fix those problems so I'll try again with it enabled. |
I just noticed, numpad clear isn't escape ( MAME with ADB emulation seems to get everything correct (or will ; there's a mapping problem with clear/=). |
Also, the arrow keys ( |
On 31-12-2022 17:49, ksherlock wrote:
MAME (250) doesn't handle control-6 or control-- correctly (because it
uses the IIe keyboard mapping?). MAME also loses the keypad modifier
bit when shift/control are used with keypad entry (eg, shift-keypad 4
generates modifier 1 instead of modifier 17). MAME is switching to
proper ADB next month which should fix those problems so I'll try
again with it enabled.
KEGS 0.60 on Windows also loses SHIFT when the keypad keys are pressed.
I notice the latest version is 1.16, so I'll install that and check.
…--
J.G.Harston - ***@***.*** - mdfs.net/jgh
|
On 31-12-2022 19:26, ksherlock wrote:
I just noticed, numpad clear isn't escape ($1b / 27), it's cancel
($18 / 24).
On the AppleIIgs the key is labelled CLEAR, but
on the AppleIIe Platinum the key is labelled ESC.
Does it return $18/24 on both, or does it return
the character that matches the label?
…--
J.G.Harston - ***@***.*** - mdfs.net/jgh
|
@jgharston Anything else to do here, or shall I close it? |
I don't know how accurately the emulators I'm using match real hardware, so I could do with some real hardware test information. Hours online tracking down documentation hasn't been much help.
With KEGS, keypad-enter and keypad-equals both return '='. Is that the same on real hardware.
KEGS doesn't map anything to the IIgs keypad-clear key, the top-left keypad key, so I don't know what keycode it returns.
On KEGS, Shift-Keypad-key sets the KBDMOD 'KPAD' bit, but doesn't set the KBDMOD 'Shift Key' bit.
I think this is slightly different on KEGS for Android, so I'll check that later.
The text was updated successfully, but these errors were encountered: