Пример #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);
 }
Пример #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);
   }
 }
Пример #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));
 }
Пример #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);
 }
Пример #5
0
 // .eseg directive
 public void enterEEPROMSegment() {
   modulePrinter.println("enter segment: eeprom");
   segment = eepromSegment;
 }
Пример #6
0
 // .cseg directive
 public void enterProgramSegment() {
   modulePrinter.println("enter segment: program");
   segment = programSegment;
 }
Пример #7
0
 // .dseg directive
 public void enterDataSegment() {
   modulePrinter.println("enter segment: data");
   segment = dataSegment;
 }
Пример #8
0
 // .equ directive
 public void addConstant(AbstractToken name, Expr val) {
   modulePrinter.println(".equ " + labelName(name) + " = " + val);
   addItem(new Item.NamedConstant(segment, name, val));
 }
Пример #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));
 }