Question

Finish the MARIE assembly language code below to determine the largest integer, the smallest integer, and...

Finish the MARIE assembly language code below to determine the largest integer, the smallest integer, and the sum of integers for a sequence of 5 signed integers. The program already calculates the largest integer, just need it to calculate the smallest integer and the sum of the integers. The 5 integers should first be entered by the user via the input device. Your program is then assembled and run to determine the largest integer, the smallest integer, and the sum of the integers entered by the user. The results are then displayed via the output device. For example, the program should print 10, -3, and 22 (2-3+10+5+8=22) as the output for the following sequence of integers entered by the user: 2, -3, 10, 5, 8.

ORG 100

Load First

Store Next

Load Array

Store Max

Loop, Clear

AddI Next

Subt Max

Skipcond 000

Jump NewMax

NextIdx, Load Next

Add One

Store Next

Load Count

Subt One

Skipcond 800

Jump Print

Store Count

Jump Loop

NewMax, Clear

AddI Next

Store Max

Jump NextIdx

Print, Load Max

Output

Halt

First, Hex 11E

Next, Hex 0

Max, Dec 0

Count, Hex 5

One, Dec 2

Array, Dec 1

Dec -3

Dec 10

Dec 5

Dec 8

0 1
Add a comment Improve this question Transcribed image text
Answer #1

Code:

if it helpful for you please give rate ..

assembly language to determine the largest integer:-

LXI H, Starting address

MOV C, M

INX H

MOV B, M

DCR C

LOOP INX H

MOV A, M

CMP B

JC SKIP

MOV B, A

SKIP DCR C

JNZ LOOP

LXI H, destination address

MOV M, B

HLT

assembly language to determine the smallest integer:-

LXI H, Starting address

MOV C, M

INX H

MOV B, M

DCR C

LOOP INX H

MOV A, M

CMP B

JNC SKIP

MOV B, A

SKIP DCR C

JNZ LOOP

LXI H, destination address

MOV M, B

HLT

assembly language to determine the sum of integer:-

LXI H, Load the address to get the count of numbers

MOV C, M

LXI H, Load HL with starting address

XRA A

MOV E, A

LOOP ADD M

JNC SKIP

INR E

SKIP DCR C

INX H

JNZ LOOP

LXI H, load address to store result

MOV M, A

INX H

MOV M, E

HLT

Add a comment
Know the answer?
Add Answer to:
Finish the MARIE assembly language code below to determine the largest integer, the smallest integer, and...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Marie Assembly Language

    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...

  • Given the instruction set for MARIE: Write the assembly language equivalent for the machine i...

    Given the instruction set for MARIE: Write the assembly language equivalent for the machine instruction: 1011 000000001111. Instruction Instruction Instruction Opcode JnS X Instruction Halt Skipcond (00 for ACO, 01 for AC-0, 10 for AC0) Jump X Clear AddI X Jumpl X Opcodde Load X8 Store X9 Add X Subt X B Input Output Instruction Instruction Instruction Opcode JnS X Instruction Halt Skipcond (00 for ACO, 01 for AC-0, 10 for AC0) Jump X Clear AddI X Jumpl X Opcodde...

  • M.A.R.I.E assembly code for 7th value of Fibonacci sequence: Fib(1) = 1, Fib(2) = 1, Fib(n)...

    M.A.R.I.E assembly code for 7th value of Fibonacci sequence: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n-1) + Fib(n-2). The program calculates Fib(7). I have 4 errors in my code and cannot seem to find the solutions here is the code so far, ORG 100    Input    Store x    Input    Store y FOR_INIT, LOAD one STORE i FOR_COND, LOAD i SUBT seven SKIPCOND 800 JUMP FOR_BODY JUMP END_FOR FOR_BODY, LOAD x ADD y STORE z LOAD...

  • JUST GIVE ME THE C CODE FOR THIS QUESTION. I GOT THE ASSEMBLY CODE.

    JUST GIVE ME THE C CODE FOR THIS QUESTION. I GOT THE ASSEMBLY CODE. In this assignment, you will create a C program that iteratively populates a fixed-size integer array of 3 elements, array α.withhexadecimal integer valuesprovided by scanf. The user will enter 3 positive hexadecimal integer values, one per line, and the program will store the 3 values in arYay _afOJ,arvay aflJ, and crr ay_af2J. Once the 3 integers are entered, your program will print the array ain 32...

  • Problem 6(15 Points) MARIE Assembly Programming Develop a MARIE program containing a main function which finds the smallest element of an array T is shown below. The passing arguments and one sub...

    Problem 6(15 Points) MARIE Assembly Programming Develop a MARIE program containing a main function which finds the smallest element of an array T is shown below. The passing arguments and one subroutine function called Sindmin findmin function array and the aro the findmin subroutine functon are the beginning e pseudo code for the subroutine elements of Array1 and Arra array size Continue the following MARIE program to find the smallest ORG 100 Jump Start nt findmin (int "addr, int size)...

  • 3. (Dynamic Array) In C++, the largest int value is 2147483647. So. an integer larger than this cannot be stored and pr...

    3. (Dynamic Array) In C++, the largest int value is 2147483647. So. an integer larger than this cannot be stored and processed as an integer. Similarly, if the sum or product of two positive integers is greater than 2147483647, the result will be incorrect. One way to store and manipulate large integers is to store each individual digit of the number in an array. Your program must, at least, contain a function to read and store a number into an...

  • In C please! Thank you! Write a program that finds the smallest (min), largest (max), and...

    In C please! Thank you! Write a program that finds the smallest (min), largest (max), and average (mean) of N values entered by the user. Your program should begin by prompting the user for N, the number of values to be entered. Then the program should accept that number of values, determining the min, max, and mean. Then it should display those values. This is an extension of a previous lab. First, get it working for N values. Then, extend...

  • (+30) Provide a python program which will Populate an array(list) of size 25 with integers in...

    (+30) Provide a python program which will Populate an array(list) of size 25 with integers in the range -100 (negative 100)   to +100 inclusive Display the array and its length (use the len function) Display the average of all the integers in the array Display the number of even integers (how many) Display the number of odd integers (how many) Display the number of integers > 0   (how many) Display the number of integers < 0   (how many) Display the...

  • C++ pleasr Extra Credit: Large Integer (25 points) In C++, the largest int value is 2147483647....

    C++ pleasr Extra Credit: Large Integer (25 points) In C++, the largest int value is 2147483647. So, an integer larger than this cannot be stored and processed as an integer. Similarly, if the sum or product of two positive integers is greater than 2147483647, the result will be incorrect. One way to store and manipulate large integers is to store each individual digit of the number in an array. Write a program that inputs two positive integers of, at most,...

  • Edit: Not sure what more information you need. Write a MIPS assembly program to determine the...

    Edit: Not sure what more information you need. Write a MIPS assembly program to determine the range between pairs of numbers. Keep things very basic with instructions such as load (lw), store (sw), add (addi and add), subtract (sub), multiplication (mul), branch (beq and bne), jump (j), and set on less than (slt) instructions. Your program should meet the following functional requirements: Input: an arbitrary number of integer pairs (in all pairs, the first number will be the max value)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT