Difference between revisions of "OSBYTE &CA"

From BeebWiki
Jump to: navigation, search
m (.)
(Rewritten table, clarified.)
Line 1: Line 1:
 
[[Category:OSBYTE]]
 
[[Category:OSBYTE]]
==OSBYTE &CA (202) - Read/Write Keyboard Status==
+
[[Category:OSBYTE]]
 +
{{PageTitle|OSBYTE &CA (202): Read/Write Keyboard Status}}
 +
This byte determines 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=Shift,    b1: reserved        b1: Scroll Lock set
 +
  b2: reserved          2=Ctrl, 3=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
  
This byte determines the current state of the keyboard modifier keys
+
Only one Lock can be set in b5-b4: 01=Shift Lock, 10=Caps Lock, 11=No Lock.
  b0 = BBC/Elk/Master: res  Compact: b0-b2 = EXTEND status            RISC OS: Alt pressed
+
When Shift Enable is on, the SHIFT key swaps the state of the Lock for the
  b1 = BBC/Elk/Master: res              1=EXTEND, 2=Shift-EXTEND        RISC OS: Scroll Lock set
+
keypress. When Shift Enable is off, SHIFT has no effect on the letter keys.
  b2 = BBC/Elk/Master: res              3=Ctrl-EXTEND, 4=Sh-Ct-EXTEND  RISC OS: Num Lock set
 
  b3 = Shift pressed
 
  b4 = Caps lock off
 
  b5 = Shift lock off
 
      (ie, b5-4=01: Shift Lock on, 10: Caps Lock on, 11: No lock)
 
  b6 = BBC/Master/RISC OS: Control pressed            Electron: FN pressed
 
  b7 = Shift enable (Shift Caps or Shift Inverse)
 
 
 
With Caps Lock on and Shift Enable off, Shift has no effect on letter keys.
 
  
 
===Examples===
 
===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,16''' turns Shift Lock on
 
* *'''FX 202,32''' turns Caps Lock on
 
* *'''FX 202,32''' turns Caps Lock on
Line 21: Line 28:
 
* *'''FX 202,160''' turns Shift Caps on
 
* *'''FX 202,160''' turns Shift Caps on
  
 +
===Extensions===
 +
  AppleII Applecorn:
 +
  b3-b0: reserved
 +
  b4:    Shift pressed
 +
  b5:    Control pressed
 +
  b7-b6: reserved
  
 
[[User:Jgharston|Jgharston]] 22:48, 26 May 2009 (UTC)
 
[[User:Jgharston|Jgharston]] 22:48, 26 May 2009 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 20:18, 13 June 2016 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 20:18, 13 June 2016 (UTC)
 +
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 20:51, 27 December 2022 (CET)

Revision as of 21:51, 27 December 2022

OSBYTE &CA (202): Read/Write Keyboard Status
This byte determines 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=Shift,    b1: reserved         b1: Scroll Lock set
  b2: reserved           2=Ctrl, 3=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:
  b3-b0: reserved
  b4:    Shift pressed
  b5:    Control pressed
  b7-b6: reserved

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