CLS:CLEAR:SPCLR
M=0:P=-1:MMAX=29
BGMSTOP
GOSUB @DRAW
@MAIN
GOSUB @CHK
VSYNC 8
GOTO @MAIN
@CHK
B=BUTTON()
IF B AND 1 THEN M=M+1
IF B AND 2 THEN M=M-1
IF B AND 4 THEN M=RND(MMAX+1)
IF M<0 THEN M=MMAX
IF MMAX<M THEN M=0
IF B AND 24 THEN GOSUB @PLAYM
IF B AND 32 THEN GOSUB @STOPM
IF B AND 63 THEN GOSUB @DRAWM
RETURN
@PLAYM
BGMPLAY M
P-M
RETURN
@STOPM
BGMSTOP
P=-1
RETURN
@DRAW
CLS:COLOR 0
?"PETIT MUSIC PLAYER♪"
?"-------------------"
?"PUSH ↑↓ TO SELECT"
?"PUSH ← TO TEKITOU"
?"PUSH A→ TO PLAY"
?"PUSH B TO STOP"
?" ...ENJOY!"
?"-------------------"
?"NEXT MUSIC IS No.";M
IF P>=0 THEN ?"PLAYING MUSIC No.";P
RETURN