Example #1
0
/* Attempts to fetch the VESA information block.  Returns TRUE
 * iff successful, else FALSE (in which case it should be assumed
 * that no VESA driver is present).
 */
static boolean_t
get_vesa_info_block (vesa_info_t *vesa_info)
{
  __dpmi_regs regs;
  boolean_t success_p;

  /* Move "VBE2" into the "VESA" signature field, to request 2.0 driver. */
  movedata (dos_pm_ds, (unsigned) "VBE2", dos_buf_selector, 0, 4);

  /* Make the VESA query. */
  dpmi_zero_regs (&regs);
  regs.x.es = dos_buf_segment;
  regs.x.di = 0;

  if (!vesa_call (VESA_GET_VGA_INFO, &regs))
    success_p = FALSE;
  else
    {
      movedata (dos_buf_selector, 0, dos_pm_ds, (unsigned) vesa_info,
		sizeof *vesa_info);
      success_p = !strncmp (vesa_info->signature, "VESA", 4);
    }

  return success_p;
}
Example #2
0
void        PutImageX(int x,int y,ImagePtr  pbm,int   page)
{
    int         plane;
    int         width,height;
    int         i;
    ImagePtr    scr_addr;
    ImagePtr    tmpPBM=pbm+4;
    ImagePtr    tmpSCR;

    memcpy(&width,pbm,2);
    memcpy(&height,pbm+2,2);

    tmpSCR=scr_addr=SetActPage(page)+y*SCR_WIDTH4+x/4;

    for(plane=0;plane<4;plane++)
    {
        tmpSCR=scr_addr;
        outport(SC_INDEX, (0x0100 << (plane & 3)) | MAP_MASK);
        // select one plane to write
        for(i=0;i<height;i++)
        {
            movedata(FP_SEG(tmpPBM),FP_OFF(tmpPBM),
                     FP_SEG(tmpSCR),FP_OFF(tmpSCR),width/4);
            tmpSCR+=SCR_WIDTH4;
            tmpPBM+=(width/4);
        }
    }
}
Example #3
0
void RAW()
{
FILE *fp;

// open file

fp=fopen("c:\\openinit.raw","rb");
if(!fp)
	return;

// Read in the palette

fread(pal,768,1,fp);

// Read in the screen line-by-line (TINY model doesn't allow far reads)

for(ctr=0;ctr<199;ctr++)
	{
	fread(buf,320,1,fp);
	movedata(_DS,FP_OFF(buf),0xa000,scr+=320,320);
	}

// close file

fclose(fp);
}
/* --------------------------------------------------------------------
   SCGetName: Gets the name into name of session.

   -------------------------------------------------------------------- */
int SCGetName( int session, char * name )
{
   union REGS regs;
   struct SREGS segregs;

   regs.h.ah = 0xDF;
   regs.x.di = 0x534C;
   regs.x.dx = 0x534C;

   regs.h.al = 0x04;
   regs.h.bl = session;


   intdosx( &regs, &regs, &segregs);
   {
      int rc;
      if (regs.h.al == 1) {
         if (regs.x.cx) {
            char far *aux = (char far *)name; /* Power C workaround */
            movedata(segregs.es,regs.x.bx,
                     FP_SEG(aux),FP_OFF(aux),
                     regs.x.cx);
            name[regs.x.cx] = '\0';
         } else {
            sprintf(name, "Work Area Number %d",session);
         }
         rc = 0;
      }
      else rc = regs.h.ah;
      return(rc);
   }
}
Example #5
0
//
// Restore screens
//
void RestoreScreen(void)
{
	layer--;
	if (layer < 0)
		Error("Restored one layer too many!");
	movedata(FP_SEG(&screens[layer]),FP_OFF(&screens[layer]),0xb800,0,4000);
}
Example #6
0
void pci_BIOS_read(void* dest, unsigned offset, unsigned len)
{
	if (!pci_BIOS_selector)
		log_std(("pci: BUG! BIOS selector out of order\n"));

	movedata(pci_BIOS_selector, offset, _my_ds(), (unsigned long)dest, len);
}
Example #7
0
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
{
    int j;

    PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));

    if (pdc_direct_video)
    {
#if SMALL || MEDIUM
# ifndef __PACIFIC__
        struct SREGS segregs;
# endif
        int ds;
#endif
        /* this should be enough for the maximum width of a screen */

        struct {unsigned char text, attr;} temp_line[256];

        /* replace the attribute part of the chtype with the actual
           color value for each chtype in the line */

        for (j = 0; j < len; j++)
        {
            chtype ch = srcp[j];

            temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT];
#ifdef CHTYPE_LONG
            if (ch & A_ALTCHARSET && !(ch & 0xff80))
                ch = acs_map[ch & 0x7f];
#endif
            temp_line[j].text = ch & 0xff;
        }

#ifdef __DJGPP__
        dosmemput(temp_line, len * 2,
                  (unsigned long)_FAR_POINTER(pdc_video_seg,
                  pdc_video_ofs + (lineno * curscr->_maxx + x) * 2));
#else
# if SMALL || MEDIUM
#  ifdef __PACIFIC__
        ds = FP_SEG((void far *) temp_line);
#  else
        segread(&segregs);
        ds = segregs.ds;
#  endif
        movedata(ds, (int)temp_line, pdc_video_seg,
                 pdc_video_ofs + (lineno * curscr->_maxx + x) * 2, len * 2);
# else
        memcpy((void *)_FAR_POINTER(pdc_video_seg,
               pdc_video_ofs + (lineno * curscr->_maxx + x) * 2),
               temp_line, len * 2);
# endif
#endif

    }
    else
        for (j = 0; j < len;)
Example #8
0
static int
BufferWrite (char *buffer, unsigned size)
{
  movedata (FP_SEG (buffer), FP_OFF (buffer),
	    LastSegment, LastOffset, size);
  LastSegment = LastSegment + (size / 16);

  return TRUE;
}
Example #9
0
void screen_block(int s_s, int s_o, int s_g, int d_s, int d_o, int d_g, int w, int h)
{
   int y;
   for (y=0; y<h; y++) {
      movedata(s_s, s_o, d_s, d_o, w);
      s_o += s_g;
      d_o += d_g;
   }
}
Example #10
0
void SaveScreen(void)
{
	movedata(0xb800,0,FP_SEG(&screens[layer]),FP_OFF(&screens[layer]),4000);
	layer++;
	if (layer > MAXLAYERS)
	{
		sprintf(errorstring,"More than %d layers!",layer);
		Error(errorstring);
	}
}
Example #11
0
void main()
  {
    char buffer[14] = {
        '*', 0x17, 'H', 0x17, 'e', 0x17, 'l', 0x17,
        'l', 0x17, 'o', 0x17, '*', 0x17 };

    movedata( FP_SEG( buffer ),
              FP_OFF( buffer ),
              0xB800,
              0x0720,
              14 );
  }
Example #12
0
void	CheckMemory(void)
{
	id0_unsigned_t	finscreen;

	if (Flags & FL_NOMEMCHECK)
		return;

	if (mminfo.nearheap+mminfo.farheap+mminfo.EMSmem+mminfo.XMSmem
		>= MINMEMORY)
		return;

	CA_CacheGrChunk (OUTOFMEM);
	finscreen = (id0_unsigned_t)grsegs[OUTOFMEM];
	ShutdownId ();
	movedata (finscreen,7,0xb800,0,4000);
	gotoxy (1,24);
	exit(1);
}
Example #13
0
void delline(void)
{
  int row, col, left, right, nbytes, bot, fill;
  ScreenGetCursor(&row, &col);
  left = txinfo.winleft - 1;
  right = txinfo.winright - 1;
  nbytes = (right-left+1)*2;
  bot = txinfo.winbottom-1;
  fill = ' ' | (ScreenAttrib << 8);
  while(row < bot)
    {
      movedata(_go32_conventional_mem_selector(), VIDADDR(row+1, left),
               _go32_conventional_mem_selector(), VIDADDR(row, left),
               nbytes);
      row++;
    }
  fillrow(bot,left,right,fill);
}
Example #14
0
/* Saves the vga state into vga_state, allocating space as necessary. */
static void
save_vga_state (void)
{
  __dpmi_regs regs;

  /* Fetch the current mode number. */
  dpmi_zero_regs (&regs);
  regs.h.ah = 0xF;
  if (__dpmi_int (0x10, &regs) != -1)
    orig_vga_mode = regs.h.al & 0x7F;
  else
    orig_vga_mode = -1;

#if defined (SAVE_VGA_STATE)
  if (state_glue_funcp (COMPUTE_BUFFER_SIZE, &vga_state_size)
      && vga_state_size <= DOS_BUF_SIZE - DOS_MIN_STACK_SPACE
      && state_glue_funcp (SAVE_STATE, NULL))
    {
      if (vga_state != NULL)
	free (vga_state);
      vga_state = malloc (vga_state_size);
      if (vga_state != NULL)
	{
	  /* Save the state away in our memory space. */
	  movedata (dos_buf_selector, 0, dos_pm_ds, (unsigned) vga_state,
		    vga_state_size);
	}
    }

  /* Restore the VGA state because many BIOSes corrupt it when they
   * save it (from the INTER document).  This shouldn't be necessary
   * for VESA drivers, but it's conceivable some stupid VESA driver
   * calls one of the buggy BIOS routines which is known to need this.
   */
  {
    int save_orig_mode;

    save_orig_mode = orig_vga_mode;
    orig_vga_mode = -1;	/* Don't reset mode! */
    restore_vga_state ();
    orig_vga_mode = save_orig_mode;
  }
#endif
}
Example #15
0
static int
EMSWrite (char *buffer, unsigned size)
{
  int start, i;
  unsigned blocks;

  start = (int) (AmofProcessed / 16384);
  blocks = size / 16384;

  for (i = 0; i < blocks; i++)
    {
      if (EMSmap (0, Handle, start + i) == -1)
	return FALSE;
      movedata (FP_SEG (buffer), FP_OFF (buffer) + (i * 16384),
		EMSBase, 0, 16384);
    }

  return TRUE;
}
Example #16
0
/* Restores the VGA state specified in vga_state. */
static void
restore_vga_state (void)
{
  __dpmi_regs regs;

  /* Set the mode. */
  if (orig_vga_mode != -1)
    {
      int current_vga_mode;

      /* Fetch the current mode number. */
      dpmi_zero_regs (&regs);
      regs.h.ah = 0xF;
      if (__dpmi_int (0x10, &regs) != -1)
	current_vga_mode = regs.h.al & 0x7F;
      else
	current_vga_mode = -1;

      /* Only reset the mode if it has changed, so we don't clear the
       * screen on exception.
       */
      if (current_vga_mode != orig_vga_mode)
	{
	  dpmi_zero_regs (&regs);
	  regs.x.ax = orig_vga_mode & 0x7F;   /* AH == 0x00 */
	  __dpmi_int (0x10, &regs);
	}
    }

#if defined (SAVE_VGA_STATE)
  /* Restore the actual state. */
  if (vga_state != NULL
      && vga_state_size <= DOS_BUF_SIZE - DOS_MIN_STACK_SPACE)
    {
      /* Restore the random VGA state. */
      movedata (dos_pm_ds, (unsigned) vga_state, dos_buf_selector, 0,
		vga_state_size);
      state_glue_funcp (RESTORE_STATE, NULL);
    }
#endif
}
Example #17
0
File: rand01.c Project: terryzeng/C
void random_start(void)
{
    int temp[2];
    movedata(0x0040, 0x006c, FP_SEG(temp), FP_OFF(temp), 4);
    RAND_SEED = temp[0];
}
Example #18
0
void FAR * _fmemcpy(void FAR *dest, void FAR *src, size_t count)
{
      movedata(FP_SEG(src), FP_OFF(src), FP_SEG(dest), FP_OFF(dest), count);
      return dest;
}
Example #19
0
static void set_program_name( char *filename )
/* change name of current program (in environment) */
{
    union {
        char FarPtr cip;
        int FarPtr  ip;
        struct {
            unsigned off;
            unsigned sel;
        } w;
    } ep;
    D16REGS     r;
    char        *p;
    char        temp[70];
    unsigned    maxp;
    int         i;
    int         blocksize;
    MCB FarPtr  blockp;
    unsigned    newenv;
    int         oldstrat;
    descriptor  g;
    ULONG       oldenv;
    SELECTOR    oldenv_sel;

    p = temp;
    abspath( filename, p );

    /* Program name not kept before DOS 3.x
    */
    if( _osmajor < 3 )
        return;

    /* Get a pointer to the MCB (arena header) which is always one
        paragraph below the environment block, even in an OS/2 DOS box.
    */
retry:
    oldenv = rsi_abs_address( makeptr( env_sel, 0 ) );
    blockp = MK_FP( rsi_sel_new_absolute( oldenv - 0x10, 0 ), 0 );
    blocksize = blockp->size;
    rsi_sel_free( FP_SEG( blockp ) );

    /* See if we have room to stuff the new name into the existing MCB;
        if not, we will have to allocate a new, larger environment block.
        maxp is the amount of room we have for a path name after subtracting
        the current contents of the environment, a two-byte field between
        the environment and the path name, and two pairs of null bytes.
    */
    maxp =( blocksize << 4 ) - 6;
    ep.ip = makeptr( env_sel, 0 );
    while( *ep.ip != 0 ) {
        ++ep.w.off;
        --maxp;
    }

    if( (i = maxp - strlen( p )) < 0 ) {
#ifdef  DSSI
        /* Can't allocate low memory
        */
        return;
#else
        /* The file name won't fit in the MCB, so we try to make a new
            one.  The number of additional bytes needed is in i, and we
            round up to a full paragraph.  Allocate using DOS so that we
            can free using DOS; otherwise we can lose low memory.
        */
        oldstrat = rsi_mem_strategy( MForceLow );
        r.ax = 0x4800;
        r.bx = blocksize + ( ( -i + 15 ) >> 4 );
        i = r.bx << 4;  /* i == size in bytes of new block */
        oldenv_sel = NULL_SEL;
        if( rsi_rm_interrupt( 0x21, &r, &r ) == 0 ) {
            newenv = r.ax;
            oldenv_sel = rsi_sel_new_absolute( (long)newenv << 4, i );
        }
        rsi_mem_strategy( oldstrat );
        if( oldenv_sel == NULL_SEL )
            return;     /* Give up */

        /* Copy the data from the old environment block into the new
            memory, and prepare to update the old environment descriptor
            with the new size and address.
        */
        movedata( env_sel, 0, oldenv_sel, 0, blocksize << 4 );
        rsi_get_descriptor( oldenv_sel, &g );
        rsi_sel_free( oldenv_sel );

        /* Update the descriptor.  This call fails in an OS/2 2.0 DOS box.
            Discard whichever one of the environment blocks will not be
            referred to in the descriptor.
        */
        if( rsi_set_descriptor( env_sel, &g ) ) {
            r.es = oldenv >> 4;
        } else {
Example #20
0
File: soft.c Project: 0x90sled/keen
////////////////////////////////////////////////////////////////////////////
//
// LoadLIBShape()
//
int LoadLIBShape(char *SLIB_Filename, char *Filename,struct Shape *SHP)
{
	#define CHUNK(Name)	(*ptr == *Name) &&			\
								(*(ptr+1) == *(Name+1)) &&	\
								(*(ptr+2) == *(Name+2)) &&	\
								(*(ptr+3) == *(Name+3))


	int RT_CODE;
	FILE *fp;
	char CHUNK[5];
	char far *ptr;
	memptr IFFfile = NULL;
	unsigned long FileLen, size, ChunkLen;
	int loop;


	RT_CODE = 1;

	// Decompress to ram and return ptr to data and return len of data in
	//	passed variable...

	if (!LoadLIBFile(SLIB_Filename,Filename,&IFFfile))
		Quit("Error Loading Compressed lib shape!");

	// Evaluate the file
	//
	ptr = MK_FP(IFFfile,0);
	if (!CHUNK("FORM"))
		goto EXIT_FUNC;
	ptr += 4;

	FileLen = *(long far *)ptr;
	SwapLong((long far *)&FileLen);
	ptr += 4;

	if (!CHUNK("ILBM"))
		goto EXIT_FUNC;
	ptr += 4;

	FileLen += 4;
	while (FileLen)
	{
		ChunkLen = *(long far *)(ptr+4);
		SwapLong((long far *)&ChunkLen);
		ChunkLen = (ChunkLen+1) & 0xFFFFFFFE;

		if (CHUNK("BMHD"))
		{
			ptr += 8;
			SHP->bmHdr.w = ((struct BitMapHeader far *)ptr)->w;
			SHP->bmHdr.h = ((struct BitMapHeader far *)ptr)->h;
			SHP->bmHdr.x = ((struct BitMapHeader far *)ptr)->x;
			SHP->bmHdr.y = ((struct BitMapHeader far *)ptr)->y;
			SHP->bmHdr.d = ((struct BitMapHeader far *)ptr)->d;
			SHP->bmHdr.trans = ((struct BitMapHeader far *)ptr)->trans;
			SHP->bmHdr.comp = ((struct BitMapHeader far *)ptr)->comp;
			SHP->bmHdr.pad = ((struct BitMapHeader far *)ptr)->pad;
			SwapWord(&SHP->bmHdr.w);
			SwapWord(&SHP->bmHdr.h);
			SwapWord(&SHP->bmHdr.x);
			SwapWord(&SHP->bmHdr.y);
			ptr += ChunkLen;
		}
		else
		if (CHUNK("BODY"))
		{
			ptr += 4;
			size = *((long far *)ptr);
			ptr += 4;
			SwapLong((long far *)&size);
			SHP->BPR = (SHP->bmHdr.w+7) >> 3;
			MM_GetPtr(&SHP->Data,size);
			if (!SHP->Data)
				goto EXIT_FUNC;
			movedata(FP_SEG(ptr),FP_OFF(ptr),FP_SEG(SHP->Data),0,size);
			ptr += ChunkLen;

			break;
		}
		else
Example #21
0
void
fmemcpyfrom(void *to, const void *from, int length)
{
   movedata(flat_selector, (unsigned)from, _my_ds(), (unsigned)to, length);
}
Example #22
0
/* Sets up the VBE protected mode interface pointers.  See VBE function
 * 0x0A for more information.  Returns TRUE iff successful.
 */
static boolean_t
set_up_vbe2_protected_mode_interface (void)
{
  boolean_t success_p;

  success_p = FALSE;  /* default */
  set_window_call_codep = NULL;
  set_display_start_codep = NULL;
  set_palette_data_code_p = NULL;

  if (vesa_version >= 0x200)  /* new with VBE 2.0 */
    {
      __dpmi_regs regs;
      dpmi_zero_regs (&regs);
      regs.x.bl = 0;	/* get protected mode table. */
      if (vesa_call (VESA_GET_PMI, &regs))
	{
	  int pmi_size;

	  pmi_size = regs.x.cx;
	  if (vesa_pmi != NULL)
	    free (vesa_pmi);
	  vesa_pmi = malloc (pmi_size);
	  if (vesa_pmi != NULL)
	    {
	      movedata (dos_buf_selector, (regs.x.es << 4) + regs.x.di,
			dos_pm_ds, (unsigned) vesa_pmi,
			pmi_size);
	      set_window_codep = ((char *) vesa_pmi
				       + vesa_pmi->set_window_offset);
	      set_display_start_codep = ((char *) vesa_pmi
					 + vesa_pmi->set_display_start_offset);
	      set_palette_data_code_p = ((char *) vesa_pmi
					 + vesa_pmi->set_palette_data_offset);
	      success_p = TRUE;

	      if (vesa_pmi->io_priv_offset && mmap_io_sel == 0)
		{
		  const uint16 *p;

		  for (p = (const uint16 *) ((char *)vesa_pmi
					     + vesa_pmi->io_priv_offset);
		       *p != 0xFFFF;
		       p++)
		    ;
		  if (p[1] != 0xFFFF)
		    {
		      uint32 addr = *(const uint32 *)(p + 1);
		      uint16 length = p[3];
		      int sel;

		      if (addr < 1024 * 1024 && length <= 65536)
			
		      sel = selector_for_phys_mem (addr, length);
		      if (sel == -1)
			{
			  mmap_io_sel = 0;
			  set_window_codep = NULL;
			  success_p = FALSE;
			}
		      else
			{
			  mmap_io_sel = sel;
			}
		    }
		}
	    }
	}
    }

  return success_p;
}
Example #23
0
void InitGame (void)
{
	id0_int_t i;

	MM_Startup ();

#if 0
	// Handle piracy screen...
	//
	movedata(FP_SEG(PIRACY),(id0_unsigned_t)PIRACY,0xb800,displayofs,4000);
	while (BE_ST_BiosScanCode(0) != sc_Return);
	//while ((bioskey(0)>>8) != sc_Return);
#endif

#if GRMODE == EGAGR
	if (mminfo.mainmem < 335l*1024)
	{
//#pragma warn    -pro
//#pragma warn    -nod
#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
		BE_ST_textcolor(7);
#endif
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
		if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE113)
#endif
		{
			BE_ST_textbackground(0);
		}
//#pragma warn    +nod
//#pragma warn    +pro
		BE_ST_clrscr();                       // we can't include CONIO because of a name conflict
//#pragma warn    +nod
//#pragma warn    +pro
		BE_ST_puts ("There is not enough memory available to play the game reliably.  You can");
		BE_ST_puts ("play anyway, but an out of memory condition will eventually pop up.  The");
		BE_ST_puts ("correct solution is to unload some TSRs or rename your CONFIG.SYS and");
		BE_ST_puts ("AUTOEXEC.BAT to free up more memory.\n");
		BE_ST_puts ("Do you want to (Q)uit, or (C)ontinue?");
		//i = bioskey (0);
		//if ( (i>>8) != sc_C)
		i = BE_ST_BiosScanCode (0);
		if (i != sc_C)
			Quit ("");
	}
#endif

	US_TextScreen();

	VW_Startup ();
	RF_Startup ();
	IN_Startup ();
	SD_Startup ();
	US_Startup ();

#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
	US_UpdateTextScreen();
#endif

	CA_Startup ();
	US_Setup ();

//
// load in and lock down some basic chunks
//

	CA_ClearMarks ();

	CA_MarkGrChunk(STARTFONT);
	CA_MarkGrChunk(STARTFONTM);
	CA_MarkGrChunk(STARTTILE8);
	CA_MarkGrChunk(STARTTILE8M);
	for (i=KEEN_LUMP_START;i<=KEEN_LUMP_END;i++)
		CA_MarkGrChunk(i);

#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
	CA_CacheMarks (NULL);
#elif defined REFKEEN_VER_KDREAMS_ANYEGA_ALL
	CA_CacheMarks (NULL, 0);
#endif

	MM_SetLock (&grsegs[STARTFONT],true);
	MM_SetLock (&grsegs[STARTFONTM],true);
	MM_SetLock (&grsegs[STARTTILE8],true);
	MM_SetLock (&grsegs[STARTTILE8M],true);
	for (i=KEEN_LUMP_START;i<=KEEN_LUMP_END;i++)
		MM_SetLock (&grsegs[i],true);

	CA_LoadAllSounds ();

	fontcolor = WHITE;

	US_FinishTextScreen();

	VW_SetScreenMode (GRMODE);
	VW_ClearVideo (BLACK);
}
Example #24
0
void main(void) {
    
    int i,j,k,c,x,y;
    RGB rgb;

    srand((int)time(NULL));

    for (x=0;x<scrwid;x++) {
    for (y=0;y<scrhei;y++) {
        rx=(float)x/scrwid*2-1;
        ry=(float)(y-scrhei/2)/scrwid*2;

        px=(qx+1)/2*scrwid;
        py=scrhei/2+(qy)/2*scrwid;
        ix=(int)px;
        iy=(int)py;
        amount[x][y][0][0]=((float)ix+1-(float)px)*((float)(iy+1)-(float)py);
        amount[x][y][1][0]=((float)px-(float)ix)*((float)(iy+1)-(float)py);
        amount[x][y][0][1]=((float)ix+1-(float)px)*((float)py-(float)iy);
        amount[x][y][1][1]=((float)px-(float)ix)*((float)py-(float)iy);
        pix[x][y]=ix;
        piy[x][y]=iy;
    }
    }

    allegro_init ();
    install_keyboard ();
    install_timer ();
    set_gfx_mode (GFX_AUTODETECT, scrwid, scrhei, 0, 0);
    set_pallete (desktop_palette);
    _farsetsel(screen->seg);
    for (c=0;c<=255;c++) {
        if (c<128) {
            rgb.r=c*63/127;
            rgb.g=0;
            rgb.b=0;
        } else {
            rgb.r=127;
            rgb.g=(c-128)*63/127;
            rgb.b=rgb.g;
        }
        set_color(c,&rgb);
    }
    
    while(!key[KEY_ESC]) {
        for (y=0; y<scrhei; y++) {
            movedata(screen->seg, bmp_read_line(screen,y), _my_ds(), map[y], scrwid);
        }
        for (x=0; x<scrwid; x++) {
        for (y=0; y<scrhei; y++) {
            c=0;
            for (i=0;i<=1;i++) {
            for (j=0;j<=1;j++) {
                c=c+amount[x][y][i][j]*map[piy[x][y]+j][pix[x][y]+i];
            }
            }
            c--;
            map2[y][x]=c;
        }
        }
        for (y=0; y<scrhei; y++) {
            movedata(_my_ds(), map2[y], screen->seg, bmp_write_line(screen,y), scrwid);
        }
        for (i=1;i<=10;i++) {
            circlefill(screen,myrnd()*scrwid,myrnd()*scrhei,8,myrnd()*255);
        }
    }

}
Example #25
0
void main(void) {
    
    int xy,i,j,c,x,y,front,back,n,minc,maxc;
    int ix,iy,k,address,jx,jy,kx,ky;
    float dzdx,dzdy,a,b,dot,norm;
    float rx,ry,sx,sy,px,py;
    long p,q;
    RGB rgb;

    for (x=0;x<scrwid;x++) {
    for (y=0;y<scrhei;y++) {
        rx=(float)x/scrwid*2-1;
        ry=(float)y/scrhei*2-1;
        sx=rx*.8;
        sy=ry*.8;
        px=(sx+1)/2*scrwid;
        py=(sy+1)/2*scrhei;
        ix=(int)px;
        iy=(int)py;
        amount[x][y][0][0]=((float)ix+1-(float)px)*((float)(iy+1)-(float)py);
        amount[x][y][1][0]=((float)px-(float)ix)*((float)(iy+1)-(float)py);
        amount[x][y][0][1]=((float)ix+1-(float)px)*((float)py-(float)iy);
        amount[x][y][1][1]=((float)px-(float)ix)*((float)py-(float)iy);
        pix[x][y]=ix;
        piy[x][y]=iy;
//        printf("%f",amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]);
        if (mysquare(amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]-1)>0.00001) {
            printf("%d %d %f %f ",ix,iy,px,py);
            printf("%f+%f(%f*%f)+%f+%f=%f? \n",amount[x][y][0][0],amount[x][y][1][0],(float)px-(float)ix,(float)(iy+1)-(float)py,amount[x][y][0][1],amount[x][y][1][1],amount[x][y][0][0]+amount[x][y][1][0]+amount[x][y][0][1]+amount[x][y][1][1]);
        }
    }
    }

//    srand(456789);
        srand((int)time(NULL));
        //printf("%d\n",(int)time(NULL));


  allegro_init ();
  install_keyboard ();
  install_timer ();
  set_gfx_mode (GFX_AUTODETECT, scrwid, scrhei, 0, 0);
  set_pallete (desktop_palette);
  buffer = create_bitmap (scrwid, scrhei);
      clear (buffer);

//      textout_centre (buffer, font, "Press SPACE!", 60, 220, 4);


    // Set up grayscale colours
    for (c=0;c<=255;c++) {
        i=0;
        rgb.r=c*63/255;
        rgb.g=0;
        rgb.b=0;
        set_color(c,&rgb);
//        colors[c]=GrAllocColor(c,i,i);
    }
    
        for (x=0; x<scrwid; x++) {
        for (y=0; y<scrhei; y++) {
            putpixel(buffer,x,y,128);
        }
        }

      blit (buffer, screen, 0, 0, 0, 0, scrwid, scrhei);

   _farsetsel(screen->seg);

    while(!key[KEY_ESC]) {
        for (y=0; y<scrhei; y++) {
     movedata(screen->seg, bmp_read_line(screen,y), _my_ds(), tmp[y], scrwid);
     }
        for (x=0; x<scrwid; x++) {
        for (y=0; y<scrhei; y++) {
        c=0;
        kx=x-scrwid/2;
        ky=y-scrhei/2;
        jx=kx*cos(ang)+ky*sin(ang);
        jy=-kx*sin(ang)+ky*cos(ang);
        ix=scrwid/2+0.9*jx;
        iy=scrhei/2+0.9*jy;
        k=0;
        i=0;j=0;
//        for (i=-1;i<=1;i++) {
//        for (j=-1;j<=1;j++) {
//            c=c+getpixel(screen, ix+i, iy+j);
//     address = bmp_read_line(screen, iy)+ix;
            c=c+tmp[iy][ix];
            k++;
//        }
//        }
        c=c/k;
        c--;
//     address = bmp_write_line(buffer, y)+x;
//        _farnspokeb(address, c);
        tmp2[y][x]=c;
//        putpixel(buffer, x, y, c);
        }
        }
        for (y=0; y<scrhei; y++) {
     movedata(_my_ds(), tmp2[y], screen->seg, bmp_write_line(screen,y), scrwid);
     }
for (i=1;i<=10;i++)
        circlefill(screen,myrnd()*scrwid,myrnd()*scrhei,8,myrnd()*255);
//        putpixel(buffer,scrwid/2,scrhei/2,255);

//      blit (buffer, screen, 0, 0, 0, 0, scrwid, scrhei);
    }

destroy_bitmap(buffer);
exit(0);
    getch();

//    GrSetMode(GR_default_text);
    printf("max col %d\n",maxc);
    printf("min col %d\n",minc);
  
}
void GetScreen( char *buffer )
{
	movedata( VIDSEGREG, 0, FP_SEG(buffer), FP_OFF(buffer), 4000 );
}
Example #27
0
void
vgahost_set_colors (int first_color, int num_colors,
		    const ColorSpec *color_array)
{
  if (vesa_version >= 0x200)
    {
      __dpmi_regs regs;
      int k, shift;
      vbe2_rgb_t *r;

      /* Fill in our table assuming an 8 bpp DAC at first. */
      r = alloca (num_colors * sizeof r[0]);
      for (k = num_colors - 1; k >= 0; k--)
	{
	  r[k].filler = 0;
	  r[k].red   = (*(const uint8 *)&color_array[k].rgb.red);   /* MSB */
	  r[k].green = (*(const uint8 *)&color_array[k].rgb.green); /* MSB */
	  r[k].blue  = (*(const uint8 *)&color_array[k].rgb.blue);  /* MSB */
	}

      /* Next round to nearest value and shift bits for < 8 bpp DACs. */
      shift = 8 - bits_per_dac_element;
      if (shift > 0)
	{
	  int j, round_bit;

	  round_bit = 1 << (shift - 1);
	  for (j = num_colors - 1; j >= 0; j--)
	    {
	      r[j].red   = shift_and_round (r[j].red,   round_bit, shift);
	      r[j].green = shift_and_round (r[j].green, round_bit, shift);
	      r[j].blue  = shift_and_round (r[j].blue,  round_bit, shift);
	    }
	}

      /* Transfer the color array to conventional memory. */
      movedata (dos_pm_ds, (unsigned) r, dos_buf_selector, 0,
		num_colors * sizeof r[0]);

      /* Call the VESA function to set the palette. */
      dpmi_zero_regs (&regs);
      regs.h.bl = 0x00;
      regs.x.cx = num_colors;
      regs.x.dx = first_color;
      regs.x.es = dos_buf_segment;
      regs.x.di = 0;
      /* Only wait for a VBL if we're setting many colors.  If we're
       * setting one at a time, it would be bad to wait for a new VBL for
       * each!
       */
      if (num_colors > 30)  /* arbitrary */
	regs.h.bl |= set_palette_during_vbl_mask;
      if (!vesa_call (VESA_PALETTE_MANIP, &regs))
	warning_unexpected ("Failed to set palette!");
    }
  else
    {
      const ColorSpec *c;
      int i;

      for (c = color_array, i = 0; i < num_colors; c++, i++)
	{
	  unsigned r, g, b;

	  r = *(const uint8 *)&c->rgb.red;
	  if (r < 0xFC)
	    r += (r & 2);	/* Round to nearest. */
	  g = *(const uint8 *)&c->rgb.green;
	  if (g < 0xFC)
	    g += (g & 2);	/* Round to nearest. */
	  b = *(const uint8 *)&c->rgb.blue;
	  if (b < 0xFC)
	    b += (b & 2);	/* Round to nearest. */

	  SET_VGA_COLOR ((first_color + i), r, g, b);
	}
    }
}
Example #28
0
int main(void) {

    int f,i,j,k,c,x,y,ix,iy,displayloop;
    float thru,ctmp;
    RGB rgb;
    FILE *fp;

    srand((int)time(NULL));

    usingmap=0;
    makingmap=1;
    mmx=0;
    mmy=0;


    img=(uchar **)calloc(scrhei,sizeof(uchar *));
    img2=(uchar **)calloc(scrhei,sizeof(uchar *));
    for (y=0; y<scrhei; y++) {
        img[y]=(uchar *)calloc(scrwid,sizeof(uchar));
        img2[y]=(uchar *)calloc(scrwid,sizeof(uchar));
        for (x=0; x<scrwid; x++) {
            img[y][x]=255*y/scrhei;
            img2[y][x]=myrnd()*255;
            if (x<scrwid-1 && y<scrhei-1) {
                pix[x][y][usingmap]=x;
                piy[x][y][usingmap]=y;
                for (i=0; i<=1; i++)
                    for (j=0; j<=1; j++)
                        amount[x][y][i][j][usingmap]=(float)1/4;
            }
        }
    }

    /* Originals from QB
       op[0] = 1; damp[0] = .999; force[0] = .005;
       op[1] = 1.02; damp[1] = .999; force[1] = .002;
       op[2] = 0; damp[2] = .999; force[2] = .002;
       op[3] = 1; damp[3] = .999; force[3] = .005;
       op[4] = 1; damp[4] = .999; force[4] = .005;
       op[5] = 0; damp[5] = .999; force[5] = .002;
    */

    /* From QB later
       name$(1) = "Velocity"
       op(1) = 1: damp(1) = .999: force(1) = .002
       name$(2) = "Rotation"
       op(2) = 0: damp(2) = .999: force(2) = .002
       name$(3) = "Drip"
       op(3) = 1: damp(3) = .999: force(3) = .005
       name$(4) = "Dribble"
       op(4) = 1: damp(4) = .999: force(4) = .005
       name$(5) = "Slide"
       op(5) = 0: damp(5) = .999: force(5) = .002
       name$(6) = "Accelerate"
       op(6) = 1: damp(6) = .999: force(6) = .005
       name$(7) = "xDisplace"
       op(7) = 0: damp(7) = .999: force(7) = .005
       name$(8) = "yDisplace"
       op(8) = 0: damp(8) = .999: force(8) = .005
       REM 9 and 10 are options for splitting displacements (no var)
       name$(9) = "2d/3d split"
       name$(10) = "Split"
    */

    // 0 Accelerate
    op[0] = 1;
    damp[0] = .999;
    force[0] = .005;
    // 1 Velocity
    op[1] = 1.02;
    damp[1] = .999;
    force[1] = .01;
    // 2 Rotation
    op[2] = 0;
    damp[2] = .995;
    force[2] = .03;
    // 3 y splurge
    op[3] = 0;
    damp[3] = .999;
    force[3] = .01;
    // 4 Dribble
    op[4] = 1;
    damp[4] = 0;
    force[4] = .01;
    // 5 x splurge
    op[5] = 0;
    damp[5] = .999;
    force[5] = .01;
    op[6]=2;
    damp[6]=.9999;
    force[6]=.01;
    op[7]=1;
    damp[7]=.999;
    force[7]=.01;

    for (f=0; f<fs; f++) {
        var[f] = op[f];
        fon[f]=1;
    }

    allegrosetup(scrwid,scrhei);
    _farsetsel(screen->seg);

    starttimer();

    while(!key[KEY_ESC]) {

        moremap();


        // Animate
        for (x=0; x<scrwid; x++) {
            for (y=0; y<scrhei; y++) {
                c=0;
                for (i=0; i<=1; i++) {
                    for (j=0; j<=1; j++) {
                        c=c+amount[x][y][i][j][usingmap]*img[piy[x][y][usingmap]+j][pix[x][y][usingmap]+i];
                    }
                }
                c--;
                img2[y][x]=c;
            }
        }
        /* for (y=0;y<scrhei;y++) {
             for (x=0;x<scrwid;x++) {
               _farpokeb(screen->seg, (unsigned long)screen->line[y]+x, img2[y][x]);
             }
        }*/
        for (y=0; y<scrhei; y++) {
            movedata(_my_ds(), img2[y], screen->seg, bmp_write_line(screen,y), scrwid);
        }
        for (f=0; f<fs; f++) {
            if (fon[f]) {
                hline(screen, scrwid/2, f*2, scrwid/2+(var[f] - op[f]) * scrwid * 4, 0);
            }
        }
        toff=toff-(float)1/128;
        for (c=0; c<=255; c++) {
            thru=saw((float)c/255-toff);
            rgb.r=huefor(thru,(float)0);
            rgb.g=huefor(thru,(float)1/3);
            rgb.b=huefor(thru,(float)2/3);
            set_color(c,&rgb);
        }
        imgtmp=img;
        img=img2;
        img2=imgtmp;
        for (i=1; i<=5; i++) {
            mycircle(myrnd()*scrwid,myrnd()*scrhei,2+myrnd()*8,myrnd()*255);
        }
        framedone();
    }

    allegro_exit();
    displayframespersecond();

}
Example #29
0
vga_mode_t *
vgahost_compute_vga_mode_list (void)
{
  vesa_info_t vesa_info;
  static const vga_mode_t standard_vga_modes[NUM_STANDARD_VGA_MODES] =
    {
      { 640, 480, 80, 0x12, 2, TRUE, FALSE, FALSE, 0, 0, 65536, 65536, -1 }
    };
  static const vga_mode_t standard_vesa_modes[NUM_VESA_MODES] =
    {
      /* Many of these fields are intentionally left blank or have defaults. */
      { 640,  400,  0, 0x100, 3, FALSE, FALSE, TRUE, 0, 0, 65536, 65536, -1 },
      { 640,  480,  0, 0x101, 3, FALSE, FALSE, TRUE, 0, 0, 65536, 65536, -1 },
      { 800,  600,  0, 0x102, 2, TRUE, FALSE, FALSE, 0, 0, 65536, 65536, -1 },
      { 800,  600,  0, 0x103, 3, FALSE, FALSE, TRUE, 0, 0, 65536, 65536, -1 },
      { 1024, 768,  0, 0x104, 2, TRUE,  FALSE, TRUE, 0, 0, 65536, 65536, -1 },
      { 1024, 768,  0, 0x105, 3, FALSE, FALSE, TRUE, 0, 0, 65536, 65536, -1 },
      { 1280, 1024, 0, 0x106, 2, TRUE,  FALSE, TRUE, 0, 0, 65536, 65536, -1 },
      { 1280, 1024, 0, 0x107, 3, FALSE, FALSE, TRUE, 0, 0, 65536, 65536, -1 },
    };
  int num_modes, i;
  __dpmi_regs regs;

  /* Default to an empty list. */
  mode_list[0].width = 0;

  /* Add in the normal VGA modes we know about. */
  memcpy (mode_list, standard_vga_modes, sizeof standard_vga_modes);
  num_modes = (sizeof standard_vga_modes) / (sizeof standard_vga_modes[0]);
  for (i = 0; i < num_modes; i++)
    mode_list[i].screen_selector = vga_window_selector;

  if (get_vesa_info_block (&vesa_info))
    {
      unsigned long list, num_mode_numbers, n;
      unsigned short mode_num, *vesa_mode_numbers;

      /* Figure out what type of DAC we have. */
      switchable_dac_p = (vesa_version >= 0x200
			  && (vesa_info.capabilities[0] & SWITCHABLE_DAC));
      set_palette_during_vbl_mask = ((vesa_info.capabilities[0]
				      & SET_PALETTE_DURING_VBL) ? 0x80 : 0);

      /* Count the number of modes in their list. */
      list = (vesa_info.mode_list_segment * 16
	      + vesa_info.mode_list_offset);
      for (num_mode_numbers = 0, mode_num = 0;
	   mode_num != 0xFFFF;
	   num_mode_numbers++)
	{
	  dosmemget (list + num_mode_numbers * sizeof (short),
		     sizeof mode_num, &mode_num);
	}
      num_mode_numbers--;  /* Don't count the 0xFFFF */
      
      /* Allocate an array to hold the modes. */
      vesa_mode_numbers = ((unsigned short *)
			   alloca (num_mode_numbers
				   * sizeof vesa_mode_numbers[0]));
      dosmemget (list, num_mode_numbers * sizeof vesa_mode_numbers[0],
		 vesa_mode_numbers);
      
      for (n = 0; n < num_mode_numbers && num_modes < MAX_VGA_MODES; n++)
	{
	  unsigned short mode_num;
	  mode_info_t mode_info;
	  vga_mode_t *m;

	  /* Mask out all but the real mode bits. */
	  mode_num = vesa_mode_numbers[n] & 0x3FFF;

	  if (!VESA_MODE_P (mode_num)) /* Is this not a VESA mode? */
	    continue;

	  /* Call BIOS function to get SVGA mode information. */
	  dpmi_zero_regs (&regs);
	  regs.x.cx = mode_num;
	  regs.x.es = dos_buf_segment;
	  regs.x.di = 0;

	  if (!vesa_call (VESA_GET_MODE_INFO, &regs))
	    continue;

	  /* Pull the new information in from DOS memory. */
	  movedata (dos_buf_selector, 0, dos_pm_ds, (unsigned) &mode_info,
		    sizeof mode_info);

	  if (!(mode_info.mode_attributes & ATTR_LEGAL_MODE)
	      || !(mode_info.mode_attributes & ATTR_GRAPHICS_MODE))
	    continue;

	  m = &mode_list[num_modes];
	  memset (m, 0, sizeof *m);

	  if (mode_info.mode_attributes & ATTR_EXTENDED_INFO)
	    {
	      /* Filter out unacceptable graphics modes.  We want either
	       * simple packed screens or 4bpp planar screens only.
	       */
	      if (mode_info.width < VDRIVER_MIN_SCREEN_WIDTH
		  || mode_info.height < VDRIVER_MIN_SCREEN_HEIGHT)
		continue;
	      if (mode_info.bits_per_pixel > 8)
		continue;
	      if (mode_info.memory_model != MEMORY_MODEL_PACKED_PIXELS
		  && (mode_info.bits_per_pixel != 4
		      || (mode_info.memory_model
			  != MEMORY_MODEL_FOUR_PLANES)))
		continue;
	      if (mode_info.num_planes != 1
		  && (mode_info.num_planes != 4
		      || mode_info.bits_per_pixel != 4))
		continue;

	      m->width    = mode_info.width;
	      m->height   = mode_info.height;
	      m->log2_bpp = ROMlib_log2[mode_info.bits_per_pixel];
	      m->planar_p = (mode_info.num_planes != 1);
	    }
	  else if (mode_num >= 0x100 && mode_num < 0x108)
	    {
	      /* No explicit information about this mode.  VESA spec
	       * says this is legal as long as it is one of the
	       * standard VESA-defined modes, which it is.
	       */
	      *m = standard_vesa_modes[mode_num - 0x100];
	    }
	  else
	    continue;		/* Strange; no information about this mode! */

	  m->row_bytes       = mode_info.row_bytes;
	  m->win_granularity = mode_info.win_granularity * 1024;
	  m->interlaced_p    = FALSE;
	  if ((mode_info.win_a_attributes & 0x3) == 0x3)
	    m->win_read = 0;
	  else if ((mode_info.win_b_attributes & 0x3) == 0x3)
	    m->win_read = 1;
	  else
	    continue;		/* No readable window at all! */
	  if ((mode_info.win_a_attributes & 0x5) == 0x5)
	    m->win_write = 0;
	  else if ((mode_info.win_b_attributes & 0x5) == 0x5)
	    m->win_write = 1;
	  else
	    continue;		/* No writeable window at all! */

	  /* Default to not knowing the physical base address. */
	  m->phys_base_addr = 0;

	  if (vesa_version >= 0x200
	      && (mode_info.mode_attributes & ATTR_LINEAR_FBUF)
	      && mode_info.phys_base_addr >= 1024 * 1024)
	    {
	      int sel;

	      m->phys_base_addr = mode_info.phys_base_addr;

	      sel = selector_for_phys_mem (m->phys_base_addr,
					   m->row_bytes * m->height);
	      if (sel != -1)
		{
		  mode_num |= USE_LINEAR_FBUF;
		  m->multi_window_p = FALSE;
		  m->screen_selector = sel;
		  m->win_size = m->row_bytes * m->height;
		}
	    }

	  /* If we failed to set to linear mode, do it the
	   * old-fashioned way.
	   */
	  if (!(mode_num & USE_LINEAR_FBUF))
	    {
	      m->multi_window_p  = (m->row_bytes * m->height > 65536);
	      m->screen_selector = vga_window_selector;
	      m->win_size = mode_info.win_size * 1024;
	      if (m->win_size > 65536) /* So we don't violate selector. */
		m->win_size = 65536;
	    }

	  m->mode_number = mode_num;

	  num_modes++;
	  if (m->planar_p && m->row_bytes * m->height > m->win_size)
	    {
	      m->log2_bpp = 0;	/* Only allow the 1bpp version. */
	    }
	  else
	    {
	      /* If we found a 4bpp planar mode, add the corresponding
	       * 1bpp mode we can get by only dealing with one of the
	       * planes.
	       */
	      if (num_modes < MAX_VGA_MODES && m->planar_p)
		{
		  mode_list[num_modes] = *m;
		  mode_list[num_modes].log2_bpp = 0;
		  num_modes++;
		}
	    }
	}
    }

  /* Terminate the mode list. */
  mode_list[num_modes].width = 0;

  return mode_list;
}
Example #30
0
/* Get inode number by searching DOS Swappable Data Area.
   The entire directory entry for a file found by FindFirst/FindNext
   appears at a certain (version-dependent) offset in the SDA after
   one of those function is called.
   Should be called immediately after calling DOS FindFirst function,
   before the info is overwritten by somebody who calls it again.  */
static unsigned int
get_inode_from_sda(const char *basename)
{
  int            count          = dirent_count;
  unsigned int * dirent_p       = dirent_table;
  unsigned short dos_mem_base   = _dos_ds;
  unsigned short our_mem_base   = _my_ds();
  char  * dot                   = strchr(basename, '.');
  size_t  total_len             = strlen(basename);
  int     name_len              = dot ? dot - basename : total_len;
  int     ext_len               = dot ? total_len - name_len - 1 : 0;
  int     cluster_offset        = offsetof(struct full_dirent, fcluster);

  /* Restore failure bits set by last call to init_dirent_table(), so
     they will be reported as if it were called now.  */
  _djstat_fail_bits |= init_dirent_table_bits;

  /* Force reinitialization in restarted programs (emacs).  */
  if (stat_count != __bss_count)
    {
      stat_count = __bss_count;
      dirent_count = 0;
    }

  /* Initialize the table of SDA entries where we are to look for
     our file.  */
  if (!dirent_count && !init_dirent_table())
    {
      /* Don't save the truename failure bit.  */
      init_dirent_table_bits = (_djstat_fail_bits & ~_STFAIL_TRUENAME);
      return 0;
    }
  init_dirent_table_bits = (_djstat_fail_bits & ~_STFAIL_TRUENAME);
  if (dirent_count == -1)
    return 0;

  count = dirent_count;
  dirent_p = dirent_table;

  _farsetsel(dos_mem_base);

  /* This is DOS 4.x lossage: this loop might execute many times.
     For other DOS versions it is executed exactly once.  */
  while (count--)
    {
      unsigned int  src_address = *dirent_p & 0x000fffff;
      char          cmp_buf[sizeof(struct full_dirent)];

      /* Copy the directory entry from the SDA to local storage.
         The filename is stored there in infamous DOS format: name and
         extension blank-padded to 8/3 characters, no dot between them.  */
      movedata(dos_mem_base, src_address, our_mem_base, (unsigned int)cmp_buf,
               sizeof(struct full_dirent));

      /* If this is the filename we are looking for, return
         its starting cluster. */
      if (!strncmp(cmp_buf, basename, name_len) &&
          (ext_len == 0 || !strncmp(cmp_buf + 8, dot + 1, ext_len)))
        return (unsigned int)_farnspeekw(*dirent_p + cluster_offset);

      /* This is not our file.  Search more, if more addresses left. */
      dirent_p++;
    }

  /* If not found, give up.  */
  _djstat_fail_bits |= _STFAIL_BADSDA;
  return 0;
}