.model tiny
.code
	org	100h
start:	jmp	Keep

int21:	pushf
	call	dword ptr cs:Old21

	push	ax
	push	bp

	pushf
	pop	ax	; flags -> ax

	mov	bp,sp
	mov	word ptr ss:[bp+8],ax	; replace flags in stack

	pop	bp
	pop	ax

	iret
Old21:

Keep:	mov	ax,3521h
	int	21h
	mov	word ptr [Old21],bx
	mov	word ptr [Old21+2],es

	mov	ax,2521h
	mov	dx,offset int21
	push	cs
	pop	ds
	int	21h

	mov	dx,offset Keep
	int	27h

end start