.model	small,c
.stack	256

adat	segment	use16

puffer		equ	4096

file		dw	0
finev		db	"a.b",0
ujnev		db	"b.b",0
hitx		db	"Hiba!",13,10,36

p1		db	puffer+1 dup(0)

adat	ends

program	segment	use16
assume	cs:program,ds:adat

include	parancs.asm
include	pack.asm

start:		mov	ax,3d00h
		mov	bx,adat
		lea	dx,finev
		mov	ds,bx
		int	21h
		sjc	hiba
		mov	file,ax
		mov	si,adat
		lea	dx,p1
		mov	cx,puffer+1
		mov	bx,file
		mov	ah,3fh
		mov	ds,si
		push	dx
		int	21h
		pop	si
		sjc	hiba
		push	ax
		push	si
		mov	cx,adat
		mov	ah,3eh
		mov	ds,cx
		mov	bx,file
		int	21h

		lea	dx,ujnev
		xor	cx,cx
		mov	ax,3c00h
		int	21h
		pop	si
		pop	cx
		sjc	hiba
		mov	file,ax
		push	ax
		
		mov	bx,ad2
		lea	di,p2
		mov	es,bx
		ncall	unpack
		mov	dx,si
		pop	bx
		mov	ah,40h
		int	21h

		mov	cx,adat
		mov	ah,3eh
		mov	ds,cx
		mov	bx,file
		int	21h
		mov	ax,4c00h
		int	21h

hiba:		mov	bx,adat
		lea	dx,hitx
		mov	ah,9
		mov	ds,bx
		int	21h
		mov	ax,4c00h
		int	21h

program	ends

ad2	segment	use16

p2		db	puffer+puffer/128+4 dup(0)

ad2	ends

end	start
