3x3 matrix traversal

A program that traverses and prints the elements of a 3x3 matrix using nested loops.

Program source code

title Author: Evgeny Sergeevich Dovgopolov

.model small
.stack 100h

data segment public
    matrix dw  10, 20, 30
           dw  40, 50, 60
           dw  70, 80, 90

    rows   equ 3
    cols   equ 3

    fmtout db  "%d \0"
data ends

code segment public                ; Start of the code segment
    assume  ds:data, cs:code
    include Handyfar.inc           ; Include the file with functions
    include Handymac.inc           ; Include the file with macros

    main proc                      ; Start of the main procedure
        call    SetDataSegment     ; Call the SetDataSegment procedure

        xor     bx, bx             ; Clear the bx register, it will serve as an index
        lea     si, ds:[matrix]    ; Load the address of the matrix array into ds:si

    @ROWS_Loop:
        xor     bl, bl             ; Clear the bl register

    @COLS_Loop:
        push    word ptr[si]       ; 2nd: load the value at index si onto the top of the stack
        lea     ax, ds:[fmtout]    ; 1st: load the address of the fmtout format string into ax
        call    PrintFormatString  ; Call the PrintFormatString procedure
        add     sp, 2              ; Align the stack

        incw    si                 ; Increment the si index by 2
        inc     bl
        cmp     bl, cols
        jl      @COLS_Loop         ; Loop while the bl register is not equal to 3

        call    PrintNewLine       ; Call the PrintNewLine procedure

        inc     bh
        cmp     bh, rows
        jl      @ROWS_Loop         ; Loop while the bh register is not equal to 3

        xor     al, al             ; Clear the al register
        call    ExitProcess        ; Call the ExitProcess procedure
    main endp                      ; End of the main procedure

code ends                          ; End of the code segment
end main	                       ; End of file. The main procedure is the entry point

10 20 30
40 50 60
70 80 90

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".