Create your own header file. It became compilable with only Wonx.
Since there is a possibility that the Error () function will collide with libwonx.a when linking, It changed to Wonx_Error (). Added bios_exit (). sprite_set_char, sprite_get_char, palette number minus 8 Fixed bug that was not specified. font_set_monodata (), font_set_colordata (), font_get_data (), disp.c, The arguments of screen_set_char (), screen_get_char (), sprite_set_data () Changed from void * to appropriate type. Sample program and attached SpeedMac. I added a document. Version 0.3 beta - from wonx-b03.tar.gz
This commit is contained in:
parent
0f43e6d6ee
commit
5e1a9795b7
23
HISTORY
23
HISTORY
@ -1,4 +1,25 @@
|
|||||||
wonx-b02
|
2000/11/13(月)
|
||||||
|
|
||||||
|
wonx-b03 公開
|
||||||
|
|
||||||
|
ヘッダファイルを独自に作成.Wonx のみでコンパイル可能になった.
|
||||||
|
libwonx.a のリンク時に Error() 関数がぶつかる可能性があるので,
|
||||||
|
Wonx_Error() に変更した.
|
||||||
|
bios_exit() を追加.
|
||||||
|
sprite_set_char, sprite_get_char で,パレット番号が8を引いた値で
|
||||||
|
指定されていないバグを修正.
|
||||||
|
disp.c の font_set_monodata(), font_set_colordata(), font_get_data(),
|
||||||
|
screen_set_char(), screen_get_char(), sprite_set_data() の引数を
|
||||||
|
void * から適切な型に変更.
|
||||||
|
サンプルプログラムと SpeedMac を添付した.
|
||||||
|
ドキュメントを追加した.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2000/11/3(金)
|
||||||
|
|
||||||
|
wonx-b02 公開
|
||||||
|
|
||||||
割り込み処理の追加.タイマ割り込みサポート.
|
割り込み処理の追加.タイマ割り込みサポート.
|
||||||
(UNIXTimer, WWInterrupt, WWTimer, WonxSystem 追加)
|
(UNIXTimer, WWInterrupt, WWTimer, WonxSystem 追加)
|
||||||
|
|||||||
36
Makefile
36
Makefile
@ -2,11 +2,15 @@ XINCLUDEDIR = /usr/X11R6/include
|
|||||||
INCLUDEDIR = .
|
INCLUDEDIR = .
|
||||||
XLIBDIR = /usr/X11R6/lib
|
XLIBDIR = /usr/X11R6/lib
|
||||||
|
|
||||||
VERSION = Wonx-b02
|
VERSION = Wonx-b03
|
||||||
PKGNAME = wonx-b02
|
PKGNAME = wonx-b03
|
||||||
|
|
||||||
|
SMAC = smac-b02
|
||||||
|
|
||||||
OBJS = WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WWText.o WWInterrupt.o WWTimer.o Wonx.o WonxDisplay.o WonxText.o WonxSystem.o XDisplay.o UNIXTimer.o bank.o comm.o disp.o text.o key.o sound.o system.o timer.o etc.o
|
OBJS = WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WWText.o WWInterrupt.o WWTimer.o Wonx.o WonxDisplay.o WonxText.o WonxSystem.o XDisplay.o UNIXTimer.o bank.o comm.o disp.o text.o key.o sound.o system.o timer.o etc.o
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
.SUFFIXES: .c .o
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
all : libwonx.a
|
all : libwonx.a
|
||||||
@ -16,16 +20,38 @@ libwonx.a : $(OBJS)
|
|||||||
# ranlib libwonx.a
|
# ranlib libwonx.a
|
||||||
|
|
||||||
.c.o : $*.c
|
.c.o : $*.c
|
||||||
gcc -c $*.c -O -Wall -I$(INCLUDEDIR) -I$(XINCLUDEDIR)
|
$(CC) -c $*.c -O -Wall -I$(INCLUDEDIR) -I$(XINCLUDEDIR)
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -f libwonx.a *.o
|
rm -f libwonx.a sample1 sample2 *.o
|
||||||
|
|
||||||
|
sample1 : libwonx.a sample1.o
|
||||||
|
$(CC) sample1.o -o sample1 \
|
||||||
|
-L. -L/usr/X11R6/lib -lwonx -lX11 -lXt
|
||||||
|
|
||||||
|
sample2 : libwonx.a sample2.o
|
||||||
|
$(CC) sample2.o -o sample2 \
|
||||||
|
-L. -L/usr/X11R6/lib -lwonx -lX11 -lXt
|
||||||
|
|
||||||
|
smac : libwonx.a
|
||||||
|
unzip $(SMAC).zip
|
||||||
|
cp -R wonx_include $(SMAC)
|
||||||
|
cp libwonx.a $(SMAC)
|
||||||
|
mv $(SMAC)/makefile $(SMAC)/makefile.orig
|
||||||
|
cp makefile_for_smac $(SMAC)/makefile
|
||||||
|
cp sys2wonx.pl $(SMAC)
|
||||||
|
echo "ここで止まったときは,sys2wonx.pl の1行目に適切なperlを指定してください"
|
||||||
|
cd $(SMAC) ; ./sys2wonx.pl *.[ch]
|
||||||
|
cd $(SMAC) ; $(MAKE)
|
||||||
|
|
||||||
package :
|
package :
|
||||||
mkdir -p $(PKGNAME)
|
mkdir -p $(PKGNAME)
|
||||||
rm -fR $(PKGNAME)/*
|
rm -fR $(PKGNAME)/*
|
||||||
|
mkdir -p $(PKGNAME)/wonx_include
|
||||||
cp COPYING COPYRIGHT HISTORY README OMAKE.jpn Makefile \
|
cp COPYING COPYRIGHT HISTORY README OMAKE.jpn Makefile \
|
||||||
*.h *.c $(PKGNAME)
|
makefile_for_smac sys2wonx.pl \
|
||||||
|
*.h *.c smac*.zip $(PKGNAME)
|
||||||
|
cp wonx_include/*.h $(PKGNAME)/wonx_include
|
||||||
tar cvzf $(PKGNAME).tar.gz $(PKGNAME)
|
tar cvzf $(PKGNAME).tar.gz $(PKGNAME)
|
||||||
|
|
||||||
# End of Makefile.
|
# End of Makefile.
|
||||||
|
|||||||
350
README
350
README
@ -1,28 +1,27 @@
|
|||||||
Wonx - WonderWitch on X.
|
Wonx - WonderWitch on X.
|
||||||
|
|
||||||
■ αバージョン配布に当たって
|
■ 配布に当たって
|
||||||
|
|
||||||
Wonx はまだ不完全なαバージョンです.実装されていない機能や,
|
Wonx はまだ不完全です.実装されていない機能や,不完全な機能,おかしな
|
||||||
不完全な機能,おかしな動作をする部分などがいっぱいあります.
|
動作をする部分などがいっぱいあります.
|
||||||
バグ情報やアドバイスがあれば,作者の坂井弘亮まで,どんどんメールください.
|
バグ情報やアドバイスがあれば,作者の坂井弘亮まで,どんどんメールください.
|
||||||
アドレスは,
|
アドレスは,
|
||||||
sakai@seki.ee.kagu.sut.ac.jp
|
sakai@seki.ee.kagu.sut.ac.jp
|
||||||
hsakai@pfu.co.jp
|
hsakai@pfu.co.jp
|
||||||
です.
|
です.
|
||||||
また,リリース版ができるまでは,アップデートは頻繁に行っていきます.
|
また,坂井の気が向く限り,アップデートは随時行っていきます.
|
||||||
http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
|
http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
|
||||||
で,随時公開していきます.
|
で,随時公開していきます.
|
||||||
|
|
||||||
現在は坂井が一人で製作していますが,ひとりでは細かい点の整合性
|
現在は坂井が一人で製作していますが,ひとりでは細かい点の整合性
|
||||||
(初期化しなかった場合の動作の違いなど.WonderWitch と Wonx では
|
(初期化しなかった場合の動作の違いなど.WonderWitch と Wonx では
|
||||||
微妙に異なっていると思う)を追いきれないのが現状です.
|
微妙に異なっている)を追いきれないのが現状です.
|
||||||
とくにマニュアルに書いてない部分に関しては,WonderWitch ではどのように
|
とくにマニュアルに書いてない部分に関しては,WonderWitch ではどのように
|
||||||
動作するのか,ひとりではチェックしきれません.
|
動作するのか,ひとりではチェックしきれません.(ていうか面倒)
|
||||||
情報をお待ち(ていうか期待)しています(そのためのα版配布です).
|
情報をお待ち(ていうか期待)しています.
|
||||||
いっしょに少しずつ,完全なものに仕上げていきましょう.
|
いっしょに少しずつ,完全なものに仕上げていきましょう.
|
||||||
|
|
||||||
広く情報を募るために,早い段階でα版として公開します.ご意見,ご要望なども
|
ご意見,ご要望なども歓迎します.どしどしお寄せください.
|
||||||
歓迎します.どしどしお寄せください.
|
|
||||||
(ただし,返事を書くとは限らないし,要望を反映するとも限りませんので
|
(ただし,返事を書くとは限らないし,要望を反映するとも限りませんので
|
||||||
その点はご容赦ください)
|
その点はご容赦ください)
|
||||||
|
|
||||||
@ -47,29 +46,64 @@ Wonx
|
|||||||
・描画速度は遅いが,デバッグ目的のためなので,速度を速くすることは
|
・描画速度は遅いが,デバッグ目的のためなので,速度を速くすることは
|
||||||
あまり考えていない.(それよりも上記のデバッグ性を優先する)
|
あまり考えていない.(それよりも上記のデバッグ性を優先する)
|
||||||
・WonderWitch 用のプログラムを,X上で楽しむためのものではない.
|
・WonderWitch 用のプログラムを,X上で楽しむためのものではない.
|
||||||
|
また,エミュレーションが目的なのではない.
|
||||||
あくまでデバッグ目的のもの.(そういうポリシーで開発を進める)
|
あくまでデバッグ目的のもの.(そういうポリシーで開発を進める)
|
||||||
|
従って,WonderWitch での動作を模倣することよりも,デバッグ情報を
|
||||||
|
出力することや改造のしやすさを優先したような実装をする場合がある.
|
||||||
|
|
||||||
■ 足りないもの
|
■ 3分wonx
|
||||||
|
|
||||||
以下のものにはまだ対応してません.したがって,例えばサウンド関連の
|
とりあえず,どんなものか見てみたいことでしょう.そんな人は,
|
||||||
関数を呼び出しても,何も起こりません.(空の関数になっている)
|
サンプルプログラムをコンパイル・実行してみましょう.
|
||||||
|
以下のようにしてみてください.
|
||||||
|
|
||||||
・文字表示関連 (ターミナルにそのまま出力する)
|
~>% tar xvzf wonx.tgz
|
||||||
とくに,文字だけでタイトル画面を書いてるゲームの場合などは,
|
(中略)
|
||||||
なにも表示されないことになってしまうので注意してください.
|
~>% cd wonx
|
||||||
(正常に動作していても,画面が真っ白で固まっているように見えてしまう)
|
|
||||||
・画面周りの細かいところ(ウインドウ機能など)
|
|
||||||
・サウンド
|
|
||||||
・シリアルポート
|
|
||||||
・割り込み処理関連
|
|
||||||
割り込みを使用している場合は注意してください.そのままではまともに
|
|
||||||
動かないでしょう.
|
|
||||||
そのうちシグナル使ってなんとかサポートしたいと思います.
|
|
||||||
|
|
||||||
■ Wonx概要
|
~/wonx>% make sample1
|
||||||
|
(中略)
|
||||||
|
~/wonx>% ./sample1
|
||||||
|
|
||||||
|
ウインドウが開いて,標準出力にメッセージが出力されます.
|
||||||
|
スペース・バーを押すと,終了します.
|
||||||
|
|
||||||
|
~/wonx>% make sample2
|
||||||
|
(中略)
|
||||||
|
~/wonx>% ./sample2
|
||||||
|
|
||||||
|
カーソルキーの上下で,キャラクタを移動します.
|
||||||
|
スペース・バーを押すと,終了します.
|
||||||
|
|
||||||
|
~/wonx>% more sample1.c
|
||||||
|
~/wonx>% more sample2.c
|
||||||
|
|
||||||
|
で,サンプルプログラムのリストを見てみましょう.
|
||||||
|
|
||||||
|
次に,WonderWitch 用のゲーム,"SpeedMac" をコンパイル・実行してみます.
|
||||||
|
|
||||||
|
~/wonx>% make smac
|
||||||
|
(中略)
|
||||||
|
~/wonx>% cd smac
|
||||||
|
~/wonx/smac>% ./smac
|
||||||
|
|
||||||
|
ウインドウが開いて,標準出力にメッセージが出力されます.
|
||||||
|
いったん p を押して画面描画を OFF にします.しばらくしたら
|
||||||
|
(メッセージの内容が変わったら) p を押して再び画面表示を ON にすると,
|
||||||
|
smac のタイトル画面が表示されます.
|
||||||
|
ここでスペースを押して,さらにまた p で画面表示を OFF にして,
|
||||||
|
しばらくしたら(メッセージの内容が変わったら) p で画面表示を ON にします.
|
||||||
|
どうですか? SpeedMac のゲーム画面が表示されているでしょうか?
|
||||||
|
カーソルキーで移動,スペースキーで射撃です.
|
||||||
|
ただし,キー入力はキー入力用関数が呼ばれたときしか有効ではないので,
|
||||||
|
キーは反応するまで長めに押してください.
|
||||||
|
p を押して頻繁に描画の ON, OFF を切替えるのは,描画が非常に遅いため,
|
||||||
|
ONのままだと画面クリアとかに異常に時間がかかるからです.
|
||||||
|
|
||||||
|
■ Wonx 概要
|
||||||
|
|
||||||
Wonx は,WonderWitch の display_control() とか display_status() といった
|
Wonx は,WonderWitch の display_control() とか display_status() といった
|
||||||
関数(システムコール)と互換の関数を持っています.
|
関数(BIOS に対するシステムコール)と代替の関数を持っています.
|
||||||
これらの関数は,X上にウインドウを開いて,そこで WonderWitch と互換の動作を
|
これらの関数は,X上にウインドウを開いて,そこで WonderWitch と互換の動作を
|
||||||
するように書いてあります.
|
するように書いてあります.
|
||||||
|
|
||||||
@ -78,18 +112,47 @@ Wonx
|
|||||||
WonderWitch の display_control() とかのかわりに,Wonx の display_control() が
|
WonderWitch の display_control() とかのかわりに,Wonx の display_control() が
|
||||||
リンクされ,X 上で動作するようになる,という仕組みです.
|
リンクされ,X 上で動作するようになる,という仕組みです.
|
||||||
|
|
||||||
■ インストール
|
■ ヘッダファイルについて
|
||||||
|
|
||||||
インストールするには,以下のことを行う必要があります.
|
Wonx は,UNIXシステム上にある libc を使用します.つまり,/usr/include の
|
||||||
|
下を include します.
|
||||||
|
また,WonderWitch には,sys/types.h などといったヘッダファイルがあります.
|
||||||
|
よって,WonderWitch のヘッダファイル構成をそのまま Wonx に引き継ぐと,
|
||||||
|
Wonx のヘッダファイルと UNIX のヘッダファイルがコンフリクトする
|
||||||
|
可能性が出てきます.
|
||||||
|
(たとえば,WonderWitch の sys/types.h と /usr/include/sys/types が
|
||||||
|
コンフリクトする,などです)
|
||||||
|
これは,WonderWitch用のアプリケーションをコンパイルするときに,要注意です.
|
||||||
|
コンパイルがうまくとおらないという障害の原因は,ほとんどがこのような,
|
||||||
|
「ヘッダファイルのコンフリクトもしくは誤認」に起因しています.
|
||||||
|
|
||||||
・Wonx のコンパイルには,WonderWitch 付属のヘッダファイル(sys/disp.h とか)が
|
対策として,Wonx では wonx_include というディレクトリの下にヘッダファイルを
|
||||||
必要なので,それらをコピーします.
|
格納してあります.(本当は sys というディレクトリにしたかったが,
|
||||||
・Wonx をコンパイルします.→ libwonx.a ができあがります.
|
上記の対策のため,このようにした)
|
||||||
・ヘッダファイル(sys/disp.h とか)と libwonx.a を,適切なディレクトリに
|
WonderWitch 用プログラム中の,
|
||||||
置きます.
|
#include <sys/types.h>
|
||||||
(アプリケーションのコンパイルには,WonderWitch 付属のヘッダファイルが必要)
|
のような部分は,すべて,
|
||||||
|
#include <wonx_include/types.h>
|
||||||
|
のように修正する必要があります.
|
||||||
|
(stdio.h や stdlib.h は,UNIX システム付属のものを使用するので,
|
||||||
|
そのままでかまいません)
|
||||||
|
(ただし,コンフリクトしないという絶対の自信があるなら,この限りではありません)
|
||||||
|
WonderWitch のプログラムの,#include <sys/*.h> は,すべて
|
||||||
|
#include <wonx_include/*.h> に修正する必要がある,ということです.
|
||||||
|
(これをまとめて行うための perl スクリプトを添付してあります.
|
||||||
|
sys2wonx.pl *.[ch] を実行すると,ごっそりと書き換えてくれます)
|
||||||
|
|
||||||
インストールは,以下の手順で行います.
|
また,UNIXシステムによっては,/usr/include/sys/types.h で ushort, ulong を
|
||||||
|
定義しているものといないものがあります.よって,コンパイル中に
|
||||||
|
ulong が2重定義されているとおこられる場合があります.
|
||||||
|
このあたりの微調整には,wonx_include 以下のファイルを直接修正して
|
||||||
|
調整してください.wonx_include/system_configure.h を修正することにより,
|
||||||
|
調整できるようになってます.
|
||||||
|
|
||||||
|
■ Wonx のコンパイル
|
||||||
|
|
||||||
|
まず Wonx をコンパイルして,libwonx.a を作成する必要があります.
|
||||||
|
Wonx のコンパイルは,以下の手順で行います.
|
||||||
|
|
||||||
1. Wonx を展開する.
|
1. Wonx を展開する.
|
||||||
|
|
||||||
@ -97,40 +160,7 @@ WonderWitch
|
|||||||
~>% cd wonx
|
~>% cd wonx
|
||||||
~/wonx>%
|
~/wonx>%
|
||||||
|
|
||||||
2. WonderWitch 付属のヘッダファイルをコピーする.
|
2. Wonx を make する.
|
||||||
|
|
||||||
~/wonx>% mkdir sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/bank.h sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/comm.h sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/disp.h sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/key.h sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/sound.h sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/system.h sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/text.h sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/timer.h sys
|
|
||||||
~/wonx>% cp ~/WWitch/include/types.h sys
|
|
||||||
|
|
||||||
3. 以下の内容のファイル(sys/service.h)を作成する.
|
|
||||||
|
|
||||||
~/wonx>% emacs sys/service.h
|
|
||||||
|
|
||||||
==== ここから ====
|
|
||||||
#ifndef _service_h_INCLUDED_
|
|
||||||
#define _service_h_INCLUDED_
|
|
||||||
|
|
||||||
#define far /* None */
|
|
||||||
#define near /* None */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
==== ここまで ====
|
|
||||||
|
|
||||||
sys/service.h は,disp.h などの中から,
|
|
||||||
#include <sys/service.h>
|
|
||||||
のようにしてインクルードされますが,コンパイル時には -I. でコンパイル
|
|
||||||
されるので,ばあいによっては,sys/sys/service.h にする必要があるかも
|
|
||||||
しれません.(未確認)
|
|
||||||
|
|
||||||
4. Wonx を make する.
|
|
||||||
|
|
||||||
~/wonx>% make
|
~/wonx>% make
|
||||||
gcc -c WWCharacter.c -O -I. -I/usr/X11R6/include
|
gcc -c WWCharacter.c -O -I. -I/usr/X11R6/include
|
||||||
@ -142,61 +172,99 @@ ar ruc libwonx.a WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o
|
|||||||
libwonx.a
|
libwonx.a
|
||||||
~/wonx>%
|
~/wonx>%
|
||||||
|
|
||||||
ここまでで,ライブラリとヘッダファイルの作成は終りです.
|
ここまでで,ライブラリの作成は終りです.
|
||||||
|
|
||||||
■ WonderWitch 用アプリケーションのコンパイル
|
■ WonderWitch 用アプリケーションのコンパイル
|
||||||
|
|
||||||
拙作の SpeedMac をコンパイルしてみます.
|
次に,Wonx の利用の例として,拙作の SpeedMac という WonderWitch 用の
|
||||||
|
ゲームをコンパイルしてみます.
|
||||||
|
(SpeedMac はサンプルプログラムとして,Wonx に標準添付してあります)
|
||||||
|
SpeedMac は WonderWitch 用のゲームプログラムです.本来は WonderWitch を
|
||||||
|
使用してコンパイルし,WonderSwan 上でゲームを楽しむためのものです.
|
||||||
|
今回は例として,SpeedMac に Wonx をリンクして,X 上で動作する SpeedMac の
|
||||||
|
実行形式を作成してみます.
|
||||||
|
|
||||||
1. 展開する.
|
1. 展開する.
|
||||||
|
|
||||||
~/wonx>% cd
|
~/wonx>% unzip smac-b02.zip
|
||||||
~>% unzip xvzf smac-b02.zip
|
|
||||||
...(中略)...
|
...(中略)...
|
||||||
~>% cd smac-b02
|
~/wonx>% cd smac-b02
|
||||||
~/smac-b02>%
|
~/wonx/smac-b02>%
|
||||||
|
|
||||||
2. ヘッダファイルと libwonx.a をコピーする.
|
2. ヘッダファイルと libwonx.a をコピーする.
|
||||||
|
|
||||||
~/smac-b02>% mkdir sys
|
~/wonx/smac-b02>% cp -R ../wonx_include .
|
||||||
~/smac-b02>% cp ~/wonx/sys/* ./sys
|
~/wonx/smac-b02>% cp ../libwonx.a .
|
||||||
~/smac-b02>% cp ~/wonx/libwonx.a .
|
~/wonx/smac-b02>%
|
||||||
~/smac-b02>%
|
|
||||||
|
|
||||||
3. Makefile を修正する.
|
3. makefile を修正する.
|
||||||
|
|
||||||
~/smac-b02>% emacs Makefile
|
~/wonx/smac-b02>% emacs makefile
|
||||||
|
|
||||||
以下のように修正します.
|
以下のように修正します.
|
||||||
|
|
||||||
・gcc でコンパイルをするように修正する.このときに,コンパイルオプションに,
|
・gcc でコンパイルをするように修正する.このときに,コンパイルオプションに,
|
||||||
-I. -I/usr/X11R6/include -L. -L/usr/X11R6/lib -lwonx -lX11 -lXt
|
-I. -L. -L/usr/X11R6/lib -lwonx -lX11 -lXt
|
||||||
を追加する.
|
を追加する.
|
||||||
(必要なら,-g も追加する)
|
(必要なら,-g も追加する)
|
||||||
・mkfent によるファイルのコンバートなどがあったら,削除する.
|
・mkfent によるファイルのコンバートなどがあったら,削除する.
|
||||||
|
|
||||||
4. make する.
|
修正後の makefile を添付してあるので,面倒なかたは手で編集するかわりに,
|
||||||
|
|
||||||
~/smac-b02>% make
|
~/wonx/smac-b02>% mv makefile makefile.orig
|
||||||
|
~/wonx/smac-b02>% cp ../makefile_for_smac ./makefile
|
||||||
|
|
||||||
|
のようにしてコピーしてください.
|
||||||
|
|
||||||
|
4. ソースを修正する.
|
||||||
|
|
||||||
|
~/wonx/smac-b02>% emacs chara.c
|
||||||
|
~/wonx/smac-b02>% emacs dsp.c
|
||||||
|
... (ファイルをひとつひとつ修正する)
|
||||||
|
|
||||||
|
ソース中の,
|
||||||
|
#include <sys/disp.h>
|
||||||
|
#include <sys/key.h>
|
||||||
|
のような部分を,
|
||||||
|
#include "wonx_include/disp.h"
|
||||||
|
#include "wonx_include/key.h"
|
||||||
|
のように修正します.
|
||||||
|
|
||||||
|
これをまとめてやるための perl スクリプト (sys2wonx.pl) を添付してあるので,
|
||||||
|
面倒なかたは,
|
||||||
|
~/wonx/smac-b02>% cp ../sys2wonx.pl .
|
||||||
|
~/wonx/smac-b02>% ./sys2wonx.pl *.[ch]
|
||||||
|
のようにしてください.
|
||||||
|
(sys2wonx.pl は,引数で指定したファイル自体を書き換えてしまうので注意)
|
||||||
|
|
||||||
|
5. make する.
|
||||||
|
|
||||||
|
~/wonx/smac-b02>% make
|
||||||
gcc -c chara.c -g -I.
|
gcc -c chara.c -g -I.
|
||||||
gcc -c game.c -g -I.
|
gcc -c game.c -g -I.
|
||||||
...(中略)...
|
...(中略)...
|
||||||
gcc -c main.c -g -I.
|
gcc -c main.c -g -I.
|
||||||
gcc -g -o smac chara.o game.o man.o mansub.o mansub2.o map.o mapsub.o menu.o monster.o picture.o player.o smac.o stage.o dsp.o etc.o main.o -lwonx -lX11 -lXt -L. -L/usr/X11R6/lib
|
gcc -g -o smac chara.o game.o man.o mansub.o mansub2.o map.o mapsub.o menu.o monster.o picture.o player.o smac.o stage.o dsp.o etc.o main.o -lwonx -lX11 -lXt -L. -L/usr/X11R6/lib
|
||||||
~/smac-b02>% ls smac
|
~/wonx/smac-b02>% ls smac
|
||||||
smac
|
smac
|
||||||
~/smac-b02>%
|
~/wonx/smac-b02>%
|
||||||
|
|
||||||
5. smac を起動する.
|
6. smac を起動する.
|
||||||
|
|
||||||
~/smac-b02>% ./smac
|
~/wonx/smac-b02>% ./smac
|
||||||
|
|
||||||
|
と,ここまでけっこう面倒ですが,実は,
|
||||||
|
|
||||||
|
~/wonx>% make smac
|
||||||
|
|
||||||
|
すると,これらの作業を全部やってくれるようになってます.
|
||||||
|
|
||||||
■ 操作
|
■ 操作
|
||||||
|
|
||||||
smac を起動すると,ウインドウが開きます.また,ターミナルには,
|
smac を起動すると,ウインドウが開きます.また,ターミナルには,
|
||||||
以下のデバッグ用の情報が表示されます.
|
以下のデバッグ用の情報が表示されます.
|
||||||
|
|
||||||
・WonderWitch の互換関数が呼ばれると,引数と戻り値を表示します.
|
・WonderWitch の代替関数が呼ばれると,引数と戻り値を表示します.
|
||||||
|
|
||||||
またここでは,以下の操作が行えます.
|
またここでは,以下の操作が行えます.
|
||||||
|
|
||||||
@ -211,9 +279,11 @@ smac
|
|||||||
・F3 を押すと,キャラクターのデータをダンプ出力する.
|
・F3 を押すと,キャラクターのデータをダンプ出力する.
|
||||||
・F4 を押すと,スプライトのデータをダンプ出力する.
|
・F4 を押すと,スプライトのデータをダンプ出力する.
|
||||||
|
|
||||||
標準ではなにか関数が呼ばれるたびに画面の再描画を行うため,非常に低速です.
|
デフォルトではなにか関数が呼ばれるたびに画面の再描画を行うため,
|
||||||
|
非常に低速です.
|
||||||
たとえば,以下のようなことをやっていると,非常に低速になります.
|
たとえば,以下のようなことをやっていると,非常に低速になります.
|
||||||
|
|
||||||
|
/* 画面のクリア */
|
||||||
for (y = 0; y < 32; y++)
|
for (y = 0; y < 32; y++)
|
||||||
for (x = 0; x < 32; x++) {
|
for (x = 0; x < 32; x++) {
|
||||||
screen_fill_char(0, x, y, 1, 1, 0x0000); /* ここで毎回再描画される */
|
screen_fill_char(0, x, y, 1, 1, 0x0000); /* ここで毎回再描画される */
|
||||||
@ -236,8 +306,8 @@ smac
|
|||||||
|
|
||||||
> smac | grep "character\[10\]"
|
> smac | grep "character\[10\]"
|
||||||
|
|
||||||
wonx は,メッセージを出力する再に,grep でフィルタリングできるように,
|
wonx は,メッセージを出力する際に,grep でフィルタリングできるように,
|
||||||
かならず行の先頭に統一性のある文字列を追加しています.
|
かならず出力メッセージの先頭に,統一性のある文字列を追加しています.
|
||||||
たとえば,関数呼び出し時に表示されるメッセージには,先頭に必ず
|
たとえば,関数呼び出し時に表示されるメッセージには,先頭に必ず
|
||||||
"call" という文字列が追加されてます.よって,grep -v call を通せば,
|
"call" という文字列が追加されてます.よって,grep -v call を通せば,
|
||||||
関数呼び出しのメッセージがごっそり出なくなる,というようになってます.
|
関数呼び出しのメッセージがごっそり出なくなる,というようになってます.
|
||||||
@ -249,10 +319,99 @@ wonx
|
|||||||
|
|
||||||
のようにして,ログをとるのも有効でしょう.
|
のようにして,ログをとるのも有効でしょう.
|
||||||
|
|
||||||
|
> smac > /dev/null
|
||||||
|
|
||||||
|
だと,文字列を kterm などに表示しないぶん,高速になります.
|
||||||
|
|
||||||
|
■ 足りないもの
|
||||||
|
|
||||||
|
以下のものにはまだ対応してません.したがって,例えばサウンド関連の
|
||||||
|
関数を呼び出しても,何も起こりません.(空の関数になっている)
|
||||||
|
|
||||||
|
・サウンド
|
||||||
|
・シリアル通信
|
||||||
|
・その他いっぱい
|
||||||
|
|
||||||
|
■ 注意しなければならないこと
|
||||||
|
|
||||||
|
Wonx は,本来は WonderWitch 用として書かれた(もしくは,書かれる)プログラムを,
|
||||||
|
UNIX 上でコンパイル・リンクするためのライブラリであり,ハードウエアを
|
||||||
|
エミュレートするものではありません.
|
||||||
|
ですから,WonderWitch と UNIX 上のC言語のギャップのため,気をつけなければ
|
||||||
|
ならないことがいくつかあります.これらは Wonx の性質上,仕方の無いことです.
|
||||||
|
|
||||||
|
以下のことは,意識することと,きれいなプログラムを書くことで,
|
||||||
|
かなり回避できると思います.(short int にすべきところでは,省略せずに
|
||||||
|
ちゃんと short int と明示するとか)
|
||||||
|
|
||||||
|
まあ,Wonx の目的は論理的なバグを早い段階で無くすことにあるので,このへんは
|
||||||
|
そういうものだと割り切って使ってください.
|
||||||
|
Wonx を使う限り,なるべく機種依存を無くすように心がけましょう.
|
||||||
|
(とくに int のサイズにあまり依存しないようにしましょう)
|
||||||
|
|
||||||
|
[コンパイルの問題]
|
||||||
|
|
||||||
|
先にも書きましたが,コンパイルできないという障害が出たら,原因はたいていは
|
||||||
|
ヘッダファイルのコンフリクトです.とくに,WonderWitch で sys 以下の
|
||||||
|
ファイルをインクルードしている場合は注意してください.
|
||||||
|
ushort, ulong などは,sys/types.h で定義されているシステムもあるし,
|
||||||
|
そうでないシステムもあります.このへんは,wonx_include/system_configure.h で
|
||||||
|
調整してください.
|
||||||
|
(FreeBSD では ushort のみ定義されているが,RedHat Linux では,
|
||||||
|
uchort, ulong ともに定義されているので,そのままだとコンパイル中に
|
||||||
|
2重定義のワーニングが出ます)
|
||||||
|
|
||||||
|
[int 型の扱い]
|
||||||
|
|
||||||
|
WonderWitch では sizeof(short int) == sizeof(int) < sizeof(long int) ですが,
|
||||||
|
UNIX ではふつう sizeof(short int) < sizeof(int) == sizeof(long int) です.
|
||||||
|
このことは,int 型を単なるカウンタとして使用するような場合には問題に
|
||||||
|
なりませんが,ビットマップの格納場所として使用するようなときには,
|
||||||
|
問題になります.
|
||||||
|
一番問題になりやすいのは,キャラクタのビットマップを扱う場合です.
|
||||||
|
font_set_colordata()などは,16*8 バイトのキャラクタデータを
|
||||||
|
short int 型の配列として引数に持ちます.WonderWitch では
|
||||||
|
sizeof(short int) == sizeof(int) なので,WonderWitch 用のプログラム上では,
|
||||||
|
キャラクタデータを short int とせずに,int 型の配列として定義してしまう
|
||||||
|
ことが考えられます.(当然 WonderWitch ならば問題は無いが,UNIX 上で
|
||||||
|
実行したら,キャラクタに妙な縞々が入るだろうと思われる)
|
||||||
|
このような場合には,UNIX 上でコンパイルするときには,short int に
|
||||||
|
修正する必要があります.
|
||||||
|
|
||||||
|
[エンディアンの問題]
|
||||||
|
|
||||||
|
WonderWitch の CPU は x86系です.SPARC などで使用する場合には,
|
||||||
|
エンディアンに注意する必要があります.
|
||||||
|
font_set_colordata()などは,short int 型の配列でキャラクタデータを受け取る
|
||||||
|
ので,char * で定義したキャラクタデータを short int * にキャストして
|
||||||
|
font_set_colordata()に渡すなどのことをしていると,画像がひっくり返る
|
||||||
|
ことが考えられます.
|
||||||
|
i386 系の PC-UNIX ならば,おそらく問題は無いでしょう.
|
||||||
|
|
||||||
|
[割り込みの問題]
|
||||||
|
|
||||||
|
WonderWitch にはタイマ割り込みがありますが,Wonx の動作は非常に遅いため,
|
||||||
|
WonderWitch の時間単位をそのまま UNIX に持ってきたら,割り込みが
|
||||||
|
かかりっぱなしになってしまいます.よってタイマ割り込みの時間単位は,
|
||||||
|
WonderWitch よりもかなり大きめにしてあります.
|
||||||
|
これは,wonx_configure.h で調整できます.
|
||||||
|
割り込みハンドラの中で,非常に時間のかかる画面描画などをしている
|
||||||
|
場合には,割り込みの時間単位を大きくしてください.でないと,ハンドラから
|
||||||
|
戻った瞬間にまたハンドラが呼ばれて,全然実行が先に進まない,ということに
|
||||||
|
なり得ます.
|
||||||
|
|
||||||
|
[キー入力について]
|
||||||
|
|
||||||
|
キー入力は,キー入力用関数が呼ばれたときのみ感知するので,長めに押してないと
|
||||||
|
反応しないことがあります.
|
||||||
|
反応しないからといってなんども押すのでなく,1回を長く確実に押すように
|
||||||
|
してください.
|
||||||
|
|
||||||
■ 作者
|
■ 作者
|
||||||
|
|
||||||
Wonx は,坂井弘亮が通勤電車の中で Libretto で書いた作品です.
|
Wonx は,坂井弘亮がその大部分を往復3時間の通勤電車の中で Libretto で書いた,
|
||||||
GPLで配布します.
|
「電車ソフトウエア」です.GPLで配布します.
|
||||||
|
作者については,添付の OMAKE.jpn を参照してください.
|
||||||
|
|
||||||
坂井弘亮の連絡先のメールアドレスは,
|
坂井弘亮の連絡先のメールアドレスは,
|
||||||
sakai@seki.ee.kagu.sut.ac.jp
|
sakai@seki.ee.kagu.sut.ac.jp
|
||||||
@ -260,5 +419,10 @@ hsakai@pfu.co.jp
|
|||||||
です.また,本ソフトウエアの最新版を,
|
です.また,本ソフトウエアの最新版を,
|
||||||
http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
|
http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
|
||||||
で配布しています.
|
で配布しています.
|
||||||
|
以下はミラーサイトです.
|
||||||
|
http://hp.vector.co.jp/authors/VA014157/index.html
|
||||||
|
http://www.people.or.jp/~hsakai/index.html
|
||||||
|
ミラーサイトは,坂井が気が向いたときにアップデートするので,常に最新,
|
||||||
|
というわけではありません.あくまでバックアップ用です.
|
||||||
|
|
||||||
■ このファイルはここまで
|
■ このファイルはここまで
|
||||||
|
|||||||
@ -150,7 +150,7 @@ int UNIXTimer_Pause(UNIXTimer unix_timer)
|
|||||||
int UNIXTimer_Unpause(UNIXTimer unix_timer)
|
int UNIXTimer_Unpause(UNIXTimer unix_timer)
|
||||||
{
|
{
|
||||||
if (unix_timer->pause == 0)
|
if (unix_timer->pause == 0)
|
||||||
Error("UNIXTimer_Unpause", "Duplicated unpause.");
|
Wonx_Error("UNIXTimer_Unpause", "Duplicated unpause.");
|
||||||
|
|
||||||
if (unix_timer->pause == 1) {
|
if (unix_timer->pause == 1) {
|
||||||
if (unix_timer->interrupt_in_pause > 0) {
|
if (unix_timer->interrupt_in_pause > 0) {
|
||||||
@ -243,7 +243,7 @@ UNIXTimer UNIXTimer_Create(int auto_preset, int interval, void * parameter,
|
|||||||
|
|
||||||
unix_timer = (UNIXTimer)malloc(sizeof(_UNIXTimer));
|
unix_timer = (UNIXTimer)malloc(sizeof(_UNIXTimer));
|
||||||
if (unix_timer == NULL)
|
if (unix_timer == NULL)
|
||||||
Error("UNIXTimer_Create", "Cannot allocate memory.");
|
Wonx_Error("UNIXTimer_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
unix_timer->timer_on = 0;
|
unix_timer->timer_on = 0;
|
||||||
unix_timer->pause = 0;
|
unix_timer->pause = 0;
|
||||||
@ -281,7 +281,7 @@ UNIXTimer UNIXTimer_Create(int auto_preset, int interval, void * parameter,
|
|||||||
UNIXTimer UNIXTimer_Destroy(UNIXTimer unix_timer)
|
UNIXTimer UNIXTimer_Destroy(UNIXTimer unix_timer)
|
||||||
{
|
{
|
||||||
if (unix_timer == NULL)
|
if (unix_timer == NULL)
|
||||||
Error("UNIXTimer_Destroy", "Object is not created.");
|
Wonx_Error("UNIXTimer_Destroy", "Object is not created.");
|
||||||
|
|
||||||
UNIXTimer_OFF(unix_timer);
|
UNIXTimer_OFF(unix_timer);
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
int WWCharacter_GetNumber(WWCharacter c)
|
int WWCharacter_GetNumber(WWCharacter c)
|
||||||
{
|
{
|
||||||
if (c == NULL) Error("WWCharacter_GetNumber()", "WWCharacter is NULL.");
|
if (c == NULL) Wonx_Error("WWCharacter_GetNumber()", "WWCharacter is NULL.");
|
||||||
|
|
||||||
return (c->number);
|
return (c->number);
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ int WWCharacter_GetNumber(WWCharacter c)
|
|||||||
int WWCharacter_SetNumber(WWCharacter c, int n)
|
int WWCharacter_SetNumber(WWCharacter c, int n)
|
||||||
{
|
{
|
||||||
if ((n < 0) || (n >= 512))
|
if ((n < 0) || (n >= 512))
|
||||||
Error("WWCharacter_SetNumber()", "Invalid range.");
|
Wonx_Error("WWCharacter_SetNumber()", "Invalid range.");
|
||||||
|
|
||||||
return (c->number = n);
|
return (c->number = n);
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ WWCharacter WWCharacter_Create(int number, unsigned char * bitmap)
|
|||||||
|
|
||||||
character = (WWCharacter)malloc(sizeof(_WWCharacter));
|
character = (WWCharacter)malloc(sizeof(_WWCharacter));
|
||||||
if (character == NULL)
|
if (character == NULL)
|
||||||
Error("WWCharacter_Create", "Cannot allocate memory.");
|
Wonx_Error("WWCharacter_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWCharacter_SetNumber(character, number);
|
WWCharacter_SetNumber(character, number);
|
||||||
WWCharacter_SetBitmap(character, bitmap);
|
WWCharacter_SetBitmap(character, bitmap);
|
||||||
@ -41,17 +41,22 @@ WWCharacter WWCharacter_Create(int number, unsigned char * bitmap)
|
|||||||
WWCharacter WWCharacter_Destroy(WWCharacter character)
|
WWCharacter WWCharacter_Destroy(WWCharacter character)
|
||||||
{
|
{
|
||||||
if (character == NULL)
|
if (character == NULL)
|
||||||
Error("WWCharacter_Destroy()", "WWCharacter is NULL.");
|
Wonx_Error("WWCharacter_Destroy()", "WWCharacter is NULL.");
|
||||||
free(character);
|
free(character);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char * WWCharacter_GetBitmap(WWCharacter character)
|
||||||
|
{
|
||||||
|
return (character->bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
int WWCharacter_SetBitmap(WWCharacter character, unsigned char * bitmap)
|
int WWCharacter_SetBitmap(WWCharacter character, unsigned char * bitmap)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (character == NULL)
|
if (character == NULL)
|
||||||
Error("WWCharacter_SetBitmap()", "WWCharacter is NULL.");
|
Wonx_Error("WWCharacter_SetBitmap()", "WWCharacter is NULL.");
|
||||||
|
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
if (bitmap == NULL) {
|
if (bitmap == NULL) {
|
||||||
@ -67,12 +72,12 @@ int WWCharacter_SetBitmap(WWCharacter character, unsigned char * bitmap)
|
|||||||
int WWCharacter_GetPixel(WWCharacter character, int x, int y)
|
int WWCharacter_GetPixel(WWCharacter character, int x, int y)
|
||||||
{
|
{
|
||||||
if (character == NULL)
|
if (character == NULL)
|
||||||
Error("WWCharacter_GetPixel()", "WWCharacter is NULL.");
|
Wonx_Error("WWCharacter_GetPixel()", "WWCharacter is NULL.");
|
||||||
|
|
||||||
if ((x < 0) || (x > 7))
|
if ((x < 0) || (x > 7))
|
||||||
Error("WWCharacter_GetPixel()", "x is invalid value.");
|
Wonx_Error("WWCharacter_GetPixel()", "x is invalid value.");
|
||||||
if ((y < 0) || (y > 7))
|
if ((y < 0) || (y > 7))
|
||||||
Error("WWCharacter_GetPixel()", "y is invalid value.");
|
Wonx_Error("WWCharacter_GetPixel()", "y is invalid value.");
|
||||||
|
|
||||||
/* ビットマップは2ビットでぴとつのピクセルに対応する. */
|
/* ビットマップは2ビットでぴとつのピクセルに対応する. */
|
||||||
/* 2ビットの値が,palette の色に対応する. */
|
/* 2ビットの値が,palette の色に対応する. */
|
||||||
@ -86,14 +91,14 @@ int WWCharacter_SetPixel(WWCharacter character, int x, int y, int pixel)
|
|||||||
{
|
{
|
||||||
unsigned char p;
|
unsigned char p;
|
||||||
if (character == NULL)
|
if (character == NULL)
|
||||||
Error("WWCharacter_SetPixel()", "WWCharacter is NULL.");
|
Wonx_Error("WWCharacter_SetPixel()", "WWCharacter is NULL.");
|
||||||
|
|
||||||
if ((x < 0) || (x > 7))
|
if ((x < 0) || (x > 7))
|
||||||
Error("WWCharacter_SetPixel()", "x is invalid value.");
|
Wonx_Error("WWCharacter_SetPixel()", "x is invalid value.");
|
||||||
if ((y < 0) || (y > 7))
|
if ((y < 0) || (y > 7))
|
||||||
Error("WWCharacter_SetPixel()", "y is invalid value.");
|
Wonx_Error("WWCharacter_SetPixel()", "y is invalid value.");
|
||||||
if ((pixel < 0) || (pixel > 3))
|
if ((pixel < 0) || (pixel > 3))
|
||||||
Error("WWCharacter_SetPixel()", "Invalid pixel.");
|
Wonx_Error("WWCharacter_SetPixel()", "Invalid pixel.");
|
||||||
|
|
||||||
p = ((unsigned char)pixel) & 0x03;
|
p = ((unsigned char)pixel) & 0x03;
|
||||||
p = p << ((x % 4) * 2);
|
p = p << ((x % 4) * 2);
|
||||||
@ -111,7 +116,7 @@ int WWCharacter_CopyBitmap(WWCharacter dst, WWCharacter src)
|
|||||||
|
|
||||||
int WWCharacter_PrintData(WWCharacter character, FILE * f)
|
int WWCharacter_PrintData(WWCharacter character, FILE * f)
|
||||||
{
|
{
|
||||||
int x, y, n;
|
int x, y, i, n;
|
||||||
|
|
||||||
n = WWCharacter_GetNumber(character);
|
n = WWCharacter_GetNumber(character);
|
||||||
|
|
||||||
@ -120,6 +125,11 @@ int WWCharacter_PrintData(WWCharacter character, FILE * f)
|
|||||||
fprintf(f, "character[%d] :\tnumber = %d\n",
|
fprintf(f, "character[%d] :\tnumber = %d\n",
|
||||||
n, WWCharacter_GetNumber(character));
|
n, WWCharacter_GetNumber(character));
|
||||||
|
|
||||||
|
for (i = 0; i < 16; i++) {
|
||||||
|
fprintf(f, "character[%d] :\tbitmap[%d] = 0x%02x\n",
|
||||||
|
n, i, (int)(WWCharacter_GetBitmap(character)[i]));
|
||||||
|
}
|
||||||
|
|
||||||
for (y = 0; y < 8; y++) {
|
for (y = 0; y < 8; y++) {
|
||||||
fprintf(f, "character[%d] :\tbitmap : ", n);
|
fprintf(f, "character[%d] :\tbitmap : ", n);
|
||||||
for (x = 0; x < 8; x++) {
|
for (x = 0; x < 8; x++) {
|
||||||
|
|||||||
@ -22,6 +22,7 @@ int WWCharacter_GetNumber(WWCharacter c);
|
|||||||
int WWCharacter_SetNumber(WWCharacter c, int n);
|
int WWCharacter_SetNumber(WWCharacter c, int n);
|
||||||
WWCharacter WWCharacter_Create(int number, unsigned char * bitmap);
|
WWCharacter WWCharacter_Create(int number, unsigned char * bitmap);
|
||||||
WWCharacter WWCharacter_Destroy(WWCharacter character);
|
WWCharacter WWCharacter_Destroy(WWCharacter character);
|
||||||
|
unsigned char * WWCharacter_GetBitmap(WWCharacter character);
|
||||||
int WWCharacter_SetBitmap(WWCharacter character, unsigned char * bitmap);
|
int WWCharacter_SetBitmap(WWCharacter character, unsigned char * bitmap);
|
||||||
int WWCharacter_GetPixel(WWCharacter character, int x, int y);
|
int WWCharacter_GetPixel(WWCharacter character, int x, int y);
|
||||||
int WWCharacter_SetPixel(WWCharacter character, int x, int y, int pixel);
|
int WWCharacter_SetPixel(WWCharacter character, int x, int y, int pixel);
|
||||||
|
|||||||
@ -14,7 +14,8 @@ WWColorMap WWColorMap_Create(int * lcd_colors)
|
|||||||
WWColorMap color_map;
|
WWColorMap color_map;
|
||||||
|
|
||||||
color_map = (WWColorMap)malloc(sizeof(_WWColorMap));
|
color_map = (WWColorMap)malloc(sizeof(_WWColorMap));
|
||||||
if (color_map == NULL) Error("WWColorMap_Create", "Cannot allocate memory");
|
if (color_map == NULL)
|
||||||
|
Wonx_Error("WWColorMap_Create", "Cannot allocate memory");
|
||||||
|
|
||||||
WWColorMap_SetLCDColors(color_map, lcd_colors);
|
WWColorMap_SetLCDColors(color_map, lcd_colors);
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,8 @@ WWDisplay WWDisplay_Create(int lcd_panel_width, int lcd_panel_height,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
display = (WWDisplay)malloc(sizeof(_WWDisplay));
|
display = (WWDisplay)malloc(sizeof(_WWDisplay));
|
||||||
if (display == NULL) Error("WWDisplay_Create", "Cannot allocate memory.");
|
if (display == NULL)
|
||||||
|
Wonx_Error("WWDisplay_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWDisplay_SetColorMap(display, WWColorMap_Create(NULL));
|
WWDisplay_SetColorMap(display, WWColorMap_Create(NULL));
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ static WWInterruptVector WWInterruptVector_Create(int number)
|
|||||||
|
|
||||||
vector = (WWInterruptVector)malloc(sizeof(_WWInterruptVector));
|
vector = (WWInterruptVector)malloc(sizeof(_WWInterruptVector));
|
||||||
if (vector == NULL)
|
if (vector == NULL)
|
||||||
Error("WWInterruptVector_Create", "Cannot allocate memory.");
|
Wonx_Error("WWInterruptVector_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWInterruptVector_SetNumber(vector, number);
|
WWInterruptVector_SetNumber(vector, number);
|
||||||
WWInterruptVector_SetCallback(vector, NULL);
|
WWInterruptVector_SetCallback(vector, NULL);
|
||||||
@ -58,7 +58,7 @@ static WWInterruptVector WWInterruptVector_Create(int number)
|
|||||||
static WWInterruptVector WWInterruptVector_Destroy(WWInterruptVector vector)
|
static WWInterruptVector WWInterruptVector_Destroy(WWInterruptVector vector)
|
||||||
{
|
{
|
||||||
if (vector == NULL)
|
if (vector == NULL)
|
||||||
Error("WWInterruptVector_Destroy", "Object is not created.");
|
Wonx_Error("WWInterruptVector_Destroy", "Object is not created.");
|
||||||
free(vector);
|
free(vector);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ static WWInterruptVector WWInterrupt_GetVector(WWInterrupt interrupt,
|
|||||||
int number)
|
int number)
|
||||||
{
|
{
|
||||||
if ((number < 0) || (number > 7))
|
if ((number < 0) || (number > 7))
|
||||||
Error("WWInterrupt_SetVector", "Invalid interrupt number.");
|
Wonx_Error("WWInterrupt_SetVector", "Invalid interrupt number.");
|
||||||
return (interrupt->vector[number]);
|
return (interrupt->vector[number]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ static WWInterruptVector WWInterrupt_SetVector(WWInterrupt interrupt,
|
|||||||
WWInterruptVector vector)
|
WWInterruptVector vector)
|
||||||
{
|
{
|
||||||
if ((number < 0) || (number > 7))
|
if ((number < 0) || (number > 7))
|
||||||
Error("WWInterrupt_SetVector", "Invalid interrupt number.");
|
Wonx_Error("WWInterrupt_SetVector", "Invalid interrupt number.");
|
||||||
return (interrupt->vector[number] = vector);
|
return (interrupt->vector[number] = vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ WWInterrupt WWInterrupt_Create()
|
|||||||
|
|
||||||
interrupt = (WWInterrupt)malloc(sizeof(_WWInterrupt));
|
interrupt = (WWInterrupt)malloc(sizeof(_WWInterrupt));
|
||||||
if (interrupt == NULL)
|
if (interrupt == NULL)
|
||||||
Error("WWInterrupt_Create", "Cannot allocate memory.");
|
Wonx_Error("WWInterrupt_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
WWInterrupt_SetVector(interrupt, i, WWInterruptVector_Create(i));
|
WWInterrupt_SetVector(interrupt, i, WWInterruptVector_Create(i));
|
||||||
@ -331,7 +331,7 @@ WWInterrupt WWInterrupt_Destroy(WWInterrupt interrupt)
|
|||||||
WWInterruptVector vector;
|
WWInterruptVector vector;
|
||||||
|
|
||||||
if (interrupt == NULL)
|
if (interrupt == NULL)
|
||||||
Error("WWInterrupt_Destroy", "Object is not created.");
|
Wonx_Error("WWInterrupt_Destroy", "Object is not created.");
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
vector = WWInterrupt_GetVector(interrupt, i);
|
vector = WWInterrupt_GetVector(interrupt, i);
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sys/system.h"
|
#include "wonx_include/system.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* クラスの定義 */
|
/* クラスの定義 */
|
||||||
|
|||||||
@ -92,7 +92,8 @@ WWLCDPanel WWLCDPanel_Create(int width, int height)
|
|||||||
int x, y, i;
|
int x, y, i;
|
||||||
|
|
||||||
lcd_panel = (WWLCDPanel)malloc(sizeof(_WWLCDPanel));
|
lcd_panel = (WWLCDPanel)malloc(sizeof(_WWLCDPanel));
|
||||||
if (lcd_panel == NULL) Error("WWLCDPanel_Create", "Cannot allocate memory.");
|
if (lcd_panel == NULL)
|
||||||
|
Wonx_Error("WWLCDPanel_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWLCDPanel_SetWidth( lcd_panel, width);
|
WWLCDPanel_SetWidth( lcd_panel, width);
|
||||||
WWLCDPanel_SetHeight(lcd_panel, height);
|
WWLCDPanel_SetHeight(lcd_panel, height);
|
||||||
|
|||||||
@ -21,7 +21,8 @@ WWPalette WWPalette_Create(int number, int * mapped_colors, int transparent)
|
|||||||
WWPalette palette;
|
WWPalette palette;
|
||||||
|
|
||||||
palette = (WWPalette)malloc(sizeof(_WWPalette));
|
palette = (WWPalette)malloc(sizeof(_WWPalette));
|
||||||
if (palette == NULL) Error("WWPalette_Create", "Cannot allocate memory");
|
if (palette == NULL)
|
||||||
|
Wonx_Error("WWPalette_Create", "Cannot allocate memory");
|
||||||
|
|
||||||
WWPalette_SetNumber(palette, number);
|
WWPalette_SetNumber(palette, number);
|
||||||
WWPalette_SetTransparent(palette, transparent);
|
WWPalette_SetTransparent(palette, transparent);
|
||||||
|
|||||||
@ -41,7 +41,7 @@ static WWScreenCharacter WWScreenCharacter_Create(int horizontal, int vertical,
|
|||||||
|
|
||||||
screen_character = (WWScreenCharacter)malloc(sizeof(_WWScreenCharacter));
|
screen_character = (WWScreenCharacter)malloc(sizeof(_WWScreenCharacter));
|
||||||
if (screen_character == NULL)
|
if (screen_character == NULL)
|
||||||
Error("WWScreenCharacter", "Cannot allocate memory.");
|
Wonx_Error("WWScreenCharacter", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWScreenCharacter_SetHorizontal(screen_character, horizontal);
|
WWScreenCharacter_SetHorizontal(screen_character, horizontal);
|
||||||
WWScreenCharacter_SetVertical(screen_character, vertical);
|
WWScreenCharacter_SetVertical(screen_character, vertical);
|
||||||
@ -200,7 +200,8 @@ WWScreen WWScreen_Create(int number,
|
|||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
screen = (WWScreen)malloc(sizeof(_WWScreen));
|
screen = (WWScreen)malloc(sizeof(_WWScreen));
|
||||||
if (screen == NULL) Error("WWScreen_Create", "Cannot allocate memory.");
|
if (screen == NULL)
|
||||||
|
Wonx_Error("WWScreen_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWScreen_SetNumber(screen, number);
|
WWScreen_SetNumber(screen, number);
|
||||||
WWScreen_SetWidth( screen, width);
|
WWScreen_SetWidth( screen, width);
|
||||||
|
|||||||
@ -63,7 +63,8 @@ WWSprite WWSprite_Create(int number, int x, int y,
|
|||||||
WWSprite sprite;
|
WWSprite sprite;
|
||||||
|
|
||||||
sprite = (WWSprite)malloc(sizeof(_WWSprite));
|
sprite = (WWSprite)malloc(sizeof(_WWSprite));
|
||||||
if (sprite == NULL) Error("WWSprite_Create", "Cannot allocate memory.");
|
if (sprite == NULL)
|
||||||
|
Wonx_Error("WWSprite_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWSprite_SetNumber(sprite, number);
|
WWSprite_SetNumber(sprite, number);
|
||||||
WWSprite_SetHorizontal(sprite, horizontal);
|
WWSprite_SetHorizontal(sprite, horizontal);
|
||||||
|
|||||||
10
WWText.c
10
WWText.c
@ -55,7 +55,7 @@ int WWText_SetTextWindow(WWText ww_text, int x, int y,
|
|||||||
c = WWText_GetBase(ww_text);
|
c = WWText_GetBase(ww_text);
|
||||||
for (ty = 0; ty < WWText_GetHeight(ww_text); ty++) {
|
for (ty = 0; ty < WWText_GetHeight(ww_text); ty++) {
|
||||||
for (tx = 0; tx < WWText_GetWidth(ww_text); tx++) {
|
for (tx = 0; tx < WWText_GetWidth(ww_text); tx++) {
|
||||||
if (c >= 512) Error("WWText_SetTextWindow", "Over character.");
|
if (c >= 512) Wonx_Error("WWText_SetTextWindow", "Over character.");
|
||||||
ww_character = WWDisplay_GetCharacter(ww_display, c);
|
ww_character = WWDisplay_GetCharacter(ww_display, c);
|
||||||
WWCharacter_SetBitmap(ww_character, NULL);
|
WWCharacter_SetBitmap(ww_character, NULL);
|
||||||
WWScreen_SetCharacter(WWText_GetScreen(ww_text),
|
WWScreen_SetCharacter(WWText_GetScreen(ww_text),
|
||||||
@ -74,7 +74,7 @@ int WWText_PutCharacter(WWText ww_text, int x, int y, int character,
|
|||||||
WWCharacter ww_character;
|
WWCharacter ww_character;
|
||||||
|
|
||||||
if ((character < 0) || (character > 127))
|
if ((character < 0) || (character > 127))
|
||||||
Error("WWText_PutCharacter", "Character number is out of range.");
|
Wonx_Error("WWText_PutCharacter", "Character number is out of range.");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* テキスト表示は,text_window_init() で指定したテキストウインドウの
|
* テキスト表示は,text_window_init() で指定したテキストウインドウの
|
||||||
@ -83,7 +83,7 @@ int WWText_PutCharacter(WWText ww_text, int x, int y, int character,
|
|||||||
|
|
||||||
if ( (x < 0) || (x > WWText_GetWidth( ww_text) - 1) ||
|
if ( (x < 0) || (x > WWText_GetWidth( ww_text) - 1) ||
|
||||||
(y < 0) || (y > WWText_GetHeight(ww_text) - 1) )
|
(y < 0) || (y > WWText_GetHeight(ww_text) - 1) )
|
||||||
Error("WWText_PutCharacter", "Position is out of range.");
|
Wonx_Error("WWText_PutCharacter", "Position is out of range.");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
n = WWText_GetBase(ww_text) +
|
n = WWText_GetBase(ww_text) +
|
||||||
@ -119,7 +119,7 @@ WWText WWText_Create(WWScreen screen,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
ww_text = (WWText)malloc(sizeof(_WWText));
|
ww_text = (WWText)malloc(sizeof(_WWText));
|
||||||
if (ww_text == NULL) Error("WWText_Create", "Cannot allocate memory.");
|
if (ww_text == NULL) Wonx_Error("WWText_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWText_SetScreen(ww_text, screen);
|
WWText_SetScreen(ww_text, screen);
|
||||||
WWText_SetX(ww_text, 0);
|
WWText_SetX(ww_text, 0);
|
||||||
@ -139,7 +139,7 @@ WWText WWText_Destroy(WWText ww_text)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ww_text == NULL) Error("WWText_Destroy", "Object is not created.");
|
if (ww_text == NULL) Wonx_Error("WWText_Destroy", "Object is not created.");
|
||||||
|
|
||||||
for (i = 0; i < 128; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
if (WWText_GetFont(ww_text, i))
|
if (WWText_GetFont(ww_text, i))
|
||||||
|
|||||||
@ -81,7 +81,7 @@ WWTimer WWTimer_Create(int auto_preset, int preset)
|
|||||||
|
|
||||||
ww_timer = (WWTimer)malloc(sizeof(_WWTimer));
|
ww_timer = (WWTimer)malloc(sizeof(_WWTimer));
|
||||||
if (ww_timer == NULL)
|
if (ww_timer == NULL)
|
||||||
Error("WWTimer_Create", "Cannot allocate memory.");
|
Wonx_Error("WWTimer_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
WWTimer_OFF(ww_timer);
|
WWTimer_OFF(ww_timer);
|
||||||
WWTimer_SetAutoPreset(ww_timer, auto_preset);
|
WWTimer_SetAutoPreset(ww_timer, auto_preset);
|
||||||
@ -98,7 +98,7 @@ WWTimer WWTimer_Create(int auto_preset, int preset)
|
|||||||
WWTimer WWTimer_Destroy(WWTimer ww_timer)
|
WWTimer WWTimer_Destroy(WWTimer ww_timer)
|
||||||
{
|
{
|
||||||
if (ww_timer == NULL)
|
if (ww_timer == NULL)
|
||||||
Error("WWTimer_Destroy", "Object is not created.");
|
Wonx_Error("WWTimer_Destroy", "Object is not created.");
|
||||||
|
|
||||||
free(ww_timer);
|
free(ww_timer);
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sys/timer.h"
|
#include "wonx_include/timer.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* クラスの定義 */
|
/* クラスの定義 */
|
||||||
|
|||||||
8
Wonx.c
8
Wonx.c
@ -1,9 +1,9 @@
|
|||||||
#include "WonxP.h"
|
#include "WonxP.h"
|
||||||
#include "etc.h"
|
#include "etc.h"
|
||||||
|
|
||||||
#include "sys/disp.h"
|
#include "wonx_include/disp.h"
|
||||||
#include "sys/text.h"
|
#include "wonx_include/text.h"
|
||||||
#include "sys/system.h"
|
#include "wonx_include/system.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* ディスプレイの確保 */
|
/* ディスプレイの確保 */
|
||||||
@ -22,7 +22,7 @@ void Wonx_Create(void)
|
|||||||
WWPalette palette;
|
WWPalette palette;
|
||||||
|
|
||||||
wonx = (Wonx)malloc(sizeof(_Wonx));
|
wonx = (Wonx)malloc(sizeof(_Wonx));
|
||||||
if (wonx == NULL) Error("Wonx_Create", "Cannot allocate memory.");
|
if (wonx == NULL) Wonx_Error("Wonx_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
wonx->wonx_display =
|
wonx->wonx_display =
|
||||||
WonxDisplay_Create(LCD_PIXEL_WIDTH * 2, LCD_PIXEL_HEIGHT * 2,
|
WonxDisplay_Create(LCD_PIXEL_WIDTH * 2, LCD_PIXEL_HEIGHT * 2,
|
||||||
|
|||||||
@ -29,17 +29,17 @@ WonxDisplay WonxDisplay_Create(int x_width, int x_height,
|
|||||||
|
|
||||||
wonx_display = (WonxDisplay)malloc(sizeof(_WonxDisplay));
|
wonx_display = (WonxDisplay)malloc(sizeof(_WonxDisplay));
|
||||||
if (wonx_display == NULL)
|
if (wonx_display == NULL)
|
||||||
Error("WonxDisplay_Create", "Cannot allocate memory.");
|
Wonx_Error("WonxDisplay_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
ww_display = WWDisplay_Create(ww_lcd_panel_width, ww_lcd_panel_height,
|
ww_display = WWDisplay_Create(ww_lcd_panel_width, ww_lcd_panel_height,
|
||||||
ww_screen_width, ww_screen_height);
|
ww_screen_width, ww_screen_height);
|
||||||
if (ww_display == NULL)
|
if (ww_display == NULL)
|
||||||
Error("WonxDisplay_Create", "Cannot create WonderWitch display.");
|
Wonx_Error("WonxDisplay_Create", "Cannot create WonderWitch display.");
|
||||||
WonxDisplay_SetWWDisplay(wonx_display, ww_display);
|
WonxDisplay_SetWWDisplay(wonx_display, ww_display);
|
||||||
|
|
||||||
x_display = XDisplay_Create(x_width, x_height);
|
x_display = XDisplay_Create(x_width, x_height);
|
||||||
if (x_display == NULL)
|
if (x_display == NULL)
|
||||||
Error("WonxDisplay_Create", "Cannot create X display.");
|
Wonx_Error("WonxDisplay_Create", "Cannot create X display.");
|
||||||
WonxDisplay_SetXDisplay(wonx_display, x_display);
|
WonxDisplay_SetXDisplay(wonx_display, x_display);
|
||||||
|
|
||||||
return (wonx_display);
|
return (wonx_display);
|
||||||
|
|||||||
17
WonxSystem.c
17
WonxSystem.c
@ -2,8 +2,9 @@
|
|||||||
/* ¤³¤³¤«¤é */
|
/* ¤³¤³¤«¤é */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include "wonx_configure.h"
|
||||||
|
|
||||||
#include "WonxSystemP.h"
|
#include "WonxSystemP.h"
|
||||||
#include "configure.h"
|
|
||||||
#include "etc.h"
|
#include "etc.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -79,28 +80,28 @@ WonxSystem WonxSystem_Create()
|
|||||||
|
|
||||||
wonx_system = (WonxSystem)malloc(sizeof(_WonxSystem));
|
wonx_system = (WonxSystem)malloc(sizeof(_WonxSystem));
|
||||||
if (wonx_system == NULL)
|
if (wonx_system == NULL)
|
||||||
Error("WonxSystem_Create", "Cannot allocate memory.");
|
Wonx_Error("WonxSystem_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
ww_interrupt = WWInterrupt_Create();
|
ww_interrupt = WWInterrupt_Create();
|
||||||
if (ww_interrupt == NULL)
|
if (ww_interrupt == NULL)
|
||||||
Error("WonxSystem_Create", "Cannot create WonderWitch interrupt.");
|
Wonx_Error("WonxSystem_Create", "Cannot create WonderWitch interrupt.");
|
||||||
WonxSystem_SetWWInterrupt(wonx_system, ww_interrupt);
|
WonxSystem_SetWWInterrupt(wonx_system, ww_interrupt);
|
||||||
|
|
||||||
/* VBlank ¤Ï WONX_VBLANK_INTERVAL * 0.1 ÉÃËè¤È¤¹¤ë */
|
/* VBlank ¤Ï WONX_VBLANK_INTERVAL * 0.1 ÉÃËè¤È¤¹¤ë */
|
||||||
ww_timer = WWTimer_Create(1, WONX_VBLANK_INTERVAL);
|
ww_timer = WWTimer_Create(1, WONX_VBLANK_INTERVAL);
|
||||||
if (ww_timer == NULL)
|
if (ww_timer == NULL)
|
||||||
Error("WonxSystem_Create", "Cannot create WonderWitch VBlank timer.");
|
Wonx_Error("WonxSystem_Create", "Cannot create WonderWitch VBlank timer.");
|
||||||
WonxSystem_SetWWVBlankTimer(wonx_system, ww_timer);
|
WonxSystem_SetWWVBlankTimer(wonx_system, ww_timer);
|
||||||
|
|
||||||
ww_timer = WWTimer_Create(0, WONX_VBLANK_INTERVAL);
|
ww_timer = WWTimer_Create(0, WONX_VBLANK_INTERVAL);
|
||||||
if (ww_timer == NULL)
|
if (ww_timer == NULL)
|
||||||
Error("WonxSystem_Create",
|
Wonx_Error("WonxSystem_Create",
|
||||||
"Cannot create WonderWitch VBlank count up timer.");
|
"Cannot create WonderWitch VBlank count up timer.");
|
||||||
WonxSystem_SetWWVBlankCountUpTimer(wonx_system, ww_timer);
|
WonxSystem_SetWWVBlankCountUpTimer(wonx_system, ww_timer);
|
||||||
|
|
||||||
ww_timer = WWTimer_Create(0, WONX_HBLANK_INTERVAL);
|
ww_timer = WWTimer_Create(0, WONX_HBLANK_INTERVAL);
|
||||||
if (ww_timer == NULL)
|
if (ww_timer == NULL)
|
||||||
Error("WonxSystem_Create",
|
Wonx_Error("WonxSystem_Create",
|
||||||
"Cannot create WonderWitch HBlank count up timer.");
|
"Cannot create WonderWitch HBlank count up timer.");
|
||||||
WonxSystem_SetWWHBlankCountUpTimer(wonx_system, ww_timer);
|
WonxSystem_SetWWHBlankCountUpTimer(wonx_system, ww_timer);
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ WonxSystem WonxSystem_Create()
|
|||||||
unix_timer = UNIXTimer_Create(1, WONX_TIMER_INTERVAL, wonx_system,
|
unix_timer = UNIXTimer_Create(1, WONX_TIMER_INTERVAL, wonx_system,
|
||||||
(UNIXTimerCallBack)WonxTimer_Callback);
|
(UNIXTimerCallBack)WonxTimer_Callback);
|
||||||
if (unix_timer == NULL)
|
if (unix_timer == NULL)
|
||||||
Error("WonxSystem_Create", "Cannot create UNIX timer.");
|
Wonx_Error("WonxSystem_Create", "Cannot create UNIX timer.");
|
||||||
WonxSystem_SetUNIXTimer(wonx_system, unix_timer);
|
WonxSystem_SetUNIXTimer(wonx_system, unix_timer);
|
||||||
|
|
||||||
UNIXTimer_ON(unix_timer);
|
UNIXTimer_ON(unix_timer);
|
||||||
@ -131,7 +132,7 @@ WonxSystem WonxSystem_Destroy(WonxSystem wonx_system)
|
|||||||
UNIXTimer unix_timer;
|
UNIXTimer unix_timer;
|
||||||
|
|
||||||
if (wonx_system == NULL)
|
if (wonx_system == NULL)
|
||||||
Error("WonxSystem_Destroy", "Object is not created.");
|
Wonx_Error("WonxSystem_Destroy", "Object is not created.");
|
||||||
|
|
||||||
unix_timer = WonxSystem_GetUNIXTimer(wonx_system);
|
unix_timer = WonxSystem_GetUNIXTimer(wonx_system);
|
||||||
|
|
||||||
|
|||||||
@ -22,11 +22,11 @@ WonxText WonxText_Create(WWScreen screen, int x, int y, int width, int height,
|
|||||||
|
|
||||||
wonx_text = (WonxText)malloc(sizeof(_WonxText));
|
wonx_text = (WonxText)malloc(sizeof(_WonxText));
|
||||||
if (wonx_text == NULL)
|
if (wonx_text == NULL)
|
||||||
Error("WonxText_Create", "Cannot allocate memory.");
|
Wonx_Error("WonxText_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
ww_text = WWText_Create(screen, x, y, width, height, palette);
|
ww_text = WWText_Create(screen, x, y, width, height, palette);
|
||||||
if (ww_text == NULL)
|
if (ww_text == NULL)
|
||||||
Error("WonxText_Create", "Cannot create WonderWitch text.");
|
Wonx_Error("WonxText_Create", "Cannot create WonderWitch text.");
|
||||||
WonxText_SetWWText(wonx_text, ww_text);
|
WonxText_SetWWText(wonx_text, ww_text);
|
||||||
|
|
||||||
return (wonx_text);
|
return (wonx_text);
|
||||||
@ -35,7 +35,7 @@ WonxText WonxText_Create(WWScreen screen, int x, int y, int width, int height,
|
|||||||
WonxText WonxText_Destroy(WonxText wonx_text)
|
WonxText WonxText_Destroy(WonxText wonx_text)
|
||||||
{
|
{
|
||||||
if (wonx_text == NULL)
|
if (wonx_text == NULL)
|
||||||
Error("WonxText_Destroy", "Object is not created.");
|
Wonx_Error("WonxText_Destroy", "Object is not created.");
|
||||||
|
|
||||||
if (WonxText_GetWWText(wonx_text))
|
if (WonxText_GetWWText(wonx_text))
|
||||||
WonxText_SetWWText(wonx_text,
|
WonxText_SetWWText(wonx_text,
|
||||||
|
|||||||
15
XDisplay.c
15
XDisplay.c
@ -2,15 +2,15 @@
|
|||||||
/* ここから */
|
/* ここから */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "XDisplayP.h"
|
#include "XDisplayP.h"
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
#include "etc.h"
|
#include "etc.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* メンバ関数の定義 */
|
/* メンバ関数の定義 */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -226,7 +226,8 @@ XDisplay XDisplay_Create(int width, int height)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
x_display = (XDisplay)malloc(sizeof(_XDisplay));
|
x_display = (XDisplay)malloc(sizeof(_XDisplay));
|
||||||
if (x_display == NULL) Error("XDisplay_Create", "Cannot allocate memory.");
|
if (x_display == NULL)
|
||||||
|
Wonx_Error("XDisplay_Create", "Cannot allocate memory.");
|
||||||
|
|
||||||
x_display->width = width;
|
x_display->width = width;
|
||||||
x_display->height = height;
|
x_display->height = height;
|
||||||
@ -405,7 +406,7 @@ int XDisplay_DrawLCDWindow(XDisplay x_display, WWLCDPanel ww_lcd_panel)
|
|||||||
rectangles[pixel] = (XRectangle *)malloc(sizeof(XRectangle) * num);
|
rectangles[pixel] = (XRectangle *)malloc(sizeof(XRectangle) * num);
|
||||||
}
|
}
|
||||||
if (rectangles == NULL)
|
if (rectangles == NULL)
|
||||||
Error("XDisplay_DrawLCDWindow", "Cannot allocate memory.");
|
Wonx_Error("XDisplay_DrawLCDWindow", "Cannot allocate memory.");
|
||||||
|
|
||||||
ww_lcd_width = WWLCDPanel_GetWidth( ww_lcd_panel);
|
ww_lcd_width = WWLCDPanel_GetWidth( ww_lcd_panel);
|
||||||
ww_lcd_height = WWLCDPanel_GetHeight(ww_lcd_panel);
|
ww_lcd_height = WWLCDPanel_GetHeight(ww_lcd_panel);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
/* ここから */
|
/* ここから */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#include "sys/key.h"
|
#include "wonx_include/key.h"
|
||||||
|
|
||||||
#include "WWLCDPanel.h"
|
#include "WWLCDPanel.h"
|
||||||
|
|
||||||
|
|||||||
16
bank.c
16
bank.c
@ -5,7 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sys/bank.h"
|
#include "wonx_include/bank.h"
|
||||||
|
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
|
|
||||||
@ -39,39 +39,39 @@ int bank_get_map(int bank)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char bank_read_byte(int bank, unsigned int offset)
|
unsigned char bank_read_byte(int bank, unsigned int off)
|
||||||
{
|
{
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bank_write_byte(int bank, unsigned int offset, unsigned int data)
|
void bank_write_byte(int bank, unsigned int off, unsigned int data)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int bank_read_word(int bank, unsigned int offset)
|
unsigned int bank_read_word(int bank, unsigned int off)
|
||||||
{
|
{
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bank_write_word(int bank, unsigned int offset, unsigned int data)
|
void bank_write_word(int bank, unsigned int off, unsigned int data)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bank_read_block(int bank, unsigned int offset,
|
void bank_read_block(int bank, unsigned int off,
|
||||||
void * buffer, unsigned int size)
|
void * buffer, unsigned int size)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bank_write_block(int bank, unsigned int offset,
|
void bank_write_block(int bank, unsigned int off,
|
||||||
void * buffer, unsigned int size)
|
void * buffer, unsigned int size)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bank_fill_block(int bank, unsigned int offset,
|
void bank_fill_block(int bank, unsigned int off,
|
||||||
unsigned int size, unsigned int data)
|
unsigned int size, unsigned int data)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
10
comm.c
10
comm.c
@ -5,7 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sys/comm.h"
|
#include "wonx_include/comm.h"
|
||||||
|
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ void comm_open(void)
|
|||||||
void comm_close(void)
|
void comm_close(void)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
int comm_send_char(unsigned char byte)
|
int comm_send_char(unsigned char c)
|
||||||
{
|
{
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -65,11 +65,11 @@ int comm_receive_block(void * buffer, int size)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void comm_set_timeout(int receive_timeout, int send_timeout)
|
void comm_set_timeout(int recv_timeout, int send_timeout)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void comm_set_baudrate(int speed)
|
void comm_set_baudrate(int baudrate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,12 +87,10 @@ unsigned int comm_get_cancel_key(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
int comm_xmodem(void * xmodem)
|
int comm_xmodem(void * xmodem)
|
||||||
{
|
{
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* ¤³¤³¤Þ¤Ç */
|
/* ¤³¤³¤Þ¤Ç */
|
||||||
|
|||||||
138
disp.c
138
disp.c
@ -5,7 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sys/disp.h"
|
#include "wonx_include/disp.h"
|
||||||
|
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
|
|
||||||
@ -13,6 +13,11 @@
|
|||||||
/* 互換関数の定義 */
|
/* 互換関数の定義 */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* void * でデータを渡す関数は,型を間違えるバグが入る可能性があるので,
|
||||||
|
* void * を適切な型に置き換えてある.
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Xサーバとの同期の整合性がとれなくなるなどの問題が考えられるので,
|
* Xサーバとの同期の整合性がとれなくなるなどの問題が考えられるので,
|
||||||
* 互換関数の内部は UNIXTimer_Pause(), UNIXTimer_Unpause() でくくり,
|
* 互換関数の内部は UNIXTimer_Pause(), UNIXTimer_Unpause() でくくり,
|
||||||
@ -72,7 +77,7 @@ void display_control(unsigned int flags)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int display_status()
|
unsigned int display_status(void)
|
||||||
{
|
{
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
unsigned short int ret;
|
unsigned short int ret;
|
||||||
@ -123,12 +128,16 @@ unsigned int display_status()
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void font_set_monodata(unsigned int number, unsigned int count, void * data)
|
/*
|
||||||
|
* void * data だと,まちがって int * でデータを指定するようなバグが
|
||||||
|
* 入る可能性があるので,unsigned char * data にした.
|
||||||
|
*/
|
||||||
|
void font_set_monodata(unsigned int number, unsigned int count,
|
||||||
|
unsigned char * data)
|
||||||
{
|
{
|
||||||
WWCharacter c;
|
WWCharacter c;
|
||||||
int i, x, y, n, p;
|
int i, x, y, n, p;
|
||||||
int f, b;
|
int f, b;
|
||||||
unsigned char * d;
|
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
|
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
@ -137,20 +146,19 @@ void font_set_monodata(unsigned int number, unsigned int count, void * data)
|
|||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : font_set_monodata() : number = %u, count = %u, data = %p\n",
|
printf("call : font_set_monodata() : number = %u, count = %u, data = %p\n",
|
||||||
(int)number, (int)count, data); fflush(stdout);
|
(int)number, (int)count, (void *)data); fflush(stdout);
|
||||||
|
|
||||||
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
||||||
|
|
||||||
n = 0;
|
|
||||||
d = (unsigned char *)data; /* ひとつのキャラクタデータは8バイト */
|
|
||||||
f = WWDisplay_GetForegroundColor(ww_display);
|
f = WWDisplay_GetForegroundColor(ww_display);
|
||||||
b = WWDisplay_GetBackgroundColor(ww_display);
|
b = WWDisplay_GetBackgroundColor(ww_display);
|
||||||
|
|
||||||
|
n = 0;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
c = WWDisplay_GetCharacter(ww_display, number + i);
|
c = WWDisplay_GetCharacter(ww_display, number + i);
|
||||||
for (y = 0; y < 8; y++) {
|
for (y = 0; y < 8; y++) {
|
||||||
for (x = 0; x < 8; x++) {
|
for (x = 0; x < 8; x++) {
|
||||||
p = (d[n] & (1 << (7 - x))) ? f : b; /*これでよいのか?*/
|
p = (data[n] & (1 << (7 - x))) ? f : b; /*これでよいのか?*/
|
||||||
WWCharacter_SetPixel(c, x, y, p);
|
WWCharacter_SetPixel(c, x, y, p);
|
||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
@ -168,12 +176,15 @@ void font_set_monodata(unsigned int number, unsigned int count, void * data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void font_set_colordata(unsigned int number,
|
/*
|
||||||
unsigned int count, void * data)
|
* void * data だと,まちがって int * でデータを指定するようなバグが
|
||||||
|
* 入る可能性があるので,unsigned char * data にした.
|
||||||
|
*/
|
||||||
|
void font_set_colordata(unsigned int number, unsigned int count,
|
||||||
|
unsigned char * data)
|
||||||
{
|
{
|
||||||
WWCharacter c;
|
WWCharacter c;
|
||||||
int i, x, y, n, p;
|
int i, x, y, n, p;
|
||||||
unsigned char * d;
|
|
||||||
|
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
@ -181,10 +192,9 @@ void font_set_colordata(unsigned int number,
|
|||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : font_set_colordata() : number = %u, count = %u, data = %p\n",
|
printf("call : font_set_colordata() : number = %u, count = %u, data = %p\n",
|
||||||
(int)number, (int)count, data); fflush(stdout);
|
(int)number, (int)count, (void *)data); fflush(stdout);
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
d = (unsigned char *)data; /* ひとつのキャラクタデータは16バイト */
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
||||||
@ -193,8 +203,8 @@ void font_set_colordata(unsigned int number,
|
|||||||
for (x = 0; x < 8; x++) {
|
for (x = 0; x < 8; x++) {
|
||||||
|
|
||||||
/*これでよいのか?*/
|
/*これでよいのか?*/
|
||||||
p = ((d[n] & (1 << (7-x))) ? 2 : 0)
|
p = ((data[n] & (1 << (7-x))) ? 2 : 0)
|
||||||
+ ((d[n + 1] & (1 << (7-x))) ? 1 : 0);
|
+ ((data[n + 1] & (1 << (7-x))) ? 1 : 0);
|
||||||
|
|
||||||
WWCharacter_SetPixel(c, x, y, p);
|
WWCharacter_SetPixel(c, x, y, p);
|
||||||
}
|
}
|
||||||
@ -214,13 +224,16 @@ void font_set_colordata(unsigned int number,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void font_get_data(unsigned int number,
|
/*
|
||||||
unsigned int count, void * data)
|
* void * data だと,まちがって int * でデータを指定するようなバグが
|
||||||
|
* 入る可能性があるので,unsigned char * data にした.
|
||||||
|
*/
|
||||||
|
void font_get_data(unsigned int number, unsigned int count,
|
||||||
|
unsigned char * data)
|
||||||
{
|
{
|
||||||
/* 関数の仕様がわからんので適当に書くぞ */
|
/* 関数の仕様がわからんので適当に書くぞ */
|
||||||
WWCharacter c;
|
WWCharacter c;
|
||||||
int i, x, y, n, p;
|
int i, x, y, n, p;
|
||||||
unsigned char * d;
|
|
||||||
|
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
@ -228,22 +241,21 @@ void font_get_data(unsigned int number,
|
|||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : font_get_data() : number = %u, count = %u, data = %p\n",
|
printf("call : font_get_data() : number = %u, count = %u, data = %p\n",
|
||||||
(int)number, (int)count, data); fflush(stdout);
|
(int)number, (int)count, (void *)data); fflush(stdout);
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
d = (unsigned char *)data; /* ひとつのキャラクタデータは16バイト? */
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
||||||
number + i);
|
number + i);
|
||||||
for (y = 0; y < 8; y++) {
|
for (y = 0; y < 8; y++) {
|
||||||
d[n ] = 0;
|
data[n ] = 0;
|
||||||
d[n+1] = 0;
|
data[n+1] = 0;
|
||||||
for (x = 0; x < 8; x++) {
|
for (x = 0; x < 8; x++) {
|
||||||
p = WWCharacter_GetPixel(c, x, y);
|
p = WWCharacter_GetPixel(c, x, y);
|
||||||
/* これでよいのか? */
|
/* これでよいのか? */
|
||||||
d[n ] |= (((unsigned char)p & 0x02) ? 1 : 0) << (7-x);
|
data[n ] |= (((unsigned char)p & 0x02) ? 1 : 0) << (7-x);
|
||||||
d[n+1] |= (((unsigned char)p & 0x01) ? 1 : 0) << (7-x);
|
data[n+1] |= (((unsigned char)p & 0x01) ? 1 : 0) << (7-x);
|
||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
n++;
|
n++;
|
||||||
@ -347,10 +359,14 @@ static void _screen_set_char1(int screen, int x, int y,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void screen_set_char(int screen, int x, int y, int w, int h, void * data)
|
/*
|
||||||
|
* void * data だと,まちがって int * でデータを指定するようなバグが
|
||||||
|
* 入る可能性があるので,unsigned short int * data にした.
|
||||||
|
*/
|
||||||
|
void screen_set_char(int screen, int x, int y, int w, int h,
|
||||||
|
unsigned short int * data)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned short int * d;
|
|
||||||
|
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
@ -358,15 +374,13 @@ void screen_set_char(int screen, int x, int y, int w, int h, void * data)
|
|||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : screen_set_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n",
|
printf("call : screen_set_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n",
|
||||||
screen, x, y, w, h, data);
|
screen, x, y, w, h, (void *)data);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
d = (unsigned short int *)data;
|
|
||||||
|
|
||||||
for (j = 0; j < h; j++) {
|
for (j = 0; j < h; j++) {
|
||||||
for (i = 0; i < w; i++) {
|
for (i = 0; i < w; i++) {
|
||||||
_screen_set_char1(screen, x + i, y + j, *d);
|
_screen_set_char1(screen, x + i, y + j, *data);
|
||||||
d++;
|
data++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,10 +425,14 @@ static unsigned int _screen_get_char1(int screen, int x, int y)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void screen_get_char(int screen, int x, int y, int w, int h, void * data)
|
/*
|
||||||
|
* void * data だと,まちがって int * でデータを指定するようなバグが
|
||||||
|
* 入る可能性があるので,unsigned short int * data にした.
|
||||||
|
*/
|
||||||
|
void screen_get_char(int screen, int x, int y, int w, int h,
|
||||||
|
unsigned short int * data)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned short int * d;
|
|
||||||
|
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
@ -422,15 +440,13 @@ void screen_get_char(int screen, int x, int y, int w, int h, void * data)
|
|||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : screen_get_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n",
|
printf("call : screen_get_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n",
|
||||||
screen, x, y, w, h, data);
|
screen, x, y, w, h, (void *)data);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
d = (unsigned short int *)data;
|
|
||||||
|
|
||||||
for (j = 0; j < h; j++) {
|
for (j = 0; j < h; j++) {
|
||||||
for (i = 0; i < w; i++) {
|
for (i = 0; i < w; i++) {
|
||||||
*d = _screen_get_char1(screen, x, y);
|
*data = _screen_get_char1(screen, x, y);
|
||||||
d++;
|
data++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,20 +551,20 @@ void screen_fill_attr(int screen, int x, int y, int w, int h,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sprite_set_range(unsigned int sprite_start, unsigned int sprite_count)
|
void sprite_set_range(unsigned int start, unsigned int number)
|
||||||
{
|
{
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : sprite_set_range() : start = %u, count = %u\n",
|
printf("call : sprite_set_range() : start = %u, number = %u\n",
|
||||||
(int)sprite_start, (int)sprite_count); fflush(stdout);
|
(int)start, (int)number); fflush(stdout);
|
||||||
|
|
||||||
WWDisplay_SetSpriteStart(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
WWDisplay_SetSpriteStart(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
||||||
sprite_start);
|
start);
|
||||||
WWDisplay_SetSpriteCount(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
WWDisplay_SetSpriteCount(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
||||||
sprite_count);
|
number);
|
||||||
|
|
||||||
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
||||||
|
|
||||||
@ -575,8 +591,10 @@ static void _sprite_set_char(unsigned int sprite_num, unsigned int data)
|
|||||||
WWSprite_SetPriority( s, (data >> 13) ? 1 : 0);
|
WWSprite_SetPriority( s, (data >> 13) ? 1 : 0);
|
||||||
WWSprite_SetClipping( s, (data >> 12) ? 1 : 0);
|
WWSprite_SetClipping( s, (data >> 12) ? 1 : 0);
|
||||||
|
|
||||||
|
/* 8を引いた値でパレット番号が指定されるので,8を足してやる */
|
||||||
p = WWDisplay_GetPalette(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
p = WWDisplay_GetPalette(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
||||||
(data >> 9) & 0x07);
|
((data >> 9) & 0x07) + 8);
|
||||||
|
|
||||||
c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()),
|
||||||
data & 0x1ff);
|
data & 0x1ff);
|
||||||
|
|
||||||
@ -628,7 +646,9 @@ static unsigned int _sprite_get_char(unsigned int sprite_num)
|
|||||||
|
|
||||||
p = WWSprite_GetPalette(s);
|
p = WWSprite_GetPalette(s);
|
||||||
c = WWSprite_GetCharacter(s);
|
c = WWSprite_GetCharacter(s);
|
||||||
ret |= (WWPalette_GetNumber(p) & 0x07) << 9;
|
|
||||||
|
/* 8を引いた値でパレット番号が指定されるので,8を引いてやる */
|
||||||
|
ret |= ((WWPalette_GetNumber(p) - 8) & 0x07) << 9;
|
||||||
ret |= WWCharacter_GetNumber(c);
|
ret |= WWCharacter_GetNumber(c);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -794,10 +814,14 @@ unsigned long int sprite_get_char_location(unsigned int sprite_num)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sprite_set_data(unsigned int sprite_num, unsigned int count, void * data)
|
/*
|
||||||
|
* void * data だと,まちがって int * でデータを指定するようなバグが
|
||||||
|
* 入る可能性があるので,unsigned long int * data にした.
|
||||||
|
*/
|
||||||
|
void sprite_set_data(unsigned int sprite_num, unsigned int count,
|
||||||
|
unsigned long int * data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned long int * n;
|
|
||||||
|
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
@ -805,15 +829,14 @@ void sprite_set_data(unsigned int sprite_num, unsigned int count, void * data)
|
|||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : sprite_set_data() : number = %u, count = %u, data = %p\n",
|
printf("call : sprite_set_data() : number = %u, count = %u, data = %p\n",
|
||||||
(int)sprite_num, (int)count, data);
|
(int)sprite_num, (int)count, (void *)data);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
n = (unsigned long int *)data;
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
_sprite_set_char_location(sprite_num + i,
|
_sprite_set_char_location(sprite_num + i,
|
||||||
n[i] >> 16,
|
data[i] >> 16,
|
||||||
(n[i] >> 8) & 0xff,
|
(data[i] >> 8) & 0xff,
|
||||||
n[i] & 0xff);
|
data[i] & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
||||||
@ -1019,8 +1042,7 @@ unsigned long int sprite_get_window(void)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void palette_set_color(unsigned int palette_num,
|
void palette_set_color(unsigned int palette_num, unsigned int colors)
|
||||||
unsigned int colors)
|
|
||||||
{
|
{
|
||||||
int mapped_colors[4];
|
int mapped_colors[4];
|
||||||
WWPalette palette;
|
WWPalette palette;
|
||||||
@ -1166,7 +1188,7 @@ unsigned long int lcd_get_color(void)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_segments(unsigned segments)
|
void lcd_set_segments(unsigned int segments)
|
||||||
{
|
{
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
@ -1200,7 +1222,7 @@ unsigned int lcd_get_segments(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_sleep(unsigned slp)
|
void lcd_set_sleep(unsigned int slp)
|
||||||
{
|
{
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
@ -1234,7 +1256,7 @@ unsigned int lcd_get_sleep(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void screen_set_vram(int screen, int locationID)
|
void screen_set_vram(int screen, int location_id)
|
||||||
{
|
{
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
@ -1251,7 +1273,7 @@ void screen_set_vram(int screen, int locationID)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sprite_set_vram(int locationID)
|
void sprite_set_vram(int location_id)
|
||||||
{
|
{
|
||||||
if (!Wonx_IsCreated()) Wonx_Create();
|
if (!Wonx_IsCreated()) Wonx_Create();
|
||||||
|
|
||||||
|
|||||||
2
etc.c
2
etc.c
@ -7,7 +7,7 @@
|
|||||||
/* エラー処理 */
|
/* エラー処理 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
int Error(char * funcname, char * message)
|
int Wonx_Error(char * funcname, char * message)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s(): %s\n", funcname, message);
|
fprintf(stderr, "%s(): %s\n", funcname, message);
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|||||||
2
etc.h
2
etc.h
@ -5,7 +5,7 @@
|
|||||||
/* エラー処理 */
|
/* エラー処理 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
int Error(char * funcname, char * message);
|
int Wonx_Error(char * funcname, char * message);
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* "true", "false" の文字列を返す */
|
/* "true", "false" の文字列を返す */
|
||||||
|
|||||||
2
key.c
2
key.c
@ -5,7 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sys/key.h"
|
#include "wonx_include/key.h"
|
||||||
|
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
|
|
||||||
|
|||||||
38
makefile_for_smac
Normal file
38
makefile_for_smac
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
SOURCES = chara.c game.c man.c mansub.c mansub2.c map.c mapsub.c menu.c monster.c picture.c player.c smac.c stage.c dsp.c etc.c
|
||||||
|
|
||||||
|
# コマンドラインの長さには制限があるので,長さに注意すること
|
||||||
|
OBJS = chara.o game.o man.o mansub.o mansub2.o map.o mapsub.o menu.o monster.o picture.o player.o smac.o stage.o dsp.o etc.o main.o
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
all : smac
|
||||||
|
|
||||||
|
smac : $(OBJS)
|
||||||
|
gcc -g -o smac $(OBJS) -lwonx -lX11 -lXt -L. -L/usr/X11R6/lib
|
||||||
|
|
||||||
|
# xsmac
|
||||||
|
|
||||||
|
#smac : smac.fx
|
||||||
|
|
||||||
|
#smac.fx : smac.bin
|
||||||
|
# doscmd mkfent16 smac.cf
|
||||||
|
|
||||||
|
#smac.bin : $(OBJS)
|
||||||
|
# echo $(OBJS) > objs
|
||||||
|
# doscmd lcc86 -o smac.bin -O @objs
|
||||||
|
|
||||||
|
.c.o : $*.c
|
||||||
|
gcc -c $*.c -g -I.
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm -f smac.fx smac.bin smac $(OBJS)
|
||||||
|
|
||||||
|
package : smac.fx
|
||||||
|
rm -fR smac-b02
|
||||||
|
mkdir -p smac-b02
|
||||||
|
cp -R copying copyrigh readme history makefile doscmdrc *.c *.h \
|
||||||
|
smac.bin smac.cf smac.fx pic8 \
|
||||||
|
smac-b02
|
||||||
|
zip -r smac-b02 smac-b02
|
||||||
|
|
||||||
|
xsmac :
|
||||||
23
sample1.c
Normal file
23
sample1.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include "wonx_include/text.h"
|
||||||
|
#include "wonx_include/key.h"
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
text_screen_init();
|
||||||
|
text_put_string(0, 1, " Wonx - WonderWitch on X. ");
|
||||||
|
text_put_string(0, 3, " This is test program ");
|
||||||
|
text_put_string(0, 4, " for Wonx. ");
|
||||||
|
text_put_string(0, 6, " Wonx is an emulator for ");
|
||||||
|
text_put_string(0, 7, " WonderWitch on X. It is ");
|
||||||
|
text_put_string(0, 8, " linked to program for ");
|
||||||
|
text_put_string(0, 9, " WonderWitch and behave as ");
|
||||||
|
text_put_string(0, 10, " WonderWitch. ");
|
||||||
|
text_put_string(0, 12, " Wonx Copyright (c) 2000 ");
|
||||||
|
text_put_string(0, 13, " Sakai Hiroaki. ");
|
||||||
|
text_put_string(0, 14, " All Rights Reserved. ");
|
||||||
|
text_put_string(0, 16, " Hit space key to exit. ");
|
||||||
|
|
||||||
|
key_wait();
|
||||||
|
|
||||||
|
bios_exit();
|
||||||
|
}
|
||||||
47
sample2.c
Normal file
47
sample2.c
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include "wonx_include/disp.h"
|
||||||
|
#include "wonx_include/key.h"
|
||||||
|
|
||||||
|
static unsigned char clear[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
static unsigned char block[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
int x, y, f, k;
|
||||||
|
|
||||||
|
display_control(DCM_SCR2 | DCM_SPR);
|
||||||
|
|
||||||
|
lcd_set_color(0, 0xffff);
|
||||||
|
palette_set_color(0, 0);
|
||||||
|
palette_set_color(8, (0xf << 12));
|
||||||
|
|
||||||
|
font_set_color(0x03);
|
||||||
|
|
||||||
|
font_set_monodata(0, 1, clear);
|
||||||
|
font_set_monodata(1, 1, block);
|
||||||
|
|
||||||
|
sprite_set_char(0,
|
||||||
|
CFM_SPR_UPPER |
|
||||||
|
((0 << 9) & CFM_SPR_PALETTE) |
|
||||||
|
(1 & CFM_FONT)
|
||||||
|
);
|
||||||
|
|
||||||
|
sprite_set_range(0, 1);
|
||||||
|
|
||||||
|
x = 14;
|
||||||
|
y = 9;
|
||||||
|
f = 0;
|
||||||
|
|
||||||
|
while (!f) {
|
||||||
|
sprite_set_location(0, x * 8, y * 8);
|
||||||
|
|
||||||
|
k = key_hit_check();
|
||||||
|
if (k & KEY_START) f = 1;
|
||||||
|
if (k & KEY_A) f = 1;
|
||||||
|
if ((k & KEY_LEFT1) && (x > 0)) x--;
|
||||||
|
if ((k & KEY_RIGHT1) && (x < LCD_PIXEL_WIDTH/8 - 1)) x++;
|
||||||
|
if ((k & KEY_UP1) && (y > 0)) y--;
|
||||||
|
if ((k & KEY_DOWN1) && (y < LCD_PIXEL_HEIGHT/8 - 1)) y++;
|
||||||
|
}
|
||||||
|
|
||||||
|
bios_exit();
|
||||||
|
}
|
||||||
BIN
smac-b02.zip
Normal file
BIN
smac-b02.zip
Normal file
Binary file not shown.
2
sound.c
2
sound.c
@ -5,7 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sys/sound.h"
|
#include "wonx_include/sound.h"
|
||||||
|
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
|
|
||||||
|
|||||||
14
sys2wonx.pl
Normal file
14
sys2wonx.pl
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
while ($FILENAME = shift(@ARGV)) {
|
||||||
|
open (RFILE, "< $FILENAME");
|
||||||
|
open (WFILE, "> $FILENAME.tmp");
|
||||||
|
while (<RFILE>) {
|
||||||
|
s/^(\s*\#\s*include\s*)[\<\"]sys\/(.+\.h)[\>\"]/$1\"wonx_include\/$2\"/i;
|
||||||
|
print WFILE $_;
|
||||||
|
}
|
||||||
|
close (RFILE);
|
||||||
|
close (WFILE);
|
||||||
|
|
||||||
|
system("mv $FILENAME.tmp $FILENAME");
|
||||||
|
}
|
||||||
50
system.c
50
system.c
@ -2,9 +2,10 @@
|
|||||||
/* ここから */
|
/* ここから */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sys/system.h"
|
#include "wonx_include/system.h"
|
||||||
|
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
|
|
||||||
@ -28,8 +29,8 @@
|
|||||||
* 引数の表示の問題もあるしね.
|
* 引数の表示の問題もあるしね.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void sys_interrupt_set_hook(int type, intvector_t * intvector,
|
void sys_interrupt_set_hook(int type, intvector_t * vector,
|
||||||
intvector_t * last_intvector)
|
intvector_t * old_vector)
|
||||||
{
|
{
|
||||||
WWInterrupt ww_interrupt;
|
WWInterrupt ww_interrupt;
|
||||||
|
|
||||||
@ -38,18 +39,18 @@ void sys_interrupt_set_hook(int type, intvector_t * intvector,
|
|||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : sys_interrupt_set_hook() : type = %d, intvector = %p, last_intvector = %p\n", type, intvector, last_intvector);
|
printf("call : sys_interrupt_set_hook() : type = %d, vector = %p, old_vector = %p\n", type, vector, old_vector);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
ww_interrupt = WonxSystem_GetWWInterrupt(Wonx_GetWonxSystem());
|
ww_interrupt = WonxSystem_GetWWInterrupt(Wonx_GetWonxSystem());
|
||||||
|
|
||||||
last_intvector->callback = WWInterrupt_GetCallback(ww_interrupt, type);
|
old_vector->callback = WWInterrupt_GetCallback(ww_interrupt, type);
|
||||||
last_intvector->cs = WWInterrupt_GetCS(ww_interrupt, type);
|
old_vector->cs = WWInterrupt_GetCS(ww_interrupt, type);
|
||||||
last_intvector->ds = WWInterrupt_GetDS(ww_interrupt, type);
|
old_vector->ds = WWInterrupt_GetDS(ww_interrupt, type);
|
||||||
|
|
||||||
WWInterrupt_SetCallback(ww_interrupt, type, intvector->callback);
|
WWInterrupt_SetCallback(ww_interrupt, type, vector->callback);
|
||||||
WWInterrupt_SetCS(ww_interrupt, type, intvector->cs);
|
WWInterrupt_SetCS(ww_interrupt, type, vector->cs);
|
||||||
WWInterrupt_SetDS(ww_interrupt, type, intvector->ds);
|
WWInterrupt_SetDS(ww_interrupt, type, vector->ds);
|
||||||
|
|
||||||
printf("call : sys_interrupt_set_hook() : return value = none\n");
|
printf("call : sys_interrupt_set_hook() : return value = none\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -60,7 +61,7 @@ void sys_interrupt_set_hook(int type, intvector_t * intvector,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_interrupt_reset_hook(int type, intvector_t * last_intvector)
|
void sys_interrupt_reset_hook(int type, intvector_t * old_vector)
|
||||||
{
|
{
|
||||||
WWInterrupt ww_interrupt;
|
WWInterrupt ww_interrupt;
|
||||||
|
|
||||||
@ -69,14 +70,14 @@ void sys_interrupt_reset_hook(int type, intvector_t * last_intvector)
|
|||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : sys_interrupt_reset_hook() : type = %d, last_intvector = %p\n", type, last_intvector);
|
printf("call : sys_interrupt_reset_hook() : type = %d, old_vector = %p\n", type, old_vector);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
ww_interrupt = WonxSystem_GetWWInterrupt(Wonx_GetWonxSystem());
|
ww_interrupt = WonxSystem_GetWWInterrupt(Wonx_GetWonxSystem());
|
||||||
|
|
||||||
WWInterrupt_SetCallback(ww_interrupt, type, last_intvector->callback);
|
WWInterrupt_SetCallback(ww_interrupt, type, old_vector->callback);
|
||||||
WWInterrupt_SetCS(ww_interrupt, type, last_intvector->cs);
|
WWInterrupt_SetCS(ww_interrupt, type, old_vector->cs);
|
||||||
WWInterrupt_SetDS(ww_interrupt, type, last_intvector->ds);
|
WWInterrupt_SetDS(ww_interrupt, type, old_vector->ds);
|
||||||
|
|
||||||
printf("call : sys_interrupt_reset_hook() : return value = none\n");
|
printf("call : sys_interrupt_reset_hook() : return value = none\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -87,7 +88,7 @@ void sys_interrupt_reset_hook(int type, intvector_t * last_intvector)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_wait(unsigned int time)
|
void sys_wait(unsigned int wait_time)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ int sys_get_sleep_time(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_set_awake_key(int awake_key_pattern)
|
void sys_set_awake_key(int pattern)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,11 +119,11 @@ int sys_get_awake_key(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_set_keepalive_int(int keepalive_pattern)
|
void sys_set_keepalive_int(int pattern)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_get_ownerinfo(int size, char *buffer)
|
void sys_get_ownerinfo(int size, char * buffer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +136,7 @@ void sys_resume(int core)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_set_remote(int remote_enable)
|
void sys_set_remote(int remote)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ unsigned int sys_get_remote(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void * sys_alloc_iram(void *pointer, unsigned size)
|
void * sys_alloc_iram(void * p, unsigned int size)
|
||||||
{
|
{
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -176,6 +177,13 @@ unsigned int sys_get_resume(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bios_exit()
|
||||||
|
{
|
||||||
|
printf("call : bios_exit() : \n");
|
||||||
|
fflush(stdout);
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* ここまで */
|
/* ここまで */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
64
text.c
64
text.c
@ -2,10 +2,11 @@
|
|||||||
/* ここから */
|
/* ここから */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "sys/text.h"
|
#include "wonx_include/text.h"
|
||||||
|
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
#include "WWText.h"
|
#include "WWText.h"
|
||||||
@ -30,7 +31,7 @@
|
|||||||
* 引数の表示の問題もあるしね.
|
* 引数の表示の問題もあるしね.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void _text_window_init(int x, int y, int w, int h, unsigned font_base)
|
static void _text_window_init(int x, int y, int w, int h, unsigned int base)
|
||||||
{
|
{
|
||||||
WWText ww_text;
|
WWText ww_text;
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
@ -38,7 +39,7 @@ static void _text_window_init(int x, int y, int w, int h, unsigned font_base)
|
|||||||
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
|
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
|
||||||
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
||||||
|
|
||||||
WWText_SetTextWindow(ww_text, x, y, w, h, font_base, ww_display);
|
WWText_SetTextWindow(ww_text, x, y, w, h, base, ww_display);
|
||||||
|
|
||||||
WWScreen_SetRollX(WWText_GetScreen(ww_text), 0);
|
WWScreen_SetRollX(WWText_GetScreen(ww_text), 0);
|
||||||
WWScreen_SetRollY(WWText_GetScreen(ww_text), 0);
|
WWScreen_SetRollY(WWText_GetScreen(ww_text), 0);
|
||||||
@ -74,7 +75,7 @@ void text_screen_init(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_window_init(int x, int y, int w, int h, unsigned int font_base)
|
void text_window_init(int x, int y, int w, int h, unsigned int base)
|
||||||
{
|
{
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
|
|
||||||
@ -83,12 +84,12 @@ void text_window_init(int x, int y, int w, int h, unsigned int font_base)
|
|||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : text_window_init() : x = %d, y = %d, width = %d, height = %d, base = %u\n", x, y, w, h, (int)font_base);
|
printf("call : text_window_init() : x = %d, y = %d, width = %d, height = %d, base = %u\n", x, y, w, h, (int)base);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
||||||
|
|
||||||
_text_window_init(x, y, w, h, font_base);
|
_text_window_init(x, y, w, h, base);
|
||||||
|
|
||||||
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ int text_get_mode(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _text_put_char(int x, int y, unsigned int c)
|
static void _text_put_char(int x, int y, unsigned int c)
|
||||||
{
|
{
|
||||||
WWText ww_text;
|
WWText ww_text;
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
@ -144,7 +145,7 @@ void text_put_char(int x, int y, unsigned int c)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _text_put_string(int x, int y, char * s)
|
static int _text_put_string(int x, int y, char * string)
|
||||||
{
|
{
|
||||||
int i, len, ret;
|
int i, len, ret;
|
||||||
WWText ww_text;
|
WWText ww_text;
|
||||||
@ -153,17 +154,17 @@ static int _text_put_string(int x, int y, char * s)
|
|||||||
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
|
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
|
||||||
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
||||||
|
|
||||||
len = strlen(s);
|
len = strlen(string);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (WWText_PutCharacter(ww_text, x + i, y, s[i], ww_display) >= 0)
|
if (WWText_PutCharacter(ww_text, x + i, y, string[i], ww_display) >= 0)
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
int text_put_string(int x, int y, char * s)
|
int text_put_string(int x, int y, char * string)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -172,10 +173,10 @@ int text_put_string(int x, int y, char * s)
|
|||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : text_put_string() : x = %d, y = %d, string = %s\n", x, y, s);
|
printf("call : text_put_string() : x = %d, y = %d, string = %s\n", x, y, string);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
ret = _text_put_string(x, y, s);
|
ret = _text_put_string(x, y, string);
|
||||||
|
|
||||||
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
||||||
|
|
||||||
@ -188,7 +189,7 @@ int text_put_string(int x, int y, char * s)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
int text_put_substring(int x, int y, char * s, int len)
|
int text_put_substring(int x, int y, char * s, int length)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
WWText ww_text;
|
WWText ww_text;
|
||||||
@ -199,14 +200,14 @@ int text_put_substring(int x, int y, char * s, int len)
|
|||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : text_put_substring() : x = %d, y = %d, string = %s, length = %d\n", x, y, s, len);
|
printf("call : text_put_substring() : x = %d, y = %d, string = %s, length = %d\n", x, y, s, length);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
|
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
|
||||||
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
if (WWText_PutCharacter(ww_text, x + i, y, s[i], ww_display) >= 0)
|
if (WWText_PutCharacter(ww_text, x + i, y, s[i], ww_display) >= 0)
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
@ -222,7 +223,7 @@ int text_put_substring(int x, int y, char * s, int len)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_put_numeric(int x, int y, int len, int format, int number)
|
void text_put_numeric(int x, int y, int length, int format, int number)
|
||||||
{
|
{
|
||||||
char buf[20];
|
char buf[20];
|
||||||
char f[20];
|
char f[20];
|
||||||
@ -232,13 +233,13 @@ void text_put_numeric(int x, int y, int len, int format, int number)
|
|||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : text_put_numeric() : x = %d, y = %d, len = %d, format = %04x, number = %d\n", x, y, len, format, number);
|
printf("call : text_put_numeric() : x = %d, y = %d, length = %d, format = %04x, number = %d\n", x, y, length, format, number);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
strcpy(f, "%");
|
strcpy(f, "%");
|
||||||
|
|
||||||
if (format & NUM_PADZERO) strcat(f, "0");
|
if (format & NUM_PADZERO) strcat(f, "0");
|
||||||
sprintf(f + strlen(f), "%d", len);
|
sprintf(f + strlen(f), "%d", length);
|
||||||
if (format & NUM_HEXA) strcat(f, "x");
|
if (format & NUM_HEXA) strcat(f, "x");
|
||||||
else if (format & NUM_SIGNED) strcat(f, "d");
|
else if (format & NUM_SIGNED) strcat(f, "d");
|
||||||
else strcat(f, "u");
|
else strcat(f, "u");
|
||||||
@ -258,11 +259,11 @@ void text_put_numeric(int x, int y, int len, int format, int number)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_store_numeric(char * buffer, int len, int format, int number)
|
void text_store_numeric(char * buffer, int length, int format, int number)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_fill_char(int x, int y, int len, int code)
|
void text_fill_char(int x, int y, int length, int c)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -271,11 +272,11 @@ void text_fill_char(int x, int y, int len, int code)
|
|||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : text_fill_char() : x = %d, y = %d, length = %d, code = %d\n", x, y, len, code);
|
printf("call : text_fill_char() : x = %d, y = %d, length = %d, character = %d\n", x, y, length, c);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
_text_put_char(x + i, y, code);
|
_text_put_char(x + i, y, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
WonxDisplay_Flush(Wonx_GetWonxDisplay());
|
||||||
@ -346,16 +347,15 @@ int text_get_palette(void)
|
|||||||
return (num);
|
return (num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_set_ank_font(int font_base_num, int is_color, int font_count,
|
void text_set_ank_font(int base, int color, int count, void * font)
|
||||||
void * font)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_set_sjis_font(void * font_address)
|
void text_set_sjis_font(void * p)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_get_fontdata(int char_code, void * fontdata_buffer)
|
void text_get_fontdata(int c, void * buffer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ int text_get_screen(void)
|
|||||||
return (n);
|
return (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursor_display(int cursor_enable)
|
void cursor_display(int flag)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,16 +429,16 @@ void cursor_set_location(int x, int y, int w, int h)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long cursor_get_location(void)
|
unsigned long int cursor_get_location(void)
|
||||||
{
|
{
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursor_set_type(int palette_num, int blink_interval)
|
void cursor_set_type(int palette_num, int interval)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long cursor_get_type(void)
|
unsigned long int cursor_get_type(void)
|
||||||
{
|
{
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
72
timer.c
72
timer.c
@ -2,24 +2,15 @@
|
|||||||
/* ここから */
|
/* ここから */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "sys/timer.h"
|
#include "wonx_include/timer.h"
|
||||||
|
|
||||||
|
#include "wonx_configure.h"
|
||||||
#include "Wonx.h"
|
#include "Wonx.h"
|
||||||
#include "etc.h"
|
#include "etc.h"
|
||||||
#include "configure.h"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned char year;
|
|
||||||
unsigned char month;
|
|
||||||
unsigned char date;
|
|
||||||
unsigned char day_of_week;
|
|
||||||
unsigned char hour;
|
|
||||||
unsigned char minute;
|
|
||||||
unsigned char second;
|
|
||||||
} datetime_t;
|
|
||||||
|
|
||||||
/* int tm_year; year - 1900 */
|
/* int tm_year; year - 1900 */
|
||||||
static int get_year(struct tm * tblock) { return (tblock->tm_year - 100); }
|
static int get_year(struct tm * tblock) { return (tblock->tm_year - 100); }
|
||||||
@ -56,10 +47,10 @@ static int get_second(struct tm * tblock) { return (tblock->tm_sec); }
|
|||||||
* 引数の表示の問題もあるしね.
|
* 引数の表示の問題もあるしね.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void rtc_set_datetime(int field, unsigned int value)
|
void rtc_set_datetime(int type, unsigned int value)
|
||||||
{
|
{
|
||||||
printf("call : rtc_set_datetime() : field = %d, value = %d\n",
|
printf("call : rtc_set_datetime() : type = %d, value = %d\n",
|
||||||
field, (int)value);
|
type, (int)value);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
/* 未サポート */
|
/* 未サポート */
|
||||||
@ -71,19 +62,19 @@ void rtc_set_datetime(int field, unsigned int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int rtc_get_datetime(int field)
|
unsigned int rtc_get_datetime(int type)
|
||||||
{
|
{
|
||||||
unsigned int ret = 0;
|
unsigned int ret = 0;
|
||||||
time_t timer;
|
time_t timer;
|
||||||
struct tm * tblock;
|
struct tm * tblock;
|
||||||
|
|
||||||
printf("call : rtc_get_datetime() : field = %d\n", field);
|
printf("call : rtc_get_datetime() : type = %d\n", type);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
time(&timer);
|
time(&timer);
|
||||||
tblock = localtime(&timer);
|
tblock = localtime(&timer);
|
||||||
|
|
||||||
switch (field) {
|
switch (type) {
|
||||||
case RTC_YEAR : ret = get_year( tblock); break;
|
case RTC_YEAR : ret = get_year( tblock); break;
|
||||||
case RTC_MONTH : ret = get_month( tblock); break;
|
case RTC_MONTH : ret = get_month( tblock); break;
|
||||||
case RTC_DATE : ret = get_day( tblock); break;
|
case RTC_DATE : ret = get_day( tblock); break;
|
||||||
@ -91,7 +82,7 @@ unsigned int rtc_get_datetime(int field)
|
|||||||
case RTC_HOUR : ret = get_hour( tblock); break;
|
case RTC_HOUR : ret = get_hour( tblock); break;
|
||||||
case RTC_MIN : ret = get_minute(tblock); break;
|
case RTC_MIN : ret = get_minute(tblock); break;
|
||||||
case RTC_SEC : ret = get_second(tblock); break;
|
case RTC_SEC : ret = get_second(tblock); break;
|
||||||
default : Error("rtc_get_datetime", "Unknown parameter.");
|
default : Wonx_Error("rtc_get_datetime", "Unknown parameter.");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("call : rtc_get_datetime() : return value = %d\n", (int)ret);
|
printf("call : rtc_get_datetime() : return value = %d\n", (int)ret);
|
||||||
@ -100,9 +91,9 @@ unsigned int rtc_get_datetime(int field)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtc_set_datetime_struct(void * buffer)
|
void rtc_set_datetime_struct(datetime_t * d)
|
||||||
{
|
{
|
||||||
printf("call : rtc_set_datetime_struct() : buffer = %p\n", buffer);
|
printf("call : rtc_set_datetime_struct() : buffer = %p\n", (void *)d);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
/* 未サポート */
|
/* 未サポート */
|
||||||
@ -114,27 +105,24 @@ void rtc_set_datetime_struct(void * buffer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtc_get_datetime_struct(void * buffer)
|
void rtc_get_datetime_struct(datetime_t * d)
|
||||||
{
|
{
|
||||||
time_t timer;
|
time_t timer;
|
||||||
struct tm * tblock;
|
struct tm * tblock;
|
||||||
datetime_t * p;
|
|
||||||
|
|
||||||
printf("call : rtc_get_datetime_struct() : buffer = %p\n", buffer);
|
printf("call : rtc_get_datetime_struct() : buffer = %p\n", (void *)d);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
time(&timer);
|
time(&timer);
|
||||||
tblock = localtime(&timer);
|
tblock = localtime(&timer);
|
||||||
|
|
||||||
p = (datetime_t *)buffer;
|
d->year = get_year(tblock);
|
||||||
|
d->month = get_month(tblock);
|
||||||
p->year = get_year(tblock);
|
d->date = get_day(tblock);
|
||||||
p->month = get_month(tblock);
|
d->day_of_week = get_week(tblock);
|
||||||
p->date = get_day(tblock);
|
d->hour = get_hour(tblock);
|
||||||
p->day_of_week = get_week(tblock);
|
d->minute = get_minute(tblock);
|
||||||
p->hour = get_hour(tblock);
|
d->second = get_second(tblock);
|
||||||
p->minute = get_minute(tblock);
|
|
||||||
p->second = get_second(tblock);
|
|
||||||
|
|
||||||
printf("call : rtc_get_datetime_struct() : return value = none\n");
|
printf("call : rtc_get_datetime_struct() : return value = none\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -170,7 +158,7 @@ void rtc_disable_alarm(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_enable(int type, unsigned int auto_preset, unsigned int preset)
|
void timer_enable(int type, unsigned int auto_preset, unsigned int count)
|
||||||
{
|
{
|
||||||
WWTimer ww_timer;
|
WWTimer ww_timer;
|
||||||
|
|
||||||
@ -179,8 +167,8 @@ void timer_enable(int type, unsigned int auto_preset, unsigned int preset)
|
|||||||
/* タイマを一時停止する */
|
/* タイマを一時停止する */
|
||||||
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
|
||||||
|
|
||||||
printf("call : timer_enable() : type = %d, auto_preset = %u, preset = %u\n",
|
printf("call : timer_enable() : type = %d, auto_preset = %u, count = %u\n",
|
||||||
type, (int)auto_preset, (int)preset);
|
type, (int)auto_preset, (int)count);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -193,11 +181,11 @@ void timer_enable(int type, unsigned int auto_preset, unsigned int preset)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case TIMER_VBLANK:
|
case TIMER_VBLANK:
|
||||||
ww_timer = WonxSystem_GetWWVBlankCountUpTimer(Wonx_GetWonxSystem());
|
ww_timer = WonxSystem_GetWWVBlankCountUpTimer(Wonx_GetWonxSystem());
|
||||||
WWTimer_SetPresetCounter(ww_timer, preset * WONX_VBLANK_INTERVAL);
|
WWTimer_SetPresetCounter(ww_timer, count * WONX_VBLANK_INTERVAL);
|
||||||
break;
|
break;
|
||||||
case TIMER_HBLANK:
|
case TIMER_HBLANK:
|
||||||
ww_timer = WonxSystem_GetWWHBlankCountUpTimer(Wonx_GetWonxSystem());
|
ww_timer = WonxSystem_GetWWHBlankCountUpTimer(Wonx_GetWonxSystem());
|
||||||
WWTimer_SetPresetCounter(ww_timer, preset * WONX_HBLANK_INTERVAL);
|
WWTimer_SetPresetCounter(ww_timer, count * WONX_HBLANK_INTERVAL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
@ -205,13 +193,13 @@ void timer_enable(int type, unsigned int auto_preset, unsigned int preset)
|
|||||||
* NULL に初期化する.
|
* NULL に初期化する.
|
||||||
*/
|
*/
|
||||||
ww_timer = NULL;
|
ww_timer = NULL;
|
||||||
Error("timer_enable", "Invalid timer type.");
|
Wonx_Error("timer_enable", "Invalid timer type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (auto_preset) {
|
switch (auto_preset) {
|
||||||
case TIMER_ONESHOT: WWTimer_SetAutoPresetOFF(ww_timer); break;
|
case TIMER_ONESHOT: WWTimer_SetAutoPresetOFF(ww_timer); break;
|
||||||
case TIMER_AUTOPRESET: WWTimer_SetAutoPresetON( ww_timer); break;
|
case TIMER_AUTOPRESET: WWTimer_SetAutoPresetON( ww_timer); break;
|
||||||
default: Error("timer_enable", "Invalid auto preset type.");
|
default: Wonx_Error("timer_enable", "Invalid auto preset type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
WWTimer_Reset(ww_timer);
|
WWTimer_Reset(ww_timer);
|
||||||
@ -251,7 +239,7 @@ void timer_disable(int type)
|
|||||||
* NULL に初期化する.
|
* NULL に初期化する.
|
||||||
*/
|
*/
|
||||||
ww_timer = NULL;
|
ww_timer = NULL;
|
||||||
Error("timer_disable", "Invalid timer type.");
|
Wonx_Error("timer_disable", "Invalid timer type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
WWTimer_OFF(ww_timer);
|
WWTimer_OFF(ww_timer);
|
||||||
@ -291,7 +279,7 @@ unsigned int timer_get_count(int type)
|
|||||||
* NULL に初期化する.
|
* NULL に初期化する.
|
||||||
*/
|
*/
|
||||||
ww_timer = NULL;
|
ww_timer = NULL;
|
||||||
Error("timer_get_count", "Invalid timer type.");
|
Wonx_Error("timer_get_count", "Invalid timer type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = WWTimer_GetCounter(ww_timer);
|
ret = WWTimer_GetCounter(ww_timer);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/* configure.h for configuration of xfireworks */
|
/* configure.h for configuration of wonx */
|
||||||
|
|
||||||
#ifndef _WONX_CONFIGURE_H_INCLUDED_
|
#ifndef _WONX_winx_configure_h_INCLUDED_
|
||||||
#define _WONX_CONFIGURE_H_INCLUDED_
|
#define _WONX_wonx_configure_h_INCLUDED_
|
||||||
|
|
||||||
/* Wonx でのタイマ割り込みの周期(単位はマイクロ秒) */
|
/* Wonx でのタイマ割り込みの周期(単位はマイクロ秒) */
|
||||||
#define WONX_TIMER_INTERVAL 100000 /* 0.1 秒*/
|
#define WONX_TIMER_INTERVAL 100000 /* 0.1 秒*/
|
||||||
@ -10,6 +10,6 @@
|
|||||||
#define WONX_HBLANK_INTERVAL ( 3 * 10) /* 3 秒毎 */
|
#define WONX_HBLANK_INTERVAL ( 3 * 10) /* 3 秒毎 */
|
||||||
#define WONX_VBLANK_INTERVAL (20 * 10) /* 20 秒毎 */
|
#define WONX_VBLANK_INTERVAL (20 * 10) /* 20 秒毎 */
|
||||||
|
|
||||||
#endif /* _WONX_CONFIGURE_H_INCLUDED_ */
|
#endif /* _WONX_wonx_configure_h_INCLUDED_ */
|
||||||
|
|
||||||
/* End of configure.h */
|
/* End of wonx_configure.h */
|
||||||
39
wonx_include/bank.h
Normal file
39
wonx_include/bank.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef _WONX_SYS_BANK_H_
|
||||||
|
#define _WONX_SYS_BANK_H_
|
||||||
|
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 年眶の年盗 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define BANK_SRAM 0
|
||||||
|
#define BANK_ROM0 1
|
||||||
|
#define BANK_ROM1 2
|
||||||
|
|
||||||
|
#define sram_get_map() bank_get_map(BANK_SRAM)
|
||||||
|
#define rom0_get_map() bank_get_map(BANK_ROM0)
|
||||||
|
#define rom1_get_map() bank_get_map(BANK_ROM1)
|
||||||
|
#define sram_set_map(bank) bank_set_map(BANK_SRAM, bank)
|
||||||
|
#define rom0_set_map(bank) bank_set_map(BANK_ROM0, bank)
|
||||||
|
#define rom1_set_map(bank) bank_set_map(BANK_ROM1, bank)
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 高垂簇眶の离咐 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void bank_set_map(int bank, int bank_num);
|
||||||
|
int bank_get_map(int bank);
|
||||||
|
unsigned char bank_read_byte(int bank, unsigned int off);
|
||||||
|
void bank_write_byte(int bank, unsigned int off, unsigned int data);
|
||||||
|
unsigned int bank_read_word(int bank, unsigned int off);
|
||||||
|
void bank_write_word(int bank, unsigned int off, unsigned int data);
|
||||||
|
void bank_read_block(int bank, unsigned int off,
|
||||||
|
void * buffer, unsigned int size);
|
||||||
|
void bank_write_block(int bank, unsigned int off,
|
||||||
|
void * buffer, unsigned int size);
|
||||||
|
void bank_fill_block(int bank, unsigned int off,
|
||||||
|
unsigned int size, unsigned int data);
|
||||||
|
void bank_erase_flash(int bank);
|
||||||
|
|
||||||
|
#endif
|
||||||
13
wonx_include/bios.h
Normal file
13
wonx_include/bios.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef _WONX_SYS_BIOS_H_
|
||||||
|
#define _WONX_SYS_BIOS_H_
|
||||||
|
|
||||||
|
#include "bank.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "disp.h"
|
||||||
|
#include "key.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "text.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
71
wonx_include/comm.h
Normal file
71
wonx_include/comm.h
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#ifndef _WONX_SYS_COMM_H_
|
||||||
|
#define _WONX_SYS_COMM_H_
|
||||||
|
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 年眶の年盗 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define COMM_SPEED_9600 0
|
||||||
|
#define COMM_SPEED_38400 1
|
||||||
|
|
||||||
|
#define XMODE_SEND 0
|
||||||
|
#define XMODE_RECEIVE 1
|
||||||
|
#define XMODE_SEND_ENCRYPTED 2
|
||||||
|
#define XMODE_RECEIVE_ENCRYPTED 3
|
||||||
|
#define XMODE_AUTO_ERASE 4
|
||||||
|
|
||||||
|
#define ERR_SIO_OK 0x0000
|
||||||
|
#define ERR_SIO_BUSY 0x8100
|
||||||
|
#define ERR_SIO_TIMEOUT 0x8101
|
||||||
|
#define ERR_SIO_OVERRUN 0x8102
|
||||||
|
#define ERR_SIO_CANCEL 0x8103
|
||||||
|
#define ERR_XM_STATECODE 0x8104
|
||||||
|
#define ERR_XM_CANCELED 0x8105
|
||||||
|
#define ERR_XM_BLOCK_LOST 0x8106
|
||||||
|
#define ERR_XM_TOO_LARGE 0x8107
|
||||||
|
|
||||||
|
enum {
|
||||||
|
XM_START = 1,
|
||||||
|
XM_NEGO,
|
||||||
|
XM_BLOCK,
|
||||||
|
XM_BLOCK_RETRY,
|
||||||
|
XM_CLOSE,
|
||||||
|
XM_ABORT,
|
||||||
|
XM_DONE,
|
||||||
|
XM_ERASE_BANK
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int state;
|
||||||
|
char mode;
|
||||||
|
char retry_c;
|
||||||
|
int block_c;
|
||||||
|
int block_max;
|
||||||
|
int block_size;
|
||||||
|
int bank;
|
||||||
|
int offset;
|
||||||
|
int timeout_c;
|
||||||
|
} xmodeminfo;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 高垂簇眶の离咐 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void comm_open(void);
|
||||||
|
void comm_close(void);
|
||||||
|
int comm_send_char(unsigned char c);
|
||||||
|
int comm_receive_char(void);
|
||||||
|
int comm_receive_with_timeout(int timeout);
|
||||||
|
int comm_send_string(char * string);
|
||||||
|
int comm_send_block(void * buffer, int size);
|
||||||
|
int comm_receive_block(void * buffer, int size);
|
||||||
|
void comm_set_timeout(int recv_timeout, int send_timeout);
|
||||||
|
void comm_set_baudrate(int baudrate);
|
||||||
|
int comm_get_baudrate(void);
|
||||||
|
void comm_set_cancel_key(unsigned int pattern);
|
||||||
|
unsigned int comm_get_cancel_key(void);
|
||||||
|
int comm_xmodem(void * xmodem);
|
||||||
|
|
||||||
|
#endif
|
||||||
112
wonx_include/disp.h
Normal file
112
wonx_include/disp.h
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
#ifndef _WONX_SYS_DISP_H_
|
||||||
|
#define _WONX_SYS_DISP_H_
|
||||||
|
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 定数の定義 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define SCREEN1 0
|
||||||
|
#define SCREEN2 1
|
||||||
|
|
||||||
|
#define LCD_PIXEL_WIDTH 224
|
||||||
|
#define LCD_PIXEL_HEIGHT 144
|
||||||
|
#define SCREEN_PIXEL_WIDTH 256
|
||||||
|
#define SCREEN_PIXEL_HEIGHT 256
|
||||||
|
#define SCREEN_CHAR_WIDTH 32
|
||||||
|
#define SCREEN_CHAR_HEIGHT 32
|
||||||
|
|
||||||
|
#define DCM_SCR1 (1 << 0)
|
||||||
|
#define DCM_SCR2 (1 << 1)
|
||||||
|
#define DCM_SPR (1 << 2)
|
||||||
|
#define DCM_SPR_WIN (1 << 3)
|
||||||
|
#define DCM_SCR2_WIN_INSIDE (1 << 5)
|
||||||
|
#define DCM_SCR2_WIN_OUTSIDE ((1 << 4) | (1 << 5))
|
||||||
|
#define DCM_BORDER_COLOR ((1 << 8) | (1 << 9) | (1 << 10))
|
||||||
|
|
||||||
|
/* SPRITE_SET_CHAR, SCREEN_SET_CHAR で使用 */
|
||||||
|
#define CFM_FLIP_V (1 << 15)
|
||||||
|
#define CFM_FLIP_H (1 << 14)
|
||||||
|
#define CFM_FONT 0x01FF /* 0~8ビット目 */
|
||||||
|
|
||||||
|
/* SPRITE_SET_CHAR で使用 */
|
||||||
|
#define CFM_SPR_UPPER (1 << 13)
|
||||||
|
#define CFM_SPRWIN_CLIP (1 << 12)
|
||||||
|
#define CFM_SPR_PALETTE ((1 << 9) | (1 << 10) | (1 << 11))
|
||||||
|
|
||||||
|
/* SCREEN_SET_CHAR で使用 */
|
||||||
|
#define CFM_SCR_PALETTE ((1 << 9) | (1 << 10) | (1 << 11) | (1 << 12))
|
||||||
|
|
||||||
|
#define CFSFT_PALETTE 9
|
||||||
|
|
||||||
|
/* LCD_SET_SEGMENTS で使用 */
|
||||||
|
#define LCDSEG_AUX3 (1 << 5) /* 予備マーク3 */
|
||||||
|
#define LCDSEG_AUX2 (1 << 4) /* 予備マーク2 */
|
||||||
|
#define LCDSEG_AUX1 (1 << 3) /* 予備マーク1 */
|
||||||
|
#define LCDSEG_HORIZONTAL (1 << 2) /* 縦モードマーク */
|
||||||
|
#define LCDSEG_VERTICAL (1 << 1) /* 横モードマーク */
|
||||||
|
#define LCDSEG_SLEEP (1 << 0) /* 省電力マーク */
|
||||||
|
|
||||||
|
/* LCD_SET_SLEEP で使用 */
|
||||||
|
#define LCD_SLEEP_ON 0
|
||||||
|
#define LCD_SLEEP_OFF 1
|
||||||
|
|
||||||
|
#define lcd_on() lcd_set_sleep(LCD_SLEEP_OFF)
|
||||||
|
#define lcd_off() lcd_set_sleep(LCD_SLEEP_ON)
|
||||||
|
|
||||||
|
/* 未実装 */
|
||||||
|
void lcd_set_interrupt_line(unsigned char line);
|
||||||
|
unsigned char lcd_get_display_line();
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 互換関数の宣言 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void display_control(unsigned int flags);
|
||||||
|
unsigned int display_status(void);
|
||||||
|
void font_set_monodata(unsigned int number, unsigned int count,
|
||||||
|
unsigned char * data);
|
||||||
|
void font_set_colordata(unsigned int number, unsigned int count,
|
||||||
|
unsigned char * data);
|
||||||
|
void font_get_data(unsigned int number, unsigned int count,
|
||||||
|
unsigned char * data);
|
||||||
|
void font_set_color(unsigned int colors);
|
||||||
|
unsigned int font_get_color(void);
|
||||||
|
void screen_set_char(int screen, int x, int y, int w, int h,
|
||||||
|
unsigned short int * data);
|
||||||
|
void screen_get_char(int screen, int x, int y, int w, int h,
|
||||||
|
unsigned short int * data);
|
||||||
|
unsigned int screen_get_char1(int screen, int x, int y);
|
||||||
|
void screen_fill_char(int screen, int x, int y, int w, int h,
|
||||||
|
unsigned int data);
|
||||||
|
void screen_fill_attr(int screen, int x, int y, int w, int h,
|
||||||
|
unsigned int data, unsigned int mask);
|
||||||
|
void sprite_set_range(unsigned int start, unsigned int number);
|
||||||
|
void sprite_set_char(unsigned int sprite_num, unsigned int data);
|
||||||
|
unsigned int sprite_get_char(unsigned int sprite_num);
|
||||||
|
void sprite_set_location(unsigned int sprite_num, int x, int y);
|
||||||
|
unsigned int sprite_get_location(unsigned int sprite_num);
|
||||||
|
void sprite_set_char_location(unsigned int sprite_num,
|
||||||
|
unsigned int data, int x, int y);
|
||||||
|
unsigned long int sprite_get_char_location(unsigned int sprite_num);
|
||||||
|
void sprite_set_data(unsigned int sprite_num, unsigned int count,
|
||||||
|
unsigned long int * data);
|
||||||
|
void screen_set_scroll(int screen, int x, int y);
|
||||||
|
unsigned int screen_get_scroll(int screen);
|
||||||
|
void screen2_set_window(int x, int y, int w, int h);
|
||||||
|
unsigned long int screen2_get_window(void);
|
||||||
|
void sprite_set_window(int x, int y, int w, int h);
|
||||||
|
unsigned long int sprite_get_window(void);
|
||||||
|
void palette_set_color(unsigned int palette_num, unsigned int colors);
|
||||||
|
unsigned int palette_get_color(unsigned int palette_num);
|
||||||
|
void lcd_set_color(unsigned int colors0, unsigned int colors1);
|
||||||
|
unsigned long int lcd_get_color(void);
|
||||||
|
void lcd_set_segments(unsigned int segments);
|
||||||
|
unsigned int lcd_get_segments(void);
|
||||||
|
void lcd_set_sleep(unsigned int slp);
|
||||||
|
unsigned int lcd_get_sleep(void);
|
||||||
|
void screen_set_vram(int screen, int location_id);
|
||||||
|
void sprite_set_vram(int location_id);
|
||||||
|
|
||||||
|
#endif
|
||||||
42
wonx_include/key.h
Normal file
42
wonx_include/key.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef _WONX_SYS_KEY_H_
|
||||||
|
#define _WONX_SYS_KEY_H_
|
||||||
|
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 年眶の年盗 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define KEY_START (1 << 1)
|
||||||
|
#define KEY_A (1 << 2)
|
||||||
|
#define KEY_B (1 << 3)
|
||||||
|
#define KEY_UP1 (1 << 4)
|
||||||
|
#define KEY_RIGHT1 (1 << 5)
|
||||||
|
#define KEY_DOWN1 (1 << 6)
|
||||||
|
#define KEY_LEFT1 (1 << 7)
|
||||||
|
#define KEY_UP2 (1 << 8)
|
||||||
|
#define KEY_RIGHT2 (1 << 9)
|
||||||
|
#define KEY_DOWN2 (1 << 10)
|
||||||
|
#define KEY_LEFT2 (1 << 11)
|
||||||
|
|
||||||
|
#define KEY_X1 KEY_UP1
|
||||||
|
#define KEY_X2 KEY_RIGHT1
|
||||||
|
#define KEY_X3 KEY_DOWN1
|
||||||
|
#define KEY_X4 KEY_LEFT1
|
||||||
|
#define KEY_Y1 KEY_UP2
|
||||||
|
#define KEY_Y2 KEY_RIGHT2
|
||||||
|
#define KEY_Y3 KEY_DOWN2
|
||||||
|
#define KEY_Y4 KEY_LEFT2
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 高垂簇眶の离咐 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
int key_press_check(void);
|
||||||
|
int key_hit_check(void);
|
||||||
|
int key_wait(void);
|
||||||
|
void key_set_repeat(int rate, int delay);
|
||||||
|
int key_get_repeat(void);
|
||||||
|
int key_hit_check_with_repeat(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
14
wonx_include/service.h
Normal file
14
wonx_include/service.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _WONX_SYS_SERVICE_H_
|
||||||
|
#define _WONX_SYS_SERVICE_H_
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
#define MK_WORD(high,low) (((unsigned short int)(high) << 8) | ((unsigned short int)(low)))
|
||||||
|
#define MK_DWORD(high,low) (((unsigned long int)(high) << 16) | ((unsigned long int)(low)))
|
||||||
|
#define MK_FP(seg,off) ((void *)MK_DWORD(seg,off))
|
||||||
|
#define FP_OFF(p) ((unsigned short int)((unsigned long int)(p) & 0xffff))
|
||||||
|
#define FP_SEG(p) ((unsigned short int)((unsigned long int)(p) >> 16))
|
||||||
|
|
||||||
|
void bios_exit();
|
||||||
|
|
||||||
|
#endif
|
||||||
26
wonx_include/sound.h
Normal file
26
wonx_include/sound.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef _WONX_SYS_SOUND_H_
|
||||||
|
#define _WONX_SYS_SOUND_H_
|
||||||
|
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* ¸ß´¹´Ø¿ô¤ÎÀë¸À */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void sound_init(void);
|
||||||
|
void sound_set_channel(unsigned int flags);
|
||||||
|
unsigned int sound_get_channel(void);
|
||||||
|
void sound_set_output(unsigned int flags);
|
||||||
|
unsigned int sound_get_output(void);
|
||||||
|
void sound_set_wave(int channel, unsigned char * wave);
|
||||||
|
void sound_set_pitch(int channel, unsigned int frequency);
|
||||||
|
unsigned int sound_get_pitch(int channel);
|
||||||
|
void sound_set_volume(int channel, unsigned int volume);
|
||||||
|
unsigned int sound_get_volume(int channel);
|
||||||
|
void sound_set_sweep(int sweep, int step);
|
||||||
|
unsigned int sound_get_sweep(void);
|
||||||
|
void sound_set_noise(unsigned int flags);
|
||||||
|
unsigned int sound_get_noise(void);
|
||||||
|
unsigned int sound_get_random(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
58
wonx_include/system.h
Normal file
58
wonx_include/system.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#ifndef _WONX_SYS_SYSTEM_H_
|
||||||
|
#define _WONX_SYS_SYSTEM_H_
|
||||||
|
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 年眶の年盗 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SYS_INT_SENDREADY = 0,
|
||||||
|
SYS_INT_KEY,
|
||||||
|
SYS_INT_CASETTE,
|
||||||
|
SYS_INT_RECEIVEREADY,
|
||||||
|
SYS_INT_DISPLINE,
|
||||||
|
SYS_INT_TIMER_COUNTUP,
|
||||||
|
SYS_INT_VBLANK,
|
||||||
|
SYS_INT_HBLANK_COUNTUP
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
void (*callback)(void);
|
||||||
|
int cs;
|
||||||
|
int ds;
|
||||||
|
int reserve;
|
||||||
|
} intvector_t;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 高垂簇眶の离咐 */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void sys_interrupt_set_hook(int type, intvector_t * vector,
|
||||||
|
intvector_t * old_vector);
|
||||||
|
void sys_interrupt_reset_hook(int type, intvector_t * old_vector);
|
||||||
|
void sys_wait(unsigned int wait_time);
|
||||||
|
unsigned long int sys_get_tick_count(void);
|
||||||
|
void sys_sleep(void);
|
||||||
|
void sys_set_sleep_time(int sleep_time);
|
||||||
|
int sys_get_sleep_time(void);
|
||||||
|
void sys_set_awake_key(int pattern);
|
||||||
|
int sys_get_awake_key(void);
|
||||||
|
void sys_set_keepalive_int(int pattern);
|
||||||
|
void sys_get_ownerinfo(int size, char * buffer);
|
||||||
|
int sys_suspend(int core);
|
||||||
|
void sys_resume(int core);
|
||||||
|
void sys_set_remote(int remote);
|
||||||
|
unsigned int sys_get_remote(void);
|
||||||
|
void * sys_alloc_iram(void * p, unsigned int size);
|
||||||
|
void sys_free_iram(void * p);
|
||||||
|
void * sys_get_my_iram(void);
|
||||||
|
unsigned int sys_get_version(void);
|
||||||
|
int sys_swap(int core);
|
||||||
|
void sys_set_resume(unsigned int flags);
|
||||||
|
unsigned int sys_get_resume(void);
|
||||||
|
|
||||||
|
void bios_exit();
|
||||||
|
|
||||||
|
#endif
|
||||||
19
wonx_include/system_configure.h
Normal file
19
wonx_include/system_configure.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* configure.h for configuration of wonx */
|
||||||
|
|
||||||
|
#ifndef _WONX_system_configure_h_INCLUDED_
|
||||||
|
#define _WONX_system_configure_h_INCLUDED_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 以下を有効にすると,ushort, ulong が typedef される.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if 0 /* ushort は,普通は標準で /usr/include/sys/types.h で定義されている */
|
||||||
|
#define TYPEDEF_USHORT
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
#define TYPEDEF_ULONG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _WONX_system_configure_h_INCLUDED_ */
|
||||||
|
|
||||||
|
/* End of system_configure.h */
|
||||||
46
wonx_include/text.h
Normal file
46
wonx_include/text.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef _WONX_SYS_TEXT_H_
|
||||||
|
#define _WONX_SYS_TEXT_H_
|
||||||
|
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
#define NUM_PADSPACE 0
|
||||||
|
#define NUM_ALIGN_RIGHT 0
|
||||||
|
#define NUM_HEXA (1 << 0)
|
||||||
|
#define NUM_PADZERO (1 << 1)
|
||||||
|
#define NUM_ALIGN_LEFT (1 << 2)
|
||||||
|
#define NUM_SIGNED (1 << 3)
|
||||||
|
#define NUM_STORE (1 << 7)
|
||||||
|
|
||||||
|
#define TEXT_MODE_ANK 0
|
||||||
|
#define TEXT_MODE_ANK_SJIS 1
|
||||||
|
#define TEXT_MODE_SJIS 2
|
||||||
|
|
||||||
|
#define TEXT_SCREEN_WIDTH 28
|
||||||
|
#define TEXT_SCREEN_HEIGHT 18
|
||||||
|
|
||||||
|
void text_screen_init(void);
|
||||||
|
void text_window_init(int x, int y, int w, int h, unsigned int base);
|
||||||
|
void text_set_mode(int mode);
|
||||||
|
int text_get_mode(void);
|
||||||
|
void text_put_char(int x, int y, unsigned int c);
|
||||||
|
int text_put_string(int x, int y, char * string);
|
||||||
|
int text_put_substring(int x, int y, char * s, int length);
|
||||||
|
void text_put_numeric(int x, int y, int length, int format, int number);
|
||||||
|
void text_store_numeric(char * buffer, int length, int format, int number);
|
||||||
|
void text_fill_char(int x, int y, int length, int c);
|
||||||
|
void text_set_palette(int palette_num);
|
||||||
|
int text_get_palette(void);
|
||||||
|
void text_set_ank_font(int base, int color, int count, void * font);
|
||||||
|
void text_set_sjis_font(void * p);
|
||||||
|
void text_get_fontdata(int c, void * buffer);
|
||||||
|
void text_set_screen(int screen);
|
||||||
|
int text_get_screen(void);
|
||||||
|
void cursor_display(int flag);
|
||||||
|
int cursor_status(void);
|
||||||
|
void cursor_set_location(int x, int y, int w, int h);
|
||||||
|
unsigned long int cursor_get_location(void);
|
||||||
|
void cursor_set_type(int palette_num, int interval);
|
||||||
|
unsigned long int cursor_get_type(void);
|
||||||
|
int text_printf(int x, int y, const char *format, ...);
|
||||||
|
|
||||||
|
#endif
|
||||||
52
wonx_include/timer.h
Normal file
52
wonx_include/timer.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#ifndef _WONX_SYS_TIMER_H_
|
||||||
|
#define _WONX_SYS_TIMER_H_
|
||||||
|
|
||||||
|
#include "service.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
RTC_YEAR = 0,
|
||||||
|
RTC_MONTH,
|
||||||
|
RTC_DATE,
|
||||||
|
RTC_DAY_OF_WEEK,
|
||||||
|
RTC_HOUR,
|
||||||
|
RTC_MIN,
|
||||||
|
RTC_SEC
|
||||||
|
};
|
||||||
|
|
||||||
|
enum timer_type {
|
||||||
|
TIMER_HBLANK = 0,
|
||||||
|
TIMER_VBLANK
|
||||||
|
};
|
||||||
|
|
||||||
|
enum timer_preset_type {
|
||||||
|
TIMER_ONESHOT = 0,
|
||||||
|
TIMER_AUTOPRESET
|
||||||
|
};
|
||||||
|
|
||||||
|
#define rtc_set_year(year) rtc_set_datetime(RTC_YEAR, year)
|
||||||
|
#define rtc_set_month(month) rtc_set_datetime(RTC_MONTH, month)
|
||||||
|
#define rtc_set_date(date) rtc_set_datetime(RTC_DATE, date)
|
||||||
|
#define rtc_set_day_of_week(week) rtc_set_datetime(RTC_DAY_OF_WEEK, week)
|
||||||
|
#define rtc_set_hour(hour) rtc_set_datetime(RTC_HOUR, hour)
|
||||||
|
#define rtc_set_minute(min) rtc_set_datetime(RTC_MIN, min)
|
||||||
|
#define rtc_set_second(sec) rtc_set_datetime(RTC_SEC, sec)
|
||||||
|
|
||||||
|
#define rtc_get_year() rtc_get_datetime(RTC_YEAR)
|
||||||
|
#define rtc_get_month() rtc_get_datetime(RTC_MONTH)
|
||||||
|
#define rtc_get_date() rtc_get_datetime(RTC_DATE)
|
||||||
|
#define rtc_get_day_of_week() rtc_get_datetime(RTC_DAY_OF_WEEK)
|
||||||
|
#define rtc_get_hour() rtc_get_datetime(RTC_HOUR)
|
||||||
|
#define rtc_get_minute() rtc_get_datetime(RTC_MIN)
|
||||||
|
#define rtc_get_second() rtc_get_datetime(RTC_SEC)
|
||||||
|
|
||||||
|
void rtc_set_datetime(int type, unsigned int value);
|
||||||
|
unsigned int rtc_get_datetime(int type);
|
||||||
|
void rtc_set_datetime_struct(datetime_t * d);
|
||||||
|
void rtc_get_datetime_struct(datetime_t * d);
|
||||||
|
void rtc_enable_alarm(int hour, int minute);
|
||||||
|
void rtc_disable_alarm(void);
|
||||||
|
void timer_enable(int type, unsigned int auto_preset, unsigned int count);
|
||||||
|
void timer_disable(int type);
|
||||||
|
unsigned int timer_get_count(int type);
|
||||||
|
|
||||||
|
#endif
|
||||||
46
wonx_include/types.h
Normal file
46
wonx_include/types.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef _WONX_SYS_TYPES_H_
|
||||||
|
#define _WONX_SYS_TYPES_H_
|
||||||
|
|
||||||
|
#include "system_configure.h"
|
||||||
|
|
||||||
|
#include <stdlib.h> /* for NULL definition */
|
||||||
|
|
||||||
|
#ifdef TYPEDEF_USHORT
|
||||||
|
typedef unsigned short int ushort;
|
||||||
|
#endif
|
||||||
|
#ifdef TYPEDEF_ULONG
|
||||||
|
typedef unsigned long int ulong;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned char BYTE;
|
||||||
|
typedef unsigned short WORD;
|
||||||
|
typedef unsigned long DWORD;
|
||||||
|
typedef int BOOL;
|
||||||
|
|
||||||
|
#ifndef far
|
||||||
|
#define far /* None */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef near
|
||||||
|
#define near /* None */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
BYTE year;
|
||||||
|
BYTE month;
|
||||||
|
BYTE date;
|
||||||
|
BYTE day_of_week;
|
||||||
|
BYTE hour;
|
||||||
|
BYTE minute;
|
||||||
|
BYTE second;
|
||||||
|
} datetime_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
x
Reference in New Issue
Block a user