| Date Assigned: | Tue Sep-26 |
| Date Due: | Thu Sep-28 by end of day |
Today in class we covered some questions from our "Assembly Language Programmers' FAQ". Specifically:
Here, you will write small programs to demonstrate the solutions to these questions. Be sure to follow all the rules of a Well-Formed Assembly Language Program.
- How (and why) to share code?
- How to get user input?
- How (and why) to check if input is valid?
- How to facilitate multiple runs?
- How to negate a number?
- How (and why) to alternate 0 and 1?
- How (and wh) to compute mod (remainder)?
1. Write an assembly language program which takes two numbers as input (prompt the user for them, have the user enter them in registers, etc), and the program outputs YES if the difference of the two numbers is less than 3 (hint: you will want to use the jmpLE command -- see the SimpSim help file for details), and NO otherwise.
Input: 6,82. Write an assembly language program which takes one number as input and outputs YES if the remainder of that number, when divided by 16, is less than 8.
Output: Yes, because 6 and 8 differ by 2, which is less than 3Input 9,7
Output: Yes, because 9 and 7 differ by 2, which is less than 3Input: 5,1
Output: No, because 5 and 1 differ by 4, which is not less than 3
Input: 38
Output: Yes, because 38 mod 16 is 6 which is less than 8Input: 88
Output: No, because 88 mod 16 is 8, which is not less than 8.
See Course Home Page.