83Plus:Hooks:9B84

From WikiTI
Revision as of 00:30, 28 March 2005 by FloppusMaximus (Talk | contribs)

Jump to: navigation, search

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 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