

CHK_MYSELF PROC
        MOV AX,DS:[2CH]
        MOV ES,AX
        MOV DI,0
        MOV CX,7FFFH
        CLD
        XOR AL,AL
CHKMS_LOOP:
        REPNZ SCASB
        CMP BYTE PTR ES:[DI],0
        JNZ CHKMS_LOOP
        ADD DI,3
        MOV SI,DI
        REPNZ SCASB
        MOV CX,DI
        SUB CX,SI
        LEA DI,PROG_NAME

        PUSH ES
        POP DS

        PUSH CS
        POP ES
        REP MOVSB

        PUSH CS
        POP DS


        MOV AX,3D00H
        LEA DX,PROG_NAME
        INT 21H
        MOV BX,AX
        PUSH BX

        MOV AX,4202H
        MOV CX,0
        MOV DX,0
        INT 21H

        MOV WORD PTR NOWSIZE,AX
        MOV WORD PTR NOWSIZE+2,DX

        LEA BX,OLDSIZE
        CMP [BX],AX
        JNZ SIZERR
        CMP [BX+2],DX
        JZ SIZEOK
SIZERR:
        DISPSTR CHKMS_NAME

        LEA DX,PROG_NAME
        INT 21H

        DISPSTR CHKMS_MSG1
        LEA BX,OLDSIZE
        MOV AX,[BX]
        MOV DX,[BX+2]
        CALL H2A
        DISPSTR CHKMS_MSG2

        LEA BX,NOWSIZE
        MOV AX,[BX]
        MOV DX,[BX+2]
        CALL H2A
        DISPSTR CHKMS_MSG3
        MOV AH,3EH
        POP BX
        INT 21H
        STC
        RET

SIZEOK:
        MOV AH,3EH
        POP BX
        INT 21H
        CLC
        RET
CHK_MYSELF ENDP

CHKMS_NAME DB 13,10,10,'WARNING: $'
PROG_NAME DB 66 DUP (36)
NOWSIZE DD ?
CHKMS_MSG1 DB 'IS FROM $'
CHKMS_MSG2 DB ' BYTES CHANGE TO $'
CHKMS_MSG3 DB ' BYTES !',13,10
CHKMS_MSG4 DB 13,10,'Do you want to continue (Y/N) ?$'
INCLUDE H2A

