Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following program subtract 25 from the value of RI and store the result in l

ID: 3776342 • Letter: T

Question

The following program subtract 25 from the value of RI and store the result in location x5000. ORIG X3000 ADO R0.R1.#0 ADO RO.RO.#-15 ADD R0.R0.#-10 STI R0. PTR HALT PTR FILL Times 5000 END Why are there two ADD instructions in the program? (The two ADD instructions being referred here, are marked in bold text) Suppose that the above program is written as two separate programs p1 and P2. as shown below. Will the assembly of P1 be successful? Why? PI: ORIG Times 3000 ADO R0.R1."#0 ADO R0. R0. #-15 ADD R0.R0.#-10 STI R0. PTR HALT ENO

Explanation / Answer

The program substract 25 from the value R

ORIG X3000

ADD R0,R0,#0

ADD R0 ,R0,#-15

ADD R0,R0,#-10

STI R0,PTR

HALT

PTR FILL, X5000

END

Their is need for two ADD instruction in the program because the storing the variables 25 can be substract by using #-15,#-10 based on this we can use program.

HLT: Terminate program execution

STL:Store the contents of accumulator at address X5000

Another Program

LXI H, X3000: HL points R0

MOV A, M : Get first operand

INX H : HL points R

SUB M : Subtract second operand

INX H : HL points 25

MOV M, A : Store result at X5000.

HLT : Terminate program execution

2)Only p2 is enough to execute the program but modifying P1 and P2 we get

ORIG X3000

ADD R0,R0,#0

ADD R0 ,R0,#-15

ADD R0,R0,#-10

STI R0,PTR

HALT

PTR FILL, X5000

END

both P1 and P2 combine using the FILL is used .