;顯示計算結果
code segment
assume cs:code,ds:code
org 100h
start:
mov ax,cs
mov ds,ax
mov dx,offset mes;顯示算式
mov ah,9
int 21h
xor ax, ax
mov cx, 0ah
next:add ax, cx; 求和
loop next
aam ;二化十
add ax,3030h;轉為ASCII
xchg ah,al
mov dx,ax;送入DX待顯示
mov ah,2
int 21h;顯示高位
mov dl,dh
int 21h;顯示低位
mov ah,1
int 21h;暫停
mov ax, 4c00h
int 21h ;結束
mes db '1+2+3+...+10=$'
code ends
end start