Example #1
0
 private void print(String what, ASTNode where) {
   String addr = StringUtil.addrToString(segment.getCurrentAddress());
   modulePrinter.println(
       segment.getName()
           + " @ "
           + addr
           + ": "
           + what
           + " on line "
           + where.getLeftMostToken().beginLine);
 }
Example #2
0
 // .include directive
 public void includeFile(AbstractToken fname) throws AbstractParseException {
   try {
     modulePrinter.println("includeFile(" + fname.image + ')');
     String fn = StringUtil.trimquotes(fname.image);
     AtmelParser parser = new AtmelParser(new FileInputStream(fn), this, fn);
     // TODO: handle infinite include recursion possibility
     parser.Module();
   } catch (FileNotFoundException e) {
     ERROR.IncludeFileNotFound(fname);
   }
 }
Example #3
0
 // .byte directive
 public void reserveBytes(Expr e, Expr f) {
   // TODO: fill section with particular value
   int result = e.evaluate(segment.getCurrentAddress(), this);
   modulePrinter.println("reserveBytes(" + e + ") -> " + result);
   addItem(new Item.UninitializedData(segment, result));
 }
Example #4
0
 // .org directive
 public void setOrigin(Expr.Constant c) {
   int result = c.evaluate(segment.getCurrentAddress(), this);
   modulePrinter.println("setOrigin(" + c + ") -> " + result);
   segment.setOrigin(result);
 }
Example #5
0
 // .eseg directive
 public void enterEEPROMSegment() {
   modulePrinter.println("enter segment: eeprom");
   segment = eepromSegment;
 }
Example #6
0
 // .cseg directive
 public void enterProgramSegment() {
   modulePrinter.println("enter segment: program");
   segment = programSegment;
 }
Example #7
0
 // .dseg directive
 public void enterDataSegment() {
   modulePrinter.println("enter segment: data");
   segment = dataSegment;
 }
Example #8
0
 // .equ directive
 public void addConstant(AbstractToken name, Expr val) {
   modulePrinter.println(".equ " + labelName(name) + " = " + val);
   addItem(new Item.NamedConstant(segment, name, val));
 }
Example #9
0
 // .def directive
 public void addDefinition(AbstractToken name, AbstractToken rtok) {
   modulePrinter.println(".def " + labelName(name) + " = " + labelName(rtok));
   addItem(new Item.RegisterAlias(segment, name, rtok));
 }