From e32f2e83046435767f3915a5e259fd8e1c79acd1 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 13 Feb 2017 14:51:10 +0000 Subject: Attempts to make CPC output work. --- src/cpcout.c | 37 ++++++++++++++++++++++++++----------- src/example/dump.c | 5 +++++ 2 files changed, 31 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/cpcout.c b/src/cpcout.c index 53496ea..27d5d82 100644 --- a/src/cpcout.c +++ b/src/cpcout.c @@ -170,6 +170,11 @@ int CPCOutput(const char *filename, const char *filename_bank, len = max - min + 1; blocks = len / BLOCK_SIZE; + if ((len % BLOCK_SIZE) == 0) + { + blocks--; + } + for(block = 0; block <= blocks; block++) { int first, last; @@ -177,12 +182,17 @@ int CPCOutput(const char *filename, const char *filename_bank, first = 0; last = 0; - WriteWord(fp, 0x10); - WriteWord(fp, 1000); - WriteWord(fp, 0x40 + 2); + WriteByte(fp, 0x11); /* Block type */ - WriteWord(fp, 0x40); - WriteByte(fp, 0x2c); + WriteWord(fp, 0x09cc); /* PILOT */ + WriteWord(fp, 0x0585); /* SYNC1 */ + WriteWord(fp, 0x04aa); /* SYNC2 */ + WriteWord(fp, 0x0505); /* ZERO */ + WriteWord(fp, 0x0a09); /* ONE */ + WriteWord(fp, 0x1000); /* PILOT LEN */ + WriteByte(fp, 0x08); /* NUM BITS IN LAST BYTE */ + WriteWord(fp, 0x07d0); /* PAUSE */ + Write3(fp, 0x0040); /* LEN */ if (f == 0) { @@ -231,12 +241,17 @@ int CPCOutput(const char *filename, const char *filename_bank, /* Output file data */ - WriteWord(fp, 0x10); - WriteWord(fp, 1000); - WriteWord(fp, blocklen + 5); - - WriteWord(fp, blocklen + 3); - WriteByte(fp, 0x16); + WriteByte(fp, 0x11); /* Block type */ + + WriteWord(fp, 0x09cc); /* PILOT */ + WriteWord(fp, 0x0585); /* SYNC1 */ + WriteWord(fp, 0x04aa); /* SYNC2 */ + WriteWord(fp, 0x0505); /* ZERO */ + WriteWord(fp, 0x0a09); /* ONE */ + WriteWord(fp, 0x1000); /* PILOT LEN */ + WriteByte(fp, 0x08); /* NUM BITS IN LAST BYTE */ + WriteWord(fp, 0x07d0); /* PAUSE */ + Write3(fp, blocklen); /* LEN */ while(min < addr) { diff --git a/src/example/dump.c b/src/example/dump.c index 648aacd..71d153a 100644 --- a/src/example/dump.c +++ b/src/example/dump.c @@ -129,5 +129,10 @@ int main(int argc, char *argv[]) printf("Got %d blocks\n", count); + for(f = 0; f < count; f++) + { + printf("Block %d len %d\n", f, block[f]->len); + } + CompareEnds(block, count); } -- cgit v1.2.3