Write a program which for a square matrix to calculate the sum of the elements. Assume that the amount can be placed in 16-bit register


1 1 1
2 2 2
3 3 3

Elements are: 1,1, 2, which are with red color. I had calculate sum of this elements.

Please help me!!!

DX will contain required sum:

mov     dx,0
        mov     esi,matr
        mov     ecx,0
        mov     cx,[dimmatr]
        mov     eax,1
        push    ecx

        mov     cx,[dimmatr]
        mov     ebx,0
        cmp     ebx,eax
        jl      msk
        add     dx,word [esi]
        inc     ebx
        add     esi,2
        loop    mCol
        inc     eax

        pop     ecx
        loop    mRow

dimmatr dw 3;matrix dimension
matr    dw 1,1,1,2,2,2,3,3,3;matrix