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

From WikiTI
Jump to: navigation, search
 
(Using the Hook)
 
(10 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|Raw Key Hook]] [[Category:83Plus:Hooks:By_Address|9B84 - Raw Key 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:''' Raw Key ''(has had other names proposed, which are discouraged -- see notes below.)''
  
'''Hook Pointer Block Address:''' [[83Plus:RAM:8562|8562]]
+
'''Hook Pointer Block Address:''' [[83Plus:RAM:9B84|9B84]]
  
'''Hook Enable BCALL:''' [[83Plus:BCALLs:1234|1234]]
+
'''Hook Enable BCALL:''' [[83Plus:BCALLs:4F66|4F66]]
  
'''Hook Disable BCALL:''' [[83Plus:BCALLs:5678|5678]]
+
'''Hook Disable BCALL:''' [[83Plus:BCALLs:4F6F|4F6F]]
  
'''Hook Call BCALL:''' [[83Plus:BCALLs:9012|9012]]
+
'''Hook Call BCALL:''' [[83Plus:BCALLs:4F5D|4F5D]]
  
'''Hook Active Flag:''' 6, (iy + 23h)
+
'''Hook Active Flag:''' [[83Plus:Flags:34#Bit_5|5, (iy + 34h)]]
  
 
This hook allows you to change the values that [[83Plus:BCALLs:4972|GetKey]] returns.
 
This hook allows you to change the values that [[83Plus:BCALLs:4972|GetKey]] returns.
  
 
== Using the Hook ==
 
== Using the Hook ==
These different values, passed in a, determines what the hook should do.
+
 
* 1: The calculator just turned on. There seem to be no other values passed to the hook.
+
This hook is called any time a key is accepted by [[83Plus:BCALLs:4972|GetKey]]. It is called for kOff only if bit [[83Plus:Flags:28#Bit_7|7,(iy+28h)]] is set.
* 2: The calculator is computing 1+1.
+
 
** b: 1
+
* A = keycode; ([[83Plus:RAM:8446|keyExtend]]) = extended keycode
** c: 1
+
** You can modify these values to change the key that is "pressed."
** Change b and/or c to affect the output of the problem (which will still look like 1+1 to the user).
+
* Return with Z set, or with A equaling zero, if the keypress should be ignored.
* 3: Preparing to turn off due to 2nd+OFF.
+
** Zero flag: Clear to abort the power off.
+
  
 
== Comments ==
 
== Comments ==
This hook doesn't exist. This is a demonstration only.
+
This hook is one of the four "official" hooks defined in ti83plus.inc.  However, it appears that someone at TI made a mistake in adding its address, because it does not in fact have anything to do with "raw" keys. It has been suggested that this was intended to be called the "GetKey" hook.  To avoid possible confusion with [[83Plus:Hooks:9B88|another hook]], the name "Raw Key" should be used nevertheless.
 +
 
 +
== Example ==
 +
The following code will swap the Apps and Prgm keys:
 +
<nowiki>RawKeyHook:
 +
        .db 83h            ; Required for all hooks
 +
        cp kAppsMenu        ; was Apps pressed?
 +
        jr z,AppsKey
 +
        cp kPrgm            ; was Prgm pressed?
 +
        ret nz
 +
        ld a,kAppsMenu      ; change key to kAppsMenu
 +
        or a                ; set NZ condition
 +
        ret
 +
AppsKey:
 +
        ld a,kPrgm          ; change key to kPrgm
 +
        or a                ; set NZ condition
 +
        ret</nowiki>
  
 
== Credits and Contributions ==
 
== Credits and Contributions ==
* '''/dev/hda1:''' My favorite hard drive partition.
+
* Texas Instruments

Latest revision as of 10:00, 27 October 2006

Synopsis

Name: Raw Key (has had other names proposed, which are discouraged -- see notes below.)

Hook Pointer Block Address: 9B84

Hook Enable BCALL: 4F66

Hook Disable BCALL: 4F6F

Hook Call BCALL: 4F5D

Hook Active Flag: 5, (iy + 34h)

This hook allows you to change the values that GetKey returns.

Using the Hook

This hook is called any time a key is accepted by GetKey. It is called for kOff only if bit 7,(iy+28h) is set.

  • A = keycode; (keyExtend) = extended keycode
    • You can modify these values to change the key that is "pressed."
  • Return with Z set, or with A equaling zero, if the keypress should be ignored.

Comments

This hook is one of the four "official" hooks defined in ti83plus.inc. However, it appears that someone at TI made a mistake in adding its address, because it does not in fact have anything to do with "raw" keys. It has been suggested that this was intended to be called the "GetKey" hook. To avoid possible confusion with another hook, the name "Raw Key" should be used nevertheless.

Example

The following code will swap the Apps and Prgm keys:

RawKeyHook:
        .db 83h             ; Required for all hooks
        cp kAppsMenu        ; was Apps pressed?
        jr z,AppsKey
        cp kPrgm            ; was Prgm pressed?
        ret nz
        ld a,kAppsMenu      ; change key to kAppsMenu
        or a                ; set NZ condition
        ret
AppsKey:
        ld a,kPrgm          ; change key to kPrgm
        or a                ; set NZ condition
        ret

Credits and Contributions

  • Texas Instruments