/[projet1]/public/pc/tools/osdk/main/opt65/sources/opt65.c
Defence Force logotype

Diff of /public/pc/tools/osdk/main/opt65/sources/opt65.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1311 by Jylam, Wed Sep 17 19:46:20 2014 UTC revision 1312 by dbug, Sat Oct 24 09:07:43 2015 UTC
# Line 283  int readline(char *buf, FILE *infile) Line 283  int readline(char *buf, FILE *infile)
283    static int x;    static int x;
284    inp_line++;    inp_line++;
285    x=0;    x=0;
286    while (x<line_len-1) {    while (x<line_len-1)
287      buf[x]=fgetc(infile);    {
288      if (buf[x]=='\n'||buf[x]=='\0'||buf[x]==EOF) break;      int value=fgetc(infile);
289      x++; }      buf[x]=(char)value;
290        if ( (buf[x]=='\n') || (buf[x]=='\0') || (value==EOF)) break;
291        x++;
292      }
293    if (x==0 && buf[x]==EOF) return EOF;    if (x==0 && buf[x]==EOF) return EOF;
294    buf[x]='\0';    buf[x]='\0';
295    return 0;    return 0;
# Line 683  int parse_line(char *a, line *p) Line 686  int parse_line(char *a, line *p)
686    
687    j=i;    j=i;
688    while (a[j]!='\0' && a[j]!=';') j++; /* search end of parameter */    while (a[j]!='\0' && a[j]!=';') j++; /* search end of parameter */
689    while (j>i) {    while (j>i)
690      {
691      if (a[j-1]!=' ' && a[j-1]!='\t') break;      if (a[j-1]!=' ' && a[j-1]!='\t') break;
692      j=j-1; }      j=j-1;
693      }
694    j=j-i;    j=j-i;
695    
696  # ifdef debug_parse  # ifdef debug_parse
# Line 698  int parse_line(char *a, line *p) Line 703  int parse_line(char *a, line *p)
703    p->par=x=get_parid(&a[i],j);    p->par=x=get_parid(&a[i],j);
704    
705    if (j==1 && (a[i]=='a'||a[i]=='A') ) return 0; /* Akku addressed */    if (j==1 && (a[i]=='a'||a[i]=='A') ) return 0; /* Akku addressed */
706    if (a[i]=='#') { /* immediate */    if (a[i]=='#')
707      { /* immediate */
708      if ( (p->mpar=resolve_abs(&parbuf[par_pos[x]+1]))!=undefd )      if ( (p->mpar=resolve_abs(&parbuf[par_pos[x]+1]))!=undefd )
709        p->depind|=absolute; /* resolved */        p->depind|=absolute; /* resolved */
710      return 0; }      return 0;
711      }
712    
713    if ( a[i]=='(' ) {    if ( a[i]=='(' )
714      {
715      i++;      i++;
716      while ( a[i]==' ' || a[i]=='\t' ) i++;      while ( a[i]==' ' || a[i]=='\t' ) i++;
717      p->depind=p->depind|imem; /* indirect-flag */ }      p->depind=p->depind|imem; /* indirect-flag */
718      }
719    
720    p->depind=p->depind|mem;    p->depind=p->depind|mem;
721    
# Line 720  int parse_line(char *a, line *p) Line 729  int parse_line(char *a, line *p)
729    x=get_mparid( &a[i], j );    x=get_mparid( &a[i], j );
730    p->mpar=x;    p->mpar=x;
731    
732    if (p->depind & imem) {    if (p->depind & imem)
733      {
734      /* address points to 16bit-pointer */      /* address points to 16bit-pointer */
735      strcpy(tmpstr,&a[i]);      strncpy(tmpstr,&a[i],sizeof(tmpstr));
736        tmpstr[sizeof(tmpstr)-1]=0;
737      tmpstr[j]='+';      tmpstr[j]='+';
738      tmpstr[j+1]='1';      tmpstr[j+1]='1';
739      p->mparhi=get_mparid( tmpstr, j+2 ); }      p->mparhi=get_mparid( tmpstr, j+2 ); }
# Line 732  int parse_line(char *a, line *p) Line 743  int parse_line(char *a, line *p)
743    /* scan for ",x" and ",y" idexes */    /* scan for ",x" and ",y" idexes */
744    
745    x=0;    x=0;
746    while (1) {    while (1)
747      {
748      if (a[i]=='\0'||a[i]==';') break;      if (a[i]=='\0'||a[i]==';') break;
749      if (a[i]==' '||a[i]=='\t') { i++; continue; }      if (a[i]==' '||a[i]=='\t') { i++; continue; }
750      if (a[i]==',')  { x=1; i++; continue; }      if (a[i]==',')  { x=1; i++; continue; }
751      if (a[i]=='x' && x==1) { x=2; i++; continue; }      if (a[i]=='x' && x==1) { x=2; i++; continue; }
752      if (a[i]=='y' && x==1) { x=3; i++; continue; }      if (a[i]=='y' && x==1) { x=3; i++; continue; }
753      x=0; i++; }      x=0; i++;
754      }
755    
756    if (x==2) {    if (x==2)
757      {
758      p->dep=p->dep|reg_x;      p->dep=p->dep|reg_x;
759      p->depind=p->depind|reg_x;      p->depind=p->depind|reg_x;
760    }    }
761    if (x==3) {    if (x==3)
762      {
763      p->dep=p->dep|reg_y;      p->dep=p->dep|reg_y;
764      p->depind=p->depind|reg_y;      p->depind=p->depind|reg_y;
765    }    }

Legend:
Removed from v.1311  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26