;CS2011, A Term 1999 ; Prof. Sergio A. Alvarez title Multiplication By Repeated Shifting and Adding .model small .stack 256 .data op1 dw 3 op1size = $-op1 op2 dw 00000101b op2size = $-op2 .code .586 main proc mov ax,@data mov ds,ax ; intialize DS mov ax,0 ; initialize accumulator mov cx,op2size ; initialize loop counter mainloop: bt op1,0 ; test lowest bit of shifted op1 jnc nosum add ax,op2 ; add this shift only if bit 0 is 1 nosum: shr op1,1 ; shift op1 right, op2 left in any case shl op2,1 loop mainloop mov ax,4C00h int 21h ; return control to DOS main endp end main