Project 3 - INTEL Assembler ProgrammingDAT 2343 - Winter 2000Synopsis
Algorithm Details
initialize a subtraction-counter variable to zero start of loop: on a new line, prompt for and input a first number - if there is an error in the input, print an error message and then break out of the loop (go to after end-of-loop) on a new line, prompt for and input a second number - if there is an error in the input, print an error message and then break out of the loop (go to after end-of-loop) if ( both the first number and the second number are zero ) break out of loop (go to after end-of-loop) endif subtract the smaller number from the larger number on a new line, print a text message followed by the result of the subtraction add one to the subtraction-counter variable go back to the start of loop end of loop on a new line, print a text message followed by the final value of the subtraction-counter variable end program Examples
8 10 44 33 123 0 0 456 0 0 The display on your screen will look something this (your typing in red): ...your prompt here... 8 ...your prompt here... 10 ...some message text... 2 ...your prompt here... 44 ...your prompt here... 33 ...some message text... 11 ...your prompt text... 123 ...your prompt text... 0 ...some message text... 123 ...your prompt text... 0 ...your prompt text... 456 ...some message text... 456 ...your prompt text... 0 ...your prompt text... 0 ...your subtraction counter message text... 4 You get to choose the wording of your own prompts and messages. To get the display to look good, you may need to add carriage returns and newlines to the output, otherwise you will find that the prompts will overwrite each other on the screen. In the assembler implementation of the above algorithm, numbers are read by calling the GETNUM subroutine and are displayed using the SHOWNUM subroutine from the supplied GETSHOW.ASM I/O package. If the input contains a non-number (check the return status of GETNUM), break out of the loop and display an error message: ...your prompt here... 8 ...your prompt here... 10 ...some message text... 2 ...your prompt here... X ...you print an error message here... ...your subtraction counter message text... 1
Hand InHand in a closed but unsealed envelope (not a folder!) containing a copy of a diskette (please keep the original in case the copy is unreadable) containing two text-only files and an executable, and also a printout:
Text Files Only
Problems?
|
Web Author: Ian! D. Allen idallen@idallen.ca Updated: 2003-09-23 11:45 Support free and non-commercial Internet. This site works best in Any Browser, a campaign for non-specific WWW. This work is licensed under a Creative Commons License. |