Beispiel #1
0
BOOL flush1(struct buffer FAR * bp)
{
/* All lines with changes on 9/4/00 by BER marked below */  
  
  UWORD result;              /* BER 9/4/00 */

  if ((bp->b_flag & BFR_VALID) && (bp->b_flag & BFR_DIRTY))
  {
    result = dskxfer(bp->b_unit, getblkno(bp),
		 (VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00  */
    if (bp->b_flag & BFR_FAT)
    {
      int i = bp->b_copies;
      ULONG blkno = getblkno(bp);

      while (--i > 0)
      {
        blkno += bp->b_offset;
        result = dskxfer(bp->b_unit, blkno, 
		     (VOID FAR *) bp->b_buffer, 1, DSKWRITE);  /* BER 9/4/00 */
      }
    }
  }
  else
    result = 0; /* This negates any error code returned in result...BER */
                /* and 0 returned, if no errors occurred - tom          */
  bp->b_flag &= ~BFR_DIRTY;     /* even if error, mark not dirty */
  if (result != 0)              /* otherwise system has trouble  */
    bp->b_flag &= ~BFR_VALID;   /* continuing.           */
  return (TRUE);   /* Forced to TRUE...was like this before dskxfer()  */
		   /* returned error codes...BER */
}
Beispiel #2
0
struct buffer FAR *getblk(ULONG blkno, COUNT dsk, BOOL overwrite)
{
  /* Search through buffers to see if the required block  */
  /* is already in a buffer                               */

  struct buffer FAR *bp = searchblock(blkno, dsk);

  if (!(bp->b_flag & BFR_UNCACHE))
  {
    return bp;
  }

  /* The block we need is not in a buffer, we must make a buffer  */
  /* available, and fill it with the desired block                */

  /* take the buffer that lbp points to and flush it, then read new block. */
  if (!flush1(bp))
    return NULL;

  /* Fill the indicated disk buffer with the current track and sector */

  if (!overwrite && dskxfer(dsk, blkno, bp->b_buffer, 1, DSKREAD))
  {
    return NULL;
  }

  bp->b_flag = BFR_VALID | BFR_DATA;
  bp->b_unit = dsk;
  bp->b_blkno = blkno;

  return bp;
}
Beispiel #3
0
/* 
    this function is called from an assembler wrapper function 
*/
VOID int2526_handler(WORD mode, struct int25regs FAR * r)
{
  ULONG blkno;
  UWORD nblks;
  BYTE  FAR *buf;
  UBYTE drv;
  
  if (mode == 0x26) mode = DSKWRITEINT26;
  else              mode = DSKREADINT25;
  
  drv = r->ax;

  if (drv >= lastdrive)
  {
    r->ax = 0x201;
    r->flags |= FLG_CARRY;
    return;
  }
  

  nblks = r->cx;
  blkno = r->dx;
    
  buf = MK_FP(r->ds, r->bx);
    
  if (nblks == 0xFFFF)
  {
    /*struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);*/
    blkno = ((struct HugeSectorBlock FAR *)buf)->blkno;
    nblks = ((struct HugeSectorBlock FAR *)buf)->nblks;
    buf   = ((struct HugeSectorBlock FAR *)buf)->buf;
  }
  

  InDOS++;

  r->ax=dskxfer(drv, blkno, buf, nblks, mode);

  if (mode == DSKWRITE)
    if (r->ax <= 0)
        setinvld(drv);

  if (r->ax > 0)
  {
    r->flags |= FLG_CARRY;
    --InDOS;
    return;
  }


  r->ax = 0;
  r->flags &= ~FLG_CARRY;
  --InDOS;
  
}
Beispiel #4
0
STATIC BOOL flush1(struct buffer FAR * bp)
{
/* All lines with changes on 9/4/00 by BER marked below */

  UWORD result;                 /* BER 9/4/00 */

  if ((bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY))
  {
    /* BER 9/4/00  */
    result = dskxfer(bp->b_unit, bp->b_blkno, bp->b_buffer, 1, DSKWRITE);
    if (bp->b_flag & BFR_FAT)
    {
      UWORD b_copies = bp->b_copies;
      ULONG blkno = bp->b_blkno;
#ifdef WITHFAT32
      ULONG b_offset = bp->b_offset;
      if (b_offset == 0) /* FAT32 FS */
        b_offset = bp->b_dpbp->dpb_xfatsize;
#else
      UWORD b_offset = bp->b_offset;
#endif
      while (--b_copies > 0)
      {
        blkno += b_offset;
        /* BER 9/4/00 */
        result = dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE);
      }
    }
  }
  else
    result = 0;                 /* This negates any error code returned in result...BER */
  /* and 0 returned, if no errors occurred - tom          */
  bp->b_flag &= ~BFR_DIRTY;     /* even if error, mark not dirty */
  if (result != 0)              /* otherwise system has trouble  */
    bp->b_flag &= ~BFR_VALID;   /* continuing.           */
  return (TRUE);                /* Forced to TRUE...was like this before dskxfer()  */
  /* returned error codes...BER */
}
Beispiel #5
0
VOID int26_handler(struct int25regs FAR * r)
{
  ULONG blkno;
  UWORD nblks;
  BYTE FAR *buf;
  UBYTE drv = r->ax & 0xFF;

  InDOS++;

  if (r->cx == 0xFFFF)
  {
    struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);
    blkno = lb->blkno;
    nblks = lb->nblks;
    buf = lb->buf;
  }
  else
  {
    nblks = r->cx;
    blkno = r->dx;
    buf = MK_FP(r->ds, r->bx);
  }

  if (drv >= nblkdev)
  {
    r->ax = 0x202;
    r->flags |= FLG_CARRY;
    return;
  }

  if (!dskxfer(drv, blkno, buf, nblks, DSKWRITE))
  {
    /* XXX: should tell the user exactly what the error was */
    r->ax = 0x202;
    r->flags |= FLG_CARRY;
    return;
  }

  setinvld(drv);

  r->ax = 0;
  r->flags &= ~FLG_CARRY;
  --InDOS;
}
Beispiel #6
0
struct buffer FAR *getblock(ULONG blkno, COUNT dsk)
{
    struct buffer FAR *bp;



  /* Search through buffers to see if the required block  */
  /* is already in a buffer                               */

    if (searchblock(blkno, dsk, &bp))
    {
      return (bp);
    }

  /* The block we need is not in a buffer, we must make a buffer  */
  /* available, and fill it with the desired block                */


  /* take the buffer that lbp points to and flush it, then read new block. */
  if (!flush1(bp))
        return NULL;
  
            /* Fill the indicated disk buffer with the current track and sector */

  if (dskxfer(dsk, blkno, (VOID FAR *) bp->b_buffer, 1, DSKREAD))
    {
        return NULL;
    }

  bp->b_flag = BFR_VALID | BFR_DATA;
  bp->b_unit = dsk;
  setblkno(bp, blkno);
  
  return bp;

}