Assembly Language Logical Shift
This example uses a Logical Shift to perform multiplication.
INP R0,2 INP R1,2 MOV R2, R1 MOV R3, R0 LOOP: LSL R3,R3,#1 LSR R2,R2,#1 CMP R2,#1 BGT LOOP BLT END ADD R3,R3,R0 END: OUT R3,4 HALT
This example uses a Logical Shift to perform multiplication.
INP R0,2 INP R1,2 MOV R2, R1 MOV R3, R0 LOOP: LSL R3,R3,#1 LSR R2,R2,#1 CMP R2,#1 BGT LOOP BLT END ADD R3,R3,R0 END: OUT R3,4 HALT