8086 - can't understand this assembly code -


this code supposed calculate : p/4+v/8 using shift operations

data segment db p db v db q data ends code segment assume cs:code,ds:data start: mov ax,p        shr ax,01 mov cl,02 shr ax,cl mov bx,ax mov ax,v shr ax,01 mov cl,03 shr ax,cl mov dx,q add bx mov q,ax code ends end 

my main question : me seems we're calculating p/8+v/16?!!!1 because think there 2 shift operations not needed

that snippet of code calculates p/8 + v/16 said.

every time shift 1 bit right doing integer division 2.

so, should remove shr ax,01 both locations p/8 + v/16


Comments