编写、运行和测试一个 MARIE 汇编语言程序。该程序应允许用户输入 8 个数字并找出最小和最大的数字。然后程序应该打印最小的数字和最大的数字。数字仅限于整数,可以是正数、负数或零。您不必提示输入或标记输出。
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
Array, Dec -5
Dec 15
Dec -17
Dec 20
Dec -23
Dec 12
Dec 130
Dec -12
我正在尝试打印最小值和最大值。这将只打印最大值。谁能帮我让它打印给定数组中的最小值。