/* k 0222	18/09/91	*//* Separation */
/* k 0224       23/09/91        *//* ebss */
/* k 0232	11/10/91	*/
#include <ebss.h>               /* @0224 */
void pbetbut(p,xx1,yy1,xx2,yy2,buf)		/* @0182 *//* @0207 */
short p;	/* @0182 */
short xx1;	/* @0182 */
short yy1;	/* @0182 */
short xx2;	/* @0182 */
short yy2;	/* @0182 */
short buf;	/* @0182 *//* @0207 */
 {
  char *pt;
  short i,j;
  if (bfd==-1)		/* @0207 */
    return;		/* @0207 */
#if ((OVL_TYPE==1)&&(RESIDENT!=1))
  if ((Res_lseek(bfd,(long)buf,0))==-1)	/* @0207 */
#else
  if ((lseek(bfd,(long)buf,0))==-1)	/* @0207 */
#endif
    return;		/* @0207 */
  /* @0207 */
  pt=videobuf;            /* @0184 */
  /* @0207 */
  pt+=((yy1-1)*160+(xx1-1)*2);
  j=2*(xx2-xx1+1);		/* @0209 */
  for (i=0;i<yy2-yy1+1;i++)
   {
	if (p==0)     /* gettext */
#if ((OVL_TYPE==1)&&(RESIDENT!=1))
	  Res_write(bfd,pt,j);	/* @0207 *//* @0209 */
#else
	  write(bfd,pt,j);	/* @0207 *//* @0209 */
#endif
	else	      /* puttext */
	 {			/* @0209 */
#if ((OVL_TYPE==1)&&(RESIDENT!=1))
	  Res_read(bfd,pt,j);	/* @0207 *//* @0209 */
#else
	  read(bfd,pt,j);	/* @0207 *//* @0209 */
#endif
	 }			/* @0209 */
	pt+=160;			/* @0207 */
   }
 }
