.386 ;v3.2



_STACK SEGMENT STACK

dw 100h dup (?)

_STACK ENDS



_DATA SEGMENT

DATACOUNT db 0

NUMDISPLAY db 50 dup (0)

ALSO_MSG db 'Run ZTW_REG and type in the number given',0

LINE1 equ 0B878h

REGMEMNAMECNTR dw 0

ACTUAL_LETTERS dw 0

RED db 0

GREEN db 0

BLUE db 0

COLOR db 63

ISTHEREANERROR db 0

INIT equ 1Fh

INIT_COLOR equ 01F7Eh

NAME_COLOR equ 1Fh

NUM_COLOR equ 1Fh

PRINT_NUM_CNT dw 22 ;and video address

ERROR_MSG_COLOR equ 0Ch

ERROR db 'Sorry bud, please read the instructions',0

LOGO db 1 dup (0dh,0ah)

UCF       DB 'ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД',10,13

          DB '  ЬЬЬ   ЬЬЬ    ЬЬЬЬЬЬЬЬЬ    ЬЬЬЬЬЬЬЬЬ   ',10,13

          DB '  ЫЫЫ   ЫЫЫ    ЫЫЫ          ЫЫЫЬЬЬ      ',10,13

          DB '  ЫЫЫЬ  ЫЫЫ    ЫЫЫЬ         ЫЫЫ         ',10,13

          DB '  ЯЯЯЯЯЯЯЯЯ    ЯЯЯЯЯЯЯЯЯ    ЯЯЯ         ',10,13

          DB 'ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД',10,13

          DB ' u N I T E D  c R ’ C K I N G  f O R C E ',10,13

          DB 'ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД',10,13

          DB ' ZTWin 1.20 and 1.21 Beta Keymaker - 3 char min -',10,13

          DB ' By IllumiTIE[UCF] - Thanks to xOANON[UCF]',10,13,10,13

          db '      Name:$'

SERIAL db 0dh,0ah,'    Serial:$'

NAMENOVMEM db 29 dup (0)

_DATA ENDS



_TEXT SEGMENT use16

  Assume CS:_TEXT, DS:_DATA, ES:_DATA, SS:_STACK

INTRO:

  call FADEOUT

  mov ax,0003h

  int 10h

  mov ax,_DATA

  mov ds,ax

  mov ax,1015h

  mov bx,0007h

  int 10h

  mov GREEN,ch

  mov BLUE,cl

  mov RED,dh

  lea dx,LOGO

  mov ah,9

  int 21h

  call CLASS

  cld

  sub di,58 ;numbe of char *2

  jmp DISPLAY_TEXT



ERROR_1:

  call ERROR_MSG

DISPLAY_TEXT:

  call ASK

  cmp ISTHEREANERROR,1

  jz ERROR_1

  call ENKRYPT

QUIT:

  call WRI_HEX_DIG

  call RESET_PAL

  call ALSO

  mov ax,4c00h

  int 21h



WRI_HEX_DIG Proc

  push di

  push ax

  push dx

  cld

  mov di,LINE1+10

  mov es,di

  mov di,PRINT_NUM_CNT

  lea si,NUMDISPLAY

L00PWRITE:

  lodsb

  mov ah,NUM_COLOR

  stosw

  or al,al

  jnz L00PWRITE

  pop dx

  pop ax

  pop di

  ret

WRI_HEX_DIG EndP

CLASS Proc

  mov bx,LINE1

  mov es,bx

  mov di,22

  mov ax,INIT_COLOR

  mov cx,29

  rep stosw

  mov ax,1000h

  xor bx,bx

  mov dx,1000h

  int 10h

  ret

CLASS EndP

DEL_ERR_MSG Proc

  push cx

  push ax

  push si

  push di

  push es

  mov di,LINE1-10

  mov es,di

  mov di,0

  xor ax,ax

  mov cx,40

  rep stosw

  pop es

  pop di

  pop si

  pop ax

  pop cx

  ret

DEL_ERR_MSG EndP

ERROR_MSG Proc

  push ax

  push esi

  push es

  push di

  dec ISTHEREANERROR

  mov di,LINE1-10

  mov es,di

  mov di,0

  mov esi,offset ERROR

  cld

ERROR_1_1:

  lodsb

  mov ah,ERROR_MSG_COLOR

  stosw

  cmp al,0

  jne ERROR_1_1

  pop di

  pop es

  pop esi

  pop ax

  ret

ERROR_MSG EndP

ASK Proc

STOP_1:

  call FLASHNOW

  xor ax,ax

  mov ah,01

  ;xor ah,ah

  int 16h

  jz STOP_1

  xor ah,ah

  int 16h

  call DEL_ERR_MSG

  cmp al,0dh

  jz DONE

  cmp al,08h

  jz NO_SAVE

  cmp ACTUAL_LETTERS,3

  jz ERROR_DONE

IS_IT_NUM:

  cmp al,39h

  jle SAVE

;  and al,05fh

  jmp short SAVE

NO_SAVE:

  cmp ACTUAL_LETTERS,0

  jz ERROR_DONE

  std

  push ax

  dec di

  dec di

  mov ax,INIT_COLOR

  stosw

  inc di

  inc di

  pop ax

  cld

  dec ACTUAL_LETTERS

  dec ACTUAL_LETTERS

  dec REGMEMNAMECNTR

  jmp short BLAH

SAVE:

  mov ah,NAME_COLOR

  stosw

  call SAVEINREGMEM

BLAH:

  inc ACTUAL_LETTERS

  jmp STOP_1

ERROR_DONE:

  mov ISTHEREANERROR,1

  ret

DONE:

  cmp ACTUAL_LETTERS,3

  jl ERROR_DONE

  ret

ASK EndP

FLASHNOW Proc

  push ax

  push bx

  push cx

  push dx

  mov ax,1010h

  xor bh,bh

  mov bl,7

  mov cl,COLOR

  mov dh,COLOR

  mov ch,COLOR

 REDO:

  mov ax,1010h

  mov cl,COLOR

  mov ch,COLOR

  mov dh,COLOR

  int 10h

  dec COLOR

  or cl,cl

  jnz QUIT_COLOR

  mov COLOR,63

 QUIT_COLOR:

  pop dx

  pop cx

  pop bx

  pop ax

  ret

FLASHNOW EndP

RESET_PAL Proc

  mov ax,1010h

  xor bh,bh

  mov bl,7

  mov ch,GREEN

  mov cl,BLUE

  mov dh,RED

  int 10h

  ret

RESET_PAL EndP

SAVEINREGMEM Proc

  push es

  push ax

  push di

  push ds

  pop es

  mov edi,offset NAMENOVMEM

  add di,REGMEMNAMECNTR

  stosb

  inc REGMEMNAMECNTR

  pop di

  pop ax

  pop es

  ret

SAVEINREGMEM EndP

ENKRYPT Proc

  push ax

  mov ah,09

  push dx

  lea dx,SERIAL

  int 21h

  pop dx

  pop ax

  push si

  push di

  lea si,NAMENOVMEM

  lea di,NUMDISPLAY

  mov ax,ACTUAL_LETTERS

  mov ah,al

  add al,ah

  dec al

  mov DATACOUNT,al

  xor ah,ah

  cld

  lodsb

  mov bp,ax

  shl ax,4 ;It's a #

  shr al,4

  cmp al,0Ah

  jb SAFE

  call ITS_A_LETTER

  jmp ALMSAFE

SAFE:  

  add al,30h

ALMSAFE:

  xchg ah,al

  cmp al,0Ah

  jb SAFEENOUGH

  call ITS_A_LETTER

  jmp ALMSAFEENOUGH

SAFEENOUGH:

  add al,30h

ALMSAFEENOUGH:

  lea di,NUMDISPLAY

  add di,word ptr[DATACOUNT]

  mov [di],al

  dec DATACOUNT

  xchg ah,al

  lea di,NUMDISPLAY

  add di,word ptr[DATACOUNT]

  mov [di],al

  dec DATACOUNT

  mov cx,ACTUAL_LETTERS

 NEXT_SECT:

  mov bx,001bh

  sub bx,bp

  xor bh,bh

 @L00P:

  cld

  xor ah,ah

  lodsb

  sub al,bl



  shl ax,4 ;It's a #

  shr al,4

  cmp al,0Ah

  jb XSAFE

  call ITS_A_LETTER

  jmp XALMSAFE

XSAFE:  

  add al,30h

XALMSAFE:

  xchg ah,al

  cmp al,0Ah

  jb XSAFEENOUGH

  call ITS_A_LETTER

  jmp XALMSAFEENOUGH

XSAFEENOUGH:

  add al,30h

XALMSAFEENOUGH:

  lea di,NUMDISPLAY

  add di,word ptr[DATACOUNT]

  mov [di],al

  dec DATACOUNT

  xchg ah,al

  lea di,NUMDISPLAY

  add di,word ptr[DATACOUNT]

  mov [di],al

  dec DATACOUNT



  loop @L00P



RETURN:

  pop si

  pop di

  ret           ;value NUMDISPLAY

ENKRYPT EndP

ALSO Proc

  push ax

  push esi

  push es

  push di

  mov di,LINE1-10

  mov es,di

  mov di,0

  mov esi,offset ALSO_MSG

  cld

ALSO_1_1:

  lodsb

  mov ah,ERROR_MSG_COLOR

  stosw

  cmp al,0

  jne ALSO_1_1

  pop di

  pop es

  pop esi

  pop ax

  ret

ALSO EndP

ITS_A_LETTER Proc

  cmp al,0Ah

  jz @A

  cmp al,0Bh

  jz @B

  cmp al,0Ch

  jz @C

  cmp al,0Dh

  jz @D

  cmp al,0Eh

  jz @E

@F:  

  mov al,46h

  ret

@A:  

  mov al,41h

  ret

@B:  

  mov al,42h

  ret

@C:  

  mov al,43h

  ret

@D:  

  mov al,44h

  ret

@E:  

  mov al,45h

  ret

ITS_A_LETTER EndP

FadeOUT PROC    Near

        call    WaitVGA

; kill the screen

;

        mov     cx,2Ah

RepeatKilling:

        mov     dx,3C8h

        mov     al,07h

        out     dx,al

        inc     dx

        mov     ax,cx

        dec     ax

        out     dx,al

        jmp     short $ + 2

        out     dx,al

        jmp     short $ + 2

        out     dx,al

;

        call    WaitVGA

        loop   RepeatKilling

FadeOut ENDP

WaitVGA PROC    Near

        pushf

        push    ax

        push    dx

        mov     dx,3DAh

Test1AgainVGA:

        in      al,dx

        test    al,8

        jnz     Test1AgainVGA

Test2AgainVGA:

        in      al,dx

        test    al,8

        jz      Test2AgainVGA

;

        pop     dx

        pop     ax

        popf

        ret

WaitVGA ENDP



_TEXT ENDS

END INTRO