Introduction to Computer Science:
Assignment 9
    Sewickley Academy, 2000-2001

See Course Home Page.
 
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.

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,8
Output:  Yes, because 6 and 8 differ by 2, which is less than 3

Input 9,7
Output:  Yes, because 9 and 7 differ by 2, which is less than 3

Input:  5,1
Output:  No, because 5 and 1 differ by 4, which is not less than 3

2.  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.
Input:  38
Output:  Yes, because 38 mod 16 is 6 which is less than 8

Input:  88
Output:  No, because 88 mod 16 is 8, which is not less than 8.


See Course Home Page.