It keeps on saying the SREGS and REGS is indifined. Woudl the interrupts be too old? This was ment for a 8086.
Plus GCC doesn't like the void main( void )
/* ReadDisk.c ? Reports errors on the 3 1/4 disk */ #include <dos.h> #include <stdio.h> unsigned char readDriveSectors( unsigned char, unsigned char, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char, unsigned char, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char, unsigned char far * ); unsigned char resetDrive( unsigned char ); #define LASTHEAD ? ? ? ? ?1 #define LASTTRACK ? ? ? ? 79 #define LASTSECTOR ? ? ? ?18 #define BYTESPERSECTOR ? ?512 #define driveToRead ? ? ? 0 #define MAXRETRIES ? ? ? ?3 #define NO_ERROR ? ? ? ? ?0 char diskBuffer[ BYTESPERSECTOR * LASTSECTOR ]; void main( void ) { unsigned int currentHead, ? ? ? ? ? ? currentTrack; unsigned char errorCode; int retryCount; for( currentTrack = 0; ? ? ? ?currentHead <= LASTHEAD; ? ? ? ? ? ? ? ?currentHead++ ) { ? ? ? ?for( retryCount = 0; ? ? ? ? ? ? ? ?retryCount < MAXRETRIES; ? ? ? ? ? ? ? ? ? ? ? ?retryCount++ ) { ? ? ? ?errorCode = readDisketteSectors( driveToRead, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LASTSECTOR, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? currentHead, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? currentTrack, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? diskBuffer ); ? ? ? ? ? ? ? ?if ( errorCode == NO_ERROR ) ? ? ? ? ? ? ? ? ? ? ? ?break; ? ? ? ? ? ? ? ?resetDrive( driveToRead ); ? ? ? ? ? ? ? ?} ? ? ? ?if ( errorCode != NO_ERROR ) ? ? ? ? ? ? ? printf( "Error reading head %u\n\7", ? ? ? ? ? ? ? ? ? ? ? ?currentHead, currentTrack ); ? ? ? ? ? } ? ? ?} } unsigned char readDisketteSectors( unsigned char drive, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char sectorsToRead, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char head, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char track, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char sector, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char far *bufferPtr ) { union REGS regs; struct SREGS sregs; regs.h.ah = 2; regs.h.al = sectorsToRead; regs.x.bx = FP_OFF(bufferPtr); regs.h.dh = head; regs.h.dl = drive; regs.h.cl = track; regs.h.cl = sector; sregs.es ?= FP_SEG(bufferPtr); int86x( 0x13, ?s, ? ? ? ??s, &sregs ); return( regs.h.ah ); } unsigned char resetDrive( unsigned char drive ) { union REGS regs; regs.h.ah = 0; regs.h.dl = drive; int86( 0x13, ?s, ?s ); return( regs.h.ah ); }
This post has been edited by Jim diGriz: 07 January 2003 - 10:27 PM