/*
 all roms start at f000:6000 and end at f000:ffff
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <dos.h>
#include <conio.h>
#include <string.h>
#include <bios.h>
unsigned int offst;
int plugs,whichplug,result;
char *stroffst,*ptr;
        main() {
                FILE *stream;

                

puts("\nSynthesizer Setup For the IBM XT   Version 1.0à");
puts("            by Larry Battraw (c) 1990 \n\n");

do{
        printf("\nHow many ROM plugs does your computer have? ");
        scanf("%d",&plugs);
        }
        while(plugs<=0);

do{
        printf("\nWhich plug do you wish to use, counting over from the right? ");
        scanf("%d",&whichplug);
        }
        while(whichplug<=1 || whichplug>plugs);

offst=0xe000-0x2000*whichplug;    /* subtract mutiple XT ROM size */
                                  /*  from first socket address   */

stream=fopen("synth.cfg","wt");
if(stream==NULL) { puts("Open file failed- too many files?"); exit(1); }

ptr=itoa(offst,stroffst,16);


puts("\nWriting....");
result=fputs(ptr,stream);
if(result==EOF) { puts("Write failed- disk full?"); exit(1); }

puts("          Closing....");
result=fclose(stream);
if(result==EOF) { puts("Write failed- disk full?"); exit(1); }

puts("- Done.");

}

