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

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:''' Homescreen
  
'''Hook Pointer Block Address:''' [[83Plus:RAM:8562|8562]]
+
'''Hook Pointer Block Address:''' [[83Plus:RAM:9B8C|9B8C]]
  
'''Hook Enable BCALL:''' [[83Plus:BCALLs:1234|1234]]
+
'''Hook Enable BCALL:''' [[83Plus:BCALLs:4FAB|4FAB]]
  
'''Hook Disable BCALL:''' [[83Plus:BCALLs:5678|5678]]
+
'''Hook Disable BCALL:''' [[83Plus:BCALLs:4FAE|4FAE]]
  
'''Hook Call BCALL:''' [[83Plus:BCALLs:9012|9012]]
+
'''Hook Call BCALL:''' ''(none known)''
  
'''Hook Active Flag:''' 6, (iy + 23h)
+
'''Hook Active Flag:''' [[83Plus:Flags:34#Bit_4|4, (iy + 34h)]]
  
This hook allows you to change the values that [[83Plus:BCALLs:4972|GetKey]] returns.
+
This hook is called when various events occur on the homescreen.
  
 
== Using the Hook ==
 
== Using the Hook ==
These different values, passed in a, determines what the hook should do.
+
These different values, passed in A, determine what the hook should do.
* 1: The calculator just turned on. There seem to be no other values passed to the hook.
+
* 0: The calculator is displaying a result.
* 2: The calculator is computing 1+1.
+
** [[83Plus:RAM:8478|OP1]] = the value to display
** b: 1
+
** You can change the value in OP1 to display something different, which will not affect the value stored to Ans.
** c: 1
+
** If you want to display something wider than the screen, you must also write the formatted string to [[83Plus:RAM:97B1|fmtString]].
** Change b and/or c to affect the output of the problem (which will still look like 1+1 to the user).
+
** Return NZ and TIOS will not display anything.
* 3: Preparing to turn off due to 2nd+OFF.
+
* 1: A key was pressed at the homescreen.
** Zero flag: Clear to abort the power off.
+
** B = keycode
 +
** Change B to change the key that appears to be pressed.
 +
** Return NZ to ignore the keypress.
 +
* 2: An expression was entered to be evaluated.
 +
** OP1 contains the name of the entry, prgm#.
 +
** Return NZ to cancel running the program.
 +
* 3: Changing context to the homescreen.
 +
** B = previous context value
 +
** You should always return Z in this case.
 +
 
 +
== Example ==
 +
The following code will display a random number as the result of any calculation.
  
== Comments ==
+
<nowiki>HomescreenHook:
This hook doesn't exist. This is a demonstration only.
+
        .db 83h            ; Required for all hooks
 +
        or a               ; are we in condition 0 (display value?)
 +
        jr nz,ReturnZ
 +
        B_CALL _Random      ; change our output value to a random #
 +
ReturnZ:
 +
        cp a                ; set zero condition
 +
        ret</nowiki>
  
 
== Credits and Contributions ==
 
== Credits and Contributions ==
* '''/dev/hda1:''' My favorite hard drive partition.
+
* '''Michael Vincent:''' Analysis and writing the most amazingly cool homescreen hacks I've seen yet.

Revision as of 22:14, 27 March 2005

Synopsis

Name: Homescreen

Hook Pointer Block Address: 9B8C

Hook Enable BCALL: 4FAB

Hook Disable BCALL: 4FAE

Hook Call BCALL: (none known)

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

This hook is called when various events occur on the homescreen.

Using the Hook

These different values, passed in A, determine what the hook should do.

  • 0: The calculator is displaying a result.
    • OP1 = the value to display
    • You can change the value in OP1 to display something different, which will not affect the value stored to Ans.
    • If you want to display something wider than the screen, you must also write the formatted string to fmtString.
    • Return NZ and TIOS will not display anything.
  • 1: A key was pressed at the homescreen.
    • B = keycode
    • Change B to change the key that appears to be pressed.
    • Return NZ to ignore the keypress.
  • 2: An expression was entered to be evaluated.
    • OP1 contains the name of the entry, prgm#.
    • Return NZ to cancel running the program.
  • 3: Changing context to the homescreen.
    • B = previous context value
    • You should always return Z in this case.

Example

The following code will display a random number as the result of any calculation.

HomescreenHook:
        .db 83h             ; Required for all hooks
        or a                ; are we in condition 0 (display value?)
        jr nz,ReturnZ
        B_CALL _Random      ; change our output value to a random #
ReturnZ:
        cp a                ; set zero condition
        ret

Credits and Contributions

  • Michael Vincent: Analysis and writing the most amazingly cool homescreen hacks I've seen yet.