Difference between revisions of "OSBYTE &CA"

From BeebWiki
Jump to: navigation, search
(Tested and rewritten to clarify action.)
m (.)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:OSBYTE]]
 
[[Category:OSBYTE]]
===OSBYTE &CA (202) - Read/Write Keyboard Status===
+
{{PageTitle|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
  
  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/Electron: reserved              RISC OS: Alt pressed
+
When Shift Enable is on, the SHIFT key swaps the state of the Lock for the
    b1 = BBC/Electron: reserved              RISC OS: Scroll Lock set
+
keypress. When Shift Enable is off, SHIFT has no effect on the letter keys.
    b2 = BBC/Electron: reserved              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 = Electron: FN pressed            BBC/RISC OS: Control 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 27:
 
* *'''FX 202,160''' turns Shift Caps on
 
* *'''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
  
 
[[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)

Latest revision as of 08:49, 3 January 2023

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)