LoginSignup
2
1

More than 5 years have passed since last update.

GBDKによるゲームボーイソフト制作-1回 Hello World!-

Last updated at Posted at 2018-03-28

前回:GBDKによるゲームボーイソフト制作-0.5回 やっておくと便利なこと-
次回:GBDKによるゲームボーイソフト制作-2回 文字を出してみる-

入門の定番をやってみる

コードを書く

適当なテキストエディタで、以下のプログラムを書いてみる。

helloworld.c
#include <stdio.h>

void main() {
    printf("Hello World!");
}

自分のわかりやすい場所に、ファイル名を「helloworld.c」として保存。
(筆者は「C:\Files\gameboy」というディレクトリを作りそこに置いてます)

コンパイル

コマンドプロンプトで、プログラムファイルを保存した場所に移動。
(以下、筆者の場合)
cd c:\Files\gameboy

以下のコマンドを入力し、ゲームボーイ用の実行ファイルを作る。
lcc -o helloworld.gb helloworld.c
※環境変数の設定をしていない場合は[C:\gbdk\bin\lcc -o helloworld.gb helloworld.c]

実際のコマンド入力画面はこんな感じ。
compile.png

こうすると同じディレクトリに「helloworld.gb」ができる

実行してみる

サンプルを実行したときと同じように「helloworld.gb」をエミュレータにドーン。
以下のような画面が出たら成功です。おめでとう。
helloworld.png

2
1
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
2
1