public void hputbuf(int val)
   {   	  
	   int ofs = offset;
	   buf[ofs++] = val & 0x80;
	   buf[ofs++] = val & 0x40;
	   buf[ofs++] = val & 0x20;
	   buf[ofs++] = val & 0x10;
	   buf[ofs++] = val & 0x08;
	   buf[ofs++] = val & 0x04;
	   buf[ofs++] = val & 0x02;
	   buf[ofs++] = val & 0x01;
	   
	   if (ofs==BUFSIZE)
			offset = 0;
	   else
			offset = ofs;
	   
   }