求助:请高手用汇编语言编程下面这一题,求出1+2+3+4+.......+99+100的和,并以十六进制的形式显示在屏幕上
2个回答
展开全部
DATA SEGMENT
RESULT DW 0
s1 db 0,0,0,0,'$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
BEGIN:
mov ax,data
mov ds,ax
mov es,ax
MOV AX,0
MOV BX,0
MOV CX,100
LP: INC BX
ADD AX,BX
LOOP LP
MOV RESULT,AX
mov cx,4
lea si,s1
l1: rol ax,1
rol ax,1
rol ax,1
rol ax,1
mov bx,ax
and bx,000fh
cmp bl,10
jc l2
add bl,37h
jmp l3
l2: add bl,30h
l3:mov [si],bl
inc si
loop l1
lea dx,s1
mov ah,09h
int 21h
MOV AH,4CH
INT 21H
CODE ENDS
END BEGIN
RESULT DW 0
s1 db 0,0,0,0,'$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
BEGIN:
mov ax,data
mov ds,ax
mov es,ax
MOV AX,0
MOV BX,0
MOV CX,100
LP: INC BX
ADD AX,BX
LOOP LP
MOV RESULT,AX
mov cx,4
lea si,s1
l1: rol ax,1
rol ax,1
rol ax,1
rol ax,1
mov bx,ax
and bx,000fh
cmp bl,10
jc l2
add bl,37h
jmp l3
l2: add bl,30h
l3:mov [si],bl
inc si
loop l1
lea dx,s1
mov ah,09h
int 21h
MOV AH,4CH
INT 21H
CODE ENDS
END BEGIN
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询