LShift proc buf,len
pushad
local newhbit
local oldhbit
local i
mov esi,buf
mov al,byte ptr [esi]
movzx ax,al
div 80h ;16位除法,al存商,ah存余数
movzx eax,al
mov oldbit,eax
mov ecx,len
mov esi,ecx
dec esi
for:
mov al,byte ptr [esi]
movzx ax,al
div 80h
movzx eax,al
mov newhbit,eax
shl al,1
movzx eax,al
xor eax,oldhbit
mov [esi],al
mov eax,oldhbit
mov newhbit,eax
dec esi
loop for
popad
LShift endp