编写汇编语言源程序计算Sum=1+3+5+。。。+99将结果存放在AX寄存器中

2024-12-21 19:00:09
推荐回答(3个)
回答1:

.......初始化和输出程序你自己应该可以解决;以下是算法部分
;==========begin===========
mov ax,00h
mov bx,00h
mov cx,100d
loopment:
add ax,bx
inc bx
loop loopment
..........

回答2:

code segment
assume cs:code
start:
mov ax,code
mov ds,ax
xor bx,bx
xor ax,ax
mov cx,50
mov bx,99
add ax,bx
sub bx,2
loop $-4
mov ax,4c00h
int 21h
code ends
end start
sub bx,2
参考参考!

回答3:

CODES SEGMENT
ASSUME CS:CODES
START:
MOV AX,0
MOV DX,1
AGAIN: CMP DX,100
JA ADDED
ADD AX,DX
INC DX
INC DX
JMP AGAIN
ADDED:
MOV AX,4C00H
INT 21H
CODES ENDS
END START