Category : Assembly Language Source Code
Archive   : DATA2SCR.ZIP
Filename : DATA2SCR.C
/*³ FILE: data2scr.c DATE: 1/19/94 ³*/
/*³ ³*/
/*³ Written by : Fernando Gorchs ³*/
/*³ ³*/
/*³ This program converts the text output from COM2DATA ³*/
/*³ from text that is readable in basic programs to text ³*/
/*³ that can be read into Microsoft's Debug utility to ³*/
/*³ reconstuct the COM file in the first place. What is ³*/
/*³ the purpose? Because it was easy to do. Output is ³*/
/*³ printed to the screen so redirection is needed to ³*/
/*³ create the script file. ³*/
/*³ ³*/
/*³ TO USE : type DATA2SCR INCRAP.BAS > OUTCRAP.SCR ³*/
/*³ ³*/
/*ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ*/
#include
#define TC 1
#ifdef MSC
#include
#endif
#ifdef TC
#include
#endif
#define BOOL int
#define TRUE 1
#define FALSE 0
#define FIRSTGR 1
#define FIRSTLS -1
#define HTSIZE 1009
#define MAXSTRL 255
#define MAXWORD 20
#define NULL 0
#define SLASH '/'
#define SQUOTE '\047'
#define STAR '*'
#define BSLASH '\134'
#define TRUE 1
#define CR 0X0D
#define WHITESP (thischar==' ' || thischar=='\t' || thischar=='\n')
#define INPUTEND (thatcur == CR || thatcur == '\n' || thatcur == ' ')
/*#define VOID int /* THIS IS FOR COMPILERS WHICH */
/* DON'T IMPLEMENT RESERVED */
/* WORD void */
static char filenam[50];
main (int argc,char *argv[])
{ /** STARTBODY main **/
FILE *infile; /* File pointer */
char thischar;
int linenum = 256;
int bytenum = 0;
int cntto13 = 0;
char ch;
int option = 2;
int i = 0;
int j = 0;
int saveperiod = 55;
int saveend = 55;
char comname[12];
void getname();
for (i = 0; i < 49; i++)
filenam [i] = ' ';
filenam [i] = '\0';
i = 0;
/* NOW CHECK COMMAND LINE ARGUMENTS */
if (argc < 2)
{
/** msg if command line is not complete **/
printf("\tÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
printf("\t³ DATA2SCR.EXE DATE: 1/21/94 ³\n");
printf("\t³ ³\n");
printf("\t³ This program converts the text output from COM2DATA ³\n");
printf("\t³ from text that is readable in basic programs to text³\n");
printf("\t³ that can be read into Microsoft's Debug utility to ³\n");
printf("\t³ reconstuct the COM file in the first place. What is ³\n");
printf("\t³ the purpose? Because it was easy to do. Output is ³\n");
printf("\t³ printed to the screen so redirection is needed to ³\n");
printf("\t³ create the script file. ³\n");
printf("\t³ ³\n");
printf("\t³ TO USE : type DATA2SCR INCRAP > OUTCRAP.SCR ³\n");
printf("\t³ then type DEBUG < OUTCRAP.SCR ³\n");
printf("\t³ and INCRAP.COM will be reconstructed. ³\n");
printf("\t³ ³\n");
printf("\t³ The extension .BAS is assumed for input unless ³\n");
printf("\t³ you explicitly type something else. However the ³\n");
printf("\t³ only valid input is output from COM2DATA. ³\n");
printf("\tÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n");
printf("\n\t Enter name of input file, or press
printf("\n\t Don't try redirection here, but from the command line.");
printf("\n\t Output will scroll by on the screen. Watch out! ");
printf("\n\t (Enter drive and path if necessary) >>");
getname (filenam);
if (filenam[0] == '\0')
{
exit(1);
}
}
else
{
strcpy (filenam, argv[1]);
}
while ( ( ch = filenam[i++] ) != '\0' )
{ if ( ch == '.' )
{
saveperiod=i - 1;
if ( ( ch = filenam[i] ) == '\0' )
option = 3;
else option = 1;
} /* end if */
} /* end while */
saveend = --i;
if ( option != 2 )
{ i = saveperiod; }
while ( filenam[i] != '\\' && i >= 0 && filenam[i] != ':' )
i-- ; /* i ends up pointing right before beginning of filename */
i++ ; /* i now points to begining of filename w/o drive and path */
while ( i != saveperiod && i != saveend )
comname[j++] = filenam[i++];
comname[j] = '\0'; /* filename without extension or path */
i = saveend;
if ( option == 2 )
{
if ( i > 46 ) {printf("Error filename and path too long");exit(2);}
filenam[i++] = '.';
}
if ( option == 3 )
if ( i > 47 ) {printf("Error filename and path too long");exit(3);}
if ( option != 1 )
{
filenam[i++] = 'b';
filenam[i++] = 'a';
filenam[i++] = 's';
filenam[i] = '\0';
}
infile = fopen (filenam,"r");
if ( infile == 0 )
{
fprintf (stderr,"\n Open of input file,%s, has failed.\n",filenam);
exit (4);
}
printf ("n %s.com\n",comname);
printf ("e 100 ");
while ((thischar = getc(infile)) != EOF)
{
if ( thischar == '&' )
{
getc(infile); /* whaste the h */
/* print the two characters representing the hex numbers */
thischar = getc(infile);
printf("%c",thischar);
thischar = getc(infile);
printf("%c ",thischar);
cntto13++;
if ( cntto13 == 13)
{
linenum = linenum + 13;
printf("\ne %x ",linenum);
cntto13 = 0;
}
}
if ( thischar == 'R' )
{
/* 'R' means we are at the end... get byte count and
convert it to hex */
getc(infile); /* E */
getc(infile); /* M */
getc(infile); /* space ... the next characters are numbers */
fscanf(infile,"%i",&bytenum);
printf("\nrcx\n");
printf("%x\n",bytenum);
printf("w\nq\n");
exit(0);
}
/* Selective compilation according to compiler */
}
printf("Bad ending... Are you sure this is valid input?");
exit (5);
} /** ENDBODY MAIN **/
int isalph (ch)
char ch;
{
return (((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'))
? TRUE : FALSE);
}
int isdigi (ch)
char ch;
{
return((ch >= '0' && ch <= '9') ? TRUE : FALSE);
}
void getname (filename)
/* This is to get the name of the input file */
char filename[50];
{
int i = 0;
char thatcur;
for (i = 0; i < 49; i++)
filename [i] = ' ';
filename [i] = '\0';
i = 0;
while ( i < 50 )
{
thatcur = getchar ();
if (i == 49 || INPUTEND)
{
filename [i] = '\0';
i = 51;
}
else
{
filename [i] = thatcur;
i++;
}
} /* END while loop */
} /* * * * * * * * * END getname function * * * * */
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/