OSBYTE &CA

From BeebWiki
Jump to: navigation, search
OSBYTE &CA (202): Read/Write Keyboard Status
This byte reflects the current state of the keyboard modifier keys
  BBC/Master:          Compact:              Electron:            RISC OS:
  b0: reserved         b0-b2: EXTEND status  b0: reserved         b0: Alt pressed
  b1: reserved       0=None 1=Extend 2=Shift b1: reserved         b1: Scroll Lock set
  b2: reserved       3=Ctrl 4=ShftCtrl       b2: reserved         b2: Num Lock set
  b3: Shift pressed    b3: Shift pressed     b3: reserved         b3: Shift pressed
  b4: Caps lock off    b4: Caps lock off     b4: Caps lock off    b4: Caps lock off
  b5: Shift lock off   b5: Shift lock off    b5: FN pressed       b5: Shift lock off
  b6: Control pressed  b6: Control pressed   b6: Shift pressed    b6: Control pressed
  b7: Shift enable     b7: Shift enable      b7: Control pressed  b7: Shift enable

Only one Lock can be set in b5-b4: 01=Shift Lock, 10=Caps Lock, 11=No Lock. When Shift Enable is on, the SHIFT key swaps the state of the Lock for the keypress. When Shift Enable is off, SHIFT has no effect on the letter keys.

Examples

OSBYTE &CA is used internally by the keyboard driver, and the layout is specific to the driver. It changes to reflect the state of the keyboard, the only bits that are useful to write are the lock and enable bits. Bit 4 is generally the only usefully consistant state across different platforms.

  • *FX 202,16 turns Shift Lock on
  • *FX 202,32 turns Caps Lock on
  • *FX 202,48 turns Caps Lock/Shift Lock off
  • *FX 202,160 turns Shift Caps on

Extensions

  AppleII Applecorn:
  b0:    Apple key pressed
  b1:    Extended (keypad/function) key pressed
  b2-b5: reserved
  b6:    Shift pressed
  b7:    Control pressed

Jgharston 22:48, 26 May 2009 (UTC) Jgharston (talk) 20:18, 13 June 2016 (UTC) Jgharston (talk) 20:51, 27 December 2022 (CET)