Category : C Source Code
Archive   : JAZ_CLIB.ZIP
Filename : JZDSKSTS.C

 
Output of file : JZDSKSTS.C contained in archive : JAZ_CLIB.ZIP
/*
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Title : csdsksts ³
³Purpose : return 1 disk status byte ³
³ ³
³Parms ³
³ fdrive : 0..3 for FLOPPY DISKETTE DRIVES A,B,C,D ³
³ fdrive : $80..$83 FOR FIXED DISK DRIVES C,D,E,F ETC. ³
³ fsector : 1..9 . which sector to read ³
³ ftrack : 0..42 which track to read ³
³ fhead : 0..1 which head to read from ³
³ fnumsect : how many sectors to read ³
³ ³
³Notes: This routine reads a dummy sector into a dummy buffer because the ³
³ disk status option returns the status of the previous read. ³
³ ³
³Returns ³
³ $80 - Timeout ³
³ $40 - Bad Seek ³
³ $20 - Nec Controller failed ³
³ $10 - Bad Crc ³
³ $8 - Attempt to cross 64k boundry ³
³ $4 - Sector not found ³
³ $3 - write protect ³
³ $2 - address mark not found ³
³ $1 - bad command ³
³ $0 - Succsessful ³
³ ³
³written by Jack A. Zucker 75766,1336 (301) 794-5950 ³
³ ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
*/

#include /* include register defs */
jzdsksts(fdrive)
int fdrive;
{
TREG wreg;
char wbuf[512]; /* buffer for sector read */
int weseg,w;

weseg = getes(); /* get value of extra segment */

for (w = 0 ; w < 3 ; w ++ ) { /* allow 3 retries */
wreg.x.ax = 0x201; /* read 1 sector */
wreg.h.dh = 0; /* get head number */
wreg.h.dl = fdrive; /* get users drive */
wreg.x.cx = 1; /* ch = track,cl = sector number */
wreg.x.es = weseg; /* segment of buffer */
wreg.x.bx = (int) wbuf; /* offset of wbuf */
intr(0x13,&wreg);
if (! (wreg.x.flags & 1)) /* we got a good read */
return(0); /* indicate it with a zero status */
}
return(wreg.h.ah); /* at this point we have a disk error */
}


  3 Responses to “Category : C Source Code
Archive   : JAZ_CLIB.ZIP
Filename : JZDSKSTS.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/