;
;(有)姫路ソフトワークス　ROBOXERO　IFRコントロール
;起動時初期設定プログラム
;
;入力チェック
V120=0
:SETUPWAIT
JUMPIF(V120,=,0,SETUPWAIT)
V116=0
;GYRO SENSOR SETUP
V115=0
;BATTLE SENSOR SETUP
V114=0
;IFR SENSOR SETUP
V113=0

:SETUPLOOP
;セットアップ終了確認
V00=V122
V00=V00 AND 8
JUMPIF(V00,#,0,SETUPEXIT)
;
:SETUPCHECK1
V00=V121
V00=V00 AND 128
JUMPIF(V00,=,0,SETUPCHECK2)
;
;GYRO ON
;
V115=1
(N389 = 0
(N393 = 74
(N394 = 74
(N396 = 0-8
(N398 = 8
(N397 = 8
(N399 = 0-8
(N401 = 0
(N403 = 0
(N402 = 0-10
(N404 = 0-10
(N389 = 1
CALL(GYRSON)
:SETUP1EXITCHK
V00=V121
V00=V00 AND 128
JUMPIF(V00,#,0,SETUP1EXITCHK)

:SETUPCHECK2
V00=V121
V00=V00 AND 32
JUMPIF(V00,=,0,SETUPCHECK3)
;
;GYRO OFF
;
V115=0
(N389 = 0
(N393 = 0
(N394 = 0
(N396 = 0
(N398 = 0
(N397 = 0
(N399 = 0
(N401 = 0
(N403 = 0
(N402 = 0
(N404 = 0
(N389 = 0
CALL(GYRSOFF)
:SETUP2EXITCHK
V00=V121
V00=V00 AND 32
JUMPIF(V00,#,0,SETUP2EXITCHK)

:SETUPCHECK3
;
V00=V121
V00=V00 AND 8
JUMPIF(V00,=,0,SETUPCHECK4)
;
;IFRS ON
;
V113=1
CALL(IFRSON)
:SETUP3EXITCHK
V00=V121
V00=V00 AND 8
JUMPIF(V00,#,0,SETUP3EXITCHK)

:SETUPCHECK4
V00=V121
V00=V00 AND 2
JUMPIF(V00,=,0,SETUPCHECK5)
;
;IFRS OFF
;
V113=0
CALL(IFRSOFF)
:SETUP4EXITCHK
V00=V121
V00=V00 AND 2
JUMPIF(V00,#,0,SETUP4EXITCHK)

:SETUPCHECK5
V00=V122
V00=V00 AND 128
JUMPIF(V00,=,0,SETUPCHECK6)
;
;BTR ON
;
V114=1
CALL(BTRSON)
:SETUP5EXITCHK
V00=V122
V00=V00 AND 128
JUMPIF(V00,#,0,SETUP5EXITCHK)

:SETUPCHECK6
V00=V122
V00=V00 AND 32
JUMPIF(V00,=,0,SETUPCHECK7)
;
;BTR OFF
;
V114=0
CALL(BTRSOFF)
:SETUP6EXITCHK
V00=V122
V00=V00 AND 32
JUMPIF(V00,#,0,SETUP6EXITCHK)

:SETUPCHECK7

JUMP(SETUPLOOP)



:GYRSON
V00=60
V01=8390
V02=0
V03=100
V04=0
SOUND
RETURN

:GYRSOFF
V00=60
V01=8610
V02=0
V03=100
V04=0
SOUND
RETURN

:IFRSON
V00=60
V01=8830
V02=0
V03=100
V04=0
SOUND
RETURN

:IFRSOFF
V00=60
V01=9050
V02=0
V03=100
V04=0
SOUND
RETURN

:BTRSON
V00=60
V01=9270
V02=0
V03=100
V04=0
SOUND
RETURN

:BTRSOFF
V00=60
V01=9480
V02=0
V03=100
V04=0
SOUND
RETURN


:PWROK
V00=60
V01=9700
V02=0
V03=200
V04=0
SOUND
RETURN

:PWRNG
V00=60
V01=9910
V02=0
V03=200
V04=0
SOUND
RETURN

:RXSTART
V00=60
V01=10130
V02=0
V03=200
V04=0
SOUND
RETURN

:RXSTOP
V00=60
V01=10340
V02=0
V03=200
V04=0
SOUND
RETURN

:BLDON
V00=60
V01=10550
V02=0
V03=200
V04=0
SOUND
RETURN

:RXGON
V00=60
V01=10770
V02=0
V03=0
V04=0
SOUND
RETURN

:SETUPEXIT
V00=V122
V00=V00 AND 8
JUMPIF(V00,#,0,SETUPEXIT)

CALL(RXSTART)


