AMX 86 Procedures
K
A
DAK
203
Assembly Language Programming
If you are programming in assembly language, refer to Appendix E for a description of
the AMX assembly language calling conventions. The appendix includes a summary of
the input and output register specifications for every AMX procedure. Experienced
AMX programmers will usually find that the appendix is all that is required as a
programmer's reference guide.
New AMX users will want to reference the detailed AMX procedure descriptions
provided in this chapter. For their benefit, the assembly language input and output
register specifications have been included in a cryptic form along with the C language
call specifications.
Notational Conventions
The following example illustrates the notational conventions used for assembly language
calling sequences.
AMXID semid;
int value;
char tag[4];
int status;
.
.
status = ajsmcre(&semid, value, tag);
AX BX= BX [DX:CX]
Let reg be the assembly language mnemonic for an y general 8 or 16-bit 8086 register.
Let seg be the assembly language mnemonic for any 8086 segment register.
If reg appears underneath any input or output parameter name, then the value of that
parameter is presented or received in register reg. In the example, value is presented to
assembly language procedure AASMCRE in BX and status is received from it in AX.
Some AMX procedures must return more than a single integer result to the caller. When
programming in C, the caller must provide a pointer to a variable into which AMX can
store the result (&semid for example). The syntax reg= is used to indicate that at the
assembler level, the result is returned in register reg, not in storage referenced by reg. In
the example, the value which would be assigned to C variable semid is received from
AASMCRE in register BX.
Occasionally, parameters are passed by reference in C but by value in assembl y language.
For example, 4-character tags are passed as string pointers in C but are passed in a
register pair in assembly language. The syntax [reg] underneath a pointer to a
parameter indicates that the actual parameter referenced by the pointer is passed in
register reg. In the example, the four bytes referenced by pointer tag are passed to
AASMCRE in register DX:CX.