Question: 2 . 1 Instructions ADD ( 1 , ACC = ACC + arg ) BR ( 1 , jump to arg ) BRNEG ( 1

2.1 Instructions
ADD(1,ACC=ACC+arg)
BR (1, jump to arg)
BRNEG (1, jump to arg if ACC0)
BRZNEG (1, jump to arg if ACC0)
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=ACCarg)
?MULT(1,ACC=ACC**arg)
READ (1, arg-input integer)
WRITE (1, put arg to output as integer)
, stop program)
STORE(1,arg=ACC)
SUB(1,ACC=ACC-arg)
, nothing)
LOAD (1, ACC=arg)
ADD, DIV, MULT, WRITE, LOAD, SUB can take either variable or immediate value
as the arg: immediate value is positive integer or negative integer
PUSH , tos ++ Your program will find the sum of the numbers input and display all the input values. You will write an assembly language project (using the virtual machine described in class and available on Canvas) to perform four tasks. These tasks will build on each other, starting with the most straightforward program and progressing to the complete program. The comprehensive program will read in numbers from the keyboard until the value -1 is entered, then display all the numbers described in tasks.
Task 1: This program should read in numbers until -1 is entered, then display the sum of all single-digit numbers [-9,-2] and [0,9] entered. -1 is a flag to end the program; do not use -1 in the sum. Call this program task1.asm.[10 Points]
Task 2: This program should read in numbers until -1 is entered. If the entered number lies between 100 and 999, check whether the entered number is a prime number. If yes, find the sum of all prime numbers and display the sum. Call this program task2.asm.[15 Points]
Task 3: This final version should read in numbers until -1 is entered. It should display all of the numbers entered, followed by printing out the total of these numbers following these rules: Call this program task3.asm.[25 Points]
If the total number is a single-digit number, compute the cube of the number. [10 Points]
If the total number is greater than or equal to ten, then compute the square of a number. [10 Points]
Do not display -1 as being entered, nor include it in the total. [5 Points]
SOLVE THIS USING THE RULES IN THE PICTURE
2 . 1 Instructions ADD ( 1 , ACC = ACC + arg ) BR

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!