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?

nandgameでOS作ってみよう #1

Posted at

サイト

前回とか

OSでは何を作る?

まずは数を二倍にするものを作っていきたいので、関数の作り方を定めます。

init.stack

#引数
push.value 5
#処理
goto numx2
#リターン後の場所
numx2_return:

goto end

numx2:

goto numx2_return

end:

これで関数を作れました

二倍する関数を作る

後は二倍する関数を作ります

2x=x+x

なので、
こんなものを作りました

init.stack

push.value 5
goto numx2
numx2_return:

goto end

numx2:
pop.d
push.d
push.d
add
goto numx2_return

end:

numx2の所に引数を増やして足すコードを書くことで二倍できるようになりました!

次回とかまとめ

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?