Example #1
0
File: syntax.c Project: ezrec/vasm
static void handle_space(char *s)
{
  expr *space,*fill=0;
  space=parse_expr_tmplab(&s);
  s=skip(s);
  if(*s==','){
    s=skip(s+1);
    fill=parse_expr_tmplab(&s);
  }
  add_atom(0,new_space_atom(space,1,fill));
  eol(s);  
}
Example #2
0
File: syntax.c Project: kusma/vasm
static void handle_block(char *s,int size)
{
  expr *cnt,*fill=0;

  cnt = parse_expr_tmplab(&s);
  s = skip(s);
  if (*s == ',') {
    s = skip(s+1);
    fill = parse_expr_tmplab(&s);
  }
  do_space(size,cnt,fill);
  eol(s);
}
Example #3
0
File: syntax.c Project: kusma/vasm
static int do_cond(char **s)
{
  expr *condexp = parse_expr_tmplab(s);
  taddr val;

  if (!eval_expr(condexp,&val,NULL,0)) {
    general_error(30);  /* expression must be constant */
    val = 0;
  }
  free_expr(condexp);
  return val != 0;
}
Example #4
0
File: syntax.c Project: ezrec/vasm
static void handle_org(char *s)
{
  if (*s == current_pc_char) {    /*  "* = * + <expr>" reserves bytes */
    s = skip(s+1);
    if (*s == '+') {
      add_atom(0,new_space_atom(parse_expr_tmplab(&s),1,0));
    }
    else {
      syntax_error(18);  /* syntax error */
      return;
    }
  }
  else {
    new_org(parse_constexpr(&s));
  }
  eol(s);
}
Example #5
0
File: syntax.c Project: ezrec/vasm
static void handle_equ(char *s)
{
  char *labname;
  symbol *label;

  if(!(labname=parse_identifier(&s))){
    syntax_error(10);  /* identifier expected */
    return;
  }
  s=skip(s);
  if(*s!=',')
    syntax_error(9);
  else
    s=skip(s+1);
  label=new_abs(labname,parse_expr_tmplab(&s));
  myfree(labname);
  eol(s);
}
Example #6
0
File: syntax.c Project: ezrec/vasm
static void handle_size(char *s)
{
  char *name;
  symbol *sym;

  if(!(name=parse_identifier(&s))){
    syntax_error(10);  /* identifier expected */
    return;
  }
  sym=new_import(name);
  myfree(name);
  s=skip(s);
  if(*s==',')
    s=skip(s+1);
  else
    syntax_error(9);
  sym->size=parse_expr_tmplab(&s);
  eol(s);
}
Example #7
0
File: syntax.c Project: kusma/vasm
static void handle_equ(char *s)
{
  int exp;
  symbol *sym;

  if (*s=='=' && *(s-1)=='=') {
    s = skip(s+1);
    exp = 1;  /* == automatically exports a symbol */
  }
  else
    exp = 0;

  sym = new_equate(labname,parse_expr_tmplab(&s));
  if (exp) {
    if (is_local_label(labname))
      syntax_error(1);  /* cannot export local symbol */
    sym->flags |= EXPORT;
  }
  eol(s);
}
Example #8
0
File: syntax.c Project: ezrec/vasm
static void alignment(char *s,int mode)
{
  int align,max=0;
  expr *fill=0;

  align = parse_constexpr(&s);
  s = skip(s);
  if (*s == ',') {
    s = skip(s+1);
    if (*s != ',')
      fill = parse_expr_tmplab(&s);
    s = skip(s);
    if (*s == ',') {
      s = skip(s+1);
      max = parse_constexpr(&s);
    }
  }
  if (!mode)
    mode = CPU_DEF_ALIGN;
  do_align(mode==1?align:(1<<align),fill,max);
  eol(s);
}
Example #9
0
File: syntax.c Project: kusma/vasm
static void handle_space(char *s,int size)
{
  do_space(size,parse_expr_tmplab(&s),0);
  eol(s);
}
Example #10
0
File: syntax.c Project: kusma/vasm
static void handle_set(char *s)
{
  new_abs(labname,parse_expr_tmplab(&s));
  eol(s);
}