add 40 track support

This commit is contained in:
ivanli88 2017-11-03 17:17:56 +08:00 committed by GitHub
parent 7269966299
commit e8d7907a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,16 +23,24 @@ char writeblk[] = {
0x00, 0x20, // DATA_BUFFER = $2000
0x00, 0x00 // BLOCK_NUM
};
char chgmtrk[] = {
// ORG $301
0xAD, 0x8B, 0xC0, 0xAD, 0x8B, 0xC0, 0xAD, 0xE3,
0xD6, 0xC9, 0x18, 0xD0, 0x05, 0xA9, 0x40, 0x8D,
0xE3, 0xD6, 0xAD, 0x81, 0xC0, 0x60
};
#define ORG 0x0301
#define BLOCK_NUM 0x030C
#define DATA_BUFFER 0x2000
char dsk[280][512];
char dsk[320][512];
int main(int argc, char **argv)
{
FILE *dskfile;
char count[2], volname[21];
int i, result, fd;
long fsize;
int i, result, fd, dblock;
int pifd = a2open(argc > 2 ? argv[2] : "127.0.0.1");
if (pifd < 0)
{
@ -46,8 +54,10 @@ int main(int argc, char **argv)
}
sleep(1);
fflush(stdin);
a2write(pifd, ORG, sizeof(online), online);
a2call(pifd, ORG, &result);
if (result == 0)
{
a2read(pifd, DATA_BUFFER, 16, volname);
@ -61,9 +71,18 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
}
a2write(pifd, ORG, sizeof(chgmtrk), chgmtrk);
a2call(pifd, ORG, &result);
if ((dskfile = fopen(argv[1], "rb")))
{
fread(dsk, 1, 280*512, dskfile);
fseek(dskfile, 0, SEEK_END);
fsize = ftell(dskfile);
fseek(dskfile, 0 , SEEK_SET);
dblock = fsize / 512;
fread(dsk, 1, fsize , dskfile);
fclose(dskfile);
}
else
@ -73,7 +92,8 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
a2write(pifd, ORG, sizeof(writeblk), writeblk);
for (i = 0; i < 280; i++)
for (i = 0; i < dblock; i++)
{
printf("Writing block #%d\r", i);
fflush(stdout);
@ -83,6 +103,7 @@ int main(int argc, char **argv)
a2write(pifd, BLOCK_NUM, 2, count);
a2call(pifd, ORG, &result);
}
a2close(pifd);
return EXIT_SUCCESS;
}