Асемблери. Принципи написання та функціонування компіляторів програм, страница 6

      if (s!=' '&& s!=','&&s!='\n') {

                               buf[x]=s;               x++;       }

      if (s!=','&&s!='\n'){

                  if ((s==' ')&&(buf[0]!=0)) {

                      clearbuf;       x=0;     } }

       else {

    for (int j=0;j<13;j++){

       if (strcmp(byte[j].r,buf)==0){

                   if (a==0){

                    c=byte[j].c;     c1=byte[j].x;

                    strcpy(fd,buf);     x=0;

                    a++;break; }

                  else {

                    c1=byte[j].x;     if (k==1) c=byte[j].c;

                    clearbuf;x=0;a=0;break;}}}

                      if (a==0) { int za=0;     n1=n;

                                   while (n1->next!=NULL){

                              if (za>0) n1=n1->next;

                                             if (strcmp(n1->name,buf)==0){

               k=1;a++;strcpy(fd,buf);

                              break;}    za++;}    }

     if (a==1 && (strcmp(fd,buf)!=0)) { n1=n;

               while (n1->next!=NULL){

                    if (az==2) n1=n1->next;

                    if (az==1) az++;

                    if (strcmp(n1->name,buf)==0)

                    if (a==1) {

                               k=2;       clearbuf;               x=0;

                               a=0;break; }

                    if (az==0) { n1=n1->next;az++;}}}

                    if (a==1) { clearbuf;x=0;  }

                    if (a==0) {

                              if (k==2 || k==1){

                                     asm  xor al,al

                                     asm  xor al,c

                                     asm  xor al,c1

                                     asm  mov w,al

                                  break; }

                              if (strcmp(fd,"ds")==0) {

                                     asm  xor al,al

                                     asm  xor al,c

                                     asm  xor al,c1

                                     asm  xor al,11000000b

                                     asm  mov w,al

                                  break; }

                              else { asm  xor al,al

                                     asm  xor al,c

                                     asm  xor al,c1

                                     asm  xor al,11000000b

                                     asm  mov w,al

                                  break;}

 } } } az=0;

return w;}

void AnalizSegment(char *str)

{

   char s=0,buf[15];   int i=0,x=0,rez;

   clearbuf;

   while(s!='\n' ){

               s=str[i++];

               if (s!=' ' && s!=':') {

                      buf[x++]=s;       }

       else {

                if (strcmp(buf,"assume")==0) break; //если buf=assume,

     // то выход из else {}

 if (sb==0 && s==' '){  //sb=0, если это 1-й элем списка

                     u=new segnam;     //новый список

                     u1=u;             //начало списка

                     strcpy(u->segmname,buf);  //копир buf в u->segname

                     u->segdisp=disp;      u->next=NULL;

                     sb++;   break; }       //выход из else {}

                if (s==' ' && sb==1){    //sb=1, если 2-й эл списка

      u2=new segnam;

      strcpy(u2->segmname,buf);

                    u2->segdisp=disp;

                    u2->next=NULL;

                    u1->next=u2; // связь эл-ов списка

                                   u1=u2;  // u1-текущий эл

                                   break; }

                if (sa==0){   //если это 1-й эл списка

                              lab=new labels;      lab1=lab;

                              strcpy(lab->label,buf);

                                     lab->labdisp=disp;

                                     lab->next=NULL;

                              sa++;       break; }

                  else {

                              lab2=new labels;

                              strcpy(lab2->label,buf);

                                     lab2->next=NULL;