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

From WikiTI
Jump to: navigation, search
 
Line 1: Line 1:
'''Note:''' Do not take the information on this template page as actual documentation!
 
 
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:''' Library Hook
  
'''Hook Pointer Block Address:''' [[83Plus:RAM:8562|8562]]
+
'''Hook Pointer Block Address:''' [[83Plus:RAM:9B80|9B80]]
  
'''Hook Enable BCALL:''' [[83Plus:BCALLs:1234|1234]]
+
'''Hook Enable BCALL:''' [[83Plus:BCALLs:4F63|4F63]]
  
'''Hook Disable BCALL:''' [[83Plus:BCALLs:5678|5678]]
+
'''Hook Disable BCALL:''' [[83Plus:BCALLs:4F6C|4F6C]]
  
'''Hook Call BCALL:''' [[83Plus:BCALLs:9012|9012]]
+
'''Hook Call BCALL:''' [[83Plus:BCALLs:94F5A|4F5A]]
  
'''Hook Active Flag:''' 6, (iy + 23h)
+
'''Hook Active Flag:''' [[83Plus:Flags:34#Bit_1|1, (iy + 34h)]]
  
This hook allows you to change the values that [[83Plus:BCALLs:4972|GetKey]] returns.
+
This hook is available for apps' internal use and to interface with BASIC programs using the OpenLib and ExecLib functions.
  
 
== 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 never used by the 83+ OS. On the 84+, it is used to implement the OpenLib( / ExecLib functions.
* 2: The calculator is computing 1+1.
+
** b: 1
+
** c: 1
+
** Change b and/or c to affect the output of the problem (which will still look like 1+1 to the user).
+
* 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.
+
 
 +
If you place the following at 4087:
 +
 
 +
<nowiki> .db 96h, 0E2h
 +
.dw 100h, LibHookInfo</nowiki>
 +
 
 +
and the following anywhere on the first page of your app:
 +
 
 +
<nowiki>LibHookInfo:
 +
.dw 1
 +
.db 2, 0
 +
.dw LibraryHook</nowiki>
 +
 
 +
a BASIC program (on the 84+) can then call your hook.
 +
 
 +
* First, the BASIC program calls the OpenLib( function with the name of your app as argument.
 +
* Your app's hook is enabled and bit [[83Plus:Flags:3E#Bit_4|4, (iy+3Eh)]] is set to indicate that ExecLib is enabled.
 +
* When the BASIC program calls ExecLib, your app's hook is called.
 +
 
 +
Note that OpenLib and ExecLib are only valid in programs, and not in the homescreen entry or in equations.
  
 
== Credits and Contributions ==
 
== Credits and Contributions ==
* '''/dev/hda1:''' My favorite hard drive partition.
+
* '''Michael Vincent:''' Analyzing the OpenLib/ExecLib interface on OS 2.21 and above.

Revision as of 22:25, 27 March 2005

Synopsis

Name: Library Hook

Hook Pointer Block Address: 9B80

Hook Enable BCALL: 4F63

Hook Disable BCALL: 4F6C

Hook Call BCALL: 4F5A

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

This hook is available for apps' internal use and to interface with BASIC programs using the OpenLib and ExecLib functions.

Using the Hook

This hook is never used by the 83+ OS. On the 84+, it is used to implement the OpenLib( / ExecLib functions.

Comments

If you place the following at 4087:

 .db 96h, 0E2h
 .dw 100h, LibHookInfo

and the following anywhere on the first page of your app:

LibHookInfo:
 .dw 1
 .db 2, 0
 .dw LibraryHook

a BASIC program (on the 84+) can then call your hook.

  • First, the BASIC program calls the OpenLib( function with the name of your app as argument.
  • Your app's hook is enabled and bit 4, (iy+3Eh) is set to indicate that ExecLib is enabled.
  • When the BASIC program calls ExecLib, your app's hook is called.

Note that OpenLib and ExecLib are only valid in programs, and not in the homescreen entry or in equations.

Credits and Contributions

  • Michael Vincent: Analyzing the OpenLib/ExecLib interface on OS 2.21 and above.