I am writing a code for adding a series of 8 bit numbers.
But it is displaying absurd characters in output.
What may be the error ?

ASSUME cs:code, ds:data

data segment
	LIST db 23H, 46H ,02H,12H
	COUNT EQU 04d
	;RESULT DB 01h DUP(?)
data ENDS
code segment

start:	mov ax,data
	mov ds,ax
	xor ax,ax
	xor bx,bx
	xor dx,dx
	clc
	mov si,OFFSET LIST
	mov cx,COUNT

add1:	mov bl,[si]
	add ax,bx
	daa
	inc si
	dec cl
	jnz add1
	mov dx,ax
        [B]mov ah,02h
	int 21h[/B]
	mov ah, 4ch
	int 21h
code ends
end start

Why the DAA instruction while summing the values?
It will effect the AX registers value, probably
on auxiliary carry.
---
21/02 Output Char takes an ASCII character in DL

mov dl, 0x41 ; 'A'
mov ah, 0x2
int 0x21 ; display an 'A'

You must translate the sum into ASCII characters for
printing, and more specifically into the ASCII representation
in decimal, hexadecimal, binary, etc...
Here is code for printing the value in ASCII hexadecimal
representation:

disphex: ; prints hex value of word in AX
    push ax
    shr ax, 8
    call dispbyte
    pop ax
    push ax
    and ax, 0xff
    call dispbyte
    pop ax
    ret
  dispbyte:
    push ax
    shr al, 4
    call dispasc
    pop ax
    push ax
    and al, 0xf
    call dispasc
    pop ax
    ret
  dispasc:
    push ax
    push dx
    add al, 0x30
    cmp al, 0x39
    jle dispasc_e
    add al, 0x7
  dispasc_e:
    mov dl, al
    mov ah, 2
    int 0x21
    pop dx
    pop ax
    ret
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.