40Hex Issue 3.2 Volume 1

 40Hex Issue 3                                                      0004

                      The Strange Case of Validate

     - Fall to your knees, begging your way out of this disease.

     Well we all know what a dick John Mcafee is.  Well with his product
     SCAN comes a program VALIDATE.  I noticed when I took a close look
     at the internal workings of this program (while working on a little
     revenge project) that there is text in the program.  The strings
     read

     "Enter password now"
     "Access denied"

     Well this got me going, what is this??? Well this brings up our
     first 40Hex challenge.  I am including a dissassembly of validate.
     Here it is:

-------------------------------------------------------------------------------

data_1e         equ     100h
data_2e         equ     102h
data_3e         equ     2Ch
data_4e         equ     14h
data_5e         equ     16h
data_6e         equ     18h
data_7e         equ     1Ah
data_8e         equ     47h
data_9e         equ     49h
data_10e        equ     4Ah
data_11e        equ     59h
  
seg_a           segment byte public
                assume  cs:seg_a, ds:seg_a
  
  
                org     100h
  
validate        proc    far
  
start:
                jmp     loc_96
                db      0Dh, '   ', 0Dh, 0Ah, 'VALIDATE 0'
                db      '.3 '
copyright       db      'Copyright 1988-89 by McAfee Asso'
                db      'ciates.'
                db      '  (408) 988-3832', 0Dh, 0Ah, 0Dh
                db      0Ah, 'Written by Dennis Yelle', 0Dh
                db      0Ah, 0Dh, 0Ah
                db      1Ah
data_19         db      30h                                     dexed access)
                db      '123456789ABCDEF'
                db      10h, 0Fh, 0Dh, 8, 6, 3
                db      1, 0, 0C8h, 10h, 0Ch, 5
                db      0, 0C8h, 10h, 0Fh, 2, 0
                db      0C8h, 10h, 0Fh, 0Eh, 7, 6
                db      0, 0C8h, 10h, 0Fh, 0Dh, 0
                db      0C8h
loc_1:
                mov     al,1
                mov     ah,4Ch
                int     21h
                db      0CDh, 20h
loc_2:
                jmp     short loc_2
  
validate        endp
  
sub_1           proc    near
                mov     dx,si
loc_3:
                lodsb
                cmp     al,1
                ja      loc_3
                pushf
                mov     cx,si
                sub     cx,dx
                dec     cx
                mov     ah,40h
                mov     bx,1
                int     21h
                popf
                jz      loc_1
                retn
sub_1           endp
  
sub_2           proc    near
                mov     bp,sp
                xchg    si,[bp]
                call    sub_1
                xchg    si,[bp]
                retn
sub_2           endp
  
                db      0B4h, 40h, 0BBh, 2, 0, 0B9h
                db      48h, 0, 0BAh, 9, 1, 0CDh
                db      21h, 0A1h, 2, 0, 8Ch, 0CBh
                db      29h, 0D8h, 3Dh, 0, 10h, 77h
                db      52h, 0E8h, 0D8h, 0FFh
                db      0Dh, 0Ah, ' Sorry, there is not e'
                db      'nough memory available.', 0Dh, 0Ah
                db      ' I need 66000 bytes of RAM.', 0Dh
                db      0Ah
                db      1, 0BEh, 80h, 0, 0ACh, 0Ah
                db      0C0h
                db      74h, 9
loc_4:
                lodsb
                cmp     al,20h
                je      loc_4
                cmp     al,0Dh
                jne     loc_6
loc_5:
                jmp     loc_10
loc_6:
                dec     si
                mov     data_33,si
                push    si
                mov     si,197h
                call    sub_9
                mov     di,666h
                call    sub_10
                mov     si,186h
                call    sub_9
                mov     di,866h
                call    sub_10
                call    sub_2
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bx+si],ah
                inc     si
                db      'ile Name:  '
                db      0, 5Eh
loc_7:
                lodsb
                cmp     al,20h
                jg      loc_7
                push    ax
                xor     al,al
                mov     [si-1],al
                mov     bx,1
                mov     cx,si
                dec     cx
                mov     dx,data_33
                sub     cx,dx
                mov     ah,40h
                int     21h
                push    si
                call    sub_8
                mov     dx,data_33
                mov     ax,3D00h
                int     21h
                jc      loc_11
                mov     data_32,ax
;*              call    sub_3
                db      0E8h, 0B8h, 0
                mov     ah,3Eh
                mov     bx,data_32
                int     21h
                pop     si
                pop     ax
                cmp     al,0Dh
                je      loc_9
loc_8:
                lodsb
                cmp     al,20h
                je      loc_8
                cmp     al,0Dh
                je      loc_9
                call    sub_8
                jmp     loc_6
loc_9:
                mov     ax,4C00h
                int     21h
loc_10:
                mov     dx,2E6h
                mov     cx,84h
                jmp     loc_17
loc_11:
                mov     dx,5FBh
                mov     cx,29h
                jmp     loc_17
                db      'This program prints the validati'
                db      'on information for a file.', 0Dh
                db      0Ah, 'Examples:', 0Dh, 0Ah, '    '
                db      '      VALIDATE SCAN.EXE', 0Dh, 0Ah
                db      '          VALIDATE SCANRES.EXE', 0Dh
                db      0Ah
  
sub_3           proc    near
                xor     ax,ax
                mov     data_34,ax
                mov     data_35,ax
loc_12:
                mov     bx,data_32
                mov     dx,0A66h
                mov     cx,8000h
                mov     ah,3Fh
                int     21h
                jnc     loc_13
                jmp     loc_16
loc_13:
                or      ax,ax
                jz      loc_14
                mov     dx,ax
                push    dx
                mov     si,0A66h
                mov     di,666h
                mov     cx,data_34
                call    sub_11
                mov     data_34,cx
                pop     dx
                mov     si,0A66h
                mov     di,866h
                mov     cx,data_35
                call    sub_11
                mov     data_35,cx
                jmp     short loc_12
loc_14:
                call    sub_2
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bx+si],ah
                and     [bp+di+69h],dl
                jp      $+67h
                cmp     ah,[bx+si]
                and     [bx+si],al
                mov     ax,4202h
                mov     bx,data_32
                xor     cx,cx
                xor     dx,dx
                int     21h
                jnc     $+0Fh
                call    sub_2
                jnz     $+70h
                db      6Bh, 6Eh, 6Fh, 77h, 6Eh, 0
                db      0EBh, 3, 0E8h, 59h, 1, 0E8h
                db      0D1h, 0FDh
                db      0Dh, 0Ah, '               Date:  '
                db      0, 0B8h, 0, 57h, 8Bh, 1Eh
                db      4Eh, 6, 0CDh, 21h, 73h, 8
                db      0BEh, 0DDh, 3, 0E8h, 8Fh, 0FDh
                db      0EBh, 26h, 52h, 8Bh, 0C2h, 0B1h
                db      5, 0D3h, 0E8h, 25h, 0Fh, 0
                db      0E8h, 70h, 1, 0E8h, 98h, 0
                db      58h, 50h, 25h, 1Fh, 0, 0E8h
                db      65h, 1, 0E8h, 8Dh, 0, 58h
                db      0B1h, 9, 0D3h, 0E8h, 5, 0BCh
                db      7, 0E8h, 57h, 1, 0E8h, 7Ch
                db      0FDh
                db      0Dh, 0Ah, 'File Authentication:', 0Dh
                db      0Ah, '     Check Method 1 - '
                db      0, 8Bh, 0Eh, 52h, 6, 0E8h
                db      27h, 0, 0E8h, 43h, 0FDh
                db      0Dh, 0Ah, '     Check Method 2 - '
                db      0, 8Bh, 0Eh, 54h, 6, 0E8h
                db      4, 0, 0E8h, 27h, 0, 0C3h
                db      51h, 89h, 0C8h, 88h, 0E0h, 0E8h
                db      1, 0
                db      58h
  
  
sub_4:
                mov     bx,ax
                mov     cl,4
                shr     bx,cl
                call    sub_5
                mov     bx,ax
  
  
sub_5:
                and     bx,0Fh
                mov     dl,data_19[bx]
  
  
sub_6:
loc_15:
                push    ax
                mov     ah,2
                int     21h
                pop     ax
                retn
  
  
sub_7:
                mov     dl,2Dh
                jmp     short loc_15
  
  
sub_8:
                mov     dl,0Dh
                call    sub_6
                mov     dl,0Ah
                jmp     short loc_15
loc_16:
                mov     dx,624h
                mov     cx,29h
loc_17:
                mov     bx,2
                push    ax
                mov     ah,40h
                int     21h
                jc      loc_18
                pop     ax
loc_18:
                mov     ah,4Ch
                int     21h
sub_3           endp
  
  
  
sub_9           proc    near
                xor     bx,bx
                xor     cx,cx
                inc     si
                lodsb
loc_19:
                mov     cl,al
                mov     ax,1
                shl     ax,cl
                or      bx,ax
                lodsb
                cmp     al,0C8h
                jb      loc_19
                mov     cl,8
                mov     di,656h
                mov     ax,bx
loc_20:
                stosw
                shr     ax,1
                jnc     loc_21
                xor     ax,bx
loc_21:
                dec     cl
                jnz     loc_20
                retn
sub_9           endp
  
  
sub_10          proc    near
                mov     si,656h
                xor     dx,dx
loc_22:
                mov     cx,dx
                mov     bx,si
                xor     ax,ax
loc_23:
                shl     cl,1
                jnc     loc_24
                xor     ax,[bx]
loc_24:
                add     bx,2
                or      cl,cl
                jnz     loc_23
                stosw
                inc     dl
                jnz     loc_22
                retn
sub_10          endp
  
sub_11          proc    near
loc_25:
                lodsb
                mov     bl,cl
                xor     bl,al
                xor     bh,bh
                mov     cl,ch
                mov     ch,0
                add     bx,bx
                xor     cx,[bx+di]
                dec     dx
                jnz     loc_25
                retn
sub_11          endp
  
data_27         dw      4240h
data_28         dw      0Fh
data_29         dw      3E8h
data_30         dw      0Ah
  
  
sub_12          proc    near
                cmp     dx,data_28
                jb      loc_32
                ja      loc_26
                cmp     ax,data_27
                jb      loc_32
loc_26:
                mov     bx,data_27
                mov     cx,data_28
                xor     si,si
loc_27:
                inc     si
                shl     bx,1
                rcl     cx,1
                jno     loc_27
                xor     di,di
loc_28:
                shl     di,1
                cmp     dx,cx
                jb      loc_30
                ja      loc_29
                cmp     ax,bx
                jb      loc_30
loc_29:
                sub     ax,bx
                sbb     dx,cx
                inc     di
loc_30:
                shr     cx,1
                rcr     bx,1
                dec     si
                jge     loc_28
                push    dx
                push    ax
                mov     ax,di
                xor     dx,dx
                call    sub_14
                mov     al,2Ch
                call    sub_19
                pop     ax
                pop     dx
                div     data_29
                push    dx
                call    sub_15
                jmp     short loc_33
  
  
sub_13:
                xor     dx,dx
                cmp     ax,2710h
                jae     loc_32
                cmp     ax,3E8h
                jb      loc_32
                div     data_29
                or      ax,ax
                push    dx
                jz      loc_31
                call    sub_16
loc_31:
                pop     ax
                jmp     short loc_34
  
  
sub_14:
loc_32:
                div     data_29
                push    dx
                or      ax,ax
                jz      loc_31
                call    sub_16
loc_33:
                mov     al,2Ch
                call    sub_19
                pop     ax
  
  
sub_15:
                xor     dx,dx
                div     data_30
                jmp     loc_35
                db      88h, 0E0h, 32h, 0E4h
  
  
sub_16:
loc_34:
                cmp     ax,0Ah
                jb      loc_37
                xor     dx,dx
                div     data_30
                cmp     al,0Ah
                jb      loc_36
loc_35:
                push    dx
                xor     dx,dx
                div     data_30
                call    sub_17
                pop     ax
                jmp     loc_37
  
  
sub_17:
loc_36:
                push    dx
                call    sub_18
                pop     ax
  
  
sub_18:
loc_37:
                add     al,30h
  
  
sub_19:
                mov     ah,2
                mov     dl,al
                int     21h
                retn
sub_12          endp
  
                db      0Dh, 0Ah, ' Sorry, I cannot open '
                db      'the input file.', 0Dh, 0Ah, 0Dh, 0Ah
                db      ' Sorry, I cannot read the input '
                db      'file.', 0Dh, 0Ah
                db      90h
data_32         dw      0
data_33         dw      0
data_34         dw      0
data_35         dw      0
                db      0ACh, 29h, 0ADh, 29h, 0AEh, 29h
                db      0AFh, 29h, 0B0h, 29h, 0E9h, 70h
                db      2, 0E9h, 49h, 2
                db      14 dup (0)
                db      0E9h, 0C7h, 0, 0Dh, 0, 0
                db      0
                db      44h, 29h
                db      42 dup (0)
                db      0CCh, 7, 6, 7
                db      13 dup (0)
                db      3, 2, 0CFh, 0C8h, 0Dh, 0C9h
                db      0Dh
                db      79 dup (0)
                db      0Dh, 0Ah, 'Please enter the passw'
                db      'ord now: '
                db      0
                db      0Dh, 0Ah, 'This program requires '
                db      'DOS 3.00 or greater'
                db      7, 0Dh, 0Ah, 0, 5Ch, 2Ah
                db      2Eh, 2Ah, 0
                db      0Dh, 0Ah, '%%211#---4677^^^%'
                db      7, 0Dh, 0Ah, 0, 42h, 23h
                db      0
                db      305 dup (0)
                db      50h, 53h, 0A1h, 1, 1, 5
                db      3, 1, 0D1h, 0E8h, 0D1h, 0E8h
                db      0D1h, 0E8h, 0D1h, 0E8h, 8Bh, 0D8h
                db      8Ch, 0C8h, 3, 0C3h, 50h, 0B8h
                db      6Bh, 2, 50h, 0CBh, 5Bh, 58h
                db      2Eh, 0C6h, 6, 1Ah, 0, 0FFh
                db      2Eh, 8Ch, 6, 1Bh, 1, 2Eh
                db      0A3h, 1Dh, 1, 2Eh, 89h, 26h
                db      1Fh, 1, 2Eh, 8Ch, 16h, 21h
                db      1, 8Ch, 0C8h, 8Eh, 0D0h, 0BCh
                db      4Fh, 2, 2Eh, 0A1h, 1Dh, 1
                db      50h, 53h, 51h, 52h, 56h, 57h
                db      55h, 1Eh, 6, 8Ch, 0C8h, 8Eh
                db      0D8h, 8Eh, 0C0h, 0A0h, 1Bh, 0
                db      3Ch, 50h, 75h, 6, 0E8h, 6Ah
                db      0, 0EBh, 15h, 90h, 3Ch, 44h
                db      75h, 6, 0E8h, 78h, 0, 0EBh
                db      0Bh, 90h
loc_38:
                cmp     al,4Ch
                jne     loc_39
                call    sub_21
                jmp     short loc_40
loc_39:
                stc
loc_40:
                pop     es
                pop     ds
                pop     bp
                pop     di
                pop     si
                pop     dx
                pop     cx
                pop     bx
                cmp     byte ptr cs:data_7e,0
                je      loc_41
                mov     ax,cs:data_4e
                mov     ds:data_1e,ax
                mov     ax,cs:data_5e
                mov     ds:data_2e,ax
                mov     ax,100h
                mov     cs:data_4e,ax
                mov     cs:data_5e,ds
                jmp     short loc_42
loc_41:
                mov     ax,cs
                sub     ax,cs:data_6e
                add     cs:data_5e,ax
loc_42:
                pop     ax
                mov     ss,word ptr cs:[121h]
                mov     sp,word ptr cs:[11Fh]
                jmp     dword ptr cs:data_4e
                db      0BAh, 4, 1, 0E8h, 0BCh, 0
                db      0B8h, 0FFh, 4Ch, 0CDh, 21h, 0BAh
                db      0AEh, 0, 0E8h, 0B1h, 0, 0C6h
                db      6, 58h, 0, 29h, 0BAh, 58h
                db      0, 0E8h, 74h, 0, 0E8h, 0BDh
                db      0, 0E8h, 87h, 0, 0C3h
  
  
sub_20          proc    near
                mov     ah,2Ah
                int     21h
                cmp     cx,ds:data_8e
                jb      loc_44
                cmp     dh,ds:data_9e
                jb      loc_44
                cmp     dl,ds:data_10e
                jb      loc_44
                jmp     short loc_44
                db      90h, 0B4h, 30h, 0CDh, 21h, 3Ch
                db      3, 73h, 4, 0F8h, 0EBh, 25h
                db      90h, 1Eh, 6, 32h, 0C0h, 0B9h
                db      0, 80h, 2Eh, 8Eh, 6, 1Bh
                db      1, 26h, 8Eh, 6, 2Ch, 0
                db      33h, 0FFh
loc_43:
                repne   scasb
                scasb
                jnz     loc_43
                add     di,2
                push    es
                pop     ds
                mov     dx,di
                mov     ah,41h
                clc
                pop     es
                pop     ds
loc_44:
                cmc
                retn
sub_20          endp
  
  
sub_21          proc    near
                mov     ah,1Ah
                mov     dx,83h
                int     21h
                mov     ah,4Eh
                mov     cx,8
                mov     dx,0FFh
                int     21h
                mov     si,0A1h
                mov     di,4Bh
                cld
loc_45:
                lodsb
                scasb
                stc
                jnz     loc_ret_46
                or      al,al
                jnz     loc_45
  
loc_ret_46:
                retn
sub_21          endp
  
  
  
sub_22          proc    near
                push    ax
                push    bx
                push    cx
                mov     ah,0Ah
                int     21h
                mov     bx,dx
                inc     bx
                mov     cl,[bx]
                xor     ch,ch
                jcxz    loc_48
  
locloop_47:
                inc     bx
                not     byte ptr [bx]
                loop    locloop_47
  
loc_48:
                pop     cx
                pop     bx
                pop     ax
                retn
sub_22          endp
  
  
  
sub_23          proc    near
                push    cx
                push    si
                push    di
                mov     cl,ds:data_11e
                xor     ch,ch
                mov     si,59h
                mov     di,1Dh
                cld
                repe    cmpsb
                jz      loc_49
                stc
loc_49:
                pop     di
                pop     si
                pop     cx
                retn
sub_23          endp
  
  
  
sub_24          proc    near
                push    bx
                push    dx
                mov     bx,dx
loc_50:
                mov     dl,[bx]
                or      dl,dl
                jz      loc_51
                call    sub_25
                inc     bx
                jmp     short loc_50
loc_51:
                pop     dx
                pop     bx
                retn
sub_24          endp
  
  
  
sub_25          proc    near
                push    ax
                mov     ah,2
                int     21h
                pop     ax
                retn
sub_25          endp
  
  
  
sub_26          proc    near
                push    dx
                mov     dl,0Dh
                call    sub_25
                mov     dl,0Ah
                call    sub_25
                pop     dx
                retn
sub_26          endp
  
                db      0, 0, 0, 0, 0ACh, 29h
                db      0ADh, 29h, 0AEh, 29h, 0AFh, 29h
                db      0B0h, 29h, 0E9h, 70h, 2, 0E9h
                db      49h, 2
                db      14 dup (0)
                db      0E9h, 60h, 5, 0Dh, 0, 0
                db      0
                db      44h, 29h
                db      42 dup (0)
                db      0EAh, 7, 0Ch, 1Fh, 0
                db      12 dup (0)
                db      3, 2, 0CCh, 0CEh, 0Dh, 0C9h
                db      0Dh
                db      79 dup (0)
                db      0Dh, 0Ah, 'Please enter the passw'
                db      'ord now: '
                db      0
                db      0Dh, 0Ah, 'This program requires '
                db      'DOS 3.00 or greater'
                db      7, 0Dh, 0Ah, 0, 5Ch, 2Ah
                db      2Eh, 2Ah, 0
                db      0Dh, 0Ah, '%%211#---4677^^^%'
                db      7, 0Dh, 0Ah, 0, 42h, 23h
                db      0
                db      305 dup (0)
                db      50h, 53h, 0A1h, 1, 1, 5
                db      3, 1, 0D1h, 0E8h, 0D1h, 0E8h
                db      0D1h, 0E8h, 0D1h, 0E8h, 8Bh, 0D8h
                db      8Ch, 0C8h, 3, 0C3h, 50h, 0B8h
                db      6Bh, 2, 50h, 0CBh, 5Bh, 58h
                db      2Eh, 0C6h, 6, 1Ah, 0, 0FFh
                db      2Eh, 8Ch, 6, 1Bh, 1, 2Eh
                db      0A3h, 1Dh, 1, 2Eh, 89h, 26h
                db      1Fh, 1, 2Eh, 8Ch, 16h, 21h
                db      1, 8Ch, 0C8h, 8Eh, 0D0h, 0BCh
                db      4Fh, 2, 2Eh, 0A1h, 1Dh, 1
                db      50h, 53h, 51h, 52h, 56h, 57h
                db      55h, 1Eh, 6, 8Ch, 0C8h, 8Eh
                db      0D8h, 8Eh, 0C0h, 0A0h, 1Bh, 0
                db      3Ch, 50h, 75h, 6, 0E8h, 6Ah
                db      0, 0EBh, 15h, 90h, 3Ch, 44h
                db      75h, 6, 0E8h, 78h, 0, 0EBh
                db      0Bh, 90h
loc_52:
                cmp     al,4Ch
                jne     loc_53
                call    sub_28
                jmp     short loc_54
loc_53:
                stc
loc_54:
                pop     es
                pop     ds
                pop     bp
                pop     di
                pop     si
                pop     dx
                pop     cx
                pop     bx
                cmp     byte ptr cs:data_7e,0
                je      loc_55
                mov     ax,cs:data_4e
                mov     ds:data_1e,ax
                mov     ax,cs:data_5e
                mov     ds:data_2e,ax
                mov     ax,100h
                mov     cs:data_4e,ax
                mov     cs:data_5e,ds
                jmp     short loc_56
loc_55:
                mov     ax,cs
                sub     ax,cs:data_6e
                add     cs:data_5e,ax
loc_56:
                pop     ax
                mov     ss,word ptr cs:[121h]
                mov     sp,word ptr cs:[11Fh]
                jmp     dword ptr cs:data_4e
                db      0BAh, 4, 1, 0E8h, 0BCh, 0
                db      0B8h, 0FFh, 4Ch, 0CDh, 21h, 0BAh
                db      0AEh, 0, 0E8h, 0B1h, 0, 0C6h
                db      6, 58h, 0, 29h, 0BAh, 58h
                db      0, 0E8h, 74h, 0, 0E8h, 0BDh
                db      0, 0E8h, 87h, 0, 0C3h
  
  
sub_27          proc    near
                mov     ah,2Ah
                int     21h
                cmp     cx,ds:data_8e
                jb      loc_58
                cmp     dh,ds:data_9e
                jb      loc_58
                cmp     dl,ds:data_10e
                jb      loc_58
                jmp     short loc_58
                db      90h, 0B4h, 30h, 0CDh, 21h, 3Ch
                db      3, 73h, 4, 0F8h, 0EBh, 25h
                db      90h, 1Eh, 6, 32h, 0C0h, 0B9h
                db      0, 80h, 2Eh, 8Eh, 6, 1Bh
                db      1, 26h, 8Eh, 6, 2Ch, 0
                db      33h, 0FFh
loc_57:
                repne   scasb
                scasb
                jnz     loc_57
                add     di,2
                push    es
                pop     ds
                mov     dx,di
                mov     ah,41h
                clc
                pop     es
                pop     ds
loc_58:
                cmc
                retn
sub_27          endp
  
  
  
sub_28          proc    near
                mov     ah,1Ah
                mov     dx,83h
                int     21h
                mov     ah,4Eh
                mov     cx,8
                mov     dx,0FFh
                int     21h
                mov     si,0A1h
                mov     di,4Bh
                cld
loc_59:
                lodsb
                scasb
                stc
                jnz     loc_ret_60
                or      al,al
                jnz     loc_59
  
loc_ret_60:
                retn
sub_28          endp
  
  
  
sub_29          proc    near
                push    ax
                push    bx
                push    cx
                mov     ah,0Ah
                int     21h
                mov     bx,dx
                inc     bx
                mov     cl,[bx]
                xor     ch,ch
                jcxz    loc_62
  
locloop_61:
                inc     bx
                not     byte ptr [bx]
                loop    locloop_61
  
loc_62:
                pop     cx
                pop     bx
                pop     ax
                retn
sub_29          endp
  
  
  
sub_30          proc    near
                push    cx
                push    si
                push    di
                mov     cl,ds:data_11e
                xor     ch,ch
                mov     si,59h
                mov     di,1Dh
                cld
                repe    cmpsb
                jz      loc_63
                stc
loc_63:
                pop     di
                pop     si
                pop     cx
                retn
sub_30          endp
  
  
  
sub_31          proc    near
                push    bx
                push    dx
                mov     bx,dx
loc_64:
                mov     dl,[bx]
                or      dl,dl
                jz      loc_65
                call    sub_32
                inc     bx
                jmp     short loc_64
loc_65:
                pop     dx
                pop     bx
                retn
sub_31          endp
  
  
  
sub_32          proc    near
                push    ax
                mov     ah,2
                int     21h
                pop     ax
                retn
sub_32          endp
  
  
sub_33          proc    near
                push    dx
                mov     dl,0Dh
                call    sub_32
                mov     dl,0Ah
                call    sub_32
                pop     dx
                retn
sub_33          endp
  
                db      0, 0, 0, 0, 0ACh, 29h
                db      0ADh, 29h, 0AEh, 29h, 0AFh, 29h
                db      0B0h, 29h, 0E9h, 70h, 2, 0E9h
                db      49h, 2
                db      14 dup (0)
                db      0E9h, 60h, 9, 0Dh, 0, 0
                db      0
                db      44h, 29h
                db      42 dup (0)
                db      0C2h, 7, 9, 0Bh, 0
                db      12 dup (0)
                db      3, 2, 0CEh, 0CEh, 0Dh, 0C9h
                db      0Dh
                db      79 dup (0)
                db      0Dh, 0Ah, 'Please enter the passw'
                db      'ord now: '
                db      0
                db      0Dh, 0Ah, 'This program requires '
                db      'DOS 3.00 or greater'
                db      7, 0Dh, 0Ah, 0, 5Ch, 2Ah
                db      2Eh, 2Ah, 0
                db      0Dh, 0Ah, '%%211#---4677^^^%'
                db      7, 0Dh, 0Ah, 0, 42h, 23h
                db      0
                db      305 dup (0)
                db      50h, 53h, 0A1h, 1, 1, 5
                db      3, 1, 0D1h, 0E8h, 0D1h, 0E8h
                db      0D1h, 0E8h, 0D1h, 0E8h, 8Bh, 0D8h
                db      8Ch, 0C8h, 3, 0C3h, 50h, 0B8h
                db      6Bh, 2, 50h, 0CBh, 5Bh, 58h
                db      2Eh, 0C6h, 6, 1Ah, 0, 0FFh
                db      2Eh, 8Ch, 6, 1Bh, 1, 2Eh
                db      0A3h, 1Dh, 1, 2Eh, 89h, 26h
                db      1Fh, 1, 2Eh, 8Ch, 16h, 21h
                db      1, 8Ch, 0C8h, 8Eh, 0D0h, 0BCh
                db      4Fh, 2, 2Eh, 0A1h, 1Dh, 1
                db      50h, 53h, 51h, 52h, 56h, 57h
                db      55h, 1Eh, 6, 8Ch, 0C8h, 8Eh
                db      0D8h, 8Eh, 0C0h, 0A0h, 1Bh, 0
                db      3Ch, 50h, 75h, 6, 0E8h, 6Ah
                db      0, 0EBh, 15h, 90h, 3Ch, 44h
                db      75h, 6, 0E8h, 78h, 0, 0EBh
                db      0Bh, 90h
loc_66:
                cmp     al,4Ch
                jne     loc_67
                call    sub_35
                jmp     short loc_68
loc_67:
                stc
loc_68:
                pop     es
                pop     ds
                pop     bp
                pop     di
                pop     si
                pop     dx
                pop     cx
                pop     bx
                cmp     byte ptr cs:data_7e,0
                je      loc_69
                mov     ax,cs:data_4e
                mov     ds:data_1e,ax
                mov     ax,cs:data_5e
                mov     ds:data_2e,ax
                mov     ax,100h
                mov     cs:data_4e,ax
                mov     cs:data_5e,ds
                jmp     short loc_70
loc_69:
                mov     ax,cs
                sub     ax,cs:data_6e
                add     cs:data_5e,ax
loc_70:
                pop     ax
                mov     ss,word ptr cs:[121h]
                mov     sp,word ptr cs:[11Fh]
                jmp     dword ptr cs:data_4e
                db      0BAh, 4, 1, 0E8h, 0BCh, 0
                db      0B8h, 0FFh, 4Ch, 0CDh, 21h, 0BAh
                db      0AEh, 0, 0E8h, 0B1h, 0, 0C6h
                db      6, 58h, 0, 29h, 0BAh, 58h
                db      0, 0E8h, 74h, 0, 0E8h, 0BDh
                db      0, 0E8h, 87h, 0, 0C3h
  
sub_34          proc    near
                mov     ah,2Ah
                int     21h
                cmp     cx,ds:data_8e
                jb      loc_72
                cmp     dh,ds:data_9e
                jb      loc_72
                cmp     dl,ds:data_10e
                jb      loc_72
                jmp     short loc_72
                db      90h, 0B4h, 30h, 0CDh, 21h, 3Ch
                db      3, 73h, 4, 0F8h, 0EBh, 25h
                db      90h, 1Eh, 6, 32h, 0C0h, 0B9h
                db      0, 80h, 2Eh, 8Eh, 6, 1Bh
                db      1, 26h, 8Eh, 6, 2Ch, 0
                db      33h, 0FFh
loc_71:
                repne   scasb
                scasb
                jnz     loc_71
                add     di,2
                push    es
                pop     ds
                mov     dx,di
                mov     ah,41h
                clc
                pop     es
                pop     ds
loc_72:
                cmc
                retn
sub_34          endp
  
sub_35          proc    near
                mov     ah,1Ah
                mov     dx,83h
                int     21h
                mov     ah,4Eh
                mov     cx,8
                mov     dx,0FFh
                int     21h
                mov     si,0A1h
                mov     di,4Bh
                cld
loc_73:
                lodsb
                scasb
                stc
                jnz     loc_ret_74
                or      al,al
                jnz     loc_73
  
loc_ret_74:
                retn
sub_35          endp
  
  
sub_36          proc    near
                push    ax
                push    bx
                push    cx
                mov     ah,0Ah
                int     21h
                mov     bx,dx
                inc     bx
                mov     cl,[bx]
                xor     ch,ch
                jcxz    loc_76
  
locloop_75:
                inc     bx
                not     byte ptr [bx]
                loop    locloop_75
  
loc_76:
                pop     cx
                pop     bx
                pop     ax
                retn
sub_36          endp
  
  
sub_37          proc    near
                push    cx
                push    si
                push    di
                mov     cl,ds:data_11e
                xor     ch,ch
                mov     si,59h
                mov     di,1Dh
                cld
                repe    cmpsb
                jz      loc_77
                stc
loc_77:
                pop     di
                pop     si
                pop     cx
                retn
sub_37          endp
  
  
sub_38          proc    near
                push    bx
                push    dx
                mov     bx,dx
loc_78:
                mov     dl,[bx]
                or      dl,dl
                jz      loc_79
                call    sub_39
                inc     bx
                jmp     short loc_78
loc_79:
                pop     dx
                pop     bx
                retn
sub_38          endp
  
  
sub_39          proc    near
                push    ax
                mov     ah,2
                int     21h
                pop     ax
                retn
sub_39          endp
  
  
sub_40          proc    near
                push    dx
                mov     dl,0Dh
                call    sub_39
                mov     dl,0Ah
                call    sub_39
                pop     dx
                retn
sub_40          endp
  
                db      0, 0, 0, 0, 0ACh, 29h
                db      0ADh, 29h, 0AEh, 29h, 0AFh, 29h
                db      0B0h, 29h, 0E9h, 6Ch, 2, 0E9h
                db      45h, 2, 0
                db      13 dup (0)
                db      0E9h, 60h, 0Dh, 0Dh, 0, 0
                db      0
                db      44h, 29h
                db      42 dup (0)
                db      0D2h, 7, 1, 1
                db      13 dup (0)
                db      3, 2, 0CFh, 0CEh, 0Dh, 0CDh
                db      0Dh
                db      79 dup (0)
                db      0Dh, 0Ah, 'Please enter the passw'
                db      'ord now: '
                db      0
                db      0Dh, 0Ah, 'This program requires '
                db      'DOS 3.00 or greater'
                db      7, 0Dh, 0Ah, 0, 5Ch, 2Ah
                db      2Eh, 2Ah, 0
                db      0Dh, 0Ah, 'Access denied'
                db      7, 0Dh, 0Ah, 0, 42h, 23h
                db      0
                db      305 dup (0)
                db      50h, 53h, 0A1h, 1, 1, 5
                db      3, 1, 0D1h, 0E8h, 0D1h, 0E8h
                db      0D1h, 0E8h, 0D1h, 0E8h, 8Bh, 0D8h
                db      8Ch, 0C8h, 3, 0C3h, 50h, 0B8h
                db      67h, 2, 50h, 0CBh, 5Bh, 58h
                db      2Eh, 0C6h, 6, 1Ah, 0, 0FFh
                db      2Eh, 8Ch, 6, 17h, 1, 2Eh
                db      0A3h, 19h, 1, 2Eh, 89h, 26h
                db      1Bh, 1, 2Eh, 8Ch, 16h, 1Dh
                db      1, 8Ch, 0C8h, 8Eh, 0D0h, 0BCh
                db      4Bh, 2, 2Eh, 0A1h, 19h, 1
                db      50h, 53h, 51h, 52h, 56h, 57h
                db      55h, 1Eh, 6, 8Ch, 0C8h, 8Eh
                db      0D8h, 8Eh, 0C0h, 0A0h, 1Bh, 0
                db      3Ch, 50h, 75h, 6, 0E8h, 6Ch
                db      0, 0EBh, 15h, 90h, 3Ch, 44h
                db      75h, 6, 0E8h, 7Ah, 0, 0EBh
                db      0Bh, 90h
loc_80:
                cmp     al,4Ch
                jne     loc_81
                call    sub_42
                jmp     short loc_82
loc_81:
                stc
loc_82:
                jc      loc_85
                pop     es
                pop     ds
                pop     bp
                pop     di
                pop     si
                pop     dx
                pop     cx
                pop     bx
                cmp     byte ptr cs:data_7e,0
                je      loc_83
                mov     ax,cs:data_4e
                mov     ds:data_1e,ax
                mov     ax,cs:data_5e
                mov     ds:data_2e,ax
                mov     ax,100h
                mov     cs:data_4e,ax
                mov     cs:data_5e,ds
                jmp     short loc_84
loc_83:
                mov     ax,cs
                sub     ax,cs:data_6e
                add     cs:data_5e,ax
loc_84:
                pop     ax
                mov     ss,word ptr cs:[11Dh]
                mov     sp,word ptr cs:[11Bh]
                jmp     dword ptr cs:data_4e
loc_85:
                mov     dx,104h
                call    sub_45
                mov     ax,4CFFh
                int     21h
                db      0BAh, 0AEh, 0, 0E8h, 0B6h, 0
                db      0C6h, 6, 58h, 0, 29h, 0BAh
                db      58h, 0, 0E8h, 79h, 0, 0E8h
                db      0C2h, 0, 0E8h, 8Ch, 0, 0C3h
  
sub_41          proc    near
                mov     ah,2Ah
                int     21h
                cmp     cx,ds:data_8e
                jb      loc_88
                cmp     dh,ds:data_9e
                jb      loc_88
                cmp     dl,ds:data_10e
                jb      loc_88
                mov     ah,30h
                int     21h
                cmp     al,3
                jae     loc_86
                mov     dx,0D0h
                call    sub_45
                clc
                jmp     short loc_88
                db      90h
loc_86:
                push    ds
                push    es
                xor     al,al
                mov     cx,8000h
                mov     es,word ptr cs:copyright+1
                mov     es,es:data_3e
                xor     di,di
loc_87:
                repne   scasb
                scasb
                jnz     loc_87
                add     di,2
                push    es
                pop     ds
                mov     dx,di
                mov     ah,41h
                int     21h
                clc
                pop     es
                pop     ds
loc_88:
                cmc
                retn
sub_41          endp
  
sub_42          proc    near
                mov     ah,1Ah
                mov     dx,83h
                int     21h
                mov     ah,4Eh
                mov     cx,8
                mov     dx,0FFh
                int     21h
                mov     si,0A1h
                mov     di,4Bh
                cld
loc_89:
                lodsb
                scasb
                stc
                jnz     loc_ret_90
                or      al,al
                jnz     loc_89
  
loc_ret_90:
                retn
sub_42          endp
  
sub_43          proc    near
                push    ax
                push    bx
                push    cx
                mov     ah,0Ah
                int     21h
                mov     bx,dx
                inc     bx
                mov     cl,[bx]
                xor     ch,ch
                jcxz    loc_92
  
locloop_91:
                inc     bx
                not     byte ptr [bx]
                loop    locloop_91
  
loc_92:
                pop     cx
                pop     bx
                pop     ax
                retn
sub_43          endp
  
sub_44          proc    near
                push    cx
                push    si
                push    di
                mov     cl,ds:data_11e
                xor     ch,ch
                mov     si,59h
                mov     di,1Dh
                cld
                repe    cmpsb
                jz      loc_93
                stc
loc_93:
                pop     di
                pop     si
                pop     cx
                retn
sub_44          endp
  
  
  
sub_45          proc    near
                push    bx
                push    dx
                mov     bx,dx
loc_94:
                mov     dl,[bx]
                or      dl,dl
                jz      loc_95
                call    sub_46
                inc     bx
                jmp     short loc_94
loc_95:
                pop     dx
                pop     bx
                retn
sub_45          endp
  
  
  
sub_46          proc    near
                push    ax
                mov     ah,2
                int     21h
                pop     ax
                retn
sub_46          endp
  
  
  
sub_47          proc    near
                push    dx
                mov     dl,0Dh
                call    sub_46
                mov     dl,0Ah
                call    sub_46
                pop     dx
                retn
sub_47          endp
  
                db      0, 0ACh, 29h, 0ADh, 29h, 0AEh
                db      29h, 0AFh, 29h, 0B0h, 29h, 0E9h
                db      6Ch, 2
loc_96:
                jmp     loc_97
                db      0
                db      13 dup (0)
                db      0E9h, 60h, 11h, 0Dh, 0, 0
                db      0
                db      44h, 29h
                db      42 dup (0)
                db      0D0h, 7, 6, 6
                db      13 dup (0)
                db      3, 2, 0CFh, 0C9h, 0Dh, 0CFh
                db      0Dh
                db      79 dup (0)
                db      0Dh, 0Ah, 'Please enter the passw'
                db      'ord now: '
                db      0
                db      0Dh, 0Ah, 'This program requires '
                db      'DOS 3.00 or greater'
                db      7, 0Dh, 0Ah, 0, 5Ch, 2Ah
                db      2Eh, 2Ah, 0
                db      0Dh, 0Ah, 'Access denied'
                db      7, 0Dh, 0Ah, 0, 42h, 23h
                db      0
                db      305 dup (0)
loc_97:
                push    ax
                push    bx
                mov     ax,word ptr ds:[101h]
                add     ax,103h
                shr     ax,1
                shr     ax,1
                shr     ax,1
                shr     ax,1
                mov     bx,ax
                mov     ax,cs
                add     ax,bx
                push    ax
                mov     ax,267h
                push    ax
                retf
                db      5Bh, 58h, 2Eh, 0C6h, 6, 1Ah
                db      0, 0FFh, 2Eh, 8Ch, 6, 17h
                db      1, 2Eh, 0A3h, 19h, 1, 2Eh
                db      89h, 26h, 1Bh, 1, 2Eh, 8Ch
                db      16h, 1Dh, 1, 8Ch, 0C8h, 8Eh
                db      0D0h, 0BCh, 4Bh, 2, 2Eh, 0A1h
                db      19h, 1, 50h, 53h, 51h, 52h
                db      56h, 57h, 55h, 1Eh, 6, 8Ch
                db      0C8h, 8Eh, 0D8h, 8Eh, 0C0h, 0A0h
                db      1Bh, 0, 3Ch, 50h, 75h, 6
                db      0E8h, 6Ch, 0, 0EBh, 15h, 90h
                db      3Ch, 44h, 75h, 6, 0E8h, 7Ah
                db      0, 0EBh, 0Bh, 90h
loc_98:
                cmp     al,4Ch
                jne     loc_99
                call    sub_49
                jmp     short loc_100
loc_99:
                stc
loc_100:
                jc      loc_103
                pop     es
                pop     ds
                pop     bp
                pop     di
                pop     si
                pop     dx
                pop     cx
                pop     bx
                cmp     byte ptr cs:data_7e,0
                je      loc_101
                mov     ax,cs:data_4e
                mov     ds:data_1e,ax
                mov     ax,cs:data_5e
                mov     ds:data_2e,ax
                mov     ax,100h
                mov     cs:data_4e,ax
                mov     cs:data_5e,ds
                jmp     short loc_102
loc_101:
                mov     ax,cs
                sub     ax,cs:data_6e
                add     cs:data_5e,ax
loc_102:
                pop     ax
                mov     ss,word ptr cs:[11Dh]
                mov     sp,word ptr cs:[11Bh]
                jmp     dword ptr cs:data_4e
loc_103:
                mov     dx,104h
                call    sub_52
                mov     ax,4CFFh
                int     21h
                db      0BAh, 0AEh, 0, 0E8h, 0B6h, 0
                db      0C6h, 6, 58h, 0, 29h, 0BAh
                db      58h, 0, 0E8h, 79h, 0, 0E8h
                db      0C2h, 0, 0E8h, 8Ch, 0, 0C3h
  
sub_48          proc    near
                mov     ah,2Ah
                int     21h
                cmp     cx,ds:data_8e
                jb      loc_106
                cmp     dh,ds:data_9e
                jb      loc_106
                cmp     dl,ds:data_10e
                jb      loc_106
                mov     ah,30h
                int     21h
                cmp     al,3
                jae     loc_104
                mov     dx,0D0h
                call    sub_52
                clc
                jmp     short loc_106
                db      90h
loc_104:
                push    ds
                push    es
                xor     al,al
                mov     cx,8000h
                mov     es,word ptr cs:copyright+1
                mov     es,es:data_3e
                xor     di,di
loc_105:
                repne   scasb
                scasb
                jnz     loc_105
                add     di,2
                push    es
                pop     ds
                mov     dx,di
                mov     ah,41h
                int     21h
                clc
                pop     es
                pop     ds
loc_106:
                cmc
                retn
sub_48          endp
  
  
sub_49          proc    near
                mov     ah,1Ah
                mov     dx,83h
                int     21h
                mov     ah,4Eh
                mov     cx,8
                mov     dx,0FFh
                int     21h
                mov     si,0A1h
                mov     di,4Bh
                cld
loc_107:
                lodsb
                scasb
                stc
                jnz     loc_ret_108
                or      al,al
                jnz     loc_107
  
loc_ret_108:
                retn
sub_49          endp
  

sub_50          proc    near
                push    ax
                push    bx
                push    cx
                mov     ah,0Ah
                int     21h
                mov     bx,dx
                inc     bx
                mov     cl,[bx]
                xor     ch,ch
                jcxz    loc_110
  
locloop_109:
                inc     bx
                not     byte ptr [bx]
                loop    locloop_109
  
loc_110:
                pop     cx
                pop     bx
                pop     ax
                retn
sub_50          endp
  
  
sub_51          proc    near
                push    cx
                push    si
                push    di
                mov     cl,ds:data_11e
                xor     ch,ch
                mov     si,59h
                mov     di,1Dh
                cld
                repe    cmpsb
                jz      loc_111
                stc
loc_111:
                pop     di
                pop     si
                pop     cx
                retn
sub_51          endp
  
  
  
sub_52          proc    near
                push    bx
                push    dx
                mov     bx,dx
loc_112:
                mov     dl,[bx]
                or      dl,dl
                jz      loc_113
                call    sub_53
                inc     bx
                jmp     short loc_112
loc_113:
                pop     dx
                pop     bx
                retn
sub_52          endp
  
  
  
sub_53          proc    near
                push    ax
                mov     ah,2
                int     21h
                pop     ax
                retn
sub_53          endp
  
  
sub_54          proc    near
                push    dx
                mov     dl,0Dh
                call    sub_53
                mov     dl,0Ah
                call    sub_53
                pop     dx
                retn
sub_54          endp
  
                db      0F0h, 0FDh, 0C5h, 0AAh, 0FFh, 0F0h
                db      8Dh, 6Dh, 0B2h
                db      73h
  
seg_a           ends
  
  
  
                end     start