Action Routines
The following are details of the call and return register settings for the Loose item and Standard Menu action routines as well as the Application Sub-Window's hit routine and control routine.
The return parameters must be set by the action routine before it exits. Where a return parameter is noted as 'must be preserved', the value on entry to the action routine must be the same when the code exits.
Standard Menu Action Routine
Call Parameters | Return Parameters |
| D0.L - see Notes1 |
D1.L | virtual column/row for item | |
D2.W | item number | |
D4.L | 0 or pt__do (2) | D4.B | 0 or window event to set |
A0 | channel ID | A0 | must be preserved |
A1 | pointer to menu status block | |
A2 | window manager vector | |
A3 | pointer to sub window definition | |
A4 | pointer to working definition | A4 | must be preserved |
Loose Item Action Routine
Call Parameters | Return Parameters |
| D0.L - see Notes1 |
D1.L | x,y pointer position | |
D2.W | uppercase keystroke | |
D4.B | event number of keystroke | D4.B | 0 or window event to set |
A0 | channel ID | A0 | must be preserved |
A1 | pointer to status area | |
A2 | window manager vector | |
A3 | pointer to loose menu item | |
A4 | pointer to working definition | A4 | must be preserved |
Application Window Hit Routine
Call Parameters | Return Parameters |
| D0.L - see Notes1 |
D1.L | x,y pointer position | |
D2.W | uppercase keystroke, -1 or 0 | |
D4.B | event number of keystroke | D4.B | 0 or window event to set |
A0 | channel ID | A0 | must be preserved |
A1 | pointer to status area | |
A2 | window manager vector | |
A3 | pointer to sub-window definition | |
A4 | pointer to working definition | A4 | must be preserved |
Notes1
WM_RPTR/T will not return after a call to an action routine provided D4 is zero and the condition code Z is set.
The action and hit routines can force WM_RPTR/T to return in two ways. The first is by setting the condition codes to non zero, whatever the value of any of the registers. The second way is to set D4 to an event number. If this is done WM_RPTR/T will set the event in the status area and clear D4.
When WM_RPTR/T returns any value set by an action routine in D0 will still be there.
In the case of the application window hit routine D2 is -1 if the select key was pressed and zero if the pointer had just been moved and was in its window.
There must be a hit routine for an application window but this could simply be JMP WM_MHIT.
There need not be an action routine for menu items in an application window. In these cases the pointer should be zero.
Application Window Control Routine
Call Parameters | Return Parameters |
| D0.L and the status register must be set |
D2.W | item number - see Notes2 | |
D3.L | position of "hit" or -1 - see Notes2 | |
D4.B | pan or scroll event | D4.B | 0 or window event to set |
A0 | window channel ID | A0 | must be preserved |
A1 | pointer to status area | |
A2 | window manager vector | |
A3 | pointer to application window definition | |
A4 | pointer to working definition | A4 | must be preserved |
Notes2
The control routine is called either directly from WM.RPTR for a "hit" on the application window's pan or scroll bars, or from WM.MHIT when there has been a "hit" on the pan or scroll arrows.
Since the actions required can be carried out by the vector WM.PANSC the control routine could be simply JMP WM.PANSC(A2).
The item number in D2.W indicates which of the pan or scroll arrows or bars has been accessed and where. The lower byte gives the section of the window. The upper byte indicates where in the window the "hit" or "do" has occurred as shown in the table below.
D3.L gives the position of the "hit" on the pan or scroll bar. Each bar is considered to be a line of pixels, whose length is given in D3.W. The position of the hit, which might be any of these pixels, is given in the upper word of D3. See the table below.
In the case of a "do" on the pan or scroll bars the action taken by WM.PANSC would be to split the window, or, if the "do" was on the separator of an already split window, to rejoin it. To indicate this occurrence to the control routine, the upper word of D3 is negative.
Upper Byte of Item Number in D2.W
Space/Hit | Enter/Do | Where | D3.L |
$70 | $74 | Top arrows | -1 |
$71 | $75 | Bottom arrows | -1 |
$72 | $75 | Left arrows | -1 |
$73 | $75 | Right arrows | -1 |
$78 | $7C | Scroll bar | pos : len |
$7A | $7E | Pan bar | pos : len |