Write an assembly language program consisting of a main program and a subprogram (a second, separate procedure to be called from the main procedure). The purpose of the second procedure is to perform addition or subtraction on 96-bit unsigned integers stored in memory. Communication between the main program and the called procedure is to be done via CPU registers (you will need to choose four).
Write an assembly language program consisting of a main program and a subprogram (a second,
separate procedure to be called from the main procedure). The purpose of the second procedure is
to perform addition or subtraction on 96-bit unsigned integers stored in memory. Communication
between the main program and the called procedure is to be done via CPU registers (you will need to
choose four).
One CPU register must be used to pass the memory offset of the first operand to the subprogram. A
second register must be used to pass the offset of the second operand to the subprogram. A third
register must be used to pass the offset of the location where the result of the operation is to be
stored. The called procedure should use only the information passed from the main program in these
three registers to locate the two source and one destination operands in memory; do not refer to
these variables by name anywhere within the subprogram. A fourth register is to be used as an
operation selector to specify whether to add or subtract the two operands. If this register contains
zero, the operands are to be added; if it contains a nonzero value, the operands are to be subtracted.
Use assembler directives within your data segment to declare storage for and initialize the test
variables given below. The main program should call the subprogram twice: once to add the 96-
bit numbers 48C2E4C3552677F535D9607Bh plus 115724954F1792C6ED40C392h, and once to
subtract the 96-bit numbers 10792731164E95A224C2F0ABh minus
086234E52324642E3C7F1265h. Assemble and link your program and test it (using the debugger as
necessary). At the conclusion of your program run, observe the final CPU register contents and the
values of all variables of interest (the two source and one destination operands from both
calculations - a total of six 96-bit values) in memory. You can capture screen shots from within
the debugger, or use Irvine’s DumpRegs and DumpMem procedures, to show these final
register and memory contents.
DATA SEGMENT
NUM1 DB 9H
NUM2 DB 7H
RESULTS DB?
ENDS
Trending now
This is a popular solution!
Step by step
Solved in 2 steps