.model tiny
.code
	org	100h
.startup
	jmp	init

filename	db	'pic'
num:		db	'00'
		db	'.vga',0
entry_point:
	push	ds
	push	ax
	push	bx
	push	cx
	push	dx	

	mov	ah,3ch
	push	cs
	pop	ds
	mov	dx,offset filename
	mov	cx,20h
	int	21h

	mov	bx,ax
	mov	ax,0A000h
	mov	ds,ax
	mov	ah,40h
	xor	dx,dx
	mov	cx,64000
	int	21h

	mov	ah,3eh
	int	21h

	cmp	byte ptr cs:[num+1],'9'
	je	add2
	inc	byte ptr cs:[num+1]
	jmp	next
add2:	mov	byte ptr cs:[num+1],'0'
	inc	byte ptr cs:[num]
next:	
	pop	dx
	pop	cx
	pop	bx
	pop	ax
	pop	ds

	iret

init:	xor	ax,ax
	mov	es,ax
	mov	bx,5*4	; 5 vector (print screen)
	mov	word ptr es:[bx],offset entry_point
	mov	word ptr es:[bx+2],cs

	mov	dx,offset init
	int	27h
end