Esempio n. 1
0
//// UploadKickstart() ////
char UploadKickstart(char *name)
{
  int keysize=0;
  char filename[12];

  strncpy(filename, name, 8); // copy base name
  strcpy(&filename[8], "ROM"); // add extension

  BootPrint("Checking for Amiga Forever key file:");
  if(FileOpen(&file,"ROM     KEY")) {
    keysize=file.size;
    if(file.size<sizeof(romkey)) {
      int c=0;
      while(c<keysize) {
        FileRead(&file, &romkey[c]);
        c+=512;
        FileNextSector(&file);
      }
      BootPrint("Loaded Amiga Forever key file");
    } else {
      BootPrint("Amiga Forever keyfile is too large!");
    }
  }
  BootPrint("Loading file: ");
  BootPrint(filename);

  if (RAOpen(&romfile, filename)) {
    if (romfile.size == 0x100000) {
      // 1MB Kickstart ROM
      BootPrint("Uploading 1MB Kickstart ...");
      SendFileV2(&romfile, NULL, 0, 0xe00000, romfile.size>>10);
      SendFileV2(&romfile, NULL, 0, 0xf80000, romfile.size>>10);
      return(1);
    } else if(romfile.size == 0x80000) {
Esempio n. 2
0
//// UploadKickstart() ////
char UploadKickstart(char *name)
{
  int keysize=0;
  char filename[12];

  strncpy(filename, name, 8); // copy base name
  strcpy(&filename[8], "ROM"); // add extension

  BootPrint("Checking for Amiga Forever key file:");
  if(FileOpen(&file,"ROM     KEY")) {
    keysize=file.size;
    if(file.size<sizeof(romkey)) {
      int c=0;
      while(c<keysize) {
        FileRead(&file, &romkey[c]);
        c+=512;
        FileNextSector(&file);
      }
      BootPrint("Loaded Amiga Forever key file");
    } else {
      BootPrint("Amiga Forever keyfile is too large!");
    }
  }
  BootPrint("Loading file: ");
  BootPrint(filename);

  if(minimig_v1()) {
    if (RAOpen(&romfile, filename)) {
      if (romfile.size == 0x80000) {
        // 512KB Kickstart ROM
        BootPrint("Uploading 512 KB Kickstart...");
        PrepareBootUpload(0xF8, 0x08);
        SendFile(&romfile);
        return(1);
      } else if ((romfile.size == 0x8000b) && keysize) {
        // 512KB Kickstart ROM
        BootPrint("Uploading 512 KB Kickstart (Probably Amiga Forever encrypted...)");
        PrepareBootUpload(0xF8, 0x08);
        SendFileEncrypted(&romfile,romkey,keysize);
        return(1);
      } else if (romfile.size == 0x40000) {
        // 256KB Kickstart ROM
        BootPrint("Uploading 256 KB Kickstart...");
        PrepareBootUpload(0xF8, 0x04);
        SendFile(&romfile);
        return(1);
      } else if ((romfile.size == 0x4000b) && keysize) {
        // 256KB Kickstart ROM
        BootPrint("Uploading 256 KB Kickstart (Probably Amiga Forever encrypted...");
        PrepareBootUpload(0xF8, 0x04);
        SendFileEncrypted(&romfile,romkey,keysize);
        return(1);
      } else {
        BootPrint("Unsupported ROM file size!");
      }
    } else {
      siprintf(s, "No \"%s\" file!", filename);
      BootPrint(s);
    }
  } else {
    if (RAOpen(&romfile, filename)) {
      int i,j;
      unsigned int adr, size, base=0x180000, offset=0xc00000, data;
      puts("Uploading 512KB Kickstart ...");
      size = ((romfile.file.size)+511)>>9;
      iprintf("File size: %d.%01dkB\r", romfile.file.size>>10, romfile.file.size&0x3ff);
      iprintf("[");
      for (i=0; i<size; i++) {
        if (!(i&31)) iprintf("*");
        RARead(&romfile,sector_buffer,512);
        EnableOsd();
        adr = 0xf80000 + i*512;
        SPI(OSD_CMD_WR);
        SPIN(); SPIN(); SPIN(); SPIN();
        SPI(adr&0xff); adr = adr>>8;
        SPI(adr&0xff); adr = adr>>8;
        SPIN(); SPIN(); SPIN(); SPIN();
        SPI(adr&0xff); adr = adr>>8;
        SPI(adr&0xff); adr = adr>>8;
        SPIN(); SPIN(); SPIN(); SPIN();
        for (j=0; j<512; j=j+4) {
          SPI(sector_buffer[j+0]);
          SPI(sector_buffer[j+1]);
          SPIN(); SPIN(); SPIN(); SPIN(); SPIN(); SPIN(); SPIN(); SPIN();
          SPI(sector_buffer[j+2]);
          SPI(sector_buffer[j+3]);
          SPIN(); SPIN(); SPIN(); SPIN(); SPIN(); SPIN(); SPIN(); SPIN();
        }
        DisableOsd();
      }
      iprintf("]\r");
      return(1);
    }
  }