.model small
.data
tab db 3,4,5,6,0
db 1,4,5,7,0
db 1,8,9,0,0
db 1,8,9,2,0
db 1,1,1,1,0
db 0,0,0,0,0
TotRows db 0
TotCols db 0
Rows db 5
Cols db 4
.code
mov ax,@data
mov ds,ax
; Counting Total Rows
LEA SI,tab
L1:
mov cx,4
L2:
mov ah,BYTE PTR[SI]
add TotRows , ah
Inc SI
Loop L2
mov ah,TotRows
mov [SI],ah
mov TotRows,0
INC SI
sub Rows,1
cmp Rows,0
jg L1
;Counting Total Cols
LEA SI,tab
mov BX,00
L3:
mov cx,5
LEA SI,tab
add SI,BX
L4:
mov ah,BYTE PTR[SI]
add TotCols , ah
add SI,5
Loop L4
mov ah,TotCols
mov [SI],ah
mov TotCols,0
sub Cols,1
cmp Cols,0
add BX,1
jg L3
mov ax,4C00h
int 21h
end