Question: You are to design, write, assemble, and simulate an assembly language programwhich will multiply two 8 - bit numbers, NUM 1 and NUM 2 ,

You are to design, write, assemble, and simulate an assembly language programwhich will multiply
two 8-bit numbers, NUM1 and NUM2, by adding NUM1 to itself NUM2 times. Both of these numbers
are UNSIGNED (non-negative) numbers. The result will be a 16-bit number to be stored in RESULT
in BIG-ENDIAN format. For example, your numbers could be 255 and 255, and the product would
then be 65025= $FE01(in hex).
PLEASE NOTE:
1. Your program should work for any NUM1 and NUM2 values, not just the ones given.
2. You are NOT allowed to use the MUL instruction anywhere in your program; you need to use the
above-mentioned addition algorithm instead.
3. Your program is NOT allowed to change the number stored in NUM1 or NUM2.
4. You have to use the program skeleton provided for Lab2. Do not change the data section or you
will lose points! This means: do not change the 'ORG $B000' and 'ORG $B010' statements, or
'NUM1 FCB' and 'NUM2 FCB'. You are allowed to change the values assigned to NUM1 and
NUM2 to simulate different numbers. If you need to define additional variables, please add them
after the 'RESULT RMB 2' statement.
5. You must terminate your program correctly using the STOP instruction as shown in class.
6. The program must only have one exit point (i.e., only one STOP instruction at the end of the
program is allowed).
7. You do not have to optimize your algorithm or your assembly program for speed.
8. You have to provide a pseudo-code solution. In your pseudo code, do NOT use a for loop, but
either a while or a do-until structure to implement a loop. Also, do NOT use any goto,break,
exit, or return statements in your pseudocode.
9. The structure of your assembly program should match the structure of your pseudo code 1-to-1
(e.g., if the pseudo code shows a while structure, your assembly program should also have a while
structure).
10. Make sure that you implement any if-then, if-then-else, while, or do-until structures the way you
learned it in class. Incorrectly implemented structures will result in points lost.
11. Any assembler or simulator error/warning messages appearing when assembling/simulating your
submitted program will result in up to 50 points lost.
You should test your program with at least five sets of decimal data:
A. NUM1: 255 NUM2: 255-> RESULT =65025($FE01)
B. NUM1: 10 NUM2: 255-> RESULT =2550($09F6)
C. NUM1: 255 NUM2: 10-> RESULT =2550($09F6)
D. NUM1: 0 NUM2: 255-> RESULT =0($0000)
E. NUM1: 255 NUM2: 0-> RESULT =0($0000)
PLEASE NOTE: Your program will be tested by us using random number pairs. If your program does
not produce a correct result for those random pairs, you will lose up to 25 points (see grading
guidelines below).
Your program should include a header containing your name, student number, the date you wrote the
program, and the lab assignment number. Furthermore, the header should include the purpose of the
program and the pseudocode solution of the problem. At least 85% of the instructions should have
meaningful comments included - not just what the instruction does; e.g., don't say "increment the
register A" which is obvious from the INCA instruction; say something like "increment the loop
counter" or whatever this incrementing does in your program. Alternatively, you can use your pseudo
code to comment instructions as was shown in class. You can ONLY use branch labels related to
structured programming, i.e., labels like IF, IF1, THEN, ELSE, ENDIF, WHILE, ENDWHL,
DOUNTL, DONE, etc. DO NOT use labels like LOOP, JOE, etc. Remember: labels need to be
unique. So, for example, if you have two if-then structures, you should use the labels IF,THEN,
ENDIF for the first structure and IF1,THEN1, ENDIF1 for the second one.
Please base the code off of this C program. we are sup[posed to follow line by line
#include
int main(){
int NUM1=255; // Example value, change as needed for testing
int NUM2=255; // Example value, change as needed for testing
int RESULT =0; // To store the multiplication result
// While loop to add NUM1 to itself NUM2 times without an explicit counter
while (NUM2>0){
RESULT += NUM1;
NUM2--;
}
// Print the result
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!