Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba2cb227e0 | ||
|
|
86539c6fac | ||
|
|
7d4a34e405 | ||
|
|
b906d49ca1 |
32
Makefile.tcpp10
Normal file
32
Makefile.tcpp10
Normal 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
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
ワンべぇ: WONBE, WonderWitch BASIC Environment
|
||||
暫定マニュアル Ver 0.04
|
||||
2000年11月12日
|
||||
暫定マニュアル Ver 0.06
|
||||
2001年1月29日
|
||||
株式会社ピーデー
|
||||
川俣 晶
|
||||
Copyright 2000 (c) by Pie Dey Co.Ltd.
|
||||
This software is distributed under GNU General Public License
|
||||
|
||||
●これは何か?
|
||||
ワンべぇは、WonderWitch上で使用できる小型BASICインタプリタです。
|
||||
WonderWitch上ですべての機能が稼働し、シリアルケーブル経由で接続された一般の通信ソフトで操作します。デバッグ済みのプログラムを実行する場合は、シリアルケーブルも通信ソフトも必要ありません。
|
||||
WonderWitchのテキスト画面を扱う最小限度のステートメント(cls,locate,print)と、最小限度のボタン入力機能(wait,scan)を持ち、簡易なミニゲームが書けます。
|
||||
WonderSwan Color使用時には4色カラーモードが可能です。
|
||||
動作テスト用にWin32上で動くバイナリーもありますが、これは、BASIC本体の動作確認用と割り切ってください。
|
||||
ドキュメントは、ちょっと見難いかもしれませんが、有志が見やすいものを作ってくれることを期待します。
|
||||
|
||||
●必要なもの
|
||||
・開発時
|
||||
@@ -46,7 +48,7 @@
|
||||
データ型は、符号付き16bit整数だけです。
|
||||
定数は、-32767~32767の10進数か、0x0000~0xffffの16進数で記述できます。-32768は変数には記憶できますが、ソースには書けません。(-32767-1のように書いてください)
|
||||
変数は、グローバル変数として、A~Zのアルファベット大文字1文字のものが26個あります。
|
||||
ローカル変数として、a~zのアルファベット子文字1文字のものが26個あります。ローカル変数はgosubステートメントを実行したときに新しい領域が割り当てられ、returnステートメントを実行したときにgosubする前の領域が戻ってきます。
|
||||
ローカル変数として、a~zのアルファベット小文字1文字のものが26個あります。ローカル変数はgosubステートメントを実行したときに新しい領域が割り当てられ、returnステートメントを実行したときにgosubする前の領域が戻ってきます。
|
||||
配列変数は@(インデックス)という形式の1次元配列だけが使用できます。使用可能なサイズは、プログラム記憶領域(48Kバイト)の残りサイズに等しくなります。インデックスは0から始まります。(例: for i=0 to 9:print @(i):next)
|
||||
演算子の優先順位は「単項演算子 > */ > +- > 比較演算子 > and,or,xor」となります。(比較演算子は、<と>と=で記述する演算子すべて)
|
||||
計算順序は、括弧()を使って明示的に変更できます。
|
||||
@@ -163,6 +165,48 @@ waitvb
|
||||
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番目の式が背景色のインデックスです。それぞれ、0~3のみ指定できます。
|
||||
実行開始時の初期状態はcolor 3,0に相当する状態です。
|
||||
Win32版では機能しません。
|
||||
|
||||
palette 式,式,式,式
|
||||
パレットを指定します。最初の式が設定するパレットのインデックス(0~3)を指定します。2番目から4番目の式が、それぞれ、R,G,Bの値を示します。R,G,Bの値はそれぞれ0~15の範囲内です。
|
||||
Win32版では機能しません。
|
||||
例: palette 0,15,0,0
|
||||
|
||||
● 2項演算子
|
||||
+ - * / < > = <= >= <> and or xor
|
||||
|
||||
@@ -177,6 +221,26 @@ rnd(
|
||||
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
|
||||
@@ -202,25 +266,89 @@ scan_y4
|
||||
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というファイルを生成します。実行終了後には削除して構いません。
|
||||
|
||||
・転載
|
||||
未完成品ですので、Internetやパソコン通信などへの転載は不可です。必ずhttp://www.piedey.co.jp/のサイトから入手するようにしてください。
|
||||
・雑誌掲載等
|
||||
ご相談下さい。
|
||||
・商業利用
|
||||
ご相談下さい。
|
||||
・自作ソフトの実行手段としてのワンべぇの添付
|
||||
自作ソフトを配布するためにwonbe.fxを一緒に渡すことを許可します。アーカイブへの同梱、CD-Rメディアなどへの焼き込み、通信ケーブルによる転送、どれも可です。ただし、ワンべぇの動作に関しては何も保証はできませんので、リスクは自分で負ってください。利用にあたっては、ロイヤリティなどはありませんので、報告も送金も必要ありません。
|
||||
● 配布規則
|
||||
このバージョンより、本ソフトは、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.5~2.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に変更
|
||||
375
README.md
Normal file
375
README.md
Normal 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
11
colordemo.wb
Normal 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
290
ctb.wb
Normal 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 ' T 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
|
||||
|
||||
93
keywords.h
93
keywords.h
@@ -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
|
||||
@@ -21,20 +23,38 @@
|
||||
#define KEYWORD_SAVE 0x90
|
||||
#define KEYWORD_LOAD 0x91
|
||||
#define KEYWORD_MERGE 0x92
|
||||
#define KEYWORD_RANDOMIZE 0x93
|
||||
#define KEYWORD_RANDOMIZE 0x93
|
||||
#define KEYWORD_EXIT 0x94
|
||||
#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_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_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 行末ターミネータ
|
||||
|
||||
0x01~0x03を除けば0x0dを単純検索するだけで行末が発見できる
|
||||
|
||||
中間コード
|
||||
0x00 (予約)
|
||||
0x01 次にあるのは10進2バイト整数
|
||||
0x02 次にあるのは16進2バイト整数
|
||||
0x03 次にあるのは可変長文字列 0x00でターミネート
|
||||
0x09 TAB
|
||||
0x0d 行末ターミネータ
|
||||
0x20~0x2f そのコードの記号
|
||||
0x30~0x39 ?
|
||||
0x3a~0x3f そのコードの記号
|
||||
0x40 @
|
||||
0x41~0x5a A~Z その名前の変数を示すシンボル
|
||||
0x5b~0x60 ?
|
||||
0x61~0x7A a~z その名前の変数を示すシンボル
|
||||
0x7b~0x7f ?
|
||||
0x80~0xff キーワードの中間言語表現
|
||||
*/
|
||||
|
||||
/* end of keywords.h */
|
||||
|
||||
4
makefile
4
makefile
@@ -1,13 +1,13 @@
|
||||
INCLUDE=C:\vshare\ww\dev\WWitch\include
|
||||
LIB=..\COMMON
|
||||
|
||||
LIBS=libww.lib runtime.lib
|
||||
LIBS=libww.lib libwwc.lib runtime.lib
|
||||
|
||||
LINKER=..\..\vc15\bin\link
|
||||
CC=..\..\vc15\bin\cl
|
||||
ASM=..\..\vc15\bin\masm
|
||||
|
||||
CFLAGS=/ASw /O /Gs /DWW
|
||||
CFLAGS=/ASw /O /Gs /DWW /DVC15
|
||||
AFLAGS=-Mx -DDISPLAY_MODE_JAPANESE1
|
||||
LFLAGS=/NOD /NOI /MAP
|
||||
|
||||
|
||||
23
makefile.tc
Normal file
23
makefile.tc
Normal 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
|
||||
|
||||
|
||||
20
testcall.wb
Normal file
20
testcall.wb
Normal 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
26
testint.wb
Normal 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
11
testpeekpoke.wb
Normal 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 "テスト完了"
|
||||
107
win32text.c
107
win32text.c
@@ -1,8 +1,11 @@
|
||||
// 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)
|
||||
@@ -282,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -50,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"
|
||||
|
||||
@@ -74,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
|
||||
# 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user