From: barrett@astro.cs.umass.edu (Daniel Barrett) Subject: Re: Wanted: Code to header to DX7 4096 Byte Dumps Date: 14 Jan 93 18:36:21 GMT In article <1993Jan14.113207.8916@tpl68k0.tplrd.tpl.oz.au> markb@tplrd.tpl.oz.au (Mark Bower) writes: >Does anyone have any program code (amiga or generic C) to add sysex >bytes and checksums to yamaha DX7 4096 byte patch dumps ? I've got >heaps of patches in this format.... Let me guess... you got them from ucsd.edu, right? :-) Here is some pseudocode that shows you how to do it. BTW, I have a compiled program that works for these particular patches, using similar code. Mail me if you want a copy. It is a real hack, not robust at all, but it works. It's been sitting in a directory for years, unused, so it's not been tested on accelerated machines nor under 2.0, but I strongly suspect it works. Dan //////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ | Dan Barrett -- Dept of Computer Science, Lederle Graduate Research Center | | University of Massachusetts, Amherst, MA 01003 -- barrett@cs.umass.edu | \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///////////////////////////////////// ------------8<----------------- cut here ----------------8<------------------ /* Here's a little program to take a DX7 patch file whose header and checksum * have been stripped off, and replace them. * * This program has NOT been tested extensively and is NOT robust. * It works ONLY if the original file size is 4096 bytes. * It is specifically written for files in the ucsd.edu DX7 patch archive. * * You might need to change the "r" and "w" in the fopen() calls in AddIt() * to "rb" and "wb" for computers (like the IBM PC) that need special * handling for binary vs. text files. * * Dan Barrett, barrett@cs.umass.edu, Public Domain. * * Usage: addit oldfile newfile */ #include typedef unsigned char UBYTE; #define DX_FILESIZE 4096L /* Size of the patch file. */ #define EOX 0xF7 /* End of system exclusive. */ #define HEADER_SIZE 6 /* Size of system exclusive header. */ UBYTE header[HEADER_SIZE] = { 0xF0, 67, 0, 9, 16, 0 }; UBYTE MakeChecksum(); void AddIt(), Update(); main(argc,argv) int argc; char *argv[]; { if (argc != 3) { fprintf(stderr, "Syntax: %s oldfile newfile\n", argv[0]); exit(1); } else AddIt(argv[1], argv[2]); exit(0); } UBYTE MakeChecksum(patchData) /* Given your array of patch data, compute and return the checksum. */ UBYTE patchData[]; { UBYTE sum; int i; sum = 0; for (i=0; i