プチコンまとめWiki (初代/mkII)

Toukou/NaのmkII作品集 の変更点

パンくずリスト


#title(投稿プログラム : NaのmkII作品集)
#contents
// ↑この2行は削除しないでください。
// ←このように「//」で始まる行はコメントです。ページ本文には反映されません。
//------------------------------------------------------------------------------
// ・投稿年月日は、このページを投稿しようとしている今日の日付を半角数字で入力してください。
//   この日付は、投稿プログラムを自動的に年月日順に並べる際に使用されます。
// ↓↓↓
2020年4月14日投稿
// ↑↑↑
//------------------------------------------------------------------------------
// ・投稿者名は、投稿プログラム一覧に表示するために使用します。
// ・「名無しさん」のままにしておくと、匿名の方からの投稿として扱われます。
// ↓↓↓
/ 投稿者 : Na
// ↑↑↑
//------------------------------------------------------------------------------
// ・適当にタグをつけることができます。半角のコンマ区切りで複数つけられます。
//   タグをつけると、同じタグが付いたページを検索することができます。
// ★次に該当するプログラムは、特定のタグを設定するようご協力お願いします。
//   これらを設定すると、将来的に投稿プログラム一覧に目立つマークが付くようになる予定です。
// ・短いプログラム → 「1行プログラム」「数行プログラム」「1画面プログラム」タグのいずれか1つ
// ・初代プチコンでも動作するプログラム → 「初代対応」タグ
// ・mkII 以降専用のプログラム → 「mkII専用」タグ
// ・QRコードを掲載している → 「QRコード」タグ
// ・該当するなら「ゲーム」「実用ツール」「音楽」タグのいずれか
// ↓↓↓
/ &tag(投稿プログラム,ゲーム,実用ツール,音楽,QRコード,mkII専用);
// ↑↑↑

//------------------------------------------------------------------------------
// ここに概要とか書きます。
// ・** や *** で始まる行は子見出しとなります。* の数で深さが決まります。
// ・[#英数字] はページ内リンクに使用されるアンカーですが、
//   書かなかったり、消したりしてもかまいません。ない場合はランダムな文字列が自動付与されます。

* 概要 [#Summary]
mkIIで作った過去作品を投稿する気になったので投稿しました。~
1〜5年前のものなのであまり覚えてない部分もあります。~

** スロットゲーム [#n803d667]
-たぶんmkIIで最初に作ったゲームです。
-初代プチコンの公式プログラムリストの[[スロットゲーム>https://smileboom.com/special/petitcom/pochette-slotgame.html]]の改造です。
-Y,X,Aボタンで止めます。
-プログラムリストに隠しコマンド書いてあるんだけどこれは何()

#region(プログラムリスト(73行))
#basic{{
@RESET
CLEAR
DIM NUM(4)
WAIT 20
IF BGMCHK()==0 THEN BGMPLAY 14
COL=RND(11)+2
NUM(1)=RND(10)
NUM(2)=RND(10)
NUM(3)=RND(10)
@LOOP
CLS
IF BTY==0 THEN NUM(1)=NUM(1)+1
IF BTX==0 THEN NUM(2)=NUM(2)+1
IF BTA==0 THEN NUM(3)=NUM(3)+1
FOR Z=1 TO 3
    IF NUM(Z)==10 THEN NUM(Z)=0
NEXT
LOCATE 10,10
PRINT "Жスロット ケ゛-ムЖ"
LOCATE 10,11
PRINT "  ┌─┬─┬─┐"
LOCATE 10,12
PRINT "  │";
COLOR COL
PRINT NUM(1);
COLOR 15
PRINT "│";
COLOR COL
PRINT NUM(2);
COLOR 15
PRINT "│";
COLOR COL
PRINT NUM(3);
COLOR 15
PRINT "│"
LOCATE 10,13
PRINT "  └─┴─┴─┘"
LOCATE 10,14
PRINT "   Х Ф А"
'Кн↑テ゛ スヘ゜シャル モ-ト゛
IF BUTTON(0)==769 THEN SPCMD=NOT SPCMD
IF BUTTON(0) AND 128 THEN BTY=1
IF BUTTON(0) AND 64 THEN BTX=1
IF BUTTON(0) AND 16 THEN BTA=1
IF (BTY+BTX+BTA)==3 THEN GOTO @STP
IF SPCMD==FALSE THEN VSYNC 7 ELSE VSYNC 30
GOTO @LOOP
@STP
GOSUB @ATRHZR
BGMVOL 0,50
IF ATR==0 THEN BGMPLAY 1,6
IF ATR==2 THEN BGMPLAY 1,4
IF ATR==3 THEN BGMPLAY 1,5
@PLS
IF BGMCHK(1)==TRUE THEN @PLS
BGMVOL 0,127
LOCATE 10,16
PRINT "  ツツ゛ケル=А"
LOCATE 10,17
PRINT "   ヤメル =Б"
@CHK
IF BUTTON(0)==16 THEN @RESET
IF BUTTON(0)==32 THEN @OWARI
GOTO @CHK

@ATRHZR
IF NUM(1)==NUM(2) THEN ATR=ATR+1
IF NUM(2)==NUM(3) THEN ATR=ATR+1
IF NUM(3)==NUM(1) THEN ATR=ATR+1
IF ATR==1 THEN ATR=2
RETURN
@OWARI
END
}}
#endregion

#ref(slot3.png,,100%)

** アナログ時計 [#g364b9c0]
- グラフィックで作った時計です。以上。

#region(プログラムリスト(83行))
#basic{{
CENTERX=256/2
CENTERY=192/2
R=192/3
COL=15

ACLS
'LOCATE 9,8:?"タタ゛イマ ノ ニチシ゛ハ"
LOCATE 10,22:?"SELECT テ゛オワル"

'LOCATE 15,5:?"12"
'LOCATE 15,19:?"6"
'LOCATE 23,12:?"3"
'LOCATE 9,12:?"9"
@1
 LOCATE 11,1:?DATE$
 'LOCATE 11,11:?TIME$
 
 HOUR=VAL(LEFT$(TIME$,2))
 MIN=VAL(MID$(TIME$,3,2))
 SEC=VAL(RIGHT$(TIME$,2))
 HOUR=HOUR+MIN/60+SEC/3600
 MIN=MIN+SEC/60


 GCLS 0
 GCOLOR COL
 GCIRCLE CENTERX,CENTERY,R

@DAT
'X,ホセイ,Y,ホセイ,キャラ
 DATA 90,-8,8,1
 DATA 90,0,8,2
 DATA 60,-8,6,1
 DATA 30,-9,1,2
 DATA 0,-10,-4,3
 DATA 330,-9,-8,4
 DATA 300,-8,-10,5
 DATA 270,-4,-12,6
 DATA 240,1,-10,7
 DATA 210,2,-8,8
 DATA 180,3,-4,9
 DATA 150,2,1,1
 DATA 150,10,1,0
 DATA 120,-2,6,1
 DATA 120,6,6,1
 RESTORE @DAT
 FOR I=1 TO 15
  READ T,X,Y,C
  GPUTCHR COS(RAD(T))*R+X+CENTERX,CENTERY-SIN(RAD(T))*R+Y,"BGF",ASC(STR$(C)),0,1
 NEXT

'HOUR
 DEGR=HOUR/12*(-360)+90+360
 IF DEGR<0 THEN DEGR=DEGR+360
 IF DEGR>360 THEN DEGR=DEGR-360
 THETA=RAD(DEGR)
 LONG=R*1/2
 X=COS(THETA)*LONG+CENTERX
 Y=CENTERY-SIN(THETA)*LONG
 GLINE CENTERX,CENTERY,X,Y
'MINUTE
 DEGR=MIN/60*(-360)+90+360
 IF DEGR<0 THEN DEGR=DEGR+360
 IF DEGR>360 THEN DEGR=DEGR-360
 THETA=RAD(DEGR)
 LONG=R*9/10
 X=COS(THETA)*LONG+CENTERX
 Y=CENTERY-SIN(THETA)*LONG
 GLINE CENTERX,CENTERY,X,Y
'MINUTE
 DEGR=SEC/60*(-360)+90+360
 IF DEGR<0 THEN DEGR=DEGR+360
 IF DEGR>360 THEN DEGR=DEGR-360
 THETA=RAD(DEGR)
 LONG=R*9/10
 X=COS(THETA)*LONG+CENTERX
 Y=CENTERY-SIN(THETA)*LONG
 GLINE CENTERX,CENTERY,X,Y



VSYNC 10
GOTO @1
}}
#endregion

#ref(clock3.png,,100%)


** ビンボール [#de5f77a3]
- 「ピンボール」ではない
- 左右キーで水の入ったビンを操作して上から落ちてくるボールを避けるという謎ゲームです
- ボールに当たったあと一定時間たつと終了になります

#region(プログラムリスト(118行))
#basic{{
SYSBEEP=FALSE
LOAD "SPU0:BIN",FALSE
PNLTYPE "OFF"
@TITLE
BGMSTOP:CLS:SPCLR 
SPSET 0,16,0,0,0,0,64,64
SPOFS 0,0,0:SPSCALE 0,150
SPSET 1,32,0,0,0,0,64,64
SPOFS 1,192,96:SPSCALE 1,150
SPOFS 0,40,30,200
SPOFS 1,136,30,200

'LOCATE 9,5 :?"┛  ┛┛┠
'LOCATE 9,6 :?"┣┏━   ━┳
'LOCATE 9,7 :?"┛      ┗
'LOCATE 9,8 :?"┫┠┠  ┠┗
'LOCATE 9,10:?"┠┨┠┛┛      ┓
'LOCATE 9,11:?" ┻       ┻ ┛
'LOCATE 9,12:?"┻┻┻  ┏┏┏ ┻ ┛┳
'LOCATE 9,13:?"┛┻ ┛     ┗ ┯━
BGMPLAY 0,9,75
TALK "ヒ゛ンホ゛-ル____ヒ゜ンホ゛-ルシ゛ャナイヨ?"
WAIT 200
LOCATE 9,17:?"PRESS А BUTTON
@ABT
IF BUTTON()!=16 THEN @ABT

'シ゛ュンヒ゛
BGMSTOP:CLEAR:WATER=1000
LOAD "MEM:BIN",FALSE:HI=VAL(MEM$)
GOSUB @PRT
SPSET 0,1,0,0,0,0,32,8
BX=64:BY=144:SPOFS 0,BX,BY
SPSET 1,0,0,0,0,0:SPOFS 1,-20,0
SPSET 2,0,0,0,0,0:SPOFS 2,-20,0
FOR I=3 TO 5
 SPSET I,2,0,0,0,0
 SPANIM I,4,15
 SPOFS I,RND(145),RND(177)
NEXT
'SPANIM 1,2,15

VSYNC 0
BEEP 0:VSYNC 60
BEEP 0:VSYNC 60
BEEP 0:VSYNC 60
BEEP 32
BGMPLAY 2

'スタ-ト
@LOOP
VSYNC 1
B=BUTTON()
IF B AND 8 THEN GOSUB @MIGI
IF B AND 4 THEN GOSUB @HIDARI
GOSUB @BINCHK
GOSUB @BALLCHK
GOSUB @ATRHNT
IF FLOOR(WATER)<=0 THEN @EMPTY
GOTO @LOOP
@EMPTY
WATER=0:GOSUB @PRT
BGMPLAY 6
@BGM1
IF BGMCHK() THEN @BGM1
MEM$=STR$(SCORE)
IF SCORE>HI THEN SAVE "MEM:BIN"
GOTO @TITLE

@MIGI
BX=BX+1:SPOFS 0,BX,BY,1
RETURN
@HIDARI
BX=BX-1:SPOFS 0,BX,BY,1
RETURN
@BINCHK
IF BX<0 THEN BX=0
'160-32=128
IF BX>128 THEN BX=128
SPOFS 0,BX,BY
RETURN
@BALLCHK
TM=(TM+1) AND 63
IF TM!=0 THEN RETURN
'160-16=144
BEEP 6
SCORE=SCORE+5
LX=RND(145)
SPOFS 1,LX,-16
SPOFS 1,LX,192,64
LX2=RND(145)
SPOFS 2,LX2,-16
SPOFS 2,LX2,192,64
RETURN
@ATRHNT
IF SPHITSP(0,1) THEN BEEP 13:SPEED=SPEED+10:SPOFS 1,-20,-20
IF SPHITSP(0,2) THEN BEEP 13:SPEED=SPEED+10:SPOFS 2,-20,-20
FOR I=1 TO 2
 FOR J=3 TO 5
  IF SPHITSP(I,J) THEN BEEP 7:SCORE=SCORE+30:SPOFS I,-20,-20
 NEXT
NEXT
WATER=WATER-SPEED/60
GOSUB @PRT:RETURN
@PRT
CLS
LOCATE 22,5 :?"HISCORE:"
LOCATE 22,8 :?"SCORE  :"
LOCATE 22,11:?"SPEED  :"
LOCATE 22,14:?"WATER  :"
LOCATE 24,6:?HI
LOCATE 24,9:?SCORE
LOCATE 24,12:?SPEED;"mL/s"
LOCATE 24,15:?FLOOR(WATER);"mL"
FOR I=0 TO 23
 LOCATE 20,I:?"з";
NEXT
RETURN
}}
#endregion

#ref(bin.png,,100%)

#ref(binchr.png,,100%)

** STOP CAR [#ma0d59b6]
- レースゲーム...ではなく、ゴールの線にどれだけ近いところで車を停止できるかというゲームです。
- メニューでは左右キーで選択、Aで決定、Bで戻る(上下キーが使えそうな気がするけど使えません)
- ゲーム中は左右で移動、Aでアクセル、Bでブレーキ
- コインをとると+100点、他の車(?)に当たると減点です
- 地味にランキングが実装されてるけど...

#region(プログラムリスト(327行))
#basic{{
@BEG
BGMSTOP:ACLS:CLEAR:SYSBEEP=0
PNLTYPE "OFF"
SPEED=0:CARX=96:COL=7
DIM MODE(3),MODEHI(3,2),HI$(11,2),HIV(11,4)
RESTORE @D
FOR I=0 TO 2
 FOR J=0 TO 1
  READ MODEHI(I,J)
 NEXT
NEXT
@D
DATA 0,7,0,5,0,15
MODE(2)=RND(16)
LOAD"SPU0:0CAR",0
LOAD"SPU1:1CAR_SP",0
LOAD"BGU0:0CAR",0
LOAD"BGU1:1CAR",0
LOAD"BGU2:2CAR",0
LOAD"SCU1:1CAR",0
LOAD"SCU0:0CAR",0
LOAD"MEM:CAR",0
LOAD"SPS0L:0CAR",0
LOAD"SPS1L:1CAR_SP",0
BGOFS 0,-256,-48
BGOFS 1,-112,0
BGY=0
SPSET 0,62,MODE(2),0,0,0
SPSCALE 0,200
SPOFS 0,208,128
SPHOME 0,8,0
LOCATE 13,18:?"PRESS А
COLOR 3
PNLSTR 3,2,"DATE         NAME    SCORE
COLOR 0
PNLSTR 21,0,"Reset=START
'$1=DATE,0=CAR,1=USER,2=SCORE,3=COURSE
FOR I=0 TO 9
 HI$(I,0)=MID$(MEM$,I*18,18)
 HI$(I,1)=MID$(MEM$,I*18,10)
 HIV(I,0)=VAL("&H"+MID$(MEM$,I*18+10,1))
 HIV(I,1)=VAL("&H"+MID$(MEM$,I*18+11,1))
 HIV(I,2)=VAL("&H"+MID$(MEM$,I*18+12,5))
 HIV(I,3)=VAL("&H"+MID$(MEM$,I*18+17,1))
 GOSUB @PNS
NEXT

BGMPLAY 15
@TITLE
VSYNC 1
VS=1+VS AND 7
BGY=BGY-0.2
BGOFS 1,-112,BGY*10,1
IF VS>1 THEN @SK1
STOCHR=(RND(8)+1)*64-32-4
BGPUT 0,38,62,STOCHR,0,0,0
BGPUT 0,39,62,STOCHR+1,0,0,0
BGPUT 0,40,62,STOCHR+2,0,0,0
BGPUT 0,41,62,STOCHR+3,0,0,0
BGPUT 0,38,63,STOCHR+32,0,0,0
BGPUT 0,39,63,STOCHR+33,0,0,0
BGPUT 0,40,63,STOCHR+34,0,0,0
BGPUT 0,41,63,STOCHR+35,0,0,0
@SK1
IF BUTTON(2)==1024 THEN @RESET
IF BUTTON(2)!=16 THEN @TITLE

CLS
COLOR 3
PNLSTR 3,2,"DATE         NAME    SCORE
COLOR 0
FOR I=0 TO 9
 GOSUB @PNS
NEXT
BGOFS 0,-256,144,20
BGY=BGY-4
BGOFS 1,-112,BGY*10,20
WAIT 20
SPSET 1,64,0,0,0,0,32,16
SPOFS 1,80,48
SPSET 2,66,0,0,0,0,32,16
SPOFS 2,112,48
MODE(0)=0
SPSET 3,96,0,0,0,0,32,16
SPOFS 3,80,96
SPSET 7,111,0,0,0,0
SPOFS 7,116,96
MODE(1)=0
SPSET 4,112+MODE(2),0,0,0,0
SPOFS 4,100,144
MNO=0
SPSET 5,60,0,0,0,0,8,8
SPSET 6,61,0,0,0,0,8,8

@MODE
VSYNC 1
BGY=BGY-0.2
BGOFS 1,-112,BGY*10,1
IF BUTTON(2)==4 THEN MODE(MNO)=MODE(MNO)-1
IF BUTTON(2)==8 THEN MODE(MNO)=MODE(MNO)+1
IF MODEHI(MNO,0)>MODE(MNO) THEN MODE(MNO)=MODEHI(MNO,0)
IF MODEHI(MNO,1)<MODE(MNO) THEN MODE(MNO)=MODEHI(MNO,1)
SPCHR 1,MODE(0)*4+64
SPCHR 2,MODE(0)*4+66
SPCHR 3,MODE(1)*2+96
SPCHR 4,MODE(2)+112
SPCHR 0,62,MODE(2),0,0,0
IF BUTTON(2)==16 THEN MNO=MNO+1
IF BUTTON(2)==32 AND MNO>0 THEN MNO=MNO-1
SPOFS 5,40,(MNO+1)*8*6+4
SPOFS 6,176,(MNO+1)*8*6+4
IF MNO!=3 THEN @MODE

BGMPLAY 4
@BGM1
IF BGMCHK() THEN @BGM1
SPCLR 1:SPCLR 2:SPCLR 3:SPCLR 4
SPCLR 5:SPCLR 6:SPCLR 7
BGOFS 0,0,144,274
BGOFS 1,0,BGY*10,120
SPOFS 0,CARX,128,120
WAIT 230

COLOR COL
FOR I=0 TO 23
 FOR J=20 TO 31
  LOCATE J,I:?"В";
 NEXT
NEXT
COLOR 0
RESTORE @MET
FOR I=1 TO MODE(1)
 READ DUMMY
NEXT
READ METOR
START=METOR
COG=START+(208/6)
@MET
DATA 100,200,500,1000,2000,5000
SPSET 1,58,0,0,0,0
SPOFS 1,RND(256),-16

GOSUB @PRT
BEEP 0:WAIT 60
BEEP 0:WAIT 60
BEEP 0:WAIT 60
BEEP 0,4096

BGMPLAY 0
@LOOP
VSYNC 1
VS=1+VS AND 3
VSC=1+VSC AND 63
TI=TI+1
IF TI>60000 THEN TI=999.99*60
SPEEDMF=SPEED/3.6/60
METOR=METOR-SPEEDMF
IF METOR<-99999 THEN METOR=-99999
IF BUTTON() AND 16 THEN SPEED=(SPEED+0.05)*1.005+(SPEED==0)
IF BUTTON() AND 32 THEN SPEED=SPEED-0.1
IF BUTTON() AND 4 THEN CARX=CARX-(SPEED/100)
IF BUTTON() AND 8 THEN CARX=CARX+(SPEED/100)
SPEED=SPEED-0.003
IF SPEED>180 THEN SPEED=180
IF FLOOR(SPEED)==0 THEN SPEED=0
IF SPEED<0 THEN SPEED=0
'IF CARX<80 THEN CARX=80
'IF CARX>112 THEN CARX=112
IF (CARX<90 OR CARX>134)AND SPEED>11 THEN SPEED=SPEED*0.95
SPOFS 0,CARX,128,1
GOSUB @PRT
IF VS==1 THEN BEEP 0,-8192+SPEED/180*8192,50
GOSUB @COIN
IF METOR==START OR SPEED!=0 THEN @LOOP

IF ABS(METOR)<1 THEN BGMPLAY 5 ELSE BGMPLAY 6
SCORE0=FLOOR(ABS(METOR)/START*-10000+10000)
SCORE1=FLOOR(0-TI/START*50)
SCORE=COISC+SCORE0+SCORE1
'IF SCORE<-9999 THEN SCORE=-9999
COLOR 13
LOCATE 21,12:?"  SCORE   "
COLOR 9
LOCATE 21,13:?"GOAL:     "
LOCATE 21,14:?"TIME:     "
LOCATE 21,15:?"COIN:     "
LOCATE 21,17:?"TOTAL     "
COLOR 0
LOCATE 21,16:?"──────────"

@SC
IF BGMCHK() THEN @SC
WAIT 30:VSYNC 0
FOR I=0 TO SCORE0-1 STEP SCORE0/20
 LCT=LEN(STR$(FLOOR(I)))
 LOCATE 31-LCT,13:?FLOOR(I)
 BEEP 7,0,30:VSYNC 3
NEXT
LCT=LEN(STR$(SCORE0))
LOCATE 31-LCT,13:?FLOOR(SCORE0)
VSYNC 10
FOR I=0 TO SCORE1-1 STEP SCORE1/20
 LCT=LEN(STR$(FLOOR(I)))
 LOCATE 31-LCT,14:?FLOOR(I)
 BEEP 7,0,50:VSYNC 3
NEXT
LCT=LEN(STR$(SCORE1))
LOCATE 31-LCT,14:?SCORE1
VSYNC 10
FOR I=0 TO COISC-1 STEP COISC/20
 LCT=LEN(STR$(FLOOR(I)))
 LOCATE 31-LCT,15:?FLOOR(I)
 BEEP 7,0,50:VSYNC 3
NEXT
LCT=LEN(STR$(COISC))
LOCATE 31-LCT,15:?COISC
VSYNC 30
FOR I=0 TO SCORE-1 STEP SCORE/100
 LCT=LEN(STR$(FLOOR(I)))
 LOCATE 31-LCT,17:?FLOOR(I)
 BEEP 7,0,50:VSYNC 3
NEXT
LCT=LEN(STR$(SCORE))
LOCATE 31-LCT,17:?SCORE
BEEP 5,2048

HI$(10,1)=DATE$
HIV(10,0)=MODE(2)
HIV(10,1)=MODE(0)
HIV(10,2)=FLOOR(SCORE)
HIV(10,3)=MODE(1)
HI$(10,0)=DATE$+HEX$(MODE(2))+HEX$(MODE(0))+HEX$(SCORE,5)+HEX$(MODE(1))
BKHI$=HI$(10,0)
I=9
@SCCHK
IF HIV(I,2)>HIV(I+1,2) THEN @SAV
SWAP HI$(I,0),HI$(I+1,0)
SWAP HI$(I,1),HI$(I+1,1)
SWAP HIV(I,0),HIV(I+1,0)
SWAP HIV(I,1),HIV(I+1,1)
SWAP HIV(I,2),HIV(I+1,2)
SWAP HIV(I,3),HIV(I+1,3)
IF I>0 THEN I=I-1:GOTO @SCCHK
@SAV
FOR I=0 TO 9
 GOSUB @PNS
NEXT
MEM$=""
FOR I=0 TO 9
 MEM$=MEM$+HI$(I,0)
NEXT
CHRINIT "SPS1L"
@SAVCHK
SAVE"MEM:CAR"
IF RESULT==CANCEL THEN @SAVCHK
LOAD"SPS1L:1CAR_SP",0

@BUTN
VSYNC 1
IF BUTTON(1)==16 THEN @BEG
GOTO @BUTN

'END
'--SUBROUTINE--

@COIN
COT=COT+1
IF COT==30 THEN PRTCO$=""
IF SPHITSP(0,1)==0 THEN @SET
SPREAD(1),DUMMY1,DUMMY2,DUMMY3,DUMMY4,CH1
IF CH1==62 THEN PRTCO$="-500":COISC=COISC-500:BEEP 13 ELSE PRTCO$="+100":COISC=COISC+100:BEEP 7
SPOFS 1,0,-16
COT=0
GOTO @SET2
@SET
IF COG-METOR<208/6 THEN RETURN
@SET2
COG=METOR
COX=RND(256)
SPOFS 1,COX,-16
CH1=RND(2)
CH1=(0==CH1)*58+(1==CH1)*62
SPCHR 1,CH1
IF CH1==62 THEN SPANIM 1,1,1,1 ELSE SPANIM 1,2,15,0
'SPOFS 1,RND(256),208,64
RETURN

@PRT
COLOR COL
LOCATE 21,5:?"В"*11
LOCATE 21,7:?"В"*11
LOCATE 21,9:?"В"*11
LOCATE 21,12:?"В"*11
COLOR 0
LOCATE 21,5:?"GOAL=";ABS(FLOOR(METOR));"m"
LOCATE 21,7:?"SPEED=";FLOOR(SPEED);"km"
LOCATE 21,9:?"TIME=";FLOOR(TI/60*100)/100
LOCATE 21,12:?PRTCO$
BGY=FLOOR(METOR*6)
BGOFS 1,0,BGY,1
SPOFS 1,COX,(COG-METOR)*6-16,1
IF BGY<144 AND BGY>-70 THEN BGOFS 0,0,BGY,1
RETURN

@PNS
IF HI$(I,0)==BKHI$ THEN COLOR 13 ELSE COLOR I+2
PNLSTR (9!=I),I*2+4,STR$(I+1)
IF HI$(I,0)==BKHI$ THEN COLOR 13 ELSE COLOR 0
PNLSTR 3,I*2+4,HI$(I,1)
IF HI$(I,1)=="-"*10 THEN RETURN
PNLSTR 24,I*2+4," "*7
PNLSTR 24,I*2+4,STR$(HIV(I,2))
SPPAGE 1
SPSET I*4+1,64+HIV(I,1)*4,0,0,0,0,32,16
SPSET I*4+2,66+HIV(I,1)*4,0,0,0,0,32,16
SPOFS I*4+1,8*16-4,8*(I*2+4)-8
SPOFS I*4+2,8*16+32-4,8*(I*2+4)-8
'SPSCALE I*4+1,50
SPSET I*4+0,62,HIV(I,0),0,0,0
SPOFS I*4+0,8*14-4,8*(I*2+4)-4
SPPAGE 0
RETURN

@RESET
MEM$="----------00F00000"*10
SAVE"MEM:CAR"
IF RESULT==TRUE THEN @BEG ELSE @TITLE
}}
#endregion

#ref(car.png,,100%)

#ref(0car.png,,100%)

#ref(1car.png,,100%)

#ref(1carsp.png,,100%)

#ref(2car.png,,100%)

#ref(0carscr.png,,100%)

#ref(1carscr.png,,100%)

** プチトゥーン [#m90af7d0]
- %%スプラトゥーンもどき%%
- DS1台で2人プレイです。
- 1分間で下画面を多く塗った方が勝ちです。%%イカとかボムとかスペシャルとかはありません%%
- 1Pは十字キーで移動、Lボタンで塗ります
- 2PはABXYボタンで移動、Rボタンで塗ります
- プレイヤーを倒すという概念はありません

#region(プログラムリスト(196行))
#basic{{
ACLS:CLEAR
SYSBEEP=FALSE
PNLTYPE "OFF"
LOAD"COL1L:PTOON",0
LOAD"COL2L:PTOON",0
LOAD"COL2:PTOON",0
LOAD"SPS0L:SP1",0
LOAD"BGU0:PTOON",0

@SET
'シタカ゛メン ヒ゛ョウカ゛
GPAGE 1,2,1
BC=RND(256)
GCLS BC
P1SCX=100:P1SCY=100
P2SCX=155:P2SCY=100
'SIZE=8
@CL
P1COL=RND(12)+1:P2COL=RND(12)+1
IF P1COL==P2COL THEN @CL

LOAD"SCU0:0PTOON",0
BGMPLAY 14
LOCATE 9,19:?"Press А Button"
PNLSTR 1,3,"*** How to Play "+CHR$(34)+"フ゜チトゥ-ン"+CHR$(34)+"? ***"
PNLSTR 5,5,"1Player:"
PNLSTR 7,6,  "П  ・・・イト゛ウ"
PNLSTR 7,7,  "К  ・・・ハッシャ"
PNLSTR 5,9,"2Player:"
PNLSTR 6,10,"АБФХ・・・イト゛ウ"
PNLSTR 7,11, "н  ・・・ハッシャ"
PNLSTR 5,14,"1フ゜ンノ ナカテ゛、テ゛キルタ゛ケ ヒロイ
PNLSTR 5,16,"メンセキヲ ヌッタ ホウカ゛ カチ。

@BTNPPPPP
IF BUTTON() AND 16 THEN ELSE @BTNPPPPP




SPPAGE 1
SPSET 0,0,P1COL,0,0,0
SPSET 1,0,P2COL,1,0,0
SPHOME 0,16,16
SPHOME 1,0,16
SPOFS 0,P1SCX,P1SCY
SPOFS 1,P2SCX,P2SCY
GPAGE 1,2,2
CLS
GOSUB @CLSL
BGMSTOP

TGC=4 'Time Graph Color
GPAGE 0
GLINE 0,7,255,7,TGC
LOCATE 15,0:?3:BEEP 0:WAIT 60
LOCATE 15,0:?2:BEEP 0:WAIT 60
LOCATE 15,0:?1:BEEP 0:WAIT 60
BEEP 0,4096
BGMPLAY 2
@MAIN
TIME=TIME+1
VSYNC 1
GPAGE 1,2,2

IF BUTTON() AND 1 THEN P1SCY=P1SCY-1
IF BUTTON() AND 2 THEN P1SCY=P1SCY+1
IF BUTTON() AND 4 THEN P1SCX=P1SCX-1
IF BUTTON() AND 8 THEN P1SCX=P1SCX+1
IF P1SCX<0 THEN P1SCX=0
IF P1SCX>255 THEN P1SCX=255
IF P1SCY<0 THEN P1SCY=0
IF P1SCY>191 THEN P1SCY=191
SPOFS 0,P1SCX,P1SCY
IF BUTTON() AND 256 THEN P1MODE=1 ELSE P1MODE=0
'IF P1BOM!=0 THEN P1BOM=P1BOM-1
DOTX=P1SCX+RND(10)+10
DOTY=P1SCY+RND(20)-10
IF P1MODE==1 THEN GCIRCLE DOTX,DOTY,2,P1COL
IF P1MODE==1 THEN GPAINT DOTX,DOTY,P1COL
IF P1MODE==1 THEN BEEP 1,0,32
'IF P1MODE==1 AND P1BOM==0 THEN GOSUB @BOM
'GOSUB @P1GRP
'CLS
'LOCATE 24,23:?"ホ゛ム:";P1BOM;

IF BUTTON() AND 64 THEN P2SCY=P2SCY-1
IF BUTTON() AND 32 THEN P2SCY=P2SCY+1
IF BUTTON() AND 16 THEN P2SCX=P2SCX+1
IF BUTTON() AND 128 THEN P2SCX=P2SCX-1
IF P2SCX<0 THEN P2SCX=0
IF P2SCX>255 THEN P2SCX=255
IF P2SCY<0 THEN P2SCY=0
IF P2SCY>191 THEN P2SCY=191
SPOFS 1,P2SCX,P2SCY
IF BUTTON() AND 512 THEN P2MODE=1 ELSE P2MODE=0
DOTX=P2SCX-RND(10)-10
DOTY=P2SCY+RND(20)-10
IF P2MODE==1 THEN GCIRCLE DOTX,DOTY,2,P2COL
IF P2MODE==1 THEN GPAINT DOTX,DOTY,P2COL
IF P2MODE==1 THEN BEEP 1,0,32

'CLS
'?P1COL
'?P2COL
'?P2SCX
'?P2SCY

'1フ゜ン
CLS:LOCATE 11,0:?"ノコリ:";60-FLOOR(TIME/60);"ヒ゛ョウ"
GPAGE 0
GLINE 0,7,255,7,0
GLINE 0,7,256-(TIME/(60*60)*256),7,TGC

IF TIME==60*30 THEN COLOR 3:TGC=14

'BGMスヒ゜-ト゛アッフ゜シ゛カン
SPDUP=45
IF TIME==60*SPDUP THEN BGMPLAY 29:COLOR 13:TGC=2

IF TIME!=60*60 THEN @MAIN

GPAGE 0,0,0
GCLS 
BGCLR 
BGMPLAY 8
@KEKKA
SPD=30
FOR J=0 TO 191
    FOR I=0 TO 255 STEP SPD
        GPAGE 1,2,2
        FOR P=0 TO SPD-1
            GCOL=GSPOIT(I+P,J)
            IF GCOL==P1COL THEN P1SCORE=P1SCORE+1
            IF GCOL==P2COL THEN P2SCORE=P2SCORE+1
        NEXT
        CLS
        COLOR 13
        LOCATE 11,0:?"ノコリ:0ヒ゛ョウ"
        COLOR 0
        LOCATE 0,6:?P1SCORE;"Dots"
        LOCATE 28-LEN(STR$(P2SCORE)),6:?P2SCORE;"Dots"
        LOCATE 10,5:?"---Result---
        GPAGE 0,0,0
        GFILL 0,56,P1SCORE/192,79,P1COL
        GFILL 255,56,256-P2SCORE/192,79,P2COL
                       '=P2SCORE/(256*192)*256
        VSYNC 1
    NEXT
NEXT
SCMAX=P1SCORE+P2SCORE
GFILL 0,56,P1SCORE/SCMAX*256,80,P1COL
GFILL 255,56,256-P2SCORE/SCMAX*256,80,P2COL
IF P1SCORE>P2SCORE THEN LOCATE 0,10:?"Win!           из        Lose..."
IF P2SCORE>P1SCORE THEN LOCATE 0,10:?"Lose...        из           Win!"

BGMPLAY 4
LOCATE 9,19:?"Press А Button"
@BTNBBBBB
IF BUTTON() AND 16 THEN ELSE @BTNBBBBB

GCLS 
CLS:WAIT 10
GOTO @SET




@CLSL
 'シタカ゛メンCLS
 FOR CLSL_I=0 TO 23
  PNLSTR 0,CLSL_I," "*32
 NEXT
RETURN

@BOM
'ハ゛クタ゛ン(ハイキョ)
GCIRCLE P1SCX+400/SIZE,P1SCY+96/SIZE,20,1
BEEP 13,0,32
GPAINT P1SCX+400/SIZE,P1SCY+96/SIZE,2,1
GCIRCLE P1SCX+400/SIZE,P1SCY+96/SIZE,20,2
P1BOM=180
RETURN

@P1GRP
'カクタ゛イ ヒョウシ゛(ハイキョ)
FOR I=0 TO 255 STEP SIZE
 FOR J=0 TO 191 STEP SIZE
  I2=I/SIZE+P1SCX:J2=J/SIZE+P1SCY
GPAGE 1,2,2
  CL=GSPOIT(I2,J2)
GPAGE 0,0,0
  GFILL I,J,I+SIZE,J+SIZE,CL
 NEXT J
NEXT I
RETURN
}}
-廃墟とは? 没って意味かな
#endregion

#ref(ptoon.png,,100%)

(CHR:SP1の中身はSPU1と同じです)
#ref(sp1.png,,100%)

#ref(ptoonchr.png,,100%)

#ref(ptooncol.png,,100%)

#ref(0ptoon.png,,100%)

** SKAT STG [#t6017db2]
- サンプルゲーム3(SIMPLE STG)の改造です。
- 敵を倒すと周りの敵も誘爆して倒せます。
- 自機のHPが1000なので、まず死にません。
- スコアが下画面に表示されます。
- ステージクリアするごとにセーブできます。

#region(プログラムリスト(597行))
#basic{{
'┌──────────────────┐
'│シュ-ティンク゛サンフ゜ル v1.1│
'└──────────────────┘
'スフ゜ライト ワリアテ
'  0~:Г myship
'  8~:↑ myshot
' 16~:Е enemy
' 24~:↓ enshot
' 64~:● explosion
' 72~:Н boss

@INIT 'ショキカ
 CLEAR
 UNUSED=-4096
 PHASE=0
 STAGE=1
 PHASCNT=0
 COMBO=0
 SYSBEEP=FALSE
 TITMD=0
 BGMCHNG=FALSE

 'カ゛メン
 ACLS
 BGMPLAY 23
 VISIBLE 0,1,0,0,0,0
 PNLTYPE "OFF"
 VSYNC 1

 'フ゜レイヤ-
 SCORE=0
 SCOREH=0
 MYX=120 : MYY=192 : MYSPD=3
 MYCNT=0 : MYSTAT=1
 MYHP=1000
 SPSET 0,288,11,0,0,1
 SPOFS 0,MYX,MYY
 SPSET 1,289,11,0,0,1
 SPOFS 1,MYX,MYY+10

 'ショット
 MSHMAX=4
 MSHCNT=0
 DIM MYSHOTX(4),MYSHOTY(4)
 FOR I=0 TO 3
  MYSHOTX(I) = UNUSED
  MYSHOTY(I) = 0
  SPSET I+8,223,12,0,0,1
  SPOFS I+8,-16,-16
 NEXT

 'ハイケイ
 DIM STARX(16),STARY(16)
 DIM STARSPD(16)
 FOR I=0 TO 15
  STARX(I) = RND(256)
  STARY(I) = RND(192)
  STARSPD(I) = (RND(16)+1)/4
 NEXT

 'テキ
 DIM ENMX(8),ENMY(8),ENMCNT(8),ENMHP(8)
 GENMCNT=0 : ENMMAX=8
 FOR I=0 TO 7
  ENMX(I) = UNUSED
  ENMY(I) = 0
  ENMHP(I) = 0
  SPSET I+16,178,11,0,0,1
  SPANIM I+16,3,4,0
  SPOFS I+16,-16,-16
 NEXT

 'テキタ゛ン
 DIM ENSHOTX(32),ENSHOTY(32),ENSHDIR(32)
 ESHTCNT=0 : ESHTMAX=32
 FOR I=0 TO 31
  ENSHOTX(I) = UNUSED
  ENSHOTY(I) = 0
  SPSET I+24,214,0,0,0,1
  SPANIM I+24,2,4,0
  SPOFS I+24,-16,-16
 NEXT

 'ハ゛クハツ
 DIM EXPX(4),EXPY(4),EXPCNT(4)
 GEXPCNT=0 : EXPMAX=4
 FOR I=0 TO 3
  EXPX(I) = UNUSED
  EXPY(I) = 0
  EXPCNT(I) = 0
  SPSET I+64,248,0,0,0,1
  SPOFS I+64,-16,-16
 NEXT

 'ホ゛ス
 SPSET 72,340,11,0,0,1
 SPSET 73,341,11,0,0,1
 SPSET 74,342,11,0,0,1
 SPSET 75,343,11,0,0,1
 SPOFS 72,-16,-16
 SPOFS 73,-16,-16
 SPOFS 74,-16,-16
 SPOFS 75,-16,-16
 BOSSX=UNUSED
 BOSSY=0
 BOSSHP=0
 BOSSCNT=0

 'ロ-ト゛
 LOAD "MEM:SKATSTG",FALSE
 IF MEM$!="" THEN SCOREH=VAL(LEFT$(MEM$,5))
 IF MEM$!="" THEN SCORE=VAL(MID$(MEM$,5,5))
 IF MEM$!="" THEN STAGE=VAL(MID$(MEM$,10,5))
 IF MEM$=="" THEN TITMD=1

 VISIBLE 1,1,0,0,1,1

@MAIN 'メインル-フ゜
 OLDBTN = BTN
 BTN = BUTTON()
 ON PHASE GOSUB @TITLE,@GAME,@BOSSSCN,@GAMEOVER,@GCLEAR
 PHASCNT=PHASCNT+1
 VSYNC 1
GOTO @MAIN

@ANYBTN
 R=0
 IF OLDBTN THEN RETURN
 IF BTN THEN R=BTN
RETURN

@TITLE
 GOSUB @ANYBTN
 LOCATE 6,4:PRINT"┗┫┻ ┗┳┏┓┏┣━┗┫┃╋┏┳┏┫
 LOCATE 6,5:PRINT"┫┓┻┗ ┻ ┛ ┛ ┫┓ ┻ ┻┳┠
 LOCATE 6,6:PRINT"┓┻┻┃┓┻┏┛ ┛ ┓┻ ┻ ┻ ┻
 LOCATE 6,7:PRINT"┃━┃ ┃┃ ━ ━ ┃━ ┃  ┏━


 IF PHASCNT<2 THEN RETURN

 IF MEM$!="" THEN LOCATE 7,16:?"Continue(STAGE ";STAGE;")"
 LOCATE 7,17:?"New Game
 IF TITMD==0 THEN LOCATE 6,16:?"→":LOCATE 6,17:?" "
 IF TITMD==1 THEN LOCATE 6,16:?" ":LOCATE 6,17:?"→"

 IF R==1 AND MEM$!="" THEN TITMD=0
 IF R==2 THEN TITMD=1

 IF R==16 AND TITMD==1 THEN SCORE=0:SCOREH=0:STAGE=1
 IF R==16 THEN PHASE = 1:BGMPLAY 23:PHASCNT=0:CLS
RETURN

@GAME
 IF PHASCNT<60 THEN LOCATE 11,11:PRINT "STAGE ";STAGE
 IF PHASCNT==60 THEN LOCATE 11,11:PRINT "          "
 GOSUB @DISPBG
 GOSUB @DISPSCOR
 GOSUB @ENSHOT
 GOSUB @ENEMY
 GOSUB @MYSHOT
 GOSUB @MYSHIP
 GOSUB @EXPLSION
 IF PHASCNT==1200 THEN GOSUB @TOBOSS
RETURN

@TOBOSS
 PHASE=2
 PHASCNT=0
 IF BGMCHNG==FALSE THEN BGMSTOP
 BOSSX=112
 BOSSY=-32
 BOSSHP=55+5*STAGE
 BOSSCNT=1
 TARGETX=112
 SPCHR 72,340
 SPCHR 73,341
 SPCHR 74,342
 SPCHR 75,343
RETURN

@BOSSSCN
 COLOR 13
 IF PHASCNT<60 THEN LOCATE 12,11:PRINT "WARNING!!"
 IF PHASCNT==60 THEN LOCATE 12,11:PRINT "         "
 COLOR 0
 IF PHASCNT==120 AND BGMCHNG==FALSE THEN BGMPLAY 13
 GOSUB @DISPBG
 GOSUB @DISPSCOR
 GOSUB @ENSHOT
 GOSUB @ENEMY
 GOSUB @MYSHOT
 GOSUB @MYSHIP
 GOSUB @EXPLSION
 GOSUB @BOSS
RETURN

@BOSS 'ホ゛ス
 IF BOSSHP==0 THEN @BOSSTHRU

 'ホ゛スノ ウコ゛キ
 IF BOSSCNT%120==0 THEN TARGETX=RND(160)+32
 IF BOSSX>TARGETX THEN BOSSX=BOSSX-1
 IF BOSSX<TARGETX THEN BOSSX=BOSSX+1

 IF BOSSCNT<80 THEN BOSSY=BOSSY+1:GOTO @BOSHTHRU
 IF BOSSCNT%30==0 THEN GOSUB @BOSSSHOT
 @BOSHTHRU

 SPOFS 72,BOSSX,BOSSY
 SPOFS 73,BOSSX+16,BOSSY
 SPOFS 74,BOSSX,BOSSY+16
 SPOFS 75,BOSSX+16,BOSSY+16

 'ハンテイ
 FOR I=0 TO 3
  IF BOSSX-8>MYSHOTX(I) THEN @BOSSJDNX
  IF BOSSX+24<MYSHOTX(I) THEN @BOSSJDNX
  IF BOSSY-8>MYSHOTY(I) THEN @BOSSJDNX
  IF BOSSY+8<MYSHOTY(I) THEN @BOSSJDNX
  BOSSHP=BOSSHP-1
  MYSHOTY(I)=-16
  SPOFS I+8,0,-16
  BEEP 0
  IF BOSSHP==0 AND BGMCHNG==FALSE THEN BGMSTOP 
  IF BOSSHP==0 THEN BOSSCNT=0:SCORE=SCORE+100+FLOOR(COMBO/10)
  @BOSSJDNX
 NEXT

 @BOSSTHRU
 BOSSCNT=BOSSCNT+1

 IF BOSSHP==0 THEN GOSUB @BOSSEXP

RETURN


@BOSSSHOT
 DIR = (RND(256)-128)*PI()/512
 FOR I=0 TO STAGE
  IF I==6 THEN RETURN
  IF ENSHOTX(ESHTCNT)!=UNUSED THEN RETURN
  ENSHOTX(ESHTCNT)=BOSSX+8
  ENSHOTY(ESHTCNT)=BOSSY+8
  ENSHDIR(ESHTCNT)=(RND(256)-128)*PI()/512
  SPOFS ESHTCNT+24,ENSHOTX(ESHTCNT),ENSHOTY(ESHTCNT)
  ESHTCNT=ESHTCNT+1
  IF ESHTCNT>=ESHTMAX THEN ESHTCNT=0
 NEXT
RETURN

@CNTNUE
 LOCATE 12,14:?"Continue?"
 LOCATE 15,16:?"Yes"
 LOCATE 15,17:?"No"
 IF BUTTON()==1 THEN TITMD=0
 IF BUTTON()==2 THEN TITMD=1
 IF TITMD==0 THEN LOCATE 14,16:?"→":LOCATE 14,17:?" "
 IF TITMD==1 THEN LOCATE 14,16:?" ":LOCATE 14,17:?"→"
 IF BUTTON()==16 AND TITMD==1 THEN @INIT
 IF BUTTON()==16 AND TITMD==0 AND BGMCHNG==FALSE THEN BGMPLAY 23
 IF BUTTON()==16 AND TITMD==0 THEN PHASE=1:PHASCNT=0:STAGE=STAGE+1:CLS
RETURN
@BOSSEXP 'ホ゛ス キエル
 IF BOSSCNT<64 THEN BEEP 13
 IF BOSSCNT==1 THEN @BOSSEXP1
 IF BOSSCNT==16 THEN @BOSSEXP2
 IF BOSSCNT==32 THEN @BOSSEXP3
 IF BOSSCNT==48 THEN @BOSSEXP4
 IF BOSSCNT==64 THEN @BOSSCLR
 IF BOSSCNT==128 THEN STAGE=STAGE+1:GOSUB @SAV:STAGE=STAGE-1:TITMD=0
 IF BOSSCNT>=128 THEN GOSUB @CNTNUE
 RETURN
 @BOSSEXP1
 SPCHR 72,352
 SPCHR 73,353
 SPCHR 74,354
 SPCHR 75,355
 RETURN
 @BOSSEXP2
 SPCHR 72,356
 SPCHR 73,357
 SPCHR 74,358
 SPCHR 75,359
 RETURN
 @BOSSEXP3
 SPCHR 72,360
 SPCHR 73,361
 SPCHR 74,362
 SPCHR 75,363
 RETURN
 @BOSSEXP4
 SPCHR 72,364
 SPCHR 73,365
 SPCHR 74,366
 SPCHR 75,367
 RETURN
 @BOSSCLR
 SPOFS 72,-16,-16
 SPOFS 73,-16,-16
 SPOFS 74,-16,-16
 SPOFS 75,-16,-16
RETURN

@SAV
 MEM$=LEFT$(STR$(SCOREH)+"    ",5)
 MEM$=MEM$+LEFT$(STR$(SCORE)+"    ",5)
 MEM$=MEM$+LEFT$(STR$(STAGE)+"    ",5)
 SAVE "MEM:SKATSTG"
RETURN

@GAMEOVER
 FOR I=0 TO 99
  SPCLR I
 NEXT
 GLINE MYX+8,MYY+8,RND(256),RND(256),RND(256)
 GCIRCLE MYX+8,MYY+8,RND(100)+2,RND(256)
 LOCATE 12,12:PRINT "GAME OVER"
 GOSUB @ANYBTN
 IF R AND 16 THEN GOSUB @SAV:GOTO @INIT
RETURN

@DISPBG 'ハイケイ ヒョウシ゛
 FOR I=0 TO 7
  GPSET STARX(I),STARY(I),0
  STARY(I)=STARY(I)+STARSPD(I)
  GPSET STARX(I),STARY(I),STAGE%256
  IF STARY(I) > 192 THEN GOSUB @STARINIT
 NEXT
RETURN

@STARINIT 'ホシノイチ モト゛ス
 STARX(I) = RND(256)
 STARY(I) = 0
 STARSPD(I) = (RND(16)+1)/4
RETURN

@ENSHOT 'テキ ショット
 FOR I=0 TO 31
  IF ENSHOTX(I)==UNUSED THEN @ESHTHRU
  ENSHOTX(I)=ENSHOTX(I)+SIN(ENSHDIR(I))*2
  ENSHOTY(I)=ENSHOTY(I)+COS(ENSHDIR(I))*2
  SPOFS I+24,ENSHOTX(I),ENSHOTY(I),2

  IF ENSHOTX(I)>256 THEN ENSHOTX(I)=UNUSED
  IF ENSHOTX(I)<-16 THEN ENSHOTX(I)=UNUSED
  IF ENSHOTY(I)>192 THEN ENSHOTX(I)=UNUSED
  IF ENSHOTY(I)<-16 THEN ENSHOTX(I)=UNUSED
  @ESHTHRU
 NEXT
RETURN

@ENEMY 'テキ
 IF PHASE!=1 THEN @GENMTHRU
 IF MAINCNTL%16 THEN @GENMTHRU
 IF ENMX(GENMCNT)!=UNUSED THEN @GENMTHRU
  ENMX(GENMCNT) = RND(240)
  ENMY(GENMCNT) = -16
  ENMHP(GENMCNT)= 1
  ENMCNT(GENMCNT) = 0
  SPOFS GENMCNT+16,ENMX(GENMCNT),-16
  GENMCNT=GENMCNT+1
  IF GENMCNT>=ENMMAX THEN GENMCNT=0
 @GENMTHRU

 FOR I=0 TO 7
  IF ENMX(I)==UNUSED THEN @ENMTHRU
  ENMY(I) = ENMY(I)+0.75
  ENMCNT(I) = ENMCNT(I)+1
'  IF ENMY(I)>192 THEN ENMX(I)=UNUSED
  IF ENMY(I)<192 THEN @ENGLTHRU
   MYX=ENMX(I)
   MYY=ENMY(I)
   GMOVFLG=TRUE
   PHASE=3
   BGMPLAY 6
   SPOFS 0,-16,-16
   SPOFS 1,-16,-16
 @ENGLTHRU
  IF ENMCNT(I)%16==0 THEN GOSUB @GENMSHOT

  'ハンテイ
  J=0
  @ENMJUDGE
   IF MYSHOTX(J)==UNUSED THEN @ENMJDGNX
   IF ENMX(I)-8>MYSHOTX(J) THEN @ENMJDGNX
   IF ENMX(I)+8<MYSHOTX(J) THEN @ENMJDGNX
   IF ENMY(I)-8>MYSHOTY(J) THEN @ENMJDGNX
   IF ENMY(I)+8<MYSHOTY(J) THEN @ENMJDGNX
   ENMHP(I)=ENMHP(I)-1
   ENMY(I)=ENMY(I)-3
   MYSHOTY(J)=-32
   SPOFS J+8,-32,0
   IF ENMHP(I)>0 THEN @ENMJDGNX
   P1=ENMX(I):P2=ENMY(I)
   GOSUB @GENEXP
   COMBO=COMBO+1
   SCORE=SCORE+1+FLOOR(COMBO/100)
   FOR K=0 TO 7
    IF ENMX(K)==UNUSED THEN @GENMCMB
    IF K==I THEN @GENMCMB
    IF ABS(ENMX(K)-ENMX(I))>64 THEN @GENMCMB
    IF ABS(ENMY(K)-ENMY(I))>64 THEN @GENMCMB
    ENMHP(K)=0
    P1=ENMX(K):P2=ENMY(K)
    GOSUB @GENEXP
    ENMX(K)=UNUSED
    SPOFS K+16,ENMX(K),ENMY(K)
    COMBO=COMBO+1
    SCORE=SCORE+1+FLOOR(COMBO/100)
    @GENMCMB
   NEXT
   ENMX(I)=UNUSED
   @ENMJDGNX
   J=J+1
  IF J<=3 THEN @ENMJUDGE

  SPOFS I+16,ENMX(I),ENMY(I),2

  @ENMTHRU
 NEXT
RETURN

@GENMSHOT 'テキタ゛ン ハッシャ
 FOR J=0 TO STAGE
  IF J==6 GOTO @ENSHTHRU
  IF ENSHOTX(ESHTCNT)!=UNUSED THEN @ENSHTHRU
  ENSHOTX(ESHTCNT)=ENMX(I)
  ENSHOTY(ESHTCNT)=ENMY(I)
  ENSHDIR(ESHTCNT)=RND(1024)*PI()/512
  SPOFS ESHTCNT+24,ENSHOTX(ESHTCNT),ENSHOTY(ESHTCNT)
  ESHTCNT=ESHTCNT+1
  IF ESHTCNT>=ESHTMAX THEN ESHTCNT=0
  @ENSHTHRU
 NEXT
RETURN

@GENEXP 'ハ゛クハツ セイセイ
 BEEP 11
 EXPX(GEXPCNT)=P1
 EXPY(GEXPCNT)=P2
 EXPCNT(GEXPCNT)=0
 SPOFS GEXPCNT+64,P1,P2
 SPANIM GEXPCNT+64,4,8,1
 GEXPCNT=GEXPCNT+1
 IF GEXPCNT>=EXPMAX THEN GEXPCNT=0
RETURN

@MYSHOT 'シ゛キ ショット
 FOR I=0 TO 3
  IF MYSHOTX(I)==UNUSED THEN @MYSHTHR
  MYSHOTY(I) = MYSHOTY(I)-8
  SPOFS I+8,MYSHOTX(I),MYSHOTY(I),2
  IF MYSHOTY(I) < -16 THEN GOSUB @RMVMYSHT
  @MYSHTHR
 NEXT
RETURN

@RMVMYSHT 'ショット ケス
 MYSHOTX(I) = UNUSED
RETURN

@EXPLSION 'ハ゛クハツ
 FOR I=0 TO 3
  IF EXPCNT(I) == 20 THEN SPOFS I+64,-16,-16
  EXPCNT(I)=EXPCNT(I)+1
 NEXT
RETURN

@DISPSCOR 'スコア ヒョウシ゛
 IF MYHP<=250 AND BGMCHNG==FALSE THEN BGMCHNG=TRUE:BGMPLAY 29


 IF SCORE>=100000 THEN SCORE=SCORE-100000:SCOREH=SCOREH+1

 
 LOCATE 11,0
 IF PHASE==2 THEN PRINT "BOSS Lv.";RIGHT$("  "+STR$(STAGE),2) ELSE PRINT "          "
 
 GPAGE 0
 GLINE 88,9,168,9,0
 GCOLOR 2
 IF BOSSHP>=(55+5*STAGE)/4 THEN GCOLOR 8
 IF BOSSHP>=(55+5*STAGE)/2 THEN GCOLOR 4
 IF BOSSHP>0 THEN GLINE 88,9,88+BOSSHP*80/(55+5*STAGE),9

 PNLSTR 0,0,"SHIP:"
 PNLSTR 23,0,RIGHT$("   "+STR$(MYHP),4)+"/1000"
 GPAGE 1
 GLINE 0,9,256,9,0
 GCOLOR 2
 IF MYHP>=250 THEN GCOLOR 8
 IF MYHP>=500 THEN GCOLOR 4
 GLINE 0,9,256*MYHP/1000,9

 SCX=4:SCV=FLOOR(SCOREH/100)
 GOSUB @DISPSCRL
 SCX=7:SCV=FLOOR(SCOREH%100/10)
 GOSUB @DISPSCRL
 SCX=10:SCV=FLOOR(SCOREH%10)
 GOSUB @DISPSCRL
 SCX=13:SCV=FLOOR(SCORE/10000)
 GOSUB @DISPSCRL
 SCX=16:SCV=FLOOR(SCORE%10000/1000)
 GOSUB @DISPSCRL
 SCX=19:SCV=FLOOR(SCORE%1000/100)
 GOSUB @DISPSCRL
 SCX=22:SCV=FLOOR(SCORE%100/10)
 GOSUB @DISPSCRL
 SCX=25:SCV=FLOOR(SCORE%10)
 GOSUB @DISPSCRL

 PNLSTR 13,6,"SCORE"

 PNLSTR 4,16,"STAGE "+STR$(STAGE)
 PNLSTR 8,19,"Е "*FLOOR(COMBO/100+1)
 PNLSTR 24,19,"        "

 GPAGE 0
RETURN

@DISPSCRL
 SCY=8
 IF SCV==0 THEN SC1$="┗┏┓":SC2$="┛ ┛":SC3$="┛ ┛":SC4$="┃┏ "
 IF SCV==1 THEN SC1$="┳┛ ":SC2$=" ┛ ":SC3$=" ┛ ":SC4$="┃┏ "
 IF SCV==2 THEN SC1$="┗┏┓":SC2$=" ┳━":SC3$="┳━ ":SC4$="┏┏━"
 IF SCV==3 THEN SC1$="┗┏┓":SC2$=" ┠━":SC3$="┓ ┛":SC4$="┃┏ "
 IF SCV==4 THEN SC1$=" ┨ ":SC2$="┗┻ ":SC3$="┏╋━":SC4$=" ┃ "
 IF SCV==5 THEN SC1$="┣┏━":SC2$="┏┏┓":SC3$="┓ ┛":SC4$="┃┏ "
 IF SCV==6 THEN SC1$="┳┏ ":SC2$="┯┠ ":SC3$="┛ ┛":SC4$="┃┏ "
 IF SCV==7 THEN SC1$="┏┏┛":SC2$=" ┳━":SC3$=" ┛ ":SC4$=" ━ "
 IF SCV==8 THEN SC1$="┗┏┓":SC2$="┫┠━":SC3$="┛ ┛":SC4$="┃┏ "
 IF SCV==9 THEN SC1$="┗┏┓":SC2$="┫┠┛":SC3$=" ┳━":SC4$="┃━ "
 PNLSTR SCX,SCY,SC1$
 PNLSTR SCX,SCY+1,SC2$
 PNLSTR SCX,SCY+2,SC3$
 PNLSTR SCX,SCY+3,SC4$

RETURN

@MYSHIP 'フ゜レイヤ-
 IF MYCNT<24 THEN MYY=MYY-2
 IF MYCNT==128 THEN MYSTAT=0

 SPCHR 0,288:SPCHR 1,289
 IF BTN AND 1 THEN MYY=MYY-MYSPD
 IF BTN AND 2 THEN MYY=MYY+MYSPD
 IF BTN AND 4 THEN MYX=MYX-MYSPD:SPCHR 0,292:SPCHR 1,293
 IF BTN AND 8 THEN MYX=MYX+MYSPD:SPCHR 0,290:SPCHR 1,291

 IF MYX<0 THEN MYX=0
 IF MYX>239 THEN MYX=239
 IF MYY<0 THEN MYY=0
 IF MYY>175 THEN MYY=175

 IF MYCNT%4 THEN @GMSHTHRU
 IF BTN AND 16 THEN GOSUB @GENMYSHT
 @GMSHTHRU

 FOR I=0 TO 31
  IF ENSHOTX(I)==UNUSED THEN @ESJDTHRU
  IF ENSHOTX(I)<MYX-8 THEN @ESJDTHRU
  IF ENSHOTX(I)>MYX+8 THEN @ESJDTHRU
  IF ENSHOTY(I)<MYY-8 THEN @ESJDTHRU
  IF ENSHOTY(I)>MYY+8 THEN @ESJDTHRU
  BEEP 11
  MYHP=MYHP-1
  IF MYHP>0 THEN @ESJDTHRU
  GMOVFLG=TRUE
  PHASE=3
  BGMPLAY 6
  SPOFS 0,-16,-16
  SPOFS 1,-16,-16
  RETURN
  @ESJDTHRU
 NEXT

 SPOFS 0,MYX,MYY-5,2
 SPOFS 1,MYX,MYY+5,2
 MYCNT=MYCNT+1
RETURN

@GENMYSHT 'ショット セイセイ
 M=MSHCNT
 IF MYSHOTX(M)!=UNUSED THEN RETURN
 BEEP 9
 MYSHOTX(M)=MYX
 MYSHOTY(M)=MYY
 SPOFS M+8,MYX,MYY
 MSHCNT=MSHCNT+1
 IF MSHCNT>=MSHMAX THEN MSHCNT=0
RETURN


'┌─────────────────────────┐
'│オワリ                      │
'└─────────────────────────┘
}}
#endregion

#ref(skatstg.png,,100%)

** 電子ピアノ [#cd7b2e32]
- わぁぃ@さんの[[電子ピアノ>Toukou/電子ピアノ]]の改造です。
- 楽器はピアノだけになっています。
- BEEPではなくMMLで再生するようになっています。
- 右上のRecLv.(?)をタッチして録音する音符の長さを設定します。
- Bでメトロノーム、Aで再生、Xで録音です。

#region(プログラムリスト(185行))
#basic{{
@INIT
VISIBLE 0,1,1,0,1,1
PNLTYPE"OFF"
CLS:BGMSTOP
FOR C=0 TO 1
SPPAGE C:SPCLR
BGPAGE C:GOSUB @BGCLR
GPAGE 1-C:GCLS 0
NEXT
GPAGE 0,0,0
IF F$!="" THEN LOAD"GRP0:"+F$,0
CLEAR
DIM RM$(12),RLC(4)
BGMSET 128,"T1L1N$0"
DATA"C","1","D","2","E","F","3","G","4","A","5","B"
DATA 0," ",1,3
DATA 0," ",17,3
DATA 0," ",9,3
DATA 0," ",1,2
DATA 0," ",24,1
DATA"C1122EF334455B"
DATA"C1122EF334455B"
DATA"C1122EF334455B"
'DATA"91122993344559"
'DATA"91122993344559"
'DATA"91122993344559"
DATA"CCDDEEFFGGAABB"
DATA"CCDDEEFFGGAABB"
DATA"CCDDEEFFGGAABB"
DATA"CCDDEEFFGGAABB"
FOR I=0 TO 11
READ RM$(I)
NEXT
FOR I=0 TO 767
PRINT" ";
NEXT
FOR I=0 TO 4
READ BM(I),BM$(I),BX(I),BY(I)
 LOCATE BX(I),BY(I)
 FOR J=0 TO 1+(I==4)*2
  PRINT BM$(I);
 NEXT
NEXT
FOR I=0 TO 6
READ P$
LOCATE 0,I+10
PRINT MID$(P$,10,4);P$;P$
NEXT
FOR I=0 TO 31
 FOR J=0 TO 23
  C$=CHR$(CHKCHR(I,J))
  C=(((C$!=" ")*15)-((VAL(C$)>0 AND VAL(C$)<9)))*(ASC(C$)>32)
  BGPUT 0,I,J,C,0,0,0
  IF C$!=" " AND I%2+(VAL(C$)>0) THEN PNLSTR I,J,"и ",2
 NEXT
NEXT
'PNLSTR 24,1,"[EXIT]"
'PNLSTR 2,6,"йййййййй"
'PNLSTR 12,6,"йййййййй"
PNLSTR 22,6,"йййййййй"
PNLSTR 22,2,"RecLv.:"
'SPSET 0,94,0,0,1,0
'SPOFS 0,57,45:V=100
V=127
'SPSET 1,94,0,0,1,0
'SPOFS 1,119,45:E=64
E=0
SPSET 0,94,0,0,1,0
SPOFS 0,211,45:O=120
RL=0
RLC(0)=2:RLC(1)=4:RLC(2)=3:RLC(3)=6

@LOOP
OTC=TC
TC=TCHST:TX=TCHX:TY=TCHY
OB=B:B=BUTTON()
I=0:G=0:W=W+1
'13'39''→10'00''
'PNLSTR 20,20,GK$
'PNLSTR 2,3,"Vol.:"+STR$(V)+"  "
'PNLSTR 12,3,"Env.:"+STR$(E)+"  "
'PNLSTR 22,1,"Б:メトロノ-ム
PNLSTR 22,4,"Tem.:"+STR$(O)+"  "
PNLSTR 1,20,"А:Rec.  Ф:Play"
'CUR=T*R+S*P
'CUM$=RIGHT$(" "+STR$(FLOOR(CUR/3600)),2)+":"
'CUS$=RIGHT$("0"+STR$(FLOOR(CUR%3600/60)),2)
'STT$="     "
'IF P THEN STT$="Play "
'IF R THEN STT$="Rec. "
'PNLSTR 1,22,STT$+CUM$+CUS$+"/10:00     "
IF RL==0 THEN PNLSTR 28,2," 8"
IF RL==1 THEN PNLSTR 28,2,"16"
IF RL==2 THEN PNLSTR 28,2,"12"
IF RL==3 THEN PNLSTR 28,2,"24"
IF W>=524287 THEN W=0
IF TC THEN GOSUB @CHK
IF 1-TC THEN BGMSTOP 0
IF (1-OTC)*TC*(TY>8)*(TY<32)*(TX>160)*(TX<248) THEN RL=(RL+1)%4
IF (TY<45)+(TY>55) THEN @TSKIP
'IF (TX>7)*(TX<73) THEN V=(TX-8)*2:SPOFS 0,7+V/2,45:IF V>127 THEN V=127
'IF (TX>87)*(TX<153) THEN E=(TX-88)*2:SPOFS 1,87+E/2,45
IF (TX>167)*(TX<233)*(1-R) THEN O=(TX-168)*2+32:SPOFS 0,167+(O-32)/2,45
@TSKIP
BP=1
IF (RL<2)*H*(W%(FLOOR(3600/O/2)*2)==0) THEN BEEP 49,4096,127:BP=0
IF (RL>=2)*H*(W%(FLOOR(3600/O/3)*3)==0) THEN BEEP 49,4096,127:BP=0
IF (RL<2)*BP*H*(W%FLOOR(3600/O/2)==0) THEN BEEP 49,0,60
IF (RL>=2)*BP*H*(W%FLOOR(3600/O/3)==0) THEN BEEP 49,0,60
'F=(B==8)-(B==4)
IF B==OB THEN @BSKIP
IF (B==16)*(1-R)*(1-P) THEN GCLS 0:R=1:H=1:GOTO @BSKIP
IF (B==64)*(1-R)*(1-P) THEN P=1:H=0:GOTO @BSKIP
IF (B==16)*R THEN R=0:T=0:H=0:GOTO @BSKIP
IF (B==64)*P THEN P=0:S=0:GOTO @BSKIP
IF B==32 THEN H=1-H:W=-1
IF B==128 THEN N=(N+1)*(N<2)
IF B==1024 THEN @SAV
@BSKIP
IF T>49139 THEN R=0:T=0
IF S>49139 THEN P=0:S=0
IF R*((W+10)%FLOOR(3600/O/RLC(RL))==0) THEN T=T+1
IF R*I*(OI!=I) THEN GPSET (T+1)%256,(T+1)/256,I
IF R*I*(OI==I)*(GSPOIT((T+1)%256,(T+1)/256)==0) THEN GPSET (T+1)%256,(T+1)/256,1
IF P*(W%FLOOR(3600/O/RLC(RL))==0) THEN GOSUB @PLAY2:S=S+1
VSYNC 1
OI=I
GOTO @LOOP
@CHK
IF I<5 THEN IF CHKCHR(TX/8,TY/8)==ASC(BM$(I)) THEN B=BM(I):G=1
IF (I>11)+(G==1) THEN I=0:RETURN
IF CHKCHR(TX/8,TY/8)==ASC(RM$(I)) THEN @PLAY
I=I+1
GOTO @CHK
@PLAY
I=I+FLOOR((TX-32)/112)*12
'IF (I+50)!=OI THEN BEEP 22,(I+F)*4096/12+RND(E)-E/2,V
IF (I+50)!=OI THEN BGMPLAY 0,128:BGMSETV 0,0,I+64
PNLSTR 0,0,STR$(I)+" "
I=I+50
RETURN
@PLAY2
M=GSPOIT(S%256,S/256)
IF M==0 THEN BGMSTOP 1:RETURN
IF M<26 OR M>74 THEN RETURN
'BEEP 22,(M-50)*4096/12
BGMPLAY 1,128:BGMSETV 1,0,M+14
RETURN
@BGCLR
FOR I=0 TO 31
 FOR J=0 TO 23
  BGPUT 0,I,J,0,0,0,0
 NEXT
NEXT
RETURN
@EXIT
PNLTYPE"KYA"
CLS:SPCLR:GOSUB @BGCLR
CLEAR
VISIBLE 1,1,1,1,1,1
END
@SAV
CLS
INPUT "ファイルメイハ? ";F$
SAVE "GRP0:"+F$
GOTO @INIT

@CONV
H=0
MEM$="T"+STR$(O)+"V"+STR$(V)
M=0:MMR=1
FOR I=0 TO TTT+1
 OM=M
 M=GSPOIT(I%256,I/256)
 IF OM==M THEN MMR=MMR+1
 IF OM==0 AND M!=0 AND MMR<32 THEN MEM$=MEM$+"R"+STR$(FLOOR(32/MMR+0.5)):MMR=1
 IF (OM==0)*(M!=0)*(MMR>=32)THEN MEM$=MEM$+"R1"*FLOOR(MMR/32)+"R"+STR$(FLOOR(32/(MMR%32)+.5)):MMR=1
' IF OM==0 AND M!=0 THEN MEM$=MEM$+"R16"*MMR:MMR=1
 IF OM!=M AND OM!=0 THEN MEM$=MEM$+"L"+STR$(FLOOR(32/MMR+0.5))+"N"+STR$(OM+10):MMR=1
NEXT
BGMPLAY MEM$
ACLS
INPUT "ファイルメイハ? ";F$
SAVE "MEM:"+F$
RETURN
}}

#endregion

#ref(pianok.png,,100%)

** MML EDITOR [#q1e39f61]
- 上の「電子ピアノ」の録音データを編集できるようにしたいと思って作りました。
- 3号の[[Visual MML>3gou:Toukou/VisualMML]]の原型です。
- MMLエディタと言いながらMMLのインポートはできません。
- MMLエクスポートすると大量のMEMが出力される残念仕様(GRPの方がファイル数少なくて済む)
- ロードとセーブはGRP形式です
- 動作がとても重いです。
- 操作方法
-- 十字キー:カーソル移動
-- キーボードをタッチ:音符入力
--- キーボードを長押ししながら十字キーを押すと音符を伸ばすことができます
-- Y:音符削除
-- X:音長変更
-- L+十字:範囲選択してコピー
-- R:貼り付け
-- A:現在の小節を再生
-- B:最初から再生
-- START:ファイルメニュー
- midi⇔MMLED用GRPの相互変換をするツールまで作ってあったりする→[[mid2mmled.zip>http://wiki.hosiken.jp/petc/?plugin=attach&pcmd=open&file=mid2mmled.zip&refer=Toukou%2FNa%A4%CEmkII%BA%EE%C9%CA%BD%B8]]
-- 出力されたbinファイルをDSPCBMPで変換するとptcになったと思います

#region(プログラムリスト(1273行))
#basic{{
@INIT
ACLS:CLEAR:RESTORE @INIT
SYSBEEP=0
LOAD "BGU1U:MMLED",0
LOAD "BGU1L:MMLED",0
LOAD "BGF0U:MMLED",0
LOAD "BGF0L:MMLED",0
VISIBLE 1,1,1,1,1,0
PNLTYPE "OFF"
GPAGE 0,0,0

U_L=1
U_CUR=2
U_NOTE=4'ケ゛ンサ゛イノハ゜-トノミ
U_NOTEALL=4+8
U_ALL=15

N_OFF=0
N_CONT=255
N_N=1

VSCNT=8
KBDY1=17:KBDY2=21
KBDO=2
KBDSCRL=14*2*8
C0=12
GENALL=0
PARTCNT=8
'INIT4,BPM1,Inst1x8,EndPos2
METALEN=4+1+1*PARTCNT+2
PARTLEN=FLOOR((256*192-METALEN)/PARTCNT)
MPOS=0
MTICK=96
ENDPOS=-1
PART=0
TEM=120
VSI=0
SEL=0:SEL_S=-1
LDPAGE=0

DIM DN[2,14],DC[2,14],DP[12],DNT$[12]
DIM VSTEP[VSCNT],VSTEP$[VSCNT]
DIM SPH[6],OLDSPH[6],SPC[6]
DIM GAKKI[PARTCNT]
DIM CHGPFLG[4]
DIM INITFLG[4]
DIM OCTCOL[11]

FOR I=0 TO 13:READ DN[0,I]:NEXT
FOR I=0 TO 13:READ DC[0,I]:NEXT
FOR I=0 TO 13:READ DN[1,I]:NEXT
FOR I=0 TO 13:READ DC[1,I]:NEXT

FOR I=0 TO 11:READ DP[I]:NEXT

FOR I=0 TO 11:READ DNT$[I]:NEXT

FOR I=0 TO VSCNT-1:READ VSTEP[I]:NEXT
FOR I=0 TO VSCNT-1:READ VSTEP$[I]:NEXT

FOR I=0 TO 3:READ C$:INITFLG[I]=ASC(C$):NEXT

FOR I=0 TO 10:READ OCTCOL[I]:NEXT

DATA 0,1,1,3,3,4,5,6,6,8,8,10,10,11
DATA 1,0,0,0,0,1,1,0,0,0,0,0,0,1
DATA 0,0,2,2,4,4,5,5,7,7,9,9,11,11
DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1

DATA 1,0,1,0,1,1,0,1,0,1,0,1

DATA "C","C#","D","D#","E","F","F#","G","G#","A","A#","B"

DATA 24,12,6,3,16,8,4,96
DATA "4  а ","8  б ","16 в ","32 г ","6  ад","12 бд","24 вд","1  Ю "

DATA "M","M","L","E"

DATA 14,10,11,9,4,0,3,7,12,13,8

C12$=CHR$(3)
C16$=CHR$(4)
C24$=CHR$(5)
C2D$=CHR$(10)
C4D$=CHR$(11)
C6D$=CHR$(14)
C8D$=CHR$(15)
C12D$=CHR$(232)
C16D$=CHR$(233)
CCS$=CHR$(234)
CDS$=CHR$(235)
CFS$=CHR$(236)
CGS$=CHR$(237)
CAS$=CHR$(238)

BGPAGE 0
FOR Y=5 TO 19 STEP 2
 BGFILL 0,0,Y+1,31,Y+1,256+22,0,0,0 'Т
 FOR X=0 TO 31 STEP 8
  BGPUT 0,X,Y,256+23,0,0,0 'У
  IF Y<19 THEN BGPUT 0,X,Y+1,256+21,0,0,0 'С
 NEXT
NEXT

BGPAGE 1
FOR X=0 TO 63
 IF DN[0,X%14]==DN[0,(X+1)%14] THEN C$=" " ELSE C$="и"
 BGFILL 0,X,KBDY1,X,KBDY2-1,ASC(C$)+256,DC[0,X%14],0,0
 IF DN[1,X%14]==DN[1,(X+1)%14] THEN C$=" " ELSE C$="и"
 BGFILL 0,X,KBDY2,X,23,ASC(C$)+256,DC[1,X%14],0,0
NEXT
GOSUB @KBDUPD
BGOFS 0,KBDSCRL,0
BGOFS 1,KBDSCRL,0

SPPAGE 1

SPC[0]=100
SPSET 0,SPC[0],0,0,0,0
SPHOME 0,8,8
SPOFS 0,0+8,KBDY1*8-16+8
SPANGLE 0,90
SPCOL 0,-8,-8,16,16,0

SPC[1]=100
SPSET 1,SPC[1],0,0,0,0
SPHOME 1,8,8
SPOFS 1,256-16+8,KBDY1*8-16+8-1
SPANGLE 1,270
SPCOL 1,-8,-8,16,16,0

SPC[2]=92
SPSET 2,SPC[2],0,0,0,0
SPOFS 2,21*8+4,5*8-4

SPC[3]=93
SPSET 3,SPC[3],0,0,0,0
SPOFS 3,27*8+4,5*8-4

SPC[4]=100
SPSET 4,SPC[4],0,0,0,0
SPHOME 4,8,8
SPOFS 4,17*8+8,11*8+8
SPANGLE 4,90
SPCOL 4,-8,-8,15,16,0

SPC[5]=100
SPSET 5,SPC[5],0,0,0,0
SPHOME 5,8,8
SPOFS 5,19*8+8-2,11*8+8-1
SPANGLE 5,270
SPCOL 5,-7,-8,15,16,0


BREPEAT 0,20,5
BREPEAT 1,20,5
BREPEAT 2,20,5
BREPEAT 3,20,5
BREPEAT 7,20,5

U=U_ALL
CE=0

@LOOP

IF CE THEN GOSUB @CHKEND
IF U THEN GOSUB @UPDATE
U=0
CE=0

B=BUTTON(1)
B0=BUTTON(0)
BH=B0
IF OLDB0 THEN OLDB0=B0:B0=0 ELSE OLDB0=B0
TST=TCHST
TX=TCHX:TY=TCHY

IF B AND 1024 THEN @MENU

IF (B AND 1)>0 AND !SEL AND PART>0 THEN PART=PART-1:U=U OR U_CUR OR U_L
IF (B AND 2)>0 AND !SEL AND PART<PARTCNT-1 THEN PART=PART+1:U=U OR U_CUR OR U_L

IF (B AND 8)>0 AND !PLAY AND BGMCHK(0) THEN PN=N_CONT:GOSUB @AUTOPUT
IF (B AND 8)*(PLAY==0) THEN GOSUB @CUR1R
IF (B AND 4)*(PLAY==0) THEN GOSUB @CUR1L

IF !(BH AND 256) OR PLAY THEN SEL=0:GOTO @BLSKIP
IF !SEL THEN SEL=1:SEL_S=MPOS:SEL_E=MPOS:SEL_P=PART:U=U OR U_CUR
@BLSKIP
IF !(B0 AND 512) THEN @BRSKIP
IF SEL_S<0 THEN @BRSKIP
SS=SEL_S
SEL=0
U=U OR U_NOTE OR U_CUR
GETPART=SEL_P:SETPART=PART
@PSTLOOP
IF SS>=SEL_E THEN GOTO @BRSKIP
GETPOS=SS:SETPOS=MPOS
GOSUB @GGET
SETVAL=GETVAL
GOSUB @GSET
IF MPOS>ENDPOS THEN ENDPOS=MPOS:CE=1
SS=SS+1
MPOS=MPOS+1
GOTO @PSTLOOP
@BRSKIP

IF !(B AND 128) THEN @BYSKIP
IF PLAY THEN @BYSKIP
PN=N_OFF
GOSUB @AUTOPUT
'CE=1
U=U OR U_NOTE
@BYSKIP

IF !(B AND 16) THEN @BASKIP
IF PLAY THEN @BASKIP
GOSUB @GENMML
'LOCATE 0,22:?" "*32*2;
'LOCATE 0,22:?MEM$;MML$;
BGMSET 129,MEM$,MML$
BGMPLAY 1,129
@BASKIP


IF B0 AND 64 THEN VSI=(VSI+1)%VSCNT:U=U OR U_L OR U_CUR:GOSUB @CUR1R:GOSUB @CUR1L

IF !(B0 AND 32) THEN @BBSKIP
IF PLAY THEN GOSUB @PLAYSTP ELSE GOSUB @PLAYSTRT
@BBSKIP

IF !PLAY THEN @NOPLAY
 PCNT=(MAINCNTL-PTIME)/60/60*TEM/4*MTICK/VSTEP[VSI]
 MPOS2=MTICK*(PLAYMEAS-1)+VSTEP[VSI]*FLOOR(PCNT)
 IF MPOS!=MPOS2 AND MPOS2<PLAYMEAS*MTICK THEN MPOS=MPOS2:U=U OR U_CUR
 IF BGMCHK(0) THEN @NOPLAY
  IF PLAYMEAS*MTICK>ENDPOS THEN GOSUB @PLAYSTP:GOTO @NOPLAY  
  PLAYCH=PLAYCH+1
  IF PLAYCH>=8 THEN PLAYCH=2
  BGMSET 128+PLAYCH,MEM$,MML$
  BGMSET 129,"T"+STR$(TEM)+"R1"
  BGMPLAY 0,129
  BGMPLAY PLAYCH,128+PLAYCH
  U=U OR U_CUR
  MPOS=PLAYMEAS*MTICK
  PLAYMEAS=PLAYMEAS+1
  'MPOS=PLAYMEAS*MTICK
  PTIME=MAINCNTL
  IF PLAYMEAS*MTICK<=ENDPOS THEN MPOS=MPOS+MTICK:GOSUB @GENMML:MPOS=MPOS-MTICK
  'LOCATE 0,22:?" "*32*2;
  'LOCATE 0,22:?MEM$;MML$;
@NOPLAY

FOR I=0 TO 5
 SPH[I]=SPHITRC(I,TX,TY,1,1)*TST
NEXT

BGPAGE 1

IF !SPH[0] THEN @SPSKIP0
KBDSCRL=KBDSCRL-4
IF KBDO<=-2 AND KBDSCRL/8<14 THEN KBDSCRL=14*8
IF KBDSCRL>=0 THEN @SPSKIP0
KBDSCRL=KBDSCRL+14*2*8
KBDO=KBDO-2
@SPSKIP0

IF !SPH[1] THEN @SPSKIP1
KBDSCRL=KBDSCRL+4
IF KBDO>=6 AND KBDSCRL/8+31>14*3+8 THEN KBDSCRL=(14*3+8-31)*8
IF KBDSCRL<=14*2*8 THEN @SPSKIP1
KBDSCRL=KBDSCRL-14*2*8
KBDO=KBDO+2
@SPSKIP1

IF (SPH[0] OR SPH[1])==0 THEN @SPSKIP
GOSUB @KBDUPD
BGOFS 0,KBDSCRL,0
BGOFS 1,KBDSCRL,0
@SPSKIP

FOR I=2 TO 3
 IF !SPH[I] THEN @SPSKIP2
 IF OLDSPH[I] THEN @SPTCHD2
 SP2TIM=0
 @SPTCHD2
 IF SP2TIM==0 THEN TEM=TEM+I*2-5:U=U OR U_L
 IF SP2TIM>=20 THEN TEM=TEM+I*2-5:U=U OR U_L
 IF TEM<1 THEN TEM=1
 IF TEM>240 THEN TEM=240
 SP2TIM=SP2TIM+1
@SPSKIP2
NEXT

FOR I=4 TO 5
 IF !SPH[I] THEN @SPSKIP4
 IF OLDSPH[I] THEN @SPTCHD4
 SP4TIM=0
 @SPTCHD4
 SP4T=0
 IF SP4TIM==0 THEN GAKKI[PART]=GAKKI[PART]+I*2-9:U=U OR U_L:SP4T=1
 IF SP4TIM>=20 THEN GAKKI[PART]=GAKKI[PART]+I*2-9:U=U OR U_L:SP4T=1
 IF GAKKI[PART]<0 THEN GAKKI[PART]=151
 IF GAKKI[PART]>151 THEN GAKKI[PART]=0
 IF GAKKI[PART]>=130 AND GAKKI[PART]<144 THEN GAKKI[PART]=129*(I==4)+144*(I==5)
 SP4TIM=SP4TIM+1
 IF SP4T THEN BGMSET 128,"@"+STR$(GAKKI[PART])+"C4":BGMPLAY 1,128
@SPSKIP4
NEXT

FOR I=0 TO 5
 SPCHR I,SPC[I],SPH[I]*14,0,0,0
 OLDSPH[I]=SPH[I]
NEXT

IF PLAY THEN @NONOTE
IF !TST THEN BGMSTOP 0:GOTO @NONOTE
IF OLDTST THEN @NONOTE
X=FLOOR((TX+KBDSCRL)/8):Y=FLOOR(TY/8)
IF Y<KBDY1 THEN @NONOTE
N=DN[(Y>=KBDY2)*1,X%14]+FLOOR(X/14+KBDO)*12+C0
BGMSET 128,"T1L1@"+STR$(GAKKI[PART])+"N"+STR$(N)
BGMPLAY 0,128
PN=N+N_N
GOSUB @AUTOPUT
GOSUB @CUR1R

@NONOTE
IF TST!=OLDTST THEN GOSUB @KBDUPD
OLDTST=TST

VSYNC 1
GOTO @LOOP

@UPDATE
'UST=FLOOR(MPOS/VSTEP[VSI]/8)*VSTEP[VSI]*8
'UST=MEAS*MTICK
UST=MPOS-MPOS%MTICK
IF UST!=OLDUST THEN U=U OR U_NOTEALL
OLDUST=UST

MEAS=FLOOR(MPOS/MTICK)
TICK=MPOS%MTICK

'IF U AND U_NOTE THEN U=U OR U_L OR U_CUR
'IF U AND U_NOTE THEN CLS
IF U AND U_CUR THEN U=U OR U_L
COLOR 0
IF !(U AND U_L) THEN @ULSKIP
PNLSTR 0,0,"┌──────────┐
PNLSTR 0,1,"│MML EDITOR│
PNLSTR 0,2,"└──────────┘
PNLSTR 0,5," ↑/↓ : ハ゜-ト"
PNLSTR 0,7,"  Ф  : ノ-ト サイス゛"
PNLSTR 0,4,"           "
PNLSTR 0,6,"            "
PNLSTR 0,8,"               "
PNLSTR 0,9,"           "
PNLSTR 0,11,"               "
IF PLAY THEN @UPLSKIP
PNLSTR 0,4," ←/→ : カ-ソル"
PNLSTR 0,6,"  Х  : サクシ゛ョ"
PNLSTR 0,8,"К+←/→: コヒ゜- ハンイ"
PNLSTR 0,9,"  н  : ハリツケ"
PNLSTR 0,11,"  А  : テスト フ゜レイ"
@UPLSKIP
IF PLAY THEN C$="  Б  : ストッフ゜" ELSE C$="  Б  : フ゜レイ "
PNLSTR 0,12,C$
PNLSTR 0,14,"START: ファイル メニュ-"

PNLSTR 17,1,"Measure"
PNLSTR 16,2,RIGHT$("   "+STR$(MEAS+1),4)+":"+RIGHT$(" "+STR$(TICK/VSTEP[VSI]+1),2)+"/"+VSTEP$[VSI]

PNLSTR 17,5,"BPM:"
PNLSTR 24,5,RIGHT$("  "+STR$(TEM),3)

PNLSTR 21,8,"Part "+STR$(PART+1)
C$=RIGHT$("  "+STR$(GAKKI[PART]),3)
PNLSTR 17,10,C$+":"
RESTORE @NAME
FOR I=0 TO GAKKI[PART]
 READ C$
NEXT
C$=C$+" "*33
PNLSTR 21,10,LEFT$(C$,11)
PNLSTR 21,11,MID$(C$,11,11)
PNLSTR 21,12,MID$(C$,22,11)

'PNLSTR 16,4,"Length:"+STR$(ENDPOS+1)+"    "

@ULSKIP

IF !(U AND U_CUR) THEN @UCURSK1
BGPAGE 0
BGCLR 1
IF SEL_S<0 THEN @SELSKIPU
X=FLOOR((SEL_S-UST)*32/MTICK)
IF X<0 THEN X=0
X2=FLOOR((SEL_E-UST)*32/MTICK)-1
IF X2>=32 THEN X2=31
IF X>X2 THEN @SELSKIPU
BGFILL 1,X,5+2*SEL_P,X2,5+2*SEL_P,7,0,0,0
@SELSKIPU
X=FLOOR((MPOS-UST)*32/MTICK)
X2=FLOOR((MPOS+VSTEP[VSI]-UST)*32/MTICK)-1
BGFILL 1,X,5+2*PART,X2,5+2*PART,10,0,0,0
@UCURSK1

FOR P=0 TO PARTCNT-1
' COLOR (P==PART)*11
' LOCATE 0,5+2*P
' FOR I2=0 TO 7
'  C$="    "
'  I=UST+I2*VSTEP[VSI]
'  IF I%(MTICK/4)==0 THEN C$="│   "
'  IF I<0 OR I>=PARTLEN THEN C$="    "
'  ?C$;
' NEXT
' C$="ТТТТ"
' IF I<0 OR I>=PARTLEN THEN C$=""
' LOCATE X-1,6+2*P
' ?C$;
' ?"Т"*32;
 
 COLOR 0
 
 IF !(U AND U_CUR) THEN @UCURSKIP
 LOCATE 0,2:?" "*32;
 LOCATE 0,22:?" "*32;
 X=FLOOR((MPOS-UST)*32/MTICK)
 IF X<0 OR X>=32 THEN @UCURSKIP
 LOCATE X,2:?"▼";
 LOCATE X,22:?"▲";

@UCURSKIP
 
 IF !(U AND U_NOTE) THEN @UNTSKIP
 IF (U AND U_NOTEALL)!=U_NOTEALL AND P!=PART THEN @UNTSKIP
 LOCATE 0,5+2*P:?" "*32;
 I2=0
 OLDCL=0
 @UPDLOOP
  X=FLOOR(I2*32/MTICK)
  I=UST+I2
  'LOCATE X,3
  'C$=""
  'IF I%MTICK==0 THEN C$=STR$(I/MTICK+1)
  '?C$;

  LOCATE X,5+2*P
  

  'COLOR (P==PART AND I==MPOS)*4
  'IF I<0 OR I>=ENDPOS THEN C=0:I2=I2+1:GOTO @PSKIP1
  'J=I+METALEN+P*PARTLEN
  'C=GSPOIT(J%256,J/256)
  GETPOS=I:GETPART=P:GOSUB @GGET
  C=GETVAL
' @PSKIP1
  IF C==N_OFF THEN C$="R":CL=14:GOTO @PSKIP3
  IF C==N_CONT THEN C$="&":CL=OLDCL:GOTO @PSKIP3
  C$=DNT$[(C-N_N)%12]
  OCT=FLOOR((C-N_N-C0)/12)
  CL=OCTCOL[OCT+1]
  @PSKIP3
  COLOR CL
  OLDCL=CL
'  C2=CHKCHR(X,5+2*P)
'  IF C==255 AND C2!=0 AND C2!=ASC(" ") THEN @PSKIP2
  IF C$=="C#" THEN C$=CCS$
  IF C$=="D#" THEN C$=CDS$
  IF C$=="F#" THEN C$=CFS$
  IF C$=="G#" THEN C$=CGS$
  IF C$=="A#" THEN C$=CAS$
  ?C$;
  
' @PSKIP2

  MMPOS=I
'  MMEPOS=MMPOS+MTICK-1

'  IF ENDPOS<MMEPOS THEN MMEPOS=ENDPOS
  MMNOTE=C
  GOSUB @GETMLEN
  
  IF L$=="12" THEN L$=C12$
  IF L$=="16" THEN L$=C16$
  IF L$=="24" THEN L$=C24$
'  IF L$=="32" THEN L$=""
  IF L$=="2." THEN L$=C2D$
  IF L$=="4." THEN L$=C4D$
  IF L$=="6." THEN L$=C6D$
  IF L$=="8." THEN L$=C8D$
  IF L$=="12." THEN L$=C12D$
  IF L$=="16." THEN L$=C16D$
  IF LEN(L$)>1 THEN L$=""
  IF X<31 THEN ?L$;

  I=MMPOS
  I2=I-UST
  
@PSKIP1
 'NEXT
 IF I2<MTICK AND I<ENDPOS THEN @UPDLOOP
@UNTSKIP
NEXT

RETURN


@KBDUPD
BGPAGE 1
FOR X=0 TO 63
 C=14+DC[0,X%14]
 N2=DN[0,X%14]+FLOOR(X/14+KBDO)*12+C0
 IF N2==N AND BGMCHK(0) THEN C=2
 BGFILL 1,X,KBDY1,X,KBDY2-1,C,0,0,0
 IF DN[0,X%14]!=0 THEN @NONUM
 C$=STR$(FLOOR(X/14)+KBDO)
 BGPUT 0,X,23,ASC(C$)+256,DC[1,X%14],0,0
@NONUM
 C=14+DC[1,X%14]
 N2=DN[1,X%14]+FLOOR(X/14+KBDO)*12+C0
 IF N2==N AND BGMCHK(0) THEN C=2
 BGFILL 1,X,KBDY2,X,23,C,0,0,0
NEXT
RETURN

@CUR1R
 SEL_T=0
 IF !SEL THEN @SELSKIPR
 IF SEL_E==MPOS THEN SEL_T=1:GOTO @SELSKIPR
 SEL_T=-1 
 @SELSKIPR
 MPOS=FLOOR(MPOS/VSTEP[VSI]+1)*VSTEP[VSI]
 'IF TICK>=MTICK THEN TICK=TICK-MTICK:MEAS=MEAS+1
 'IF MEAS*MTICK+TICK>=PARTLEN THEN BEEP 2:GOSUB @CUR1L

 IF SEL_T==1 THEN SEL_E=MPOS
 IF SEL_T==-1 THEN SEL_S=MPOS
 U=U OR U_CUR OR U_L
 
RETURN

@CUR1L
 SEL_T=0
 IF !SEL THEN @SELSKIPL
 IF SEL_S==MPOS THEN SEL_T=-1:GOTO @SELSKIPL
 SEL_T=1
 @SELSKIPL
 MPOS=FLOOR((MPOS-1)/VSTEP[VSI])*VSTEP[VSI]
 'IF TICK<0 THEN TICK=TICK+MTICK:MEAS=MEAS-1
 'IF MEAS*MTICK+TICK<0 THEN MEAS=0:TICK=0:BEEP 2
 'MPOS=MEAS*MTICK+TICK
 IF MPOS<0 THEN MPOS=0:BEEP 2
 IF SEL_T==1 THEN SEL_E=MPOS
 IF SEL_T==-1 THEN SEL_S=MPOS
 
 U=U OR U_CUR OR U_L
RETURN

@AUTOPUT
 SETPOS=MPOS:SETPART=PART:SETVAL=PN:GOSUB @GSET
 'GPSET GPOS%256,GPOS/256,PN
 FOR I=1 TO VSTEP[VSI]-1
  SETPOS=SETPOS+1
  IF PN==N_NO THEN SETVAL=N_NO ELSE SETVAL=N_CONT
  GOSUB @GSET
  'GPSET (GPOS+I)%256,(GPOS+I)/256,(PN!=0)*255
 NEXT
 GOSUB @CUR1R
 IF MPOS>ENDPOS THEN ENDPOS=MPOS:CE=1
 GOSUB @AUTOERS
 GOSUB @CUR1L

 U=U OR U_NOTE
RETURN

@AUTOERS
 GETPOS=MPOS:SETPOS=GETPOS
 GETPART=PART:SETPART=GETPART
 SETVAL=N_NO
 U=U OR U_NOTE
 @AELOOP
  'IF EPOS>=PARTLEN THEN RETURN
  'TPOS2=EPOS+METALEN+PART*PARTLEN
  'IF GSPOIT(TPOS2%256,TPOS2/256)!=255 THEN RETURN

  'GPSET TPOS2%256,TPOS2/256,0
  GOSUB @GGET

  IF GETVAL!=N_CONT THEN RETURN

  GOSUB @GSET
  GETPOS=GETPOS+1:SETPOS=GETPOS
  IF GETPOS>=ENDPOS-1 THEN CE=1

  GOTO @AELOOP

@GENMML
 SRESULT=1
 MEM$=""
 MML$="T"+STR$(TEM)
 MMPOS=MPOS-MPOS%MTICK
 MMEPOS=MMPOS+MTICK-1
 IF GENALL THEN MMPOS=0:MMEPOS=ENDPOS
 IF ENDPOS<MMEPOS THEN MMEPOS=ENDPOS
 FI=0
 FOR P=0 TO PARTCNT-1
  IF GENALL THEN MMPOS=0 ELSE MMPOS=MPOS-MPOS%MTICK
  'MMGPOS=MMPOS+METALEN+P*PARTLEN
  OCT=4
  MML$=MML$+":"+STR$(P)+"@"+STR$(GAKKI[P])
  MMNOTEO=N_CONT
  @MMLOOP
   'MMNOTE=GSPOIT(MMGPOS%256,MMGPOS/256)
   GETPOS=MMPOS:GETPART=P:GOSUB @GGET:MMNOTE=GETVAL
   IF LEN(MML$)>240 THEN GOSUB @MMSAVE
   IF SRESULT!=1 THEN RETURN
   IF MMPOS>MMEPOS THEN GOTO @MMLOOPN
   'MMNOTE=MMNOTE2
   OCTN=FLOOR((MMNOTE-N_N-C0)/12)
   IF MMNOTE==N_OFF THEN OCTN=OCT
   IF MMNOTE==N_CONT THEN OCTN=OCT
   OCT$=""
   IF OCTN==OCT+1 THEN OCT$="<"
   IF OCTN==OCT-1 THEN OCT$=">"
   IF OCTN>OCT+1 OR OCTN<OCT-1 THEN OCT$="O"+STR$(OCTN)
   OCT=OCTN
   MMNT$=""
   IF MMNOTE==N_OFF OR MMNOTE==N_CONT THEN MMNT$="R"
   IF MMNOTE==N_CONT AND MMNOTEO!=N_CONT THEN MMNT$="&"+DNT$[(MMNOTEO-N_N)%12]
   IF MMNT$!="" THEN @MMSKIP1
   MMNT$=DNT$[(MMNOTE-N_N)%12]
   IF OCTN==-1 THEN MMNT$="N"
   IF OCTN==9 THEN MMNT$="N"
  @MMSKIP1
   GOSUB @GETMLEN
   IF MMNT$=="N" THEN MML$=MML$+"L"+L$+MMNT$+STR$(MMNOTE-N_N) ELSE MML$=MML$+OCT$+MMNT$+L$
   MMHASNT=1
   MMNOTEO=MMNOTE
   GOTO @MMLOOP
 @MMLOOPN
 NEXT
 IF GENALL THEN GOSUB @MMSAVE
 GENALL=0
 RETURN

@GETMLEN
 MMLEN=1
 'MMGPOS=MMPOS+METALEN+P*PARTLEN
   @MMLOOP2
    MMPOS=MMPOS+1
    'MMGPOS=MMGPOS+1
    IF MMLEN>MTICK THEN @MMLOOPE
    'MMNOTE2=GSPOIT(MMGPOS%256,MMGPOS/256)
    GETPOS=MMPOS:GETPART=P:GOSUB @GGET:MMNOTE2=GETVAL
    IF MMPOS>ENDPOS THEN @MMLOOPE
    IF MMNOTE2==N_CONT THEN MMLEN=MMLEN+1:GOTO @MMLOOP2
    IF MMNOTE==N_OFF AND MMNOTE2==N_OFF THEN MMLEN=MMLEN+1:GOTO @MMLOOP2
   
   @MMLOOPE
    IF MMLEN==0 THEN RETURN
    IF MTICK%MMLEN==0 THEN @MMNODOT
    IF MTICK%(MMLEN/1.5)==0 THEN @MMDOT
    
     'MML$=MML$+OCT$
     MMLEN2=MTICK
     @MMTAI
      IF MMLEN2>MMLEN THEN @MMNOTAI
      L$=STR$(MTICK/MMLEN2)
      'IF L$=="4" THEN L$=""
      'MML$=MML$+MMNT$+L$
      'IF MMNT$!="R" THEN MML$=MML$+"&"
      MMLEN=MMLEN-MMLEN2
      'MMGPOS=MMGPOS-MMLEN
      MMPOS=MMPOS-MMLEN
      RETURN
     @MMNOTAI
     MMLEN2=FLOOR(MMLEN2/2)
     'IF MMLEN2>0 THEN @MMTAI
     'IF MMNT$!="R" THEN MML$=LEFT$(MML$,LEN(MML$)-1)
     'MMNOTE=MMNOTE2
     'GOTO @MMLOOP
     GOTO @MMTAI

    @MMNODOT
     L$=STR$(MTICK/MMLEN)
     'IF L$=="4" THEN L$=""
     'MML$=MML$+OCT$+MMNT$+L$
     'MMNOTE=MMNOTE2
     'GOTO @MMLOOP
     RETURN
    @MMDOT
     L$=STR$(MTICK/(MMLEN/1.5))+"."
     'IF L$=="4" THEN L$=""
     'MML$=MML$+OCT$+MMNT$+L$+"."
     'MMNOTE=MMNOTE2
     'GOTO @MMLOOP
     RETURN


 @MMSAVE
  IF GENALL==0 AND MEM$!="" THEN SRESULT=0:RETURN
  MEM$=MML$
  MML$=""
  IF GENALL==0 THEN RETURN
  PRGRESS=FLOOR((P+MMPOS/ENDPOS)/PARTCNT*100)
  IF PRGRESS>100 THEN PRGRESS=100
  LOCATE 0,23:?"Progress:";PRGRESS;"%";
  F$=STR$(FI)*(FI>0)
  SAVE "MEM:"+LEFT$(FILE$,8-LEN(F$))+F$

  SRESULT=RESULT
  FI=FI+1
  RETURN

@CHKEND
 TPOS2=-1
 FOR P=0 TO PARTCNT-1
  'TPOS=ENDPOS+METALEN+P*PARTLEN
  TPOS=ENDPOS
  @CELOOP
   'IF TPOS<METALEN+P*PARTLEN THEN @CELOOPE
   IF TPOS<0 THEN @CELOOPE
   'IF GSPOIT(TPOS%256,TPOS/256)!=0 THEN @CELOOPE
   GETPOS=TPOS:GETPART=P:GOSUB @GGET
   IF GETVAL!=N_OFF THEN @CELOOPE
   IF TPOS2!=-1 AND TPOS<=TPOS2 THEN @CELOOPE
   TPOS=TPOS-1
  GOTO @CELOOP
 @CELOOPE
  'TPOS=TPOS-P*PARTLEN-METALEN
  IF TPOS>TPOS2 THEN TPOS2=TPOS
 NEXT
 IF ENDPOS!=TPOS2 THEN U=U OR U_NOTE
 ENDPOS=TPOS2
 RETURN

@PLAYSTP
 PLAY=0
 BGMSTOP
 U=U OR U_CUR OR U_L
 RETURN

@PLAYSTRT
 BGMSTOP 
 IF ENDPOS<=0 THEN BEEP 2:RETURN
 IF ENDPOS>=4*PARTLEN THEN GOSUB @TMPSAV
 PLAY=1
 PLAYCH=2
 SEL=0
 MPOS=0
 PLAYMEAS=0
 IF PLAYMEAS*MTICK<=ENDPOS THEN GOSUB @GENMML
 PTIME=MAINCNTL
 U=U OR U_CUR OR U_L
 RETURN

@TMPSAV
 SYSBEEP=1
 FOR PG=0 TO 3
  PG2=LDPAGE+PG
  IF CHGPFLG[PG2%4] THEN SAVE "GRP"+STR$(PG2%4)+":MMLTMP"+STR$(PG2)
  CHGPFLG[PG2%4]=0
 NEXT
 SYSBEEP=0
RETURN

@LDLEFT4
 GOSUB @TMPSAV
 FOR PG=0 TO 3
  PG2=PAGE+PG
  GPAGE 0,PG2%4,0
  GCLS 
  CHGPFLG[PG2%4]=1
  IF ENDPOS>=PAGE*PARTLEN THEN LOAD "GRP"+STR$(PG2%4)+":MMLTMP"+STR$(PG2),0:CHGPFLG[PG2%4]=0
 NEXT
 LDPAGE=PAGE
RETURN


@LDLEFT1
 SYSBEEP=0
 PG2=LDPAGE+3
 IF CHGPFLG[PG2%4] THEN SAVE "GRP"+STR$(PG2%4)+":MMLTMP"+STR$(PG2)
 PG2=LDPAGE-1
 GPAGE 0,PG2%4,0
 GCLS 
 CHGPFLG[PG2%4]=1
 IF ENDPOS>=PAGE*PARTLEN THEN LOAD "GRP"+STR$(PG2%4)+":MMLTMP"+STR$(PG2),0:CHGPFLG[PG2%4]=0
 LDPAGE=PG2
 IF PAGE<LDPAGE THEN @LDLEFT1
RETURN

@LDRIGHT1
 SYSBEEP=0
 PG2=LDPAGE
 IF CHGPFLG[PG2%4] THEN SAVE "GRP"+STR$(PG2%4)+":MMLTMP"+STR$(PG2)
 PG2=LDPAGE+4
 GPAGE 0,PG2%4,0
 GCLS 
 CHGPFLG[PG2%4]=1
 IF ENDPOS>=PAGE*PARTLEN THEN LOAD "GRP"+STR$(PG2%4)+":MMLTMP"+STR$(PG2),0:CHGPFLG[PG2%4]=0
 LDPAGE=LDPAGE+1
 IF PAGE>LDPAGE+3 THEN @LDRIGHT1
RETURN


@GSET
'SETPART,SETPOS,SETVAL
 PAGE=FLOOR(SETPOS/PARTLEN)
 IF PAGE<0 THEN BEEP 2:RETURN

 IF PAGE<=LDPAGE-4 THEN GOSUB @LDLEFT4
 IF PAGE<LDPAGE THEN GOSUB @LDLEFT1
 IF PAGE>=LDPAGE+7 THEN GOSUB @LDLEFT4
 IF PAGE>LDPAGE+3 THEN GOSUB @LDRIGHT1

 GPAGE 0,PAGE%4,0
 GPOS=METALEN+SETPART*PARTLEN+SETPOS%PARTLEN

 GPSET GPOS%256,GPOS/256,SETVAL

 CHGPFLG[PAGE%4]=1
RETURN

@GGET
'GETPART,GETPOS,GETVAL
 PAGE=FLOOR(GETPOS/PARTLEN)
 IF PAGE<0 THEN BEEP 2:RETURN

 IF PAGE<=LDPAGE-4 THEN GOSUB @LDLEFT4
 IF PAGE<LDPAGE THEN GOSUB @LDLEFT1
 IF PAGE>=LDPAGE+7 THEN GOSUB @LDLEFT4
 IF PAGE>LDPAGE+3 THEN GOSUB @LDRIGHT1

 GPAGE 0,PAGE%4,0
 GPOS=METALEN+GETPART*PARTLEN+GETPOS%PARTLEN
 GETVAL=GSPOIT(GPOS%256,GPOS/256)
RETURN

@MENU
 VISIBLE 1,1,0,0,0,0
 PNLTYPE "KYA"
 SYSBEEP=1
 COLOR 0
 CLS
 LOCATE 0,0
 ?"─"*32;
 ?"L:GRPヨミコミ
 ?"S:GRPホソ゛ン
 ?"X:MMLシュツリョク
 ?"Q:ファイルメニュ-オワリ
 ?"E:ツ-ルオワリ
 ?"─"*32;
 INPUT "コマント゛";CMD$
 IF CMD$=="L" THEN @LFILE
 IF CMD$=="S" THEN @SFILE
 IF CMD$=="X" THEN @XFILE
 IF CMD$=="Q" THEN @QMENU
 IF CMD$=="E" THEN CLS:END
 GOTO @MENU
 
 @LFILE
  FOR PG=0 TO 3
   GPAGE 0,PG,0
   GCLS
   CHGPFLG[PG]=1
  NEXT
  LDPAGE=0
  ENDPOS=-1
  MPOS=0

  INPUT "ファイルメイハ(GRP)";FILE$
  IF LEN(FILE$)==0 THEN @LFILE
  '?"Loading..."
  ?

  FILE$=LEFT$(FILE$,8)
  ?FILE$;
  LOAD "GRP0:"+FILE$,0
  IF RESULT==1 THEN ?":OK":GOTO @LFILE2
  ?":NG"

  FILE$=LEFT$(FILE$,7)
  ?FILE$;0;
  LOAD "GRP0:"+FILE$+"0",0
  IF RESULT==1 THEN ?":OK":GOTO @LFILE2
  ?":NG"

  FILE$=LEFT$(FILE$,6)+"_"
  ?FILE$;0;
  LOAD "GRP0:"+FILE$+"0",0
  IF RESULT==1 THEN ?":OK":GOTO @LFILE2
  ?":NG"
  GOTO @QMENU

  @LFILE2
  GPAGE 0,0,0
  INITFOK=1
  FOR I=0 TO 3
   IF GSPOIT(I,0)!=INITFLG[I] THEN INITFOK=0
  NEXT
  IF INITFOK THEN @INASKSKP
   ?"ファイルヘッタ゛カ゛ タタ゛シクアリマセン"
   INPUT "ヨミコミマスカ(Y/N)";CMD$
   IF CMD$!="Y" THEN GCLS:GOTO @QMENU
  @INASKSKP
  TEM=GSPOIT(4,0)
  IF TEM>240 THEN TEM=240
  IF TEM==0 THEN TEM=1
  FOR P=0 TO PARTCNT-1
   GAKKI[P]=GSPOIT(5+P,0)
  NEXT
  ENDPOS=GSPOIT(13,0)*256+GSPOIT(14,0)
  PAGE=1

  CE=1
  @LODLOOP
   IF ENDPOS<PAGE*PARTLEN THEN @LFAIL
   'IF PAGE>3 THEN @LFAIL
   PG2=PAGE
   IF PG2>3 THEN PG2=3

  @TRYLLOOP
   F$=STR$(PAGE)*(PAGE>0)
   ?LEFT$(FILE$,8-LEN(F$));F$;
   SYSBEEP=0
   LOAD "GRP"+STR$(PG2)+":"+LEFT$(FILE$,8-LEN(F$))+F$,0
   IF RESULT==1 THEN ?":OK":GOTO @LFILE3
   ?":NG"
   IF PAGE!=1 THEN @LFAIL
   IF RIGHT$(FILE$,1)!="0" THEN @LFAIL
   FILE$=LEFT$(FILE$,LEN(FILE$)-1)
   GOTO @TRYLLOOP
  @LFAIL
   IF PAGE>3 THEN @LFAIL2
   GPAGE 0,PAGE,0
   GCLS
   CHGPFLG[PAGE]=0
   PAGE=PAGE+1
   GOTO @LFAIL
  @LFAIL2
   IF ENDPOS<4*PARTLEN THEN @QMENU
   LOAD "GRP3:"+LEFT$(FILE$,7)+"3",0
   GOSUB @TMPSAV
   GOTO @QMENU

  @LFILE3
   SYSBEEP=1
   IF ENDPOS>=4*PARTLEN THEN SAVE "GRP"+STR$(PG2)+":MMLTMP"+STR$(PAGE)
   SYSBEEP=0

   GPAGE 0,PG2,0
   ENDPOS=ENDPOS+GSPOIT(13,0)*256+GSPOIT(14,0)
   PAGE=PAGE+1:GOTO @LODLOOP

 @SFILE
  INPUT "ファイルメイハ(GRP)";FILE$
  IF LEN(FILE$)==0 THEN @SFILE
  '?"Saving..."
  ?
  PAGE=0
  EPTMP=ENDPOS
  IF ENDPOS<4*PARTLEN THEN @SAVLOOP
   PAGE=0
   GOSUB @LDLEFT4
   SYSBEEP=1
  @SAVLOOP
   IF PAGE>=4 THEN GOSUB @LDRIGHT1
   GPAGE 0,PAGE%4,0

   FOR I=0 TO 3
    GPSET I,0,INITFLG[I]
   NEXT
   GPSET 4,0,TEM
   FOR P=0 TO PARTCNT-1
    GPSET 5+P,0,GAKKI[P]
   NEXT

   IF EPTMP>PARTLEN THEN EPTMP2=PARTLEN ELSE EPTMP2=EPTMP
   GPSET 13,0,EPTMP2/256
   GPSET 14,0,EPTMP2%256

   EPTMP=EPTMP-PARTLEN
   F$=STR$(PAGE)*(PAGE>0)
   SYSBEEP=1
   SAVE "GRP"+STR$(PAGE%4)+":"+LEFT$(FILE$,8-LEN(F$))+F$
   IF EPTMP>0 THEN PAGE=PAGE+1:GOTO @SAVLOOP
  GOTO @QMENU
 @XFILE
  INPUT "FileName(MEM)";FILE$
  IF LEN(FILE$)==0 THEN @XFILE
  GENALL=1
  '?"Generating MML Data..."
  ?
  ?"MMLテ゛-タ シュツリョクチュウ...
  GOSUB @GENMML
  GOTO @QMENU
 
 @QMENU
  'IF CE THEN GOSUB @CHKEND
  'CE=0
  CLS
  PNLTYPE "OFF"
  VISIBLE 1,1,1,1,1,0
  SYSBEEP=0
  PLAY=0
  U=U_ALL
  GOTO @LOOP



@NAME
'セツメイショ(Web)カラコヒ゜ヘ゜
DATA "Acoustic Grand Piano"
DATA "Bright Acoustic Piano"
DATA "Electric Grand Piano"
DATA "Honky-tonk Piano"
DATA "Electric Piano 1"
DATA "Electric Piano 2"
DATA "Harpsichord"
DATA "Clavi"
DATA "Celesta"
DATA "Glockenspiel"
DATA "Music Box"
DATA "Vibraphone"
DATA "Marimba"
DATA "Xylophone"
DATA "Tubular Bells"
DATA "Dulcimer"
DATA "Drawbar Organ"
DATA "Percussive Organ"
DATA "Rock Organ"
DATA "Church Organ"
DATA "Reed Organ"
DATA "Accordion"
DATA "Harmonica"
DATA "Tango Accordion"
DATA "Acoustic Guitar (nylon)"
DATA "Acoustic Guitar (steel)"
DATA "Electric Guitar (jazz)"
DATA "Electric Guitar (clean)"
DATA "Electric Guitar (muted)"
DATA "Overdriven Guitar"
DATA "Distortion Guitar"
DATA "Guitar Harmonics"
DATA "Acoustic Bass"
DATA "Electric Bass (finger)"
DATA "Electric Bass (pick)"
DATA "Fretless Bass"
DATA "Slap Bass 1"
DATA "Slap Bass 2"
DATA "Synth Bass 1"
DATA "Synth Bass 2"
DATA "Violin"
DATA "Viola"
DATA "Cello"
DATA "Contrabass"
DATA "Tremolo Strings"
DATA "Pizzicato Strings"
DATA "Orchestral Harp"
DATA "Timpani"
DATA "String Ensembles 1"
DATA "String Ensembles 2"
DATA "Synth Strings 1"
DATA "Synth Strings 2"
DATA "Voice Aahs"
DATA "Voice Oohs"
DATA "Synth Voice"
DATA "Orchestra Hit"
DATA "Trumpet"
DATA "Trombone"
DATA "Tuba"
DATA "Muted Trumpet"
DATA "French Horn"
DATA "Brass Section"
DATA "Synth Brass 1"
DATA "Synth Brass 2"
DATA "Soprano Sax"
DATA "Alto Sax"
DATA "Tenor Sax"
DATA "Baritone Sax"
DATA "Oboe"
DATA "English Horn"
DATA "Bassoon"
DATA "Clarinet"
DATA "Piccolo"
DATA "Flute"
DATA "Recorder"
DATA "Pan Flute"
DATA "Blown Bottle"
DATA "Shakuhachi"
DATA "Whistle"
DATA "Ocarina"
DATA "Lead 1 (square)"
DATA "Lead 2 (sawtooth)"
DATA "Lead 3 (calliope)"
DATA "Lead 4 (chiff)"
DATA "Lead 5 (charang)"
DATA "Lead 6 (voice)"
DATA "Lead 7 (fifths)"
DATA "Lead 8 (bass + lead)"
DATA "Pad 1 (new age)"
DATA "Pad 2 (warm)"
DATA "Pad 3 (polysynth)"
DATA "Pad 4 (choir)"
DATA "Pad 5 (bowed)"
DATA "Pad 6 (metallic)"
DATA "Pad 7 (halo)"
DATA "Pad 8 (sweep)"
DATA "FX 1 (rain)"
DATA "FX 2 (soundtrack)"
DATA "FX 3 (crystal)"
DATA "FX 4 (atmosphere)"
DATA "FX 5 (brightness)"
DATA "FX 6 (goblins)"
DATA "FX 7 (echoes)"
DATA "FX 8 (sci-fi)"
DATA "Sitar"
DATA "Banjo"
DATA "Shamisen"
DATA "Koto"
DATA "Kalimba"
DATA "Bag pipe"
DATA "Fiddle"
DATA "Shanai"
DATA "Tinkle Bell"
DATA "Agogo"
DATA "Steel Drums"
DATA "Woodblock"
DATA "Taiko Drum"
DATA "Melodic Tom"
DATA "Synth Drum"
DATA "Reverse Cymbal"
DATA "Guitar Fret Noise"
DATA "Breath Noise"
DATA "Seashore"
DATA "Bird Tweet"
DATA "Telephone Ring"
DATA "Helicopter"
DATA "Applause"
DATA "Gunshot"
DATA "Drum"
DATA "Drum"
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA "PSG Duty 12.5%"
DATA "PSG Duty 25.0%"
DATA "PSG Duty 37.5%"
DATA "PSG Duty 50.0%"
DATA "PSG Duty 62.5%"
DATA "PSG Duty 75.0%"
DATA "PSG Duty 87.5%"
DATA "Noise"
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA ""
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
DATA "User Waveform"
'--EOF--
}}
#endregion

#ref(mmled.png,,100%)

#ref(mmledchr.png,,100%)



* CHECKER FLAG (ひとことコメント) [#Comments]
この作品に対するコメントがあれば一言どうぞ。(作品に直接関係ない質問や雑談は[[掲示板>Board]]へ)

#comment

表示モード : [ スマホ・3DS対応表示 | クラシック表示 ]
PukiWiki 1.4.7 Copyright © 2001-2006 PukiWiki Developers Team. License is GPL. Based on "PukiWiki" 1.3 by yu-ji
ページの処理時間 : 0.016 秒 | ログイン
Copyright(C) 2011-2014 プチコンまとめWiki ◆1sxkymI8ji30