Difference between revisions of "83Plus:Hooks:9B88"

From WikiTI
Jump to: navigation, search
 
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Note:''' Do not take the information on this template page as actual documentation!
+
[[Category:83Plus:Hooks:By_Name|GetCSC Hook]] [[Category:83Plus:Hooks:By_Address|9B88 - GetCSC Hook]]
 
+
The Hooks are named by their hook pointer block address (the four bytes consisting of page, address, and an extra byte), in hexadecimal. An example is [[83Plus:Hooks:9B84]].
+
 
+
----
+
 
+
 
== Synopsis ==
 
== Synopsis ==
'''Name:''' ImAHook
+
'''Name:''' GetCSC ''(officially GetKey; there is some disagreement as to the appropriateness of both names)''
  
'''Hook Pointer Block Address:''' [[83Plus:RAM:8562|8562]]
+
'''Hook Pointer Block Address:''' [[83Plus:RAM:9B88|9B88]]
  
'''Hook Enable BCALL:''' [[83Plus:BCALLs:1234|1234]]
+
'''Hook Enable BCALL:''' [[83Plus:BCALLs:4F7B|4F7B]]
  
'''Hook Disable BCALL:''' [[83Plus:BCALLs:5678|5678]]
+
'''Hook Disable BCALL:''' [[83Plus:BCALLs:4F7E|4F7E]]
  
'''Hook Call BCALL:''' [[83Plus:BCALLs:9012|9012]]
+
'''Hook Call BCALL:''' [[83Plus:BCALLs:4F78|4F78]]
  
'''Hook Active Flag:''' 6, (iy + 23h)
+
'''Hook Active Flag:''' [[83Plus:Flags:34#Bit_0|0, (iy + 34h)]]
  
This hook allows you to change the values that [[83Plus:BCALLs:4972|GetKey]] returns.
+
This hook is called when the OS scans for keypad activity.  (Note, however, that it is only called when the OS is idle in the [[83Plus:BCALLs:4972|GetKey]] routine.)  It is called once before the key scan begins, and a second time after the keypad has been scanned.  It thus operates at a lower level than the [[83Plus:Hooks:9B84|Raw Key hook]], which operates on actual GetKey values.
  
 
== Using the Hook ==
 
== Using the Hook ==
These different values, passed in a, determines what the hook should do.
+
These different values, passed in A, determine what the hook should do.
* 1: The calculator just turned on. There seem to be no other values passed to the hook.
+
 
* 2: The calculator is computing 1+1.
+
* 1Ah: Before the keypad is scanned
** b: 1
+
** Return with Z set and A = '''keycode''' to force a key to be "pressed."
** c: 1
+
** Return with NZ set and A = 1Ah to scan the keypad normally.
** Change b and/or c to affect the output of the problem (which will still look like 1+1 to the user).
+
* 1Bh: After the keypad is scanned
* 3: Preparing to turn off due to 2nd+OFF.
+
** B = scancode found (or 0 if no key pressed)
** Zero flag: Clear to abort the power off.
+
** Return with NZ set and A = '''scancode''' to be returned.
  
 
== Comments ==
 
== Comments ==
This hook doesn't exist. This is a demonstration only.
+
Officially named the "GetKeyHook" by ti83plus.inc.  Although it has been pointed out that it is only called during GetKey, referring to it as the "GetKeyHook" is rather misleading, because it deals only with raw scan codes ("GetCSC values") as opposed to the full keypresses returned by GetKey (which depend, for example, on whether 2nd or Alpha are active.)
 +
 
 +
== 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 ==
* '''/dev/hda1:''' My favorite hard drive partition.
+
* '''Texas Instruments''' (thanks for all the confusing equates)

Latest revision as of 10:55, 29 July 2011

Synopsis

Name: GetCSC (officially GetKey; there is some disagreement as to the appropriateness of both names)

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. (Note, however, that it is only called when the OS is idle in the GetKey routine.) It is called once before the key scan begins, and a second time after the keypad has been scanned. It thus operates at a lower level than the Raw Key hook, which operates on actual 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 = keycode 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
    • B = scancode found (or 0 if no key pressed)
    • Return with NZ set and A = scancode to be returned.

Comments

Officially named the "GetKeyHook" by ti83plus.inc. Although it has been pointed out that it is only called during GetKey, referring to it as the "GetKeyHook" is rather misleading, because it deals only with raw scan codes ("GetCSC values") as opposed to the full keypresses returned by GetKey (which depend, for example, on whether 2nd or Alpha are active.)

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)