0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Posted at

#概要

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

#投入するソース

9*2

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

#サンプルコード

	mul: function(_Rd, _Rr) {
		var Rd = kan2(this.dataspace[_Rd]);
		var Rr = kan2(this.dataspace[_Rr]);
		var v = (Rd * Rr) & 0xffff;
		this.dataspace[0] = hen(v & 0xff);
		this.dataspace[1] = hen((v >> 7) & 0xff);
		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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?