83Plus:Hooks:9BA0

From WikiTI
Jump to: navigation, search

Synopsis

Name: Regraph Hook

Hook Pointer Block Address: 9BA0

Hook Enable BCALL: 4FEA

Hook Disable BCALL: 4FED

Hook Call BCALL: 4FF0

Hook Active Flag: 6, (iy + 35h)

This hook allows one to intercept various events that occur during a regraph, and optionally cancel them. Be aware that this hook is called if a function is being drawn on top of a currently existing graph ("smart graph.")

Note: This was only extensively researched in function mode.

Using the Hook

In most cases, returning with zero set will allow something to occur, and returning with zero reset will cancel something. Like some hooks, this hook is rather messy.

These events are listed in the order below to match the order they are actually called in.

  • A = 00h: Graphing has started, otherwise nothing has occured. Returning with zero reset will cancel the entire graphing procedure.
  • A = 01h: Graph about to be erased if required, otherwise presented (from plotSScreen) Returning with zero reset will cancel the entire graphing process.
  • A = 02h: About to draw axes and grid. Returning with zero reset will cancel this drawing only.
  • A = 09h: Stat plots drawn. About to draw equations. Returning with zero reset will cancel drawing of all equations (or at least the ones being drawn in this graph.)
  • A = 03h: About to evaluate a point. OP1 contains the value of the independant variable. E contains the equation number only if this is the first time this message is sent for this function, otherwise may hold C9h. Return value ignored. Message skipped in Simultaneous mode.
  • A = 08h: About to evaluate a point---this is somewhat a duplicate of event 03h. OP1 contains equation name. Called twice in the case of Parametric graphs (one time for X and one time for Y). Value of E here the same as value of E during the message A = 3, or if in Simultaneous mode then the number of the equation. During the first call per equation (when not in Simultaneous mode), OP4 may contain the name of the independant variable. This event can also be called when the next location of the trace cursor has to be calculated. Returning with zero reset will make the os try to use the value in OP1 as result. Returning with zero set will make the os try to execute the equation, resulting in event 04h. (Changing the name of the equation in OP1 has no effect.)
  • A = 04h: Function evaluated. OP1 is the X coordinate after evaluation. OP2 is the Y coordinate after evaluation, assuming that zero was set as a return value when A = 08h, otherwise contains function name. Canceling this event will cancel drawing of that point, as well as any line connecting to it. This event is skipped if an error occured in parsing.
  • A = 05h: Called after A = 4 regardless of return value or if A = 4 wasn't called due to parse error. Skipped in Simultaneous mode.
  • A = 06h: B contains pixel x-coordinate of the next point to be drawn. Can be modified if desired (but not sure on exact behavior.) Skipped in Simultaneous mode.
  • A = 07h: About to draw axes labels, and done drawing equations. Return values ingored.

Comments

Below is a table of the order of events that are called for each point to be evaluated. In parametric mode the event 08h is called twice because it has to evaluate both X and Y (in that order).

Function (sequential) 03h 08h 04h 05h 06h
Function (simultaneous) 08h 04h
Parametric 08h 08h 04h
Polar 08h 04h
Sequential 04h

As mentioned, this hook's behavior is rather erratic and messy; the best way to learn it is to just mess with it.