Answered step by step
Verified Expert Solution
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 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 #
ENDComplete 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
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