Difference between revisions of "83Plus:Hooks:9B88"
From WikiTI
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Synopsis == | == Synopsis == | ||
− | '''Name:''' | + | '''Name:''' GetCSC ''(officially GetKey; this name is discouraged)'' |
− | '''Hook Pointer Block Address:''' [[83Plus:RAM: | + | '''Hook Pointer Block Address:''' [[83Plus:RAM:9B88|9B88]] |
− | '''Hook Enable BCALL:''' [[83Plus:BCALLs: | + | '''Hook Enable BCALL:''' [[83Plus:BCALLs:4F7B|4F7B]] |
− | '''Hook Disable BCALL:''' [[83Plus:BCALLs: | + | '''Hook Disable BCALL:''' [[83Plus:BCALLs:4F7E|4F7E]] |
− | '''Hook Call BCALL:''' [[83Plus:BCALLs: | + | '''Hook Call BCALL:''' [[83Plus:BCALLs:4F78|4F78]] |
− | '''Hook Active Flag:''' | + | '''Hook Active Flag:''' [[83Plus:Flags:34#Bit_0|0, (iy + 34h)]] |
− | This hook | + | This hook is called when the OS scans for keypad activity. It is called once before the key scan begins, and a second time if the scan finds a key pressed. It thus operates at a lower level than the [[83Plus:Hooks:9B84|Raw Key hook]], which operates on GetKey values. |
== Using the Hook == | == Using the Hook == | ||
− | These different values, passed in | + | These different values, passed in A, determine what the hook should do. |
− | * | + | |
− | + | * 1Ah: Before the keypad is scanned | |
− | ** | + | ** Return with Z set and A = scancode to force a key to be "pressed." |
− | ** | + | ** Return with NZ set and A = 1Ah to scan the keypad normally. |
− | + | * 1Bh: After the keypad is scanned and a key is found | |
− | * | + | ** B = scancode found |
− | ** | + | ** Return with NZ set and A = scancode to be returned. |
== Comments == | == Comments == | ||
− | + | Officially named the "GetKeyHook." This name is deprecated and confusing. | |
+ | |||
+ | == Example == | ||
+ | The following code will swap the 2nd and Alpha keys: | ||
+ | |||
+ | <nowiki>GetKeyHook: | ||
+ | .db 83h ; Required for all hooks | ||
+ | cp 1Bh ; which condition? | ||
+ | ret nz | ||
+ | ld a,b ; which key was pressed? | ||
+ | cp skAlpha ; was it Alpha? | ||
+ | jr z,AlphaKey | ||
+ | cp sk2nd ; was it 2nd? | ||
+ | ret nz | ||
+ | ld a,skAlpha-1 ; change to Alpha | ||
+ | inc a ; set NZ | ||
+ | ret | ||
+ | AlphaKey: | ||
+ | ld a,sk2nd-1 ; change to 2nd | ||
+ | inc a ; set NZ | ||
+ | ret</nowiki> | ||
== Credits and Contributions == | == Credits and Contributions == | ||
− | * ''' | + | * '''Texas Instruments''' (thanks for all the confusing equates) |
Revision as of 21:45, 27 March 2005
Synopsis
Name: GetCSC (officially GetKey; this name is discouraged)
Hook Pointer Block Address: 9B88
Hook Enable BCALL: 4F7B
Hook Disable BCALL: 4F7E
Hook Call BCALL: 4F78
Hook Active Flag: 0, (iy + 34h)
This hook is called when the OS scans for keypad activity. It is called once before the key scan begins, and a second time if the scan finds a key pressed. It thus operates at a lower level than the Raw Key hook, which operates on GetKey values.
Using the Hook
These different values, passed in A, determine what the hook should do.
- 1Ah: Before the keypad is scanned
- Return with Z set and A = scancode to force a key to be "pressed."
- Return with NZ set and A = 1Ah to scan the keypad normally.
- 1Bh: After the keypad is scanned and a key is found
- B = scancode found
- Return with NZ set and A = scancode to be returned.
Comments
Officially named the "GetKeyHook." This name is deprecated and confusing.
Example
The following code will swap the 2nd and Alpha keys:
GetKeyHook: .db 83h ; Required for all hooks cp 1Bh ; which condition? ret nz ld a,b ; which key was pressed? cp skAlpha ; was it Alpha? jr z,AlphaKey cp sk2nd ; was it 2nd? ret nz ld a,skAlpha-1 ; change to Alpha inc a ; set NZ ret AlphaKey: ld a,sk2nd-1 ; change to 2nd inc a ; set NZ ret
Credits and Contributions
- Texas Instruments (thanks for all the confusing equates)