LoginSignup
0
0

More than 1 year has passed since last update.

インタープリタを作る その21

Posted at

概要

インタープリタを作ってみた。
avrインタープリター書いてみた。
加算addを実装する。

投入するソース

9+2

avr.ldi(16, 0x09)
avr.ldi(17, 0x02)
avr.add(16, 17)
avr.out(1, 16)

サンプルコード

    add: function(_Rd, _Rr) {
        var Rd = kan2(this.dataspace[_Rd]);
        var Rr = kan2(this.dataspace[_Rr]);
        var v = (Rd + Rr) & 0xff;
        this.dataspace[_Rd] = hen(v);
        var SREG = this.dataspace[this.sreg];
        this.PC++;
        this.dataspace[this.sreg] = SREG;
    },

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0