.MODEL SMALL .STACK .DATA msg1 db '1+2+...+$' odoa db 0dh,0ah,'$' t1 db 20 dup (?) tt db 20 dup (?) oper db 120 tmp db ? tab db '0123456789' .CODE MOV AX,@DATA MOV DS,AX ; lea dx,msg1 mov ah,09 int 21h ; xor si,si xor ax,ax lea bx,tab mov dl,10 mov al,oper mov tmp,al ; cont: idiv dl mov tmp,al ; ah is the remainder, al is the quotient mov al,ah xlat mov tt[si],al inc si xor ax,ax mov al,tmp cmp al,0 je final jmp cont ; final: mov tt[si],'$' lea dx,tt mov ah,09 int 21h ; mov dl,'=' mov ah,02 ; print '=' int 21h ; lea dx,odoa mov ah,09 int 21h ; mov ah,4ch int 21h END