mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-12-22 17:29:33 +00:00
Merge remote-tracking branch 'refs/remotes/origin/master' into dschmenk/master
This commit is contained in:
commit
62eb8820f5
@ -7,7 +7,7 @@ else
|
||||
BINDIR=$(DESTDIR)/usr/bin
|
||||
SHAREDIR=$(DESTDIR)/usr/share/a2pi
|
||||
endif
|
||||
BIN=a2joy a2joymou a2joypad a2mon a2term fusea2pi a2pidcmd dskread dskwrite bload brun
|
||||
BIN=a2joy a2joymou a2joypad a2mon a2term fusea2pi a2pidcmd dskread dskwrite bload brun nibread dskformat
|
||||
SBIN=a2pid
|
||||
A2PIDEFS=-DSETSERCLK
|
||||
|
||||
|
73
src/dskformat.c
Normal file
73
src/dskformat.c
Normal file
@ -0,0 +1,73 @@
|
||||
#include "a2lib.c"
|
||||
|
||||
char writeblk[] = {
|
||||
// ORG $280
|
||||
0xA0, 0x00, 0xA2, 0xFE, 0x86, 0x60, 0xA6, 0x43, 0x86, 0x2B, 0xBD, 0x89, 0xC0, 0xAD, 0x8B, 0xC0,
|
||||
0x98, 0x85, 0x61, 0x20, 0x0C, 0xD1, 0xA0, 0x07, 0x20, 0x85, 0xD3, 0x88, 0xD0, 0xFA, 0xA6, 0x43,
|
||||
0xAD, 0x81, 0xC0, 0xAD, 0xB1, 0x02, 0xA6, 0x43, 0xBC, 0x88, 0xC0, 0xA9, 0x20, 0x8D, 0xA3, 0x02,
|
||||
0x60, 0xA0, 0x00, 0x84, 0x63, 0xA2, 0x60, 0xBD, 0x8D, 0xC0, 0xBD, 0x8E, 0xC0, 0x10, 0x00, 0xA9,
|
||||
0xFF, 0x9D, 0x8F, 0xC0, 0xCD, 0xEC, 0xC0, 0x85, 0x64, 0xA2, 0x02, 0xEA, 0xEA, 0xEA, 0x20, 0xB6,
|
||||
0x03, 0xC1, 0x00, 0xA5, 0x64, 0x8D, 0xED, 0xC0, 0xCD, 0xEC, 0xC0, 0x88, 0xD0, 0xED, 0xCA, 0xD0,
|
||||
0xEC, 0xA9, 0xD5, 0x20, 0xA1, 0x03, 0xA9, 0xAA, 0x20, 0xA7, 0x03, 0xA9, 0x96, 0x20, 0xA7, 0x03,
|
||||
0xA5, 0x60, 0x20, 0x91, 0x03, 0xA5, 0x61, 0x20, 0x91, 0x03, 0xA5, 0x63, 0x20, 0x91, 0x03, 0xA5,
|
||||
0x60, 0x45, 0x61, 0x45, 0x63, 0x48, 0x4A, 0x09, 0xAA, 0xEA, 0x8D, 0xED, 0xC0, 0xCD, 0xEC, 0xC0,
|
||||
0x68, 0x09, 0xAA, 0x20, 0xA5, 0x03, 0xA9, 0xDE, 0x20, 0xA7, 0x03, 0xA9, 0xAA, 0x20, 0xA7, 0x03,
|
||||
0xA9, 0xEB, 0x20, 0xA7, 0x03, 0xA0, 0x08, 0xA5, 0x64, 0x20, 0xAA, 0x03, 0xC1, 0x00, 0xEA, 0x88,
|
||||
0xD0, 0xF7, 0xA9, 0xD5, 0x20, 0xAB, 0x03, 0xA9, 0xAA, 0x20, 0xA7, 0x03, 0xA9, 0xAD, 0x20, 0xA7,
|
||||
0x03, 0xA0, 0x57, 0xC5, 0xEA, 0xEA, 0xC5, 0xEA, 0xA9, 0x96, 0x20, 0xB0, 0x03, 0x88, 0xD0, 0xF5,
|
||||
0xC5, 0xEA, 0xC5, 0xEA, 0xA9, 0x96, 0x20, 0xB0, 0x03, 0xC8, 0xD0, 0xF5, 0xA9, 0xDE, 0x20, 0xAB,
|
||||
0x03, 0xA9, 0xAA, 0x20, 0xA7, 0x03, 0xA9, 0xEB, 0xE6, 0x63, 0x20, 0xAC, 0x03, 0xA5, 0x63, 0xC9,
|
||||
0x10, 0xF0, 0x11, 0xA0, 0x0F, 0xC1, 0x00, 0xA5, 0x64, 0x8D, 0xED, 0xC0, 0xCD, 0xEC, 0xC0, 0xA2,
|
||||
0x01, 0x4C, 0xCB, 0x02, 0xEA, 0xEA, 0xC1, 0x00, 0xAD, 0xEE, 0xC0, 0xAD, 0xEC, 0xC0, 0x60, 0x38,
|
||||
0x60, 0xEA, 0x48, 0x4A, 0x09, 0xAA, 0x8D, 0xED, 0xC0, 0xCD, 0xEC, 0xC0, 0x68, 0x09, 0xAA, 0xC9,
|
||||
0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC9, 0xC5, 0xEA,
|
||||
0x8D, 0xED, 0xC0, 0xCD, 0xEC, 0xC0, 0x60
|
||||
};
|
||||
#define ORG 0x280
|
||||
#define TRACK_NUM 0x281
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *dskfile;
|
||||
char count[2], volname[21];
|
||||
long fsize;
|
||||
int i, result, fd, etrk;
|
||||
int pifd = a2open(argc > 2 ? argv[2] : "127.0.0.1");
|
||||
if (pifd < 0)
|
||||
{
|
||||
perror("Unable to connect to Apple II Pi");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (argc < 2)
|
||||
{
|
||||
perror("Usage: dskformat <end track> [ip address]\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
sleep(1);
|
||||
fflush(stdin);
|
||||
|
||||
if (argv[1])
|
||||
{
|
||||
etrk = atoi(argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
perror("Please type end track to format\n");
|
||||
a2close(pifd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
count[0] = 0;
|
||||
a2write(pifd, ORG, sizeof(writeblk), writeblk);
|
||||
a2write(pifd, TRACK_NUM, 1, count);
|
||||
a2call(pifd, ORG, &result);
|
||||
for (i = 0; i < etrk; i++)
|
||||
{
|
||||
printf("Formating Track #%d\r", i);
|
||||
fflush(stdout);
|
||||
count[0] = i;
|
||||
a2write(pifd, TRACK_NUM, 1, count);
|
||||
a2call(pifd, ORG, &result);
|
||||
}
|
||||
a2close(pifd);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
159
src/dskread.c
159
src/dskread.c
@ -1,66 +1,93 @@
|
||||
#include "a2lib.c"
|
||||
|
||||
char online[] = {
|
||||
// ORG $301
|
||||
0x20, 0x00, 0xBF, // JSR $BF00 (PRODOS)
|
||||
0xC5, // DB ON_LINE
|
||||
0x08, 0x03, // DW PARAMS
|
||||
0x60, // RTS
|
||||
// PARAMS @ $308
|
||||
0x02, // PARAM_COUNT
|
||||
0x60, // UNIT_NUM = DRIVE 0, SLOT 6
|
||||
0x00, 0x20 // DATA_BUFFER = $2000
|
||||
};
|
||||
char readblk[] = {
|
||||
// ORG $301
|
||||
0x20, 0x00, 0xBF, // JSR $BF00 (PRODOS)
|
||||
0x80, // DB READ_BLOCK
|
||||
0x08, 0x03, // DW PARAMS
|
||||
0x60, // RTS
|
||||
// PARAMS @ $308
|
||||
0x03, // PARAM_COUNT
|
||||
0x60, // UNIT_NUM = DRIVE 0, SLOT 6
|
||||
0x00, 0x20, // DATA_BUFFER = $2000
|
||||
0x00, 0x00 // BLOCK_NUM
|
||||
};
|
||||
#define ORG 0x0301
|
||||
#define BLOCK_NUM 0x030C
|
||||
#define DATA_BUFFER 0x2000
|
||||
char dsk[280][512];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *dskfile;
|
||||
char count[2], volname[21];
|
||||
int i, result, fd;
|
||||
int pifd = a2open(argc > 1 ? argv[1] : "127.0.0.1");
|
||||
if (pifd < 0)
|
||||
{
|
||||
perror("Unable to connect to Apple II Pi");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
a2write(pifd, ORG, sizeof(online), online);
|
||||
a2call(pifd, ORG, &result);
|
||||
a2read(pifd, DATA_BUFFER, 16, volname);
|
||||
volname[(volname[0] & 0x0F) + 1] = '\0';
|
||||
printf("Volume name:%s\n", volname + 1);
|
||||
strcat(volname + 1, ".PO");
|
||||
a2write(pifd, ORG, sizeof(readblk), readblk);
|
||||
for (i = 0; i < 280; i++)
|
||||
{
|
||||
printf("Reading block #%d\r", i);
|
||||
fflush(stdout);
|
||||
count[0] = i;
|
||||
count[1] = i >> 8;
|
||||
a2write(pifd, BLOCK_NUM, 2, count);
|
||||
a2call(pifd, ORG, &result);
|
||||
a2read(pifd, DATA_BUFFER, 512, dsk[i]);
|
||||
}
|
||||
a2close(pifd);
|
||||
if ((dskfile = fopen(volname + 1, "wb")))
|
||||
{
|
||||
fwrite(dsk, 1, 280*512, dskfile);
|
||||
fclose(dskfile);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#include "a2lib.c"
|
||||
|
||||
char online[] = {
|
||||
// ORG $301
|
||||
0x20, 0x00, 0xBF, // JSR $BF00 (PRODOS)
|
||||
0xC5, // DB ON_LINE
|
||||
0x08, 0x03, // DW PARAMS
|
||||
0x60, // RTS
|
||||
// PARAMS @ $308
|
||||
0x02, // PARAM_COUNT
|
||||
0x60, // UNIT_NUM = DRIVE 0, SLOT 6
|
||||
0x00, 0x20 // DATA_BUFFER = $2000
|
||||
};
|
||||
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
|
||||
};
|
||||
char readblk[] = {
|
||||
// ORG $301
|
||||
0x20, 0x00, 0xBF, // JSR $BF00 (PRODOS)
|
||||
0x80, // DB READ_BLOCK
|
||||
0x08, 0x03, // DW PARAMS
|
||||
0x60, // RTS
|
||||
// PARAMS @ $308
|
||||
0x03, // PARAM_COUNT
|
||||
0x60, // UNIT_NUM = DRIVE 0, SLOT 6
|
||||
0x00, 0x20, // DATA_BUFFER = $2000
|
||||
0x00, 0x00 // BLOCK_NUM
|
||||
};
|
||||
#define ORG 0x0301
|
||||
#define BLOCK_NUM 0x030C
|
||||
#define DATA_BUFFER 0x2000
|
||||
char dsk[320][512];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *dskfile;
|
||||
char count[2], volname[21];
|
||||
char noname[] = "_NONAME";
|
||||
int i, result, fd, trk, pifd;
|
||||
if (argc > 1)
|
||||
{
|
||||
i = strtol(argv[1],NULL,10);
|
||||
pifd = a2open(i > 41 ? argv[1] : "127.0.0.1");
|
||||
trk = (i < 41 ? i : 35);
|
||||
}
|
||||
else
|
||||
{
|
||||
pifd = a2open("127.0.0.1");
|
||||
trk = 35;
|
||||
}
|
||||
if (pifd < 0)
|
||||
{
|
||||
perror("Unable to connect to Apple II Pi");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
a2write(pifd, ORG, sizeof(chgmtrk), chgmtrk);
|
||||
a2call(pifd, ORG, &result);
|
||||
|
||||
a2write(pifd, ORG, sizeof(online), online);
|
||||
a2call(pifd, ORG, &result);
|
||||
a2read(pifd, DATA_BUFFER, 16, volname);
|
||||
volname[(volname[0] & 0x0F) + 1] = '\0';
|
||||
printf("%x\n",volname[0]);
|
||||
printf("%x\n",volname);
|
||||
if ( !isprint(volname[1]) )
|
||||
{
|
||||
strcpy(volname, noname);
|
||||
printf("NO VOL NAME OR HEX VOL\n");
|
||||
}
|
||||
printf("Volume name:%s\n", volname +1);
|
||||
strcat(volname + 1, ".PO");
|
||||
a2write(pifd, ORG, sizeof(readblk), readblk);
|
||||
for (i = 0; i < trk*8; i++)
|
||||
{
|
||||
printf("Reading block #%d\r", i);
|
||||
fflush(stdout);
|
||||
count[0] = i;
|
||||
count[1] = i >> 8;
|
||||
a2write(pifd, BLOCK_NUM, 2, count);
|
||||
a2call(pifd, ORG, &result);
|
||||
a2read(pifd, DATA_BUFFER, 512, dsk[i]);
|
||||
}
|
||||
a2close(pifd);
|
||||
if ((dskfile = fopen(volname + 1, "wb")))
|
||||
{
|
||||
fwrite(dsk, 1, trk*8*512, dskfile);
|
||||
fclose(dskfile);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
197
src/dskwrite.c
197
src/dskwrite.c
@ -1,88 +1,109 @@
|
||||
#include "a2lib.c"
|
||||
|
||||
char online[] = {
|
||||
// ORG $301
|
||||
0x20, 0x00, 0xBF, // JSR $BF00 (PRODOS)
|
||||
0xC5, // DB ON_LINE
|
||||
0x08, 0x03, // DW PARAMS
|
||||
0x60, // RTS
|
||||
// PARAMS @ $308
|
||||
0x02, // PARAM_COUNT
|
||||
0x60, // UNIT_NUM = DRIVE 0, SLOT 6
|
||||
0x00, 0x20 // DATA_BUFFER = $2000
|
||||
};
|
||||
char writeblk[] = {
|
||||
// ORG $301
|
||||
0x20, 0x00, 0xBF, // JSR $BF00 (PRODOS)
|
||||
0x81, // DB WRITE_BLOCK
|
||||
0x08, 0x03, // DW PARAMS
|
||||
0x60, // RTS
|
||||
// PARAMS @ $308
|
||||
0x03, // PARAM_COUNT
|
||||
0x60, // UNIT_NUM = DRIVE 0, SLOT 6
|
||||
0x00, 0x20, // DATA_BUFFER = $2000
|
||||
0x00, 0x00 // BLOCK_NUM
|
||||
};
|
||||
#define ORG 0x0301
|
||||
#define BLOCK_NUM 0x030C
|
||||
#define DATA_BUFFER 0x2000
|
||||
char dsk[280][512];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *dskfile;
|
||||
char count[2], volname[21];
|
||||
int i, result, fd;
|
||||
int pifd = a2open(argc > 2 ? argv[2] : "127.0.0.1");
|
||||
if (pifd < 0)
|
||||
{
|
||||
perror("Unable to connect to Apple II Pi");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (argc < 2)
|
||||
{
|
||||
perror("Usage: dskwrite <filename> [ip address]\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
sleep(1);
|
||||
fflush(stdin);
|
||||
a2write(pifd, ORG, sizeof(online), online);
|
||||
a2call(pifd, ORG, &result);
|
||||
if (result == 0)
|
||||
{
|
||||
a2read(pifd, DATA_BUFFER, 16, volname);
|
||||
volname[(volname[0] & 0x0F) + 1] = '\0';
|
||||
printf("Are you sure you want to overwrite volume :%s?", volname + 1);
|
||||
fflush(stdout);
|
||||
fgets(count, 2, stdin);
|
||||
if (count[0] != 'y' && count[0] != 'Y')
|
||||
{
|
||||
a2close(pifd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if ((dskfile = fopen(argv[1], "rb")))
|
||||
{
|
||||
fread(dsk, 1, 280*512, dskfile);
|
||||
fclose(dskfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
perror("Unable to read .PO file\n");
|
||||
a2close(pifd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
a2write(pifd, ORG, sizeof(writeblk), writeblk);
|
||||
for (i = 0; i < 280; i++)
|
||||
{
|
||||
printf("Writing block #%d\r", i);
|
||||
fflush(stdout);
|
||||
count[0] = i;
|
||||
count[1] = i >> 8;
|
||||
a2write(pifd, DATA_BUFFER, 512, dsk[i]);
|
||||
a2write(pifd, BLOCK_NUM, 2, count);
|
||||
a2call(pifd, ORG, &result);
|
||||
}
|
||||
a2close(pifd);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#include "a2lib.c"
|
||||
|
||||
char online[] = {
|
||||
// ORG $301
|
||||
0x20, 0x00, 0xBF, // JSR $BF00 (PRODOS)
|
||||
0xC5, // DB ON_LINE
|
||||
0x08, 0x03, // DW PARAMS
|
||||
0x60, // RTS
|
||||
// PARAMS @ $308
|
||||
0x02, // PARAM_COUNT
|
||||
0x60, // UNIT_NUM = DRIVE 0, SLOT 6
|
||||
0x00, 0x20 // DATA_BUFFER = $2000
|
||||
};
|
||||
char writeblk[] = {
|
||||
// ORG $301
|
||||
0x20, 0x00, 0xBF, // JSR $BF00 (PRODOS)
|
||||
0x81, // DB WRITE_BLOCK
|
||||
0x08, 0x03, // DW PARAMS
|
||||
0x60, // RTS
|
||||
// PARAMS @ $308
|
||||
0x03, // PARAM_COUNT
|
||||
0x60, // UNIT_NUM = DRIVE 0, SLOT 6
|
||||
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[320][512];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *dskfile;
|
||||
char count[2], volname[21];
|
||||
long fsize;
|
||||
int i, result, fd, dblock;
|
||||
int pifd = a2open(argc > 2 ? argv[2] : "127.0.0.1");
|
||||
if (pifd < 0)
|
||||
{
|
||||
perror("Unable to connect to Apple II Pi");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (argc < 2)
|
||||
{
|
||||
perror("Usage: dskwrite <filename> [ip address]\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
sleep(1);
|
||||
fflush(stdin);
|
||||
|
||||
a2write(pifd, ORG, sizeof(online), online);
|
||||
a2call(pifd, ORG, &result);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
a2read(pifd, DATA_BUFFER, 16, volname);
|
||||
volname[(volname[0] & 0x0F) + 1] = '\0';
|
||||
printf("Are you sure you want to overwrite volume :%s?", volname + 1);
|
||||
fflush(stdout);
|
||||
fgets(count, 2, stdin);
|
||||
if (count[0] != 'y' && count[0] != 'Y')
|
||||
{
|
||||
a2close(pifd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
a2write(pifd, ORG, sizeof(chgmtrk), chgmtrk);
|
||||
a2call(pifd, ORG, &result);
|
||||
|
||||
if ((dskfile = fopen(argv[1], "rb")))
|
||||
{
|
||||
|
||||
fseek(dskfile, 0, SEEK_END);
|
||||
fsize = ftell(dskfile);
|
||||
fseek(dskfile, 0 , SEEK_SET);
|
||||
|
||||
dblock = fsize / 512;
|
||||
fread(dsk, 1, fsize , dskfile);
|
||||
fclose(dskfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
perror("Unable to read .PO file\n");
|
||||
a2close(pifd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
a2write(pifd, ORG, sizeof(writeblk), writeblk);
|
||||
|
||||
for (i = 0; i < dblock; i++)
|
||||
{
|
||||
printf("Writing block #%d\r", i);
|
||||
fflush(stdout);
|
||||
count[0] = i;
|
||||
count[1] = i >> 8;
|
||||
a2write(pifd, DATA_BUFFER, 512, dsk[i]);
|
||||
a2write(pifd, BLOCK_NUM, 2, count);
|
||||
a2call(pifd, ORG, &result);
|
||||
}
|
||||
|
||||
a2close(pifd);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
68
src/nibread.c
Normal file
68
src/nibread.c
Normal file
@ -0,0 +1,68 @@
|
||||
#include "a2lib.c"
|
||||
#include "stdlib.h"
|
||||
|
||||
char readblk[] = {
|
||||
// ORG $2C0
|
||||
0xA0, 0x00, 0xA6, 0x43, 0x86, 0x2B, 0xBD, 0x89, 0xC0, 0xAD, 0x8B, 0xC0, 0x98, 0x20, 0x0C, 0xD1,
|
||||
0xA0, 0x07, 0x20, 0x85, 0xD3, 0x88, 0xD0, 0xFA, 0xA6, 0x43, 0xAD, 0x81, 0xC0, 0x20, 0xE6, 0x02,
|
||||
0xA6, 0x43, 0xBC, 0x88, 0xC0, 0x60, 0xA9, 0x24, 0x85, 0x45, 0xA9, 0x00, 0x85, 0x44, 0x85, 0x3A,
|
||||
0xA0, 0x00, 0xC6, 0x44, 0xD0, 0x04, 0xC6, 0x45, 0x30, 0x1F, 0xBD, 0x8C, 0xC0, 0x10, 0xFB, 0xDD,
|
||||
0x8C, 0xC0, 0xF0, 0x02, 0xD0, 0xEA, 0xC8, 0xC0, 0x18, 0xD0, 0xEF, 0x85, 0x3A, 0xBD, 0x8C, 0xC0,
|
||||
0x10, 0xFB, 0xC5, 0x3A, 0xF0, 0xF7, 0x85, 0x3B, 0xC8, 0xA9, 0x20, 0x85, 0x45, 0xA9, 0x00, 0x85,
|
||||
0x44, 0xBD, 0x8C, 0xC0, 0x10, 0xFB, 0x91, 0x44, 0xC8, 0xD0, 0xF6, 0xE6, 0x45, 0xA5, 0x45, 0xC9,
|
||||
0x3B, 0xD0, 0xEE, 0xA5, 0x3A, 0xF0, 0x5A, 0xA4, 0x3B, 0x8C, 0x18, 0x20, 0xA0, 0x17, 0x99, 0x00,
|
||||
0x20, 0x88, 0x10, 0xFA, 0xC8, 0xC8, 0xF0, 0x49, 0xB9, 0x18, 0x20, 0xC5, 0x3A, 0xF0, 0xF6, 0x98,
|
||||
0x18, 0x69, 0x18, 0x8D, 0x63, 0x03, 0xA9, 0x35, 0x85, 0x45, 0xA9, 0x00, 0x85, 0x44, 0xA8, 0xAA,
|
||||
0xB1, 0x44, 0xDD, 0x18, 0x20, 0xD0, 0x07, 0xE0, 0x0B, 0xF0, 0x12, 0xE8, 0xD0, 0x02, 0xA2, 0x00,
|
||||
0xC8, 0xD0, 0xED, 0xE6, 0x45, 0xA5, 0x45, 0xC9, 0x3B, 0xD0, 0xE5, 0xF0, 0x14, 0x98, 0x38, 0xE9,
|
||||
0x0B, 0xA8, 0xA5, 0x3A, 0x91, 0x44, 0xC8, 0xD0, 0xFB, 0xE6, 0x45, 0xA5, 0x45, 0xC9, 0x3B, 0x90,
|
||||
0xF1, 0x60
|
||||
};
|
||||
#define ORG 0x02C0
|
||||
#define TRACK_NUM 0x02C1
|
||||
#define DATA_BUFFER 0x2000
|
||||
char dsk[42][6656];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *dskfile;
|
||||
char count[2];
|
||||
int i, result, fd, trk, pifd;
|
||||
if (argc > 1)
|
||||
{
|
||||
i = strtol(argv[1],NULL,10);
|
||||
pifd = a2open(i > 43 ? argv[1] : "127.0.0.1");
|
||||
trk = (i < 43 ? i : 35);
|
||||
}
|
||||
else
|
||||
{
|
||||
pifd = a2open("127.0.0.1");
|
||||
trk = 35;
|
||||
}
|
||||
if (pifd < 0)
|
||||
{
|
||||
perror("Unable to connect to Apple II Pi");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
char volname[] = "nibble.nib";
|
||||
a2write(pifd, ORG, sizeof(readblk), readblk);
|
||||
count[0] = 0;
|
||||
a2write(pifd, TRACK_NUM, 1, count);
|
||||
a2call(pifd, ORG, &result);
|
||||
for (i = 0; i < trk; i++)
|
||||
{
|
||||
printf("Reading Track #%d\r", i);
|
||||
fflush(stdout);
|
||||
count[0] = i;
|
||||
a2write(pifd, TRACK_NUM, 1, count);
|
||||
a2call(pifd, ORG, &result);
|
||||
a2read(pifd, DATA_BUFFER, 6656, dsk[i]);
|
||||
}
|
||||
a2close(pifd);
|
||||
if ((dskfile = fopen(volname, "wb")))
|
||||
{
|
||||
fwrite(dsk, 1, trk*6656, dskfile);
|
||||
fclose(dskfile);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user