Compare commits

...

7 Commits

Author SHA1 Message Date
Godzil
ba2cb227e0 Add quick translation of the readme 2018-03-07 22:21:09 +00:00
Godzil
86539c6fac Rename wonbe.txt to README.jp.txt and create a first readme file 2018-03-07 22:16:36 +00:00
Kawamata Akira
7d4a34e405 - Transfer to WonderSwan Color development kit
- Add colormode, palette, color statement, hardarch system variable
 - Add a digression to the document

Version 0.06 - from wonbe006.lzh
2001-01-29 12:00:00 +09:00
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
Kawamata Akira
3bc39a53f1 - When trying to delete a line number including 0x0d such as 13, the program took a broken bug
- Change processing system from Turbo C2.0 to Visual C ++ 1.51
 - Significantly improved loading speed
 - Only the .wb entrance menu is displayed
 - Sample game STAR WITCH (star.wb, star.txt) attached

Version 0.04 - from wonbe004.lzh
2000-11-12 12:00:00 +09:00
Kawamata Akira
3a44094757 - Operator precedence order Unary operator> * /> + -> Comparison operator> and, or, xor
- Change the value when the comparison operator is established from 1 to -1
 - Change prompt to OK
 - Fixed a bug that negative numbers were output as positive numbers by print / debug
 - Changed so that loop can escape in next even if for closing price does not match exactly

Version 0.03 - from wonbe003.lzh
2000-11-07 17:00:00 +09:00
Kawamata Akira
ee82c35364 scan_XX took a bug that does not work
Version 0.02 - from wonbe002.lzh
2000-11-07 12:00:00 +09:00
23 changed files with 3502 additions and 515 deletions

32
Makefile.tcpp10 Normal file
View File

@ -0,0 +1,32 @@
# Makefile for Wonbe 0.04j4
# with GNUmake and gcc / Turbo C++ 1.0
# Hirotaka JOE Ohkubo 2000/12/04
INCLUDE = C:/WWitch/include
C0WW = C:\\WWitch\\lib\\c0wwjpn1.obj
LIBS = C:\\WWitch\\lib\\libww.lib C:\\WWitch\\lsic86ww\\lib\\s\\runtime.lib
COPTS = -1 -j1 -d -O -Z -ms! -zPCGROUP -zSDGROUP -zGDGROUP
CFLAGS = -DWW
all: wonbe.fx wonbe32.exe
wonbe.fx: wonbe.bin
mkfent wonbe.cf
wonbe.bin: wonbe.obj
tlink /m /c $(C0WW) wonbe.obj, wonbe, wonbe, $(LIBS)
exe2fbin wonbe.exe wonbe.bin
rm wonbe.exe
wonbe.obj: wonbe.c keywords.h
tcc -I$(INCLUDE) $(COPTS) $(CFLAGS) -c wonbe.c
wonbe32.exe: wonbe.o win32text.o
gcc -o wonbe32.exe wonbe.o win32text.o -lgdi32
wonbe.o: wonbe.c keywords.h
gcc -c -DWIN32 -DCYGWIN wonbe.c
win32text.o: win32text.c win32text.h

372
README.jp.txt Normal file
View File

@ -0,0 +1,372 @@
ワンべぇ: WONBE, WonderWitch BASIC Environment
暫定マニュアル Ver 0.06
2001年1月29日
株式会社ピーデー
川俣 晶
This software is distributed under GNU General Public License
●これは何か?
 ワンべぇは、WonderWitch上で使用できる小型BASICインタプリタです。
 WonderWitch上ですべての機能が稼働し、シリアルケーブル経由で接続された一般の通信ソフトで操作します。デバッグ済みのプログラムを実行する場合は、シリアルケーブルも通信ソフトも必要ありません。
 WonderWitchのテキスト画面を扱う最小限度のステートメント(cls,locate,print)と、最小限度のボタン入力機能(wait,scan)を持ち、簡易なミニゲームが書けます。
 WonderSwan Color使用時には4色カラーモードが可能です。
 動作テスト用にWin32上で動くバイナリーもありますが、これは、BASIC本体の動作確認用と割り切ってください。
 ドキュメントは、ちょっと見難いかもしれませんが、有志が見やすいものを作ってくれることを期待します。
●必要なもの
・開発時
 WonderWitchのカートリッジとシリアルケーブル。38400bpsの無手順通信が可能な通信ソフトを持つパソコン等。
・実行時
 ワンべぇと実行したプログラムを入れてあるWonderWitchのカートリッジのみ
●準備
・TransMagicなどでワンべぇ(fonbe.fx)をWonderWitchに転送します。
・TransMagicなどの接続を切り、通信ソフトから38400bpsの無手順通信を開始します
・WonderWitch上でワンべぇを実行します
・エントランスメニュー画面でY2を押します
・通信ソフトに、ワンべぇの名前が表示され、"*Ready"と出ます
・これで準備完了です
・print "hello!"リターンと打ってWonderWitchの画面を見てください。文字が出ていれば正常です。
●開発済みプログラムの実行
・WonderWitch上でワンべぇを実行します
・エントランスメニュー画面で実行したいファイルを選んでAボタンを押します
●開発環境の概要
 通常の行番号ベースのエディタが使えます。
 行番号に引き続いて1行を入力してリターンを押すと、プログラムに記録されます。
 行番号だけを入力してリターンを押すとその行は削除されます。
 行番号無しで命令を入力すると即座に実行されます。
 編集はバックスペースによる1文字削除しか使えません。通信ソフトからホスト上のエディタにCOPY&PASTEして、エディタ上で編集してから、通信ソフトに貼り付けてワンべぇに送ると便利です。ただし、フロー制御が無いので、複数行まとめて貼り付けると文字落ちが生じます。張り付けは1行単位で行ってください。プログラムはホスト上で編集してあらかじめTransMagicなどで送信しておくのも有効な手段です。
 現状では2Kバイト以上のプログラムを作成してもsaveコマンドで保存できません。listコマンドを実行してから通信ソフト上でCOPY&PASTEしてホスト上に保存してください。
 実行中は、STARTボタンを押すといつでも対話モードに戻れます。その後、contステートメントで実行を継続できます。
 中間言語に翻訳してから処理するため、中間言語に翻訳できない場合は、入力直後にエラーが出ます。
●言語の概要
 ごく軽いBASIC言語です。
 昔あったTiny BASICに近い構文を持っています。
 データ型は、符号付き16bit整数だけです。
 定数は、-3276732767の10進数か、0x00000xffffの16進数で記述できます。-32768は変数には記憶できますが、ソースには書けません。(-32767-1のように書いてください)
 変数は、グローバル変数として、AZのアルファベット大文字1文字のものが26個あります。
 ローカル変数として、azのアルファベット小文字1文字のものが26個あります。ローカル変数はgosubステートメントを実行したときに新しい領域が割り当てられ、returnステートメントを実行したときにgosubする前の領域が戻ってきます。
 配列変数は@(インデックス)という形式の1次元配列だけが使用できます。使用可能なサイズは、プログラム記憶領域(48Kバイト)の残りサイズに等しくなります。インデックスは0から始まります。(例: for i=0 to 9:print @(i):next)
 演算子の優先順位は「単項演算子 > */ > +- > 比較演算子 > and,or,xor」となります。(比較演算子は、<と>と=で記述する演算子すべて)
 計算順序は、括弧()を使って明示的に変更できます。
 オーバーフロー、アンダーフローのチェックはありません。溢れは無視されます。ただしゼロ除算はエラーになります。
 ステートメントなどのキーワードはすべてアルファベット小文字で入力します。大文字を使っても小文字になります。
● ステートメント一覧
変数 = 式
 式を計算して変数に代入します。letキーワードはサポートしていません。
例: a=b+c
if 式 then ステートメント列
 式が0でなければステートメント列を実行します。0なら次の行から実行を継続します。elseはありません。
例: if (a=0) and (b=1) then goto 200
print [文字列|式|chr(式)][,|;]...
 WonderWitchのテキスト画面の現在のカーソル位置から文字を表示します。
 式の前後に空白文字が入ることはありません。
 chr(式)は、式の値を文字コードと見なして表示します。
 制御コードは扱いませんので、WonderWitchのキャラクタージェネレータにあるすべての文字が表示できます。
 区切り文字の;は何もしません。,はタブストップ位置までカーソルを進めます。
 print文の最後は;または,で終わった場合は改行しません。
例: print "計算結果=",chr(34);1+2;chr(34)
locate 式,式
 WonderWitchのテキスト画面の現在のカーソル位置を設定します。引数はx,yの順番です。
例: locate 10,10
cls
 WonderWitchのテキスト画面を消去します。
例: cls
goto 式
 式の行番号に飛びます。計算型goto文が可能です。つまり、goto A*100とすると、Aが1のきは100行目に。2のときは200行目に飛びます。
例: goto 100
gosub 式
 スタックに現在位置とローカル変数を積んで、式の行番号に飛びます。gotoと同じく計算型gosubが可能です。
 スタックはforと合わせて8レベルまでです。
例: gosub 100
return
 gosubがスタックに積んだ情報を取り出して、そこに処理を戻す。ローカル変数も戻る。
例: return
for 変数=式 to 式
for 変数=式 to 式 step 式
 変数の値を変化させながらnextまで繰り返します。
 最後の変数の値が終値に一致せず、終値+ステップ値がオーバーフローする場合は無限ループする可能性があります。そのような値は指定しないように注意してください。
例: for i=0 to 10 step 2
next
 forステートメントの位置に戻って動作を繰り返します。forステートメントで示した条件が満たされた場合は、nextの次に動作が進みます。nextの後に変数名を書くとエラーになります。
例: next
end
 プログラムの実行を終了します。
break
 その位置で一時的に実行を中断します。contステートメントで実行を継続できます。
rem 文字列
'文字列
 コメントを記述します。後ろに:を置いてステートメントを続けることはできません。
例: rem これはテストプログラムです。
例: 'この式が座標を計算します
new
 メモリ上のプログラムを消去します。
list [行番号][-][行番号]
 指定範囲の行番号のプログラムをリストします。すべて省略すると全行をリストします。
run
run 式
run 文字列
 プログラムを実行します。それに先だって変数やスタックがクリアされます。
 runはメモリ上のプログラムを先頭から。run 式は、式の行番号から。run 文字列は文字列のファイルを読み込んでそれを実行します。
例: run
例: run 100
例: run "test.wb"
cont
 breakステートメントやSTARTボタンによるブレークによって停止した位置から実行を再開します。
save 文字列
 文字列をファイル名としてメモリ上のプログラムを保存します。保存されるのは内部表現ではなくテキスト形式です。
 現在はWonderWitchのファイルシステムの制約上、2Kバイトを超えるファイルを保存できません。listコマンドで端末にリストを送ってそれをCOPY&PASTEして保存してください。
例: save "hello.wb"
load 文字列
 文字列をファイル名としてファイルからプログラムを読み込みます。読み込むのはテキスト形式で、改行はCRLFとLFのどちらでも可です。中間言語に翻訳できない行がある場合はそこで読み込みが中断されます。プログラムの実行中に使用した場合は実行は中断されます。
例: load "hello.wb"
merge 文字列
 メモリ上のプログラムにファイル上のプログラムを混ぜ合わせます。同じ行番号の行は読み込まれる方が優先されます。中間言語に翻訳できない行がある場合はそこで読み込みが中断されます。プログラムの実行中に使用した場合は実行は中断されます。
例: load "merge.wb"
randomize 式
 乱数の初期値を指定します。これを使わないと必ず同じ順序で乱数が発生します。引数には、システム変数tickを指定すると最適です。
例: randomize tick
exit
 ワンべぇを抜けてOSに戻ります。
debug [文字列|式|chr(式)][,|;]...
 printステートメントと同等ですが、WonderWitchの画面ではなく、シリアルポートに送ります。単体で実行する場合には使えないデバッグ専用の機能です。
waitvb 式
 式の回数だけVBLANKを待ちます。待っている間はSTARTボタンによるブレークを受け付けなくなるので、指定できる値は750までと制限されています。750を超える値を指定するとエラーになります。
例: waitvb 75
files
 カレントディレクトリのファイル一覧をシリアルポートに送ります。単体で実行する場合には使えないデバッグ専用の機能です。
play 文字列
 引数の文字列をMMLとして再生します。使用可能にするには「● playステートメントを有効にする方法」を参照してください。
例: play "cde"
poke 式,式
 最初の式をオフセット、2番目の式を値と見なし、システム変数defsegのセグメントに1バイトのメモリ書き込みを行います。
 Win32版では機能しません。
 注意:csegのセグメントはフラッシュメモリなのでpokeでは書き込めません。
call 式
 式をオフセットと見なし、システム変数defsegのセグメントにマシン語レベルのサブルーチンコール(FAR)を行います。コールする前にシステム変数AX,BX,CX,DX,SI,DI,DS,ESがそれぞれのレジスタに設定されます。リターン後のレジスタ状態はシステム変数AX,BX,CX,DX,SI,DI,ESに保存されます。(注:DSは戻りません)
 Win32版では機能しません。
int 式
 式を割り込み番号と見なし、マシン語レベルのシステム割り込み(int)を行います。WonderWitchのBIOSを呼び出すことができます。コールする前にシステム変数AX,BX,CX,DX,SI,DI,DS,ESがそれぞれのレジスタに設定されます。リターン後のレジスタ状態はシステム変数AX,BX,CX,DX,SI,DI,ESに保存されます。(注:DSは戻りません)
 Win32版では機能しません。
tron
 トレースモードをオンにします。トレースモードに入ると、新しい行の実行始めるごとに、行番号をデバッグコンソールに送信します。
troff
 トレースモードをオフにします。
colormode 式
 カラーモードを設定します。WonderSwan Colorでのみ使用できます。
 式の値は以下の通りです。
0x00 モノクロモード
0x80 4色モード
0xC0 16色モード (設定できますがワンべぇの機能からは描画できません)
0xE0 16色PACKEDモード (設定できますがワンべぇの機能からは描画できません)
 Win32版では機能しません。
color 式,式
 描画する文字の色を指定します。最初の式が前景色のインデックス、2番目の式が背景色のインデックスです。それぞれ、03のみ指定できます。
 実行開始時の初期状態はcolor 3,0に相当する状態です。
 Win32版では機能しません。
palette 式,式,式,式
 パレットを指定します。最初の式が設定するパレットのインデックス(03)を指定します。2番目から4番目の式が、それぞれ、R,G,Bの値を示します。R,G,Bの値はそれぞれ015の範囲内です。
 Win32版では機能しません。
例: palette 0,15,0,0
 2項演算子
 + - * / < > = <= >= <> and or xor
● 単項演算子
 - not
● 関数
rnd(式)
 0から式-1までの範囲の乱数を返します。
abs(式)
 式の絶対値を返します。
varptr(変数)
 指定した変数のオフセットを返します。
 Win32版では機能しません。
varseg(変数)
 指定した変数のセグメントを返します。
 Win32版では機能しません。
peek(式)
 式をオフセットと見なし、システム変数defsegのセグメントから1バイトのメモリ読み出しを行います。
 Win32版では機能しません。
● システム変数 (読み書き可能)
ax,bx,cx,dx,si,di,ds,es
 callおよびintステートメントを使用する際にレジスタの値を指定したり、リターン後のレジスタの値を保存するために使用します。
defseg
 peek関数、poke,callステートメントで使用されるセグメント値を保持します。初期値はdsegの値となります。
● システム変数 (読み出しのみ)
scan
 WonderSwanのボタンの状態を調べ、1個の整数値として返します。SCAN_で始まるシステム変数とandを取ることで、どのボタンが押されているかどうか判定できます。STARTボタンは実行中断になるので、これは扱えません。
wait
 WonderSwanのボタンが押されるまで待ち、その状態を1個の整数値として返します。SCAN_で始まるシステム変数とandを取ることで、どのボタンが押されたか判定できます。STARTボタンは実行中断になるので、これは扱えません。
scan_a
scan_b
scan_x1
scan_x2
scan_x3
scan_x4
scan_y1
scan_y2
scan_y3
scan_y4
 それぞれのボタンのマスク値を示す定数を返します。
 Aボタンが押されているかどうかを調べるには、下記の例のように記述します。
例: if scan and scna_a then print "Aボタンが押さている"
tick
 システムタイマーのtickを返します。ただし、本来のtick値は符号無し32bit整数であり、ここで得られるのは16bit符号あり整数であることに注意が必要です。はみ出たbitは捨てられます。
dseg
 実行中のDSセグメントレジスタの値を返します。変数やワンべぇプログラムの中間言語コードはすべてこのセグメントにあります。
 Win32版では機能しません。
cseg
 実行中のCSセグメントレジスタの値を返します。ワンべぇのプログラム本体がこのセグメントにあります。
 Win32版では機能しません。
sseg
 実行中のSSセグメントレジスタの値を返します。マシン語スタックがこのセグメントにあります。
 Win32版では機能しません。
hardarch
 現在実行中のWonderSwanがColorモデルかどうかを返します。モクロWonderSwanなら0。WonderSwan Colorなら1になります。
 Win32版では機能しません。
● ファイル保存時の拡張子
 ワンべぇのソースフィルは、".wb"で終わるファイル名にしておいて下さい。loadなどのコマンドでは拡張子に関係なく読み込めますが、エントランスメニューに表示されるのは".wb"で終わるファイル名だけです。
 playステートメントを有効にする方法
 sound.ilを、/rom0に転送しておいてください。このファイルが無いとplayステートメントを使用しても音が出ません。sound.ilが無ければ音が出ないだけで、プログラムは実行されます。
 Win32版では、クジラ飛行机さん作の"テキスト音楽「サクラ」"に含まれるdsakura.dllを用いてMMLを再生することができます。このソフトは、http://www.text2music.com/より入手できます。dsakura.dllは環境変数pathの通ったディレクトリならどこに置いても構いません。必要ファイルはこのDLLのみです。dsakura.dllが無ければ音が出ないだけで、プログラムは実行されます。ただし、MMLの仕様が完全に同じではないことに注意してください。なお、Win32版ではplayステートメント実行時にカレントディレクトリに$$$.midというファイルを生成します。実行終了後には削除して構いません。
● 配布規則
 このバージョンより、本ソフトは、GNU General Public License (GPL)に従うものとしました。詳細はhttp://www.gnu.org/にあります。
 要するに、誰でも、どんな目的にも使用して良いということです。ただし、本ソフトを売ってはいけません。また、ソースコードは必ず公開しなければなりません。商品の中に収録することは可ですが、本ソフトを利用者が自由にコピーして配布することを妨げてはなりません。
 2000年12月現在、ソースコードは株式会社ピーデーの川俣晶(autumn@piedey.co.jp)が管理しています。有益なソースコードの修正をフィードバックしてくれれば、こちらのソースツリーに反映します。
● 余談
 ワンべぇは、私こと川俣が、20世紀への感謝と決別の気持ちで作ったものです。つまり、私にとって、マイコン/パソコンに出会ったという事件こそが、20世紀最大のイベントであり、そこで大きな役割を果たした超小型インタプリタ言語達、Tiny BASIC、VTL、GAME、TL/1は大きな印象を私の中に残したのです。そして、当時、私はプログラム言語を自分で作りたくて、一生懸命研究を重ねていたのも、また事実です。結局、いくつものトイ言語を開発しました。必要とあれば実用言語も作りました。ENIXのTOKYOナンパストリートをFM-7からPC-8801に移植するときにはメモリ効率を上げるために整数型の小型インタプリタを作ったりもしました。しかし、最終的に構造化アセンブラの匂いを微かに含んだ自作のZ-80用アセンブラ開発システムAZASをもって自作言語の世界は終着駅を迎えたわけです。この時点で、明らかに、Tiny BASICのような言語を開発する意味がなかったのです。必要な性能を得るためには、アセンブラレベルの開発が不可欠だったためです。作ることはできたけれど、作る意味は既に無かったのです。そして、時代が16bitの時代に移ると共に、私も自作言語を使うのはやめて、出来の良い既存の処理系を使うようになりました。MASM 1.27, Turbo Pascal 3.0, Turbo C 1.52.0, MS-C 6.0, Visual BASIC 1.0, JDK 1.02などなど。しかし、ふと20世紀も終わる頃に振り返ると、右も左も分からない少年時代に憧れたあのシンプルなTiny BASICが思い出されたわけです。だから、これこそが私にとっての20世紀そのもの、という気持ちを込めて作ったのです。
 そのような訳で、これにはある種の世代性があります。BASICでゲームを作るというと、MSXとかベーマガという世代もいるようですが、はっきり言って、この世代にはワンべぇは理解できないと思います。MSXに搭載されたBASICは、超高機能巨大BASICであって、Tiny BASICとはまったく世代が違うのです。PC-8801やFM-7まで遡れる世代でも、まだ分からないでしょう。結局のところ、これが分かるためには、パソコンがパソコンと呼ばれる前、マイコンと呼ばれ、ケースに収まっておらず基板が剥き出しの状態で売られていた時代まで遡る必要があります。つまりは、そういう時代、何かを得ようとすれば手作りの要素が入り込んで当たり前の時代のロマンへ捧げるものが、このワンべぇと言うことになります。そして、そのロマンを再現するにふさわしい土台として、WonderWitchという製品がこの時代に登場したことも、不思議な縁だと思います。
 というわけで、私がワンべぇ利用者に言いたいことは一つです。このロマンを分かち合ってくれ。つまり、気に入らないところは、どんどん改造してくれ。好き勝手に改造して使えることを保証するために、ソースはGPLにしてあります。
● 同梱ワンべぇプログラム
▼デモ
colordemo.wb
 カラー機能のデモ (これのみWonderSwanColor用)
▼ゲーム
ctb.wb
 落ち物ゲーム
janken.wb
 ジャンケンゲーム
shoot.wb
 シューティングゲーム
star.wb
 STAR TREK風ゲーム"STAR WITCH" (同梱star.txt参照)
 プログラムの書き方の参考にどうぞ
▼テスト
test.wb
 簡単なインタプリタの動作テスト
testcall.wb
 callステートメントの動作テスト
testcont.wb
 contステートメントの動作テスト
testfor.wb
 forステートメントの動作テスト
testgosub.wb
 gosubステートメントの動作テスト
testif.wb
 ifステートメントの動作テスト
testint.wb
 intステートメントの動作テスト
testlocate.wb
 locateステートメントの動作テスト
testlongloop.wb
 STARTキーによる中断のテスト
testpeekpoke.wb
 peek関数pokeステートメントのテスト
● 変更履歴
2001年1月29日 Ver 0.06
・WonderSwan Colorの開発キットに移行
・colormode, palette, colorステートメント、hardarchシステム変数を追加
・ドキュメントに余談を追加
2000年12月10日 Ver 0.05
・Hirotaka JOE Ohkuboさんの差分(0.04j4)をマージ play文が使用可能に (要sound.il)
・?をキーワードdebugと見なす
・then直後が10進整数値ならgotoの省略を許す
・マシン語関連機能の追加
・tron/troffコマンドの追加(実行行番号の表示)
2000年11月12日 Ver 0.04
・13など0x0dを含む行番号を削除しようとするとプログラムが壊れたバグを取った
・処理系をTurbo C2.0からVisual C++ 1.51に変更
・ロード速度を大幅に改善
・エントランスメニューは.wbのみ表示
・サンプルゲームSTAR WITCH(star.wb, star.txt)を添付
2000年11月7日 Ver 0.03
・演算子の優先順位 単項演算子 > */ > +- > 比較演算子 > and,or,xor
・比較演算子成立時の値を1から-1に変更
・プロンプトをOKに変更
・print/debugで負数が正数として出力されていたバグを解消
・forの終値がピッタリ一致しなくてもnextでループ脱出するように変更
2000年11月7日 Ver 0.02 scan_XXが機能しないバグを取った
2000年11月6日 Ver 0.01 最初のバージョン
● 問い合わせ先
株式会社ピーデー http://www.piedey.co.jp/
川俣 晶 autumn@piedey.co.jp
以上

375
README.md Normal file
View File

@ -0,0 +1,375 @@
ONE Bee: WONBE, WonderWitch BASIC Environment
(Warning: this translation to english was done using google translate, some part of the document may mean nothing, proper translation will come later)
Provisional manual Ver 0.06
January 29, 2001
People
Kawamata Akira
This software is distributed under GNU General Public License
● What is this?
One way is a small BASIC interpreter that you can use on WonderWitch.
All functions operate on WonderWitch and operate with ordinary communication software connected via serial cable. When executing a debugged program, neither a serial cable nor communication software is necessary.
You can write simple mini games with minimum statement (cls, locate, print) handling WonderWitch's text screen and minimum button input function (wait, scan).
When WonderSwan Color is used, 4 color mode is possible.
There is also a binary that runs on Win32 for the operation test, but please divide this for the operation check of BASIC body.
The document may be a little difficult to see, but I hope that volunteers will make things that are easy to see.
● What you need
・ During development
WonderWitch cartridge and serial cable. Personal computers with communication software capable of non-procedural communication at 38,400 bps.
・runtime
Only the cartridge of WonderWitch containing the executed program with the one way
● Preparation
・ Transfer one side (fonbe.fx) to WonderWitch with TransMagic etc.
・ Disconnect the TransMagic etc. and start the non-procedure communication at 38400 bps from the communication software
・ Run one-speed on WonderWitch
・ Press Y2 on the entrance menu screen
・ The name of the one-piece is displayed in the communication software and "* Ready" appears
・ You are now ready
・ Print "hello!" Return and hit the WonderWitch screen. It is normal if letters appear.
● Execution of developed programs
・ Run one-speed on WonderWitch
・ On the entrance menu screen, select the file you want to execute and press the A button
● Overview of development environment
You can use a normal line number based editor.
After entering one line following the line number and pressing return, it is recorded in the program.
If you enter only the line number and press Return, the line will be deleted.
If you enter an instruction without a line number, it will be executed immediately.
Editing can only use one character deletion by backspace. COPY & PASTE from the communication software to the editor on the host, edit it on the editor, paste it on the communication software and send it to the one side is convenient. However, there is no flow control, so if you paste multiple lines at once, character dropout will occur. Please do sticking on a line-by-line basis. It is also effective to edit the program on the host and send it by TransMagic etc. beforehand.
Even if you create a program of 2 KB or more at present, you can not save with the save command. Execute the list command, COPY & PASTE on the communication software and save it on the host.
During execution, you can return to the interactive mode at any time by pressing the START button. You can then continue with the cont statement.
Since it is processed after translating it into an intermediate language, if it can not be translated into an intermediate language, an error will be issued immediately after input.
● Language overview
It is a very light BASIC language.
I have a syntax similar to Tiny BASIC that used to be.
The data type is only a signed 16 bit integer.
Constants can be described as decimal numbers from -32767 to 32767 or hexadecimal numbers from 0x0000 to 0xffff. - 32768 can be stored in variables, but it can not be written in source. (Please write like -32767-1)
Variables have 26 alphabetic capital letters of A to Z as global variables.
As local variables, there are 26 alphabet lowercase letters a through z. A local variable is allocated a new area when the gosub statement is executed and the area before gosub is returned when the return statement is executed.
Array variables can only be one-dimensional arrays of the form @ (index). The available size is equal to the remaining size of the program storage area (48 Kbytes). The index starts at 0. (Eg for i = 0 to 9: print @ (i): next)
Operator precedence is "unary operator> * /> + -> comparison operator> and, or, xor". (Comparison operator is all operators described with <and> and =)
The calculation order can be changed explicitly with parentheses ().
There is no overflow or underflow check. Overflow is ignored. However, division by zero results in an error.
Enter all keywords such as statements in lowercase alphabet. Even using uppercase letters will be lowercase.
● Statement list
Variable = expression
Calculate the expression and assign it to the variable. The let keyword is not supported.
Example: a = b + c
if expression then statement column
If the expression is not 0, execute the statement column. If it is 0, execution continues from the next line. There is no else.
For example: if (a = 0) and (b = 1) then goto 200
print [character string | expression | chr (expression)] [, |;] ... ...
Display characters from WonderWitch's text screen's current cursor position.
There is no space character before or after the expression.
chr (expression) displays the value of the expression as a character code and displays it.
Since control codes are not handled, all characters in WonderWitch's character generator can be displayed.
The delimiter "; does nothing. ,, Advances the cursor to the tab stop position.
The end of the print statement ends with; or, it does not break a line.
Example: print "calculation result =", chr (34); 1 + 2; chr (34)
locate expression, expression
Set the current cursor position on the WonderWitch text screen. The arguments are in the order of x and y.
Example: locate 10, 10
cls
Delete the WonderWitch text screen.
Example: cls
goto expression
Jump to the line number of the formula. Calculated goto statements are possible. That is, if you set goto A * 100, A will be on the 100th line when the A is on. If it is 2, it jumps to line 200.
Example: goto 100
gosub expression
Put the current position and local variable on the stack and jump to the line number of the expression. Calculated gosub is possible as well as goto.
The stack is up to 8 levels in combination with for.
Example: gosub 100
return
It retrieves the information gosub loaded on the stack and returns the processing to it. Also return local variables.
Example: return
for variable = expression to expression
for variable = expression to expression step expression
Repeat until next while varying the value of the variable.
If the value of the last variable does not match the closing price and the closing price + step value overflows, there is a possibility of an infinite loop. Please be careful not to specify such a value.
Example: for i = 0 to 10 step 2
next
Go back to the position of the for statement and repeat the operation. If the condition indicated in the for statement is satisfied, the operation proceeds next. Writing the variable name after next will result in an error.
Example: next
end
End program execution.
break
Temporarily suspend execution at that position. You can continue execution with the cont statement.
rem String
'String
Write a comment. You can not put a statement behind the statement:
Example: rem This is a test program.
Example: 'This expression calculates coordinates
new
Erases the program in memory.
list [line number] [-] [line number]
List programs with line numbers in the specified range. If omitted all the lines are listed.
run
run expression
run String
Execute the program. Prior to that, variables and stacks are cleared.
run is from the top of the program in memory. The run expression is from the line number of the expression. The run string reads a string file and executes it.
Example: run
Example: run 100
Example: run "test.wb"
cont
Execution resumes from the position stopped by a break statement or a break by the START button.
save String
Save the program in memory with the string as the file name. It is saved in text format, not internal representation.
Currently, due to restrictions of WonderWitch's file system, files exceeding 2 K bytes can not be saved. Please send the list to the terminal with the list command, COPY & PASTE it and save it.
Example: save "hello.wb"
load string
Load a program from a file with a string as a file name. It reads in text format, and line feed can be either CRLF or LF. If there are lines that can not be translated into an intermediate language, reading is interrupted there. Execution is interrupted when used during program execution.
Example: load "hello.wb"
merge string
Mix the program in the file with the program in the memory. The line with the same line number will be given priority when it is read. If there are lines that can not be translated into an intermediate language, reading is interrupted there. Execution is interrupted when used during program execution.
Example: load "merge.wb"
randomize expression
Specify the initial value of the random number. If you do not use this, random numbers will always occur in the same order. For the argument, it is best to specify the system variable tick.
Example: randomize tick
exit
I will go back to the OS by going through one page.
debug [string | expression | chr (expression)] [, |;] ... ...
It is equivalent to the print statement but sends it to the serial port instead of the WonderWitch screen. It is a function dedicated to debugging that can not be used when executing by itself.
waitvb expression
Wait for VBLANK for the number of expressions. While waiting, the START button break will not be accepted, so you can limit the value to 750. An error will occur if you specify a value greater than 750.
Example: waitvb 75
files
Send the file list of the current directory to the serial port. It is a function dedicated to debugging that can not be used when executing by itself.
play String
Play the argument string as MML. To enable it, see "How to activate the play statement".
Example: play "cde"
poke expression, expression
We regard the first expression as an offset, the second expression as a value, and write 1 byte of memory to the segment of the system variable defseg.
It does not work with the Win32 version.
Note: Since the segment of cseg is flash memory, it can not be written by poke.
call expression
Assume the expression as an offset and do a machine language level subroutine call (FAR) on the segment of the system variable defseg. Before calling, the system variables AX, BX, CX, DX, SI, DI, DS, ES are set in their respective registers. The register state after return is saved in the system variables AX, BX, CX, DX, SI, DI, ES. (Note: DS will not return)
It does not work with the Win32 version.
int expression
We regard the expression as an interrupt number and perform a system interrupt (int) at machine language level. You can call WonderWitch's BIOS. Before calling, the system variables AX, BX, CX, DX, SI, DI, DS, ES are set in their respective registers. The register state after return is saved in the system variables AX, BX, CX, DX, SI, DI, ES. (Note: DS will not return)
It does not work with the Win32 version.
tron
Turn on trace mode. When entering trace mode, each time you start executing a new line, it sends the line number to the debug console.
troff
Turn off trace mode.
colormode expression
Set the color mode. Can be used only with WonderSwan Color.
The values ??of the expressions are as follows.
0x00 monochrome mode
0x80 4 color mode
0xC0 16 color mode (It can be set but it can not be drawn from the function of the one side)
0xE0 16 color PACKED mode (It can be set but it can not be drawn from the function of the one side)
It does not work with the Win32 version.
color expression, expression
Specify the color of the character to be drawn. The first expression is the index of the foreground color, and the second expression is the index of the background color. Only 0 to 3 can be specified, respectively.
The initial state at the start of execution is the state corresponding to color 3,0.
It does not work with the Win32 version.
palette expression, expression, expression, expression
Specify the palette. Specify the index (0 to 3) of the palette set by the first expression. The second to fourth expressions indicate the values ??of R, G, B respectively. The values ??of R, G, and B are each in the range of 0 to 15.
It does not work with the Win32 version.
Example: palette 0, 15, 0, 0
● Binary operator
+ - * / <> = <=> = <> and or xor
● Unary operator
not
● Function
rnd (expression)
Returns a random number in the range from 0 to expression -1.
abs (expression)
Returns the absolute value of an expression.
varptr (variable)
Returns the offset of the specified variable.
It does not work with the Win32 version.
varseg (variable)
Returns the segment of the specified variable.
It does not work with the Win32 version.
peek (expression)
We regard the expression as an offset and read 1 byte of memory from the segment of the system variable defseg.
It does not work with the Win32 version.
● System variables (readable and writable)
ax, bx, cx, dx, si, di, ds, es
It is used to specify the register value when call and int statements are used and to save the value of the register after return.
defseg
It holds segment value used in peek function, poke, call statement. The initial value is the value of dseg.
● System variables (read only)
scan
It examines the state of WonderSwan's button and returns it as one integer value. You can determine which button is pressed by taking a system variable beginning with SCAN_ and and. Since the START button is suspended, this can not be handled.
wait
Wait until the button of WonderSwan is pressed and return its state as one integer value. By taking the system variable beginning with SCAN_ and and, you can determine which button was pressed. Since the START button is suspended, this can not be handled.
scan_a
scan_b
scan_x1
scan_x2
scan_x 3
scan_x 4
scan_y1
scan_y 2
scan_y 3
scan_y 4
Returns a constant indicating the mask value of each button.
To check whether the A button is pressed, write it as in the example below.
Example: if scan and scna_a then print "A button is pressed"
tick
Returns the system timer tick. However, it is important to note that the original tick value is an unsigned 32 bit integer, and that obtained here is a 16 bit signed integer. The overflowing bits are thrown away.
dseg
Returns the value of the DS segment register being executed. Variables and intermediate language code of the program are all in this segment.
It does not work with the Win32 version.
cseg
Returns the value of the CS segment register being executed. One program's main program is in this segment.
It does not work with the Win32 version.
sseg
Returns the value of the running SS segment register. There is a machine language stack in this segment.
It does not work with the Win32 version.
hardarch
Returns whether or not WonderSwan currently running is a Color model. 0 for monochrome WonderSwan. WonderSwan Color will be 1.
It does not work with the Win32 version.
● File extension
Please make sure that the source fillet of one bee is a file name ending with ". Wb". You can load with commands such as load regardless of the extension, but only the filename that ends with ".wb" is displayed in the entrance menu.
● How to activate the play statement
Transfer sound.il to / rom0. Without this file, no sound will be emitted even if you use the play statement. If there is no sound.il, the sound is not produced, and the program is executed.
In the Win32 version, you can play MML using dsakura.dll included in "text music" Sakura "by whale flying machine.This software is available from http://www.text2music.com/ You can put dsakura.dll anywhere you go through the environment variable path.The only file you need is this DLL.If you do not have dsakura.dll, the program will just run with no sounds However, please note that the specification of MML is not exactly the same.In Win32 version, a file called $$$. Mid is generated in the current directory when the play statement is executed.Delete it after the execution does not matter.
Distribution rules
From this version, we assume that this software follows the GNU General Public License (GPL). Details are at http://www.gnu.org/.
In short, anyone can use it for any purpose. However, you should not sell this software. In addition, source code must be released. It is possible to record it in the product, but you should not prevent the user from freely copying and distributing this software.
As of December 2000, the source code is managed by PD Kawamata Akira (autumn@piedey.co.jp). If you feed back useful source code fixes, it will be reflected in this source tree.
Digression
My name is Mr. Kawamata made by gratitude and discretion for the 20th century. In other words, for me, the incident that I encountered a microcomputer / personal computer was the biggest event of the 20th century, and the very small interpreter languages ??Tiny BASIC, VTL, GAME, TL / 1 played a big role there, have a big impression I left it inside of me. And, at that time, I also wanted to make programming languages ??by themselves, and it was also true that I worked hard. After all, I developed several toy languages. I also made a practical language if necessary. When porting TOKYO Nanpa Street of ENIX from FM - 7 to PC - 8801, I also made an integer type compact interpreter to increase memory efficiency. However, with the assembler development system AZAS of my own Z-80 which finally contained the odor of structured assembler finely, the world of my own language came to the terminal station. Clearly, at this point there was no point in developing a language like Tiny BASIC. Assembler level development was indispensable to obtain the necessary performance. I could make it, but I had no meaning to make. And, as I moved to the era of 16 bit era, I stopped using my own language and started to use a pretty good existing processing system. MASM 1.27 ~, Turbo Pascal 3.0, Turbo C 1.5 ~ 2.0, MS - C 6.0 ~, Visual BASIC 1.0 ~, JDK 1.02 ~ etc etc etc. However, when I look back at the end of the 20th century, I remembered that simple Tiny BASIC that I admired in a boyhood when I do not know right or left. That's why I made it with the feeling that this is the 20th century for me.
That is why there are certain generations. To make games with BASIC, there seem to be generations such as MSX and Baumaga, but clearly speaking, I think that one generation can not understand this generation. BASIC on MSX is an ultra-high-performance huge BASIC, and the generation is completely different from Tiny BASIC. Even in generations back to PC - 8801 and FM - 7, you will not know yet. After all, in order to understand this, before the PC is called a personal computer, it is called a microcomputer, it is necessary to go back to the era when the board was sold in a bare state without fitting in the case. In other words, in such a period, what you sacrifice for a romantic era when you try to gain something, a handmade element enters and it is said to be this one. And, as a foundation suitable for reproducing that romance, I think that a product named WonderWitch appeared in this era also is a mysterious edge.
So, there is one thing I would like to say to a user. Share this romance. In other words, if you do not like it, remodel it quickly. In order to guarantee that it can be used by remodeling freely as you like, the source is GPL.
● Included one-page program
▼ Demo
colordemo.wb
Demo of color function (only for WonderSwanColor)
▼ Game
ctb.wb
Fall game
janken.wb
Janken game
shoot.wb
shooting game
star.wb
STAR TREK-like game "STAR WITCH" (see bundled star.txt)
Please refer to how to write the program
▼ Test
test.wb
Simple interpreter operation test
testcall.wb
Testing the operation of the call statement
testcont.wb
Testing the behavior of the cont statement
testfor.wb
Test operation of for statement
testgosub.wb
Testing the operation of the gosub statement
testif.wb
Operation test of if statement
testint.wb
Testing the operation of int statements
testlocate.wb
Testing the operation of the locate statement
testlongloop.wb
Test of interruption by START key
testpeekpoke.wb
peek function test poke statement
● Change history
January 29, 2001 Ver 0.06
・ Transfer to WonderSwan Color development kit
・ Add colormode, palette, color statement, hardarch system variable
・ Add a digression to the document
December 10, 2000 Ver 0.05
・ 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)
November 12, 2000 Ver 0.04
・ When trying to delete a line number including 0x0d such as 13, the program took a broken bug
・ Change processing system from Turbo C2.0 to Visual C ++ 1.51
・ Significantly improved loading speed
・ Only the .wb entrance menu is displayed
・ Sample game STAR WITCH (star.wb, star.txt) attached
November 7, 2000 Ver 0.03
・ Operator precedence order Unary operator> * /> + -> Comparison operator> and, or, xor
・ Change the value when the comparison operator is established from 1 to -1
・ Change prompt to OK
- Fixed a bug that negative numbers were output as positive numbers by print / debug
・ Changed so that loop can escape in next even if for closing price does not match exactly
November 7, 2000 Ver 0.02 scan_XX took a bug that does not work
November 6, 2000 Ver 0.01 First version
● Contact Information
Paiday Co., Ltd. http://www.piedey.co.jp/
Kawamata Akira autumn@piedey.co.jp
that's all

11
colordemo.wb Normal file
View File

@ -0,0 +1,11 @@
100 rem draw random characters
110 if hardarch = 0 then print "Try in WonerSwanColor":a=wait:end
120 colormode 128
200 for i=0 to 1000
300 locate rnd(28), rnd(17):color rnd(4), rnd(4):print chr(rnd(256));
400 next
450 locate 0,0:color 3,0:print "Push START to exit...."
500 rem palette random
600 palette rnd(4), rnd(16), rnd(16), rnd(16)
700 waitvb 30
800 goto 500

290
ctb.wb Normal file
View File

@ -0,0 +1,290 @@
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

95
janken.wb Normal file
View File

@ -0,0 +1,95 @@
100 rem じゃんけんゲーム for ワンべぇ
110 rem Nov.6,2000 by autumn
200 T=40 'waitvbする長さ
900 randomize tick
1000 cls
1010 print " ■  ■              ■"
1020 print " ■ ■ ■             ■"
1030 print " ■  ■              ■"
1040 print " ■  ■■   ■ ■■     ■"
1050 print " ■       ■ ■      ■"
1060 print " ■       ■ ■■■    ■"
1070 print " ■       ■■   ■  ■ ■  ■"
1080 print " ■      ■■    ■  ■■■   ■"
1090 print " ■      ■■    ■  ■ ■   ■"
1100 print " ■    ■   ■ ■■  ■  ■   ■"
1110 print " ■    ■   ■■■   ■   ■ ■■"
1120 print " ■   ■■   ■     ■   ■ ■"
1130 print " ■■■■■    ■    ■    ■■■"
1140 print "   ■■      ■        ■"
1200 waitvb T
2000 cls
2010 print "       ■        ■"
2020 print "  ■    ■        ■"
2030 print "  ■    ■       ■"
2040 print " ■■    ■       ■"
2050 print " ■  ■■■■■■■    ■"
2060 print " ■  ■■■■      ■"
2070 print " ■     ■      ■■■   ■"
2080 print " ■     ■     ■■■■    ■"
2090 print " ■     ■     ■  ■    ■"
2100 print " ■     ■     ■  ■■  ■"
2110 print " ■     ■    ■    ■  ■"
2120 print "  ■    ■    ■    ■ ■■"
2130 print " ■    ■■    ■    ■■■"
2140 print "      ■           ■"
2200 waitvb T
3000 a=rnd(3)
3010 goto 4000+(a*1000)
4000 cls
4010 print "              ■"
4020 print "      ■ ■     ■■■■■■"
4030 print "     ■■  ■      ■■■■"
4040 print "    ■■ ■  ■"
4050 print "   ■■   ■"
4060 print "   ■     ■     ■■■■■"
4070 print "  ■          ■■■■■■■"
4080 print " ■■          ■     ■■"
4090 print " ■■                ■■"
4100 print "  ■■               ■■"
4110 print "   ■■              ■■"
4120 print "    ■              ■"
4130 print "    ■■            ■■"
4140 print "     ■■         ■■■"
4150 print "      ■■       ■■■"
4160 print "               ■"
4200 goto 7000
5000 cls
5010 print "                 ■"
5020 print "  ■              ■"
5030 print " ■               ■  ■"
5040 print " ■ ■■          ■■■■■■"
5050 print "■■■■■     ■    ■■ ■"
5060 print " ■        ■       ■ ■■"
5070 print " ■        ■    ■■■■■■"
5080 print " ■        ■■■  ■■  ■"
5090 print " ■■■■■    ■        ■"
5100 print " ■■  ■    ■     ■■■■■"
5110 print "■■    ■   ■    ■■   ■"
5120 print "■     ■ ■■■■   ■"
5130 print "     ■  ■ ■■■  ■"
5140 print "   ■■■  ■ ■  ■ ■■"
5150 print "  ■■■   ■■      ■■■■"
5160 print "                 ■■■"
5200 goto 7000
6000 cls
6010 print "         ■■■    ■"
6020 print " ■     ■■■ ■    ■"
6030 print "  ■    ■ ■ ■    ■"
6040 print "  ■     ■ ■  ■■■■■■■"
6050 print "  ■ ■■■■■■■  ■■■    ■"
6060 print " ■■ ■■■■■      ■  ■"
6070 print " ■      ■      ■■■■■"
6080 print " ■      ■      ■■■■■■"
6090 print " ■      ■     ■■  ■  ■"
6100 print " ■      ■    ■■ ■ ■  ■"
6110 print " ■   ■■■■    ■  ■■   ■"
6120 print " ■  ■■  ■■   ■  ■■   ■"
6130 print " ■  ■   ■■■  ■  ■    ■"
6140 print " ■■  ■■■  ■  ■ ■■■  ■■"
6150 print "     ■■       ■■  ■■■"
6160 print "                  ■"
7000 locate 0,16:print " **PUSH START TO EXIT**";
7010 locate 0,17:print "**ANOTHER BUTTON TO AGAIN**";
7100 d=wait
7200 goto 1000

View File

@ -1,6 +1,8 @@
/* WONBE predefined keyword IDs */
/* First Created: Nov.3,2000 by Nashiko */
/* Copyright 2000 (c) by Pie Dey Co.,Ltd. */
/* First Created: Nov.3,2000 by Pie Dey Co.,Ltd. */
/* This source code is distributed under GNU General Public License (GPL) */
/* see http://www.gnu.org/ about GPL */
#define KEYWORD_IF 0x80
#define KEYWORD_PRINT 0x81
@ -26,15 +28,33 @@
#define KEYWORD_DEBUG 0x95
#define KEYWORD_WAITVB 0x96
#define KEYWORD_FILES 0x97
#define KEYWORD_AND 0xa0
#define KEYWORD_OR 0xa1
#define KEYWORD_XOR 0xa2
#define KEYWORD_NOT 0xb0
#define KEYWORD_PLAY 0x98
#define KEYWORD_POKE 0x99
#define KEYWORD_CALL 0x9a
#define KEYWORD_INT 0x9b
#define KEYWORD_TRON 0x9c
#define KEYWORD_TROFF 0x9d
#define KEYWORD_COLORMODE 0x9e
#define KEYWORD_PALETTE 0x9f
#define KEYWORD_COLOR 0xa0
#define KEYWORD_AND 0xb0
#define KEYWORD_OR 0xb1
#define KEYWORD_XOR 0xb2
#define KEYWORD_NOT 0xb8
#define KEYWORD_SCAN 0xc0
#define KEYWORD_WAIT 0xc1
#define KEYWORD_RND 0xc2
#define KEYWORD_ABS 0xc3
#define KEYWORD_TICK 0xc4
#define KEYWORD_VARPTR 0xc5
#define KEYWORD_VARSEG 0xc6
#define KEYWORD_DSEG 0xc7
#define KEYWORD_CSEG 0xc8
#define KEYWORD_SSEG 0xc9
#define KEYWORD_PEEK 0xca
#define KEYWORD_SCAN_A 0xd0
#define KEYWORD_SCAN_B 0xd1
#define KEYWORD_SCAN_X1 0xd2
@ -45,15 +65,60 @@
#define KEYWORD_SCAN_Y2 0xd7
#define KEYWORD_SCAN_Y3 0xd8
#define KEYWORD_SCAN_Y4 0xd9
#define KEYWORD_HARDARCH 0xda
#define KEYWORD_AX 0xe0
#define KEYWORD_BX 0xe1
#define KEYWORD_CX 0xe2
#define KEYWORD_DX 0xe3
#define KEYWORD_SI 0xe4
#define KEYWORD_DI 0xe5
#define KEYWORD_DS 0xe6
#define KEYWORD_ES 0xe7
#define KEYWORD_DEFSEG 0xe8
#define KEYWORD_THEN 0xf0
#define KEYWORD_CHR 0xf1
#define KEYWORD_TO 0xf2
#define KEYWORD_STEP 0xf3
#define KEYWORDS_STATEMENT_FROM 0x80
#define KEYWORDS_STATEMENT_TO 0x97
#define KEYWORDS_2OP_FROM 0xa0
#define KEYWORDS_2OP_TO 0xa2
#define KEYWORDS_STATEMENT_TO 0xa0
#define KEYWORDS_2OP_FROM 0xb0
#define KEYWORDS_2OP_TO 0xb2
/*
WONBE
 1
 0x00 0x00
 1
WORD (1-32767)
WORD
BYTE 0x0d
 0x010x030x0d
0x00 ()
0x01 102
0x02 162
0x03 0x00
0x09 TAB
0x0d
0x200x2f
0x300x39 ?
0x3a0x3f
0x40 @
0x410x5a AZ
0x5b0x60 ?
0x610x7A az
0x7b0x7f ?
0x800xff
*/
/* end of keywords.h */

View File

@ -1,23 +1,34 @@
INCLUDE=C:\vshare\ww\dev\WWitch\include
LIB=..\COMMON
# start up routine
C0WW_JAPANESE2=..\common\c0wwjpn2.obj
LIBS=libww.lib libwwc.lib runtime.lib
C0WW=$(C0WW_JAPANESE2)
LINKER=..\..\vc15\bin\link
CC=..\..\vc15\bin\cl
ASM=..\..\vc15\bin\masm
LIBWW=@..\common\libww.rsp
CFLAGS=-DWW -ms -zPCGROUP -zSDGROUP -zGDGROUP
CFLAGS=/ASw /O /Gs /DWW /DVC15
AFLAGS=-Mx -DDISPLAY_MODE_JAPANESE1
LFLAGS=/NOD /NOI /MAP
all: wonbe.fx
wonbe.fx: wonbe.bin
mkfent wonbe.cf
wonbe.bin: wonbe.obj
tlink /m /c $(C0WW) wonbe, wonbe, wonbe, $(LIBWW)
exe2fbin wonbe.exe wonbe.bin
wonbe.bin: wonbe.obj vc15_rt.obj
$(LINKER) @<<
$(LFLAGS) vc15_rt.obj wonbe.obj,wonbe.sss,wonbe.map,$(LIBS);
<<
echo 0000 >0000.sss
exe2bin wonbe.sss wonbe.bin <0000.sss
echo remove temp file
del 0000.sss
del wonbe.sss
wonbe.obj: wonbe.c
tcc -c $(CFLAGS) $(DEFINES) -IC:\vshare\ww\dev\WWitch\include wonbe.c
$(CC) -c $(CFLAGS) wonbe.c
vc15_rt.obj: vc15_rt.asm
$(ASM) $(AFLAGS) vc15_rt.asm;

23
makefile.tc Normal file
View File

@ -0,0 +1,23 @@
# start up routine
C0WW_JAPANESE2=..\common\c0wwjpn2.obj
C0WW=$(C0WW_JAPANESE2)
LIBWW=@..\common\libww.rsp
CFLAGS=-DWW -ms -zPCGROUP -zSDGROUP -zGDGROUP
all: wonbe.fx
wonbe.fx: wonbe.bin
mkfent wonbe.cf
wonbe.bin: wonbe.obj
tlink /m /c $(C0WW) wonbe, wonbe, wonbe, $(LIBWW)
exe2fbin wonbe.exe wonbe.bin
wonbe.obj: wonbe.c
tcc -c $(CFLAGS) $(DEFINES) -IC:\vshare\ww\dev\WWitch\include wonbe.c

78
shoot.wb Normal file
View File

@ -0,0 +1,78 @@
1000 rem シューティング by ワンべぇ
1005 rem Nov.7,2000 by autumn
1010 rem a,b 自機座標
1020 rem c,d 自ミサイル座標
1030 rem e,f 敵座標
1040 rem @(n*2*0),@(n*2+1) 敵ミサイル座標(nは07)
1050 rem g ミサイル生成カウンタ
1060 rem h ミサイル生成タイミングカウンタ
2000 rem 座標の初期化
2010 a=14:b=16
2020 c=-1:d=-1
2030 e=15:f=2
2040 for i=0 to 7:@(i*2)=-1:@(i*2+1)=-1:next
2050 g=0:h=0
3000 rem 開始を待つ
3010 cls
3020 locate 3,6:print "PUSH BUTTON TO START"
3030 locate 3,10:print " (NOT START BUTTON)"
3040 z=wait
3050 cls:locate 10,8:print "GO!";
3060 waitvb 30
4000 rem 表示を更新
4010 cls
4020 locate a,b:print "▲";
4030 locate e,f:print "▼";
4040 if c>=0 then locate c,d:print "|";
4050 for i=0 to 7
4060 if @(i*2)>=0 then locate @(i*2),@(i*2+1):print "*"
4070 next
5000 rem 当たり判定
5010 if (c=e)and(d=f) then goto 8000 '自ミサイルが命中・勝利
5020 for i=0 to 7
5030 if (a=@(i*2))and(b=@(i*2+1)) then goto 9000 '敵ミサイルが命中・敗北
5040 next
6000 rem 敵移動処理
6010 r=rnd(2)
6020 if (r=0)and(e<26) then e=e+1
6030 if (r<>0)and(e>0) then e=e-1
6100 rem 敵ミサイル移動処理
6110 for i=0 to 7
6120 @(i*2+1)=@(i*2+1)+1
6130 if @(i*2+1)>16 then @(i*2)=-1:@(i*2+1)=-1
6140 next
6200 rem 敵ミサイル生成処理
6210 h=h+1
6220 if h>3 then h=0
6230 if h<>0 then goto 6300
6240 @(g*2)=e:@(g*2+1)=f+1 '新しいミサイル
6250 g=g+1:if g>7 then g=0
6300 rem 自機移動処理
6310 s=scan
6320 if s and scan_x2 then if a<26 then a=a+1
6330 if s and scan_x4 then if a>0 then a=a-1
6400 rem 自ミサイル移動処理
6410 if c>=0 then d=d-1:if d<0 then c=-1:d=-1
6500 rem 自ミサイル発射処理
6510 if s and scan_a then if c<0 then c=a:d=b-1
6800 waitvb 3
6900 goto 4000
8000 rem 勝利
8010 X=e:Y=f:gosub 10000
8020 locate 10,10:print "YOU WIN!"
8030 goto 9500
9000 rem 敗北
9010 X=a:Y=b:gosub 10000
9020 locate 10,10:print "YOU LOSE..."
9500 locate 0,12:print "PUSH START BUTTON TO EXIT"
9510 locate 0,13:print " ANOTHER IS AGAIN"
9520 z=wait
9900 goto 2000
10000 rem 爆発表現
10010 for i=0 to 9
10020 locate X,Y:print "+";
10030 waitvb 10
10040 locate X,Y:print "×";
10050 waitvb 10
10060 next
10090 return

133
star.txt Normal file
View File

@ -0,0 +1,133 @@
STAR WITCH ~ゴブリン帝国の野望~
★★★ 準備 ★★★
 WonderSwan本体とWonderWitchを用意してください。
 wonbe.fxとstar.wbをWonderWitchに転送してください。
 Freya OSから「ワンべぇ」を選んでスタートさせてください。
 star.wbを選択してAボタンを押してください。
 読み込みが完了するまでしばらく待ちます。
★★★ 目的 ★★★
 プレイヤーは、最強の宇宙戦艦WITCH号の艦長となって、ゴブリン帝国の宇宙戦艦を撃滅します。
 宇宙空間はエリアと呼ばれる単位で区切られています。
 一つのエリアに侵入したゴブリン戦艦をすべて撃滅すると、次のエリアに進むことができます。
 10個のエリアからゴブリン戦艦を駆逐すると、プレイヤーの勝利となります。
 逆に、戦闘途上で、WITCH号のエネルギー量がゼロになると、プレイヤーの敗北となります。
★★★ シンボル ★★★
 エリアマップ上では以下のシンボルで表示されます。
WITCH号 Wマーク
ゴブリン戦艦 Gマーク
輸送船 Tマーク
小惑星 *マーク
★★★ 基本操作 ★★★
 Aボタンで確定
 Bボタンでキャンセル
 X14ボタンで上下左右
 Win32版のワンべぇでプレイする場合は以下のようになります。
 スペースバーで確定
 ESCキーでキャンセル
 方向キーで上下左右
★★★ 移動 ★★★
 WITCH号には、エリア間を移動する「ジャンプ」の機能と、エリア内を移動する「バーニア」の機能があります。「ジャンプ」は、エリア内のすべてのゴブリン戦艦を撃沈しない限り使用できません。「バーニア」はいつでも使用できます。
 エリアは8×8の升目に区切られています。バーニアで移動中にこれから入ろうとする升目に小惑星や敵艦がいると、そこで緊急停止させられます。
 「ジャンプ」する場合には、ジャンプ先の候補が3つ提示されますので、戦略をよく考えて選択します。
 「バーニア」を使う場合は、方向と距離を数字で指定します。方向は0から360までの角度で指定します。右が0、上が90、左が180、下が270になります。5度単位で微妙な数値を指定することができます。距離は実際に動く升目の数を指定します。
★★★ 戦闘 ★★★
 ゴブリン戦艦のいるエリアにWITCH号が入ると、ゴブリン戦艦は情け容赦なく攻撃を加えてきます。
 ゴブリン戦艦の使用する武器は、指向性ウェーブ兵器です。これは、自艦の持つエネルギーを発射して、発射したのと同じ量だけWITCH号にダメージを与える兵器です。
 これに対して、WITCH号が使用できる武器は2種類あります。
 一つはウェーブキヤンと呼ばれる無指向性ウェーブ兵器です。これは、1回の攻撃で、エリア全体を攻撃できる広域兵器です。しかし、敵艦以外にもエネルギーが収束してしまうという欠点があります。たとえば、ゴブリン戦艦が2隻、小惑星が3個、輸送船が1隻いるとします。ここで、600のエネルギーをウェーブキヤンで発射すると、それぞれの標的にエネルギーが均等に分かれ、ゴブリン戦艦はそれぞれ100のダメージを受けます。ウェーブキヤンで使用した分のエネルギーは、WITCH号のエネルギーから差し引かれますので、敵の攻撃を受け止めたり、移動するためのエネルギーは残しておかねばなりません。
 ゴブリン戦艦は、艦内のエネルギーがゼロになると防御シールドが消えて破壊できます。ウェーブキヤノンで小惑星を破壊することはできません。輸送船はウェーブ吸収装置が取り付けられているので、ウェーブキヤノンでダメージを受けることはありません。
 もう一つの武器は、反応弾頭ミサイルです。これは、一度に1発しか発射できませんが、ゴブリン戦艦を一撃で確実にしとめることができる強力兵器です。また、小惑星や、輸送船も破壊することができます。ミサイルを発射するにあたってエネルギーは消費しません。WITCH号は最大で10発までこのミサイルを搭載することができます。ミサイルを発射する場合には、発射する方向を指定します。指定方法は「バーニア」による移動と同じです。
★★★ 補給 ★★★
 輸送船と上下左右の4カ所のいずれかで隣接すると、輸送船よりエネルギーとミサイルの補給を受けることができます。隣接し続ける限り、毎ターンの最初にエネルギーとミサイルが満タンになります。
 輸送船はステルス機能があるため、ゴブリン戦艦の攻撃を受けることはありませんが、そのかわり、一切の攻撃兵器を持っておらず、戦闘の手助けはできません。
★★★ ステータス値 ★★★
 上部左右中央部に表示される数値の意味は以下の通りです。
ENERGY WITCH号の残りエネルギー量
MISSILE WITCH号の残りミサイル数
LEFT あとクリアすべきエリアの数
DAY 経過日数
★★★ 目指せ名艦長 ★★★
 このゲームでは、ただ単に勝利するだけなら難しくありません。
 クリア最短日数や、最多敵艦撃破などの条件を設定して、トライしてください。
★★★ 攻略のヒント ★★★
・輸送船とランデブーして大逆転
 輸送船と接触すれば、事実上エネルギーもミサイルも使い放題です。使っても次のターンの開始時に回復されるので、どーんとウェーブキヤノンで大量のエネルギーを叩き付けてゴブリン戦艦を全滅させてしまいましょう。
・ウェーブキヤノンとミサイルどちらが得か?
 ミサイルは1隻ずつしか攻撃できませんが、ウェーブキヤンはすべての敵を同時攻撃できます。敵に囲まれたときに、少ないダメージで敵を倒すには、一見、ウェーブキヤンが有利に見えます。しかし、ウェーブキヤンは敵以外にもエネルギーを消費してしまうという弱点があるため、エネルギーの無駄遣いになりがちです。
 もし、ウェーブキヤノンで敵を仕留める場合は、敵にどんどん攻撃させ、敵艦のエネルギーが底をついたところで、少量のエネルギーでウェーブキヤノンを使うと無駄が少なくて済みます。
 しかし、何と言ってもエネルギーを使わないで敵を仕留めるミサイルを使うのが最もエネルギーの効率が良いのは言うまでもありません。エリアマップから正しい発射角度を瞬時に判断できるようになってこそ、名艦長と言えるでしょう。
・ウェーブキヤノンとミサイルの使い分けの判断は?
 ミサイルで1隻ずつ沈めるのが基本です。ウェーブキヤンを使うのは例外的な状況と考えるべきです。以下が代表的な状況です。
 →輸送船とランデブーしているとき
 →補給直後でエネルギーがたっぷりあるとき
 →小惑星などが邪魔をしてミサイル攻撃しにくいとき
 →小惑星などが少なく、効率よくエネルギーを敵に叩き込めるとき
 →ミサイルの残りがゼロのとき
 →敵の残りエネルギーが極めて少ないとき
・輸送船を破壊するな
 ミサイルの方向を間違えて輸送船に命中してしまうと、ペナルティとして、輸送船の乗組員の救助のために10日間の日数が加算されます。最短日数クリアを目指す場合は、注意してください。
・常に輸送船のいるエリアを目指すべきか?
 エネルギーが満タンであれば、そう簡単にやられることはありません。輸送船がいるエリアよりも敵が多いエリアを選んでジャンプしましょう。最多敵艦撃破を目指す場合は、残りエネルギーが十分かどうか特に注意して判断しましょう。
・小惑星はただの飾りか?
 小惑星の多い少ないは、戦い方に大きな影響を及ぼします。小惑星が多いと、いろいろな問題が起きます。
 →輸送船とランデブーする邪魔になる
 →ミサイル攻撃の邪魔になる
 →ウェーブキヤノンのエネルギーに無駄が増える
 ですので、他の条件が同じであれば、小惑星の少ないエリアにジャンプする方が有利と言えます。
・小惑星を破壊せよ
 輸送船とランデブーしたいのに小惑星が邪魔だ、というときは、ミサイルで小惑星を破壊してしまいましょう。2回に分けて迂回して移動すると日数が余計に掛かります。最短日数クリアを目指す場合は、注意してください。
・ゴブリン戦艦残りエネルギー量を正確に知りたいとき
 ウェーブキヤノンで攻撃すると、ゴブリン戦艦に与えたダメージの他に、各艦の残りエネルギー量も表示されます。少ないエネルギー量で軽くウェーブキヤノンで攻撃してみると良いでしょう。
・ゴブリン戦艦の戦術
 ゴブリン戦艦は敵を発見すると、ひたすら指向性ウェーブ兵器で攻撃を繰り返します。その際、自艦の持つエネルギーのうち、どの程度のエネルギー量を叩き付けてくるかは一定しません。また、最初にどの程度のエネルギー量を持っているかも一定しません。だいたい初期エネルギー量は500前後で、1回の攻撃では所持エネルギーの半分程度で攻撃してきますが、それは平均値でしかありません。
 しかし、エネルギーがゼロに近づいた場合には、艦の自滅を回避するために攻撃を取りやめます。存在するのに攻撃を仕掛けてこないゴブリン戦艦がある場合は、エネルギーがゼロに近いので、わずかなエネルギーをウェーブキヤノンで叩き付けるだけで撃沈できます。
 ゴブリン戦艦は命じられた場所を文字通り死守するので、戦闘中に移動することはありません。

501
star.wb Normal file
View File

@ -0,0 +1,501 @@
cls:print"  "
locate 10,10:print "○○○○";
100 cls:gosub 17000 'オープニング
1000 cls
1010 print "┏━━━━━━━━━┳━━━━━━━┳━━━━━━━━┓";
1020 print "┃ 12345678┃       ┃        ┃";
1030 print "┃1        ┃ENERGY ┃   ジャンプ ┃";
1040 print "┃2        ┃       ┃        ┃";
1050 print "┃3        ┃MISSILE┃   バーニア ┃";
1060 print "┃4        ┃       ┃        ┃";
1070 print "┃5        ┃LEFT   ┃   ウェーブ ┃";
1080 print "┃6        ┃       ┃        ┃";
1090 print "┃7        ┃DAY    ┃   ミサイル ┃";
1100 print "┃8        ┃       ┃        ┃";
1110 print "┣━━━━━━━━━┻━━━━━━━┻━━━━━━━━┫";
1120 print "┃                          ┃";
1130 print "┃                          ┃";
1140 print "┃                          ┃";
1150 print "┃                          ┃";
1160 print "┃                          ┃";
1170 print "┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
1175 print "   STAR WITCH ~ゴブリン帝国の野望~";
1180 rem 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7
1190 rem
2000 rem 初期化
2005 randomize tick
2010 E=4000 'EはWITCH号のエネルギー
2020 M=10 'MはWITCH号の所持ミサイル
2030 L=10 'Lはクリアすべきエリアの残り数
2040 D=1 'Dは現在の日数 (1アクション1日)
2042 S=0 'WITCH号のX位置
2044 T=0 'WITCH号のY位置
2050 A=0 '@(A)@A(A+8*8-1)までが現在エリアの内容
2060 '0:なし -1:小惑星 -2:輸送船
2061 '正数はゴブリン戦艦でエネルギー量
2065 W=A+8*8 'ワークエリアに使って良い配列の先頭位置
2070 B=0 'エリア作成時の輸送船の数
2080 G=0 'エリア作成時のゴブリン戦艦の数
2090 S=1+rnd(4) 'エリア作成時の小惑星の数
2095 H=0 '通算の撃破ゴブリン戦艦数
2100 P=11 'メッセージエリアのY位置 (良く参照されるので変数に置く)
2200 rem エリア進入
2210 gosub 10000
3000 rem ターン開始
3010 gosub 25000 'ステータス更新
3020 gosub 12000 '補給チェックと実行
3030 gosub 11000 '敵の攻撃
3100 rem コマンド選択
3105 gosub 20000:locate 2,P+2:print "艦長、ご指示を";
3110 c=0
3120 locate 20, 2+(c*2):print "→";
3200 s=wait
3205 locate 20, 2+(c*2):print " ";
3210 if s and scan_a then goto 4000+(c*1000)
3220 if s and scan_x1 then c=c-1:if c<0 then c=3
3230 if s and scan_x3 then c=c+1:if c>3 then c=0
3290 goto 3120
4000 '*******ジャンプ*******
4010 f=0
4020 for y=0 to 7:for x=0 to 7
4030 if @(A+x+y*8) > 0 then f=f+1
4040 next:next
4050 if f=0 then goto 4200
4060 gosub 20000
4070 locate 2,P+1:print "艦長!";
4080 locate 2,P+3:print "ゴブリン戦艦がまだ";f;"隻もいます!"
4090 d=wait
4100 gosub 20000
4110 goto 3100
4200 ' 行き先候補
4210 gosub 20000
4215 locate 2,P:print "目的地を指示してください"
4220 for i=0 to 2
4230 @(W+i*3)=1+rnd(5) 'ゴブリン戦艦15隻
4240 @(W+i*3+1)=0:if rnd(3)=0 then @(W+i*3+1)=1 '輸送船は1/3の確率
4250 @(W+i*3+2)=1+rnd(4) '小惑星15個
4260 locate 4,P+1+i
4270 print "ゴブリン";@(W+i*3);
4280 print " 輸送船";@(W+i*3+1);
4290 print " 小惑星"@(W+i*3+2);
4300 next
4400 rem 候補を選ぶ
4410 c=0
4420 locate 2, P+1+c:print "→";
4500 s=wait
4505 locate 2, P+1+c:print " ";
4510 if s and scan_a then goto 4600
4520 if s and scan_x1 then c=c-1:if c<0 then c=2
4530 if s and scan_x3 then c=c+1:if c>2 then c=0
4590 goto 4420
4600 ' 次のエリアに行く
4610 B=@(W+c*3+1)
4620 G=@(W+c*3)
4630 S=@(W+c*3+2)
4700 gosub 20000
4710 locate 2,P+1:print "ハイパースペース・ドライブ";
4720 locate 2,P+3:print "  スタンバイOK!"
4730 d=wait
4740 gosub 20000
4750 locate 2,P+2:print "次のエリアにジャンプします";
4760 d=wait
4780 gosub 20000
4785 for y=0 to 7:for x=0 to 7:locate 2+x,2+y:print "※";:next:next
4790 waitvb 75
4795 if E>10 then E=E-10:goto 4800
4796 locate 2,P+1:print "艦長! エネルギーが足りません!";
4797 locate 4,P+3:print "通常空間に復帰できません!!";
4798 d=wait:goto 19000
4800 locate 2,P+2:print "ジャンプ成功! レーダー動作します";
4810 d=wait
4820 gosub 20000
4890 D=D+1:L=L-1:goto 2200
locate 10,10:print "●○○○";
5000 '******バーニア*******
5010 gosub 20000
5020 locate 2,P+1:print "エリア内移動・スタンバイ";
5030 locate 2,P+3:print "コースは? (0-360)";
5040 X=21:Y=P:gosub 21000
5050 if Z<0 then goto 3100 'キャンセルされた
5060 if Z<=360 then s=Z:goto 5100
5070 gosub 20000
5080 locate 2,P+1:print "艦長!";
5090 locate 2,P+3:print "コースは0から360までです!";
5095 d=wait:goto 5010
5100 gosub 20000
5110 locate 2,P+1:print "エリア内移動・スタンバイ";
5120 locate 2,P+3:print "距離は? (1-12)";
5130 X=21:Y=P:gosub 21000
5140 if Z<0 then goto 5010 'キャンセルされた
5145 if Z>E+1 then goto 5190
5150 if Z>=1 and Z<=12 then l=Z:E=E-l:goto 5200
5155 gosub 20000
5160 locate 2,P+1:print "艦長!";
5170 locate 2,P+3:print "距離は1から12までです!";
5180 d=wait:goto 5100
5190 gosub 20000
5192 locate 2,P+1:print "艦長!";
5194 locate 2,P+3:print "エネルギーが足りません!";
5198 d=wait:goto 5100
5200 '移動アニメーション
5210 gosub 20000
5215 'locate 2+S,2+T:print " ";
5220 X=s:gosub 23000:a=Y
5230 X=s:gosub 22000:b=-Y '反時計回りにしたいのでマイナス
5235 c=S:d=T '最後に有効であった座標を持つ
5240 i=1:j=0 'iは本当の移動距離。jは見かけ上の移動距離
5250 x=S+a*i/100
5260 y=T+b*i/100
5261 'debug S,T,x,y,a,b,i,s
5262 if x<0 or x>7 or y<0 or y>7 then goto 5400
5264 if @(A+x+y*8)=0 then goto 5270
5266 gosub 20000:locate 2,P+2:print "衝突回避! 緊急停止!";d=wait
5268 goto 5400 'ループを強制終了させる
5270 if c=x and d=y then goto 5300 '見かけ上の移動が起きていない
5272 j=j+1
5275 locate 2+x,2+y:print "";
5280 locate 2+c,2+d:print " ";:c=x:d=y
6285 D=D+1:gosub 25000
5290 waitvb 75
5300 i=i+1:if j<l then goto 5250
5400 S=c:T=d
5410 locate 2+S,2+T:print "";
5500 goto 3000
6000 '*****ウェーブ*****
6010 gosub 20000
6020 locate 2,P+1:print "ウェーブキヤノン・スタンバイ";
6030 locate 2,P+3:print " エネルギー量は? (1-";E-1;")";
6040 X=21:Y=P:gosub 21000
6050 if Z<0 then goto 3100 'キャンセルされた
6060 if Z>=1 and Z<=E-1 then s=Z:goto 6100
6070 gosub 20000
6080 locate 2,P+1:print "艦長!";
6090 locate 2,P+3:print " エネルギー量は1から";E-1;"までです!";
6095 d=wait:goto 6010
6100 gosub 20000
6110 ' 存在するオブジェクト数を数える
6120 f=0
6130 for y=0 to 7:for x=0 to 7
6140 if @(A+x+y*8) <> 0 then f=f+1
6150 next:next
6160 e=s/f:if e<1 then e=1 'eは1標的あたりの攻撃量
6170 gosub 20000
6180 locate 2,P+2:print "ウェーブキヤノン・発射!";
6190 d=wait
6200 for y=0 to 7:for x=0 to 7
6210 if @(A+x+y*8) <= 0 then goto 6400
6220 gosub 20000
6230 locate 2,P+1:print "(";x+1;",";y+1;")のゴブリン戦艦にダメージ";e;
6240 @(A+x+y*8)=@(A+x+y*8)-e:if @(A+x+y*8)<=0 then @(A+x+y*8)=0:goto 6300
6245 locate 4,P+3:print "(残りエネルギー";@(A+x+y*8);")";
6250 d=wait
6290 goto 6400
6300 locate 4,P+3:print "ゴブリン戦艦、撃沈!";:H=H+1
6350 X=x:Y=y:gosub 24000 '爆発
6400 next:next
6900 E=E-s:
6910 if L=0 then gosub 26000:if Y=0 then goto 18000
6920 D=D+1:goto 3000
locate 10,10:print "●●○○";
7000 '******ミサイル******
7010 if M>0 then goto 7100
7020 gosub 20000
7030 locate 2,P+1:print "艦長!";
7040 locate 2,P+3:print "ミサイルの残弾はゼロです!";
7050 d=wait
7090 goto 3100
7100 gosub 20000
7110 locate 2,P+1:print "ミサイル・スタンバイ";
7120 locate 2,P+3:print "コースは? (0-360)";
7130 X=21:Y=P:gosub 21000
7140 if Z<0 then goto 3100 'キャンセルされた
7150 if Z<=360 then s=Z:goto 7200
7160 gosub 20000
7170 locate 2,P+1:print "艦長!";
7180 locate 2,P+3:print "コースは0から360までです!";
7190 d=wait:goto 7100
7200 '移動アニメーション
7205 M=M-1:gosub 25000
7210 gosub 20000
7220 X=s:gosub 23000:a=Y
7230 X=s:gosub 22000:b=-Y '反時計回りにしたいのでマイナス
7235 i=1
7240 c=S:d=T '最後に有効であった座標を持つ
7250 x=S+a*i/100
7260 y=T+b*i/100
7270 'debug S,T,x,y,a,b,i,s
7280 if x<0 or x>7 or y<0 or y>7 then goto 7500
7290 if @(A+x+y*8)<>0 then goto 7600
7320 if c=x and d=y then goto 7370 '見かけ上の移動が起きていない
7340 locate 2+x,2+y:print "";
7350 waitvb 75
7360 locate 2+x,2+y:print " ";:c=x:d=y
7370 i=i+1:goto 7250
7400 goto 3000
7500 'はずれ!
7510 gosub 20000
7515 locate 2,P+1:print "艦長!";
7520 locate 4,P+3:print "攻撃は失敗です!";
7530 d=wait
7590 D=D+1:goto 3000
7600 'あたり!
7610 gosub 20000
7620 locate 2,P+1:print "艦長!";
7630 locate 4,P+3
7640 if @(A+x+y*8)=-1 then print "小惑星に命中しました!";
7650 if @(A+x+y*8)=-2 then print "輸送船に命中しました!";
7660 if @(A+x+y*8)>0 then print "ゴブリン戦艦に命中しました!";
7670 X=x:Y=y:gosub 24000 '爆発
7680 'd=wait
7690 gosub 20000
7700 locate 4,P+2
7710 if @(A+x+y*8)=-1 then print "小惑星の消滅を確認!";
7720 if @(A+x+y*8)=-2 then print "輸送船乗組員の救助のため10日必要です";:D=D+1
7730 if @(A+x+y*8)>0 then print "ゴブリン戦艦を撃沈!";:H=H+1
7740 @(A+x+y*8)=0 'そこにはもう何もない
7750 d=wait
7760 if L=0 then gosub 26000:if Y=0 then goto 18000
7790 D=D+1:goto 3000
10000 rem エリア作成
10005 for y=0 to 7:for x=0 to 7:@(A+x+y*8)=0:next:next
10010 if B=0 then goto 10100
10020 for i=0 to B-1
10030 x=rnd(8):y=rnd(8)
10040 if @(A+x+y*8) <> 0 then goto 10030
10050 @(A+x+y*8)=-2
10060 next
10100 if G=0 then goto 10200
10105 for i=0 to G-1
10110 x=rnd(8):y=rnd(8)
10120 if @(A+x+y*8) <> 0 then goto 10110
10130 @(A+x+y*8)=400+rnd(200) 'ゴブリン戦艦のエネルギー初期値
10140 next
10200 for i=0 to S-1
10210 x=rnd(8):y=rnd(8)
10220 if @(A+x+y*8) <> 0 then goto 10210
10230 @(A+x+y*8)=-1
10240 next
10250 'WITCH号の位置を確定
10260 S=rnd(7):T=rnd(7)
10270 if @(A+S+T*8) <> 0 then goto 10260
10300 gosub 10500
10400 return
10500 'レーダー作動
10510 for y=0 to 7:for x=0 to 7
10520 locate x+2,y+2
10530 t=@(A+x+y*8)
10540 if t=0 then print " ";
10550 if t=-1 then print "";
10560 if t=-2 then print "";
10570 if t>0 then print "";
10580 next:next
10590 locate S+2,T+2:print "";
10600 return
11000 '*****敵の攻撃*****
11010 for y=0 to 7:for x=0 to 7
11020 if @(A+x+y*8) <= 2 then goto 11900
11025 n=@(A+x+y*8)/4+rnd(@(A+x+y*8)/2):if n<1 then 11900
11030 gosub 20000
11040 locate 2,P+1:print "(";x+1;",";y+1;")のゴブリン戦艦よりの攻撃!";
11050 d=wait
11070 locate 4,P+3:print "WITCH号に";n;"のダメージ!";
11075 @(A+x+y*8)=@(A+x+y*8)-n
11080 E=E-n:if E<0 then E=0
11090 gosub 25000
11100 d=wait
11110 if E>0 then goto 11900
11120 gosub 20000
11130 locate 2,P+1:print "艦長!";
11130 locate 4,P+3:print "エネルギーがもうありません!";
11140 gosub 20000
11150 locate 2,P+1:print "防御バリア機能停止";
11160 locate 4,P+3:print "WITCH号の船体が砕けます!";
11170 X=S:Y=T:gosub 24000 '爆発
11180 gosub 20000
11190 goto 19000 'BAD ENDING
11900 next:next
11910 return
locate 10,10:print "●●●○";
12000 '補給チェックと実行
12020 f=0
12030 if S>0 then if @(A+(S-1)+T*8)=-2 then f=1
12040 if S<7 then if @(A+(S+1)+T*8)=-2 then f=1
12050 if T>0 then if @(A+S+(T-1)*8)=-2 then f=1
12060 if T<7 then if @(A+S+(T+1)*8)=-2 then f=1
12070 if f=0 then return
12080 gosub 20000
12090 locate 2,P+1:print "艦長!";
12100 locate 4,P+3:print "輸送船から補給を受けます。";
12110 d=wait
12120 E=4000:M=10
12130 gosub 25000 'ステータス更新
12190 return
17000 'OPENING
17010 cls
17020 for i=0 to 1
17030 locate 2,2:print "緊急指令!"
17040 waitvb 30
17050 locate 2,2:print "     "
17060 waitvb 30
17070 next
17100 locate 2,2:print "緊急指令!"
17110 cls:print
17120 waitvb 30:print " かねてより":print
17130 waitvb 30:print " 我が地球連邦政府に敵対していた":print
17140 waitvb 30:print " 凶悪なゴブリン帝国が":print
17150 waitvb 30:print " 多数の宇宙戦艦で侵攻してきた":print
17155 print
17160 waitvb 30:print " 連邦艦隊ナンバーワン艦長の君に命じる":print
17170 waitvb 30:print " 最新鋭戦艦WITCH号を指揮し":print
17180 waitvb 30:print " 侵入したゴブリン戦艦を撃破せよ"
17190 d=wait
17200 cls
17210 for i=0 to 4
17220 if i=4 then locate 2, 2:print"  ■■■ ■■■■■  ■    ■■■■"
17230 if i=3 then locate 2, 3:print" ■      ■   ■ ■   ■   ■"
17240 if i=2 then locate 2, 4:print"  ■■■   ■   ■■■   ■■■■"
17250 if i=1 then locate 2, 5:print"     ■  ■  ■   ■  ■  ■"
17260 if i=0 then locate 2, 6:print"  ■■■   ■ ■     ■ ■   ■"
17270 if i=0 then locate 2, 9:print"■  ■  ■ ■ ■■■  ■■■   ■  ■"
17280 if i=1 then locate 2,10:print"■ ■ ■ ■ ■  ■  ■   ■  ■  ■"
17290 if i=2 then locate 2,11:print"■ ■ ■ ■ ■  ■  ■      ■■■■"
17300 if i=3 then locate 2,12:print"■ ■ ■ ■ ■  ■  ■   ■  ■  ■"
17310 if i=4 then locate 2,13:print" ■   ■  ■  ■   ■■■   ■  ■"
17320 waitvb 30:next
17330 locate 9,15:print "~ゴブリン帝国の野望~";
17340 d=wait
17400 cls
17410 print " ***WITCH号の最新装備を紹介する***":print
17420 waitvb 30:print " 量子レーダー:"
17430 print "  W←WITCH号 *←小惑星"
17440 print "  G←ゴブリン戦艦 T←輸送船":print
17450 waitvb 30:print " 超空間ジャンプドライブ:"
17460 print "  エリア内の敵を全滅させたら次のエリアに進める。":print
17470 waitvb 30:print " バーニア:"
17480 print "  エリア内を移動できる。":print
17490 waitvb 30:print " ウェーブキヤノン:"
17500 print "  エリア内のすべての敵を同時攻撃":print
17510 waitvb 30:print " 反応弾頭ミサイル:"
17520 print "  敵艦も小惑星も一撃で粉砕する"
17590 d=wait
17600 cls
17610 locate 8,8:print "それでは健闘を祈る!"
17690 d=wait
17700 cls
17710 locate 5,8:print "艦長! WITCH号、出港します!"
17790 d=wait
17900 return
18000 'GOOD ENDING
18010 cls:print
18020 waitvb 75:print " 作戦開始後";D;"日":print
18030 waitvb 75:print " ";H;"隻の戦艦を失った":print
18032 waitvb 75:print " ゴブリン帝国は、全面降伏した":print
18035 waitvb 75:print " 宇宙の平和は守られたのだ":print
18040 waitvb 75:print " WITCH号ならびに艦長の活躍をたたえ":print
18050 waitvb 75:print " 全人類から感謝の言葉をおくる":print
18060 waitvb 75:locate 10,14:print "ありがとう!"
18070 waitvb 75:locate 10,16:print "CONGRATURATIONS!";
18080 d=wait
18090 end
locate 10,10:print "●●●●";
19000 'BAD ENDING
19010 cls:print
19020 waitvb 75:print " 作戦開始後";D;"日":print
19030 waitvb 75:print " WITCH号、宇宙の藻屑と消える":print
19040 waitvb 75:print " この日、地球連邦政府は、ゴブリン帝国に降伏":print
19050 waitvb 75:print " 地球人はゴブリン帝国の奴隷となった":print
19060 waitvb 75:locate 17,16:print "GAME OVER!";
19080 d=wait
19090 end
20000 ' clear message
20010 for i=11 to 15:locate 1,i
20020 print "                          ";
20030 next
20040 return
21000 ' 数値入力
21010 locate X,Y+0:print "┏━━━━┓";
21020 locate X,Y+1:print "┃    ┃";
21030 locate X,Y+2:print "┃0000┃";
21040 locate X,Y+3:print "┃    ┃";
21050 locate X,Y+4:print "┗━━━━┛";
21100 for i=0 to 3:@(W+i)=0:next
21110 v=3 '桁位置
21200 locate X+v+1,Y+1:print "↑";
21210 locate X+v+1,Y+3:print "↓";
21220 for i=0 to 3:locate X+i+1,Y+2:print @(W+i);:next
21300 s=wait
21310 locate X+v+1,Y+1:print " ";
21320 locate X+v+1,Y+3:print " ";
21330 if s and scan_x3 then @(W+v)=@(W+v)-1:if @(W+v)<0 then @(W+v)=9
21340 if s and scan_x1 then @(W+v)=@(W+v)+1:if @(W+v)>9 then @(W+v)=0
21350 if s and scan_x2 then v=v+1:if v>3 then v=0
21360 if s and scan_x4 then v=v-1:if v<0 then v=3
21365 if s and scan_a then goto 21400
21370 if s and scan_b then Z=-1:return
21380 goto 21200
21400 Z=@(W+0)*1000+@(W+1)*100+@(W+2)*10+@(W+3)
21410 return
22000 ' 疑似三角関数(Y=sin(X)) Y=-100...100 X=0-360
22010 X=X/5
22020 if X<=18 then gosub 22100:return
22030 if X<=36 then X=36-X:gosub 22100:return
22040 if X<=54 then X=X-36:gosub 22100:Y=-Y:return
22050 if X<=72 then X=72-X:gosub 22100:Y=-Y:return
22060 X=X-72:goto 22020
22100 if X=0 then Y=0
22110 if X=1 then Y=8
22120 if X=2 then Y=17
22130 if X=3 then Y=25
22140 if X=4 then Y=34
22150 if X=5 then Y=42
22160 if X=6 then Y=49
22170 if X=7 then Y=57
22180 if X=8 then Y=64
22190 if X=9 then Y=70
22200 if X=10 then Y=76
22210 if X=11 then Y=81
22220 if X=12 then Y=86
22230 if X=13 then Y=90
22240 if X=14 then Y=93
22250 if X=15 then Y=96
22260 if X=16 then Y=98
22270 if X=17 then Y=99
22280 if X=18 then Y=99
22290 return
23000 ' 疑似三角関数(cos)
23010 X=X+90:gosub 22000:return
24000 ' 爆発アニメーション
24005 locate 2+X,2+Y:print "・";:waitvb 30
24010 locate 2+X,2+Y:print "●";:waitvb 30
24020 locate 2+X,2+Y:print "※";:waitvb 30
24030 locate 2+X,2+Y:print " ";
24040 d=wait
24090 return
25000 '******ステータス表示更新*****
25010 locate 11,3:print "       ";
25020 locate 14,3:print E;
25030 locate 11,5:print "       ";
25040 locate 14,5:print M;
25050 locate 11,7:print "       ";
25060 locate 14,7:print L;
25070 locate 11,9:print "       ";
25080 locate 14,9:print D;
25090 return
26000 ' エリア内残り敵戦艦を数えてYに返す
26010 Y=0
26020 for y=0 to 7:for x=0 to 7
26030 if @(A+x+y*8)>0 then Y=Y+1
26040 next:next
26090 return
cls:print" "

20
testcall.wb Normal file
View File

@ -0,0 +1,20 @@
100 ' test machine language call
110 A=varptr(@(0))
115 gosub 1000
120 ax=1:bx=2:cx=3:dx=4:si=-1:di=-2
130 call A
140 if ax <> 2 then debug "axの値が期待と違います":end
150 if bx <> 3 then debug "bxの値が期待と違います":end
160 if cx <> 4 then debug "cxの値が期待と違います":end
170 if dx <> 5 then debug "dxの値が期待と違います":end
180 if si <> 0 then debug "siの値が期待と違います":end
190 if di <> -1 then debug "diの値が期待と違います":end
900 debug "正常終了":end
1000 poke A+0,0x40 'inc ax
1010 poke A+1,0x43 'inc bx
1020 poke A+2,0x41 'inc cx
1030 poke A+3,0x42 'inc dx
1040 poke A+4,0x46 'inc si
1050 poke A+5,0x47 'inc di
1060 poke A+6,0xCB 'ret (FAR)
1090 return

26
testint.wb Normal file
View File

@ -0,0 +1,26 @@
100 cx=22
110 ds=varseg(@(0))
120 dx=varptr(@(0))
125 ax=10*256
130 int 0x17
140 if ax<>0 then debug "BIOSªƒGƒ‰<C692>[‚ð•Ô‚µ‚Ü‚µ‚½":end
150 debug "name dump:";
160 for i=0 to 15:debug peek(varptr(@(0))+i);",";:next:debug
162 debug "name char:";
165 for i=0 to 15:debug chr(peek(varptr(@(0))+i));:next:debug
170 debug
180 debug "birth_year:";@(8)
190 debug "birth_month:";peek(varptr(@(0))+18)
200 debug "birth_day:";peek(varptr(@(0))+19)
210 debug "sex:";
220 s = peek(varptr(@(0))+20)
230 if s=0 then debug "?"
240 if s=1 then debug "male"
250 if s=2 then debug "female"
260 debug "bloodtype:";
270 b = peek(varptr(@(0))+21)
280 if b=0 then debug "?"
290 if b=1 then debug "A"
300 if b=2 then debug "B"
310 if b=3 then debug "O"
320 if b=4 then debug "AB"

11
testpeekpoke.wb Normal file
View File

@ -0,0 +1,11 @@
100 a=varptr(A)
110 s=varseg(A)
120 debug "変数Aはオフセット";a;",セグメント";s
130 A=0x1234
140 defseg=s
150 if peek(a) <> 0x34 then debug "peekが異常です(!)":end
160 if peek(a+1) <> 0x12 then debug "peekが異常です(2)":end
170 poke a,0xfe
180 poke a+1,0xdc
190 if A <> 0xdcfe then debug "pokeが異常です":end
900 debug "テスト完了"

310
vc15_rt.asm Normal file
View File

@ -0,0 +1,310 @@
;***
;vc15_rt.asm: Wonder Witch Start-up code for Visual C++ 1.5x
;
SRAM_SEG equ 1000h
MAXPATHLEN equ 64
INT_EXIT equ 10h
INT_DISP equ 12h
INT_TEXT equ 13h
DISPLAY_CONTROL equ 00h
SPRITE_SET_RANGE equ 0bh
SCREEN_SET_SCROLL equ 13h
SCREEN2_SET_WINDOW equ 15h
SPRITE_SET_WINDOW equ 17h
SCREEN_SET_VRAM equ 21h
SPRITE_SET_VRAM equ 22h
TEXT_SCREEN_INIT equ 00h
TEXT_SET_MODE equ 02h
TEXT_SET_SCREEN equ 0eh
TEXT_MODE_ANK equ 0
TEXT_MODE_ANK_SJIS equ 1
TEXT_MODE_SJIS equ 2
SCREEN1 equ 0
SCREEN2 equ 1
DCM_SCR1 equ 1
DCM_SCR2 equ 2
V_SPRITE_START equ 0
V_SPRITE_COUNT equ 0
ifdef DISPLAY_MODE_JAPANESE1
V_DISPLAY_CONTROL equ DCM_SCR2
V_TEXT_SCREEN equ SCREEN2
V_TEXT_MODE equ TEXT_MODE_ANK_SJIS
V_SCREEN1_VRAM equ 3 ; duplicated with screen2
V_SCREEN2_VRAM equ 3
V_SPRITE_VRAM equ 11
V_STACK_TOP equ 01600h
endif
ifdef DISPLAY_MODE_JAPANESE2
V_DISPLAY_CONTROL equ DCM_SCR1 + DCM_SCR2
V_TEXT_SCREEN equ SCREEN2
V_TEXT_MODE equ TEXT_MODE_ANK_SJIS
V_SCREEN1_VRAM equ 2
V_SCREEN2_VRAM equ 3
V_SPRITE_VRAM equ 7
V_STACK_TOP equ 00e00h
endif
ifdef DISPLAY_MODE_ASCII1
V_DISPLAY_CONTROL equ DCM_SCR2
V_TEXT_SCREEN equ SCREEN2
V_TEXT_MODE equ TEXT_MODE_ANK
V_SCREEN1_VRAM equ 6 ; duplicated with screen2
V_SCREEN2_VRAM equ 6
V_SPRITE_VRAM equ 23
V_STACK_TOP equ 02e00h
endif
ifdef DISPLAY_MODE_ASCII2
V_DISPLAY_CONTROL equ DCM_SCR1 + DCM_SCR2
V_TEXT_SCREEN equ SCREEN2
V_TEXT_MODE equ TEXT_MODE_ANK
V_SCREEN1_VRAM equ 6
V_SCREEN2_VRAM equ 5
V_SPRITE_VRAM equ 19
V_STACK_TOP equ 02600h
endif
_TEXT segment byte public 'CODE'
_TEXT ends
TEXT segment byte public 'CODE'
TEXT ends
_DATA segment para public 'DATA'
dseg_start proc far
dseg_start endp
_DATA ends
DATA segment para public 'DATA'
DATA ends
CONST segment para public 'CONST'
CONST ends
_BSS segment word public 'BSS'
bss_start proc far
bss_start endp
_BSS ends
BSS segment word public 'BSS'
BSS ends
c_common segment word public 'BSS'
c_common ends
_HEAP segment para public 'HEAP'
heap_start proc far
heap_start endp
_HEAP ends
CGROUP group _TEXT, TEXT
DGROUP group _DATA, DATA, CONST, _BSS, BSS, c_common, _HEAP
assume cs:CGROUP, ds:DGROUP, es:DGROUP
_TEXT segment byte public 'CODE'
extrn _main :near
public _load0
public _run0
public _exit0
_load0 proc far
push ds
push di
push si
push cx
push bx
; calcurate initialized data size
mov cx, offset DGROUP:bss_start
shr cx, 1 ; word alignmented
; copy initialized data into user ds
mov ax, cs
sub ax, CGROUP
; add ax, seg dseg_start
add ax, DGROUP
mov ds, ax
mov ax, SRAM_SEG
mov es, ax
mov si, offset DGROUP:dseg_start
mov di, si
rep movsw
; clear bss
mov cx, offset DGROUP:heap_start
push cx
mov di, offset DGROUP:bss_start
sub cx, di
shr cx, 1
xor ax, ax
rep stosw
; calcurate heap start position
; set argv starting position at heap start
pop es:[__argv]
mov dx, cs
mov ax, offset _run0
pop bx
pop cx
pop si
pop di
pop ds
ret
_load0 endp
_run0 proc far ;C, argc :word, argv :near ptr
push bp
mov bp,sp
push ds
mov dx, SRAM_SEG
mov es, dx
mov ds, dx
; mov ax, sp
; mov word ptr ds:[__sp], ax
; mov ax, ss
; mov word ptr ds:[__sp + 2], ax
;; setup SP according to the display modes
;; display_control(0);
mov bx, 0
mov ah, DISPLAY_CONTROL
int INT_DISP
;; screen_set_scroll(SCREEN1, 0, 0);
mov bx, 00000h
mov al, SCREEN1
mov ah, SCREEN_SET_SCROLL
int INT_DISP
;; screen_set_scroll(SCREEN2, 0, 0);
mov bx, 00000h
mov al, SCREEN2
mov ah, SCREEN_SET_SCROLL
int INT_DISP
;; screen2_set_window(0, 0, 255, 255)
mov cx, 0ffffh
mov bx, 00000h
mov ah, SCREEN2_SET_WINDOW
int INT_DISP
;; sprite_set_window(0, 0, 255, 255)
mov cx, 0ffffh
mov bx, 00000h
mov ah, SPRITE_SET_WINDOW
int INT_DISP
;; text_set_screen(V_TEXT_SCREEN);
mov al, V_TEXT_SCREEN
mov ah, TEXT_SET_SCREEN
int INT_TEXT
;; text_set_mode(V_TEXT_MODE);
mov bx, V_TEXT_MODE
mov ah, TEXT_SET_MODE
int INT_TEXT
;; screen_set_vram(SCREEN1, V_SCREEN1_VRAM)
mov bx, V_SCREEN1_VRAM
mov al, SCREEN1
mov ah, SCREEN_SET_VRAM
int INT_DISP
;; screen_set_vram(SCREEN2, V_SCREEN2_VRAM)
mov bx, V_SCREEN2_VRAM
mov al, SCREEN2
mov ah, SCREEN_SET_VRAM
int INT_DISP
;; sprite_set_vram(SCREEN2, V_SCREEN2_VRAM)
mov bx, V_SPRITE_VRAM
mov ah, SPRITE_SET_VRAM
int INT_DISP
;; sprite_set_range(V_SPRITE_START, V_SPRITE_COUNT)
mov cx, V_SPRITE_COUNT
mov bx, V_SPRITE_START
mov ah, SPRITE_SET_RANGE
int INT_DISP
;; display_control(V_DISPLAY_CONTROL);
mov bx, V_DISPLAY_CONTROL
mov ah, DISPLAY_CONTROL
int INT_DISP
MOV CX, [BP + 8] ; for argv ; mov bx, argc
MOV BX, [BP + 6] ; for argc ; mov cx, argv
mov ax, V_STACK_TOP
mov sp, ax
push cx ; argv
push bx ; argc
call _main
_exit00:
_exit0:
int INT_EXIT
;mov sp,bp
;pop bp
;ret
_run0 endp
;_exit0:
; mov ax, SRAM_SEG
; mov es, ax
; les ax, dword ptr es:[__sp]
; mov sp, ax
; mov ax, es
; mov ss, ax
; jmp _exit00
_TEXT ends
_DATA segment para public 'DATA'
public __acrtused ; trick to force in startup
__acrtused = 9876h ; funny value not easily matched in SYMDEB
public __id
public __pid
public __ppid
public __pcbid
public __ppcbid
public __ilib
public __proc
public __cwfs
public __currentdir
public __argv
public __heap
;dseg_start:
__id db 'TCC', 0
__pid dw ?
__ppid dw ?
__pcbid dw ?
__ppcbid dw ?
__ilib dd ?
__proc dd ?
__cwfs dd ?
__currentdir db MAXPATHLEN dup (?)
__argv dw ?
__resource dd ?
__heap dw ?
_DATA ends
end

View File

@ -1,15 +1,19 @@
// wonbe Win32 text emulation
// First Created: Nov.4,2000 by Nashiko
// Copyright 2000 (c) by Pie Dey Co.,Ltd.
/* First Created: Nov.4,2000 by Pie Dey Co.,Ltd. */
/* This source code is distributed under GNU General Public License (GPL) */
/* see http://www.gnu.org/ about GPL */
#include <windows.h>
#include <stdio.h>
#include "win32text.h"
#define SCREEN_SIZE_X (224/8)
#define SCREEN_SIZE_Y (144/8)
static WORD screen[SCREEN_SIZE_X][SCREEN_SIZE_Y];
static WORD lastChar;
//static WORD lastChar;
static UINT lastVKey;
static HWND hwnd;
@ -22,6 +26,7 @@ static void wmPaint( HWND hWnd, HDC hdc )
GetClientRect( hWnd, &rect );
SelectObject( hdc, GetStockObject( SYSTEM_FIXED_FONT ) );
GetTextMetrics( hdc, &tm );
xArea = SCREEN_SIZE_X * tm.tmMaxCharWidth;
@ -47,6 +52,13 @@ static void wmPaint( HWND hWnd, HDC hdc )
rectDraw.left+x*tm.tmMaxCharWidth,
rectDraw.top+y*tm.tmHeight,
str, 2 );
} else {
static char table[] = " !”#$%&’()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|} ̄";
if( val >= 0x20 && val <= 0x7e ) {
TextOut( hdc,
rectDraw.left+x*tm.tmMaxCharWidth,
rectDraw.top+y*tm.tmHeight,
&table[(val-0x20)*2], 2 );
} else {
str[0] = (BYTE)val;
TextOut( hdc,
@ -56,6 +68,7 @@ static void wmPaint( HWND hWnd, HDC hdc )
}
}
}
}
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
@ -70,10 +83,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
EndPaint(hWnd, &ps);
break;
case WM_CHAR:
lastChar = (WORD)wParam;
case WM_KEYDOWN:
lastVKey = (WORD)wParam;
break;
//case WM_CHAR:
// lastChar = (WORD)wParam;
// break;
case WM_CLOSE:
return 0; // 閉じちゃ駄目
@ -166,7 +183,8 @@ int createText()
DWORD dwThreadId, dwThrdParam = 1;
HANDLE hThread;
lastChar = 0;
//lastChar = 0;
lastVKey = 0;
hThread = CreateThread(
NULL, // no security attributes
0, // use default stack size
@ -179,42 +197,37 @@ int createText()
unsigned short win32_wait()
{
WORD t;
UINT t;
while( TRUE ) {
// 以下の2行は本当はマルチスレッド的にNGなんだけど
// テスト用環境だから大目に見る
t = lastChar;
lastChar = 0;
t = lastVKey;
lastVKey = 0;
switch( t ) {
case 'p':
case 'P':
return 0x02; // START BUTTON
case ' ':
case VK_SPACE:
return 0x04; //KEYWORD_SCAN_A;
case 0x1b:
case VK_ESCAPE:
return 0x08; //KEYWORD_SCAN_B;
case 'e':
case VK_UP:
case 'E':
return 0x10; //KEYWORD_SCAN_X1;
case 'd':
case VK_RIGHT:
case 'D':
return 0x20; //KEYWORD_SCAN_X2;
case 'x':
case VK_DOWN:
case 'X':
return 0x40; //KEYWORD_SCAN_X3;
case 's':
case VK_LEFT:
case 'S':
return 0x80; //KEYWORD_SCAN_X4;
case 't':
case 'T':
return 0x100; //KEYWORD_SCAN_Y1;
case 'g':
case 'G':
return 0x200; //KEYWORD_SCAN_Y2;
case 'v':
case 'V':
return 0x400; //KEYWORD_SCAN_Y3;
case 'f':
case 'F':
return 0x800; //KEYWORD_SCAN_Y4;
}
@ -272,4 +285,104 @@ void win32_sys_wait( unsigned int val )
Sleep( val*10 );
}
static BOOL bPlayingMIDI = FALSE;
static UINT wDeviceID;
DWORD stopMIDIFile(HWND hwnd)
{
if( bPlayingMIDI ) {
mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL);
bPlayingMIDI = FALSE;
}
return 0;
}
DWORD playMIDIFile(HWND hWndNotify, LPSTR lpszMIDIFileName)
{
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_PLAY_PARMS mciPlayParms;
MCI_STATUS_PARMS mciStatusParms;
//MCI_SEQ_SET_PARMS mciSeqSetParms;
// Open the device by specifying the device and filename.
// MCI will attempt to choose the MIDI mapper as the output port.
mciOpenParms.lpstrDeviceType = "sequencer";
mciOpenParms.lpstrElementName = lpszMIDIFileName;
if (dwReturn = mciSendCommand((MCIDEVICEID)NULL, MCI_OPEN,
MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,
(DWORD)(LPVOID) &mciOpenParms))
{
// Failed to open device. Don't close it; just return error.
return (dwReturn);
}
// The device opened successfully; get the device ID.
wDeviceID = mciOpenParms.wDeviceID;
bPlayingMIDI = TRUE;
// Check if the output port is the MIDI mapper.
mciStatusParms.dwItem = MCI_SEQ_STATUS_PORT;
if (dwReturn = mciSendCommand(wDeviceID, MCI_STATUS,
MCI_STATUS_ITEM, (DWORD)(LPVOID) &mciStatusParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD)NULL);
return (dwReturn);
}
// The output port is not the MIDI mapper.
// Ask if the user wants to continue.
if (LOWORD(mciStatusParms.dwReturn) != MIDI_MAPPER)
{
//printf("Warning: The MIDI mapper is not available.\n");
}
// Begin playback. The window procedure function for the parent
// window will be notified with an MM_MCINOTIFY message when
// playback is complete. At this time, the window procedure closes
// the device.
mciPlayParms.dwCallback = (DWORD) hWndNotify;
if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY,
(DWORD)(LPVOID) &mciPlayParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD)NULL);
return (dwReturn);
}
return (0L);
}
// "テキスト音楽「サクラ」"に含まれるdsakura.dllを用いてMMLを再生します
// サクラは以下より入手できます http://www.text2music.com/
// dsakura.dllが無ければ音が出ないだけで、エラーにはなりません。
void win32_play_mml( const char * mml )
{
static BOOL initialized = FALSE;
static HMODULE hmod = NULL;
static FARPROC pMMLtoMIDI = NULL;
if( !initialized ) {
HMODULE hmod = LoadLibrary("dsakura");
if( hmod != NULL ) {
pMMLtoMIDI = GetProcAddress( hmod, "MMLtoMIDI" );
} else {
printf("LoadLibrary(\"dsakura\") failed\n");
}
initialized = TRUE;
}
if( pMMLtoMIDI != NULL ) {
char errmsg[256];
BOOL b;
stopMIDIFile(hwnd);
b = (*pMMLtoMIDI)(mml,"$$$.mid",errmsg);
if( b == FALSE ) {
printf("dsakura: %s\n",errmsg);
}
playMIDIFile(hwnd, "$$$.mid");
} else {
printf("play: %s\n", mml );
}
}
// end of win32text.c

View File

@ -1,6 +1,8 @@
// wonbe Win32 text emulation
// First Created: Nov.4,2000 by Nashiko
// Copyright 2000 (c) by Pie Dey Co.,Ltd.
/* First Created: Nov.3,2000 by Pie Dey Co.,Ltd. */
/* This source code is distributed under GNU General Public License (GPL) */
/* see http://www.gnu.org/ about GPL */
int createText();
void clearText();
@ -11,5 +13,6 @@ unsigned short win32_wait();
unsigned short win32_scan();
unsigned int win32_get_tick_count();
void win32_sys_wait( unsigned int val );
void win32_play_mml( const char * mml );
// end of win32text.h

1144
wonbe.c

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,7 @@ RSC=rc.exe
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
@ -49,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Winmm.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "wonbe - Win32 Debug"
@ -62,6 +63,7 @@ LINK32=link.exe
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
@ -72,7 +74,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Winmm.lib /nologo /subsystem:console /debug /machine:I386
!ENDIF

BIN
wonbe.exe

Binary file not shown.

BIN
wonbe.fx

Binary file not shown.

226
wonbe.txt
View File

@ -1,226 +0,0 @@
ワンべぇ: WONBE, WonderWitch BASIC Environment
暫定マニュアル Ver 0.01
2000年11月6日
株式会社ピーデー
川俣 晶
Copyright 2000 (c) by Pie Dey Co.Ltd.
●これは何か?
 ワンべぇは、WonderWitch上で使用できる小型BASICインタプリタです。
 WonderWitch上ですべての機能が稼働し、シリアルケーブル経由で接続された一般の通信ソフトで操作します。デバッグ済みのプログラムを実行する場合は、シリアルケーブルも通信ソフトも必要ありません。
 WonderWitchのテキスト画面を扱う最小限度のステートメント(cls,locate,print)と、最小限度のボタン入力機能(wait,scan)を持ち、簡易なミニゲームが書けます。
 動作テスト用にWin32上で動くバイナリーもありますが、これは、BASIC本体の動作確認用と割り切ってください。
●必要なもの
・開発時
 WonderWitchのカートリッジとシリアルケーブル。38400bpsの無手順通信が可能な通信ソフトを持つパソコン等。
・実行時
 ワンべぇと実行したプログラムを入れてあるWonderWitchのカートリッジのみ
●準備
・TransMagicなどでワンべぇ(fonbe.fx)をWonderWitchに転送します。
・TransMagicなどの接続を切り、通信ソフトから38400bpsの無手順通信を開始します
・WonderWitch上でワンべぇを実行します
・エントランスメニュー画面でY2を押します
・通信ソフトに、ワンべぇの名前が表示され、"*Ready"と出ます
・これで準備完了です
・print "hello!"リターンと打ってWonderWitchの画面を見てください。文字が出ていれば正常です。
●開発済みプログラムの実行
・WonderWitch上でワンべぇを実行します
・エントランスメニュー画面で実行したいファイルを選んでAボタンを押します
●開発環境の概要
 通常の行番号ベースのエディタが使えます。
 行番号に引き続いて1行を入力してリターンを押すと、プログラムに記録されます。
 行番号だけを入力してリターンを押すとその行は削除されます。
 行番号無しで命令を入力すると即座に実行されます。
 編集はバックスペースによる1文字削除しか使えません。通信ソフトからホスト上のエディタにCOPY&PASTEして、エディタ上で編集してから、通信ソフトに貼り付けてワンべぇに送ると便利です。ただし、フロー制御が無いので、複数行まとめて貼り付けると文字落ちが生じます。張り付けは1行単位で行ってください。プログラムはホスト上で編集してあらかじめTransMagicなどで送信しておくのも有効な手段です。
 現状では2Kバイト以上のプログラムを作成してもsaveコマンドで保存できません。listコマンドを実行してから通信ソフト上でCOPY&PASTEしてホスト上に保存してください。
 実行中は、STARTボタンを押すといつでも対話モードに戻れます。その後、contステートメントで実行を継続できます。
 中間言語に翻訳してから処理するため、中間言語に翻訳できない場合は、入力直後にエラーが出ます。
●言語の概要
 ごく軽いBASIC言語です。
 昔あったTiny BASICに近い構文を持っています。
 データ型は、符号付き16bit整数だけです。
 定数は、-3276832767の10進数か、0x00000xffffの16進数で記述できます。
 変数は、グローバル変数として、AZのアルファベット大文字1文字のものが26個あります。
 ローカル変数として、azのアルファベット子文字1文字のものが26個あります。ローカル変数はgosubステートメントを実行したときに新しい領域が割り当てられ、returnステートメントを実行したときにgosubする前の領域が戻ってきます。
 配列変数は@(インデックス)という形式の1次元配列だけが使用できます。使用可能なサイズは、プログラム記憶領域(48Kバイト)の残りサイズに等しくなります。インデックスは0から始まります。(例: for i=0 to 9:print @(i):next)
 演算子の優先順位はありません。(1+2*3は9になります)
 計算順序は、括弧()を使って明示的にコントロールしてください。
 オーバーフロー、アンダーフローのチェックはありません。溢れは無視されます。ただしゼロ除算はエラーになります。
 ステートメントなどのキーワードはすべてアルファベット小文字で入力します。大文字を使っても小文字になります。
● ステートメント一覧
変数 = 式
 式を計算して変数に代入します。letキーワードはサポートしていません。
例: a=b+c
if 式 then ステートメント列
 式が0でなければステートメント列を実行します。0なら次の行から実行を継続します。elseはありません。
例: if (a=0) and (b=1) then goto 200
print [文字列|式|chr(式)][,|;]...
 WonderWitchのテキスト画面の現在のカーソル位置から文字を表示します。
 式の前後に空白文字が入ることはありません。
 chr(式)は、式の値を文字コードと見なして表示します。
 制御コードは扱いませんので、WonderWitchのキャラクタージェネレータにあるすべての文字が表示できます。
 区切り文字の;は何もしません。,はタブストップ位置までカーソルを進めます。
 print文の最後は;または,で終わった場合は改行しません。
例: print "計算結果=",chr(34);1+2;chr(34)
locate 式,式
 WonderWitchのテキスト画面の現在のカーソル位置を設定します。引数はx,yの順番です。
例: locate 10,10
cls
 WonderWitchのテキスト画面を消去します。
例: cls
goto 式
 式の行番号に飛びます。計算型goto文が可能です。つまり、goto A*100とすると、Aが1のきは100行目に。2のときは200行目に飛びます。
例: goto 100
gosub 式
 スタックに現在位置とローカル変数を積んで、式の行番号に飛びます。gotoと同じく計算型gosubが可能です。
 スタックはforと合わせて8レベルまでです。
例: gosub 100
return
 gosubがスタックに積んだ情報を取り出して、そこに処理を戻す。ローカル変数も戻る。
例: return
for 変数=式 to 式
for 変数=式 to 式 step 式
 変数の値を変化させながらnextまで繰り返します。
 終了値は厳密であることに注意が必要です。for i=1 to 2 step 2:nextは、無限ループになります。なぜなら変数iは永遠に2にならないからです。このような仕様にしておかないと、終了値を超えたら終わるという判定だと、ループの終値が32767のときに機能しないためです。
例: for i=0 to 10 step 2
next
 forステートメントの位置に戻って動作を繰り返します。forステートメントで示した条件が満たされた場合は、nextの次に動作が進みます。nextの後に変数名を書くとエラーになります。
例: next
end
 プログラムの実行を終了します。
break
 その位置で一時的に実行を中断します。contステートメントで実行を継続できます。
rem 文字列
'文字列
 コメントを記述します。後ろに:を置いてステートメントを続けることはできません。
例: rem これはテストプログラムです。
例: 'この式が座標を計算します
new
 メモリ上のプログラムを消去します。
list [行番号][-][行番号]
 指定範囲の行番号のプログラムをリストします。すべて省略すると全行をリストします。
run
run 式
run 文字列
 プログラムを実行します。それに先だって変数やスタックがクリアされます。
 runはメモリ上のプログラムを先頭から。run 式は、式の行番号から。run 文字列は文字列のファイルを読み込んでそれを実行します。
例: run
例: run 100
例: run "test.wb"
cont
 breakステートメントやSTARTボタンによるブレークによって停止した位置から実行を再開します。
save 文字列
 文字列をファイル名としてメモリ上のプログラムを保存します。保存されるのは内部表現ではなくテキスト形式です。
 現在はWonderWitchのファイルシステムの制約上、2Kバイトを超えるファイルを保存できません。listコマンドで端末にリストを送ってそれをCOPY&PASTEして保存してください。
例: save "hello.wb"
load 文字列
 文字列をファイル名としてファイルからプログラムを読み込みます。読み込むのはテキスト形式で、改行はCRLFとLFのどちらでも可です。中間言語に翻訳できない行がある場合はそこで読み込みが中断されます。プログラムの実行中に使用した場合は実行は中断されます。
例: load "hello.wb"
merge 文字列
 メモリ上のプログラムにファイル上のプログラムを混ぜ合わせます。同じ行番号の行は読み込まれる方が優先されます。中間言語に翻訳できない行がある場合はそこで読み込みが中断されます。プログラムの実行中に使用した場合は実行は中断されます。
例: load "merge.wb"
randomize 式
 乱数の初期値を指定します。これを使わないと必ず同じ順序で乱数が発生します。引数には、システム変数tickを指定すると最適です。
例: randomize tick
exit
 ワンべぇを抜けてOSに戻ります。
debug [文字列|式|chr(式)][,|;]...
 printステートメントと同等ですが、WonderWitchの画面ではなく、シリアルポートに送ります。単体で実行する場合には使えないデバッグ専用の機能です。
waitvb 式
 式の回数だけVBLANKを待ちます。待っている間はSTARTボタンによるブレークを受け付けなくなるので、指定できる値は750までと制限されています。750を超える値を指定するとエラーになります。
例: waitvb 75
files
 カレントディレクトリのファイル一覧をシリアルポートに送ります。単体で実行する場合には使えないデバッグ専用の機能です。
 2項演算子
 + - * / < > = <= >= <> and or xor
● 単項演算子
 - not
● 関数
rnd(式)
 0から式-1までの範囲の乱数を返します。
abs(式)
 式の絶対値を返します。
● システム変数 (読み出しのみ)
scan
 WonderSwanのボタンの状態を調べ、1個の整数値として返します。SCAN_で始まるシステム変数とandを取ることで、どのボタンが押されているかどうか判定できます。STARTボタンは実行中断になるので、これは扱えません。
wait
 WonderSwanのボタンが押されるまで待ち、その状態を1個の整数値として返します。SCAN_で始まるシステム変数とandを取ることで、どのボタンが押されたか判定できます。STARTボタンは実行中断になるので、これは扱えません。
scan_a
scan_b
scan_x1
scan_x2
scan_x3
scan_x4
scan_y1
scan_y2
scan_y3
scan_y4
 それぞれのボタンのマスク値を示す定数を返します。
 Aボタンが押されているかどうかを調べるには、下記の例のように記述します。
例: if scan and scna_a then print "Aボタンが押さている"
tick
 システムタイマーのtickを返します。ただし、本来のtick値は符号無し32bit整数であり、ここで得られるのは16bit符号あり整数であることに注意が必要です。はみ出たbitは捨てられます。
● ファイル保存時の拡張子
 一応、ワンべぇのソースフィルは、".wb"で終わるファイル名にしておいて下さい。現在エントランスメニューには全ファイルが見えていますが、".wb"で終わるファイル名だけに限定しようかと考えています。
● 配布規則
 現バージョンは品質が不明のテスト版です。
 ですので、以下のように扱ってください。
 (正規版でどうするかは未定です)
・転載
 未完成品ですので、Internetやパソコン通信などへの転載は不可です。必ずhttp://www.piedey.co.jp/のサイトから入手するようにしてください。
・雑誌掲載等
 ご相談下さい。
・商業利用
 ご相談下さい。
・自作ソフトの実行手段としてのワンべぇの添付
 自作ソフトを配布するためにwonbe.fxを一緒に渡すことを許可します。アーカイブへの同梱、CD-Rメディアなどへの焼き込み、通信ケーブルによる転送、どれも可です。ただし、ワンべぇの動作に関しては何も保証はできませんので、リスクは自分で負ってください。利用にあたっては、ロイヤリティなどはありませんので、報告も送金も必要ありません。
● 問い合わせ先
株式会社ピーデー http://www.piedey.co.jp/
川俣 晶 autumn@piedey.co.jp
以上