_EXEC - execute machine instructions.

(GCOS-8 only)

Usage:

result = _exec(aq, inst1, inst2, ...);

Where:

aq
is a two-word structure containing values to be assigned to the A and Q registers before the given instructions are executed. You can declare this structure to have whatever form is appropriate to the type of instructions being executed. For example, if you want to treat A and Q as separate integers, you can declare
struct {
    int a, q;
} aq;
int inst1, inst2, ...;
is a sequence of machine instructions. Each instruction is specified as an integer whose value is equal to the hardware's representation of the desired machine instruction.
result
is the result of the executed instructions, as obtained from the AQ or EAQ register. For more information about results, see below.

Description:

"_exec" loads the A and Q registers with specified values, then executes a specified set of machine instructions.

Loosely speaking, the result of "_exec" is the value of the A and Q registers after the instructions have been executed. However, the actual result depends on the way you declare "_exec".

In other words, the way you declare "_exec" determines where the compiler looks for the result. Naturally, the specified machine instructions must ensure that the result is left where the compiler expects to find it.

You can also vary the way that argument values are passed to "_exec". The first machine word of the argument values is always passed in the A register and the second machine word is always passed in the Q register. Therefore, if you call the function with

_exec(aq, inst1, ...);

the first two words of the "aq" structure are passed in the A and Q registers. However, you could also use constructs like

double dval;
_exec(dval, inst1, ...);

where the "double" value is passed in the AQ register, or

int a, q;
_exec(a, q, inst1, ...);

where you pass two integers, one for the A register and one for the Q.

Notes:

If you call the "_exec" function with different calling sequences within the same compilation unit, give each calling sequence a different name and use the #equate directive to associate the different names with "_exec", as in

#equate d_exec _exec
typedef struct {
    int a, q;
} AQ;
double d_exec(AQ aq, ...);
AQ _exec(int a, int q, ...);

By using different names, you can avoid diagnostic messages about conflicts between calling sequences.

Copyright © 1996, Thinkage Ltd.