

Each EXEC/MT_CJOB transient program area is activated in the state:
(A6,A5.L) +-------------------+
high | Command string | } If A6+A5>A7, parameters from
address+-------------------+ }
| .L Channel ID | } the jobs parent job.
| ... | }
| .L Channel ID | }
+-------------------+ } (EXEC/EXEC_W leave A6+A5=A7.)
| .? Number of | }
(A7) i.e.USP| Channel IDs | }
+-------------------+
| Stack area/ | The jobs stack is the top
(A6,A4.L) | Data area |
+-=-=-=-=-=-=-=-=-=-+ part of the data area.
| Code area |
Even address+-------------------+
| .Bs Job Name | If the job name has an odd number
| .W #chars in j.n. |
| .W $4AFB | of characters, it's followed by
low | JMP.L start |
(A6) address+-------------------+ an (ignored) 'pad' character.
The stack usually runs from the top of the data area downwards, except that the various ways of loading can imply differing numbers of zeros already on the stack when the program is started.
TALENT WORKBENCH does not appear to implement the A4 and A5 conventions.
The A6 convention is of great use to circumvent the problem that instructions that store to memory may not have PC-related addresses, i.e. may not have addresses of either of the forms:

See Toolkit II documentation.

Defining extra routines
Call BP_INIT (qv) to link in the new routine(s).
...is by substitution:
Use CA_GTINT (.W integer) CA_GTFP (f.p.) CA_GTSTR (string) CA_GTLIN (f.p. converted to .L integer). Each needs A3 to base of & A5 to end of the NTEs of the parameters, assumes the parameters are of the same type, and returns the # of parameters fetched, with their values on the RI stack. Separator flags are spoilt.
For unquoted strings (i.e. SuperBASIC names to be used literally - e.g. as file names) the caller of CA_GTSTR must do as follows:
Entries on the stack must be word-aligned. So for a string
TOS is usually pointed to by A1. Space can be allocated by BV_CHRIX. The vectored routines for getting results to RI stack do their own space-allocation. RI stack is automatically tidied after procedures and after errors in functions.
On return from a function the returned value should be the topmost (i.e. lowest address) with nothing below it, and both (A6,A1.L) and BV_RIP(A6) pointing to it. The result type should be in D4 (1=string, 2=fp, 3=.W integer, with .L integers converted to f.p. before the RETurn).
Results can be passed back in parameters by pointing A3 to the NTE and calling BP_LET. If the actual was an expression, BP_LET doesn't give an error, and the result value is lost. The type of the result is given by the NTE, and the value on the RI stack must be in the correct form for that type.

| Last updated 4th January 1999. |