http://www.ousob.com --- Legacy Redefined #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <bios.h> #include <dos.h> #include <memory.h> #include <extend50.h> char out_buffer[512] = {"Write and read test of ROM-BIOS disk service 13h" }; char in_buffer[512]; CLIPPER b_chgdrive() { int gotAproblem = 0 ; unsigned dn ; unsigned driveNum ; unsigned drives ; unsigned status ; struct diskinfo_t disk_info ; char *driveLetter = _parc(1) ; if( !ISCHAR(1) ){ gotAproblem++; } if( !gotAproblem ) { dn = (unsigned)_toupper(driveLetter[0]) - 'A'; if( dn < 2 ){ disk_info.drive = _toupper(driveLetter[0]) - 'A'; disk_info.head = 0; disk_info.track = 39; disk_info.sector = 1; disk_info.nsectors = 1; disk_info.buffer = (void far *) out_buffer; status = _bios_disk(_DISK_WRITE, &disk_info); if( status >> 8 ){ _bios_disk(_DISK_RESET,&disk_info); } disk_info.buffer = (void far *)in_buffer; status = _bios_disk(_DISK_READ,&disk_info); if( status >> 8 ){ _bios_disk(_DISK_RESET, &disk_info); } if( memcmp(out_buffer,in_buffer,512) ){ gotAproblem++; } else{ driveNum = _toupper(driveLetter[0]) - 'A' + 1; _dos_setdrive(driveNum,&drives); _dos_getdrive(&driveNum); if( driveNum != _toupper(driveLetter[0]) - 'A' + 1){ gotAproblem++; } } } else{ driveNum = _toupper(driveLetter[0]) - 'A' + 1; _dos_setdrive(driveNum,&drives); _dos_getdrive(&driveNum); if( driveNum != _toupper(driveLetter[0]) - 'A' + 1){ gotAproblem++; } } } _retl( gotAproblem ? 0 : 1 ); }