Whether two characters occur equally often in a string

A program that checks whether two given characters occur equally often.

Program source code

title Author: Evgeny Sergeevich Dovgopolov

.model small
.stack 100h

data segment public
    string    db "aabcdeef$"
    msg_true  db "True$"
    msg_false db "False$"
data ends

code segment public
    assume ds:data, cs:code

    main proc
        mov     ax, seg data        ; Get the data segment address and store it in ax
        mov     ds, ax              ; Pass the data segment address from ax to ds

        mov     bl, 'e'             ; Copy the value of the character 'e' into the bl register
        mov     bh, 'a'             ; Copy the value of the character 'a' into the bh register
        lea     si, ds:[string]     ; Load the address of the string variable into the ds:si register
        call    CheckString         ; Call the CheckString procedure

        jne     NotEqual            ; If ZF=0, then jump to the label NotEqual

        lea     dx, ds:[msg_true]   ; Load the address of the msg_true variable into the ds:dx register
        jmp     Done                ; Jump unconditionally to the Done label

    NotEqual:
        lea     dx, ds:[msg_false]  ; Load the address of the msg_false variable into the ds:dx register

    Done:
        mov     ah, 09h             ; Copy the string output function number into ah
        int     21h                 ; Call the interrupt

        mov     ax, 4C00h           ; Copy the termination function number into ah and the value into al
        int     21h                 ; Call the interrupt
    main endp

    CheckString proc
        push    ax                  ; Save the ax register value on the stack
        push    dx                  ; Save the dx register value on the stack
        push    si                  ; Save the si register value on the stack

        xor     dx, dx              ; Clear the value of the dx register

    MainLoop:
        lodsb                       ; Load a byte from the si register into the al register

        cmp     al, 24h             ; Compare the value in the al register with 24h - '$'
        je      Finish              ; If ZF=1, then jump to the label Finish

    TestBH:
        cmp     al, bh              ; Compare the value in the al register with the value in the bh register
        jne     TestBL              ; If ZF=0, then jump to the label TestBL

        inc     dh                  ; Increment dh by 1

    TestBL:
        cmp     al, bl              ; Compare the value in the al register with the value in the bl register
        jne     MainLoop            ; If ZF=0, then jump to the label MainLoop

        inc     dl                  ; Increment dl by 1
        jmp     MainLoop            ; Jump unconditionally to the MainLoop label

    Finish:
        cmp     dh, dl              ; Compare the value in the dh register with the value in the dl register

        pop     si                  ; Pop the value from the stack into the si register
        pop     dx                  ; Pop the value from the stack into the dx register
        pop     ax                  ; Pop the value from the stack into the ax register
        ret                         ; Return from the procedure
    CheckString endp

code ends
end main

True

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