Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1088 alone 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
            t.hdr[s].datlen = 0;
28
         }
29
         t.format();
30
      }
31
   }
32
}
33
 
34
int FDD::read_isd()
35
{
36
   static const unsigned char sn[] = { 1, 2, 3, 4, 9 };
37
 
38
   format_isd();
39
 
40
   for(unsigned c = 0; c < cyls; c++)
41
   {
42
      for (unsigned h = 0; h < 2; h++)
43
      {
44
         for (unsigned s = 0; s < 5; s++)
45
         {
46
            t.seek(this, c, h, LOAD_SECTORS);
47
            t.write_sector(sn[s], 3, snbuf+(c*10 + h*5 + s)*1024);
48
         }
49
      }
50
   }
51
   return 1;
52
}
53
 
54
int FDD::write_isd(FILE *ff)
55
{
56
   for(unsigned c = 0; c < 80; c++)
57
   {
58
      for(unsigned h = 0; h < 2; h++)
59
      {
60
          t.seek(this, c, h, LOAD_SECTORS);
61
          for(unsigned s = 0; s < 5; s++)
62
          {
63
              if (fwrite(t.hdr[s].data, 1, 1024, ff) != 1024)
64
                 return 0;
65
          }
66
      }
67
   }
68
   return 1;
69
}