汇编 编个小程序

来源:百度知道 编辑:UC知道 时间:2024/06/22 08:59:25
编程实现S=1²+2²+3²……20² 最后的结果保存在S单元

data segment
S dw ?
COUNT equ 20
data ends

code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov cx,COUNT
xor bx,bx
lp:
mov al,cl
mov ah,cl
mul ah
add bx,ax
loop lp
mov S,bx
mov ah,4ch
int 21h
code ends
end start

mov cl 0x14h
mov s,0
start:
mov al,cl
mul al,al
add s,ax
loop start