Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the following program that only adds integers that are even negatives. The program considers the NON - ZERO integers at labels N 1 ,

Complete the following program that only adds integers that are even negatives. The program considers the NON-ZERO integers at labels N1, N2, and N3 and stores the sum of the appropriate integers in the memory at label SUM. It uses a subroutine at label CHKN to check each integer.
.ORIG x3000
LD R0, N1
[ Select ]
L1 ADD R1, R0, #0
LD R0, N2
LEA R6, CHKN
[ Select ]
JMP R6
L2 ADD R1, R1, R0
LD R0, N3
[ Select ]
L3 ADD R1, R1, R0
ST R1, SUM
HALT
CHKN ADD R4, R0, #0 ; move in to R4 for testing
[ Select ]
AND R4, R4, x0001 ; right most bit is always 1 if odd
[ Select ]
WRONG AND R0, R0, #0 ; zero out wrong values
RETURN RET
N1.FILL ; value not shown
N2.FILL ; value not shown
N3.FILL ; value not shown
SUM .FILL #0
.ENDComplete the following program that only adds integers that are even negatives. The program considers the NON-ZERO integers at labels N1, N2, and N3 and stores the sum of the appropriate integers in the memory at label SUM. It uses a subroutine at label CHKN to check each integer.
.ORIG x3000
LD R0, N1
[ Select ]
L1 ADD R1, R0, #0
LD R0, N2
LEA R6, CHKN
[ Select ]
JMP R6
L2 ADD R1, R1, R0
LD R0, N3
[ Select ]
L3 ADD R1, R1, R0
ST R1, SUM
HALT
CHKN ADD R4, R0, #0 ; move in to R4 for testing
[ Select ]
AND R4, R4, x0001 ; right most bit is always 1 if odd
[ Select ]
WRONG AND R0, R0, #0 ; zero out wrong values
RETURN RET
N1.FILL ; value not shown
N2.FILL ; value not shown
N3.FILL ; value not shown
SUM .FILL #0
.END

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

What is meant by 'Wealth Maximization ' ?

Answered: 1 week ago