Lab 09
Lab 09
Lab Task
Pass the address of the string and its length as arguments via the stack.
Save the flags using pushf and restore them with popf to preserve the status during string
manipulation.
Use registers carefully and save them with pusha/popa if needed.
Pass the address of the array and the number of elements via the stack.
Manually sort it without comparing values
Protect all registers using pusha/popa.
Display the sorted array in the main program using Kip Irvine’s WriteInt.
Push the operation code (1 for addition, 2 for subtraction, 3 for multiplication, 4 for
division) and two integers onto the stack.
Save flags using pushf and restore them with popf.
Protect registers using pusha/popa. Return the result on the stack.
Pass the number of terms (n) and the address of an array to store the sequence via the
stack.
Use pusha and popa to protect registers.
Use pushf and popf where necessary to preserve flags during computations.
The sequence should be generated iteratively.
Test the procedure with n = 10 and display the sequence using Kip Irvine's WriteInt.
Note:
USE Offset Operator for passing arrays as arguments on Stack.
e.g.:
MOV ECX, OFFSET ARRAY
PUSH ECX
mov ecx,[ebp+8]