
#include <sys/bios.h>

unsigned char wave_data[] = {
  0xa8, 0xdc, 0xee, 0xef, 0xde, 0xbc, 0x9a, 0x89,
  0x67, 0x56, 0x34, 0x12, 0x01, 0x11, 0x32, 0x75,
};

void main()
{
int key=0,t=0,time=180; /* time（タイマー設定 単位：秒）*/

text_screen_init(); 
text_put_string(5,2,"ラーメンお待ち！");
text_put_string(1,4,"使用方法");
text_put_string(1,5,"1.ワンダースワンを画面を下にして");
text_put_string(1,6,"  平らな所に置いて下さい。");
text_put_string(1,8,"2.その上にお湯を入れたカップラーメンを");
text_put_string(1,9,"  乗せて下さい。");
text_put_string(1,11,"3.ブザーで３分をお知らせいたします。");
text_put_string(3,13,"注意・音量を最大にしておいて下さい。");
text_put_string(3,14,"  ・A,Bボタンが押されるようにして下さい。");
text_put_string(3,15,"  ・専用充電池を使用して下さい。");
text_put_string(6,17," スタートボタンを押すと終了します。"); /* 画面表示 */ 

   while ( (key = key_press_check()) != KEY_START )
   {
      switch(key)
      {
         case KEY_A | KEY_B:       /* ABボタン同時押し */
           t++; /* １カウント */
           break;
         default:
           t=0; /* カウント初期化 */
           break;
      }
     if(t>=time){
                    sound_set_output( 0x0f );
                    sound_set_wave( 0, wave_data);
                    sound_set_pitch( 0, 2000 );
                    sound_set_volume( 0, 0xff );
                    sound_set_channel( 1 );
                    sound_set_wave( 1, wave_data);
                    sound_set_pitch( 1, 2000 );
                    sound_set_volume( 1, 0xff );
                    sound_set_channel( 2 ); /* 音を鳴らす */
                 }

      else{
             sound_init();/* サウンド初期化 */
           }
      sys_wait(75); /* 約１秒 */
    }
}