Subversion Repositories pentevo

Rev

Rev 796 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include "std.h"
  2.  
  3. #include "emul.h"
  4. #include "vars.h"
  5.  
  6. #include "util.h"
  7.  
  8. void FDD::format_isd()
  9. {
  10.    static const unsigned char sn[] = { 1, 2, 3, 4, 9 };
  11.  
  12.    newdisk(80, 2);
  13.  
  14.    for(unsigned c = 0; c < cyls; c++)
  15.    {
  16.       for (unsigned h = 0; h < 2; h++)
  17.       {
  18.          t.seek(this, c, h, JUST_SEEK);
  19.          t.s = 5;
  20.          for(unsigned s = 0; s < 5; s++)
  21.          {
  22.             unsigned n = sn[s];
  23.             t.hdr[s].n = u8(n); t.hdr[s].l = 3;
  24.             t.hdr[s].c = u8(c); t.hdr[s].s = 0;
  25.             t.hdr[s].c1 = t.hdr[s].c2 = 0;
  26.             t.hdr[s].data = (unsigned char*)1;
  27.          }
  28.          t.format();
  29.       }
  30.    }
  31. }
  32.  
  33. int FDD::read_isd()
  34. {
  35.    static const unsigned char sn[] = { 1, 2, 3, 4, 9 };
  36.  
  37.    format_isd();
  38.  
  39.    for(unsigned c = 0; c < cyls; c++)
  40.    {
  41.       for (unsigned h = 0; h < 2; h++)
  42.       {
  43.          for (unsigned s = 0; s < 5; s++)
  44.          {
  45.             t.seek(this, c, h, LOAD_SECTORS);
  46.             t.write_sector(sn[s], snbuf+(c*10 + h*5 + s)*1024);
  47.          }
  48.       }
  49.    }
  50.    return 1;
  51. }
  52.  
  53. int FDD::write_isd(FILE *ff)
  54. {
  55.    for(unsigned c = 0; c < 80; c++)
  56.    {
  57.       for(unsigned h = 0; h < 2; h++)
  58.       {
  59.           t.seek(this, c, h, LOAD_SECTORS);
  60.           for(unsigned s = 0; s < 5; s++)
  61.           {
  62.               if (fwrite(t.hdr[s].data, 1, 1024, ff) != 1024)
  63.                  return 0;
  64.           }
  65.       }
  66.    }
  67.    return 1;
  68. }
  69.