7

Apple II computers other than the IIgs (which uses ADB) have a hardwired keyboard combined with the paddle/joystick ports for input. What combinations of modifier keys can you detect? I know that the paddle/joystick buttons are considered part of the keyboard so those count towards the combinations as well. For example could you detect open-apple + closed-apple + shift + alpha-numerical key. What about joystick button-one + open-apple + alpha-numerical key.

7

The Apple II descends directly from the Apple I and other similar home-built micros of the era in its handling of the keyboard: there is an address from which you can query whether a new keystroke has been received. If it has been received, it is the appropriate code for whatever was pressed — if you pressed 'a' then it'll have an 'a' in it; if you pressed shift+'a' then it'll have an 'A' in it. There's no inherent way to read the current state of any of the modifiers, or indeed any of the keys.

Compare and contrast with later 8-bit micros, which usually scan a keyboard matrix in software, and with any computer with a serial keyboard bus, such as ADB, which will receive key up and key down notifications.

Later models of the Apple II modify this behaviour. They:

  1. codify the commonly-performed shift-key modification. That additionally connects the shift key to the third joystick button; and
  2. as of the IIe, the open and closed Apple keys are added, connected to the other two joystick buttons.

So:

  • joystick buttons are considered part of the keyboard only in the sense that they were reprovisioned to provide additional keyboard input after the fact;
  • if you have an unmodified pre-IIe Apple II you cannot detect the current state of any of the modifiers;
  • a common modification to the pre-IIe machines maps shift to the third joystick button. That's in addition to the actual third joystick button, if you had one. Those two things cannot be disambiguated;
  • from the IIe onwards, the open and closed Apple keys are added and similarly report on the other joystick buttons (open Apple = the first button, closed Apple = the second). But cannot be disambiguated from the actual joystick buttons.
  • 4
    The situation with the shift key mod and third button input on later //e models (the earlier ones didn't include the shift-key mod) is worse than what you suggest: with the mod installed, the button will read as pressed any time the shift key is released. The only time the actual third button would have any effect is when the shift key is also pressed, in which case it would short out the supply. – supercat Jun 18 at 22:01
  • 2
    Other (perhaps tangential) notes. (1) The //e actually added an "any key down" behaviour, so you can tell if a key is still pressed (but not which one). (2) The Platinum //e came with the shift key mod pre-installed. (3) The //c allows keys to be buffered in AUX RAM by interrupts to allow type-ahead. This may interfere with attempts to gather Open/Closed-Apple key modifiers. – Nick Westgate Jun 20 at 2:32
3

The state of the open-Apple, closed-Apple, and--on machines with the "shift key mod"--shift key can be read at any time, independently from any other keypress. Additionally, on the Apple //e, but not earlier models, it is possible to determine whether all non-modifier keys are released at any moment in time. Nothing in the hardware will record the state of modifier keys at the moment a key is pushed, except in cases where the modifier affects the key code produced. If, for example, while the computer is busy one types a key and then presses and holds the open-Apple when the computer finishes what it was doing, it would have no way of determining that open-Apple was not pressed at the time you typed the character.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.