6 * File system for tp tapes. dectape versions have 192
7 * entries, magtape have 496. This treats the same
8 * by ignoring entries with bad header checksums
12 unsigned char name[32];
13 unsigned char mode[2];
16 unsigned char unused[1];
17 unsigned char size[3];
18 unsigned char tmod[4];
19 unsigned char taddress[2];
20 unsigned char unused2[16];
21 unsigned char checksum[2];
30 int i, isabs, badcksum, goodcksum;
35 tapefile = open(name, OREAD);
37 error("Can't open argument file");
38 read(tapefile, dir, sizeof dir);
39 badcksum = goodcksum = 0;
40 for (i=0, tpp=&dir[8]; i<496; i++, tpp++) {
41 unsigned char *sp = (unsigned char *)tpp;
43 for (j=0; j<32; j++, sp+=2)
44 cksum += sp[0] + (sp[1]<<8);
51 if (tpp->name[0]=='\0')
53 f.addr = tpp->taddress[0] + (tpp->taddress[1]<<8);
56 f.size = (tpp->size[0]<<16) + (tpp->size[1]<<0) + (tpp->size[2]<<8);
57 f.mdate = (tpp->tmod[2]<<0) + (tpp->tmod[3]<<8)
58 +(tpp->tmod[0]<<16) + (tpp->tmod[1]<<24);
59 f.mode = tpp->mode[0]&0777;
62 isabs = tpp->name[0]=='/';
63 f.name = (char *)tpp->name+isabs;
66 fprint(2, "%d bad checksums, %d good\n", badcksum, goodcksum);
88 doread(Ram *r, vlong off, long cnt)
90 if (cnt>sizeof(buffer))
91 print("count too big\n");
92 seek(tapefile, 512*r->addr+off, 0);
93 read(tapefile, buffer, cnt);
98 dowrite(Ram *r, char *buf, long off, long cnt)
100 USED(r); USED(buf); USED(off); USED(cnt);