fix missing array initialization in initialse_ram()

This commit is contained in:
lux 2017-08-07 16:08:36 +02:00
parent 648f276051
commit 683349d210

View File

@ -8,8 +8,9 @@ int initialise_ram(uint16_t *ram, int argc, char **argv )
FILE *fp; FILE *fp;
int j=0; int j=0;
char tempS[CPU_WORD_SIZE+1]; char tempS[CPU_WORD_SIZE+1]; //+1 for "\0"
// char *end;
for(int i=0;i<RAM_SIZE;i++) ram[i]=0;
if(argc<2) if(argc<2)
{ {
@ -24,7 +25,7 @@ int initialise_ram(uint16_t *ram, int argc, char **argv )
if(!(fp=fopen(argv[1],"rb"))) if(!(fp=fopen(argv[1],"rb")))
{ {
fprintf(stderr,"%s","input file corrupted\n"); fprintf(stderr,"%s","open input stream fault !\n");
return -1; return -1;
} }
// initialise Toy-RAM // initialise Toy-RAM