START:		JMP BEGIN
INT_21_VECT	DD	0
vrem		dw	0
	str1	db 13,10,13,10,13,10,'Memory allocation error.',13,10,7
                db 'Cannot load COMMAND.COM ,system halted$'

ROUT    PROC    FAR
	pushf
	cmp	ax,4b00h
	JE	exit
	popf
	jmp	cs:[int_21_vect]



exit:   push    ax
	push	bx
	push	cx
	push	dx
	push	ds

        ;----------------
	mov	bx,dx
	mov	ax,ds:[bx+3]
;       cmp     ax,'AW'
;       jne     cont

	mov	cs:vrem,3000

cont:
	pop	ds
	pop	dx
	pop	cx
	pop	bx
	pop	ax
	popf
	jmp	cs:[int_21_vect]

ROUT    ENDP
prik	proc	far
	push	ds
	push	ax
	push	dx

        push    cs
	pop	ds
        cmp     vrem,0
	je	ert
	dec	vrem
	cmp	vrem,1
	jne	ert
                      ;<-------------------
        mov     ah,9
	mov	dx,offset str1
	int	21h

        mov     ah,2
	mov	bh,0
	mov	dh,25
	mov	dl,0
	int	10h

jmp     $
                      ;<-------------------
ert:	pop	dx
	pop	ax
	pop	ds
iret
FINISH  EQU $

prik    endp
BEGIN:  CLI

        mov     ax,3521h
        int     21h

	cmp	bx,offset rout
	jz	endes

        mov     word ptr INT_21_VECT,bx
        mov     word ptr INT_21_VECT+2,es

        mov     dx,OFFSET ROUT
        mov     ax,2521h
        int     21h

        mov     dx,OFFSET prik
        mov     ax,251ch
        int     21h

        mov     dx,offset MESSAGE
        mov     ah,09h
        int     21h

        STI

        lea     dx,FINISH
        int     27h
endes:	mov	ah,9
	mov	dx,offset str2
	int	21h
	int	20h
	str2	db '$'
        MESSAGE    DB '$'




