/* Copyright (C) 1986 by M. J. Shannon, Jr. ** Permission to distribute for non-commercial uses granted as long as this ** notice is retained. Violators will be prosecuted. */ #include #include "mpu/mpu.h" void setavoice(); unsigned char read_buf[256]; /* a buffer to read into */ unsigned char patch_buf[256]; /* a buffer to read into */ int main(argc, argv, envp) int argc; char **argv; char **envp; { char *vers_string; /* reset the MPU */ mpu_reset(); /* get the firmware version/revision */ vers_string = mpu_id(); /* show it to the user */ printf("MPU: %s\n", vers_string); /* enable various options */ mpu_put(SWE_HEXCL); mpu_put(SWE_DATAINSTOP); mpu_put(SWE_TIME); /* and load the patch */ setavoice(); /* return success to DOS */ return (0); } void setavoice() { int length; int i; FILE *fp; char s[256]; getfile:; /* ask for a filename to read the patch from */ printf("File name:"); gets(s); /* to get out, just hit CR */ if (s[0] == '\0') exit(0); /* create the file for binary i/o */ fp = fopen(s, "rb"); /* complain if we couldn't */ if (!fp) { printf("Couldn't open <%s>!\n", s); goto getfile; } /* read it in */ fread(patch_buf, 102, 1, fp); /* close the file */ fclose(fp); printf("Loading..."); mpu_sexcl(patch_buf); printf("\n"); /* read until we get something */ while ((length = mpu_read(&read_buf[0])) == 0) /* tell user we didn't get anything */ printf("Waiting...\n"); printf("Reply was %d bytes:\n", length); for (i = 0; i < length; ++i) printf("%.2x ", read_buf[i]); printf("\n"); }