 TBAV: keys
 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>
                                                                      Plof

 TBAV itself is bullshit, but who wouldn't like to read his/her name on it
 as if we'd paid  for it? :) Moreover, having it registered, we can access
 the exceptional virus information it offers to us }:)

 This generator works with TBAV 7.04, and I'm sure it also works with pre-
 vious (and future) versions, since Frans Veldman  hasn't changed  the en-
 cryption schemes since TBAV 6.52 :) You can  find the compiled executable
 file in \FILES.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->8
 cseg    segment para public 'codigo'
         assume  cs:cseg,ds:cseg,es:cseg,ss:cseg
         org     100h

 begin:

 init    proc    near

 ; Prompt for the name to be registered to
         mov     dx,offset pregunta
         mov     ah,09h
         int     21h

 ; Name must be written by means of DOS
         mov     ax,0A00h
         mov     dx,offset registrador
         int     21h
         xor     ch,ch
         mov     bx,dx
         mov     cl,[bx+1]
         cmp     cl,02h
         ja      principio

         mov     dx,offset nombrecorto
         mov     al,01h                 ; Errorlevel=1 if short name
         jmp     finalconmensaje

 principio:

 ; Pop the name into what will be TBAV.KEY
 ; In CL we maintain no. of characters

         mov     si,offset registrador+2
         mov     di,offset nombre

 moviendonombre:

         lodsb
         stosb
         loop moviendonombre

 ; Modify byte 11bh

         xor     ax,ax
         mov     si,offset nombre
         call    sumarnombre
         push    ax                          ; Check first name
         mov     bh,06fh
         add     bh,ah
         mov     si,offset nombre
         xor     bh,[si]
         mov     si,offset fichero+011bh
         mov     byte ptr [si],bh

 ; Modify byte 11ch

         pop     ax
         push    ax
         mov     bh,0f5h
         add     bh,ah
         ror     bh,01h
         mov     si,offset fichero+011ch
         mov     byte ptr [si],bh

 ; Modify byte 118h

         pop     ax
         push    ax
         mov     bh,02bh
         add     bh,ah
         mov     si,offset fichero+0118h
         mov     byte ptr [si],bh

 ; Modify byte 119h

         pop     ax                     ; Pop name check
         push    ax
         mov     bh,0bah
         add     bh,ah
         mov     si,offset fichero+0119h
         mov     byte ptr [si],bh

 ; Modify byte 11ah

         pop     ax
         push    ax                      ; In case something's after it
         mov     bh,0f4h
         add     bh,ah
         xor     bh,03dh
         mov     si,offset fichero+011ah
         mov     byte ptr [si],bh

 ; Zero the registers

         pop     ax                  ; Pop AX so there are no problems
         xor     ax,ax
         mov     bx,ax
         mov     dx,ax

 sumachequeo:

         mov     cx,01feh
         mov     si,offset fichero

 chequeo:

         lodsb
         xor     ax,0413fh
         add     bx,ax
         loop    chequeo
         mov     word ptr [si],bx

 encriptado:

         mov     si,offset codigo
         mov     di,si
         mov     cx,0080h

 encrp:
         lodsw
         xchg    ah,al
         xor     ax,cx
         add     ax,081f3h
         stosw
         loop    encrp

 ; Write the file

         ; Create and open the file

         mov     dx,offset nombredefichero
         mov     ah,3ch
         int     21h
         jnz     fichero_bien_iniciado

 ; If couldn't be created

         mov     al,02h          ;  Errorlevel=2 if file couldn't be created
                                 ;  tbav.key file
         mov     dx,offset nocreado
         jmp     finalconmensaje

 fichero_bien_iniciado:

         push    ax              ; Handle

 ; write 512d bytes

         mov     ah,40h
         pop     bx
         mov     dx,offset fichero
         mov     cx,200h
         int     21h

 ; Close file (BX still has the handle)

         mov     ah,3eh
         int     21h

 fin:

         mov     al,00h                ; Right, errorlevel=0
         mov     dx,offset finalnormal

 finalconmensaje:

         mov     ah,09h
         int     21h
         mov     ah,4ch
         int     21h             ; AL must have the errorlevel

 ; Subroutines

 sumarnombre:

         lodsb
         test    al,al
         jz      acabosenombre
         xor     al,0a5h
         ror     ah,1
         add     ah,al
         call    sumarnombre

 acabosenombre:
         ret

 ; Non executable portion

 fichero db  'Created by TBAVReg by Plof (/\/\adrid, 2-feb-96)'
         db  'Move your fucking ass, Franzzz',0dh,0ah
         db  'This key works on TBAV '
         db  'v7.04 and doesn''t expire until 2099. Look after me! ;-)',0dh,0ah
 nombre  db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
         db  000h, 000h, 000h, 000h, 000h, 000h  ;THE REGISTRATION  0a0
         db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
         db  000h, 000h, 000h, 000h, 000h, 000h  ;NAME IS PLACED    0b0
         db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
         db  000h, 000h, 000h, 000h, 000h, 000h  ;HERE (THERE'S     0c0
         db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
         db  000h, 000h, 000h, 000h, 000h, 000h  ;ROOM UNTIL LINE   0d0
         db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
         db  000h, 000h, 000h, 000h, 000h, 000h  ;0E0... HERE! :-)  0e0
         db  000h, 01ah, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
         db  000h, 000h, 000h, 000h, 000h, 000h  ;................  0f0
 codigo  db  0a0h, 000h, 041h, 001h, 0afh, 092h, 04ch, 001h, 08ch, 001h
         db  0cch, 001h, 0b6h, 018h, 083h, 083h  ;..A...L.........  100
         db  006h, 001h, 0c9h, 007h, 034h, 020h, 0ffh, 0ffh, 01eh, 0adh
         db  0dah, 036h, 074h, 0abh, 0d4h, 0d3h  ;....4......6t...  110
         db  0b7h, 0c0h, 0bbh, 054h, 058h, 072h, 02ah, 065h, 0e1h, 052h
         db  025h, 0c9h, 08bh, 054h, 02bh, 02ch  ;...TXr*e.R%..T+,  120
         db  048h, 03fh, 044h, 0abh, 0a7h, 08dh, 0d5h, 09ah, 0ffh, 0ffh
         db  000h, 000h, 02fh, 00ah, 001h, 003h  ;H?D........./...  130
         db  020h, 048h, 048h, 0cbh, 0f1h, 03ch, 091h, 043h, 056h, 046h
         db  02eh, 085h, 0a5h, 0a5h, 0a5h, 0a5h  ;.HH..<.CVF......  140
         db  0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h
         db  0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h  ;................  150
         db  0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h
         db  0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h  ;................  160
         db  0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h
         db  0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h  ;................  170
         db  0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h, 0a5h
         db  0a5h, 0a5h, 053h, 065h, 063h, 075h  ;............Secu  180
         db  072h, 069h, 074h, 079h, 020h, 076h, 069h, 06fh, 06ch, 061h
         db  074h, 069h, 06fh, 06eh, 03ah, 020h  ;rity.violation:.  190
         db  053h, 069h, 06eh, 067h, 06ch, 065h, 020h, 075h, 073h, 065h
         db  072h, 020h, 06bh, 065h, 079h, 020h  ;Single.user.key.  1a0
         db  06eh, 06fh, 074h, 020h, 076h, 061h, 06ch, 069h, 064h, 020h
         db  06fh, 06eh, 020h, 074h, 068h, 069h  ;not.valid.on.thi  1b0
         db  073h, 020h, 06dh, 061h, 063h, 068h, 069h, 06eh, 065h, 021h
         db  007h, 000h, 045h, 076h, 061h, 06ch  ;s.machine!..Eval  1c0
         db  075h, 061h, 074h, 069h, 06fh, 06eh, 007h, 020h, 06bh, 065h
         db  079h, 007h, 020h, 064h, 061h, 074h  ;uation..key..dat  1d0
         db  065h, 007h, 020h, 06ch, 069h, 06dh, 069h, 074h, 007h, 020h
         db  065h, 078h, 070h, 069h, 072h, 065h  ;e..limit..expire  1e0
         db  064h, 021h, 007h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
         db  000h, 000h, 000h, 000h              ;d!............    1f0
 suma    dw  ?

 nombredefichero db 'tbav.key',00h

 registrador     db 4eh
                 db 50h dup (?)
 nombrecorto     db 13,10,10,'Name is too short'
                 db 13,10,10,10,'$'

 nocreado        db 13,10,10,'File couldn''t be created',13,10,10,10,'$'

 finalnormal     db 13,10,10,'Now copy TBAV.KEY into your TBAV '
                 db 'directory and enjoy ;)',13,10,10,'$'

 pregunta        db 13,10,'TBAVReg 0.9á Register key generator '
                 db 'for the DOS version of TBAV',13,10,10
                 db 'Written by Plof (9-feb-96, /\/\adrid)',13,10,10
                 db 'Write the name you''d like to register TBAV to: '
                 db 13,10,'>$'

 init    endp
 cseg    ends
         end     begin
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->8


 Greetz,
 Plof
