Question: this is a LC3 assembly language code it is supposed to multiply using shift and add ;Lab#5: MULTIPICATION SHIFT AND ADD METHOD ; Inputs: X,Y

this is a LC3 assembly language code it is supposed to multiply using shift and add

;Lab#5: MULTIPICATION SHIFT AND ADD METHOD ; Inputs: X,Y ; Outputs: X.Y .ORIG x3000 LDI R0,X ; MULTIPLIER LDI R1,Y ; MULTIPLICAND JSR MULT STI R2, RESULTMUL ;X.Y

HALT X .FILL x3100 Y .FILL x3101 RESULTMUL .FILL x3102

MULT ADD R3,R3,#1;SIGN

ADD R0,R0,#0 BRp POSX NOT R0,R0 ;-X ADD R0,R0,#1 ADD R3,R3,#0 POSX ADD R1,R1,#0 BRp POSY NOT R1,R1 ;-Y ADD R1,R1,#1 ADD R3,R3,#0 POSY ADD R6, R6, #14 ; I=14 to loop 15 times because 16th bit is sign bit ADD R2, R2, #0 ADD R5, R5, #0 LOOP AND R4, R4, #0 ADD R4, R4, #1 AND R5, R0, R4 ;;I NEED HELP HERE BRnz ISONE

ADD R2, R2, R1 ISONE ADD R1, R1, R1

ADD R6, R6,#-1 BRp LOOP

ADD R3,R3,#0 BRp POSP NOT R2,R2 ADD R2,R2,#1 POSP RET

.END

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!