Answer:
A subroutine is a sequence of instructions that is modular and can be executed multiple times. If you are familiar with any programming language, you may see that subroutines are similar to functions.MARIE provides a way to call these subroutines by using the JnS instruction, and normal program execution can be resumed once the subroutine exits by using the JumpI instruction.
Here is an example that prints the sum of two variables X and Y then halts the program:
JnS PrintSum /Enter subroutine PrintSum Halt PrintSum, HEX 000 / Used for storing return address INPUT Store X INPUT Store Y Load X Add Y Output
JumpI PrintVariableX
X, DEC 0 Y, DEC 0
How would you go about creating a subroutine in MARIE assembly language that allows for the...
Assembly (MARIE), how can I output my input variables on exit?I am trying to compose an assembly (MARIE) program to output my input variables **on exit**. I am triggering an exit when . (period) is entered. I am transforming the input, and to later display the new value on exit.Some context, FOO will return SBB when ran through Rot-13However, my program is displaying the output on each iteration of my loop. I am instead wanting to not display anything, until . is entered...
!!!!!!!!!!!LC-3 Assembly Language!!!!!!!!!!!! I need an LC-3 Assembly Language subroutine that generates a random number between 0-5 Explanations about each line as comments, please. Thank you
!!!!!!!!!!!LC-3 Assembly Language!!!!!!!!!!!! I need an LC-3 Assembly Language subroutine that generates a random number between 0-5 Explanations about each line as comments, please. Thank you
Using the MARIE computer assembly language, write a program that computes the following expression: z = a * b * c. The computer will read in the input values a, b, and c from the keyboard and the final result (z) have to be displayed. In addition, every time an input value is read in, it must be displayed on the screen. Remember that the instruction set does not have an instruction to execute multiplication. The program must be tested...
Write MARIE assembly language programs that do the following: I. Write a program that inputs three integers, a, b, and c, in that order. It computes the following ia-bi-fc+ c The result should be written to output 2. Write a program that inputs integers, s. y, and z. It outputs the difference of the langest and first element entered. You may assume x. y, and z all have different values. So if 8, 12, and 9 are input, the output...
must be written in assembly code Write an MSP430 assembly language subroutine, REP_FREE, to examine the elements of an array of positive word-size numbers stored at location ARRAY_IN. The array is already sorted in an ascending order. The first element is the number, n,which is the length of the array. The subroutine will copy the elements from location ARRAY_IN to location ARRAY_OUT. While copying, if an element appears more than once (repeated), then the repeated copies are ignored. In essence,...
NEED HELP WITH THIS . Write a MARIE assembly language program that would simulate calling and executing the following C function, as shown below: z = someFunction(a, b); where z, a and b are main( ) program variables, and the values stored in a and b are input by the user. The value stored in z will be output. Did your program execute correctly? This is the code for the function: int someFunction(int x, int y) { return 3 *...
Write an ARM assembly language subroutine (named nfibo) to calculate and return the n-th Fibonacci number. Fibonacci numbers (or a Fibonacci sequence) are a series of numbers with a property that the next number in the series is a sum of previous two numbers. Starting the series from 0, 1 as the first two numbers we have 0, 1, (0 + 1) = 1, (1 + 1) = 2, (1 + 2) = 3, (2 + 3) = 5, (3...
For some reason nobody out there answers this question, Please please help me with this, Let me know if any further info will be needed. Create a MARIE assembly program which inputs two integers, X and Y, computes 3X + 4Y, and outputs the result. Requirements 1. The program must be written in MARIE Assembly Language. 2. It must use a subroutine to perform the multiplications. 3. You do not need to prompt for the input, just use the Input...
This has to be in MSP430 assembly language. Thank you! Here is a link with instructions set for msp430 (pages 5-8): https://www.ti.com/sc/docs/products/micro/msp430/userguid/as_5.pdf Write an MSP430 assembly language subroutine, REP_FREE, to examine the elements of a list of positive word-size numbers stored at location LIST_IN. The list is already sorted in ascending order. The first element is the number, n, which is the length of the array. The subroutine will copy the elements from location LIST IN to location LIST_OUT. While...