; multi-segment executable file template. data segment ; add your data here! pkey db "press any key...$" niza_broevi db 10 dup(?) s db 0 ends stack segment dw 128 dup(0) ends code segment start: ; set segment registers: mov ax, data mov ds, ax mov es, ax ; add your code here mov cl, 0d mov bx, 0 READ: mov ah,01h int 21h cmp al, '#' je EXIT mov niza_broevi[bx], al inc bx inc cl ; mov dl, al ; mov ah, 02h ; int 21h jmp READ EXIT: mov bx, 0d SUMMING: mov ax, niza_broevi[bx] div 2d ; int 21h inc bx dec cl mov dh, dl sub dh, 30h add s,dh cmp cl, 0d jne SUMMING mov dl, s add dl, 30h mov ah, 02h int 21h lea dx, pkey mov ah, 9 int 21h ; output string at ds:dx ; wait for any key.... mov ah, 1 int 21h mov ax, 4c00h ; exit to operating system. int 21h ends end start ; set entry point and stop the assembler.