Ejemplo n.º 1
0
static void default_entry(unsigned char *b)
{
	printf("\nDefault entry\n");
	report("  Boot Indicator", "%02X (%s)", *b, get_boot(*b)); b++;
	report("  Boot Media Type", "%X (%s)", *b, get_media(*b)); b++;
	report("  Load Segment", "%02X %02X", b[0], b[1]); b += 2;
	report("  System Type", "%02X", *b); b++;
	b++;			/* unused */
	report_16("  Sector Count", b); b += 2;
	report_32("  Load RBA", b); b += 2;
	report("  Selection criteria", "%02X (%s)", *b, get_selection(*b)); b++;
}
Ejemplo n.º 2
0
VOID main(COUNT argc, char **argv)
{
  if (argc != 2)
  {
    fprintf(stderr, "Usage: %s drive\n drive = A,B,etc.\n", pgm);
    exit(1);
  }

  drive = *argv[1] - (islower(*argv[1]) ? 'a' : 'A');
  if (drive < 0 || drive >= NDEV)
  {
    fprintf(stderr, "%s: drive out of range\n", pgm);
    exit(1);
  }

  if (!DiskReset(drive))
  {
    fprintf(stderr, "%s: cannot reset drive %c:",
            drive, 'A' + drive);
    exit(1);
  }

  get_boot(drive);

  if (!check_space(drive, oldboot))
  {
    fprintf(stderr, "%s: Not enough space to transfer system files\n", pgm);
    exit(1);
  }

#ifdef DEBUG
  if ((log = fopen("sys.log", "w")) == NULL)
  {
    printf("Can't write log file.\n");
    log = NULL;
  }
#endif

  printf("Writing boot sector...\n");
  put_boot(drive);

  printf("\nCopying KERNEL.SYS...");
  if (!copy(drive, "kernel.sys"))
  {
    fprintf(stderr, "\n%s: cannot copy \"KERNEL.SYS\"\n", pgm);
#ifdef DEBUG
    fclose(log);
#endif
    exit(1);
  }

  printf("\nCopying COMMAND.COM...");
  if (!copy(drive, "command.com"))
  {
    fprintf(stderr, "\n%s: cannot copy \"COMMAND.COM\"\n", pgm);
#ifdef DEBUG
    fclose(log);
#endif
    exit(1);
  }
  printf("\nSystem transfered.\n");
#ifdef DEBUG
  fclose(log);
#endif
  exit(0);
}