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.

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

Posted at

#概要

インタープリタを作ってみた。
avrインタープリター書いてみた。
練習問題やってみた。

#練習問題

zundokoをやれ。

#考え方

レジスタ16は、カウンタ
乱数を求めて、126以下なら、カウンタアップ、zun表示
違うなら、カウントクリア、doko表示
カウンタが4なら、kiyoshi表示

#サンプルコード

avr.ldi(16, 0xea)
avr.ldi(17, 0x05)
avr.ldi(18, 0x00)
avr.ldi(19, 0x00)
avr.mul(16, 17)
avr.mov(16, 0)
avr.inc(16)
avr.cpi(16, 0x80)
avr.brcc(12)
avr.ldi(19, 0x7a)
avr.out(0, 19)
avr.ldi(19, 0x75)
avr.out(0, 19)
avr.ldi(19, 0x6e)
avr.out(0, 19)
avr.ldi(19, 0x20)
avr.out(0, 19)
avr.inc(18)
avr.cpi(18, 0x04)
avr.breq(13)
avr.jmp(4)
avr.ldi(18, 0x00)
avr.ldi(19, 0x64)
avr.out(0, 19)
avr.ldi(19, 0x6f)
avr.out(0, 19)
avr.ldi(19, 0x6b)
avr.out(0, 19)
avr.ldi(19, 0x6f)
avr.out(0, 19)
avr.ldi(19, 0x20)
avr.out(0, 19)
avr.jmp(4)
avr.ldi(19, 0x64)
avr.out(0, 19)
avr.ldi(19, 0x6f)
avr.out(0, 19)
avr.ldi(19, 0x6b)
avr.out(0, 19)
avr.ldi(19, 0x6f)
avr.out(0, 19)
avr.ldi(19, 0x20)
avr.out(0, 19)
avr.ldi(19, 0x6b)
avr.out(0, 19)
avr.ldi(19, 0x69)
avr.out(0, 19)
avr.ldi(19, 0x79)
avr.out(0, 19)
avr.ldi(19, 0x6f)
avr.out(0, 19)
avr.ldi(19, 0x73)
avr.out(0, 19)
avr.ldi(19, 0x68)
avr.out(0, 19)
avr.ldi(19, 0x69)
avr.out(0, 19)
avr.ldi(19, 0x20)
avr.out(0, 19)
avr.ldi(19, 0x21)
avr.out(0, 19)
avr.ldi(19, 0x21)
avr.out(0, 19)


#結果

zun zun doko zun doko doko doko doko zun doko zun zun doko doko doko doko zun zun doko doko zun doko doko zun zun doko doko doko doko doko zun zun zun zun doko kiyoshi !!

#成果物

以上。

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?