Question: 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 NONZERO integers at labels N N and N 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 x
LD R N
Select
L ADD R R #
LD R N
LEA R CHKN
Select
JMP R
L ADD R R R
LD R N
Select
L ADD R R R
ST R SUM
HALT
CHKN ADD R R # ; move in to R for testing
Select
AND R R x ; right most bit is always if odd
Select
WRONG AND R R # ; zero out wrong values
RETURN RET
NFILL ; value not shown
NFILL ; value not shown
NFILL ; value not shown
SUM FILL #
END
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
