A C++ program contains the following call to an external assembly procedure:
cryptic(x,y,z);
Assume that the parameters x, y, z are short integers that occupy two bytes
of memory each. Assume also that x and y are passed by reference, whereas z
is passed by value. Standard C naming and calling conventions are assumed to
be in effect. The C++ prototype of the assembly procedure is:
extern "C" void cryptic(int& x, int& y, int z);
- (a) Give the full proc / endp directives for the assembly procedure.
Do not include any explicit parameter declarations.
- (b) Write assembly instructions that set up a stack frame within the
assembly procedure and then proceed to copy the *values* (not the addresses)
of the parameters x, y, z to registers ax, bx, cx, respectively. Previous
values of ax, bx, cx should be saved for future use.
- (c) Where is stack clean-up performed in the present context?
Give assembly-level code that performs this task.