📄 buhao7-1.asm
字号:
title 7-1
INCLUDE allyssa32.inc
.data
array sdword 2 dup(?)
str1 byte "Please input one 32-bit sign number :",0dh,0ah,0
str2 byte "The result is : ",0
align 4
jia1gao sdword 0
jia1 sdword 0
.code
main proc
call clrscr
mov esi,offset array
mov ecx,lengthof array
mov edx,offset str1
push esi
putin:
call writestring
call readint
mov [esi],eax
add esi,4
loop putin
pop esi
mov edx,offset str2
call writestring
call mul32
exit
main endp
mul32 proc
;-------------------
;receives :the offset address of array(store two 32-bit numbers)
;returns :nothing
;-------------------
mov ecx,31
mov eax,[esi]
cdq
mov ebx,[esi+4]
add eax,0
jns sign
add ebx,0
jns fuzhi
jmp neg1
sign:
add ebx,0
jns fuzhi
js neg1
neg1:
neg eax
neg edx
sub edx,1h
neg ebx
;call dumpregs
fuzhi:
mov jia1,eax
mov jia1gao,edx
shift:
cmp ecx,0
je quit
add ebx,0
jns next
push ecx
push eax
push edx
cl1:
shl eax,1
rcl edx,1
;call dumpregs
loop cl1
; call dumpregs
add jia1,eax
adc jia1gao,edx
pop edx
pop eax
pop ecx
next:
shl ebx,1
dec ecx
;call dumpregs
jmp shift
quit:
add ebx,0
js bujian
sub jia1,eax
sbb jia1gao,edx
bujian:
mov esi,offset jia1gao
mov ebx,4
mov ecx,2
call dumpmem
ret
mul32 endp
end main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -