E-mail Address
Password

Register
arasian > support > education > tutorial

Ti-83 and Ti-84 Assembly Programming
Getting Started
     1.1: About This Tutorial
     1.2: About TI-ASM
     1.3: Writing Your First Program
     1.4: Compiling
     1.5: Debugging
ASM Basics
     2.1: Calls and Jumps
     2.2: Registers
     2.3: Displaying Text
System Controls and Calls
     3.1: Data
     3.2: Register Stack
     3.3: If Statements (Comparing)
     3.4: GetKey and GetCSC
     3.5: System Flags
     3.6: Menus
     3.7: Displaying Pictures
     3.8: For Loops (djnz)
     3.9: White Loops
     3.10: OP Registers
Applications
     4.1: Apps vs ASM
     4.5: KeyHooks
KeyHooks

The following tutorial is copied from this file

TI-83 Plus SDK/Hooks Programming Information
============================================
Information provided by Dan Englender (dan@calc.org)
Studied and transcribed into a readable document by Michael Vincent (michael@radicalsoft.org)

There are two kinds of key hooks, RawKeyHook and GetKeyHook. Important: Someone at TI reversed the names, so pay attention. RawKeyHook is executed when _getkey is pressed (on par with it). GetKeyHook is executed constantly (on par with _getcsc). RawKeyHook is the more useful, so we will cover that first.

---RawKeyHook---
Installation: B_CALL(4F66h) with the following inputs: A = ROM page hook is on, HL points to hook address.
Usage: The routine you set up upon installation will be called whenever _getkey is executed. When the routine is called, it will receive the following inputs:

A = Key code of the key pressed

You will need to have the following as outputs:

A = New key code
Zero flag is set if you want the keypress ignored, otherwise nonzero flag to execute the keypress.

There are some odd things in the calc's operation. You must have "add a,e" in your routine too. Working sample code is below (disables 2nd+Mem press):

;App header before here

	ld hl,keyhook		;Load HL with pointer to routine
	in a,(6)		;Get the current ROM page in A
	bcall($4F66)		;Call RawKeyHook
	bjump(_JForceCmdNoChar)	;Return to TI-OS
keyhook:			;The actual routine
	add a,e			;This is required for it to work
	cp $36			;Is the key 2nd+Mem?
	ret nz			;Exit if not
	xor a			;If so, set zero flag so it doesn't work
	ret			;Exit				
Creative Commons License
The text in this tutorial is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

Privacy Policy | Contact Us
(c) 1999-2010 Arasian. All rights reserved.