About me

Course Work




Sample Report

This page is meant only as a guideline for a potential report. Additionally, not every section will be required for each project. I will announce what I expect for each project in class. Please pay particular attention to the sample source code at the end of the report.


  1. Cover Page
  2. Introduction
    1. Overall Function (what's it do - short paragraph)
    2. Target Machine and Environment (Processor? OS? How much RAM? etc)
    3. Algorithm Statement (pseudo code in addition to a verbal description is okay)
  3. Results
    1. Memory Utilization (.MAP file)
    2. Results of Measurements
    3. User Instructions and Transcript Example (Sample run)
    4. Conclusions (what does or does not work - high level)
  4. System Description
    1. Diagram of Program Components
    2. High-level Flow Description
    3. Descriptions of Non-Trivial Subroutines and How They Manipulate Data
  5. Flow Charts
  6. Testing
    1. Testing of Non-Trivial Modules (how did you determine what doesn't work)
    2. Integrated Testing (how did you build up your system and pull it together)
    3. Description of Non-Functioning Routines (what does or does not work - low level)
  7. Statement of Originality
    1. Contributor's Names and Assistance Provided (and mark the source code)
    2. References
    3. Signature
  8. Commented Program Listing - FIXED FONT (Courier)
    1. Design and Efficiency (optimized for space or time? where?)
    2. Integrity and Formatting (columns, contributor's code clearly marked?)
    3. Comments (non-trivial, easy to read, descriptive)


CSE 240-03

Project 1

Extended Precision Octal Multiplier



Overall Function:

This program requests two octal numbers, up to 20 digits each, and computes and displays their product. After each computation, the user will be allowed to compute another product or exit the program.

Target Machine:

This program was developed for an 8088 or greater processor running MS-DOS 2.0. A minimum of 1k of disk space and 1k of RAM are required to run this program.

Algorithm Statement:

There are three main stages to this program: input, computation, and output.

  1. Input: For each number entered, characters are read from the keyboard into 21-character left-justified buffers. After a number is buffered, a loop is executed to check each digit to be sure that it is in the range 0-7. For each digit, if it is in the correct range, then the ascii character '0' is subtracted from the digit's stored value, converting it from a character to an integer. If it was not in the correct range, an error message is displayed and the user can reenter the number.
  2. Computation: The multiplication is executed with the algorithm demonstrated in the following pseudo code. Note that the result is placed in a string called temp, in reverse order.
    	count := 0;
    	for i := (length of number2) downto 1
    		carry = 0;
    	count := count + 1;
    	place := 0;
    	for j := (length of number1) downto 1
    		temp[place+count] = temp[place+count] + number1[j] * number2[i] + carry;
    	divide temp[place+count] by 8;
    	put quotient into carry;
    	put remainder into temp[place+count];
    	place := place + 1;
    	if (j=1) then temp[place+count+1] = carry;
  3. Output: Since the result is stored as a string in reverse order, the display algorithm starts at the end of the string. It checks the elements to see whether they are zeros, and skips over them if they are. When the first nonzero element is reached, the ascii character '0' is added to it and it is displayed to the screen. When the termination character (a CR, initialized to the beginning of the string) is reached, the printing ends. Special consideration is given to the condition where the product is zero by printing a zero if no nonzero characters were reached after 40 checks down the string.
  4. Results

    Memory Utilization:

      Start  Stop   Length Name               Class
      00000H 001FFH 00200H _STACK             STACK
      00200H 002D1H 000D2H _DATA              DATA
      002D2H 003EEH 0011DH _TEXT              CODE
     Program entry point at 002D:0002

    User Instructions:

    To produce an executable file, at the DOS prompt type:

    	tasm lab1<enter>
    	tlink lab1<enter>
    To run this program, at the DOS prompt type:

    The program will prompt you for two octal integers of 20 digits or less. At each prompt, type the number and press enter. If you attempt to enter more than 20 digits at either prompt, the computer will beep and not accept the extra digits. The program will then compute the octal product of the two numbers you entered and display it. Then the program will ask whether you would like to repeat the process. Hit 'y' to repeat; hitting any other key will exit the program.

    Sample Run:

    	Enter 1st number:  156
    	Enter 2nd number:  4133
    	The product is  :  713432
    	Again (y/n)?y
    	Enter 1st number:  0u1hk
    	That is not a valid octal number.
    	Enter 1st number:  00032
    	Enter 2nd number:  9
    	That is not a valid octal number.
    	Enter 2nd number:  2
    	The product is  :  64
    	Again (y/n)?n


    This program meets all of the required specifications. It can handle all standard input, correctly dealing with 1-20 digit octal numbers with or without leading zeros. It can handle all nonstandard input, requiring the user to reenter any string that contains digits out of the range of 0-7. It does not allow the user to enter more than 20 digits, and it re-prompts the user if he presses <enter> at a prompt without typing any data. Note that all characters not in the range of 0-7 are considered invalid, including minus signs and decimal points. The program produces correct output without leading zeros, and continues or exits properly.


    Testing of Non-Trivial Modules:

    As described in the Algorithm Statement, above, the program can be broken down into three sections. Each section was tested as it was completed, using the debugger to look at the memory. Output depended on Computation which depended on Input, so they were built and tested in the reverse order. See the Test Table, below, for complete results.

    Input: Output:  
    number1number2Expected resultProgram resultReason for test
    <CR> re-prompt for number1re-prompt for number1What if user just hits <CR>?
    3<CR>re-prompt for number2re-prompt for number2What if user just hits <CR>?
    0004000125050Are leading zeros OK?
    912 err msg, re-prompt for number1err msg, re-prompt for number1Number out of range?
    312edq21 err msg, re-prompt for number1err msg, re-prompt for number1Invalid characters entered?
    1988err msg, re-prompt for number2err msg, re-prompt for number2Number out of range?
    12rfhw4err msg, re-prompt for number2err msg, re-prompt for number2Invalid characters entered?
    <more than 20 digits> beep, only accept first 20beep, only accept first 20More than 20 characters entered?
    0000Handles 0 correctly?
    24000Handles 0 correctly?
    032100Handles 0 correctly?
    1234325556417556417General functionality test
    645332310121757456161617574561616General functionality test
    4444444444444444444400000000000000000002111111111111111111110111111111111111111110Handles 20 digit multiplication?

    Integrated Testing

    First, the Input stage was built and tested using the debugger to see that the numbers were being stored correctly in memory and that error checking was being correctly performed. Then the Computation stage was developed and tested, again using the debugger to see that the result was being successfully computed and stored in memory in a way that could be printed later. Finally, the Output stage was developed and tested to make sure the screen output corresponded to what was computed and stored in memory by the Computation stage.

    Description of Non-Functioning Routines:

    There are no non-functioning routines in this program.

    Statement of Originality

    Contributor's Names:

    While some high level ideas were discussed in class, this program was designed and implemented by me, anonymous

    References Used:

    Maljugin, Vitaly, et al, The Revolutionary Guide to Assembly Language, Wrox Press, 1993.

    Dr. Lovell has requested that I only put a portion of the solution source code on-line. Please look at the comments. This is an excellent example of well documented code that does not have trivial comments (e.g. mov bx, 0 ;moves a zero to bx). The use of clear labels and variable names helps make this code easier to read.

    		push cx				; Save outer loop index on stack
    		mov  ch,0h			; Prepare cx reg for innerloop repetition
    		mov  cl,num1Len			; Set cx to length of number 1
    		mov  ah,0h			; Clear the accumulator
    		mov  al,Buff1[di]		; Load digit of number 1 to al
    		mov  dl,Buff2[si]		; Load digit of number 2 to dl
    		mul  dl				; Multiply two numbers
    		add  al,carry			; Add carry to result
    		add  al,[bx]			; Add existing result to al
    		mov  dl,08h
    		div  dl				; Divide current result	by 8
    		mov  [bx],ah			; Save remainder to answer buffer
    		mov  carry,al			; Save quotient to the carry
    		dec  di				; Decrement number 1 index
    		dec  bx				; Decrement answer pointer
    		loop InnerLoop			; Repeat inner loop if cx!=0
    		dec  si				; Decrement number 2 index
    		mov  dh,0h
    		mov  dl,num1Len			; Reset dl value
    		mov  di,dx			; Reset di index
    		dec  di						
    		pop  cx				; Get outerloop index from stack
    Last Modified: January 26, 1999 - Barry E. Mapen