Question
ASSEMBLY LANGUAGE : Your program will find the sum of numbers input and display all of the input values. The full program will read in
ASSEMBLY LANGUAGE: Your program will find the sum of numbers input and display all of the input values. The full program will read in numbers from the keyboard until the value -1 is entered, then display all of the numbers that were entered, followed by the sum of all single digit numbers that were entered.
Example:
1
2
3
4
15
-1
OUTPUT: 15
COMMANDS:
ADD (1, ACC = ACC +arg)
BR (1, jump to arg)
BRNEG (1, jump to arg if ACC < 0)
BRZNEG (1, jump to arg if ACC < = 0)
BRPOS (1, jump to arg if ACC > 0)
BRZPOS (1, jump to arg if ACC > = 0)
BRZERO (1, jump to arg if ACC == 0)
COPY (2, arg1 = arg2)
DIV (1, ACC = ACC / arg)
MULT (1, ACC = ACC * arg)
READ (1, arg=input integer)
WRITE (1, put arg to output as integer)
STOP (0, stop program)
STORE (1, arg = ACC)
SUB (1, ACC = ACC - arg)
NOOP (0, nothing)
LOAD (1, ACC=arg)
PROGRAM THAT WILL STOP ONCE -1 VALUE ENTERED:
LOOP1: READ X
LOAD X
BRNEG OUT1
BR LOOP1
OUT1:LOAD X
ADD 1
BRZERO OUT2
BR LOOP1
OUT2: NOOP
STOP
X 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started