i'm trying to write a code that print all array elements and print the sum of it, also it copy the a1 elements's and paste in a2 note the type of arrays should be byte it works but it is print the sum is 9 rather than 45 i didn't know what is the error!
.data
a1 byte 0,1,2,3,4,5,6,7,8,9
a2 byte 10 dup(?)
space byte " ",0
var1 byte "the sum is: ",0dh,0ah
total word 0
.code
main PROC
mov ecx,10
mov edi, 0
mov eax,0
xx:
movzx eax,byte ptr a1[edi]
call writedec
mov edx,offset space
call writestring
add edx, eax
mov bl,a1[edi]
mov a2[edi],bl
inc edi
loop xx
mov edx, offset space
call writestring
mov edx,offset var1
call writestring
mov bx, total
call Writedec
exit