Page 146 - DCAP507_SYSTEM_SOFTWARE
P. 146

System Software




                    Notes          fscanf(fp1,"%s",input);
                                   }
                                   for(n=0;n<record;n++)
                                   {
                                   operation=label[n][0];
                                   length=strlen(label[n]);
                                   for(i=1;i<length;i++)
                                   lbl[i-1]=label[n][i];
                                   lbl[length-1]='\0';
                                   length=0;
                                   strcpy(address,"\0");
                                   location=mloc[n]-exeloc;
                                   loc=location;
                                   count=0;
                                   while(length<mlen[n])
                                   {s
                                   trcat(address,obcode[location++].code);
                                   count++;
                                   length+=2;
                                   }
                                   for(i=0;i<num;i++)
                                   if(strcmp(lbl,estab[i].sname)==0)
                                   break;
                                   switch(operation)
                                   {  case  '+':newadd=strtol(address,&add1,10)+(long  int)estab[i].padd;
                                   break;
                                   case  '-':newadd=strtol(address,&add1,10)-(long  int)estab[i].padd;
                                   break;
                                   }  ltoa(newadd,address,10);
                                   x=0;
                                   y=0;
                                   while(count>0)
                                   {
                                   obcode[loc].code[x++]=address[y++];
                                   if(x>1)
                                   {
                                   x=0;
                                   loc++;
                                   count--;
                                   }}}  count=0;
                                   n=0;
                                   fprintf(fp3,"%d\t",obcode[0].add);
                                   for(i=0;i<inc;i++)




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