https://pastein.ru/t/rr
скопируйте уникальную ссылку для отправки
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
mov ax, 5
jmp start
a dw 10 dup(?)
sms db 'Íå ââåäåíî íå÷åòíûõ ÷èñåë',0dh,0ah,'$'
sms1 db 0dh,0ah,'Ñóììà íå÷åòíûõ ÷èñåë ðàâíà: ','$'
g dw ?
xor cx,cx
start:
mov cx, 10
mov di,0
z1: call input
xor bx,bx
mov a[bx+di],ax
add di,2
loop z1
mov bx,0
z5:
mov ax,a[bx]
test ax,1
jnz z2
add bx,2
cmp bx,20
jz z8
jmp z5
z2:
add bx,2
mov cx,3
z3:
mov ax,a[bx]
add [g],ax
add bx,2
;add ax,a[bx]
loop z3
jmp z9
z8:
mov ax,3
int 10h
mov dx, offset sms
mov ah, 9
int 21h
mov ah,0h
int 16h
jmp
z9:
mov ax,3
int 10h
mov ax,[g]
mov dx, offset sms1
mov ah, 9
int 21h
call vyvod
int 19h
ret
proc input
push bx
push cx
push dx
xor bx, bx
xor cx, cx
xor dx, dx
mov ah,01h
int 21h
cmp al,'-'
jne m1 ;Ïðûãíóòü íà ââîä
inc dx
m0:
mov ah,01h
int 21h
cmp al, 39h
ja m2 ;_Çàêîí÷èòü ââîä
cmp al, 0h
m1:
sub al,30h
jb m2 ;_Çàêîí÷èòü ââîä
mov cl,al
shl bx,1
mov ax,bx
shl ax,2
add bx,ax
add bx,cx
jmp m0 ;_Ïîâòîðèòü ââîä
m2:
test dx,dx
jz m3
neg bx
m3:
mov ah, 02h
mov dl, 0dh
int 21h
mov dl, 0ah
int 21h
xor cx,cx
mov ax,bx
pop bx
pop cx
pop dx
ret
endp input
endp proc1
proc vyvod
mov ax, [g]
cmp ax, 0
jne print_ax_r
push ax
mov al, '0'
mov ah, 0eh
int 10h
pop ax
ret
print_ax_r:
pusha
mov dx, 0
cmp ax, 0
je pn_done
mov bx, 10
div bx
call print_ax_r
mov ax, dx
add al, 30h
mov ah, 0eh
int 10h
jmp pn_done
pn_done:
popa
ret
endp