83Plus:Hooks:9B7C

From WikiTI
Revision as of 20:14, 6 April 2005 by Michael (Talk | contribs)

Jump to: navigation, search

Synopsis

Name: Cursor Hook

Hook Pointer Block Address: 9B7C

Hook Enable BCALL: 4F60

Hook Disable BCALL: 4F69

Hook Call BCALL: 4F57

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

This hook is called when the edit cursor (the flashing block cursor) is shown or hidden.

Using the Hook

There are three events that are passed for various events, identified when A = 22h, 23h, or 24h. I'm not aware of any event where A < 22h.

  • A = 22h: This is one of the two events that occur before the cursor will be displayed. Returning with the zero flag set will abort the display sequence, but returning with the zero flag reset will cause the sequence to continue. If you want to change the cursor, draw your own one here and return with the zero flag set.
  • A = 23h: I (JasonM) have no clue why this event exists! It is called after event 22h, but before the actual drawing occurs. It's only called if you returned with the zero flag reset for event 22h (basically, if you said you want the cursor to flash.) If you return with zero set, it cancels the flash, otherwise it will draw it's usual cursor. It would appear that the TI-OS just wants to confirm your decision from the first event!
  • A = 24h: This event is called when the cursor block is about to be replaced with the character underneath it. Returning with the zero flag set will cause this operation to be canceled (the cursor block will be left on the screen.) The character underneath the cursor is passed in B (it's simply a copy of curUnder), and you should return the character in A. If you want to, you can return any character you like: this will make it appear that the cursor is above a character other than it actually is (note: this doesn't actually edit the text in the edit buffer.) The TI-OS tends to cause redraw errors if you return a character other than in B, so it's probably a good idea to to just return B (make sure you do an "or a" to clear the zero flag, or the cursor won't disappear.)

Comments

This hook is pretty useless (unless you're saving the manatees). Still, since it will be fired when the user enters most contexts (any context that starts in an edit buffer), it can serve as a useful hook if you want to fire in a particular context after the context is set up. It could also serve as a replacement for a custom interrupt under some situtations.

Credits and Contributions

  • Michael Vincent: Example of hook usage in Omnicalc