diff options
author | Ian C <ianc@noddybox.co.uk> | 2017-02-13 14:51:10 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2017-02-13 14:51:10 +0000 |
commit | e32f2e83046435767f3915a5e259fd8e1c79acd1 (patch) | |
tree | 03fa2074913462992611eef4afde54e55dcb1c07 /src | |
parent | a3beda2846259a26487f125323b85930628db99f (diff) |
Attempts to make CPC output work.
Diffstat (limited to 'src')
-rw-r--r-- | src/cpcout.c | 37 | ||||
-rw-r--r-- | src/example/dump.c | 5 |
2 files changed, 31 insertions, 11 deletions
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); } |