CS 2011, A Term 1999
Introduction to Machine Organization and Assembly Language
Extra Credit Project (due Oct. 8)

Instructions

  1. Write an assembly language procedure named bigmul that accepts three singleword unsigned integer parameters x, y, n on the stack and returns a pointer to the product of [x] and [y] in register DI. Notice that the first two parameters x and y are pointers to the actual multiplication operands [x] and [y]. The third parameter, n, indicates the number of words occupied by each of the operands [x] and [y]; it is assumed that the product [DI] occupies 2n words. You may restrict the allowable values of n to the interval 1 <= n <= 8 (if you want to be fancier and to allow larger values of n, use DOS functions for dynamic memory allocation as described in Irvine, chapter 14). Bigmul should be thought of as having the prototype bigmul(x,y,n), and C/C++ calling conventions should be used (however, no linking to C/C++ is required).
  2. Link bigmul with (an appropriately modified version of) the main procedure from HW4, which prompts the user for unsigned integer values of x and y, calls bigmul to compute the product x*y, and displays the result to the user. Note that you may need to modify the display procedures so that larger integer values can be handled. If you plan to modify the Irvine library procedure Writeint, remember that the source code presented in the book is incomplete, as it fails to initialize CX and DI.
  3. Assemble, link, and debug your program using tasm / tlink / td.

Deliverables

  1. Submit a floppy disk containing the assembly source code for the bigmul and main procedures as well as any necessary library procedures, documentation including complete command line assembler/linker options (follow the WPI CS documentation standard described at http://www.cs.wpi.edu/Help/documentation-standard.html), and a script file showing the DOS window view of a run of your program as it computes the product 10,000,000,000 times 1,234,567. (you may use the prn2file utility available on the ccc machines in the directory /cs/cs2011/   to generate the script file).
  2. Explain what technical issues you had to address in this assignment beyond the issues raised by HW4, and describe the main features of your solutions to these issues.
  3. Submit hardcopies of the above items.
Everything you submit (files too) must include your name, login, and section number. Note that no credit will be given for programs that do not assemble/link correctly under tasm/tlink when the documentation instructions are followed, or that do not produce correct output in cases in which the result occupies three or more 16-bit words.

Background Information

Dynamic memory allocation

See Irvine, chapter 14 for information about DOS function calls for dynamic memory allocation (note that dynamic memory allocation isn't required for the basic n<=8 version).