mirror of
https://github.com/FDOS/kernel.git
synced 2025-04-08 17:15:17 +02:00
update documentation to include new options; add option to sys to force LBA or CHS usage, allow using BIOS specified boot drive # on floppy, add verbose output (debug prints), and reorder some steps in copy() to avoid some unnecessary disk swaps on single drive systems
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1494 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
66c9f421ac
commit
ddb2dffb9f
28
docs/sys.txt
28
docs/sys.txt
@ -1,4 +1,4 @@
|
|||||||
FreeDOS SYS 3.6
|
FreeDOS System Installer v3.6d, Jul 29 2009
|
||||||
documentation by:
|
documentation by:
|
||||||
Jeremy Davis
|
Jeremy Davis
|
||||||
Bart Oldeman
|
Bart Oldeman
|
||||||
@ -13,8 +13,7 @@ The best documentation is the source itself, but
|
|||||||
we try to keep this document updated.
|
we try to keep this document updated.
|
||||||
|
|
||||||
|
|
||||||
Usage:
|
Usage: SYS [source] drive: [bootsect] [{option}]
|
||||||
SYS [source] dest: [bootsect] [{option}]
|
|
||||||
source = A:,B:,C:\KERNEL\BIN\,etc., or current directory if not given
|
source = A:,B:,C:\KERNEL\BIN\,etc., or current directory if not given
|
||||||
dest = A,B,etc.
|
dest = A,B,etc.
|
||||||
bootsect = name of 512-byte boot sector file image for drive:
|
bootsect = name of 512-byte boot sector file image for drive:
|
||||||
@ -33,13 +32,19 @@ SYS [source] dest: [bootsect] [{option}]
|
|||||||
/K name : name of kernel to use in boot sector instead of KERNEL.SYS
|
/K name : name of kernel to use in boot sector instead of KERNEL.SYS
|
||||||
/L segm : hex load segment to use in boot sector instead of 0x60
|
/L segm : hex load segment to use in boot sector instead of 0x60
|
||||||
/B btdrv : hex BIOS # of boot drive set in bs, 0=A:, 80=1st hd,...
|
/B btdrv : hex BIOS # of boot drive set in bs, 0=A:, 80=1st hd,...
|
||||||
/FORCEDRV: force use of drive # set in bs instead of BIOS boot value
|
/FORCE : override automatic selection of BIOS related settings
|
||||||
|
/FORCE:BSDRV (/FORCEDRV) use boot drive # set in bootsector
|
||||||
|
/FORCE:BIOSDRV use boot drive # provided by BIOS
|
||||||
|
/FORCE:AUTO select LBA or CHS depending on BIOS availability
|
||||||
|
/FORCE:LBA always use LBA
|
||||||
|
/FORCE:CHS always use CHS
|
||||||
/NOBAKBS : skips copying boot sector to backup bs, FAT32 only else ignored
|
/NOBAKBS : skips copying boot sector to backup bs, FAT32 only else ignored
|
||||||
/SKFN filename : set KERNEL.SYS input file and /OEM:FD
|
/SKFN filename : copy from filename to KERNEL.SYS; settings same as /OEM:FD
|
||||||
/SCFN filename : sets COMMAND.COM input file
|
/SCFN filename : copy from filename to COMMAND.COM
|
||||||
/BACKUPBS [path]filename : save current bs before overwriting
|
/BACKUPBS [path]filename : save current bs before overwriting
|
||||||
/DUMPBS [path]filename : save current bs and exit
|
/DUMPBS [path]filename : save current bs and exit
|
||||||
/RESTORBS [path]filename : overwrite bs and exit
|
/RESTORBS [path]filename : overwrite bs and exit
|
||||||
|
/VERBOSE : display additional (debug) output
|
||||||
|
|
||||||
SYS CONFIG /help
|
SYS CONFIG /help
|
||||||
|
|
||||||
@ -86,6 +91,17 @@ for dual booting or diagnostic purposes.
|
|||||||
If you also specify BOTH, sys will write to both
|
If you also specify BOTH, sys will write to both
|
||||||
the image file and the boot sector.
|
the image file and the boot sector.
|
||||||
|
|
||||||
|
The FORCE options override the default actions
|
||||||
|
to use. On FAT32 drives /FORCE:LBA and /FORCE:CHS
|
||||||
|
will select which boot sector code is used (default
|
||||||
|
same as /FORCE:AUTO will choose based on query of
|
||||||
|
BIOS support for LBA extensions and use LBA if it
|
||||||
|
is supported else only CHS will be used). On FAT12
|
||||||
|
and FAT16 drives specifying /FORCE:LBA will ensure
|
||||||
|
even 1st floppy drive attempts to use LBA support
|
||||||
|
(note that CHS may still be used if LBA check fails)
|
||||||
|
and /FORCE:CHS will always bypass use of LBA extensions.
|
||||||
|
|
||||||
|
|
||||||
Kernel Configuration Options:
|
Kernel Configuration Options:
|
||||||
|
|
||||||
|
191
sys/sys.c
191
sys/sys.c
@ -32,7 +32,7 @@
|
|||||||
#define FDCONFIG /* include support to configure FD kernel */
|
#define FDCONFIG /* include support to configure FD kernel */
|
||||||
/* #define DRSYS */ /* SYS for Enhanced DR-DOS (OpenDOS enhancement Project) */
|
/* #define DRSYS */ /* SYS for Enhanced DR-DOS (OpenDOS enhancement Project) */
|
||||||
|
|
||||||
#define SYS_VERSION "v3.6c"
|
#define SYS_VERSION "v3.6d"
|
||||||
#define SYS_NAME "FreeDOS System Installer "
|
#define SYS_NAME "FreeDOS System Installer "
|
||||||
|
|
||||||
|
|
||||||
@ -369,6 +369,8 @@ typedef struct SYSOptions {
|
|||||||
BYTE *bsFileOrig; /* file name & path to save original bs when backing up */
|
BYTE *bsFileOrig; /* file name & path to save original bs when backing up */
|
||||||
BYTE *fnKernel; /* optional override to source kernel filename (src only) */
|
BYTE *fnKernel; /* optional override to source kernel filename (src only) */
|
||||||
BYTE *fnCmd; /* optional override to cmd interpreter filename (src & dest) */
|
BYTE *fnCmd; /* optional override to cmd interpreter filename (src & dest) */
|
||||||
|
enum {AUTO=0,LBA,CHS} force; /* optional force boot sector to only use LBA or CHS */
|
||||||
|
BOOL verbose; /* show extra (DEBUG) output */
|
||||||
} SYSOptions;
|
} SYSOptions;
|
||||||
|
|
||||||
void dumpBS(const char *, int);
|
void dumpBS(const char *, int);
|
||||||
@ -380,8 +382,7 @@ BOOL copy(const BYTE *source, COUNT drive, const BYTE * filename);
|
|||||||
void showHelpAndExit(void)
|
void showHelpAndExit(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"Usage: \n"
|
"Usage: %s [source] drive: [bootsect] [{option}]\n"
|
||||||
"%s [source] drive: [bootsect] [{option}]\n"
|
|
||||||
" source = A:,B:,C:\\DOS\\,etc., or current directory if not given\n"
|
" source = A:,B:,C:\\DOS\\,etc., or current directory if not given\n"
|
||||||
" drive = A,B,etc.\n"
|
" drive = A,B,etc.\n"
|
||||||
" bootsect = name of 512-byte boot sector file image for drive:\n"
|
" bootsect = name of 512-byte boot sector file image for drive:\n"
|
||||||
@ -403,7 +404,9 @@ void showHelpAndExit(void)
|
|||||||
" /K name : name of kernel to use in boot sector instead of %s\n"
|
" /K name : name of kernel to use in boot sector instead of %s\n"
|
||||||
" /L segm : hex load segment to use in boot sector instead of %02x\n"
|
" /L segm : hex load segment to use in boot sector instead of %02x\n"
|
||||||
" /B btdrv : hex BIOS # of boot drive set in bs, 0=A:, 80=1st hd,...\n"
|
" /B btdrv : hex BIOS # of boot drive set in bs, 0=A:, 80=1st hd,...\n"
|
||||||
" /FORCEDRV: force use of drive # set in bs instead of BIOS boot value\n"
|
" /FORCE : override automatic selection of BIOS related settings\n"
|
||||||
|
" /FORCE:BSDRV use boot drive # set in bootsector\n"
|
||||||
|
" /FORCE:BIOSDRV use boot drive # provided by BIOS\n"
|
||||||
" /NOBAKBS : skips copying boot sector to backup bs, FAT32 only else ignored\n"
|
" /NOBAKBS : skips copying boot sector to backup bs, FAT32 only else ignored\n"
|
||||||
#ifdef FDCONFIG
|
#ifdef FDCONFIG
|
||||||
"%s CONFIG /help\n"
|
"%s CONFIG /help\n"
|
||||||
@ -448,6 +451,11 @@ void initOptions(int argc, char *argv[], SYSOptions *opts)
|
|||||||
{
|
{
|
||||||
showHelpAndExit();
|
showHelpAndExit();
|
||||||
}
|
}
|
||||||
|
/* enable extra (DEBUG) output */
|
||||||
|
else if (memicmp(argp, "VERBOSE", 7) == 0)
|
||||||
|
{
|
||||||
|
opts->verbose = 1;
|
||||||
|
}
|
||||||
/* write to *both* the real boot sector and the image file */
|
/* write to *both* the real boot sector and the image file */
|
||||||
else if (memicmp(argp, "BOTH", 4) == 0)
|
else if (memicmp(argp, "BOTH", 4) == 0)
|
||||||
{
|
{
|
||||||
@ -504,10 +512,44 @@ void initOptions(int argc, char *argv[], SYSOptions *opts)
|
|||||||
showHelpAndExit();
|
showHelpAndExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* force use of drive # set in bs instead of BIOS boot value */
|
/* override auto options */
|
||||||
else if (memicmp(argp, "FORCEDRV", 8) == 0)
|
else if (memicmp(argp, "FORCE", 5) == 0)
|
||||||
{
|
{
|
||||||
opts->ignoreBIOS = 1;
|
argp += 5;
|
||||||
|
if (*argp == ':')
|
||||||
|
{
|
||||||
|
argp++; /* point to CHS/LBA/... that follows */
|
||||||
|
|
||||||
|
/* specify which BIOS access mode to use */
|
||||||
|
if (memicmp(argp, "AUTO", 4) == 0) /* default */
|
||||||
|
opts->force = AUTO;
|
||||||
|
else if (memicmp(argp, "CHS", 3) == 0)
|
||||||
|
opts->force = CHS;
|
||||||
|
else if (memicmp(argp, "LBA", 3) == 0)
|
||||||
|
opts->force = LBA;
|
||||||
|
|
||||||
|
/* specify if BIOS or BOOTSECTOR provided boot drive # is to be used */
|
||||||
|
else if (memicmp(argp, "BSDRV", 5) == 0) /* same as FORCEDRV */
|
||||||
|
opts->ignoreBIOS = 1;
|
||||||
|
else if (memicmp(argp, "BIOSDRV", 7) == 0) /* always use BIOS passed */
|
||||||
|
opts->ignoreBIOS = -1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%s: invalid FORCE qualifier %s\n", pgm, argp);
|
||||||
|
showHelpAndExit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (memicmp(argp, "DRV", 3) == 0) /* FORCEDRV */
|
||||||
|
{
|
||||||
|
/* force use of drive # set in bs instead of BIOS boot value */
|
||||||
|
/* deprecated, use FORCE:BSDRV */
|
||||||
|
opts->ignoreBIOS = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%s: invalid FORCE qualifier %s\n", pgm, argp);
|
||||||
|
showHelpAndExit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* skips copying boot sector to backup bs, FAT32 only else ignored */
|
/* skips copying boot sector to backup bs, FAT32 only else ignored */
|
||||||
else if (memicmp(argp, "NOBAKBS", 7) == 0)
|
else if (memicmp(argp, "NOBAKBS", 7) == 0)
|
||||||
@ -704,13 +746,17 @@ void initOptions(int argc, char *argv[], SYSOptions *opts)
|
|||||||
opts->kernel.minsize = bootFiles[opts->flavor].minsize;
|
opts->kernel.minsize = bootFiles[opts->flavor].minsize;
|
||||||
|
|
||||||
|
|
||||||
|
/* did user insist on always using BIOS provided drive # */
|
||||||
|
if (opts->ignoreBIOS == -1)
|
||||||
|
opts->ignoreBIOS = 0; /* its really a boolean value in rest of code */
|
||||||
/* if destination is floppy (A: or B:) then use drive # stored in boot sector */
|
/* if destination is floppy (A: or B:) then use drive # stored in boot sector */
|
||||||
if (opts->dstDrive < 2)
|
else if (opts->dstDrive < 2)
|
||||||
opts->ignoreBIOS = 1;
|
opts->ignoreBIOS = 1;
|
||||||
|
|
||||||
/* if bios drive to store in boot sector not set and not floppy set to 1st hd */
|
/* if bios drive to store in boot sector not set and not floppy set to 1st hd */
|
||||||
if (!opts->defBootDrive && (opts->dstDrive >= 2))
|
if (!opts->defBootDrive && (opts->dstDrive >= 2))
|
||||||
opts->defBootDrive = 0x80;
|
opts->defBootDrive = 0x80;
|
||||||
|
/* else opts->defBootDrive = 0x0; the 1st floppy */
|
||||||
|
|
||||||
|
|
||||||
/* unless we are only setting boot sector, verify kernel file exists */
|
/* unless we are only setting boot sector, verify kernel file exists */
|
||||||
@ -1087,19 +1133,21 @@ BOOL haveLBA(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void correct_bpb(struct bootsectortype *default_bpb,
|
void correct_bpb(struct bootsectortype *default_bpb,
|
||||||
struct bootsectortype *oldboot)
|
struct bootsectortype *oldboot, BOOL verbose)
|
||||||
{
|
{
|
||||||
/* don't touch partitions (floppies most likely) that don't have hidden
|
/* don't touch partitions (floppies most likely) that don't have hidden
|
||||||
sectors */
|
sectors */
|
||||||
if (default_bpb->bsHiddenSecs == 0)
|
if (default_bpb->bsHiddenSecs == 0)
|
||||||
return;
|
return;
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Old boot sector values: sectors/track: %u, heads: %u, hidden: %lu\n",
|
if (verbose)
|
||||||
oldboot->bsSecPerTrack, oldboot->bsHeads, oldboot->bsHiddenSecs);
|
{
|
||||||
printf("Default and new boot sector values: sectors/track: %u, heads: %u, "
|
printf("Old boot sector values: sectors/track: %u, heads: %u, hidden: %lu\n",
|
||||||
"hidden: %lu\n", default_bpb->bsSecPerTrack, default_bpb->bsHeads,
|
oldboot->bsSecPerTrack, oldboot->bsHeads, oldboot->bsHiddenSecs);
|
||||||
default_bpb->bsHiddenSecs);
|
printf("Default and new boot sector values: sectors/track: %u, heads: %u, "
|
||||||
#endif
|
"hidden: %lu\n", default_bpb->bsSecPerTrack, default_bpb->bsHeads,
|
||||||
|
default_bpb->bsHiddenSecs);
|
||||||
|
}
|
||||||
|
|
||||||
oldboot->bsSecPerTrack = default_bpb->bsSecPerTrack;
|
oldboot->bsSecPerTrack = default_bpb->bsSecPerTrack;
|
||||||
oldboot->bsHeads = default_bpb->bsHeads;
|
oldboot->bsHeads = default_bpb->bsHeads;
|
||||||
@ -1242,9 +1290,10 @@ void put_boot(SYSOptions *opts)
|
|||||||
UBYTE default_bpb[0x5c];
|
UBYTE default_bpb[0x5c];
|
||||||
int bsBiosMovOff; /* offset in bs to mov [drive],dl that we NOP out */
|
int bsBiosMovOff; /* offset in bs to mov [drive],dl that we NOP out */
|
||||||
|
|
||||||
#ifdef DEBUG
|
if (opts->verbose)
|
||||||
printf("Reading old bootsector from drive %c:\n", opts->dstDrive + 'A');
|
{
|
||||||
#endif
|
printf("Reading old bootsector from drive %c:\n", opts->dstDrive + 'A');
|
||||||
|
}
|
||||||
|
|
||||||
/* lock drive */
|
/* lock drive */
|
||||||
generic_block_ioctl(opts->dstDrive + 1, 0x84a, NULL);
|
generic_block_ioctl(opts->dstDrive + 1, 0x84a, NULL);
|
||||||
@ -1316,7 +1365,7 @@ void put_boot(SYSOptions *opts)
|
|||||||
/* get default bpb (but not for floppies) */
|
/* get default bpb (but not for floppies) */
|
||||||
if (opts->dstDrive >= 2 &&
|
if (opts->dstDrive >= 2 &&
|
||||||
generic_block_ioctl(opts->dstDrive + 1, 0x4860, default_bpb) == 0)
|
generic_block_ioctl(opts->dstDrive + 1, 0x4860, default_bpb) == 0)
|
||||||
correct_bpb((struct bootsectortype *)(default_bpb + 7 - 11), bs);
|
correct_bpb((struct bootsectortype *)(default_bpb + 7 - 11), bs, opts->verbose);
|
||||||
|
|
||||||
#ifdef WITHFAT32 /* copy one of the FAT32 boot sectors */
|
#ifdef WITHFAT32 /* copy one of the FAT32 boot sectors */
|
||||||
if (!opts->kernel.stdbs) /* MS/PC DOS compatible BS requested */
|
if (!opts->kernel.stdbs) /* MS/PC DOS compatible BS requested */
|
||||||
@ -1326,7 +1375,11 @@ void put_boot(SYSOptions *opts)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(newboot, haveLBA() ? fat32lba : fat32chs, SEC_SIZE);
|
/* user may force explicity lba or chs, otherwise base on if LBA available */
|
||||||
|
if ((opts->force==LBA) || ((opts->force==AUTO) && haveLBA()))
|
||||||
|
memcpy(newboot, fat32lba, SEC_SIZE);
|
||||||
|
else /* either auto mode & no LBA detected or forced CHS */
|
||||||
|
memcpy(newboot, fat32chs, SEC_SIZE);
|
||||||
#else
|
#else
|
||||||
printf("SYS hasn't been compiled with FAT32 support.\n"
|
printf("SYS hasn't been compiled with FAT32 support.\n"
|
||||||
"Consider using -DWITHFAT32 option.\n");
|
"Consider using -DWITHFAT32 option.\n");
|
||||||
@ -1338,11 +1391,38 @@ void put_boot(SYSOptions *opts)
|
|||||||
printf("FAT type: FAT1%c\n", fs + '0' - 10);
|
printf("FAT type: FAT1%c\n", fs + '0' - 10);
|
||||||
if (opts->dstDrive >= 2 &&
|
if (opts->dstDrive >= 2 &&
|
||||||
generic_block_ioctl(opts->dstDrive + 1, 0x860, default_bpb) == 0)
|
generic_block_ioctl(opts->dstDrive + 1, 0x860, default_bpb) == 0)
|
||||||
correct_bpb((struct bootsectortype *)(default_bpb + 7 - 11), bs);
|
correct_bpb((struct bootsectortype *)(default_bpb + 7 - 11), bs, opts->verbose);
|
||||||
|
|
||||||
if (opts->kernel.stdbs)
|
if (opts->kernel.stdbs)
|
||||||
{
|
{
|
||||||
|
/* copy over appropriate boot sector, FAT12 or FAT16 */
|
||||||
memcpy(newboot, (fs == FAT16) ? fat16com : fat12com, SEC_SIZE);
|
memcpy(newboot, (fs == FAT16) ? fat16com : fat12com, SEC_SIZE);
|
||||||
|
|
||||||
|
/* !!! if boot sector changes then update these locations !!! */
|
||||||
|
{
|
||||||
|
unsigned offset;
|
||||||
|
offset = (fs == FAT16) ? 0x175 : 0x178;
|
||||||
|
|
||||||
|
if ( (newboot[offset]==0x84) && (newboot[offset+1]==0xD2) ) /* test dl,dl */
|
||||||
|
{
|
||||||
|
/* if always use LBA then NOP out conditional jmp over LBA logic if A: */
|
||||||
|
if (opts->force==LBA)
|
||||||
|
{
|
||||||
|
offset+=2; /* jz */
|
||||||
|
newboot[offset] = 0x90; /* NOP */ ++offset;
|
||||||
|
newboot[offset] = 0x90; /* NOP */
|
||||||
|
}
|
||||||
|
else if (opts->force==CHS) /* if force CHS then always skip LBA logic */
|
||||||
|
{
|
||||||
|
newboot[offset] = 0x30; /* XOR */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%s : fat boot sector does not match expected layout\n", pgm);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1377,9 +1457,8 @@ void put_boot(SYSOptions *opts)
|
|||||||
/* ensure appears valid, if not then force valid */
|
/* ensure appears valid, if not then force valid */
|
||||||
if ((bs32->bsBackupBoot < 1) || (bs32->bsBackupBoot > bs32->bsResSectors))
|
if ((bs32->bsBackupBoot < 1) || (bs32->bsBackupBoot > bs32->bsResSectors))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
if (opts->verbose)
|
||||||
printf("BPB appears to have invalid backup boot sector #, forcing to default.\n");
|
printf("BPB appears to have invalid backup boot sector #, forcing to default.\n");
|
||||||
#endif
|
|
||||||
bs32->bsBackupBoot = 0x6; /* ensure set, 6 is MS defined bs size */
|
bs32->bsBackupBoot = 0x6; /* ensure set, 6 is MS defined bs size */
|
||||||
}
|
}
|
||||||
bs32->bsDriveNumber = opts->defBootDrive;
|
bs32->bsDriveNumber = opts->defBootDrive;
|
||||||
@ -1466,14 +1545,16 @@ void put_boot(SYSOptions *opts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG /* add an option to display this on user request? */
|
if (opts->verbose) /* display information about filesystem */
|
||||||
|
{
|
||||||
printf("Root dir entries = %u\n", bs->bsRootDirEnts);
|
printf("Root dir entries = %u\n", bs->bsRootDirEnts);
|
||||||
|
|
||||||
printf("FAT starts at sector (%lu + %u)\n",
|
printf("FAT starts at sector (%lu + %u)\n",
|
||||||
bs->bsHiddenSecs, bs->bsResSectors);
|
bs->bsHiddenSecs, bs->bsResSectors);
|
||||||
printf("Root directory starts at sector (PREVIOUS + %u * %u)\n",
|
printf("Root directory starts at sector (PREVIOUS + %u * %u)\n",
|
||||||
bs->bsFATsecs, bs->bsFATs);
|
bs->bsFATsecs, bs->bsFATs);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
memset(&newboot[0x1f1], ' ', 11);
|
memset(&newboot[0x1f1], ' ', 11);
|
||||||
@ -1496,14 +1577,15 @@ void put_boot(SYSOptions *opts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
if (opts->verbose)
|
||||||
/* there's a zero past the kernel name in all boot sectors */
|
{
|
||||||
printf("Boot sector kernel name set to %s\n", &newboot[0x1f1]);
|
/* there's a zero past the kernel name in all boot sectors */
|
||||||
if (opts->kernel.stdbs)
|
printf("Boot sector kernel name set to %s\n", &newboot[0x1f1]);
|
||||||
printf("Boot sector kernel load segment set to %X:0h\n", opts->kernel.loadaddr);
|
if (opts->kernel.stdbs)
|
||||||
else
|
printf("Boot sector kernel load segment set to %X:0h\n", opts->kernel.loadaddr);
|
||||||
printf("Boot sector kernel jmp address set to 70:%Xh\n", opts->kernel.loadaddr);
|
else
|
||||||
#endif
|
printf("Boot sector kernel jmp address set to 70:%Xh\n", opts->kernel.loadaddr);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DDEBUG
|
#ifdef DDEBUG
|
||||||
printf("\nNew Boot Sector:\n");
|
printf("\nNew Boot Sector:\n");
|
||||||
@ -1546,9 +1628,8 @@ void put_boot(SYSOptions *opts)
|
|||||||
|
|
||||||
if (opts->bsFile != NULL)
|
if (opts->bsFile != NULL)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
if (opts->verbose)
|
||||||
printf("writing new bootsector to file %s\n", opts->bsFile);
|
printf("writing new bootsector to file %s\n", opts->bsFile);
|
||||||
#endif
|
|
||||||
|
|
||||||
saveBS(opts->bsFile, newboot);
|
saveBS(opts->bsFile, newboot);
|
||||||
} /* if write boot sector to file*/
|
} /* if write boot sector to file*/
|
||||||
@ -1622,6 +1703,16 @@ BOOL copy(const BYTE *source, COUNT drive, const BYTE * filename)
|
|||||||
int fdin, fdout;
|
int fdin, fdout;
|
||||||
ULONG copied = 0;
|
ULONG copied = 0;
|
||||||
|
|
||||||
|
#if defined __WATCOMC__ || defined _MSC_VER /* || defined __BORLANDC__ */
|
||||||
|
#if defined(__WATCOMC__) && __WATCOMC__ < 1280
|
||||||
|
unsigned short date, time;
|
||||||
|
#else
|
||||||
|
unsigned date, time;
|
||||||
|
#endif
|
||||||
|
#elif defined __TURBOC__
|
||||||
|
struct ftime ftime;
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("Copying %s...\n", source);
|
printf("Copying %s...\n", source);
|
||||||
|
|
||||||
truename(src, source);
|
truename(src, source);
|
||||||
@ -1639,6 +1730,12 @@ BOOL copy(const BYTE *source, COUNT drive, const BYTE * filename)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined __WATCOMC__ || defined _MSC_VER /* || defined __BORLANDC__ */
|
||||||
|
_dos_getftime(fdin, &date, &time);
|
||||||
|
#elif defined __TURBOC__
|
||||||
|
getftime(fdin, &ftime);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!check_space(drive, filelength(fdin)))
|
if (!check_space(drive, filelength(fdin)))
|
||||||
{
|
{
|
||||||
printf("%s: Not enough space to transfer %s\n", pgm, filename);
|
printf("%s: Not enough space to transfer %s\n", pgm, filename);
|
||||||
@ -1736,23 +1833,13 @@ BOOL copy(const BYTE *source, COUNT drive, const BYTE * filename)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
|
||||||
#if defined __WATCOMC__ || defined _MSC_VER /* || defined __BORLANDC__ */
|
#if defined __WATCOMC__ || defined _MSC_VER /* || defined __BORLANDC__ */
|
||||||
#if defined(__WATCOMC__) && __WATCOMC__ < 1280
|
_dos_setftime(fdout, date, time);
|
||||||
unsigned short date, time;
|
|
||||||
#else
|
|
||||||
unsigned date, time;
|
|
||||||
#endif
|
|
||||||
_dos_getftime(fdin, &date, &time);
|
|
||||||
_dos_setftime(fdout, date, time);
|
|
||||||
#elif defined __TURBOC__
|
#elif defined __TURBOC__
|
||||||
struct ftime ftime;
|
setftime(fdout, &ftime);
|
||||||
getftime(fdin, &ftime);
|
|
||||||
setftime(fdout, &ftime);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
close(fdin);
|
/* reduce disk swap on single drives, close file on drive last accessed 1st */
|
||||||
close(fdout);
|
close(fdout);
|
||||||
|
|
||||||
#ifdef __SOME_OTHER_COMPILER__
|
#ifdef __SOME_OTHER_COMPILER__
|
||||||
@ -1766,6 +1853,10 @@ BOOL copy(const BYTE *source, COUNT drive, const BYTE * filename)
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* and close input file, usually same drive as next action will access */
|
||||||
|
close(fdin);
|
||||||
|
|
||||||
|
|
||||||
printf("%lu Bytes transferred\n", copied);
|
printf("%lu Bytes transferred\n", copied);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user