wonbe/ctb.wb
Kawamata Akira b906d49ca1 - Hirotaka JOE Ohkubo's difference (0.04j4) can be merged with play statement (sound.il required)
- Consider? As the keyword debug
 - Allow goto to be omitted if immediately after it is a decimal integer value
 - Addition of machine language related functions
 - Add tron / troff command (display execution line number)

Version 0.05 - from wonbe005.lzh
2000-12-10 12:00:00 +09:00

291 lines
10 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

10 goto 10000
1000 ' 駒表示
1001 ' X,Y : センター座標, A : 駒データ位置, B : 0x20 で消去, 0x81A1 で '■'
1002 y = Y : if y >= 0 then locate X,y : print chr(B);
1003 for i=A to A+4 step 2
1004 y = Y + @(i+1) : if y >= 0 then locate X + @(i),y : print chr(B);
1005 next
1006 return
1100 ' 移動できるかチェック
1101 ' U,V : センター座標, W : 駒データ位置, F : 0 OK / 1 NG
1110 F = 1 : @(P) = 1 'ぶず
1111 if @(1+U+V*12) then goto 1116
1112 if @(1+U+@(W )+(V+@(W+1))*12) then goto 1116
1113 if @(1+U+@(W+2)+(V+@(W+3))*12) then goto 1116
1114 if @(1+U+@(W+4)+(V+@(W+5))*12) then goto 1116
1115 F = 0
1116 @(P)=0 : return
1200 ' スコア表示
1210 locate 21,11
1220 if S < 10000 then print " ";
1230 if S < 1000 then print " ";
1240 if S < 100 then print " ";
1250 if S < 10 then print " ";
1260 print S;
1270 return
1300 ' ブズ回転
1310 O = rnd(4)+0x81A8 : locate Q+8,R-4 : print chr(O);
1320 T = tick + 66
1330 return
1400 ' データと画面をスクロールダウン
1401 ' Y : 消えるライン xy座標系
1410 for i=Y*12+10 to 13 step -1 : @(i)=@(i-12) : next
1420 for i=1 to 10 : @(i)=0 : next
1430 for i=Y to 4 step -1 : for j=1 to 10
1440 locate j+8,i-4 : k=@(i*12+j)
1450 if k=1 then print "■"; : goto 1460
1451 if k=2 then print chr(2); : goto 1460
1452 print " ";
1460 next : next
1470 return
3000 ' メインループ
3010 if T < tick then gosub 1300 ' ブズ回転
3020 if t < tick then goto 3500 ' 落とす
3100 ' キースキャン
3110 U = x : V = y : W = a
3120 k = scan : if k and l then goto 3150 ' 一度手を離せ。
3130 if k and scan_a then W = @(W+6) : l = scan_a : goto 3200
3131 if k and scan_x2 then U = U + 1 : l = scan_x2 : goto 3200
3132 if k and scan_x3 then V = V + 1 : l = scan_x3 : goto 3200
3133 if k and scan_x4 then U = U - 1 : l = scan_x4 : goto 3200
3140 l = 0 ' 何も押されていない
3150 waitvb 1
3160 goto 3000
3200 ' キーによる駒移動
3210 gosub 1100 ' 移動できるかチェック
3220 if F then if l = scan_x3 then goto 3600 ' 押し込み
3230 if F then goto 3000 ' 動かせない。おしまい。
3240 ' 動かせる。実行。
3250 if l = scan_x3 then l = 0 ' : t = tick + w ' 下向きだけはリピート可能
3260 X = x+9 : Y = y-4 : A = a : B = 32 : gosub 1000 ' 今のを消す
3270 x = U : y = V : a = W
3280 X = x+9 : Y = y-4 : A = a : B = 0x81A1 : gosub 1000 ' 移動後を表示
3290 goto 3000
3299 ' メインループ終わり
3500 ' 時間切れ。一つ下がる
3510 U = x : V = y + 1 : W = a : gosub 1100
3520 if F then goto 3600 ' 下がれない。
3530 X = x+9 : Y = y-4 : A = a : B = 32 : gosub 1000 ' 今のを消す
3540 y = V : Y = y-4 : B = 0x81A1 : gosub 1000 ' 移動後を表示
3550 t = tick + w
3560 play "o1a16" ' 落下音
3570 goto 3000
3600 ' 着底
3610 ' 埋まったラインを消す
3615 play "o1g8"
3620 @(P)=1
3621 @(1+x+y*12)=1
3622 @(1+x+@(a )+(y+@(a+1))*12)=1
3623 @(1+x+@(a+2)+(y+@(a+3))*12)=1
3624 @(1+x+@(a+4)+(y+@(a+5))*12)=1
3630 for i=y+@(a+1) to y+@(a+5)
3640 f=0 : @(P)=1
3650 for j=1+i*12 to 10+i*12
3660 if @(j)=0 then f=1
3670 next
3680 @(P)=0
3690 if f then goto 3920 ' このラインは消せない。次。
3710 if i <> R then goto 3780
3720 ' ブズ抹消!
3730 locate Q+8,R-4 : print chr(2);
3740 S=S+50 : gosub 1200 : play "o4e8~c0"
3760 P=1 : R=22 ' ブズ死亡状態
3770 goto 3800
3780 ' ラインだけ消去
3790 S=S+1 : gosub 1200 : play "g16"
3800 ' データと画面をスクロールダウン
3810 Y=i : gosub 1400
3870 ' ブズ復元
3880 if P=1 then goto 3920
3890 ' ブズが落ちてきたブロックに殴られたか?
3900 if @(P) then P=P+12 : R=R+1 : S=S+75 : gosub 1200 : play "g16c16"
3910 locate Q+8,R-4 : print chr(O);
3920 next ' MAX4ブロック分ループ終了。
4000 ' ブズの移動フェーズ
4010 if P=1 then goto 4300
4020 locate Q+8,R-4 : print " "; : c = 4
4030 goto 4040 + (O and 1) * 4 + (O and 2) '時計回りの苦肉の策
4040 if @(P+1)=0 then P=P+1 : Q=Q+1 : goto 4050 ' 0x81A8 右 00
4041 c=c-1 : if c=0 then goto 4080
4042 if @(P-12)=0 and R>1 then P=P-12 : R=R-1 : goto 4050 ' 0x81AA 上 10
4043 c=c-1 : if c=0 then goto 4080
4044 if @(P-1)=0 then P=P-1 : Q=Q-1 : goto 4050 ' 0x81A9 左 01
4045 c=c-1 : if c=0 then goto 4080
4046 if @(P+12)=0 then P=P+12 : R=R+1 : goto 4050 ' 0x81AB 下 11
4047 c=c-1 : if c=0 then goto 4080
4048 goto 4040
4050 ' 動けた! 「ぷふぁ」
4051 ' ぶずが画面上に抜けたらゲームオーバー
4052 if R < 4 then locate Q+8,R-3 : print chr(1);: goto 4400
4060 gosub 1300
4070 goto 4300
4080 ' ぶずは囲まれた! 「ぎゃう」
4090 S = S + 100 : gosub 1200 : play "e8~>c0" ': play "o6#0c8#1e8#2g8"
4100 locate Q+8,R-4 : print chr(2);
4110 @(P) = 2 : P=1 : Y=R : R=22
4120 ' この死体でこのラインが埋まるか?
4130 f=0
4140 for i=Y*12+1 to Y*12+10
4150 if @(i)=0 then f=1
4160 next
4170 if f then goto 4300
4180 waitvb 7 : play "g16" : gosub 1400
4190 S=S+1 : gosub 1200
4300 ' 絶対不可侵領域を塗りつぶしてないか→ゲームオーバー
4310 f=1
4320 for i=1+3*12 to 10+3*12
4330 if @(i) then f=0
4340 next
4350 if f then goto 5000 ' 詰まってはいない。
4400 ' GAME OVER
4410 play "o3edc"
4420 locate 10, 9 : print "G A M E";
4430 locate 10,11 : print "O V E R";
4440 k=wait
4450 if scan then goto 4450 ' 手を離せ。
4455 for i=0 to 17: locate 9,i : print " ";:next
4460 goto 10050 ' スタート画面へ。
5000 ' ブズ生成 *スタート時突入ポイント*
5010 if P<>1 then goto 5100
5020 Q=rnd(10)+1
5030 R=16+rnd(7)-rnd(7) : if R = 22 then R=20
5040 P=Q+R*12 : if @(P) then goto 5020
5050 gosub 1300
5100 ' 次の駒生成
5110 for j=4 to 7: locate 22,j : print " "; : next
5120 a = b : b = rnd(19)*7+K
5130 X = 24 : Y = 6 : B = 0x8E9F : A = b : gosub 1000
5140 x = 5 : y = 2 ' 駒の初期位置
5150 t = tick + w ' 次のタイムアウト
5160 l = scan_x3 ' 下が続けて入ってしまうのを避けるため
5170 goto 3000
9999 end
10000 ' いろいろ準備ちゅう...
10010 randomize tick
10020 gosub 20000 ' 表示初期化
10030 play "cego6c2rco5gec2" ' テーマ音楽、でもない。
10040 gosub 30000 '駒データ準備
10049 ' ここから再開
10050 locate 10, 9 : print "P U S H";
10051 locate 10,11 : print " K E Y ";
10060 k = wait
10070 play "#0c#1e#2g"
10080 for i=0 to 17: locate 9,i : print " ";:next
11000 ' ゲーム準備
11010 b = rnd(19)*7+K ' 最初に落とす駒を準備
11020 w = 90
11030 for i=0 to K-1: @(i) = 0 : next
11040 for i=0 to K-1 step 12 : @(i) = 1 : @(i+11) = 1 : next ' ばんぺいくん
11050 for i=12*22+1 to K-1 : @(i) = 1 : next ' これもばんぺいくん(昇圧回路不要)
11060 l = 0
11070 P = 1 ' ぶず
11080 S = 0 : gosub 1200 ' score
11090 goto 5000 ' メインループ
20000 ' 画面初期化
20010 cls
20020 for i=0 to 17: locate 8,i: print "左";: locate 19,i:print "右";: next
20030 locate 2,3 : print "きゃっち";
20040 locate 4,4 : print "ざ";
20050 locate 2,5 : print "Buzz";
20060 locate 2,7 : print "by";
20070 locate 2,8 : print "流れ星の";
20080 locate 3,9 : print "ジョヲ";
20090 locate 22,2 : print "NEXT";
20100 locate 21,3 : print "┏━━━━┓";
20110 locate 21,4 : print "┃    ┃";
20111 locate 21,5 : print "┃    ┃";
20112 locate 21,6 : print "┃    ┃";
20113 locate 21,7 : print "┃    ┃";
20120 locate 21,8 : print "┗━━━━┛";
20130 locate 21,10 : print "SCORE";
29999 return
30000 ' 駒の形
30001 ' read - data 文も欲しくなる...
30002 ' データ形式 (7 words/駒)
30003 ' (センター座標からの x offset, y offset) × 3, 回転先駒データ位置
30004 K = 23 * 12 : ' フィールド記憶領域の次に駒データを入れるベース位置
30005 k = K
30006 ' 縦棒 ID = 0
30007 @(k ) = 0 : @(k+1) = -2 : @(k+2) = 0 : @(k+3) = -1
30008 @(k+4) = 0 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30009 ' 横棒 ID = 1
30010 @(k ) = -1 : @(k+1) = 0 : @(k+2) = -2 : @(k+3) = 0
30011 @(k+4) = 1 : @(k+5) = 0 : @(k+6) = k-7: k = k + 7
30012 ' 佐渡島 ID = 2
30013 @(k ) = 1 : @(k+1) = 0 : @(k+2) = 0 : @(k+3) = 1
30014 @(k+4) = -1 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30015 ' 立ち佐渡島 ID = 3
30016 @(k ) = -1 : @(k+1) = -1 : @(k+2) = -1 : @(k+3) = 0
30017 @(k+4) = 0 : @(k+5) = 1 : @(k+6) = k-7: k = k + 7
30018 ' 逆佐渡島 ID = 4
30019 @(k ) = -1 : @(k+1) = 0 : @(k+2) = 0 : @(k+3) = 1
30020 @(k+4) = 1 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30021 ' 立ち逆佐渡島 ID = 5
30022 @(k ) = 1 : @(k+1) = -1 : @(k+2) = 1 : @(k+3) = 0
30023 @(k+4) = 0 : @(k+5) = 1 : @(k+6) = k-7: k = k + 7
30024 ' L ID=6
30025 @(k ) = 0 : @(k+1) = -1 : @(k+2) = 0 : @(k+3) = 1
30026 @(k+4) = 1 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30027 ' L+1 ID=7
30028 @(k ) = 1 : @(k+1) = -1 : @(k+2) = 1 : @(k+3) = 0
30029 @(k+4) = -1 : @(k+5) = 0 : @(k+6) = k+7: k = k + 7
30030 ' L+2 ID=8
30031 @(k ) = -1 : @(k+1) = -1 : @(k+2) = 0 : @(k+3) = -1
30032 @(k+4) = 0 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30033 ' L+3 ID=9
30034 @(k ) = 1 : @(k+1) = 0 : @(k+2) = -1 : @(k+3) = 0
30035 @(k+4) = -1 : @(k+5) = 1 : @(k+6) = k-21: k = k + 7
30036 ' 逆L ID=10
30037 @(k ) = 0 : @(k+1) = -1 : @(k+2) = 0 : @(k+3) = 1
30038 @(k+4) = -1 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30039 ' 逆L+1 ID=11
30040 @(k ) = -1 : @(k+1) = 0 : @(k+2) = 1 : @(k+3) = 0
30041 @(k+4) = 1 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30042 ' 逆L+2 ID=12
30043 @(k ) = 1 : @(k+1) = -1 : @(k+2) = 0 : @(k+3) = -1
30044 @(k+4) = 0 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30045 ' 逆L+3 ID=13
30046 @(k ) = -1 : @(k+1) = -1 : @(k+2) = -1 : @(k+3) = 0
30047 @(k+4) = 1 : @(k+5) = 0 : @(k+6) = k-21: k = k + 7
30048 ' 凸 ID=14
30049 @(k ) = 0 : @(k+1) = -1 : @(k+2) = -1 : @(k+3) = 0
30050 @(k+4) = 1 : @(k+5) = 0 : @(k+6) = k+7: k = k + 7
30051 ' 左凸 ID=15
30052 @(k ) = 0 : @(k+1) = -1 : @(k+2) = -1 : @(k+3) = 0
30053 @(k+4) = 0 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30054 ' ID=16
30055 @(k ) = 1 : @(k+1) = 0 : @(k+2) = -1 : @(k+3) = 0
30056 @(k+4) = 0 : @(k+5) = 1 : @(k+6) = k+7: k = k + 7
30057 ' ト ID=17
30058 @(k ) = 1 : @(k+1) = 0 : @(k+2) = 0 : @(k+3) = -1
30059 @(k+4) = 0 : @(k+5) = 1 : @(k+6) = k-21: k = k + 7
30060 ' 田 ID=18
30061 @(k ) = 0 : @(k+1) = -1 : @(k+2) = -1 : @(k+3) = -1
30062 @(k+4) = -1 : @(k+5) = 0 : @(k+6) = k : k = k + 7
31000 return
32764 ' 結局仕様書をまとめないとコーディングはできないね。
32765 ' そう単純じゃなかった。
32766 ' Catch the Buzz - original on Macintosh
32767 ' reproduced with WONBE by Hirotaka JOE Ohkubo, 2000/12/07