Пример #1
0
 protected override void Parse(AsmParser parser)
 {
     Register = parser.ReadRegW24();
     parser.ReadToken(TokenType.Comma);
     Token exprToken;
     var imm = parser.CalculateExpression(out exprToken);
     if (imm > 63) {
         throw new TokenException("value must be less than 64", exprToken);
     }
     Value = (byte)imm;
 }
Пример #2
0
 protected override void Parse(AsmParser parser)
 {
     Token firstToken;
     var offset = parser.CalculateExpression(out firstToken);
     var zeroOffset = parser.CurrentOffset + 2;
     var delta = offset - zeroOffset;
     if ((delta & 0x1) > 0) {
         throw new TokenException("invalid relative jump", firstToken);
     }
     delta /= 2;
     if (delta < -2048 || delta > 2047) {
         throw new TokenException("relative jump out of range (-2047; 2048)", firstToken);
     }
     delta *= 2;
     Delta = (short)delta;
 }
Пример #3
0
        protected override void Parse(AsmParser parser)
        {
            Token firstToken;
            var target = parser.CalculateExpression(out firstToken);

            if ((target & 0x1) > 0) {
                throw new TokenException("invalid absolute jump", firstToken);
            }
            target /= 2;

            //todo: for 64k devices limit is 64k
            if (target < 0 || target >= (1 << 22)) {
                throw new TokenException("jump beyond 4m boundary", firstToken);
            }

            Target = (int)(target << 1);
        }