Exemplo n.º 1
0
upload(unsigned char tonebyte[NPATCH][NCODPARAM])		/* send sets of patch data to synth */
{
	int n, i;

	clearsc();
	puts("        Upload - Send 64 patches in memory to synth.\n\n");
	puts("Make sure your synth has MIDI EXCL turned on.\n");
	puts("Also set the protect switch in back to the OFF position.\n");
	puts("   (Hitting the ESC key will terminate transmission)\n");

	putcmd(UART);		/* tell MPU401 to go into simple UART mode */

	for (i = 0; i < 10; i++){	/* make ten attempts to send data */
		puts("Hold DATA TRANSFER key down and press BULK LOAD key on synth.");

		n = getexcl();
		if (n == MIDRQF){
			clearsc();
			puts("Received request for data message, proceeding with load.");
			break;
		} else if (n == -2){	/* user hit ESC */
			putcmd(SYSRESET);
			return(1);
		} else {
			puts("*** Did not get request for data, try again. ****");
		}
	}
	if ( n != MIDRQF){
		writerr("Failed ten attempts to send. Aborting transmission.");
		putcmd(SYSRESET);
		return(1);
	}

	sendexcl(MIDWSF);
	n = getexcl();
	if (n != MIDACK)
		puts("Did not get ACK message after sending WSF.");

	n = sendtones(tonebyte);				/* send all patches */
	putcmd(SYSRESET);				/* put MPU401 back into normal mode */


	if (n == MIDACK)
		puts("Synth acknowledged data receipt was ok.");
	else if (n == -1){			/* user hit ESC key */
		writerr("Upload terminated. ");
		return(-1);
	} else {
		puts("Synth did not acknowledge final data receipt.");
		puts("Check data before saving, or resend.");
	}

	writerr(" ");
	return(1);
}
Exemplo n.º 2
0
int main() //main function
{
	char ch='y';
	while(1){
		int num = menu();
		if(num==1){
				clearsc();
				printf("Given Code\n\n%s", readFile("code.txt"));
			}
		else if(num==2){
				clearsc();
				printf("Current ISA with opcodes\n\n%s", readFile("isa.txt"));
			}
		else if(num==3){
				clearsc();
				printf("Given Code\n\n%s\n", readFile("code.txt"));
				printf("Assembled Instructions for the given code are\n\n");
				decodeCode();
			}
		else if(num==4){
				clearsc();
				printf("Help for the Assembler of our ISA\n\n%s", readFile("help.txt"));
			}
		else if(num==5){
				exit(1);
			}
			
		printf("\n\nPress \"Y\" to go to the Menu again\n");
		printf("Press \"N\" to exit\n");
		printf("Enter your choice:\t");
		fflush(stdout);fflush(stdin);
		scanf("%c",&ch);
		if(tolower(ch)!='y'&& tolower(ch)=='n')
			return 0;
	}
	
	return 0;
}				
Exemplo n.º 3
0
int menu(){
	clearsc();
	printf("Menu\n");
	printf("1)  Enter 1 to show the code\n");
	printf("2)  Enter 2 to show the ISA\n");
	printf("3)  Enter 3 to show the output\n");
	printf("4)  Enter 4 to show the help\n");
	printf("5)  Enter 5 to exit\n\n");
	printf("Enter your choice:\t");
	int num;
	fflush(stdout);fflush(stdin);
	scanf("%d",&num);
	printf("\n\n");
	return num;	
}
Exemplo n.º 4
0
download(int param[], char name[],
		unsigned char tonebyte[NPATCH][NCODPARAM])		/* put patch data from synth->tonebyte */
{
	int n, m, i;

	clearsc();
	puts("      Download - Send all patches in ynths memory to computer.");
	puts(" ");
	puts(" ");
	puts("Make sure your synth has MIDI EXCL turned on.");
	puts("   (ESC to exit)");
	puts(" ");

	putcmd(UART);		/* tell MPU401 to go into simple UART mode */

	for (i = 0; i < 10; i++){	/* make ten attempts to get data */
		puts("Hold data transfer key down and press bulk dump key on synth.");

		sendexcl(MIDRQF);
		m = getexcl();
		if (m == MIDWSF){
			clearsc();
			puts("Sending acknowledge, proceding with load.");
			sendexcl(MIDACK);
			break;
		} else if (m == -2){	/* user hit ESC */
			putcmd(SYSRESET);
			return(-1);
		} else {
			puts("*** Failed load attemp, try again. ****");
		}
	}
	if (m != MIDWSF){
		writerr("Failed ten attempts to load. Aborting load procedure.");
		putcmd(SYSRESET);
		return(-1);
	}

	n = gettones(tonebyte);				/* get all patches */
	putcmd(SYSRESET);				/* put MPU401 back into normal mode */

	if (n == 0)
		puts("Data integrity check ok");
	else if (n == -2)				/* user hit ESC key */
		return(-1);
	else {
		puts("Checksum did not match, may be data error.");
		puts("Check data before saving, or resend");
	}

	puts(" ");
	puts("Patches received:");
	for (n = 0; n < 16; n++){
		m = n * 4;
		decode(m, param, name, tonebyte);
		fputs(name,stdout); fputs("   ",stdout);
		decode(m+1, param, name, tonebyte);
		fputs(name,stdout); fputs("   ",stdout);
		decode(m+2, param, name, tonebyte);
		fputs(name,stdout); fputs("   ",stdout);
		decode(m+3, param, name, tonebyte);
		fputs(name,stdout); fputc('\n',stdout);
	}
	writerr("Download complete.   ");
	return(1);
}