v) Consider the following ASM code. Assume this has been assembled and run on SC
ID: 3708781 • Letter: V
Question
v) Consider the following ASM code. Assume this has been assembled and run on SCOMP. ORG &H000; Begin program at x000 Start: LOAD A SUB B JNEG Neg LOAD C JUMP Next Neg: LOADD Next: ADD A STORE E Done: JUMP Done A: DW &H0001; B: DW &H0002; C: DW &H0003; D: DW &HFFFE; E: DW&H0005; DD: EQU &HFFFF; What is stored in location "E" at the end of program (i.e., after it starts looping forever at "Done")? &H000; b) &HFFFF; c) &H0004; d)&HFFFE; e) None of the aboveExplanation / Answer
Answer is as follows :
Load A // Load the value of i.e. &H0001 to accumulator i.e. equal to 1 in hexadecimal
SUB B // Subtract value of B i.e. H0002 from Accumulator , So 0002 - 0001 = -1 i.e. negtive.
JNEG NEG // Check if value of Accumulator is negative. Yes it is negative than jump to label NEXT.
So at Neg.
Load D // load the value of D to Accumulator i.e. $HFFFFE i.e. FFFE in hexadecimal.
ADD A// Add the contents of A i.e. 0001 to Accumulator So , FFFE + 0001 = FFFF
STORE E // Store the value at variable E, so E contains &HFFFF in hexadecimal.
So from above the correct option is B i.e. &HFFFF.
// lines are explanation of corresponding instruction and working of program.
if there is any query please ask in comments..
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.