89.0k views
1 vote
Write, run, and test a MARIE assembly language program.The program should allow the user to input 8 numbers and find the smallest and the largest. The program should then print the smallest number and the largest number. Numbers are limited to integers, and can be positive, negative, or zero. You do NOT have to prompt input or label output.

User Kiritsuku
by
2.9k points

1 Answer

4 votes

Answer:

Check the explanation

Step-by-step explanation:

ORG 100 / Calculation of the maximum

Load First /loading 1st array member

Store Next /address of next pointer,stores

Load Array /Loading 1st element

Store Max /maximum value with 1st element

Loop, Clear

AddI Next /Load next element!

Subt Max /Comparing with the maximum once

Skipcond 000 /If negative ->skip

Jump NewMax /If not negative ->max value

NextIdx, Load Next

Add One /pointer++

Store Next

Load Count /counter--

Subt One

Skipcond 800 /counter is positive ->same proceeding

Jump Print /else - printing the result

Store Count /counter decresed and stored

Jump Loop

NewMax, Clear / new maximum value

AddI Next

Store Max

Jump NextIdx

Print, Load Max

Output

Halt /Terminate program

First, Hex 11E /starting is location 11E(change as per...,as code changes don't forget to change it too)

Next, Hex 0 /next element index (memory location)

Max, Dec 0 /maximum value

Count, Hex 8 / loop counter decreases

One, Dec 1 /Loop stops

say array:

[Dec -5,Dec 15,Dec -17,Dec 20,Dec -23,Dec 12,Dec 130,Dec -12]

User Brnby
by
3.2k points