/****************************************************************\
|  set graphics mode for 3dv
|----------------------------------------------------------------
|  This program applies a patch to the 3dv program in the usgiest
|  possible way. Written by Bill Davidsen for people who have
|  MS-DOS with no DEBUG and need another mode.
\****************************************************************/

#include <stdio.h>

static void puthelp();

main(argc, argv)
int argc;
char *argv[];
{
	int n;
	FILE *fp;

	if (argc != 2) puthelp();

	n = atoi(argv[1]);
	if (n < 1 || n > 4) puthelp();

	fp = fopen("3dv.exe", "r+");
	if (fp == NULL) {
		printf("File 3dv.exe not in currect directory\n");
		exit(1);
	}

	fseek(fp, (long)0xcd5, 0);
	putc(n, fp);
	fclose(fp);

	exit(0);
}

static void
puthelp()
{
	printf("Call with:\n");
	printf("  3dvsetup n\n");
	printf("Where n=1 EGA, 2 CGA hi res, 3 CGA lo res, 4 Hercules\n");
	exit(1);
}
