Question

write an Marie assembler program that will read in or read in M A X B...

write an Marie assembler program that will

read in or read in

M A

X B

B C

D

solve for Y solve for Y

Y=MX+B Y = AB + CD

output Y output Y

Just code one of the programs - not both

Homework Answers

Answer #1
CODE:
ORG  100
Load A
Store  X /Store A in first parameter
Load  B
Store Y /Store B in second parameter
JnS Mul /Jump to multiplication subroutine
Load Sum /Get result
Store  E /E:= A x B
Load C
Store X /Store C in first parameter
Load D
Store Y /Store D in second parameter
JnS Mul /Jump to multiplication subroutine
Load Sum /Get result
Store F /F := C x D
Load E /Get first result
Add F /AC now contains sum of A X B + C X D
Halt /Terminate program
A, Dec 0 /Initial values of A,B,C,D not given in problem
B, Dec 0 / (give values before assembling and running)
C, Dec 0 /
D, Dec 0 /
X, Dec 0 /First parameter
Y, Dec 0 /Second parameter
Ctr, Dec 0 /Counter for looping
One, Dec 1 /Constant with value 1
E, Dec 0 /Temp storage
F, Dec 0 /Temp storage
Sum, Dec 0
Mul, Hex 0 /Store return address here
Load Y /Load second parameter to be used as counter
Store Ctr /Store as counter
Clear /Clear sum
Store Sum /Zero out the sum to begin
Loop, Load Sum /Load the sum
Add X /Add first parameter
Store  Sum /Store result in Sum
Load  Ctr
Subt One /Decrement counter
Store Ctr /Store counter
SkipCond  400 /If counter = 0 finish subroutine
Jump Loop /Continue subroutine loop
JumpI Mul /Done with subroutine, return to main
END

I am trying to get my program to do a simple math problem of A*B+C*D given a set of test numbers. I have the code written out, but after I input numbers for A and B it goes into an infinite loop. My code is this:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a short MARIE program. Answer ASAP. Will upvote. This program will let the user input...
Write a short MARIE program. Answer ASAP. Will upvote. This program will let the user input two decimal values a and b. Then this program will calculate c = a + b and output the result. Q1) Write down the code which let the user input two valuesa and b. The code need to store the input values. Q2) Write down the code which calculates c = a + b. The code need to store the result into variable c....
Write a MARIE assembly program to read three different positive numbers from the keyboard and output...
Write a MARIE assembly program to read three different positive numbers from the keyboard and output the difference between the largest and smallest numbers to the screen.
1.Write pseudocode for a program that allows the user to input two numbers (X and Y)...
1.Write pseudocode for a program that allows the user to input two numbers (X and Y) and a code C. If the code has value 1, the program should output the larger of X and Y and otherwise output the smaller. Now convert your pseudocode to an assembly language program. Enter the program into the lab software assembler. Assemble the program and execute it with different input data. 2. Write pseudocode for a program that allows the user to input...
You are to write a C program that will read from a file, one or more...
You are to write a C program that will read from a file, one or more sets of x,y coordinates. Each set of coordinates is part of a Cartesian system. A Cartesian coordinate system is a system that specifies each point uniquely in a plane by a pair of numerical coordinates. Your program will determine which quadrant each set belong. - Quadrants are often numbered 1st - 4th and denoted by Roman numerals: I(+,+), II (−,+), III (−,−), and IV...
Write a c code program to solve 5a. Given the data as follows: x[100] = {61,58,97,7,72,91,20,90,83,67,66,54,15,62,38,44,60,88,12,99,86,45,84,30,52,76,39,27,27,59,45,45,98,80,22,95,6,3,21,30,37,86,95,7,41,95,23,5,1,22,68,14,71,39,37,97,9,26,42,71,75,4,79,3
Write a c code program to solve 5a. Given the data as follows: x[100] = {61,58,97,7,72,91,20,90,83,67,66,54,15,62,38,44,60,88,12,99,86,45,84,30,52,76,39,27,27,59,45,45,98,80,22,95,6,3,21,30,37,86,95,7,41,95,23,5,1,22,68,14,71,39,37,97,9,26,42,71,75,4,79,32,42,9,35,13,31,95,78,83,12,21,60,2,28,67,21,69,11,45,13,52,26,16,43,56,31,74,35,5,41,33,36,6,75,8,30,42}; y[100] = {75,63,113,23,79,96,35,99,102,81,69,70,29,65,43,63,65,89,23,100,98,54,101,42,54,90,42,46,28,74,61,60,106,98,32,108,9,20,30,49,53,91,98,10,46,100,28,14,8,39,80,32,86,54,55,100,12,36,48,85,80,9,92,45,62,29,50,30,39,98,94,96,32,37,80,5,43,73,34,79,23,64,22,54,42,24,53,62,44,91,48,15,60,40,37,7,91,28,45,48}. Compute the average, variance and standard deviation (S.D.) of x and y separately. 5b. Given the data as follows: x[100] = {61,58,97,7,72,91,20,90,83,67,66,54,15,62,38,44,60,88,12,99,86,45,84,30,52,76,39,27,27,59,45,45,98,80,22,95,6,3,21,30,37,86,95,7,41,95,23,5,1,22,68,14,71,39,37,97,9,26,42,71,75,4,79,32,42,9,35,13,31,95,78,83,12,21,60,2,28,67,21,69,11,45,13,52,26,16,43,56,31,74,35,5,41,33,36,6,75,8,30,42}; y[100] = {75,63,113,23,79,96,35,99,102,81,69,70,29,65,43,63,65,89,23,100,98,54,101,42,54,90,42,46,28,74,61,60,106,98,32,108,9,20,30,49,53,91,98,10,46,100,28,14,8,39,80,32,86,54,55,100,12,36,48,85,80,9,92,45,62,29,50,30,39,98,94,96,32,37,80,5,43,73,34,79,23,64,22,54,42,24,53,62,44,91,48,15,60,40,37,7,91,28,45,48}. Compute Linear regression, i.e., find a and b such that y=ax+b results in the smallest total error. 5c. For the data given in problem 5, check the relationship between average(x) and average(y), and also the relationship...
C Programming Program 1. Declare 5 variables of type long int Read 5 integers from the...
C Programming Program 1. Declare 5 variables of type long int Read 5 integers from the user. After you read each one, output it back to the user with the message: You entered:   xxx Where xxx is the number that they entered. Add up all the numbers that the user entered and output the sum to the user like this: The sum of the numbers you entered is: xxx Find the average of these numbers and output it with 2...
Write spim program and execute it on mars. Your program reads two integer values x and...
Write spim program and execute it on mars. Your program reads two integer values x and y. Write a function called sum that gets x and y passed as parameters and return the sum of odd values between x and y inclusive. In addition write another function called even that gets x and y as parameters and returns the count of all even numbers between x and y inclusive. Also in main print the quotient and remainder of diving y...
Write a program to solve the classic FizzBuzz problem. The program should output integers 1 thru...
Write a program to solve the classic FizzBuzz problem. The program should output integers 1 thru 100, one to a line.However, if the number is divisible by 3 it should output Fizz instead of the number; if the number is divisible by 5 it should output Buzz instead of the number and if it is divisible by both 3 and 5, it should output Fizz Buzz instead. write in C
For 6-7, convert the C code to equivalent MARIE code. You may reference literal values using...
For 6-7, convert the C code to equivalent MARIE code. You may reference literal values using an immediate datum mode as in #1, or assume the value is in a variable of the same name (e.g., one). 6) scanf(“%d”, &x); z=0; for(i=0;i<x;i++)                 scanf(“%d”, &y); if(y==0) z++;                 }                 printf(“%d”, z);
Which of the following strings P is a Python program. (b) P = “def f(x): x...
Which of the following strings P is a Python program. (b) P = “def f(x): x = 'am I a Python program?'” (d) P = “def f(x,y,z): return y” (e) P = “def f(x): return y” For each of the following Python programs P and input strings I, give the output P(I), (f) P = “def f(x): return str(len(x+x+'x'))”, I = “GAGAT” (g) P = “def f(x): return str(len(x))”, I=P (h) P = “def f(x): return str(1/int(x))”, I = “0”
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT