Page 145 - DCAP507_SYSTEM_SOFTWARE
P. 145

Unit 9: Design of an Absolute Loader




          {                                                                                     Notes
          pstart=estab[i].padd;
          break;
          }
          while(strcmp(input,"T")!=0)
          fscanf(fp1,"%s",input);
          }
          do
          {  if(strcmp(input,"T")==0)
          {
          fscanf(fp1,"%d",&textloc);
          textloc=textloc+pstart;
          for(i=0;i<(textloc-loc);i++)
          {s
          trcpy(obcode[inc].code,"xx");
          obcode[inc++].add=start++;
          }
          fscanf(fp1,"%d",&textlen);
          loc=textloc+textlen;
          }  else  if(strcmp(input,"M")==0)
          {
          fscanf(fp1,"%d",&mloc[record]);
          mloc[record]=mloc[record]+pstart;
          fscanf(fp1,"%d",&mlen[record]);
          fscanf(fp1,"%s",label[record++]);
          }  else
          {  length=strlen(input);
          x=0;
          for(i=0;i<length;i++)
          {
          obcode[inc].code[x++]=input[i];
          if(x>1)
          {
          obcode[inc++].add=start++;
          x=0;
          }}}
          fscanf(fp1,"%s",input);
          }
          while(strcmp(input,"E")!=0);
          if(strcmp(input,"E")==0)




                                           LOVELY PROFESSIONAL UNIVERSITY                                   139
   140   141   142   143   144   145   146   147   148   149   150