Page 131 - DCAP507_SYSTEM_SOFTWARE
P. 131

Unit 9: Design of an Absolute Loader




                                                                                                Notes
                                            Figure  9.1





































                 Example: Write a C Program for the Implementation of an Absolute Loader.
          #include<stdio.h>
          #include<conio.h>
          #include<string.h>
          char  input[10],label[10],ch1,ch2;
          int  addr,w=0,start,ptaddr,l,length=0,end,count=0,k,taddr,address,i=0;
          FILE  *fp1,*fp2;
          void  check();
          void  main()
          {
          clrscr();
          fp1=fopen("INPUT.dat","r");
          fp2=fopen("OUTPUT.dat","w");
          fscanf(fp1,"%s",input);
          printf("\n\n\t\t\t\tABSOLUTE  LOADER\n");
          fprintf(fp2,"\n-------------------\n");
          fprintf(fp2,"MEMORY  ADDRESS\t\t\tCONTENTS");
          fprintf(fp2,"\n-------------------\n");
          while(strcmp(input,"E")!=0)




                                           LOVELY PROFESSIONAL UNIVERSITY                                   125
   126   127   128   129   130   131   132   133   134   135   136