No Description

Hiroaki Sakai c0b964b4f4 Added dummy function of _asm_*(). 23 years ago
wonx_include c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
COPYING 3c624a304e Initial version 23 years ago
COPYRIGHT f25d7235fb Changed official name from Wonx to WonX. 6 years ago
HISTORY c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
MANUAL c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
Makefile c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
OMAKE.jpn f25d7235fb Changed official name from Wonx to WonX. 6 years ago
README c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
UNIXSerialPort.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
UNIXSerialPort.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
UNIXSerialPortP.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
UNIXTimer.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
UNIXTimer.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
UNIXTimerP.h f25d7235fb Changed official name from Wonx to WonX. 6 years ago
WWCharacter.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWCharacter.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWCharacterP.h 3c624a304e Initial version 23 years ago
WWColorMap.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWColorMap.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWColorMapP.h 3c624a304e Initial version 23 years ago
WWCursor.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWCursor.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWCursorP.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWDisplay.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWDisplay.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWDisplayP.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWInterrupt.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWInterrupt.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWInterruptP.h 0f43e6d6ee Added interrupt handling. Timer interrupt support. 6 years ago
WWLCDPanel.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWLCDPanel.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWLCDPanelP.h 95d1135996 WWLCDPanel has two bitmap data, and the bitmap once drawn is 23 years ago
WWPalette.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWPalette.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWPaletteP.h 3c624a304e Initial version 23 years ago
WWScreen.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWScreen.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWScreenP.h 96b108c909 In UNIXTimer.c, callback function is called every time the callback function is called 6 years ago
WWSerialPort.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWSerialPort.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWSerialPortP.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWSprite.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWSprite.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWSpriteP.h 3c624a304e Initial version 23 years ago
WWText.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWText.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWTextFonts.c eb06f7f4f8 Added text display function. (Only 0 to 127 ASCII characters, kanji is not supported) 6 years ago
WWTextP.h eb06f7f4f8 Added text display function. (Only 0 to 127 ASCII characters, kanji is not supported) 6 years ago
WWTimer.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWTimer.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WWTimerP.h 0f43e6d6ee Added interrupt handling. Timer interrupt support. 6 years ago
WonX.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonX.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXDisplay.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXDisplay.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXDisplayP.h f25d7235fb Changed official name from Wonx to WonX. 6 years ago
WonXP.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXSerialPort.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXSerialPort.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXSerialPortP.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXSystem.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXSystem.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
WonXSystemP.h f25d7235fb Changed official name from Wonx to WonX. 6 years ago
Wonx2WonX.pl f25d7235fb Changed official name from Wonx to WonX. 6 years ago
XDisplay.c f25d7235fb Changed official name from Wonx to WonX. 6 years ago
XDisplay.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
XDisplayP.h 9c414a9117 Fixed the display range of screen2_set_window (). 23 years ago
bank.c f25d7235fb Changed official name from Wonx to WonX. 6 years ago
comm.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
disp.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
etc.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
etc.h c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
key.c f25d7235fb Changed official name from Wonx to WonX. 6 years ago
makefile_for_smac 5e1a9795b7 Create your own header file. It became compilable with only Wonx. 6 years ago
makefile_for_wwterm c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
readline.pl f25d7235fb Changed official name from Wonx to WonX. 6 years ago
sample1.c f25d7235fb Changed official name from Wonx to WonX. 6 years ago
sample2.c 5e1a9795b7 Create your own header file. It became compilable with only Wonx. 6 years ago
service.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
smac-b02.zip 5e1a9795b7 Create your own header file. It became compilable with only Wonx. 6 years ago
sound.c f25d7235fb Changed official name from Wonx to WonX. 6 years ago
sout2str.pl c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
sys2wonx.pl 5e1a9795b7 Create your own header file. It became compilable with only Wonx. 6 years ago
system.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
text.c c0b964b4f4 Added dummy function of _asm_*(). 6 years ago
timer.c f25d7235fb Changed official name from Wonx to WonX. 6 years ago
wonx_configure.h f25d7235fb Changed official name from Wonx to WonX. 6 years ago
wwterm-b05.zip c0b964b4f4 Added dummy function of _asm_*(). 6 years ago

README

WonX - WonderWitch on X.

ۤä

WonX ϤޤԴǤƤʤǽ䡤Դʵǽ
ư򤹤ʬʤɤäѤޤ
Х䥢ɥХСԤκ湰μޤǡɤɤ᡼뤯
ɥ쥹ϡ
sakai@seki.ee.kagu.sut.ac.jp
hsakai@pfu.co.jp
Ǥ
ޤε¤ꡤåץǡȤϿԤäƤޤ
http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
ǡƤޤ

ߤϺ椬ͤƤޤҤȤǤϺ٤
(ʤäưΰ㤤ʤɡWonderWitch WonX Ǥ
̯˰ۤʤäƤ)ɤʤΤǤ
Ȥ˥ޥ˥奢˽񤤤Ƥʤʬ˴ؤƤϡWonderWitch ǤϤɤΤ褦
ưΤҤȤǤϥåޤ(Ƥ)
Ԥ(Ƥ)Ƥޤ
ä˾ġʤΤ˻ž夲Ƥޤ礦

ո˾ʤɤⴿޤޤɤɤ󤻤
(ֻ񤯤Ȥϸ¤ʤ˾ȿǤȤ¤ޤΤ
ϤƼϤ)

Ϥ

WonX ϡWonderWitch ѤΥץ X ץꥱȤƥѥ뤹
Ρ饤֥Ǥʲħޤ

C٥ǸߴǽäƤΤǡWonderWitch ѤΥץ
UNIXǤΤޤޥѥǤ롥(-lwonx ǥѥ뤹)
UNIXǥǥХåѤƥǥХåǤ褦ˤʤ롥(!)
饯ǡѥåȥǡΥ׵ǽ롥
ʰͤ䡤ѥåȤ䥭饯ʤǻѤʤɤ
å顼Ϥ(褦ˤ)顼å롥
ѤǤʤǽ(ؿѰդƤ뤬ޤƤʤäꡤ
äꤷơȤΤ)Ϥ󤢤롥
ɲäƤĤꡥ
β̼̿ñ˻롥(ǥǻäꡤѤ
ץȤäꤹɬפ̵ʤ) ϤȤ٤ꡥ
ߥ졼Ǥʤ饤֥ǤꡤɸƤΤǡ
ͳ˥ޥǽ
®٤٤ǥХåŪΤʤΤǡ®٤®뤳Ȥ
ޤͤƤʤ(嵭ΥǥХåͥ褹)
WonderWitch ѤΥץXdzڤिΤΤǤϤʤ
ޤߥ졼ŪʤΤǤϤʤ
ޤǥǥХåŪΤΡ(ݥꥷdzȯʤ)
äơWonderWitch Ǥư魯뤳Ȥ⡤ǥХå
Ϥ뤳Ȥ¤Τ䤹ͥ褷褦ʼ򤹤礬롥

3ʬWonX

ȤꤢɤʤΤƤߤȤǤ礦ʿͤϡ
ץץ򥳥ѥ롦¹ԤƤߤޤ礦
ʲΤ褦ˤƤߤƤ

~>% tar xvzf wonx-x.x.tar.gz
(ά)
~>% cd 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 Dzɽ OFF ˤơ
Ф餯(åƤѤä) p Dzɽ ON ˤޤ
ɤǤ SpeedMac Υ̤ɽƤǤ礦
륭ǰưڡǼͷǤ
ϤϥѴؿƤФ줿ȤͭǤϤʤΤǡ
ȿޤĹ˲Ƥ
p 򲡤ˤ ON, OFF ؤΤϡ褬٤ᡤ
ONΤޤޤȲ̥ꥢȤ˰۾˻֤뤫Ǥ

ǸˡWonderWitch Ѥüߥ졼 "WWTerm" 򥳥ѥ롦¹
Ƥߤޤ

~/wonx>% make wwterm
(ά)
~/wonx>% cd wwterm
~/wonx/smac>% ./terminal

10ʬWonX

ˡʤˤʤä WonderWitch ѤΥץ WonX Ȥä
ѥ롦󥯤ơX Window System ư褦ʼ¹Է
äƤߤޤ礦

ޤWonX Ÿơmake Ƥlibwonx.a Ǥޤ

~>% tar xvzf wonx-x.x.tar.gz
(ά)
~>% cd wonx
~/wonx>% make
(ά)
~/wonx>% ls libwonx.a
libwonx.a
~/wonx>%

ˡlibwonx.a ȡwonx_include ǥ쥯ȥȡsys2wonx.pl
ʤκäץΥǥ쥯ȥ(ǤȤơyoursample Ȥޤ)
˥ԡޤ

~/wonx>% cp -R libwonx.a wonx_include sys2wonx.pl ../yoursample
~/wonx>% cd ../yoursample
~/yoursample>%

ʤκäץΤ٤ƤΥեMS-DOS ƥȷ
UNIX ΥƥȷѴޤ(Ĥޤꡤԥɤ \r\n \n
Ѵơɤ SJIS EUC Ѵޤ)

~/yoursample>% cat makefile | qkc -I -O -e -u > makefile.new
~/yoursample>% mv makefile.new makefile
~/yoursample>% cat sample.c | qkc -I -O -e -u > sample.c.new
~/yoursample>% mv sample.c.new sample.c
...(ʲ٤ƤΥեˤĤơƱͤ˷֤ά)...

*.C Ȥե̾Υե뤬ä顤*.c ѹޤ
(*.C C++ ΥץȻפƤޤΤ)

~/yoursample>% mv SAMPLE2.C sample2.c

makefile ʲΤ褦˽롥
ѥˤ gcc Ѥ롥
֥ȥե *.obj *.o ѹ
ѥե饰 -I. -L. -L/usr/X11R6/lib -lwonx -lX11 -lXt ɲá
mkfent ʤɤˤ *.fx եκʤɤä顤ȥȤ롥

~/yoursample>% emacs makefile

餯makefile νܤݤǤ(ݤʤΤϡWonX ޤ
ŬѤǤʤäȤΥνǤ)
źդ makefile_for_smac makefile_for_wwterm 򻲹ͤˤơmakefile
Ƥ

ˡsys2wonx.pl 򤫤ơץ #include Τ褦ʤΤ
#include "wonx_include/disp.h" ѹ롥
(! sys2wonx.pl ϡեΤ񤭴ƤޤΤǡѹ
褦ʥեɬХååפƤ
#include Τ褦ʬ̵եξȡɤ߹
Τޤ޽ϤΤǡեƼΤѤʤȻפޤ
դѤäƤޤޤ)

~/yoursample>% ./sys2wonx.pl *.[ch]

Ǹˡmake 򤷤ޤ

~/yoursample>% make

ޤСǥѥ뤬̤äơ¹ԤǤޤ

~/yoursample>% ./sample

WonX

WonX ϡWonderWitch display_control() Ȥ display_status() Ȥä
ؿ(BIOS Ф륷ƥॳ)ؤδؿäƤޤ
δؿϡX˥ɥ򳫤ơ WonderWitch ȸߴư
褦˽񤤤Ƥޤ

WonX make ȡlibwonx.a Ȥ饤֥꤬Ǥޤ
ǡWonderWitch ѤΥץUNIX -lwonx ƥѥ뤷ƤС
WonderWitch display_control() ȤΤˡWonX display_control()
󥯤졤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 Ǥ wonx_include Ȥǥ쥯ȥβ˥إåե
ǼƤޤ( sys Ȥǥ쥯ȥˤä
嵭кΤᡤΤ褦ˤ)
WonderWitch ѥץΡ
#include
Τ褦ʬϡ٤ơ
#include
Τ褦˽ɬפޤ
(stdio.h stdlib.h ϡUNIX ƥ°ΤΤѤΤǡ
ΤޤޤǤޤޤ)
(եꥯȤʤȤФμʤ顤θ¤ǤϤޤ)
WonderWitch ΥץΡ#include ϡ٤
#include ˽ɬפ롤ȤȤǤ
(ޤȤƹԤ perl ץȤźդƤޤ
sys2wonx.pl *.[ch] ¹ԤȡäȽ񤭴Ƥޤ)

ޤUNIXƥˤäƤϡ/usr/include/sys/types.h ushort, ulong
ƤΤȤʤΤޤäơѥ
ulong ƤȤ礬ޤ
ΤĴˤϡwonx_include ʲΥեľܽ
ĴƤwonx_include/system_configure.h 뤳Ȥˤꡤ
ĴǤ褦ˤʤäƤޤ

WonX Υѥ

ޤ WonX 򥳥ѥ뤷ơlibwonx.a ɬפޤ
WonX ΥѥϡʲμǹԤޤ

1. WonX Ÿ롥

~>% tar xvzf wonx-x.x.tar.gz
~>% cd wonx
~/wonx>%

2. WonX make 롥

~/wonx>% make
gcc -c WWCharacter.c -O -I. -I/usr/X11R6/include
gcc -c WWColorMap.c -O -I. -I/usr/X11R6/include
...(ά)...
gcc -c wonx.c -O -I. -I/usr/X11R6/include
ar ruc libwonx.a WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WonXDisplay.o XDisplay.o disp.o text.o key.o system.o timer.o etc.o wonx.o
~/wonx>% ls lib*
libwonx.a
~/wonx>%

ޤǤǡ饤֥κϽǤ

WonderWitch ѥץꥱΥѥ

ˡWonX ѤȤơۺ SpeedMac Ȥ WonderWitch Ѥ
򥳥ѥ뤷Ƥߤޤ
(SpeedMac ϥץץȤơWonX ɸźդƤޤ)
SpeedMac WonderWitch ѤΥץǤ WonderWitch
Ѥƥѥ뤷WonderSwan ǥڤिΤΤǤ
ȤơSpeedMac WonX 󥯤ơX ư SpeedMac
¹ԷƤߤޤ

1. Ÿ롥

~/wonx>% unzip smac-b02.zip
...(ά)...
~/wonx>% cd smac-b02
~/wonx/smac-b02>%

2. إåե libwonx.a 򥳥ԡ롥

~/wonx/smac-b02>% cp -R ../wonx_include .
~/wonx/smac-b02>% cp ../libwonx.a .
~/wonx/smac-b02>%

3. makefile 롥

~/wonx/smac-b02>% emacs makefile

ʲΤ褦˽ޤ

gcc ǥѥ򤹤褦˽롥ΤȤˡѥ륪ץˡ
-I. -L. -L/usr/X11R6/lib -lwonx -lX11 -lXt
ɲä롥
(ɬפʤ顤-g ɲä)
mkfent ˤեΥСȤʤɤä顤롥

makefile źդƤΤǡݤʤϼԽ뤫ˡ

~/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
#include
Τ褦ʬ
#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 game.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
~/wonx/smac-b02>% ls smac
smac
~/wonx/smac-b02>%

6. smac ư롥

~/wonx/smac-b02>% ./smac

ȡޤǤäݤǤ¤ϡ

~/wonx>% make smac

ȡκȤäƤ褦ˤʤäƤޤ



smac ưȡɥޤޤߥʥˤϡ
ʲΥǥХåѤξɽޤ

WonderWitch شؿƤФȡͤɽޤ

ޤǤϡʲԤޤ

륭WonderSwan X1X4ܥбƤ롥
i,j,k,l WonderSwan Y1Y4ܥбƤ롥
ڡСȺեȥA,BܥбƤ롥
sSTARTܥбƤ롥
p 򲡤ȡɽ/ɽ⡼ɤؤ롥
(ɽȲ̤ؤԤʤ®)
F1 򲡤ȡLCD顼ޥåפΥǡ׽Ϥ롥
F2 򲡤ȡѥåȤΥǡ׽Ϥ롥
F3 򲡤ȡ饯Υǡ׽Ϥ롥
F4 򲡤ȡץ饤ȤΥǡ׽Ϥ롥

ǥեȤǤϤʤˤؿƤФ뤿Ӥ˲̤κԤᡤ
®Ǥ
ȤСʲΤ褦ʤȤäƤȡ®ˤʤޤ

/* ̤Υꥢ */
for (y = 0; y < 32; y++)
for (x = 0; x < 32; x++) {
screen_fill_char(0, x, y, 1, 1, 0); /* 褵 */
}
}

Τ褦ʾϡp 򲡤ɽ⡼ɤˤơ롼׽ä
Ƥ p 򲡤ɽ⡼ɤᤷƤ

F1 F2 򲡤ȡǡ׽ϤΤǤɸǤϤ¾ˤ
å̤˽ϤƤΤǡդĤ F1 򲡤Ǥϡ
äȤޤ̤ΥåήƤޤȤޤ
Τ褦ʤȤϡʲΤ褦ˤƵưޤȤХѥ뤷
smac Ȥ¹ԷǤƤΤʤ顤

> smac | grep -v call

⤷⥭饯ֹ10֤Υ饯Υǡˤϡ
ʲΤ褦˼¹ԤƤ顤F3 򲡤ɤǤ礦

> smac | grep "character\[10\]"

WonX ϡåϤݤˡgrep ǥե륿󥰤Ǥ褦ˡ
ʤ餺ϥåƬˡΤʸɲäƤޤ
ȤСؿƤӽФɽåˤϡƬɬ
"call" ȤʸɲäƤޤäơgrep -v call ̤С
ؿƤӽФΥåäФʤʤ롤Ȥ褦ˤʤäƤޤ

ɸǤ̤ΥåФƤΤǡgrep 򤦤ޤȤ褦ˤƤ
⤷ϡ

> smac | grep call > function_call.log

Τ褦ˤơȤΤͭǤ礦

> smac > /dev/null

ȡʸ kterm ʤɤɽʤ֤󡤹®ˤʤޤ

­ʤ

ʲΤΤˤϤޤбƤޤ󡥤äơ㤨ХɴϢ
ؿƤӽФƤ⡤ⵯޤ(δؿˤʤäƤ)


ץ
쥯ȥ饤֥

դʤФʤʤ

WonX ϡ WonderWitch ѤȤƽ񤫤줿(⤷ϡ񤫤)ץ
UNIX ǥѥ롦󥯤뤿Υ饤֥Ǥꡤϡɥ
ߥ졼ȤΤǤϤޤ
Ǥ顤WonderWitch UNIX CΥåפΤᡤĤʤ
ʤʤȤĤޤ WonX 塤̵ȤǤ

ʲΤȤϡռ뤳Ȥȡ줤ʥץ񤯤Ȥǡ
ʤǤȻפޤ(ӥåȥޥåʤɤǡshort int ˤ٤
ȤǤϡάˤ short int Ȥ)

ޤWonX ŪŪʥХᤤʳ̵Ȥȡ
ŪХȥϡɤߤΥХڤΥƸ򶹤뤳Ȥȡ
椬ż֤Ǥ WonderWitch Υץ񤱤褦ˤ뤳ȤˤΤǡ
ΤؤϤΤȳڤäƻȤäƤ
WonX Ȥ¤ꡤʤ٤¸̵褦˿ޤ礦
(Ȥ int Υˤޤ¸ʤ褦ˤޤ礦)

[ѥ]

ˤ񤭤ޤѥǤʤȤ㳲Ф顤ϤƤ
إåեΥեꥯȤǤȤˡWonderWitch sys ʲ
ե򥤥󥯥롼ɤƤդƤ
ushort, ulong ʤɤϡsys/types.h Ƥ륷ƥ⤢뤷
Ǥʤƥ⤢ޤΤؤϡwonx_include/system_configure.h
ĴƤ
(FreeBSD Ǥ ushort ΤƤ뤬RedHat Linux Ǥϡ
uchort, ulong ȤƤΤǡΤޤޤȥѥ
Υ˥󥰤Фޤ)

[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 ĴǤޤ
ߥϥɥǡ˻֤Τʤɤ򤷤Ƥ
ˤϡߤλñ̤礭ƤǤʤȡϥɥ餫
äִ֤ˤޤϥɥ餬ƤФơ¹Ԥ˿ʤޤʤȤȤ
ʤޤ

[ϳߡꥢߤ]

(ޤ뤳ȤϤʤȻפޤ)ϳߤȥϸѴؿ
Ʊ롼ʻѤȡߤΤȤꤳܤ䤹ʤǽ
ޤ
ĤޤꡤʲΤ褦ʥץ񤯤ȤˤդƤ

void far key_handler()
{
/* Ϥν */
}

static intvector_t key_intvector;
static intvector_t key_last_intvector;

main()
{
key_intvector.callback = (void (near *)())FP_OFF(key_handler);
key_intvector.cs = _asm_inline("\tmov\tax,cs");
key_intvector.ds = _asm_inline("\tmov\tax,ds");

sys_interrupt_set_hook(SYS_INT_KEY, &key_intvector, &key_last_intvector);

while (1) {
/*
* ϳԤξ֤ʤΤˡkey_press_check() ǥϾ֤
* Ԥ
*/
key = key_press_check();
/* ʤŬʽ򤳤ΤؤǹԤäꤹ */
}
}

ϳߤԤʤ顤key_press_check() ǥϾ֤
̸Ĥ˸롤ȤȤȡߤΤȤꤳܤǽ
ޤ
(ϳߤˤäƸƤӽФߥϥɥ
key_press_check() Ѥ뤳Ȥꤢޤ(Ǥʤȳߤ
̵̣ʤäƤޤ) ޤǡƱ롼ʻѤ꤬
ȯǽ롤ȤȤǤ)

Ǥ⡤ʤؤʥץढޤ񤯤̵ʤȻפäƤޤ
(ľȤȡȤƤ⤿ؤʤΤ)
ΤȤϡꥢߤ˴ؤƤ⡤ƱͤǤ

[ϤˤĤ]

ϤϡѴؿƤФ줿ȤΤߴΤΤǡĹ˲Ƥʤ
ȿʤȤޤ
ȿʤȤäƤʤɤⲡΤǤʤĹμ¤˲褦
Ƥ

[MS-DOS եΰ]

MS-DOS եϡβԥɤ UNIX Υƥȥե
ۤʤΤǡդƤ*.[ch] եξ̵ΤǤ
makefile դƤ
(UNIX ΥƥȥեǤϡԤ \n ǤMS-DOS Ǥ \r\n Ǥ)
㤨Сmakefile ˡ

gcc -g -o smac $(OBJS) -L. -L/usr/X11R6/lib -lwonx -lX11 -lXt

Τ褦ʹԤäȤơ줬 MS-DOS ΥƥȷΥեȡ
-lXt ΤȤ;ʬʲԥ(\r)ղäƤޤᡤUNIX make
Ƥ⡤-lXt 饤̵֥꤬פܤƤޤޤ
(ºݤˤϥѥϡ-lXt\r ȻפäƤޤäơlibXt\r.a Ȥ饤֥
õƤޤΤǤ)
(⡤ե emacs less ʤɤǻȤƤ⡤ԥɤɽʤ
ᡤ狼ˤ)
ޤ

gcc -g -o smac $(OBJS) -lwonx -lX11 -lXt -L. -L/usr/X11R6/lib

Τ褦ˤƤȡ/usr/X11R6/lib ꤷĤʤΤˡºݤˤ
/usr/X11R6/lib\r Ȥǥ쥯ȥ꤬ꤵ줿ȤˤʤäƤޤ
-lX11, -lXt θ˼Ԥޤ

ɤ˴ؤƤ⡤ƱȤޤUNIX Ǥδɤ EUC ʤΤǡ
SJIS δäƤȡޤѥǤʤäꡤ
make ޤưʤäꡤѥǤƤץ༫Τ
ưƤޤ⸶˵ŤˤʤäƤޤǽޤ
makefile 䥽ɤɬ
> cat makefile | qkc -I -O -e -u > makefile.tmp
> mv makefile.tmp makefile
ʤɤ̤ơUNIXΥƥȥեѴޤ礦

[ե̾]

MS-DOS Ǥϥե̾Ϥ٤ʸǤgcc Ǥ *.C Τ褦
ե̾Υե C++ ǽ񤫤ƤȽǤ뤿ᡤ
SAMPLE.C Τ褦̾Υե򥳥ѥ뤹ȡޤ󥯤Ǥʤ
Ȥޤ
Τ褦ʾϡsample.c ˥͡षƥѥ뤷Ƥ

[ꥢ̿ˤĤ]

ꥢ̿μѴؿ(comm_receive_char())ϡfgetc(stdin)
ʸơ\n \r Ѵ֤ޤϡŪ̿
ü򥨥ߥ졼Ȥ뤿Ǥ

ޤcomm_send_char() ϤʸϡɸϤ˽Ϥޤ
֤ԥɤϡ"\t" "\n" Τ褦ʸѴƽϤޤ
źդ sout2str.pl ̤Ȥˤꡤꥢ̿ؤνϤΤФơ
üؤνϤΥ᡼ɽ뤳ȤǤޤ

ߤˤĤ

ϳߤ䥷ꥢߤʤɤϡUNIXΥ顼ॷʥ
ѤƼƤޤ(֤˥ݡ󥰤Ƥ)
äơʲΤ褦ʥץ⥳ѥ뤷ư
ȤǤޤ

void far key_handler()
{
int key;
key = key_press_check();
/* Ϥν */
}

/* ꥢγߥϥɥ */
void far com_handler()
{
int c;
c = comm_receive_char();
/* ꥢν */
}

static intvector_t key_intvector;
static intvector_t key_last_intvector;
static intvector_t com_intvector;
static intvector_t com_last_intvector;

main()
{
key_intvector.callback = (void (near *)())FP_OFF(key_handler);
com_intvector.callback = (void (near *)())FP_OFF(com_handler);
key_intvector.cs = _asm_inline("\tmov\tax,cs");
key_intvector.ds = _asm_inline("\tmov\tax,ds");
com_intvector.cs = _asm_inline("\tmov\tax,cs");
com_intvector.ds = _asm_inline("\tmov\tax,ds");

sys_interrupt_set_hook(SYS_INT_KEY,
&key_intvector, &key_last_intvector);
sys_interrupt_set_hook(SYS_INT_RECEIVEREADY,
&com_intvector, &com_last_intvector);

while (1) {
/* ̵¥롼סߤä顤Υϥɥ */
}
}

_asm_inline() Ͼ0֤ߡؿȤƤޤ
ޤFP_OFF(), FP_SEG() ϡ
#define FP_OFF(p) (p)
#define FP_SEG(p) (0)
Τ褦Ƥޤäơ嵭Τ褦ʥץ WonX
ѥ뤷Ƽ¹Ԥ뤳ȤǤޤ

Τ褦ˡwhile (1) {} ̵¥롼פ󤷤ơߤäȤ
褦ʥץ񤤤Ƥ⡤ưޤ
Ϥϥݡ󥰤ƤȤΤʤΤǡ
ϳߤ򤫤ˤϡĹ˥򲡤Ƥɬפޤ
(ϴŪߤΤǡȿޤĹ˲Ƥ)

WonX ¸ʬΤ꤫

WonderWitch ѤΥץȯƤݤˡWonX ξΤȤ߹ߤơ
WonderSwan Ǽ¹ԤȤˤϼɤäȤޤ
(㤨СǥХåνϤΤ printf() ʤ)
Τ褦ʤȤΤˡwonx_include/types.h
#define _WONX_
ƤΤǡΤ褦ʾ #ifdef _WONX_ ǤäƤ

ץǡμ꤫

ˡ

#include "WonX.h"
#include "WonXDisplay.h"
#include "WWDisplay.h"
#include "WWColorMap.h"
#include "WWPalette.h"
#include "WWCharacter.h"
#include "WWSprite.h"

int i;
WWDisplay ww_display;

ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());

WWColorMap_PrintData(WWDisplay_GetColorMap(ww_display), stdout);

for (i = 0; i < 16; i++)
WWPalette_PrintData(WWDisplay_GetPalette(ww_display, i), stdout);

for (i = 0; i < 512; i++)
WWCharacter_PrintData(WWDisplay_GetCharacter(ww_display, i), stdout);

for (i = 0; i < 128; i++)
WWSprite_PrintData(WWDisplay_GetSprite(ww_display, i), stdout);

Τ褦ʥɤ뤳ȤˤꡤǤդξǥ饯ѥåȤ
ץǡϤ뤳ȤǤޤ

ץˡ԰¤ʾ꤬ä顤

#ifdef _WONX_
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
printf("Before setting:\n");
WWSprite_PrintData(WWDisplay_GetSprite(ww_display, 0), stdout);
#endif /* _WONX_ */

/* ˥ץ饤ȤˤĤƤ԰¤ʥɤ */

#ifdef _WONX_
printf("After setting:\n");
WWSprite_PrintData(WWDisplay_GetSprite(ww_display, 0), stdout);
#endif /* _WONX_ */

Τ褦ˤ԰¤ʥɤǥץǡȡǥХå
ΩĤǤ礦



WonX ϡ湰μʬ̶֤ż֤ Libretto ǽ񤤤
ż֥եȥפǤGPLۤޤ
ԤˤĤƤϡźդ OMAKE.jpn 򻲾ȤƤ

湰μϢΥ᡼륢ɥ쥹ϡ
sakai@seki.ee.kagu.sut.ac.jp
hsakai@pfu.co.jp
ǤޤܥեȥκǿǤ
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
ߥ顼Ȥϡ椬Ȥ˥åץǡȤΤǡ˺ǿ
Ȥ櫓ǤϤޤ󡥤ޤǥХååѤǤ

ΥեϤޤ