#include <jaz.h>
extern unsigned int _psp;
jztrmres()
{
  TREG wreg;
  unsigned int wpara,wlast,sbrk();

  wlast = sbrk(0);		/* get 1st free byte of memory */

  wreg.h.ah = 0x31;		/* terminate but stay resident */

  /* convert to paragraphs */
  wpara = (unsigned int) (((unsigned int) getcs() + 0xf) >> 4) + wlast;

  wreg.x.dx = wpara - _psp;	/* get address just beyond program */

  msdos(&wreg);
}
