summaryrefslogtreecommitdiffstats
path: root/thk04
diff options
context:
space:
mode:
Diffstat (limited to 'thk04')
-rw-r--r--thk04/.DS_Storebin0 -> 15364 bytes
-rw-r--r--thk04/COPYING280
-rw-r--r--thk04/FREEJ-AUTHORS71
l---------thk04/Makefile1
-rw-r--r--thk04/Makefile.Linux64
-rw-r--r--thk04/Makefile.OSX61
-rw-r--r--thk04/README76
-rw-r--r--thk04/README.OSX16
-rw-r--r--thk04/ant.pngbin0 -> 110813 bytes
-rw-r--r--thk04/code.pngbin0 -> 68193 bytes
-rw-r--r--thk04/config-darwin.h94
-rw-r--r--thk04/config-linux.h92
l---------thk04/config.h1
-rw-r--r--thk04/context.cpp245
-rw-r--r--thk04/context.h122
-rw-r--r--thk04/cpu_accel.cpp211
-rw-r--r--thk04/cpu_accel.h84
-rw-r--r--thk04/dio.c312
-rw-r--r--thk04/fastmemcpy.cpp726
-rw-r--r--thk04/fastmemcpy.h48
-rw-r--r--thk04/filter.h42
-rw-r--r--thk04/font_acorn_8x8.h262
-rw-r--r--thk04/font_pearl_8x8.h2578
-rw-r--r--thk04/freej.h46
-rw-r--r--thk04/freej_plugin.h29
-rw-r--r--thk04/gen_layer.cpp324
-rw-r--r--thk04/gen_layer.h79
-rw-r--r--thk04/impl_layers.cpp204
-rw-r--r--thk04/jsync.cpp63
-rw-r--r--thk04/jsync.h64
-rw-r--r--thk04/jutils.cpp306
-rw-r--r--thk04/jutils.h51
-rw-r--r--thk04/layer.cpp160
-rw-r--r--thk04/layer.h163
-rw-r--r--thk04/linklist.cpp327
-rw-r--r--thk04/linklist.h82
-rw-r--r--thk04/misfu-climax.xmbin0 -> 1050865 bytes
-rw-r--r--thk04/mm_accel.h30
-rw-r--r--thk04/mmx.h261
-rw-r--r--thk04/osd.cpp171
-rw-r--r--thk04/osd.h67
-rw-r--r--thk04/plugger.cpp155
-rw-r--r--thk04/plugger.h100
-rw-r--r--thk04/plugin.cpp79
-rw-r--r--thk04/plugin.h74
-rw-r--r--thk04/png_layer.cpp201
-rw-r--r--thk04/png_layer.h60
-rw-r--r--thk04/screen.cpp98
-rw-r--r--thk04/screen.h63
-rw-r--r--thk04/scroll_layer.cpp215
-rw-r--r--thk04/scroll_layer.h70
-rw-r--r--thk04/sdl_blit.cpp213
-rw-r--r--thk04/sdl_screen.cpp213
-rw-r--r--thk04/sdl_screen.h71
-rw-r--r--thk04/thk.cpp481
-rwxr-xr-xthk04/thk.darwin-x86bin0 -> 2101984 bytes
-rwxr-xr-xthk04/thk.linux-x86bin0 -> 5238784 bytes
-rw-r--r--thk04/vertigo.c179
58 files changed, 10085 insertions, 0 deletions
diff --git a/thk04/.DS_Store b/thk04/.DS_Store
new file mode 100644
index 0000000..596f484
--- /dev/null
+++ b/thk04/.DS_Store
Binary files differ
diff --git a/thk04/COPYING b/thk04/COPYING
new file mode 100644
index 0000000..5a965fb
--- /dev/null
+++ b/thk04/COPYING
@@ -0,0 +1,280 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
diff --git a/thk04/FREEJ-AUTHORS b/thk04/FREEJ-AUTHORS
new file mode 100644
index 0000000..7168241
--- /dev/null
+++ b/thk04/FREEJ-AUTHORS
@@ -0,0 +1,71 @@
+
+*** MAIN AUTHOR ::
+
+Denis "jaromil" Rojo - http://rastasoft.org
+ concept, coder and mantainer
+
+*** CONTRIBUTIONS ::
+
+Aaron Holtzman <aholtzma/@/ess.engr.uvic.ca>
+ yuv2rgb c conversion code
+
+Andreas Schiffler <aschiffler/@/home.com>
+ inspirations, experience and delaygrab filter
+
+Clifford Smith <nullset/@/dookie.net>
+ transform filter from EffecTV
+
+Christoph Rudorff <christoph.rudorff/@/telebel.de>
+ avi layer enhancements
+
+Dries Pruimboom <dries/@/irssystems.nl>
+ cartoon filter
+
+Edo Tannenbaum <et/@/et-arts.com>
+ nervous filter from EffecTV
+
+Fukuchi Kentarou <fukuchi/@/is.titech.ac.jp>
+ a couple of filters and code goodies from EffecTV
+
+Lluis Gomez I Bigorda <lgomez/@/pangea.org>
+ zoom filter
+
+Leonid Andreev <lenonid/@/math.harvard.edu>
+ feedback and bugfixes
+
+Olie Lho <ollie/@/sis.com.tw>
+ yuv2rgb asm mmx optimized code
+
+Pete Warden
+ backlight filter
+
+Silvano "kysucix" Galliani - http://kysucix.nexlab.it
+ truetype text layer
+
+*** SUPPORTED BY ::
+
+Nederlands Instituut voor Mediakunst - Montevideo/Time Based Arts
+ .... <http://www.montevideo.nl>
+
+*** THANKS TO ::
+
+Bergen Elektronic Kunst ....... <http://www.bek.no>
+Bomboclat ..................... <http://autistici.org/bomboclat>
+City of Judenburg ............. <http://www.judenburg.at>
+Ecoteca Pescara ............... <http://www.ecoteca.org>
+Erich Berger .................. <http://randomseed.org>
+Florian Cramer ................ <http://userpage.fu-berlin.de/~cantsin>
+Freaknet Medialab Catania ..... <http://freaknet.org>
+Isabella Bordoni .............. <http://ib-arts.dyne.org>
+LiquidMusic ................... <http://residence.aec.at/liquidmusic>
+Ljudmila Medialab ............. <http://www.ljudmila.org>
+LOA hacklab Milano ............ <http://ecn.org/loa>
+Lobo .......................... <http://clavius.dyne.org>
+Luigi Pagliarini .............. <http://www.aritificialia.com/luigi>
+Megabug ....................... <http://autistici.org/megabug>
+Roberto Paci Dalo' ............ <http://giardini.sm>
+Servus.at ..................... <http://www.servus.at>
+Sonar Festival ................ <http://www.sonar.es>
+
+$Id: AUTHORS,v 1.14 2004/03/22 18:37:47 jaromil Exp $
+
diff --git a/thk04/Makefile b/thk04/Makefile
new file mode 120000
index 0000000..b00583b
--- /dev/null
+++ b/thk04/Makefile
@@ -0,0 +1 @@
+Makefile.Linux \ No newline at end of file
diff --git a/thk04/Makefile.Linux b/thk04/Makefile.Linux
new file mode 100644
index 0000000..94a593c
--- /dev/null
+++ b/thk04/Makefile.Linux
@@ -0,0 +1,64 @@
+# why not autoconf/automake here?
+# i love simplicity
+# i'm still looking for a simple person loving me!
+
+CC = gcc
+CPP = g++
+INSTALL = install -c
+PREFIX = /usr/local
+DATADIR = $(PREFIX)/share/transhackmeeting
+
+#debug flags
+#CFLAGS = -pipe -ggdb \
+# -DDATADIR=\"$(DATADIR)\"
+
+# very shamanic lubrifications
+# -fno-inline -fno-loop-optimize -fexpensive-optimizations -fpeephole2
+
+CFLAGS = -fPIC -pipe -Wall -O2 -ffast-math -fomit-frame-pointer -DDATADIR=\"$(DATADIR)\"
+
+# choose your compilation architecture
+CFLAGS += -DARCH_X86
+CFLAGS += -DHAVE_MMX
+#CFLAGS += -DARCH_PPC
+CFLAGS += -DHAVE_64BIT
+
+
+
+
+
+
+INCLUDE = -I. `sdl-config --cflags` \
+ `pkg-config --cflags libpng12` \
+ `libmikmod-config --cflags`
+
+LIBS = `sdl-config --libs` \
+ `pkg-config --libs libpng12` \
+ `libmikmod-config --libs`
+
+OBJS = context.o thk.o gen_layer.o scroll_layer.o impl_layers.o \
+ jsync.o jutils.o layer.o linklist.o osd.o plugger.o plugin.o \
+ png_layer.o screen.o sdl_blit.o sdl_screen.o \
+ fastmemcpy.o cpu_accel.o
+
+all: thk vertigo.so
+
+thk: $(OBJS)
+ $(CPP) -o thk $(OBJS) $(LIBS)
+# strip $(SOPT) thk
+
+vertigo.so: vertigo.o
+ ld -E -z now -shared vertigo.o -o vertigo.so
+
+%.o: %.cpp
+ $(CPP) $(INCLUDE) $(CFLAGS) -c -o $@ $<
+
+%.o: %.c
+ $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $<
+
+install: all
+ $(INSTALL) -s thk $(PREFIX)/bin
+ $(INSTALL) data/* $(DATADIR)
+
+clean:
+ rm -f thk *.o *.so
diff --git a/thk04/Makefile.OSX b/thk04/Makefile.OSX
new file mode 100644
index 0000000..476c32a
--- /dev/null
+++ b/thk04/Makefile.OSX
@@ -0,0 +1,61 @@
+# why not autoconf/automake here?
+# i love simplicity
+# i'm still looking for a simple person loving me!
+
+CC = gcc
+CPP = g++
+INSTALL = install -c
+PREFIX = /usr/local
+DATADIR = $(PREFIX)/share/transhackmeeting
+
+# debug flags
+#CFLAGS = -pipe -ggdb \
+# -DDATADIR=\"$(DATADIR)\"
+
+# very shamanic lubrifications
+CFLAGS = -pipe -Wall -O2 -ffast-math -fomit-frame-pointer -mpowerpc-gfxopt -faltivec \
+ -fno-inline -fmove-all-movables -fno-loop-optimize -fexpensive-optimizations -fpeephole2 \
+ -DDATADIR=\"$(DATADIR)\"
+
+
+
+INCLUDE = -I. `sdl-config --cflags` \
+ `pkg-config --cflags libpng12` -I/sw/include
+
+
+# shared libs
+#LIBS = `sdl-config --libs` \
+# `pkg-config --libs libpng12` \
+# `libmikmod-config --libs`
+
+# static libs
+LIBS = `sdl-config --static-libs` \
+ `libmikmod-config --prefix`/lib/libmikmod.a \
+ /sw/lib/libpng12.a -lm -lz
+
+OBJS = context.o thk.o gen_layer.o scroll_layer.o impl_layers.o \
+ jsync.o jutils.o layer.o linklist.o osd.o plugger.o plugin.o \
+ png_layer.o screen.o sdl_blit.o sdl_screen.o \
+ fastmemcpy.o cpu_accel.o
+
+all: thk vertigo.so
+
+thk: $(OBJS)
+ $(CPP) -o thk $(OBJS) $(LIBS)
+# strip $(SOPT) thk
+
+vertigo.so: vertigo.o
+ gcc -bundle -flat_namespace -undefined suppress vertigo.o -o vertigo.so
+
+%.o: %.cpp
+ $(CPP) $(INCLUDE) $(CFLAGS) -c -o $@ $<
+
+%.o: %.c
+ $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $<
+
+install: all
+ $(INSTALL) -s thk $(PREFIX)/bin
+ $(INSTALL) data/* $(DATADIR)
+
+clean:
+ rm -f thk *.o *.so
diff --git a/thk04/README b/thk04/README
new file mode 100644
index 0000000..56032c6
--- /dev/null
+++ b/thk04/README
@@ -0,0 +1,76 @@
+disssssssssplayyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
+
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+oooooooasciioooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+ oooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooo
+ooooooooo.oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+oooooooooooooooooooooooooooooooooooooooooartoooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+oooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooo.oooooooooooooooooooooofaoooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+oooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooficoooooooooooooooooooooooooooooooo
+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+
+THIS IS AN XPERIMENT FOR CONSTRUCTIVEFUCKINGSP______--
+
+ +++++ D Y N E . O R G +++++++
+
+ praudli presentzzz
+
+ THK 2004 :: LECTROBRAIN INTRO
+ 100% freesoftware && freemuzaq
+ handmade c/c++ && ft2 .xm
+
+come and meet liberated Lectrobrainz -
+an intro/announcement to the trans.hackmeeting 2004
+sourcecode released to enhance knowledge reproduction
+
+feel free to compile the source and tweak and modify
+or just enjoy the nifty lighteffectszzzzzzzz
+_____________________________________________________
+[[[[[[[[ http://rastasoft.org/thk04.tar.gz ]]]]]]]]]]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!! REQUIREMENTS:
+[ libmikmod :::: http://mikmod.online.fr
+[ SDL :::::::::: http://www.libsdl.org
+[ libPNG ::::::: http://www.libpng.org
+
+ BE SURE TO VISIT | TISIV OT ERUS EB
+____________________________________________________
+[[[[[[[[[[ http://trans.hackmeeting.org ]]]]]]]]]]]]]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ASCII::ART::FA::FICO DEMO::SCENE::LOFA::DIPPIU'
+(fottiflashfottiflashfottiflashfottiflash)
+
++++ CONCEPT??? CODING!!!! [ j a r o m i l ] http://rastasoft.org
+../.#*$ =>>> RESPECT IS DUE TO THE DREADLOCK RASTAMAN
+
++++ MUZAQ ??? CARILLON INDUSTRIALI!!! [ p i n n a + c i n o ]
+@$((((((@( http://misfu.dyne.org )))))))))++++..@#-==>
+
+
+-------------
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
diff --git a/thk04/README.OSX b/thk04/README.OSX
new file mode 100644
index 0000000..74ec293
--- /dev/null
+++ b/thk04/README.OSX
@@ -0,0 +1,16 @@
+
+binaries are included
+
+the sound won't work because the libmikmod driver shipped by fink
+doesn't includes (yet?) the drv_osx needed to play on coreaudio.
+
+once the libmikmod gets updated in fink, then you should recompile
+in order to have music.
+
+meanwhile you can just try to play climax-misfu.xm besides the intro :/
+
+
+to recompile you have to link the correct makefile and config.h:
+ln -sf config-darwin.h config.h
+ln -sf Makefile.OSX Makefile
+
diff --git a/thk04/ant.png b/thk04/ant.png
new file mode 100644
index 0000000..314e190
--- /dev/null
+++ b/thk04/ant.png
Binary files differ
diff --git a/thk04/code.png b/thk04/code.png
new file mode 100644
index 0000000..305b848
--- /dev/null
+++ b/thk04/code.png
Binary files differ
diff --git a/thk04/config-darwin.h b/thk04/config-darwin.h
new file mode 100644
index 0000000..7f6f2c4
--- /dev/null
+++ b/thk04/config-darwin.h
@@ -0,0 +1,94 @@
+/* define if compiling for Apple Darwin OSX */
+/* #undef HAVE_DARWIN */
+#define HAVE_DARWIN 1
+
+/* define if compiling for Linux/PPC */
+/* #undef HAVE_PPC */
+#define HAVE_PPC 1
+
+/* define if compiling for Linux */
+// #define HAVE_LINUX 1
+
+/* Define to 1 if you are using a x86 cpu */
+// #define ARCH_X86 1
+
+/* Define to 1 if you have MMX cpu extensions */
+//#define HAVE_MMX 1
+
+/* Define to 1 if you have SSE cpu extensions */
+//#define HAVE_SSE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `ioctl' function. */
+#define HAVE_IOCTL 1
+
+/* Define to 1 if you have the `malloc' function. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Name of package */
+#define PACKAGE "TransHackmeeting"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "2004"
+
+/* define if compiling freetype2 layer */
+/* #undef WITH_FT2 1 */
+
+/* define if compiling glade gtk+-2 GUI */
+/* #undef WITH_GLADE2 1 */
+
+/* Define is using the javascript interpreter */
+/* #undef WITH_JAVASCRIPT */
+
+/* define if compiling midi layer */
+/* #undef WITH_MIDI */
+
+/* define if compiling png layer */
+#define WITH_PNG 1
+
+/* define if compiling video4linux layer */
+/* #undef WITH_V4L */
+
+/* define if compiling xhacks layer */
+/* #undef WITH_XHACKS */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
diff --git a/thk04/config-linux.h b/thk04/config-linux.h
new file mode 100644
index 0000000..001d17e
--- /dev/null
+++ b/thk04/config-linux.h
@@ -0,0 +1,92 @@
+/* define if compiling for Apple Darwin OSX */
+/* #undef HAVE_DARWIN */
+
+/* define if compiling for Linux/PPC */
+/* #undef HAVE_PPC */
+
+/* define if compiling for Linux */
+#define HAVE_LINUX 1
+
+/* Define to 1 if you are using a x86 cpu */
+#define ARCH_X86 1
+
+/* Define to 1 if you have MMX cpu extensions */
+#define HAVE_MMX 1
+
+/* Define to 1 if you have SSE cpu extensions */
+#define HAVE_SSE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `ioctl' function. */
+#define HAVE_IOCTL 1
+
+/* Define to 1 if you have the `malloc' function. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Name of package */
+#define PACKAGE "TransHackmeeting"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.0"
+
+/* define if compiling freetype2 layer */
+/* #undef WITH_FT2 1 */
+
+/* define if compiling glade gtk+-2 GUI */
+/* #undef WITH_GLADE2 1 */
+
+/* Define is using the javascript interpreter */
+/* #undef WITH_JAVASCRIPT */
+
+/* define if compiling midi layer */
+/* #undef WITH_MIDI */
+
+/* define if compiling png layer */
+#define WITH_PNG 1
+
+/* define if compiling video4linux layer */
+/* #undef WITH_V4L */
+
+/* define if compiling xhacks layer */
+/* #undef WITH_XHACKS */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
diff --git a/thk04/config.h b/thk04/config.h
new file mode 120000
index 0000000..6b2f2ba
--- /dev/null
+++ b/thk04/config.h
@@ -0,0 +1 @@
+config-linux.h \ No newline at end of file
diff --git a/thk04/context.cpp b/thk04/context.cpp
new file mode 100644
index 0000000..2d3ce75
--- /dev/null
+++ b/thk04/context.cpp
@@ -0,0 +1,245 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: context.cpp,v 1.44 2004/05/02 10:43:03 jaromil Exp $"
+ *
+ */
+
+#include <inttypes.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <assert.h>
+#include <mikmod.h>
+#include <context.h>
+
+#include <sdl_screen.h>
+
+#include <jutils.h>
+#include <fastmemcpy.h>
+#include <config.h>
+
+
+Context::Context() {
+
+ notice("squatarra the %s %s engine",PACKAGE,VERSION);
+ act("intro by jaromil @ rastasoft // june 2004");
+ screen = NULL;
+
+ /* initialize fps counter */
+ framecount=0; fps=0.0;
+ track_fps = false;
+ magnification = 0;
+ changeres = false;
+ clear_all = false;
+ quit = false;
+ pause = false;
+}
+
+Context::~Context() {
+ close();
+ notice("cu on http://trans.hackmeeting.org");
+}
+
+bool Context::init(int wx, int hx) {
+
+ screen = new SdlScreen();
+ if(!screen->init(wx,hx)) {
+ error("Can't initialize the viewport");
+ error("This is a fatal error");
+ return(false);
+ }
+
+ /* refresh the list of available plugins */
+ plugger.refresh();
+
+ /* initialize the On Screen Display */
+ osd.init(this);
+ // osd.active = true;
+ // set_osd(osd.status_msg); /* let jutils know about the osd */
+
+ /* initialize the Keyboard Listener */
+ // kbd.init(this);
+
+#ifdef WITH_JAVASCRIPT
+ js = new JsParser(this);
+ js->open("test.js");
+#endif
+
+ /* initialize the S-Lang text Console */
+ // console.init(this);
+
+ find_best_memcpy();
+
+ set_fps_interval(24);
+ gettimeofday( &lst_time, NULL);
+
+ return true;
+}
+
+void Context::close() {
+ Layer *lay;
+
+
+ // console.close();
+
+ lay = (Layer *)layers.begin();
+ while(lay) {
+ lay->lock();
+ layers.rem(1);
+ lay->quit = true;
+ lay->signal_feed();
+ lay->unlock();
+ SDL_Delay(500);
+ delete lay;
+ lay = (Layer *)layers.begin();
+ }
+
+ if(screen) delete screen;
+
+ plugger.close();
+
+#ifdef WITH_JAVASCRIPT
+ delete js;
+#endif
+
+}
+
+void Context::cafudda(int secs) {
+ Layer *lay;
+
+ if(secs) /* if secs =0 will go out after one cycle */
+
+ //#ifdef ARCH_X86
+ // __asm__ volatile (".byte 0x0f, 0x31" : "=A" (now));
+ //#else
+ now = dtime();
+ //#endif
+
+ do {
+
+ /* fetch keyboard events */
+ // kbd.run();
+
+ rocknroll(true);
+
+ if(clear_all) screen->clear();
+
+ lay = (Layer *)layers.end();
+ layers.lock();
+ while(lay) {
+ if(!pause)
+ lay->cafudda();
+ lay = (Layer *)lay->prev;
+ }
+ layers.unlock();
+
+ osd.cafudda();
+
+ // console.cafudda();
+
+ screen->show();
+
+ /* change resolution if needed */
+ if(changeres) {
+ screen->set_magnification(magnification);
+ osd.init(this);
+ /* crop all layers to new screen size */
+ Layer *lay = (Layer *)layers.begin();
+ while(lay) {
+ lay->lock();
+ screen->crop(lay);
+ lay->unlock();
+ lay = (Layer*)lay->next;
+ }
+ changeres = false;
+ }
+
+ /******* handle timing */
+
+ if(!secs) break; /* just one pass */
+
+ riciuca = (dtime()-now<secs) ? true : false;
+
+ calc_fps();
+ MikMod_Update();
+ } while(riciuca);
+}
+
+void Context::magnify(int algo) {
+ if(magnification == algo) return;
+ magnification = algo;
+ changeres = true;
+}
+
+/* FPS */
+
+void Context::set_fps_interval(int interval) {
+ fps_frame_interval = interval*1000000;
+ min_interval = (long)1000000/interval;
+}
+
+void Context::calc_fps() {
+ /* 1frame : elapsed = X frames : 1000000 */
+ gettimeofday( &cur_time, NULL);
+ elapsed = cur_time.tv_usec - lst_time.tv_usec;
+ if(cur_time.tv_sec>lst_time.tv_sec) elapsed+=1000000;
+
+ if(track_fps) {
+ framecount++;
+ if(framecount==24) {
+ fps=(double)1000000/elapsed;
+ framecount=0;
+ }
+ }
+
+ if(elapsed<=min_interval) {
+ /* usleep( min_interval - elapsed ); this is not POSIX, arg */
+ slp_time.tv_sec = 0;
+ slp_time.tv_nsec = (min_interval - elapsed)<<10;
+ nanosleep(&slp_time,NULL);
+
+ lst_time.tv_usec += min_interval;
+ if( lst_time.tv_usec > 999999) {
+ lst_time.tv_usec -= 1000000;
+ lst_time.tv_sec++;
+ }
+ } else {
+ lst_time.tv_usec = cur_time.tv_usec;
+ lst_time.tv_sec = cur_time.tv_sec;
+ }
+
+}
+
+void Context::rocknroll(bool state) {
+
+ Layer *l = (Layer *)layers.begin();
+
+ // if(!l) { osd.credits(true); return; }
+
+ layers.lock();
+ while(l) {
+ if(!l->running) {
+ l->start();
+ // l->signal_feed();
+ while(!l->running) jsleep(0,500);
+ l->active = state;
+ }
+ l = (Layer *)l->next;
+ }
+ layers.unlock();
+}
diff --git a/thk04/context.h b/thk04/context.h
new file mode 100644
index 0000000..a9be74f
--- /dev/null
+++ b/thk04/context.h
@@ -0,0 +1,122 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __context_h__
+#define __context_h__
+
+#include <inttypes.h>
+#include <iostream>
+#include <stdlib.h>
+
+#include <linklist.h>
+#include <layer.h>
+#include <osd.h>
+//#include <kbd_ctrl.h>
+//#include <console.h>
+#include <plugger.h>
+#include <screen.h>
+
+/* maximum height & width supported by context */
+#define MAX_HEIGHT 1024
+#define MAX_WIDTH 768
+
+//class JsParser;
+//class Console;
+
+class Context {
+ private:
+ /* ---- fps ---- */
+ struct timeval cur_time;
+ struct timeval lst_time;
+ struct timespec slp_time;
+ int fps_frame_interval;
+ int framecount;
+ long elapsed;
+ long min_interval;
+ void calc_fps();
+ /* ------------- */
+
+ /* doublesize calculation */
+ uint64_t **doubletab;
+ Uint8 *doublebuf;
+ int dcy, cy, cx;
+ uint64_t eax;
+ /* ---------------------- */
+
+ /* timing and other amenities */
+ double now;
+ int rtc_now;
+ bool riciuca;
+
+
+ public:
+
+ Context();
+ ~Context();
+
+ bool init(int wx, int hx);
+ void close();
+ void cafudda(int secs);
+
+ /* this returns the address of selected coords to video memory */
+ void *coords(int x, int y) { return screen->coords(x,y); };
+
+ void rocknroll(bool state);
+
+ void magnify(int algo);
+ int magnification;
+ bool changeres;
+
+ bool quit;
+
+ bool pause;
+
+ /* linked list of registered layers */
+ Linklist layers;
+
+ /* Video Screen */
+ ViewPort *screen;
+
+ /* On Screen Display */
+ Osd osd;
+
+ /* Keyboard controller */
+ // KbdListener kbd;
+
+ /* Console parser */
+ // Console console;
+
+ /* Filter plugins plugger */
+ Plugger plugger;
+
+ /* javascript parser object */
+ // JsParser *js;
+
+ /* Set the interval (in frames) after
+ the fps counter is updated */
+ void set_fps_interval(int interval);
+ float fps;
+ bool track_fps;
+
+
+ bool clear_all;
+
+ bool rtc; ///< using the realtime clock on linux?
+};
+
+#endif
diff --git a/thk04/cpu_accel.cpp b/thk04/cpu_accel.cpp
new file mode 100644
index 0000000..1853854
--- /dev/null
+++ b/thk04/cpu_accel.cpp
@@ -0,0 +1,211 @@
+/*
+ (c) Copyright 2000-2002 convergence integrated media GmbH.
+ (c) Copyright 2002 convergence GmbH.
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de> and
+ Sven Neumann <sven@convergence.de>.
+
+ cpu_accel code was taken from xine that obviously took it from mpeg2dec.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/*
+ * cpu_accel.c
+ * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ *
+ * mpeg2dec is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * mpeg2dec is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdio.h>
+#include <signal.h>
+#include <setjmp.h>
+
+#include <cpu_accel.h>
+
+#include <config.h>
+
+#ifdef ARCH_X86
+static __u32 arch_accel (void)
+{
+ __u32 eax, ebx, ecx, edx;
+ int AMD;
+ __u32 caps = 0;
+
+#ifndef HAVE_64BIT // XXX HACK!
+#define cpuid(op,eax,ebx,ecx,edx) \
+ asm ("pushl %%ebx\n\t" \
+ "cpuid\n\t" \
+ "movl %%ebx,%1\n\t" \
+ "popl %%ebx" \
+ : "=a" (eax), \
+ "=r" (ebx), \
+ "=c" (ecx), \
+ "=d" (edx) \
+ : "a" (op) \
+ : "cc")
+
+ asm ("pushfl\n\t"
+ "pushfl\n\t"
+ "popl %0\n\t"
+ "movl %0,%1\n\t"
+ "xorl $0x200000,%0\n\t"
+ "pushl %0\n\t"
+ "popfl\n\t"
+ "pushfl\n\t"
+ "popl %0\n\t"
+ "popfl"
+ : "=r" (eax),
+ "=r" (ebx)
+ :
+ : "cc");
+
+ if (eax == ebx) /* no cpuid */
+ return 0;
+
+ cpuid (0x00000000, eax, ebx, ecx, edx);
+ if (!eax) /* vendor string only */
+ return 0;
+
+ AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
+
+ cpuid (0x00000001, eax, ebx, ecx, edx);
+ if (! (edx & 0x00800000)) /* no MMX */
+ return 0;
+
+#endif /* HAVE_64BIT */
+#ifdef HAVE_MMX
+ caps = MM_ACCEL_X86_MMX;
+#ifdef HAVE_SSE
+ if (edx & 0x02000000) /* SSE - identical to AMD MMX extensions */
+ caps |= MM_ACCEL_X86_SSE | MM_ACCEL_X86_MMXEXT;
+
+ if (edx & 0x04000000) /* SSE2 */
+ caps |= MM_ACCEL_X86_SSE2;
+
+#ifndef HAVE_64BIT // XXX HACK!
+ cpuid (0x80000000, eax, ebx, ecx, edx);
+ if (eax < 0x80000001) /* no extended capabilities */
+ return caps;
+
+ cpuid (0x80000001, eax, ebx, ecx, edx);
+
+ if (edx & 0x80000000)
+ caps |= MM_ACCEL_X86_3DNOW;
+
+ if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */
+ caps |= MM_ACCEL_X86_MMXEXT;
+#endif /* USE_SSE */
+#endif /* USE_MMX */
+#endif /* HAVE_64BIT */
+
+ return caps;
+}
+
+static jmp_buf sigill_return;
+
+static void sigill_handler (int n) {
+ longjmp(sigill_return, 1);
+}
+#endif /* ARCH_X86 */
+
+#if defined (ARCH_PPC) && defined (ENABLE_ALTIVEC)
+static sigjmp_buf jmpbuf;
+static volatile sig_atomic_t canjump = 0;
+
+static void sigill_handler (int sig)
+{
+ if (!canjump) {
+ signal (sig, SIG_DFL);
+ raise (sig);
+ }
+
+ canjump = 0;
+ siglongjmp (jmpbuf, 1);
+}
+
+static __u32 arch_accel (void)
+{
+ signal (SIGILL, sigill_handler);
+ if (sigsetjmp (jmpbuf, 1)) {
+ signal (SIGILL, SIG_DFL);
+ return 0;
+ }
+
+ canjump = 1;
+
+ asm volatile ("mtspr 256, %0\n\t"
+ "vand %%v0, %%v0, %%v0"
+ :
+ : "r" (-1));
+
+ signal (SIGILL, SIG_DFL);
+ return MM_ACCEL_PPC_ALTIVEC;
+}
+#endif /* ARCH_PPC */
+
+__u32 detect_mm_accel() {
+#if defined (ARCH_X86) || (defined (ARCH_PPC) && defined (ENABLE_ALTIVEC))
+ static __u32 accel = ~0U;
+
+ if (accel != ~0U)
+ return accel;
+
+ accel = arch_accel ();
+
+#ifdef HAVE_SSE
+
+ /* test OS support for SSE */
+ if (accel & MM_ACCEL_X86_SSE) {
+ if (setjmp(sigill_return)) {
+ accel &= ~(MM_ACCEL_X86_SSE|MM_ACCEL_X86_SSE2);
+ }
+ else {
+ signal (SIGILL, sigill_handler);
+ __asm __volatile ("xorps %xmm0, %xmm0");
+ signal (SIGILL, SIG_DFL);
+ }
+ }
+#endif /* USE_SSE */
+
+ return accel;
+
+#else /* !ARCH_X86 && !ARCH_PPC/ENABLE_ALTIVEC */
+#ifdef HAVE_MLIB
+ return MM_ACCEL_MLIB;
+#else
+ return 0;
+#endif
+#endif /* !ARCH_X86 && !ARCH_PPC/ENABLE_ALTIVEC */
+}
+
diff --git a/thk04/cpu_accel.h b/thk04/cpu_accel.h
new file mode 100644
index 0000000..c54aba4
--- /dev/null
+++ b/thk04/cpu_accel.h
@@ -0,0 +1,84 @@
+/*
+ (c) Copyright 2000-2002 convergence integrated media GmbH.
+ (c) Copyright 2002 convergence GmbH.
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de> and
+ Sven Neumann <sven@convergence.de>.
+
+ cpu_accel code was taken from xine that obviously took it from mpeg2dec.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/*
+ * cpu_accel.c
+ * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ *
+ * mpeg2dec is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * mpeg2dec is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __CPU_ACCEL_H__
+#define __CPU_ACCEL_H__
+
+#include <stdint.h>
+/*
+ * The type of an value that fits in an MMX register (note that long
+ * long constant values MUST be suffixed by LL and unsigned long long
+ * values by ULL, lest they be truncated by the compiler)
+ */
+
+/* generic accelerations */
+#define MM_ACCEL_MLIB 0x00000001
+
+/* x86 accelerations */
+#define MM_ACCEL_X86_MMX 0x80000000
+#define MM_ACCEL_X86_3DNOW 0x40000000
+#define MM_ACCEL_X86_MMXEXT 0x20000000
+#define MM_ACCEL_X86_SSE 0x10000000
+#define MM_ACCEL_X86_SSE2 0x08000000
+/* powerpc accelerations */
+#define MM_ACCEL_PPC_ALTIVEC 0x04000000
+/* x86 compat defines */
+#define MM_MMX MM_ACCEL_X86_MMX
+#define MM_3DNOW MM_ACCEL_X86_3DNOW
+#define MM_MMXEXT MM_ACCEL_X86_MMXEXT
+#define MM_SSE MM_ACCEL_X86_SSE
+#define MM_SSE2 MM_ACCEL_X86_SSE2
+#define __u32 uint32
+
+typedef uint32_t __u32;
+
+__u32 detect_mm_accel();
+
+#endif
+
diff --git a/thk04/dio.c b/thk04/dio.c
new file mode 100644
index 0000000..3bcc6f5
--- /dev/null
+++ b/thk04/dio.c
@@ -0,0 +1,312 @@
+/* Code to support devices on the DIO (and eventually DIO-II) bus
+ * Copyright (C) 05/1998 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+ *
+ * This code has basically these routines at the moment:
+ * int dio_find(u_int deviceid)
+ * Search the list of DIO devices and return the select code
+ * of the next unconfigured device found that matches the given device ID.
+ * Note that the deviceid parameter should be the encoded ID.
+ * This means that framebuffers should pass it as
+ * DIO_ENCODE_ID(DIO_ID_FBUFFER,DIO_ID2_TOPCAT)
+ * (or whatever); everybody else just uses DIO_ID_FOOBAR.
+ * void *dio_scodetoviraddr(int scode)
+ * Return the virtual address corresponding to the given select code.
+ * NB: DIO-II devices will have to be mapped in in this routine!
+ * int dio_scodetoipl(int scode)
+ * Every DIO card has a fixed interrupt priority level. This function
+ * returns it, whatever it is.
+ * const char *dio_scodetoname(int scode)
+ * Return a character string describing this board [might be "" if
+ * not CONFIG_DIO_CONSTANTS]
+ * void dio_config_board(int scode) mark board as configured in the list
+ * void dio_unconfig_board(int scode) mark board as no longer configured
+ *
+ * This file is based on the way the Amiga port handles Zorro II cards,
+ * although we aren't so complicated...
+ */
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/dio.h>
+#include <linux/slab.h> /* kmalloc() */
+#include <linux/init.h>
+#include <asm/hwtest.h> /* hwreg_present() */
+#include <asm/io.h> /* readb() */
+/* not a real config option yet! */
+#define CONFIG_DIO_CONSTANTS
+
+#ifdef CONFIG_DIO_CONSTANTS
+/* We associate each numeric ID with an appropriate descriptive string
+ * using a constant array of these structs.
+ * FIXME: we should be able to arrange to throw away most of the strings
+ * using the initdata stuff. Then we wouldn't need to worry about
+ * carrying them around...
+ * I think we do this by copying them into newly kmalloc()ed memory and
+ * marking the names[] array as .initdata ?
+ */
+struct dioname
+{
+ int id;
+ const char *name;
+};
+
+/* useful macro */
+#define DIONAME(x) { DIO_ID_##x, DIO_DESC_##x }
+#define DIOFBNAME(x) { DIO_ENCODE_ID( DIO_ID_FBUFFER, DIO_ID2_##x), DIO_DESC2_##x }
+
+static struct dioname names[] =
+{
+ DIONAME(DCA0), DIONAME(DCA0REM), DIONAME(DCA1), DIONAME(DCA1REM),
+ DIONAME(DCM), DIONAME(DCMREM),
+ DIONAME(LAN),
+ DIONAME(FHPIB), DIONAME(NHPIB), DIONAME(IHPIB),
+ DIONAME(SCSI0), DIONAME(SCSI1), DIONAME(SCSI2), DIONAME(SCSI3),
+ DIONAME(FBUFFER),
+ DIONAME(PARALLEL), DIONAME(VME), DIONAME(DCL), DIONAME(DCLREM),
+ DIONAME(MISC0), DIONAME(MISC1), DIONAME(MISC2), DIONAME(MISC3),
+ DIONAME(MISC4), DIONAME(MISC5), DIONAME(MISC6), DIONAME(MISC7),
+ DIONAME(MISC8), DIONAME(MISC9), DIONAME(MISC10), DIONAME(MISC11),
+ DIONAME(MISC12), DIONAME(MISC13),
+ DIOFBNAME(GATORBOX), DIOFBNAME(TOPCAT), DIOFBNAME(RENAISSANCE),
+ DIOFBNAME(LRCATSEYE), DIOFBNAME(HRCCATSEYE), DIOFBNAME(HRMCATSEYE),
+ DIOFBNAME(DAVINCI), DIOFBNAME(XXXCATSEYE), DIOFBNAME(HYPERION),
+ DIOFBNAME(XGENESIS), DIOFBNAME(TIGER), DIOFBNAME(YGENESIS)
+};
+
+#undef DIONAME
+#undef DIOFBNAME
+
+#define NUMNAMES (sizeof(names) / sizeof(struct dioname))
+
+static const char *unknowndioname
+ = "unknown DIO board -- please email <pmaydell@chiark.greenend.org.uk>!";
+
+static const char *dio_getname(int id)
+{
+ /* return pointer to a constant string describing the board with given ID */
+ unsigned int i;
+ for (i = 0; i < NUMNAMES; i++)
+ if (names[i].id == id)
+ return names[i].name;
+
+ return unknowndioname;
+}
+
+#else
+
+static char dio_no_name[] = { 0 };
+#define dio_getname(_id) (dio_no_name)
+
+#endif /* CONFIG_DIO_CONSTANTS */
+
+/* We represent all the DIO boards in the system with a linked list of these structs. */
+struct dioboard
+{
+ struct dioboard *next; /* link to next struct in list */
+ int ipl; /* IPL of this board */
+ int configured; /* has this board been configured? */
+ int scode; /* select code of this board */
+ int id; /* encoded ID */
+ const char *name;
+};
+
+static struct dioboard *blist = NULL;
+
+static int __init dio_find_slow(int deviceid)
+{
+ /* Called to find a DIO device before the full bus scan has run. Basically
+ * only used by the console driver.
+ * We don't do the primary+secondary ID encoding thing here. Maybe we should.
+ * (that would break the topcat detection, though. I need to think about
+ * the whole primary/secondary ID thing.)
+ */
+ int scode;
+ u_char prid;
+
+ for (scode = 0; scode < DIO_SCMAX; scode++)
+ {
+ void *va;
+
+ if (DIO_SCINHOLE(scode))
+ continue;
+
+ va = dio_scodetoviraddr(scode);
+ if (!va || !hwreg_present(va + DIO_IDOFF))
+ continue; /* no board present at that select code */
+
+ /* We aren't very likely to want to use this to get at the IHPIB,
+ * but maybe it's returning the same ID as the card we do want...
+ */
+ if (!DIO_ISIHPIB(scode))
+ prid = DIO_ID(va);
+ else
+ prid = DIO_ID_IHPIB;
+
+ if (prid == deviceid)
+ return scode;
+ }
+ return 0;
+}
+
+/* Aargh: we use 0 for an error return code, but select code 0 exists!
+ * FIXME (trivial, use -1, but requires changes to all the drivers :-< )
+ */
+int dio_find(int deviceid)
+{
+ if (blist)
+ {
+ /* fast way */
+ struct dioboard *b;
+ for (b = blist; b; b = b->next)
+ if (b->id == deviceid && b->configured == 0)
+ return b->scode;
+ return 0;
+ }
+ return dio_find_slow(deviceid);
+}
+
+/* This is the function that scans the DIO space and works out what
+ * hardware is actually present.
+ */
+static int __init dio_init(void)
+{
+ int scode;
+ struct dioboard *b, *bprev = NULL;
+
+ printk("Scanning for DIO devices...\n");
+
+ for (scode = 0; scode < DIO_SCMAX; ++scode)
+ {
+ u_char prid, secid = 0; /* primary, secondary ID bytes */
+ u_char *va;
+
+ if (DIO_SCINHOLE(scode))
+ continue;
+
+ va = dio_scodetoviraddr(scode);
+ if (!va || !hwreg_present(va + DIO_IDOFF))
+ continue; /* no board present at that select code */
+
+ /* Found a board, allocate it an entry in the list */
+ b = kmalloc(sizeof(struct dioboard), GFP_KERNEL);
+
+ /* read the ID byte(s) and encode if necessary. Note workaround
+ * for broken internal HPIB devices...
+ */
+ if (!DIO_ISIHPIB(scode))
+ prid = DIO_ID(va);
+ else
+ prid = DIO_ID_IHPIB;
+
+ if (DIO_NEEDSSECID(prid))
+ {
+ secid = DIO_SECID(va);
+ b->id = DIO_ENCODE_ID(prid, secid);
+ }
+ else
+ b->id = prid;
+
+ b->configured = 0;
+ b->scode = scode;
+ b->ipl = DIO_IPL(va);
+ b->name = dio_getname(b->id);
+ printk("select code %3d: ipl %d: ID %02X", scode, b->ipl, prid);
+ if (DIO_NEEDSSECID(b->id))
+ printk(":%02X", secid);
+ printk(": %s\n", b->name);
+
+ b->next = NULL;
+
+ if (bprev)
+ bprev->next = b;
+ else
+ blist = b;
+ bprev = b;
+ }
+ return 0;
+}
+
+subsys_initcall(dio_init);
+
+/* Bear in mind that this is called in the very early stages of initialisation
+ * in order to get the virtual address of the serial port for the console...
+ */
+void *dio_scodetoviraddr(int scode)
+{
+ if (scode > DIOII_SCBASE)
+ {
+ printk("dio_scodetoviraddr: don't support DIO-II yet!\n");
+ return 0;
+ }
+ else if (scode > DIO_SCMAX || scode < 0)
+ return 0;
+ else if (DIO_SCINHOLE(scode))
+ return 0;
+ else if (DIO_ISIHPIB(scode))
+ return (void*)DIO_IHPIBADDR;
+
+ return (void*)(DIO_VIRADDRBASE + DIO_BASE + scode * 0x10000);
+}
+
+int dio_scodetoipl(int scode)
+{
+ struct dioboard *b;
+ for (b = blist; b; b = b->next)
+ if (b->scode == scode)
+ break;
+
+ if (!b)
+ {
+ printk("dio_scodetoipl: bad select code %d\n", scode);
+ return 0;
+ }
+ else
+ return b->ipl;
+}
+
+const char *dio_scodetoname(int scode)
+{
+ struct dioboard *b;
+ for (b = blist; b; b = b->next)
+ if (b->scode == scode)
+ break;
+
+ if (!b)
+ {
+ printk("dio_scodetoname: bad select code %d\n", scode);
+ return NULL;
+ }
+ else
+ return b->name;
+}
+
+void dio_config_board(int scode)
+{
+ struct dioboard *b;
+ for (b = blist; b; b = b->next)
+ if (b->scode == scode)
+ break;
+
+ if (!b)
+ printk("dio_config_board: bad select code %d\n", scode);
+ else if (b->configured)
+ printk("dio_config_board: board at select code %d already configured\n", scode);
+ else
+ b->configured = 1;
+}
+
+void dio_unconfig_board(int scode)
+{
+ struct dioboard *b;
+ for (b = blist; b; b = b->next)
+ if (b->scode == scode)
+ break;
+
+ if (!b)
+ printk("dio_unconfig_board: bad select code %d\n", scode);
+ else if (!b->configured)
+ printk("dio_unconfig_board: board at select code %d not configured\n",
+ scode);
+ else
+ b->configured = 0;
+}
diff --git a/thk04/fastmemcpy.cpp b/thk04/fastmemcpy.cpp
new file mode 100644
index 0000000..2005acc
--- /dev/null
+++ b/thk04/fastmemcpy.cpp
@@ -0,0 +1,726 @@
+/*
+ (c) Copyright 2000-2002 convergence integrated media GmbH.
+ (c) Copyright 2002 convergence GmbH.
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de> and
+ Sven Neumann <sven@convergence.de>.
+ Silvano Galliani aka kysucix <kysucix@dyne.org> sse2 version
+
+ Fast memcpy code was taken from xine (see below).
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/*
+ * Copyright (C) 2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * These are the MMX/MMX2/SSE optimized versions of memcpy
+ *
+ * This code was adapted from Linux Kernel sources by Nick Kurshev to
+ * the mplayer program. (http://mplayer.sourceforge.net)
+ *
+ * Miguel Freitas split the #ifdefs into several specialized functions that
+ * are benchmarked at runtime by xine. Some original comments from Nick
+ * have been preserved documenting some MMX/SSE oddities.
+ * Also added kernel memcpy function that seems faster than glibc one.
+ *
+ */
+
+/* Original comments from mplayer (file: aclib.c) This part of code
+ was taken by me from Linux-2.4.3 and slightly modified for MMX, MMX2,
+ SSE instruction set. I have done it since linux uses page aligned
+ blocks but mplayer uses weakly ordered data and original sources can
+ not speedup them. Only using PREFETCHNTA and MOVNTQ together have
+ effect!
+
+ From IA-32 Intel Architecture Software Developer's Manual Volume 1,
+
+ Order Number 245470:
+ "10.4.6. Cacheability Control, Prefetch, and Memory Ordering Instructions"
+
+ Data referenced by a program can be temporal (data will be used
+ again) or non-temporal (data will be referenced once and not reused
+ in the immediate future). To make efficient use of the processor's
+ caches, it is generally desirable to cache temporal data and not
+ cache non-temporal data. Overloading the processor's caches with
+ non-temporal data is sometimes referred to as "polluting the
+ caches". The non-temporal data is written to memory with
+ Write-Combining semantics.
+
+ The PREFETCHh instructions permits a program to load data into the
+ processor at a suggested cache level, so that it is closer to the
+ processors load and store unit when it is needed. If the data is
+ already present in a level of the cache hierarchy that is closer to
+ the processor, the PREFETCHh instruction will not result in any data
+ movement. But we should you PREFETCHNTA: Non-temporal data fetch
+ data into location close to the processor, minimizing cache
+ pollution.
+
+ The MOVNTQ (store quadword using non-temporal hint) instruction
+ stores packed integer data from an MMX register to memory, using a
+ non-temporal hint. The MOVNTPS (store packed single-precision
+ floating-point values using non-temporal hint) instruction stores
+ packed floating-point data from an XMM register to memory, using a
+ non-temporal hint.
+
+ The SFENCE (Store Fence) instruction controls write ordering by
+ creating a fence for memory store operations. This instruction
+ guarantees that the results of every store instruction that precedes
+ the store fence in program order is globally visible before any
+ store instruction that follows the fence. The SFENCE instruction
+ provides an efficient way of ensuring ordering between procedures
+ that produce weakly-ordered data and procedures that consume that
+ data.
+
+ If you have questions please contact with me: Nick Kurshev:
+ nickols_k@mail.ru.
+*/
+
+/* mmx v.1 Note: Since we added alignment of destinition it speedups
+ of memory copying on PentMMX, Celeron-1 and P2 upto 12% versus
+ standard (non MMX-optimized) version.
+ Note: on K6-2+ it speedups memory copying upto 25% and
+ on K7 and P3 about 500% (5 times).
+*/
+
+/* Additional notes on gcc assembly and processors: [MF]
+ prefetch is specific for AMD processors, the intel ones should be
+ prefetch0, prefetch1, prefetch2 which are not recognized by my gcc.
+ prefetchnta is supported both on athlon and pentium 3.
+
+ therefore i will take off prefetchnta instructions from the mmx1
+ version to avoid problems on pentium mmx and k6-2.
+
+ quote of the day:
+ "Using prefetches efficiently is more of an art than a science"
+*/
+
+#include <sys/time.h>
+#include <time.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <config.h>
+#include <jutils.h>
+#include <cpu_accel.h>
+#include <fastmemcpy.h>
+
+
+
+#ifdef ARCH_X86
+
+/* for small memory blocks (<256 bytes) this version is faster */
+#define small_memcpy(to,from,n)\
+{\
+register unsigned long int dummy;\
+__asm__ __volatile__(\
+ "rep; movsb"\
+ :"=&D"(to), "=&S"(from), "=&c"(dummy)\
+ :"0" (to), "1" (from),"2" (n)\
+ : "memory");\
+}
+/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
+#ifdef HAVE_3DNOW
+#define EMMS "femms"
+#else
+#define EMMS "emms"
+#endif
+
+#ifdef HAVE_MMX2
+#define PREFETCH "prefetchnta"
+#elif defined ( HAVE_3DNOW )
+#define PREFETCH "prefetch"
+#else
+#define PREFETCH "/nop"
+#endif
+
+
+#undef MOVNTQ
+#ifdef HAVE_MMX2
+#define MOVNTQ "movntq"
+#else
+#define MOVNTQ "movq"
+#endif
+
+#undef MIN_LEN
+#ifdef HAVE_MMX1
+#define MIN_LEN 0x800 /* 2K blocks */
+#else
+#define MIN_LEN 0x40 /* 64-byte blocks */
+#endif
+
+
+static void * agp_memcpy(void *to, const void *from , size_t len) {
+ void *retval;
+ size_t i;
+ retval = to;
+ if(len >= MIN_LEN)
+ {
+ register unsigned long int delta;
+ /* Align destinition to MMREG_SIZE -boundary */
+ delta = ((unsigned long int)to)&7;
+ if(delta)
+ {
+ delta=8-delta;
+ len -= delta;
+ small_memcpy(to, from, delta);
+ }
+ i = len >> 6; /* len/64 */
+ len &= 63;
+ /*
+ This algorithm is top effective when the code consequently
+ reads and writes blocks which have size of cache line.
+ Size of cache line is processor-dependent.
+ It will, however, be a minimum of 32 bytes on any processors.
+ It would be better to have a number of instructions which
+ perform reading and writing to be multiple to a number of
+ processor's decoders, but it's not always possible.
+ */
+ for(; i>0; i--)
+ {
+ __asm__ __volatile__ (
+ PREFETCH" 320(%0)\n"
+ "movq (%0), %%mm0\n"
+ "movq 8(%0), %%mm1\n"
+ "movq 16(%0), %%mm2\n"
+ "movq 24(%0), %%mm3\n"
+ "movq 32(%0), %%mm4\n"
+ "movq 40(%0), %%mm5\n"
+ "movq 48(%0), %%mm6\n"
+ "movq 56(%0), %%mm7\n"
+ MOVNTQ" %%mm0, (%1)\n"
+ MOVNTQ" %%mm1, 8(%1)\n"
+ MOVNTQ" %%mm2, 16(%1)\n"
+ MOVNTQ" %%mm3, 24(%1)\n"
+ MOVNTQ" %%mm4, 32(%1)\n"
+ MOVNTQ" %%mm5, 40(%1)\n"
+ MOVNTQ" %%mm6, 48(%1)\n"
+ MOVNTQ" %%mm7, 56(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from = ((const unsigned char *)from)+64;
+ to = ((unsigned char *)to)+64;
+ }
+#ifdef HAVE_MMX2
+ /* since movntq is weakly-ordered, a "sfence"
+ * is needed to become ordered again. */
+ __asm__ __volatile__ ("sfence":::"memory");
+#endif
+ /* enables to use FPU */
+ __asm__ __volatile__ (EMMS:::"memory");
+ }
+ /*
+ * Now do the tail of the block
+ */
+ if(len) small_memcpy(to, from, len);
+ return retval;
+}
+
+
+/* linux kernel __memcpy (from: /include/asm/string.h) */
+static inline void * __memcpy(void * to, const void * from, size_t n)
+{
+ int d0, d1, d2;
+
+ if ( n < 4 ) {
+ small_memcpy(to,from,n);
+ }
+ else
+ __asm__ __volatile__(
+ "rep ; movsl\n\t"
+ "testb $2,%b4\n\t"
+ "je 1f\n\t"
+ "movsw\n"
+ "1:\ttestb $1,%b4\n\t"
+ "je 2f\n\t"
+ "movsb\n"
+ "2:"
+ : "=&c" (d0), "=&D" (d1), "=&S" (d2)
+ :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
+ : "memory");
+
+ return(to);
+}
+
+#ifdef HAVE_MMX
+
+#define MMX_MMREG_SIZE 8
+
+#define MMX1_MIN_LEN 0x800 /* 2K blocks */
+#define MIN_LEN 0x40 /* 64-byte blocks */
+
+static void * mmx_memcpy(void * to, const void * from, size_t len)
+{
+ void *retval;
+ size_t i;
+ retval = to;
+
+ if (len >= MMX1_MIN_LEN) {
+ register unsigned long int delta;
+ /* Align destinition to MMREG_SIZE -boundary */
+ delta = ((unsigned long int)to)&(MMX_MMREG_SIZE-1);
+ if (delta) {
+ delta=MMX_MMREG_SIZE-delta;
+ len -= delta;
+ small_memcpy(to, from, delta);
+ }
+ i = len >> 6; /* len/64 */
+ len&=63;
+ for (; i>0; i--) {
+ __asm__ __volatile__ (
+ "movq (%0), %%mm0\n"
+ "movq 8(%0), %%mm1\n"
+ "movq 16(%0), %%mm2\n"
+ "movq 24(%0), %%mm3\n"
+ "movq 32(%0), %%mm4\n"
+ "movq 40(%0), %%mm5\n"
+ "movq 48(%0), %%mm6\n"
+ "movq 56(%0), %%mm7\n"
+ "movq %%mm0, (%1)\n"
+ "movq %%mm1, 8(%1)\n"
+ "movq %%mm2, 16(%1)\n"
+ "movq %%mm3, 24(%1)\n"
+ "movq %%mm4, 32(%1)\n"
+ "movq %%mm5, 40(%1)\n"
+ "movq %%mm6, 48(%1)\n"
+ "movq %%mm7, 56(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from = ((const unsigned char *)from)+64;
+ to = ((unsigned char *)to)+64;
+ }
+ __asm__ __volatile__ ("emms":::"memory");
+ }
+ /*
+ * Now do the tail of the block
+ */
+ if (len) __memcpy(to, from, len);
+ return retval;
+}
+
+/* we might want to write optimized versions of these later */
+#define __constant_count_memset(s,c,count) __memset_generic((s),(c),(count))
+
+/*
+ * memset(x,0,y) is a reasonably common thing to do, so we want to fill
+ * things 32 bits at a time even when we don't know the size of the
+ * area at compile-time..
+ */
+void mymemzero(void * s, unsigned long c ,size_t count)
+{
+int d0, d1;
+__asm__ __volatile__(
+ "rep ; stosl\n\t"
+ "testb $2,%b3\n\t"
+ "je 1f\n\t"
+ "stosw\n"
+ "1:\ttestb $1,%b3\n\t"
+ "je 2f\n\t"
+ "stosb\n"
+ "2:"
+ : "=&c" (d0), "=&D" (d1)
+ :"a" (c), "q" (count), "0" (count/4), "1" ((long) s)
+ :"memory");
+}
+
+#ifdef HAVE_SSE
+
+#define SSE_MMREG_SIZE 16
+
+static void * mmx2_memcpy(void * to, const void * from, size_t len)
+{
+ void *retval;
+ size_t i;
+ retval = to;
+
+ /* PREFETCH has effect even for MOVSB instruction ;) */
+ __asm__ __volatile__ (
+ " prefetchnta (%0)\n"
+ " prefetchnta 64(%0)\n"
+ " prefetchnta 128(%0)\n"
+ " prefetchnta 192(%0)\n"
+ " prefetchnta 256(%0)\n"
+ : : "r" (from) );
+
+ if (len >= MIN_LEN) {
+ register unsigned long int delta;
+ /* Align destinition to MMREG_SIZE -boundary */
+ delta = ((unsigned long int)to)&(MMX_MMREG_SIZE-1);
+ if (delta) {
+ delta=MMX_MMREG_SIZE-delta;
+ len -= delta;
+ small_memcpy(to, from, delta);
+ }
+ i = len >> 6; /* len/64 */
+ len&=63;
+ for (; i>0; i--) {
+ __asm__ __volatile__ (
+ "prefetchnta 320(%0)\n"
+ "movq (%0), %%mm0\n"
+ "movq 8(%0), %%mm1\n"
+ "movq 16(%0), %%mm2\n"
+ "movq 24(%0), %%mm3\n"
+ "movq 32(%0), %%mm4\n"
+ "movq 40(%0), %%mm5\n"
+ "movq 48(%0), %%mm6\n"
+ "movq 56(%0), %%mm7\n"
+ "movntq %%mm0, (%1)\n"
+ "movntq %%mm1, 8(%1)\n"
+ "movntq %%mm2, 16(%1)\n"
+ "movntq %%mm3, 24(%1)\n"
+ "movntq %%mm4, 32(%1)\n"
+ "movntq %%mm5, 40(%1)\n"
+ "movntq %%mm6, 48(%1)\n"
+ "movntq %%mm7, 56(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from = ((const unsigned char *)from)+64;
+ to = ((unsigned char *)to)+64;
+ }
+ /* since movntq is weakly-ordered, a "sfence"
+ * is needed to become ordered again. */
+ __asm__ __volatile__ ("sfence":::"memory");
+ __asm__ __volatile__ ("emms":::"memory");
+ }
+ /*
+ * Now do the tail of the block
+ */
+ if (len) __memcpy(to, from, len);
+ return retval;
+}
+
+/* SSE note: i tried to move 128 bytes a time instead of 64 but it
+didn't make any measureable difference. i'm using 64 for the sake of
+simplicity. [MF] */
+static void * sse_memcpy(void * to, const void * from, size_t len)
+{
+ void *retval;
+ size_t i;
+ retval = to;
+
+ /* PREFETCH has effect even for MOVSB instruction ;) */
+ __asm__ __volatile__ (
+ " prefetchnta (%0)\n"
+ " prefetchnta 64(%0)\n"
+ " prefetchnta 128(%0)\n"
+ " prefetchnta 192(%0)\n"
+ " prefetchnta 256(%0)\n"
+ : : "r" (from) );
+
+ if (len >= MIN_LEN) {
+ register unsigned long int delta;
+ /* Align destinition to MMREG_SIZE -boundary */
+ delta = ((unsigned long int)to)&(SSE_MMREG_SIZE-1);
+ if (delta) {
+ delta=SSE_MMREG_SIZE-delta;
+ len -= delta;
+ small_memcpy(to, from, delta);
+ }
+ i = len >> 6; /* len/64 */
+ len&=63;
+ if (((unsigned long)from) & 15)
+ /* if SRC is misaligned */
+ for (; i>0; i--) {
+ __asm__ __volatile__ (
+ "prefetchnta 320(%0)\n"
+ "movups (%0), %%xmm0\n"
+ "movups 16(%0), %%xmm1\n"
+ "movups 32(%0), %%xmm2\n"
+ "movups 48(%0), %%xmm3\n"
+ "movntps %%xmm0, (%1)\n"
+ "movntps %%xmm1, 16(%1)\n"
+ "movntps %%xmm2, 32(%1)\n"
+ "movntps %%xmm3, 48(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from = ((const unsigned char *)from)+64;
+ to = ((unsigned char *)to)+64;
+ }
+ else
+ /*
+ Only if SRC is aligned on 16-byte boundary.
+ It allows to use movaps instead of movups, which required
+ data to be aligned or a general-protection exception (#GP)
+ is generated.
+ */
+ for (; i>0; i--) {
+ __asm__ __volatile__ (
+ "prefetchnta 320(%0)\n"
+ "movaps (%0), %%xmm0\n"
+ "movaps 16(%0), %%xmm1\n"
+ "movaps 32(%0), %%xmm2\n"
+ "movaps 48(%0), %%xmm3\n"
+ "movntps %%xmm0, (%1)\n"
+ "movntps %%xmm1, 16(%1)\n"
+ "movntps %%xmm2, 32(%1)\n"
+ "movntps %%xmm3, 48(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from = ((const unsigned char *)from)+64;
+ to = ((unsigned char *)to)+64;
+ }
+ /* since movntq is weakly-ordered, a "sfence"
+ * is needed to become ordered again. */
+ __asm__ __volatile__ ("sfence":::"memory");
+ /* enables to use FPU */
+ __asm__ __volatile__ ("emms":::"memory");
+ }
+ /*
+ * Now do the tail of the block
+ */
+ if (len) __memcpy(to, from, len);
+ return retval;
+}
+
+static void * sse2_memcpy(void * to, const void * from, size_t len)
+{
+ void *retval;
+ size_t i;
+ retval = to;
+
+ /* PREFETCH has effect even for MOVSB instruction ;) */
+ /* Is that useful ? kysucix */
+
+ __asm__ __volatile__ (
+ " prefetchnta (%0)\n"
+ " prefetchnta 64(%0)\n"
+ " prefetchnta 128(%0)\n"
+ " prefetchnta 192(%0)\n"
+ " prefetchnta 256(%0)\n"
+ /*
+ " prefetchnta 320(%0)\n"
+ " prefetchnta 384(%0)\n"
+ " prefetchnta 448(%0)\n"
+ " prefetchnta 512(%0)\n"
+ */
+ : : "r" (from) );
+
+ if (len >= MIN_LEN) {
+ register unsigned long int delta;
+ /* Align destinition to MMREG_SIZE -boundary */
+ delta = ((unsigned long int)to)&(SSE_MMREG_SIZE-1);
+ if (delta) {
+ delta=SSE_MMREG_SIZE-delta;
+ len -= delta;
+ small_memcpy(to, from, delta);
+ }
+ i = len >> 7; /* len/128 */
+ len&=127;
+ if (((unsigned long)from) & 15)
+ /* if SRC is misaligned */
+ for (; i>0; i--) {
+ __asm__ __volatile__ (
+ "prefetchnta 640(%0)\n"
+
+ "movdqu (%0), %%xmm0\n"
+ "movdqu 16(%0), %%xmm1\n"
+ "movdqu 32(%0), %%xmm2\n"
+ "movdqu 48(%0), %%xmm3\n"
+
+ "movntdq %%xmm0, (%1)\n"
+ "movntdq %%xmm1, 16(%1)\n"
+ "movntdq %%xmm2, 32(%1)\n"
+ "movntdq %%xmm3, 48(%1)\n"
+
+ "movdqu 64(%0), %%xmm4\n"
+ "movdqu 80(%0), %%xmm5\n"
+ "movdqu 96(%0), %%xmm6\n"
+ "movdqu 112(%0), %%xmm7\n"
+
+ "movntdq %%xmm4, 64(%1)\n"
+ "movntdq %%xmm5, 80(%1)\n"
+ "movntdq %%xmm6, 96(%1)\n"
+ "movntdq %%xmm7, 112(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from = ((const unsigned char *)from)+128;
+ to = ((unsigned char *)to)+128;
+ }
+ else
+ /*
+ Only if SRC is aligned on 16-byte boundary.
+ It allows to use movaps instead of movups, which required
+ data to be aligned or a general-protection exception (#GP)
+ is generated.
+ */
+ for (; i>0; i--) {
+ __asm__ __volatile__ (
+ "prefetchnta 640(%0)\n"
+
+ "movapd (%0), %%xmm0\n"
+ "movapd 16(%0), %%xmm1\n"
+ "movapd 32(%0), %%xmm2\n"
+ "movapd 48(%0), %%xmm3\n"
+
+ "movntdq %%xmm0, (%1)\n"
+ "movntdq %%xmm1, 16(%1)\n"
+ "movntdq %%xmm2, 32(%1)\n"
+ "movntdq %%xmm3, 48(%1)\n"
+
+ "movapd 64(%0), %%xmm4\n"
+ "movapd 80(%0), %%xmm5\n"
+ "movapd 96(%0), %%xmm6\n"
+ "movapd 112(%0), %%xmm7\n"
+
+ "movntdq %%xmm4, 64(%1)\n"
+ "movntdq %%xmm5, 80(%1)\n"
+ "movntdq %%xmm6, 96(%1)\n"
+ "movntdq %%xmm7, 112(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from = ((const unsigned char *)from)+128;
+ to = ((unsigned char *)to)+128;
+ }
+ /* since movntq is weakly-ordered, a "sfence"
+ * is needed to become ordered again. */
+ __asm__ __volatile__ ("mfence":::"memory");
+ /* enables to use FPU */
+ __asm__ __volatile__ ("emms":::"memory");
+ }
+ /*
+ * Now do the tail of the block
+ */
+ if (len) __memcpy(to, from, len);
+ return retval;
+}
+#endif /* USE_SSE */
+#endif /* USE_MMX */
+
+
+static void *linux_kernel_memcpy(void *to, const void *from, size_t len) {
+ return __memcpy(to,from,len);
+}
+
+#endif /* ARCH_X86 */
+
+/* save library size on platforms without special memcpy impl. */
+
+static struct {
+ const char *name;
+ void *(*function)(void *to, const void *from, size_t len);
+ unsigned long long time;
+ __u32 cpu_require;
+} memcpy_method[] =
+{
+ { NULL, NULL, 0, 0},
+ { "glibc memcpy()", memcpy, 0, 0},
+#ifdef ARCH_X86
+ { "linux kernel memcpy()", linux_kernel_memcpy, 0, 0},
+ { "agp optimized memcpy()", agp_memcpy,0,0},
+#ifdef HAVE_MMX
+ { "MMX optimized memcpy()", mmx_memcpy, 0, MM_MMX},
+#ifdef HAVE_SSE
+ { "MMXEXT optimized memcpy()", mmx2_memcpy, 0, MM_MMXEXT},
+ { "SSE optimized memcpy()", sse_memcpy, 0, MM_MMXEXT|MM_SSE},
+#ifdef HAVE_SSE2
+ { "SSE2 optimized memcpy()", sse2_memcpy, 0, MM_MMXEXT|MM_SSE|MM_SSE2},
+#endif /* USE_SSE2 */
+#endif /* USE_SSE */
+#endif /* USE_MMX */
+#endif /* ARCH_X86 */
+ { NULL, NULL, 0, 0},
+};
+
+
+#ifdef ARCH_X86
+static inline unsigned long long int rdtsc()
+{
+ unsigned long long int x;
+ __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
+ return x;
+}
+#else
+static inline unsigned long long int rdtsc()
+{
+ struct timeval tv;
+
+ gettimeofday (&tv, NULL);
+ return (tv.tv_sec * 1000000 + tv.tv_usec);
+}
+#endif
+
+
+//void *(* jmemcpy)(void *to, const void *from, size_t len) = memcpy;
+
+#define BUFSIZE 1024
+
+void find_best_memcpy()
+{
+ /* save library size on platforms without special memcpy impl. */
+
+ unsigned long long t;
+ char *buf1, *buf2;
+ int i, j, best = 0;
+ __u32 config_flags = detect_mm_accel();
+
+ if (!(buf1 = (char*) malloc( BUFSIZE * 2000 * sizeof(char) )))
+ return;
+
+ if (!(buf2 = (char*) malloc( BUFSIZE * 2000 * sizeof(char) ))) {
+ free( buf1 );
+ return;
+ }
+
+ memset(buf1,0, BUFSIZE*2000);
+ memset(buf2,0, BUFSIZE*2000);
+
+ /* make sure buffers are present on physical memory */
+ memcpy( buf1, buf2, BUFSIZE * 2000 );
+ memcpy( buf2, buf1, BUFSIZE * 2000 );
+ func("Finding best memory copy function");
+ for (i=1; memcpy_method[i].name; i++) {
+ if (memcpy_method[i].cpu_require & ~config_flags)
+ continue;
+
+ t = rdtsc();
+
+ for (j=0; j<2000; j++)
+ memcpy_method[i].function( buf1 + j*BUFSIZE, buf2 + j*BUFSIZE, BUFSIZE );
+
+ t = rdtsc() - t;
+ memcpy_method[i].time = t;
+
+ func("%s : time %2.2f",
+ memcpy_method[i].name, (float) ( (float) t / 1000000.0));
+
+ if (best == 0 || t < memcpy_method[best].time)
+ best = i;
+ }
+
+ if (best) {
+ notice("Using memory-to-memory copy method : %s",
+ memcpy_method[best].name);
+
+ jmemcpy = memcpy_method[best].function;
+ }
+
+ free( buf1 );
+ free( buf2 );
+}
+
diff --git a/thk04/fastmemcpy.h b/thk04/fastmemcpy.h
new file mode 100644
index 0000000..4c46c7d
--- /dev/null
+++ b/thk04/fastmemcpy.h
@@ -0,0 +1,48 @@
+/*
+ (c) Copyright 2000-2002 convergence integrated media GmbH.
+ (c) Copyright 2002 convergence GmbH.
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de> and
+ Sven Neumann <sven@convergence.de>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __MISC__MEMCPY_H__
+#define __MISC__MEMCPY_H__
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <config.h>
+
+void find_best_memcpy();
+
+extern void *(*jmemcpy)( void *to, const void *from, size_t len );
+
+static inline void *jmemmove( void *to, const void *from, size_t len )
+{
+ if (from > to || ((const char*) from + len) < ((char*) to))
+ return jmemcpy( to, from, len );
+
+ return memmove( to, from, len );
+}
+
+#endif
+
diff --git a/thk04/filter.h b/thk04/filter.h
new file mode 100644
index 0000000..7d028bc
--- /dev/null
+++ b/thk04/filter.h
@@ -0,0 +1,42 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __filter_h__
+#define __filter_h__
+
+#include <linklist.h>
+#include <plugin.h>
+
+class Filter: public Plugin, public Entry {
+ public:
+ Filter() { initialized=false; active=true; inuse=false; };
+ virtual ~Filter() { };
+
+ // virtual bool kbd_input(SDL_keysym *keysym) { return(false); };
+
+ /* TODO
+
+ merge Plugin with this class
+ */
+
+ bool initialized;
+ bool active;
+ bool inuse;
+};
+
+#endif
diff --git a/thk04/font_acorn_8x8.h b/thk04/font_acorn_8x8.h
new file mode 100644
index 0000000..95953c9
--- /dev/null
+++ b/thk04/font_acorn_8x8.h
@@ -0,0 +1,262 @@
+#define CHAR_WIDTH 8
+#define CHAR_HEIGHT 8
+#define CHAR_START 1
+
+static unsigned char fontdata[] = {
+/* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
+/* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */
+/* 02 */ 0x7e, 0xff, 0xbd, 0xff, 0xc3, 0xe7, 0xff, 0x7e, /* ^B */
+/* 03 */ 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, /* ^C */
+/* 04 */ 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, /* ^D */
+/* 05 */ 0x00, 0x18, 0x3c, 0xe7, 0xe7, 0x3c, 0x18, 0x00, /* ^E */
+/* 06 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 08 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 09 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0A */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0B */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0C */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0D */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0E */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 0F */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 10 */ 0x00, 0x60, 0x78, 0x7e, 0x7e, 0x78, 0x60, 0x00, /* |> */
+/* 11 */ 0x00, 0x06, 0x1e, 0x7e, 0x7e, 0x1e, 0x06, 0x00, /* <| */
+/* 12 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 13 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 14 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 15 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 16 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 18 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 19 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 1A */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 1B */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 1C */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 1D */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 1E */ 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x7e, 0x7e, 0x00, /* /\ */
+/* 1F */ 0x00, 0x7e, 0x7e, 0x3c, 0x3c, 0x18, 0x18, 0x00, /* \/ */
+/* 20 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
+/* 21 */ 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x18, 0x00, /* ! */
+/* 22 */ 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, /* " */
+/* 23 */ 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00, /* # */
+/* 24 */ 0x0C, 0x3F, 0x68, 0x3E, 0x0B, 0x7E, 0x18, 0x00, /* $ */
+/* 25 */ 0x60, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x06, 0x00, /* % */
+/* 26 */ 0x38, 0x6C, 0x6C, 0x38, 0x6D, 0x66, 0x3B, 0x00, /* & */
+/* 27 */ 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, /* ' */
+/* 28 */ 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, /* ( */
+/* 29 */ 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, /* ) */
+/* 2A */ 0x00, 0x18, 0x7E, 0x3C, 0x7E, 0x18, 0x00, 0x00, /* * */
+/* 2B */ 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, /* + */
+/* 2C */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, /* , */
+/* 2D */ 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, /* - */
+/* 2E */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, /* . */
+/* 2F */ 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00, /* / */
+/* 30 */ 0x3C, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x3C, 0x00, /* 0 */
+/* 31 */ 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, /* 1 */
+/* 32 */ 0x3C, 0x66, 0x06, 0x0C, 0x18, 0x30, 0x7E, 0x00, /* 2 */
+/* 33 */ 0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C, 0x00, /* 3 */
+/* 34 */ 0x0C, 0x1C, 0x3C, 0x6C, 0x7E, 0x0C, 0x0C, 0x00, /* 4 */
+/* 35 */ 0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C, 0x00, /* 5 */
+/* 36 */ 0x1C, 0x30, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00, /* 6 */
+/* 37 */ 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, /* 7 */
+/* 38 */ 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00, /* 8 */
+/* 39 */ 0x3C, 0x66, 0x66, 0x3E, 0x06, 0x0C, 0x38, 0x00, /* 9 */
+/* 3A */ 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, /* : */
+/* 3B */ 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30, /* ; */
+/* 3C */ 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x00, /* < */
+/* 3D */ 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00, /* = */
+/* 3E */ 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x00, /* > */
+/* 3F */ 0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00, /* ? */
+/* 40 */ 0x3C, 0x66, 0x6E, 0x6A, 0x6E, 0x60, 0x3C, 0x00, /* @ */
+/* 41 */ 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00, /* A */
+/* 42 */ 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x00, /* B */
+/* 43 */ 0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x00, /* C */
+/* 44 */ 0x78, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0x78, 0x00, /* D */
+/* 45 */ 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x7E, 0x00, /* E */
+/* 46 */ 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60, 0x00, /* F */
+/* 47 */ 0x3C, 0x66, 0x60, 0x6E, 0x66, 0x66, 0x3C, 0x00, /* G */
+/* 48 */ 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00, /* H */
+/* 49 */ 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, /* I */
+/* 4A */ 0x3E, 0x0C, 0x0C, 0x0C, 0x0C, 0x6C, 0x38, 0x00, /* J */
+/* 4B */ 0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66, 0x00, /* K */
+/* 4C */ 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 0x00, /* L */
+/* 4D */ 0x63, 0x77, 0x7F, 0x6B, 0x6B, 0x63, 0x63, 0x00, /* M */
+/* 4E */ 0x66, 0x66, 0x76, 0x7E, 0x6E, 0x66, 0x66, 0x00, /* N */
+/* 4F */ 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, /* O */
+/* 50 */ 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x00, /* P */
+/* 51 */ 0x3C, 0x66, 0x66, 0x66, 0x6A, 0x6C, 0x36, 0x00, /* Q */
+/* 52 */ 0x7C, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0x66, 0x00, /* R */
+/* 53 */ 0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C, 0x00, /* S */
+/* 54 */ 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, /* T */
+/* 55 */ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, /* U */
+/* 56 */ 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, /* V */
+/* 57 */ 0x63, 0x63, 0x6B, 0x6B, 0x7F, 0x77, 0x63, 0x00, /* W */
+/* 58 */ 0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00, /* X */
+/* 59 */ 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00, /* Y */
+/* 5A */ 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00, /* Z */
+/* 5B */ 0x7C, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7C, 0x00, /* [ */
+/* 5C */ 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00, /* \ */
+/* 5D */ 0x3E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3E, 0x00, /* ] */
+/* 5E */ 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^ */
+/* 5F */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, /* _ */
+/* 60 */ 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ` */
+/* 61 */ 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, /* a */
+/* 62 */ 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x00, /* b */
+/* 63 */ 0x00, 0x00, 0x3C, 0x66, 0x60, 0x66, 0x3C, 0x00, /* c */
+/* 64 */ 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x3E, 0x00, /* d */
+/* 65 */ 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, /* e */
+/* 66 */ 0x1C, 0x30, 0x30, 0x7C, 0x30, 0x30, 0x30, 0x00, /* f */
+/* 67 */ 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x3C, /* g */
+/* 68 */ 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00, /* h */
+/* 69 */ 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, /* i */
+/* 6A */ 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x70, /* j */
+/* 6B */ 0x60, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0x00, /* k */
+/* 6C */ 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, /* l */
+/* 6D */ 0x00, 0x00, 0x36, 0x7F, 0x6B, 0x6B, 0x63, 0x00, /* m */
+/* 6E */ 0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00, /* n */
+/* 6F */ 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, /* o */
+/* 70 */ 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, /* p */
+/* 71 */ 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x07, /* q */
+/* 72 */ 0x00, 0x00, 0x6C, 0x76, 0x60, 0x60, 0x60, 0x00, /* r */
+/* 73 */ 0x00, 0x00, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x00, /* s */
+/* 74 */ 0x30, 0x30, 0x7C, 0x30, 0x30, 0x30, 0x1C, 0x00, /* t */
+/* 75 */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, /* u */
+/* 76 */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, /* v */
+/* 77 */ 0x00, 0x00, 0x63, 0x6B, 0x6B, 0x7F, 0x36, 0x00, /* w */
+/* 78 */ 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00, /* x */
+/* 79 */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x3C, /* y */
+/* 7A */ 0x00, 0x00, 0x7E, 0x0C, 0x18, 0x30, 0x7E, 0x00, /* z */
+/* 7B */ 0x0C, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0C, 0x00, /* { */
+/* 7C */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, /* | */
+/* 7D */ 0x30, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x30, 0x00, /* } */
+/* 7E */ 0x31, 0x6B, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, /* ~ */
+/* 7F */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /*  */
+/* 80 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 81 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 82 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 83 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 84 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 85 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 86 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 88 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 89 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 8A */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 8B */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 8C */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 8D */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 8E */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 8F */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 90 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 91 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 92 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 93 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 94 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 95 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 98 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 99 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 9A */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 9B */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 9C */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 9D */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 9E */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 9F */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A2 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A3 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A4 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A5 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A6 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A8 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* A9 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* AA */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* AB */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* AC */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* AD */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* AE */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* AF */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* B0 */ 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88,
+/* B1 */ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
+/* B2 */ 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77,
+/* B3 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+/* B4 */ 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18,
+/* B5 */ 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18,
+/* B6 */ 0x66, 0x66, 0x66, 0xe6, 0x66, 0x66, 0x66, 0x66,
+/* B7 */ 0x00, 0x00, 0x00, 0xfe, 0x66, 0x66, 0x66, 0x66,
+/* B8 */ 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18,
+/* B9 */ 0x66, 0x66, 0xe6, 0x06, 0xe6, 0x66, 0x66, 0x66,
+/* BA */ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+/* BB */ 0x00, 0x00, 0xfe, 0x06, 0xe6, 0x66, 0x66, 0x66,
+/* BC */ 0x66, 0x66, 0xe6, 0x06, 0xfe, 0x00, 0x00, 0x00,
+/* BD */ 0x66, 0x66, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
+/* BE */ 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00,
+/* BF */ 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18,
+/* C0 */ 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00,
+/* C1 */ 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,
+/* C2 */ 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18,
+/* C3 */ 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
+/* C4 */ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
+/* C5 */ 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18,
+/* C6 */ 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18,
+/* C7 */ 0x66, 0x66, 0x66, 0x67, 0x66, 0x66, 0x66, 0x66,
+/* C8 */ 0x66, 0x66, 0x67, 0x60, 0x7f, 0x00, 0x00, 0x00,
+/* C9 */ 0x00, 0x00, 0x7f, 0x60, 0x67, 0x66, 0x66, 0x66,
+/* CA */ 0x66, 0x66, 0xe7, 0x00, 0xff, 0x00, 0x00, 0x00,
+/* CB */ 0x00, 0x00, 0xff, 0x00, 0xe7, 0x66, 0x66, 0x66,
+/* CC */ 0x66, 0x66, 0x67, 0x60, 0x67, 0x66, 0x66, 0x66,
+/* CD */ 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+/* CE */ 0x66, 0x66, 0xe7, 0x00, 0xe7, 0x66, 0x66, 0x66,
+/* CF */ 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
+/* D0 */ 0x66, 0x66, 0x66, 0xff, 0x00, 0x00, 0x00, 0x00,
+/* D1 */ 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18,
+/* D2 */ 0x00, 0x00, 0x00, 0xff, 0x66, 0x66, 0x66, 0x66,
+/* D3 */ 0x66, 0x66, 0x66, 0x7f, 0x00, 0x00, 0x00, 0x00,
+/* D4 */ 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00,
+/* D5 */ 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18,
+/* D6 */ 0x00, 0x00, 0x00, 0x7f, 0x66, 0x66, 0x66, 0x66,
+/* D7 */ 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0x66, 0x66,
+/* D8 */ 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18,
+/* D9 */ 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,
+/* DA */ 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18,
+/* DB */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+/* DC */ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+/* DD */ 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
+/* DE */ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+/* DF */ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+/* E0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E2 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E3 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E4 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E5 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E6 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E8 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* E9 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* EA */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* EB */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* EC */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* ED */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* EE */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* EF */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F2 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F3 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F4 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F5 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F6 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F8 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* F9 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* FA */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* FB */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* FC */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* FD */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* FE */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* FF */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
diff --git a/thk04/font_pearl_8x8.h b/thk04/font_pearl_8x8.h
new file mode 100644
index 0000000..cfe2b51
--- /dev/null
+++ b/thk04/font_pearl_8x8.h
@@ -0,0 +1,2578 @@
+/**********************************************/
+/* */
+/* Font file generated by cpi2fnt */
+/* ------------------------------ */
+/* Combined with the alpha-numeric */
+/* portion of Greg Harp's old PEARL */
+/* font (from earlier versions of */
+/* linux-m86k) by John Shifflett */
+/* */
+/**********************************************/
+
+#define CHAR_HEIGHT 8
+#define CHAR_WIDTH 8
+#define CHAR_START 1
+
+static unsigned char fontdata[] = {
+
+ /* 0 0x00 '^@' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 1 0x01 '^A' */
+ 0x7e, /* 01111110 */
+ 0x81, /* 10000001 */
+ 0xa5, /* 10100101 */
+ 0x81, /* 10000001 */
+ 0xbd, /* 10111101 */
+ 0x99, /* 10011001 */
+ 0x81, /* 10000001 */
+ 0x7e, /* 01111110 */
+
+ /* 2 0x02 '^B' */
+ 0x7e, /* 01111110 */
+ 0xff, /* 11111111 */
+ 0xdb, /* 11011011 */
+ 0xff, /* 11111111 */
+ 0xc3, /* 11000011 */
+ 0xe7, /* 11100111 */
+ 0xff, /* 11111111 */
+ 0x7e, /* 01111110 */
+
+ /* 3 0x03 '^C' */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0x10, /* 00010000 */
+ 0x00, /* 00000000 */
+
+ /* 4 0x04 '^D' */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0x10, /* 00010000 */
+ 0x00, /* 00000000 */
+
+ /* 5 0x05 '^E' */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+
+ /* 6 0x06 '^F' */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+
+ /* 7 0x07 '^G' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 8 0x08 '^H' */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xe7, /* 11100111 */
+ 0xc3, /* 11000011 */
+ 0xc3, /* 11000011 */
+ 0xe7, /* 11100111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /* 9 0x09 '^I' */
+ 0x00, /* 00000000 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x42, /* 01000010 */
+ 0x42, /* 01000010 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /* 10 0x0a '^J' */
+ 0xff, /* 11111111 */
+ 0xc3, /* 11000011 */
+ 0x99, /* 10011001 */
+ 0xbd, /* 10111101 */
+ 0xbd, /* 10111101 */
+ 0x99, /* 10011001 */
+ 0xc3, /* 11000011 */
+ 0xff, /* 11111111 */
+
+ /* 11 0x0b '^K' */
+ 0x0f, /* 00001111 */
+ 0x07, /* 00000111 */
+ 0x0f, /* 00001111 */
+ 0x7d, /* 01111101 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x78, /* 01111000 */
+
+ /* 12 0x0c '^L' */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+
+ /* 13 0x0d '^M' */
+ 0x3f, /* 00111111 */
+ 0x33, /* 00110011 */
+ 0x3f, /* 00111111 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x70, /* 01110000 */
+ 0xf0, /* 11110000 */
+ 0xe0, /* 11100000 */
+
+ /* 14 0x0e '^N' */
+ 0x7f, /* 01111111 */
+ 0x63, /* 01100011 */
+ 0x7f, /* 01111111 */
+ 0x63, /* 01100011 */
+ 0x63, /* 01100011 */
+ 0x67, /* 01100111 */
+ 0xe6, /* 11100110 */
+ 0xc0, /* 11000000 */
+
+ /* 15 0x0f '^O' */
+ 0x18, /* 00011000 */
+ 0xdb, /* 11011011 */
+ 0x3c, /* 00111100 */
+ 0xe7, /* 11100111 */
+ 0xe7, /* 11100111 */
+ 0x3c, /* 00111100 */
+ 0xdb, /* 11011011 */
+ 0x18, /* 00011000 */
+
+ /* 16 0x10 '^P' */
+ 0x80, /* 10000000 */
+ 0xe0, /* 11100000 */
+ 0xf8, /* 11111000 */
+ 0xfe, /* 11111110 */
+ 0xf8, /* 11111000 */
+ 0xe0, /* 11100000 */
+ 0x80, /* 10000000 */
+ 0x00, /* 00000000 */
+
+ /* 17 0x11 '^Q' */
+ 0x02, /* 00000010 */
+ 0x0e, /* 00001110 */
+ 0x3e, /* 00111110 */
+ 0xfe, /* 11111110 */
+ 0x3e, /* 00111110 */
+ 0x0e, /* 00001110 */
+ 0x02, /* 00000010 */
+ 0x00, /* 00000000 */
+
+ /* 18 0x12 '^R' */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+
+ /* 19 0x13 '^S' */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+
+ /* 20 0x14 '^T' */
+ 0x7f, /* 01111111 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7b, /* 01111011 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x00, /* 00000000 */
+
+ /* 21 0x15 '^U' */
+ 0x3e, /* 00111110 */
+ 0x61, /* 01100001 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x86, /* 10000110 */
+ 0x7c, /* 01111100 */
+
+ /* 22 0x16 '^V' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x7e, /* 01111110 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /* 23 0x17 '^W' */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+
+ /* 24 0x18 '^X' */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 25 0x19 '^Y' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 26 0x1a '^Z' */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0xfe, /* 11111110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 27 0x1b '^[' */
+ 0x00, /* 00000000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xfe, /* 11111110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 28 0x1c '^\' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 29 0x1d '^]' */
+ 0x00, /* 00000000 */
+ 0x24, /* 00100100 */
+ 0x66, /* 01100110 */
+ 0xff, /* 11111111 */
+ 0x66, /* 01100110 */
+ 0x24, /* 00100100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 30 0x1e '^^' */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 31 0x1f '^_' */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 32 0x20 ' ' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 33 0x21 '!' */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 34 0x22 '"' */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 35 0x23 '#' */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /* 36 0x24 '$' */
+ 0x18, /* 00011000 */
+ 0x3e, /* 00111110 */
+ 0x60, /* 01100000 */
+ 0x3c, /* 00111100 */
+ 0x06, /* 00000110 */
+ 0x7c, /* 01111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 37 0x25 '%' */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xcc, /* 11001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x66, /* 01100110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 38 0x26 '&' */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x68, /* 01101000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 39 0x27 ''' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 40 0x28 '(' */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+
+ /* 41 0x29 ')' */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+
+ /* 42 0x2a '*' */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0xff, /* 11111111 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 43 0x2b '+' */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 44 0x2c ',' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+
+ /* 45 0x2d '-' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 46 0x2e '.' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 47 0x2f '/' */
+ 0x03, /* 00000011 */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+
+ /* 48 0x30 '0' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xde, /* 11011110 */
+ 0xfe, /* 11111110 */
+ 0xf6, /* 11110110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 49 0x31 '1' */
+ 0x18, /* 00011000 */
+ 0x78, /* 01111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 50 0x32 '2' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /* 51 0x33 '3' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x06, /* 00000110 */
+ 0x1c, /* 00011100 */
+ 0x06, /* 00000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 52 0x34 '4' */
+ 0x1c, /* 00011100 */
+ 0x3c, /* 00111100 */
+ 0x6c, /* 01101100 */
+ 0xcc, /* 11001100 */
+ 0xfe, /* 11111110 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+
+ /* 53 0x35 '5' */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xfc, /* 11111100 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 54 0x36 '6' */
+ 0x38, /* 00111000 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 55 0x37 '7' */
+ 0xfe, /* 11111110 */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0x00, /* 00000000 */
+
+ /* 56 0x38 '8' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 57 0x39 '9' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /* 58 0x3a ':' */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 59 0x3b ';' */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+
+ /* 60 0x3c '<' */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+
+ /* 61 0x3d '=' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 62 0x3e '>' */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+
+ /* 63 0x3f '?' */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 64 0x40 '@' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xde, /* 11011110 */
+ 0xde, /* 11011110 */
+ 0xde, /* 11011110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 65 0x41 'A' */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 66 0x42 'B' */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /* 67 0x43 'C' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 68 0x44 'D' */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /* 69 0x45 'E' */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xf8, /* 11111000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /* 70 0x46 'F' */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xf8, /* 11111000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+
+ /* 71 0x47 'G' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xce, /* 11001110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 72 0x48 'H' */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 73 0x49 'I' */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /* 74 0x4a 'J' */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 75 0x4b 'K' */
+ 0xc6, /* 11000110 */
+ 0xcc, /* 11001100 */
+ 0xd8, /* 11011000 */
+ 0xf0, /* 11110000 */
+ 0xd8, /* 11011000 */
+ 0xcc, /* 11001100 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 76 0x4c 'L' */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /* 77 0x4d 'M' */
+ 0x82, /* 10000010 */
+ 0xc6, /* 11000110 */
+ 0xee, /* 11101110 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 78 0x4e 'N' */
+ 0xc6, /* 11000110 */
+ 0xe6, /* 11100110 */
+ 0xf6, /* 11110110 */
+ 0xde, /* 11011110 */
+ 0xce, /* 11001110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 79 0x4f 'O' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 80 0x50 'P' */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfc, /* 11111100 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+
+ /* 81 0x51 'Q' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xf6, /* 11110110 */
+ 0xde, /* 11011110 */
+ 0x7c, /* 01111100 */
+ 0x06, /* 00000110 */
+
+ /* 82 0x52 'R' */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfc, /* 11111100 */
+ 0xd8, /* 11011000 */
+ 0xcc, /* 11001100 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 83 0x53 'S' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x60, /* 01100000 */
+ 0x38, /* 00111000 */
+ 0x0c, /* 00001100 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 84 0x54 'T' */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 85 0x55 'U' */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 86 0x56 'V' */
+ 0xc3, /* 11000011 */
+ 0xc3, /* 11000011 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 87 0x57 'W' */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xd6, /* 11010110 */
+ 0xfe, /* 11111110 */
+ 0xee, /* 11101110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 88 0x58 'X' */
+ 0xc3, /* 11000011 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0xc3, /* 11000011 */
+ 0x00, /* 00000000 */
+
+ /* 89 0x59 'Y' */
+ 0xc3, /* 11000011 */
+ 0xc3, /* 11000011 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 90 0x5a 'Z' */
+ 0xfe, /* 11111110 */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /* 91 0x5b '[' */
+ 0x3c, /* 00111100 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /* 92 0x5c '\' */
+ 0xc0, /* 11000000 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x06, /* 00000110 */
+ 0x03, /* 00000011 */
+ 0x00, /* 00000000 */
+
+ /* 93 0x5d ']' */
+ 0x3c, /* 00111100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /* 94 0x5e '^' */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 95 0x5f '_' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+
+ /* 96 0x60 '`' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 97 0x61 'a' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0x06, /* 00000110 */
+ 0x7e, /* 01111110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /* 98 0x62 'b' */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /* 99 0x63 'c' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 100 0x64 'd' */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x7e, /* 01111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /* 101 0x65 'e' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 102 0x66 'f' */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0x00, /* 00000000 */
+
+ /* 103 0x67 'g' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0x7c, /* 01111100 */
+
+ /* 104 0x68 'h' */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 105 0x69 'i' */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 106 0x6a 'j' */
+ 0x06, /* 00000110 */
+ 0x00, /* 00000000 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+
+ /* 107 0x6b 'k' */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xcc, /* 11001100 */
+ 0xd8, /* 11011000 */
+ 0xf0, /* 11110000 */
+ 0xd8, /* 11011000 */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+
+ /* 108 0x6c 'l' */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 109 0x6d 'm' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xec, /* 11101100 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 110 0x6e 'n' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 111 0x6f 'o' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 112 0x70 'p' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfc, /* 11111100 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+
+ /* 113 0x71 'q' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+
+ /* 114 0x72 'r' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0xe6, /* 11100110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+
+ /* 115 0x73 's' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x06, /* 00000110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /* 116 0x74 't' */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x7c, /* 01111100 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x36, /* 00110110 */
+ 0x1c, /* 00011100 */
+ 0x00, /* 00000000 */
+
+ /* 117 0x75 'u' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 118 0x76 'v' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /* 119 0x77 'w' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xd6, /* 11010110 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /* 120 0x78 'x' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 121 0x79 'y' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc3, /* 11000011 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+
+ /* 122 0x7a 'z' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x0c, /* 00001100 */
+ 0x38, /* 00111000 */
+ 0x60, /* 01100000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /* 123 0x7b '{' */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x70, /* 01110000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x0e, /* 00001110 */
+ 0x00, /* 00000000 */
+
+ /* 124 0x7c '|' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 125 0x7d '}' */
+ 0x70, /* 01110000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /* 126 0x7e '~' */
+ 0x72, /* 01110010 */
+ 0x9c, /* 10011100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 127 0x7f '' */
+ 0x00, /* 00000000 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /* 128 0x80 '' */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x0c, /* 00001100 */
+ 0x78, /* 01111000 */
+
+ /* 129 0x81 '' */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 130 0x82 '' */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 131 0x83 '' */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 132 0x84 '' */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 133 0x85 '' */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 134 0x86 '' */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 135 0x87 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x7e, /* 01111110 */
+ 0x0c, /* 00001100 */
+ 0x38, /* 00111000 */
+
+ /* 136 0x88 '' */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 137 0x89 '' */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 138 0x8a '' */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 139 0x8b '' */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /* 140 0x8c '' */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /* 141 0x8d '' */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /* 142 0x8e '' */
+ 0xc6, /* 11000110 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 143 0x8f '' */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 144 0x90 '' */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xf8, /* 11111000 */
+ 0xc0, /* 11000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /* 145 0x91 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0xd8, /* 11011000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /* 146 0x92 '' */
+ 0x3e, /* 00111110 */
+ 0x6c, /* 01101100 */
+ 0xcc, /* 11001100 */
+ 0xfe, /* 11111110 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xce, /* 11001110 */
+ 0x00, /* 00000000 */
+
+ /* 147 0x93 '' */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 148 0x94 '' */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 149 0x95 '' */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 150 0x96 '' */
+ 0x78, /* 01111000 */
+ 0x84, /* 10000100 */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 151 0x97 '' */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 152 0x98 '' */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0xfc, /* 11111100 */
+
+ /* 153 0x99 '' */
+ 0xc6, /* 11000110 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /* 154 0x9a '' */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 155 0x9b '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 156 0x9c '' */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x64, /* 01100100 */
+ 0xf0, /* 11110000 */
+ 0x60, /* 01100000 */
+ 0x66, /* 01100110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /* 157 0x9d '' */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 158 0x9e '' */
+ 0xf8, /* 11111000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xfa, /* 11111010 */
+ 0xc6, /* 11000110 */
+ 0xcf, /* 11001111 */
+ 0xc6, /* 11000110 */
+ 0xc7, /* 11000111 */
+
+ /* 159 0x9f '' */
+ 0x0e, /* 00001110 */
+ 0x1b, /* 00011011 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /* 160 0xa0 '' */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 161 0xa1 '' */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /* 162 0xa2 '' */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /* 163 0xa3 '' */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 164 0xa4 '' */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+
+ /* 165 0xa5 '' */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0xe6, /* 11100110 */
+ 0xf6, /* 11110110 */
+ 0xde, /* 11011110 */
+ 0xce, /* 11001110 */
+ 0x00, /* 00000000 */
+
+ /* 166 0xa6 '' */
+ 0x3c, /* 00111100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x3e, /* 00111110 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 167 0xa7 '' */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 168 0xa8 '' */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x63, /* 01100011 */
+ 0x3e, /* 00111110 */
+ 0x00, /* 00000000 */
+
+ /* 169 0xa9 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 170 0xaa '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 171 0xab '' */
+ 0x63, /* 01100011 */
+ 0xe6, /* 11100110 */
+ 0x6c, /* 01101100 */
+ 0x7e, /* 01111110 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x0f, /* 00001111 */
+
+ /* 172 0xac '' */
+ 0x63, /* 01100011 */
+ 0xe6, /* 11100110 */
+ 0x6c, /* 01101100 */
+ 0x7a, /* 01111010 */
+ 0x36, /* 00110110 */
+ 0x6a, /* 01101010 */
+ 0xdf, /* 11011111 */
+ 0x06, /* 00000110 */
+
+ /* 173 0xad '' */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 174 0xae '' */
+ 0x00, /* 00000000 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x66, /* 01100110 */
+ 0x33, /* 00110011 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 175 0xaf '' */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0x66, /* 01100110 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 176 0xb0 '' */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+
+ /* 177 0xb1 '' */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+
+ /* 178 0xb2 '' */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+
+ /* 179 0xb3 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 180 0xb4 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 181 0xb5 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 182 0xb6 '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 183 0xb7 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 184 0xb8 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 185 0xb9 '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x06, /* 00000110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 186 0xba '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 187 0xbb '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x06, /* 00000110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 188 0xbc '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x06, /* 00000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 189 0xbd '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 190 0xbe '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 191 0xbf '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 192 0xc0 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 193 0xc1 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 194 0xc2 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 195 0xc3 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 196 0xc4 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 197 0xc5 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 198 0xc6 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 199 0xc7 '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 200 0xc8 '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x30, /* 00110000 */
+ 0x3f, /* 00111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 201 0xc9 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3f, /* 00111111 */
+ 0x30, /* 00110000 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 202 0xca '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf7, /* 11110111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 203 0xcb '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xf7, /* 11110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 204 0xcc '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x30, /* 00110000 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 205 0xcd '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 206 0xce '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf7, /* 11110111 */
+ 0x00, /* 00000000 */
+ 0xf7, /* 11110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 207 0xcf '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 208 0xd0 '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 209 0xd1 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 210 0xd2 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 211 0xd3 '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x3f, /* 00111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 212 0xd4 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 213 0xd5 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 214 0xd6 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3f, /* 00111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 215 0xd7 '' */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xff, /* 11111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /* 216 0xd8 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 217 0xd9 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 218 0xda '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 219 0xdb '' */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /* 220 0xdc '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /* 221 0xdd '' */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+
+ /* 222 0xde '' */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+
+ /* 223 0xdf '' */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 224 0xe0 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0xc8, /* 11001000 */
+ 0xdc, /* 11011100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /* 225 0xe1 '' */
+ 0x78, /* 01111000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xd8, /* 11011000 */
+ 0xcc, /* 11001100 */
+ 0xc6, /* 11000110 */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+
+ /* 226 0xe2 '' */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+
+ /* 227 0xe3 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /* 228 0xe4 '' */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /* 229 0xe5 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /* 230 0xe6 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0xc0, /* 11000000 */
+
+ /* 231 0xe7 '' */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /* 232 0xe8 '' */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+
+ /* 233 0xe9 '' */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /* 234 0xea '' */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0xee, /* 11101110 */
+ 0x00, /* 00000000 */
+
+ /* 235 0xeb '' */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x3e, /* 00111110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /* 236 0xec '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 237 0xed '' */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x7e, /* 01111110 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7e, /* 01111110 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+
+ /* 238 0xee '' */
+ 0x1e, /* 00011110 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0x7e, /* 01111110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x1e, /* 00011110 */
+ 0x00, /* 00000000 */
+
+ /* 239 0xef '' */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /* 240 0xf0 '' */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 241 0xf1 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /* 242 0xf2 '' */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /* 243 0xf3 '' */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /* 244 0xf4 '' */
+ 0x0e, /* 00001110 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /* 245 0xf5 '' */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+
+ /* 246 0xf6 '' */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 247 0xf7 '' */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 248 0xf8 '' */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 249 0xf9 '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 250 0xfa '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 251 0xfb '' */
+ 0x0f, /* 00001111 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0xec, /* 11101100 */
+ 0x6c, /* 01101100 */
+ 0x3c, /* 00111100 */
+ 0x1c, /* 00011100 */
+
+ /* 252 0xfc '' */
+ 0x6c, /* 01101100 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 253 0xfd '' */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 254 0xfe '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /* 255 0xff '' */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+};
diff --git a/thk04/freej.h b/thk04/freej.h
new file mode 100644
index 0000000..7509e4a
--- /dev/null
+++ b/thk04/freej.h
@@ -0,0 +1,46 @@
+/* FreeJ
+ * (c) Copyright 2001-2004 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/**
+ @file freej.h
+ @brief FreeJ public header
+*/
+
+#ifndef __FREEJ_H__
+#define __FREEJ_H__
+
+#include <inttypes.h>
+
+/**
+ This data structure is made to hold informations about the geometry
+ of Layers in FreeJ, describing their format and image bounds.
+
+ @brief geometrical specifications of layers
+*/
+typedef struct {
+ int16_t x; ///< x axis position coordinate
+ int16_t y; ///< y axis position coordinate
+ uint16_t w; ///< width of frame in pixels
+ uint16_t h; ///< height of frame in pixels
+ uint8_t bpp; ///< bits per pixel
+ uint16_t pitch; ///< width of frame in bytes
+ uint32_t size; ///< size of the whole frame in bytes
+ float fps; ///< frames per second
+} ScreenGeometry;
+
+#endif
diff --git a/thk04/freej_plugin.h b/thk04/freej_plugin.h
new file mode 100644
index 0000000..be5cb55
--- /dev/null
+++ b/thk04/freej_plugin.h
@@ -0,0 +1,29 @@
+#ifndef __freej_plugin_h__
+#define __freej_plugin_h__
+
+static char *name;
+static char *author;
+static char *info;
+static int version;
+
+char *getname() { return name; };
+char *getauthor() { return author; };
+char *getinfo() { return info; };
+int getversion() { return version; };
+
+/* INTERNAL =================================================
+ this counts how many times a plugin is instantiated
+ it is handled into the Plugin:: open() and close() methods */
+int dlcount = 0;
+
+/* here we hardcode maximum instances permitted by every plugin */
+int maxinstances = 1;
+
+int dlinc() {
+ if(dlcount<maxinstances) {
+ dlcount++; return(dlcount);
+ } else return(-1); };
+int dldec() { dlcount--; return(dlcount); };
+/* ========================================================== */
+
+#endif
diff --git a/thk04/gen_layer.cpp b/thk04/gen_layer.cpp
new file mode 100644
index 0000000..c762f32
--- /dev/null
+++ b/thk04/gen_layer.cpp
@@ -0,0 +1,324 @@
+/* FreeJ
+ * Particle generator layer
+ * (c) Copyright 2004 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * blossom original algo is (c) 2003 by ragnar (waves 1.2)
+ * http://home.uninet.ee/~ragnar/waves
+ * further optimizations and changes followed
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: gen_layer.cpp,v 1.2 2004/05/02 10:43:03 jaromil Exp $"
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <gen_layer.h>
+#include <jutils.h>
+#include <context.h>
+#include <config.h>
+
+/* defines for blob size and roundness */
+#define LIM 8 // 25
+#define NB_BLOB 16 // 25
+
+
+GenLayer::GenLayer()
+ :Layer() {
+
+ /* initialize prime numbers */
+ prime[0] = 2;
+ prime[1] = 3;
+ prime[2] = 5;
+ prime[3] = 7;
+ prime[4] = 11;
+ prime[5] = 13;
+ prime[6] = 17;
+ prime[7] = 19;
+ prime[8] = 23;
+ prime[9] = 29;
+ prime[10] = 31;
+
+ /* blossom vars */
+ blossom_count = 0;
+ blossom_m = 0;
+ blossom_n = 0;
+ blossom_i = 0;
+ blossom_j = 0;
+ blossom_k = 0;
+ blossom_l = 0;
+ blossom_r = 0.7;
+ blossom_a = 0;
+
+ /* initialize color masks */
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ rmask = 0xff000000;
+ gmask = 0x00ff0000;
+ bmask = 0x0000ff00;
+ amask = 0x00000000;
+#else
+ rmask = 0x000000ff;
+ gmask = 0x0000ff00;
+ bmask = 0x00ff0000;
+ amask = 0x00000000;
+#endif
+
+ surf = NULL;
+ blob_buf = NULL;
+
+ pi2 = 2.0*M_PI;
+
+ setname("GEO");
+}
+
+GenLayer::~GenLayer() {
+ close();
+}
+
+bool GenLayer::open(char *file) {
+ /* we don't need this */
+ return true;
+}
+
+void GenLayer::close() {
+ if(surf) SDL_FreeSurface(surf);
+ if(blob_buf) free(blob_buf);
+ return;
+}
+
+bool GenLayer::init(Context *scr) {
+
+ close(); // reentrancy
+
+ /* allocate the buffer on which the layer will write */
+
+ fastsrand( time(NULL) );
+
+ /* internal initalization */
+ _init(scr,scr->screen->w,scr->screen->h,32);
+
+ surf = SDL_CreateRGBSurface
+ (SDL_HWSURFACE|SDL_HWACCEL,geo.w,geo.h,32,bmask,gmask,rmask,amask);
+ if(!surf) {
+ error("can't create GenLayer surface: %s",SDL_GetError());
+ return(false);
+ }
+
+ pixels = (uint32_t*)surf->pixels;
+
+ blossom_recal(true);
+
+ /* blob initialization */
+ blob_buf = NULL;
+
+ blob_init(8);
+
+ return(true);
+}
+
+void *GenLayer::feed() {
+ /* automatic random recalculation:
+ if( !blossom_count ) {
+ recalculate();
+ blossom_count = 100+(50.0)*rand()/RAND_MAX;
+ } else {
+ blossom_count--;
+ */
+ blossom_a += 0.01;
+ if( blossom_a > pi2 )
+ blossom_a -= pi2;
+
+
+ SDL_FillRect(surf,NULL,0x0);
+
+ if (SDL_MUSTLOCK(surf))
+ if (SDL_LockSurface(surf) < 0) {
+ error("%s", SDL_GetError());
+ return NULL;
+ }
+
+ blossom();
+ return(surf->pixels);
+
+ if (SDL_MUSTLOCK(surf)) {
+ SDL_UnlockSurface(surf);
+ }
+
+}
+
+void GenLayer::blossom_recal(bool r) {
+ lock_feed();
+ float z = ((PRIMES-2)*fastrand()/RAND_MAX)+1;
+ blossom_m = 1.0+(30.0)*fastrand()/RAND_MAX;
+ blossom_n = 1.0+(30.0)*fastrand()/RAND_MAX;
+ blossom_i = prime[ (int) (z*fastrand()/RAND_MAX) ];
+ blossom_j = prime[ (int) (z*fastrand()/RAND_MAX) ];
+ blossom_k = prime[ (int) (z*fastrand()/RAND_MAX) ];
+ blossom_l = prime[ (int) (z*fastrand()/RAND_MAX) ];
+ wd = (double)geo.w;
+ hd = (double)geo.h;
+ if(r)
+ blossom_r = (blossom_r>=1.0)?1.0:blossom_r+0.1;
+ else
+ blossom_r = (blossom_r<=0.1)?0.1:blossom_r-0.1;
+ unlock_feed();
+}
+
+void GenLayer::blossom() {
+
+ float a;
+ int x, y;
+ double zx, zy;
+
+ /* here place a formula that draws on the screen
+ the surface being drawed at this point is always blank */
+ for( a=0.0 ; a<pi2; a+=0.006 ) {
+ zx = blossom_m*a;
+ zy = blossom_n*a;
+ x = (int)(wd*(0.47+ (blossom_r*sin(blossom_i*zx+blossom_a)+
+ (1.0-blossom_r)*sin(blossom_k*zy+blossom_a)) /2.2 ));
+
+ y = (int)(hd*(0.47+ (blossom_r*cos(blossom_j*zx+blossom_a)+
+ (1.0-blossom_r)*cos(blossom_l*zy+blossom_a)) /2.2 ));
+
+ //point(x,y);
+ blob(x,y);
+
+ }
+
+}
+
+void GenLayer::point(int x, int y) {
+
+ pixels[ (y*geo.w)+x ] += 0x99999999;
+
+}
+
+
+void GenLayer::blob_init(int ray) {
+ uint8_t col;
+
+ blob_size = ray*2;
+
+ /* @TODO
+ there should be a gradient sphere here
+ Niels helps me with this: calculating a circle
+ while(theta <= 360) {
+ double radians = (theta / 180.0) * PI;
+ double dx = ( origin[0] + cos( radians ) * radius );
+ double dy = ( origin[1] + sin( radians ) * radius );
+ */
+ uint32_t dx,dy;
+ double rad, th;
+ int c;
+ srand(time(NULL));
+ if(blob_buf) free(blob_buf);
+ blob_buf = (uint32_t*) calloc(ray*2*ray*2,sizeof(uint32_t));
+
+ for(th=1;th<=360;th++) {
+ rad = (th / 180.0) * M_PI;
+ for(c=ray;c>0;c--) {
+ dx = (uint32_t)( (ray) + cos( rad ) * c );
+ dy = (uint32_t)( (ray) + sin( rad ) * c );
+ col = (uint8_t)( 0x99/c * 0.8);
+ blob_buf[ (dx+((ray*2)*dy)) ] =
+ SDL_MapRGB(surf->format,col,col,col*1.3);
+ }
+ }
+
+}
+
+void GenLayer::blob(int x, int y) {
+ // if(y>geo.h-blob_size) return;
+ // if(x>geo.w-blob_size) return;
+
+ int i, j;
+ int stride = (geo.w-blob_size)>>1;
+
+ uint64_t *tmp_scr = (uint64_t*)pixels + ((x + y*geo.w)>>1);
+ uint64_t *tmp_blob = (uint64_t*)blob_buf;
+
+#ifdef HAVE_MMX
+
+ /* using mmx packed unsaturated addition on bytes
+ for cleaner and shiny result */
+ for(j=blob_size; j>0; j--) {
+ for(i=blob_size>>4; i>0; i--) {
+
+ asm volatile("movq (%1),%%mm0;"
+ "movq 8(%1),%%mm1;"
+ "movq 16(%1),%%mm2;"
+ "movq 24(%1),%%mm3;"
+ "movq 32(%1),%%mm4;"
+ "movq 40(%1),%%mm5;"
+ "movq 48(%1),%%mm6;"
+ "movq 56(%1),%%mm7;"
+ "paddusb (%0),%%mm0;" //addizione perfetta senza clipping
+ "paddusb 8(%0),%%mm1;" //addizione perfetta senza clipping
+ "paddusb 16(%0),%%mm2;" //addizione perfetta senza clipping
+ "paddusb 24(%0),%%mm3;" //addizione perfetta senza clipping
+ "paddusb 32(%0),%%mm4;" //addizione perfetta senza clipping
+ "paddusb 40(%0),%%mm5;" //addizione perfetta senza clipping
+ "paddusb 48(%0),%%mm6;" //addizione perfetta senza clipping
+ "paddusb 56(%0),%%mm7;" //addizione perfetta senza clipping
+ "movq %%mm0,(%0);"
+ "movq %%mm1,8(%0);"
+ "movq %%mm2,16(%0);"
+ "movq %%mm3,24(%0);"
+ "movq %%mm4,32(%0);"
+ "movq %%mm5,40(%0);"
+ "movq %%mm6,48(%0);"
+ "movq %%mm7,56(%0);"
+ // "paddsw %0, %%mm0;"// halo violetto
+ :
+ :"r"(tmp_scr),"r"(tmp_blob)
+ :"memory");
+ tmp_scr+=8;
+ tmp_blob+=8;
+ }
+ tmp_scr += stride;
+ }
+ asm("emms;");
+#else
+ for(j=blob_size; j>0; j--) {
+ for(i=blob_size>>1; i>0; i--) {
+ *(tmp_scr++) += *(tmp_blob++);
+ }
+ tmp_scr += stride;
+ }
+#endif
+
+}
+
+bool GenLayer::keypress(SDL_keysym *keysym) {
+ switch(keysym->sym) {
+
+ case SDLK_RIGHT:
+ blossom_recal(true);
+ break;
+
+ case SDLK_LEFT:
+ blossom_recal(false);
+ break;
+
+ default: return(false);
+
+ }
+
+ return(true);
+}
+
diff --git a/thk04/gen_layer.h b/thk04/gen_layer.h
new file mode 100644
index 0000000..8a0eaeb
--- /dev/null
+++ b/thk04/gen_layer.h
@@ -0,0 +1,79 @@
+/* FreeJ
+ * (c) Copyright 2004 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: gen_layer.h,v 1.2 2004/05/02 10:43:04 jaromil Exp $"
+ *
+ */
+
+#ifndef __GEN_LAYER_H__
+#define __GEN_LAYER_H__
+
+#include <SDL/SDL.h>
+#include <layer.h>
+
+#define PRIMES 11
+
+class GenLayer: public Layer {
+ private:
+
+ /* blossom vars */
+ double blossom_count;
+ double blossom_m;
+ double blossom_n;
+ double blossom_i;
+ double blossom_j;
+ double blossom_k;
+ double blossom_l;
+ float blossom_r;
+ float blossom_a;
+
+ /* primes */
+ int prime[PRIMES];
+
+ float pi2;
+ double wd, hd;
+
+ /* surface buffer */
+ uint32_t rmask,gmask,bmask,amask;
+ SDL_Surface *surf;
+ uint32_t *pixels;
+
+ /* pixel drawing */
+ void point(int x, int y);
+
+ /* blob drawing */
+ void blob_init(int ray);
+ void blob(int x, int y);
+ uint32_t *blob_buf;
+ int blob_size;
+
+ public:
+ GenLayer();
+ ~GenLayer();
+
+ bool init(Context *screen);
+ bool open(char *file);
+ void *feed();
+ bool keypress(SDL_keysym *keysym);
+ void close();
+
+ void blossom_recal(bool r);
+ void blossom();
+
+};
+
+#endif
diff --git a/thk04/impl_layers.cpp b/thk04/impl_layers.cpp
new file mode 100644
index 0000000..6f88d61
--- /dev/null
+++ b/thk04/impl_layers.cpp
@@ -0,0 +1,204 @@
+/* FreeJ
+ * (c) Copyright 2001-2003 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: impl_layers.cpp,v 1.11 2004/03/22 18:37:48 jaromil Exp $"
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <layer.h>
+#include <jutils.h>
+#include <config.h>
+
+/* software layers which don't need special loaders */
+#include <gen_layer.h>
+
+#ifdef WITH_V4L
+#include <v4l_layer.h>
+#endif
+
+#ifdef WITH_AVIFILE
+#include <avi_layer.h>
+#endif
+
+#ifdef WITH_AVCODEC
+#include <video_layer.h>
+#endif
+
+#ifdef WITH_PNG
+#include <png_layer.h>
+#endif
+
+#ifdef WITH_FT2
+#include <txt_layer.h>
+#endif
+
+#ifdef WITH_XHACKS
+#include <xhacks_layer.h>
+#endif
+
+const char *layers_description =
+#ifdef WITH_V4L
+" . - Video4Linux devices as of BTTV cards and webcams\n"
+" . you can specify the size /dev/video0%160x120\n"
+#endif
+#ifdef WITH_AVIFILE
+" . - AVI,ASF,WMA,WMV movies as of codecs supported by avifile lib\n"
+#endif
+#ifdef WITH_AVCODEC
+" . - AVI,ASF,WMA,WMV,MPEG local and remote (http://localhost/file.mpg), dv1394 firewire devices\n"
+#endif
+#ifdef WITH_PNG
+" . - PNG images (also with transparency)\n"
+#endif
+#ifdef WITH_FT2
+" . - TXT files rendered with freetype2 library\n"
+#endif
+#ifdef WITH_XHACKS
+" . - xscreensaver screen hack. ex. /usr/X11R6/lib/xscreensaver/cynosure\n"
+#endif
+" . - particle generator ( add layer_gen on commandline)\n"
+"\n";
+
+
+Layer *create_layer(char *file) {
+ char *p,*pp;
+ FILE *tmp;
+ Layer *nlayer = NULL;
+
+ /* check that file exists */
+ if(strncasecmp(file,"/dev/",5)!=0
+ && strncasecmp(file,"http://",7)!=0
+ && strncasecmp(file,"layer_",6)!=0) {
+ tmp = fopen(file,"r");
+ if(!tmp) {
+ error("can't open %s to create a Layer: %s",
+ file,strerror(errno));
+ return NULL;
+ } else fclose(tmp);
+ }
+ /* check file type, add here new layer types */
+ p = pp = file;
+ p += strlen(file);
+// while(*p!='\0' && *p!='\n') p++; *p='\0';
+
+
+ /* ==== Video4Linux */
+ if(strncasecmp(pp,"/dev/",5)==0 && strncasecmp((pp+5),"ieee1394/",9)!=0) {
+#ifdef WITH_V4L
+ unsigned int w=320, h=240;
+ while(p!=pp) {
+ if(*p!='%') p--;
+ else { /* size is specified */
+ *p='\0'; p++;
+ sscanf(p,"%ux%u",&w,&h);
+ p = pp; }
+ }
+ nlayer = new V4lGrabber();
+ if(nlayer->open(pp)) {
+ ((V4lGrabber*)nlayer)->init_width = w;
+ ((V4lGrabber*)nlayer)->init_heigth = h;
+ } else {
+ error("create_layer : V4L open failed");
+ delete nlayer; nlayer = NULL;
+ }
+#else
+ error("Video4Linux layer support not compiled");
+ act("can't load %s",pp);
+#endif
+
+ } else /* AVI LAYER */
+ if( strncasecmp((p-4),".avi",4)==0
+ | strncasecmp((p-4),".asf",4)==0
+ | strncasecmp((p-4),".asx",4)==0
+ | strncasecmp((p-4),".wma",4)==0
+ | strncasecmp((p-4),".wmv",4)==0
+ | strncasecmp((p-4),".mov",4)==0
+ | strncasecmp((p-5),".mpeg",5)==0
+ | strncasecmp((p-4),".mpg",4)==0
+ | strncasecmp(pp,"/dev/ieee1394/",14)==0) {
+#ifdef WITH_AVCODEC
+ nlayer = new VideoLayer();
+ if(!nlayer->open(pp)) {
+ error("create_layer : VIDEO open failed");
+ delete nlayer; nlayer = NULL;
+ }
+#elif WITH_AVIFILE
+ if( strncasecmp(pp,"/dev/ieee1394/",14)==0)
+ nlayer=NULL;
+ nlayer = new AviLayer();
+ if(!nlayer->open(pp)) {
+ error("create_layer : AVI open failed");
+ delete nlayer; nlayer = NULL;
+ }
+#else
+ error("VIDEO and AVI layer support not compiled");
+ act("can't load %s",pp);
+#endif
+ } else /* PNG LAYER */
+ if(strncasecmp((p-4),".png",4)==0) {
+#ifdef WITH_PNG
+ nlayer = new PngLayer();
+ if(!nlayer->open(pp)) {
+ error("create_layer : PNG open failed");
+ delete nlayer; nlayer = NULL;
+ }
+#else
+ error("PNG layer support not compiled");
+ act("can't load %s",pp);
+#endif
+
+ } else /* TXT LAYER */
+ if(strncasecmp((p-4),".txt",4)==0) {
+#ifdef WITH_FT2
+ nlayer = new TxtLayer();
+ if(!nlayer->open(pp)) {
+ error("create_layer : TXT open failed");
+ delete nlayer; nlayer = NULL;
+ }
+#else
+ error("TXT layer support not compiled");
+ act("can't load %s",pp);
+ return(NULL);
+#endif
+ } else
+ if(strstr(pp,"xscreensaver")) { /* XHACKS_LAYER */
+#ifdef WITH_XHACKS
+ nlayer = new XHacksLayer();
+ if (!nlayer->open(pp)) {
+ error("create_layer : XHACK open failed");
+ delete nlayer; nlayer = NULL;
+ }
+#else
+ error("no xhacks layer support");
+ act("can't load %s",pp);
+ return(NULL);
+#endif
+ } else
+ if(strncasecmp(pp,"layer_gen",9)==0) {
+ nlayer = new GenLayer();
+ }
+
+ if(!nlayer)
+ error("can't create a layer with %s",file);
+ else
+ func("create_layer succesful, returns %p",nlayer);
+ return nlayer;
+}
diff --git a/thk04/jsync.cpp b/thk04/jsync.cpp
new file mode 100644
index 0000000..4c25fd4
--- /dev/null
+++ b/thk04/jsync.cpp
@@ -0,0 +1,63 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <jsync.h>
+#include <jutils.h>
+#include <config.h>
+
+typedef void* (kickoff)(void*);
+
+JSyncThread::JSyncThread() {
+
+ if(pthread_mutex_init (&_mutex,NULL) == -1)
+ error("error initializing POSIX thread mutex");
+ if(pthread_cond_init (&_cond, NULL) == -1)
+ error("error initializing POSIX thread condtition");
+ if(pthread_attr_init (&_attr) == -1)
+ error("error initializing POSIX thread attribute");
+
+ if(pthread_mutex_init (&_mutex_feed,NULL) == -1)
+ error("error initializing POSIX thread feed mutex");
+ if(pthread_cond_init (&_cond_feed, NULL) == -1)
+ error("error initializing POSIX thread feed condtition");
+
+ /* sets the thread as detached
+ see: man pthread_attr_init(3) */
+ pthread_attr_setdetachstate(&_attr,PTHREAD_CREATE_DETACHED);
+
+}
+
+JSyncThread::~JSyncThread() {
+
+ if(pthread_mutex_destroy(&_mutex) == -1)
+ error("error destroying POSIX thread mutex");
+ if(pthread_cond_destroy(&_cond) == -1)
+ error("error destroying POSIX thread condition");
+ if(pthread_attr_destroy(&_attr) == -1)
+ error("error destroying POSIX thread attribute");
+
+ if(pthread_mutex_destroy(&_mutex_feed) == -1)
+ error("error destroying POSIX thread feed mutex");
+ if(pthread_cond_destroy(&_cond_feed) == -1)
+ error("error destroying POSIX thread feed attribute");
+
+}
+
+void JSyncThread::start() {
+ pthread_create(&_thread, &_attr, &kickoff, this);
+}
diff --git a/thk04/jsync.h b/thk04/jsync.h
new file mode 100644
index 0000000..c9c021d
--- /dev/null
+++ b/thk04/jsync.h
@@ -0,0 +1,64 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __JSYNC_H__
+#define __JSYNC_H__
+
+#include <pthread.h>
+
+class JSyncThread {
+ private:
+
+ pthread_t _thread;
+ pthread_attr_t _attr;
+
+ pthread_mutex_t _mutex;
+ pthread_cond_t _cond;
+
+ /* mutex and conditional for the feed */
+ pthread_mutex_t _mutex_feed;
+ pthread_cond_t _cond_feed;
+
+ public:
+
+ JSyncThread();
+ virtual ~JSyncThread();
+
+ void start();
+ virtual void run() {};
+
+ void lock() { pthread_mutex_lock(&_mutex); };
+ void unlock() { pthread_mutex_unlock(&_mutex); };
+
+ void lock_feed() { pthread_mutex_lock(&_mutex_feed); };
+ void unlock_feed() { pthread_mutex_unlock(&_mutex_feed); };
+
+ /* MUTEX MUST BE LOCKED AND UNLOCKED WHILE USING WAIT */
+ void wait() { pthread_cond_wait(&_cond,&_mutex); };
+ void signal() { pthread_cond_signal(&_cond); };
+
+ void wait_feed() { pthread_cond_wait(&_cond_feed,&_mutex_feed); };
+ void signal_feed() { pthread_cond_signal(&_cond_feed); };
+
+ protected:
+
+ static void* kickoff(void *arg) { ((JSyncThread *) arg)->run(); return NULL; };
+
+};
+
+#endif
diff --git a/thk04/jutils.cpp b/thk04/jutils.cpp
new file mode 100644
index 0000000..3f15d5a
--- /dev/null
+++ b/thk04/jutils.cpp
@@ -0,0 +1,306 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ * this file includes a malloc wrapper, it acts very verbose when debug
+ * mode allow it
+ */
+
+#include <stdio.h>
+
+#ifdef linux
+/* we try to use the realtime linux clock on /dev/rtc */
+#include <linux/rtc.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/select.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#endif
+
+#include <iostream>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <time.h>
+#include <sched.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <jutils.h>
+#include <config.h>
+
+#define MAX_DEBUG 2
+
+#define FUNC 2 /* se il debug level e' questo
+ ci sono le funzioni chiamate */
+#define WARN 1 /* ... blkbblbl */
+
+char msg[255];
+
+static int verbosity;
+
+static char *osd_msg;
+
+void set_debug(int lev) {
+ lev = lev<0 ? 0 : lev;
+ lev = lev>MAX_DEBUG ? MAX_DEBUG : lev;
+ verbosity = lev;
+}
+
+int get_debug() {
+ return(verbosity);
+}
+
+void set_osd(char *st) {
+ osd_msg = st;
+ osd_msg[0] = '\0';
+}
+
+void show_osd() {
+ strncpy(osd_msg,msg,49);
+ osd_msg[50] = '\0';
+}
+
+void show_osd(char *format, ...) {
+ va_list arg;
+ va_start(arg, format);
+
+ vsnprintf(osd_msg,49, format, arg);
+ osd_msg[50] = '\0';
+ va_end(arg);
+
+}
+
+void notice(char *format, ...) {
+ va_list arg;
+ va_start(arg, format);
+
+ vsnprintf(msg, 254, format, arg);
+ fprintf(stderr,"[*] %s\n",msg);
+
+ va_end(arg);
+}
+
+void func(char *format, ...) {
+ if(verbosity>=FUNC) {
+ va_list arg;
+ va_start(arg, format);
+
+ vsnprintf(msg, 254, format, arg);
+ fprintf(stderr,"[F] %s\n",msg);
+
+ va_end(arg);
+ }
+}
+
+void error(char *format, ...) {
+ va_list arg;
+ va_start(arg, format);
+
+ vsnprintf(msg, 254, format, arg);
+ fprintf(stderr,"[!] %s\n",msg);
+
+ va_end(arg);
+}
+
+void act(char *format, ...) {
+ va_list arg;
+ va_start(arg, format);
+
+ vsnprintf(msg, 254, format, arg);
+ fprintf(stderr," . %s\n",msg);
+
+ va_end(arg);
+}
+
+void warning(char *format, ...) {
+ if(verbosity>=WARN) {
+ va_list arg;
+ va_start(arg, format);
+
+ vsnprintf(msg, 254, format, arg);
+ fprintf(stderr,"[W] %s\n",msg);
+
+ va_end(arg);
+ }
+}
+
+void *jalloc(void *point,size_t size) {
+ if(point!=NULL)
+ if(verbosity>0) warning("requested malloc on a non-NULL pointer");
+
+ point = malloc(size);
+
+ if(point==NULL) {
+ error("cannot allocate %u bytes of memory",size);
+ return(NULL);
+ } else if(verbosity>=FUNC) {
+ fprintf(stderr,"[M] allocated memory at %p sized %u bytes\n",point,(unsigned int)size);
+ }
+ return(point);
+}
+
+bool jfree(void *point) {
+
+ if(point==NULL) {
+ warning("requested free on a NULL pointer");
+ return(false);
+ }
+
+ if(verbosity>=FUNC)
+ fprintf(stderr,"[M] freeing memory at address %p\n",point);
+
+ free(point);
+ point = NULL;
+ return(true);
+}
+
+/*
+ * fastrand - fast fake random number generator
+ * by Fukuchi Kentarou
+ * Warning: The low-order bits of numbers generated by fastrand()
+ * are bad as random numbers. For example, fastrand()%4
+ * generates 1,2,3,0,1,2,3,0...
+ * You should use high-order bits.
+ *
+ */
+
+static Uint32 randval;
+
+Uint32 fastrand()
+{
+ return (randval=randval*1103515245+12345);
+}
+
+void fastsrand(Uint32 seed)
+{
+ randval = seed;
+}
+
+double dtime() {
+ //#ifdef ARCH_X86
+ // double x;
+ // __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
+ // return x;
+ //#else
+ struct timeval mytv;
+ gettimeofday(&mytv,NULL);
+ return((double)mytv.tv_sec+1.0e-6*(double)mytv.tv_usec);
+ //#endif
+}
+
+void jsleep(int sec, long nsec) {
+ timespec timelap;
+ timelap.tv_sec = sec;
+ timelap.tv_nsec = nsec;
+ nanosleep(&timelap,NULL);
+}
+
+
+/* small RTC interface by jaromil
+ all comes from the Linux Kernel Documentation */
+#ifdef linux
+/* better to use /dev/rtc */
+static int rtcfd = -1;
+static fd_set readfds;
+static timeval rtctv = { 0,0 };
+static unsigned long rtctime;
+int rtc_open() {
+ int res;
+ rtcfd = open("/dev/rtc",O_RDONLY);
+ if(!rtcfd) {
+ perror("/dev/rtc");
+ return 0;
+ }
+ /* set the alarm event to 1 second */
+ res = ioctl(rtcfd, RTC_UIE_ON, 0);
+ if(res<0) {
+ perror("rtc ioctl");
+ return 0;
+ }
+ notice("realtime clock succesfully initialized");
+ return 1;
+}
+/* tick returns 0 if 1 second didn't passed since last tick,
+ positive number if 1 second passed */
+unsigned long rtc_tick() {
+ FD_ZERO(&readfds);
+ FD_SET(rtcfd,&readfds);
+ if ( ! select(rtcfd+1,&readfds,NULL,NULL,&rtctv) )
+ return 0; /* a second didn't passed yet */
+ read(rtcfd,&rtctime,sizeof(unsigned long));
+ return rtctime;
+}
+void rtc_freq_set(unsigned long freq) {
+ int res;
+
+ res = ioctl(rtcfd,RTC_IRQP_SET,freq);
+ if(res<0) { perror("rtc freq set"); }
+
+ res = ioctl(rtcfd,RTC_IRQP_READ,&freq);
+ if(res<0) { perror("rtc freq read"); }
+
+ act("realtime clock frequency set to %ld",freq);
+
+ res = ioctl(rtcfd,RTC_PIE_ON,0);
+ if(res<0) { perror("rtc freq on"); return; }
+
+}
+void rtc_freq_wait() {
+ int res;
+ res = read(rtcfd,&rtctime,sizeof(unsigned long));
+ if(res < 0) {
+ perror("read rtc frequency interrupt");
+ return;
+ }
+}
+void rtc_close() {
+ if(rtcfd<=0) return;
+ ioctl(rtcfd, RTC_UIE_OFF, 0);
+ // ioctl(rtcfd,RTC_PIE_OFF,0);
+ close(rtcfd);
+}
+#endif
+
+void *(* jmemcpy)(void *to, const void *from, size_t len) = memcpy;
+
+/*
+ * memset(x,0,y) is a reasonably common thing to do, so we want to fill
+ * things 32 bits at a time even when we don't know the size of the
+ * area at compile-time..
+ */
+void jmemset(void * s, unsigned long c ,size_t count)
+{
+#ifdef ARCH_X86
+int d0, d1;
+__asm__ __volatile__(
+ "rep ; stosl\n\t"
+ "testb $2,%b3\n\t"
+ "je 1f\n\t"
+ "stosw\n"
+ "1:\ttestb $1,%b3\n\t"
+ "je 2f\n\t"
+ "stosb\n"
+ "2:"
+ : "=&c" (d0), "=&D" (d1)
+ :"a" (c), "q" (count), "0" (count/4), "1" ((long) s)
+ :"memory");
+#else
+ memset(s,c,count);
+#endif
+}
diff --git a/thk04/jutils.h b/thk04/jutils.h
new file mode 100644
index 0000000..0c010bd
--- /dev/null
+++ b/thk04/jutils.h
@@ -0,0 +1,51 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __UTILS_H__
+#define __UTILS_H__
+
+#include <SDL.h>
+
+extern char msg[255];
+
+extern void *(*jmemcpy)( void *to, const void *from, size_t len );
+void jmemset(void * s, unsigned long c ,size_t count);
+
+void set_debug(int lev);
+int get_debug();
+void set_osd(char *st);
+void show_osd();
+void show_osd(char *format, ...);
+void notice(char *format, ...);
+void func(char *format, ...);
+void error(char *format, ...);
+void act(char *format, ...);
+void warning(char *format, ...);
+void *jalloc(void *point,size_t size);
+bool jfree(void *point);
+Uint32 fastrand();
+void fastsrand(Uint32 seed);
+double dtime();
+bool set_rtpriority(bool max);
+void jsleep(int sec, long nsec);
+int rtc_open();
+unsigned long rtc_tick();
+void rtc_freq_set(unsigned long freq);
+void rtc_freq_wait();
+void rtc_close();
+#endif
diff --git a/thk04/layer.cpp b/thk04/layer.cpp
new file mode 100644
index 0000000..a3f6ce6
--- /dev/null
+++ b/thk04/layer.cpp
@@ -0,0 +1,160 @@
+/* FreeJ
+ * (c) Copyright 2001-2002 Denis Rojo aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: layer.cpp,v 1.45 2004/05/02 10:43:03 jaromil Exp $"
+ *
+ */
+
+#include <string.h>
+
+#include <SDL.h>
+
+#include <layer.h>
+#include <context.h>
+#include <jutils.h>
+#include <config.h>
+
+Layer::Layer()
+ :Entry(), JSyncThread() {
+ quit = false;
+ active = false;
+ running = false;
+ hidden = false;
+ bgcolor = 0;
+ fade_in = fade_out = 0;
+ bgmatte = NULL;
+ blit = 1;
+ set_alpha(255);
+ setname("???");
+ buffer = NULL;
+}
+
+Layer::~Layer() {
+ filters.clear();
+ if(bgmatte) jfree(bgmatte);
+}
+
+void Layer::_init(Context *freej, int wdt, int hgt, int bpp) {
+ this->freej = freej;
+
+ geo.w = (wdt == 0) ? freej->screen->w : wdt;
+ geo.h = (hgt == 0) ? freej->screen->h : hgt;
+ geo.bpp = (bpp) ? bpp : freej->screen->bpp;
+ geo.size = geo.w*geo.h*(geo.bpp>>3);
+ geo.pitch = geo.w*(geo.bpp>>3);
+ geo.fps = freej->fps;
+ geo.x = (freej->screen->w - geo.w)/2;
+ geo.y = (freej->screen->h - geo.h)/2;
+
+ // crop();
+ freej->screen->crop(this);
+
+ /* allocate memory for the matte background */
+ bgmatte = jalloc(bgmatte,geo.size);
+
+ func("initialized %s layer %ix%i %ibpp",
+ get_name(),geo.w,geo.h,geo.bpp);
+}
+
+void Layer::run() {
+ while(!feed()) jsleep(0,50);
+ running = true;
+ wait_feed();
+ while(!quit) {
+ buffer = feed();
+ if(!buffer) error("feed error on layer %s",_name);
+ wait_feed();
+ }
+ running = false;
+}
+
+bool Layer::cafudda() {
+
+ if((!active) || (hidden))
+ return false;
+
+ offset = (bgcolor) ? bgmatte : buffer;
+ if(!offset) {
+ signal_feed();
+ return(false);
+ }
+
+ filters.lock();
+
+ Filter *filt = (Filter *)filters.begin();
+
+ while(filt) {
+ if(filt->active) offset = filt->process(offset);
+ filt = (Filter *)filt->next;
+ }
+
+ if(fade_in)
+ if(fade_in > alpha) { alpha++; }
+ else { fade_in = 0; }
+ else if(fade_out)
+ if(fade_out < alpha) { alpha--; }
+ else { fade_out = 0; }
+
+ //blit(offset);
+ freej->screen->blit(this);
+
+ filters.unlock();
+
+ signal_feed();
+
+ return(true);
+}
+
+
+void Layer::setname(char *s) {
+ snprintf(_name,4,"%s",s);
+}
+char *Layer::get_name() { return _name; }
+
+char *Layer::get_blit() {
+ switch(blit) {
+ case 1: return "RGB";
+ case 2: return "BLU";
+ case 3: return "GRE";
+ case 4: return "RED";
+ case 5: return "ADD";
+ case 6: return "SUB";
+ case 7: return "AND";
+ case 8: return "OR ";
+ case 9: return alphastr;
+ default: return "???";
+ }
+}
+
+void Layer::set_alpha(int opaq) {
+ alpha = (opaq>255) ? 255 : (opaq<0) ? 0 : opaq;
+ snprintf(alphastr,4,"%03u",alpha);
+}
+
+void Layer::set_filename(char *f) {
+ char *p = f + strlen(f);
+ while(*p!='/' && (p > f)) p--;
+ strncpy(filename,p+1,256);
+}
+
+void Layer::set_position(int x, int y) {
+ lock();
+ geo.x = x;
+ geo.y = y;
+ freej->screen->crop(this);
+ unlock();
+}
diff --git a/thk04/layer.h b/thk04/layer.h
new file mode 100644
index 0000000..05e5bf7
--- /dev/null
+++ b/thk04/layer.h
@@ -0,0 +1,163 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: layer.h,v 1.28 2004/04/26 16:11:36 jaromil Exp $"
+ *
+ */
+
+/**
+ @file layer.h
+ @brief FreeJ generic Layer interface
+*/
+
+#ifndef __LAYER_H__
+#define __LAYER_H__
+
+#include <inttypes.h>
+#include <SDL.h>
+
+#include <filter.h>
+#include <jsync.h>
+
+class Context;
+
+/**
+ This class describes methods and properties common to all Layers in
+ FreeJ: it is the main interface for functionalities like blit
+ changes, filter management and position changes.
+
+ The public methods hereby described are matching the javascript API
+ which is made available by the internal parser.
+
+ Methods implemented to create and destroy a layer:
+ - Layer::open
+ - Layer::init
+ - Layer::close
+
+ Miscellaneus operations made available for the layer:
+ - Layer::set_position
+ - Layer::set_blit
+ - Layer::get_blit
+ - Layer::set_alpha
+ - Layer::get_name
+
+ LinkList of filters used on the layer:
+ - Layer::filters
+
+ Pointer to the initialized Context where the layer is used:
+ - Layer::freej
+
+ Geometrical informations about the layer:
+ - Layer::geo
+
+ @brief Layer parent abstract class
+*/
+class Layer: public Entry, public JSyncThread {
+ friend class Context;
+ friend class JSyncThread;
+
+ public:
+
+ Layer(); ///< Layer constructor
+ ~Layer(); ///< Layer destructor
+
+ /* these must be defined in layer implementations */
+ virtual bool open(char *file) =0;
+ virtual bool init(Context *scr) =0;
+ virtual void close() =0;
+
+ char *get_name();
+ ///< Get Layer's descriptive name (3 letters)
+
+ char *get_filename() { return filename; };
+ ///< Get Layer's filename
+
+ void set_position(int x, int y);
+ ///< Set Layer's position on screen
+
+ /* BLIT */
+ void set_blit(int b) { blit = b; }; ///< Set Layer's blit algorithm
+ uint8_t blit; ///< Layer's blit algorithm integer identifier
+ char *get_blit(); ///< Get a short string describing Layer's blit algorithm
+
+
+ /* ALPHA */
+ void set_alpha(int opaq); ///< Set Layer's alpha opacity
+ uint8_t alpha; ///< Layer's alpha opacity value
+ uint8_t get_alpha() { return alpha; }; ///< Get Layer's alpha value
+
+ uint8_t fade_in, fade_out;
+
+ virtual bool keypress(SDL_keysym *keysym) =0;
+ ///< pass to the Layer a keypress
+
+ Linklist filters;
+ ///< Filter list of effects applied on the Layer
+
+ ScreenGeometry geo;
+ ///< Geometrical information about the Layer
+
+ bool active; ///< is active? (read-only)
+ bool quit; ///< should it quit? (read-write)
+ bool running; ///< is running? (read-only)
+ bool hidden; ///< is hidden (read-only by the blit)
+ int bgcolor; ///< matte background color
+
+ SDL_Rect rect; ///< SDL rectangle for blit crop
+
+ void *offset; ///< pointere to where all goes after processing
+
+
+ protected:
+
+ void _init(Context *freej, int wdt, int hgt, int bpp=0);
+ ///< Layer abstract initialization
+
+ Context *freej;
+
+ void set_filename(char *f);
+ char filename[256];
+
+ void setname(char *s);
+
+ void *buffer;
+
+
+ private:
+ char _name[5];
+ char alphastr[5];
+
+ void run(); ///< Main Layer thread loop
+
+ virtual void *feed() = 0; ///< feeds in the image source
+
+ bool cafudda(); ///< cafudda is called by the Context
+
+
+
+ void *bgmatte;
+
+};
+
+/* function for type detection of implemented layers */
+
+extern Layer *create_layer(char *file);
+///< create the propriate Layer type from a file
+
+extern const char *layers_description;
+
+#endif
diff --git a/thk04/linklist.cpp b/thk04/linklist.cpp
new file mode 100644
index 0000000..4a67e9e
--- /dev/null
+++ b/thk04/linklist.cpp
@@ -0,0 +1,327 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: linklist.cpp,v 1.13 2004/01/14 14:16:05 jaromil Exp $"
+ *
+ -------------------------------------------------------------------------
+ linked list container class
+
+ NOTE: add and rem don't take care of deleting pointers
+ that has to be done by the process that creates them and
+ knows which inheriting class they are (delete is done in main)
+*/
+
+#include <iostream>
+
+#include <jutils.h>
+#include <linklist.h>
+#include <config.h>
+
+Linklist::Linklist() {
+ length = 0;
+ first = NULL;
+ last = NULL;
+ pthread_mutex_init(&mutex,NULL);
+}
+
+Linklist::~Linklist() {
+ clear();
+}
+
+/* adds one element at the end of the list */
+void Linklist::append(Entry *addr) {
+ Entry *ptr = NULL;
+ if(addr->list) addr->rem();
+ lock();
+
+ if(!last) { /* that's the first entry */
+ last = addr;
+ last->next = NULL;
+ last->prev = NULL;
+ first = last;
+ } else { /* add the entry to the end */
+ ptr = last;
+ ptr->next = addr;
+ addr->next = NULL;
+ addr->prev = ptr;
+ last = addr;
+ }
+ /* save the pointer to this list */
+ addr->list = this;
+ length++;
+ unlock();
+}
+
+void Linklist::prepend(Entry *addr) {
+ Entry *ptr = NULL;
+ if(addr->list) addr->rem();
+ lock();
+
+ if(!first) { /* that's the first entry */
+ first = addr;
+ first->next = NULL;
+ first->prev = NULL;
+ last = first;
+ } else { /* add an entry to the beginning */
+ ptr = first;
+ ptr->prev = addr;
+ addr->next = ptr;
+ addr->prev = NULL;
+ first = addr;
+ }
+ addr->list = this;
+ length++;
+ unlock();
+}
+
+/* adds an element at the position specified
+ if pos is out of bounds adds it at the beginning or the end
+ the element occupying allready the position slides down
+ THIS FUNCTION IS NOT YET RELIABLE
+*/
+void Linklist::insert(Entry *addr, int pos) {
+ if(length<=pos) { /* adds it at the end */
+ append(addr);
+ return;
+ } else if(pos<=1) {
+ prepend(addr);
+ return;
+ }
+
+ if(addr->list) addr->rem();
+
+ Entry *ptr = pick(pos);
+
+ lock();
+ ptr->prev->next = addr;
+ addr->prev = ptr->prev;
+
+ ptr->prev = addr;
+ addr->next = ptr;
+
+ length++;
+ addr->list = this;
+ unlock();
+}
+
+/* clears the list
+ i don't delete filters here because they have to be deleted
+ from the procedure creating them. so this call simply discards
+ the pointers stored into the linked list. OBJECTS ARE NOT FREED */
+void Linklist::clear() {
+ lock();
+ sel(0);
+ length = 0;
+ first = NULL;
+ last = NULL;
+ unlock();
+}
+
+/* takes one element from the list
+ === STARTING FROM 1 ===
+ returns NULL if called with pos=0 or pos>length
+ returns Entry pointer otherwise
+ this function is then overloading the operator[]
+*/
+Entry *Linklist::pick(int pos) {
+ if((length<pos)||(pos<1)) return(NULL);
+ if(pos==1) return(first);
+ if(pos==length) return(last);
+
+ Entry *ptr = first;
+ int c;
+ for(c=1;c<pos;c++) ptr = ptr->next;
+
+ return(ptr);
+}
+
+
+/* this function is a wrapper around Entry::up()
+ better to use that if you have a pointer to your Entry */
+bool Linklist::moveup(int pos) {
+ Entry *p = pick(pos);
+ if(!p) return(false);
+ return( p->up() );
+}
+bool Linklist::movedown(int pos) {
+ Entry *p = pick(pos);
+ if(!p) return(false);
+ return( p->down() );
+}
+bool Linklist::moveto(int num, int pos) {
+ Entry
+ *p = pick(num);
+ if(!p) return(false);
+ return( p->move(pos) );
+}
+/* removes one element from the list */
+void Linklist::rem(int pos) {
+ Entry *ptr = pick(pos);
+ if(ptr==NULL) return;
+ ptr->rem();
+}
+
+/* selects ONLY ONE, deselects the others
+ use Entry::sel() if you want to do multiple selects */
+void Linklist::sel(int pos) {
+ int c;
+ Entry *ptr = last;
+
+ if(pos>length) return;
+
+ for(c=length;c>0;c--) {
+ if(c==pos) ptr->sel(true);
+ else ptr->sel(false);
+ ptr = ptr->prev;
+ }
+}
+
+/* returns the last one selected
+ this is supposed to be used with single selections */
+Entry *Linklist::selected() {
+ int c;
+ Entry *ptr = last;
+ for(c=length;c>0;c--) {
+ if(ptr->select) return ptr;
+ ptr = ptr->prev;
+ }
+ return NULL;
+}
+
+Entry::Entry() {
+ next = NULL;
+ prev = NULL;
+ list = NULL;
+ select = false;
+}
+
+Entry::~Entry() {
+ rem();
+}
+
+
+bool Entry::up() {
+ if(!prev || !list) return(false);
+ list->lock();
+
+ Entry *tprev = prev,
+ *tnext = next,
+ *pp = prev->prev;
+
+ if(!next)
+ list->last = prev;
+
+ if(tnext)
+ tnext->prev = tprev;
+
+ next = tprev;
+ prev = pp;
+ tprev->next = tnext;
+ tprev->prev = this;
+
+ if(pp)
+ pp->next = this;
+
+ if(!prev)
+ list->first = this;
+
+ list->unlock();
+ return(true);
+}
+
+bool Entry::down() {
+ if(!next || !list) return(false);
+ list->lock();
+
+ Entry *tprev = prev,
+ *tnext = next,
+ *nn = next->next;
+
+ if(!prev)
+ list->first = next;
+
+ if(tprev)
+ tprev->next = tnext;
+
+ prev = tnext;
+ next = nn;
+ tnext->prev = tprev;
+ tnext->next = this;
+ if(nn)
+ nn->prev = this;
+
+ if(!next)
+ list->last = this;
+
+ list->unlock();
+ return(true);
+}
+
+bool Entry::move(int pos) {
+ func("Entry::move(%i) - NEW LINKLIST MOVE");
+ if(!list) return(false);
+ list->lock();
+
+ Entry *tn, *tp;
+
+ Entry *swapping = list->pick(pos);
+ if(swapping == this) return(true);
+ if(!swapping) return(false);
+
+ tn = swapping->next;
+ tp = swapping->prev;
+
+ swapping->next = next;
+ swapping->prev = prev;
+ if(next) next->prev = swapping;
+ else list->last = swapping;
+ if(prev) prev->next = swapping;
+ else list->first = swapping;
+
+ next = tn;
+ prev = tp;
+ if(next) next->prev = this;
+ else list->last = this;
+ if(prev) prev->next = this;
+ else list->first = this;
+
+ list->unlock();
+ func("LINKLIST MOVE RETURNS SUCCESS");
+
+ return(true);
+}
+
+void Entry::rem() {
+ if(!list) return;
+ list->lock();
+
+ if(prev)
+ prev->next = next;
+ else list->first = next;
+
+ if(next)
+ next->prev = prev;
+ else list->last = prev;
+
+ list->length--;
+ list->unlock();
+ list = NULL;
+}
+
+void Entry::sel(bool on) {
+ select = on;
+}
diff --git a/thk04/linklist.h b/thk04/linklist.h
new file mode 100644
index 0000000..9b25014
--- /dev/null
+++ b/thk04/linklist.h
@@ -0,0 +1,82 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __linklist_h__
+#define __linklist_h__
+
+#include <pthread.h>
+
+class Entry;
+
+class Linklist {
+ public:
+ Linklist();
+ virtual ~Linklist();
+
+ Entry *begin() { return(first); };
+ Entry *end() { return(last); };
+ int len() { return(length); };
+
+ void append(Entry *addr);
+ void add(Entry *addr) { append(addr); }; /* lazy backward compatibility */
+ void prepend(Entry *addr);
+ void insert(Entry *addr, int pos);
+
+ void rem(int pos);
+ void sel(int pos);
+ void clear();
+ bool moveup(int pos);
+ bool movedown(int pos);
+ bool moveto(int num, int pos);
+ Entry *pick(int pos);
+ Entry *selected();
+
+ Entry *operator[](int pos) { return pick(pos); };
+
+ /* don't touch these directly */
+ Entry *first;
+ Entry *last;
+ int length;
+
+ void lock() { pthread_mutex_lock(&mutex); };
+ void unlock() { pthread_mutex_unlock(&mutex); };
+
+ private:
+ pthread_mutex_t mutex;
+};
+
+class Entry {
+ public:
+ Entry();
+ ~Entry();
+
+ Entry *next;
+ Entry *prev;
+
+ Linklist *list;
+
+ bool up();
+ bool down();
+ bool move(int pos);
+ void rem();
+ void sel(bool on);
+
+ bool select;
+};
+
+#endif
diff --git a/thk04/misfu-climax.xm b/thk04/misfu-climax.xm
new file mode 100644
index 0000000..3e0b087
--- /dev/null
+++ b/thk04/misfu-climax.xm
Binary files differ
diff --git a/thk04/mm_accel.h b/thk04/mm_accel.h
new file mode 100644
index 0000000..d60ea65
--- /dev/null
+++ b/thk04/mm_accel.h
@@ -0,0 +1,30 @@
+/*
+ * mm_accel.h
+ * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ *
+ * mpeg2dec is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * mpeg2dec is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* generic accelerations */
+#define MM_ACCEL_MLIB 0x00000001
+
+/* x86 accelerations */
+#define MM_ACCEL_X86_MMX 0x80000000
+#define MM_ACCEL_X86_3DNOW 0x40000000
+#define MM_ACCEL_X86_MMXEXT 0x20000000
+
+uint32_t mm_accel (void);
diff --git a/thk04/mmx.h b/thk04/mmx.h
new file mode 100644
index 0000000..e402b21
--- /dev/null
+++ b/thk04/mmx.h
@@ -0,0 +1,261 @@
+/*
+ * mmx.h
+ * Copyright (C) 1997-2001 H. Dietz and R. Fisher
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ *
+ * mpeg2dec is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * mpeg2dec is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * The type of an value that fits in an MMX register (note that long
+ * long constant values MUST be suffixed by LL and unsigned long long
+ * values by ULL, lest they be truncated by the compiler)
+ */
+
+typedef union {
+ long long q; /* Quadword (64-bit) value */
+ unsigned long long uq; /* Unsigned Quadword */
+ int d[2]; /* 2 Doubleword (32-bit) values */
+ unsigned int ud[2]; /* 2 Unsigned Doubleword */
+ short w[4]; /* 4 Word (16-bit) values */
+ unsigned short uw[4]; /* 4 Unsigned Word */
+ char b[8]; /* 8 Byte (8-bit) values */
+ unsigned char ub[8]; /* 8 Unsigned Byte */
+ float s[2]; /* Single-precision (32-bit) value */
+} ATTR_ALIGN(8) mmx_t; /* On an 8-byte (64-bit) boundary */
+
+
+#define mmx_i2r(op,imm,reg) \
+ __asm__ __volatile__ (#op " %0, %%" #reg \
+ : /* nothing */ \
+ : "i" (imm) )
+
+#define mmx_m2r(op,mem,reg) \
+ __asm__ __volatile__ (#op " %0, %%" #reg \
+ : /* nothing */ \
+ : "m" (mem))
+
+#define mmx_r2m(op,reg,mem) \
+ __asm__ __volatile__ (#op " %%" #reg ", %0" \
+ : "=m" (mem) \
+ : /* nothing */ )
+
+#define mmx_r2r(op,regs,regd) \
+ __asm__ __volatile__ (#op " %" #regs ", %" #regd)
+
+
+#define emms() __asm__ __volatile__ ("emms")
+
+#define movd_m2r(var,reg) mmx_m2r (movd, var, reg)
+#define movd_r2m(reg,var) mmx_r2m (movd, reg, var)
+#define movd_v2r(var,reg) __asm__ __volatile__ ("movd %0, %%" #reg \
+ : /* nothing */ \
+ : "rm" (var))
+#define movd_r2v(reg,var) __asm__ __volatile__ ("movd %%" #reg ", %0" \
+ : "=rm" (var) \
+ : /* nothing */ )
+
+#define movq_m2r(var,reg) mmx_m2r (movq, var, reg)
+#define movq_r2m(reg,var) mmx_r2m (movq, reg, var)
+#define movq_r2r(regs,regd) mmx_r2r (movq, regs, regd)
+
+#define packssdw_m2r(var,reg) mmx_m2r (packssdw, var, reg)
+#define packssdw_r2r(regs,regd) mmx_r2r (packssdw, regs, regd)
+#define packsswb_m2r(var,reg) mmx_m2r (packsswb, var, reg)
+#define packsswb_r2r(regs,regd) mmx_r2r (packsswb, regs, regd)
+
+#define packuswb_m2r(var,reg) mmx_m2r (packuswb, var, reg)
+#define packuswb_r2r(regs,regd) mmx_r2r (packuswb, regs, regd)
+
+#define paddb_m2r(var,reg) mmx_m2r (paddb, var, reg)
+#define paddb_r2r(regs,regd) mmx_r2r (paddb, regs, regd)
+#define paddd_m2r(var,reg) mmx_m2r (paddd, var, reg)
+#define paddd_r2r(regs,regd) mmx_r2r (paddd, regs, regd)
+#define paddw_m2r(var,reg) mmx_m2r (paddw, var, reg)
+#define paddw_r2r(regs,regd) mmx_r2r (paddw, regs, regd)
+
+#define paddsb_m2r(var,reg) mmx_m2r (paddsb, var, reg)
+#define paddsb_r2r(regs,regd) mmx_r2r (paddsb, regs, regd)
+#define paddsw_m2r(var,reg) mmx_m2r (paddsw, var, reg)
+#define paddsw_r2r(regs,regd) mmx_r2r (paddsw, regs, regd)
+
+#define paddusb_m2r(var,reg) mmx_m2r (paddusb, var, reg)
+#define paddusb_r2r(regs,regd) mmx_r2r (paddusb, regs, regd)
+#define paddusw_m2r(var,reg) mmx_m2r (paddusw, var, reg)
+#define paddusw_r2r(regs,regd) mmx_r2r (paddusw, regs, regd)
+
+#define pand_m2r(var,reg) mmx_m2r (pand, var, reg)
+#define pand_r2r(regs,regd) mmx_r2r (pand, regs, regd)
+
+#define pandn_m2r(var,reg) mmx_m2r (pandn, var, reg)
+#define pandn_r2r(regs,regd) mmx_r2r (pandn, regs, regd)
+
+#define pcmpeqb_m2r(var,reg) mmx_m2r (pcmpeqb, var, reg)
+#define pcmpeqb_r2r(regs,regd) mmx_r2r (pcmpeqb, regs, regd)
+#define pcmpeqd_m2r(var,reg) mmx_m2r (pcmpeqd, var, reg)
+#define pcmpeqd_r2r(regs,regd) mmx_r2r (pcmpeqd, regs, regd)
+#define pcmpeqw_m2r(var,reg) mmx_m2r (pcmpeqw, var, reg)
+#define pcmpeqw_r2r(regs,regd) mmx_r2r (pcmpeqw, regs, regd)
+
+#define pcmpgtb_m2r(var,reg) mmx_m2r (pcmpgtb, var, reg)
+#define pcmpgtb_r2r(regs,regd) mmx_r2r (pcmpgtb, regs, regd)
+#define pcmpgtd_m2r(var,reg) mmx_m2r (pcmpgtd, var, reg)
+#define pcmpgtd_r2r(regs,regd) mmx_r2r (pcmpgtd, regs, regd)
+#define pcmpgtw_m2r(var,reg) mmx_m2r (pcmpgtw, var, reg)
+#define pcmpgtw_r2r(regs,regd) mmx_r2r (pcmpgtw, regs, regd)
+
+#define pmaddwd_m2r(var,reg) mmx_m2r (pmaddwd, var, reg)
+#define pmaddwd_r2r(regs,regd) mmx_r2r (pmaddwd, regs, regd)
+
+#define pmulhw_m2r(var,reg) mmx_m2r (pmulhw, var, reg)
+#define pmulhw_r2r(regs,regd) mmx_r2r (pmulhw, regs, regd)
+
+#define pmullw_m2r(var,reg) mmx_m2r (pmullw, var, reg)
+#define pmullw_r2r(regs,regd) mmx_r2r (pmullw, regs, regd)
+
+#define por_m2r(var,reg) mmx_m2r (por, var, reg)
+#define por_r2r(regs,regd) mmx_r2r (por, regs, regd)
+
+#define pslld_i2r(imm,reg) mmx_i2r (pslld, imm, reg)
+#define pslld_m2r(var,reg) mmx_m2r (pslld, var, reg)
+#define pslld_r2r(regs,regd) mmx_r2r (pslld, regs, regd)
+#define psllq_i2r(imm,reg) mmx_i2r (psllq, imm, reg)
+#define psllq_m2r(var,reg) mmx_m2r (psllq, var, reg)
+#define psllq_r2r(regs,regd) mmx_r2r (psllq, regs, regd)
+#define psllw_i2r(imm,reg) mmx_i2r (psllw, imm, reg)
+#define psllw_m2r(var,reg) mmx_m2r (psllw, var, reg)
+#define psllw_r2r(regs,regd) mmx_r2r (psllw, regs, regd)
+
+#define psrad_i2r(imm,reg) mmx_i2r (psrad, imm, reg)
+#define psrad_m2r(var,reg) mmx_m2r (psrad, var, reg)
+#define psrad_r2r(regs,regd) mmx_r2r (psrad, regs, regd)
+#define psraw_i2r(imm,reg) mmx_i2r (psraw, imm, reg)
+#define psraw_m2r(var,reg) mmx_m2r (psraw, var, reg)
+#define psraw_r2r(regs,regd) mmx_r2r (psraw, regs, regd)
+
+#define psrld_i2r(imm,reg) mmx_i2r (psrld, imm, reg)
+#define psrld_m2r(var,reg) mmx_m2r (psrld, var, reg)
+#define psrld_r2r(regs,regd) mmx_r2r (psrld, regs, regd)
+#define psrlq_i2r(imm,reg) mmx_i2r (psrlq, imm, reg)
+#define psrlq_m2r(var,reg) mmx_m2r (psrlq, var, reg)
+#define psrlq_r2r(regs,regd) mmx_r2r (psrlq, regs, regd)
+#define psrlw_i2r(imm,reg) mmx_i2r (psrlw, imm, reg)
+#define psrlw_m2r(var,reg) mmx_m2r (psrlw, var, reg)
+#define psrlw_r2r(regs,regd) mmx_r2r (psrlw, regs, regd)
+
+#define psubb_m2r(var,reg) mmx_m2r (psubb, var, reg)
+#define psubb_r2r(regs,regd) mmx_r2r (psubb, regs, regd)
+#define psubd_m2r(var,reg) mmx_m2r (psubd, var, reg)
+#define psubd_r2r(regs,regd) mmx_r2r (psubd, regs, regd)
+#define psubw_m2r(var,reg) mmx_m2r (psubw, var, reg)
+#define psubw_r2r(regs,regd) mmx_r2r (psubw, regs, regd)
+
+#define psubsb_m2r(var,reg) mmx_m2r (psubsb, var, reg)
+#define psubsb_r2r(regs,regd) mmx_r2r (psubsb, regs, regd)
+#define psubsw_m2r(var,reg) mmx_m2r (psubsw, var, reg)
+#define psubsw_r2r(regs,regd) mmx_r2r (psubsw, regs, regd)
+
+#define psubusb_m2r(var,reg) mmx_m2r (psubusb, var, reg)
+#define psubusb_r2r(regs,regd) mmx_r2r (psubusb, regs, regd)
+#define psubusw_m2r(var,reg) mmx_m2r (psubusw, var, reg)
+#define psubusw_r2r(regs,regd) mmx_r2r (psubusw, regs, regd)
+
+#define punpckhbw_m2r(var,reg) mmx_m2r (punpckhbw, var, reg)
+#define punpckhbw_r2r(regs,regd) mmx_r2r (punpckhbw, regs, regd)
+#define punpckhdq_m2r(var,reg) mmx_m2r (punpckhdq, var, reg)
+#define punpckhdq_r2r(regs,regd) mmx_r2r (punpckhdq, regs, regd)
+#define punpckhwd_m2r(var,reg) mmx_m2r (punpckhwd, var, reg)
+#define punpckhwd_r2r(regs,regd) mmx_r2r (punpckhwd, regs, regd)
+
+#define punpcklbw_m2r(var,reg) mmx_m2r (punpcklbw, var, reg)
+#define punpcklbw_r2r(regs,regd) mmx_r2r (punpcklbw, regs, regd)
+#define punpckldq_m2r(var,reg) mmx_m2r (punpckldq, var, reg)
+#define punpckldq_r2r(regs,regd) mmx_r2r (punpckldq, regs, regd)
+#define punpcklwd_m2r(var,reg) mmx_m2r (punpcklwd, var, reg)
+#define punpcklwd_r2r(regs,regd) mmx_r2r (punpcklwd, regs, regd)
+
+#define pxor_m2r(var,reg) mmx_m2r (pxor, var, reg)
+#define pxor_r2r(regs,regd) mmx_r2r (pxor, regs, regd)
+
+
+/* 3DNOW extensions */
+
+#define pavgusb_m2r(var,reg) mmx_m2r (pavgusb, var, reg)
+#define pavgusb_r2r(regs,regd) mmx_r2r (pavgusb, regs, regd)
+
+
+/* AMD MMX extensions - also available in intel SSE */
+
+
+#define mmx_m2ri(op,mem,reg,imm) \
+ __asm__ __volatile__ (#op " %1, %0, %%" #reg \
+ : /* nothing */ \
+ : "m" (mem), "i" (imm))
+
+#define mmx_r2ri(op,regs,regd,imm) \
+ __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \
+ : /* nothing */ \
+ : "i" (imm) )
+
+#define mmx_fetch(mem,hint) \
+ __asm__ __volatile__ ("prefetch" #hint " %0" \
+ : /* nothing */ \
+ : "m" (mem))
+
+
+#define maskmovq(regs,maskreg) mmx_r2ri (maskmovq, regs, maskreg)
+
+#define movntq_r2m(mmreg,var) mmx_r2m (movntq, mmreg, var)
+
+#define pavgb_m2r(var,reg) mmx_m2r (pavgb, var, reg)
+#define pavgb_r2r(regs,regd) mmx_r2r (pavgb, regs, regd)
+#define pavgw_m2r(var,reg) mmx_m2r (pavgw, var, reg)
+#define pavgw_r2r(regs,regd) mmx_r2r (pavgw, regs, regd)
+
+#define pextrw_r2r(mmreg,reg,imm) mmx_r2ri (pextrw, mmreg, reg, imm)
+
+#define pinsrw_r2r(reg,mmreg,imm) mmx_r2ri (pinsrw, reg, mmreg, imm)
+
+#define pmaxsw_m2r(var,reg) mmx_m2r (pmaxsw, var, reg)
+#define pmaxsw_r2r(regs,regd) mmx_r2r (pmaxsw, regs, regd)
+
+#define pmaxub_m2r(var,reg) mmx_m2r (pmaxub, var, reg)
+#define pmaxub_r2r(regs,regd) mmx_r2r (pmaxub, regs, regd)
+
+#define pminsw_m2r(var,reg) mmx_m2r (pminsw, var, reg)
+#define pminsw_r2r(regs,regd) mmx_r2r (pminsw, regs, regd)
+
+#define pminub_m2r(var,reg) mmx_m2r (pminub, var, reg)
+#define pminub_r2r(regs,regd) mmx_r2r (pminub, regs, regd)
+
+#define pmovmskb(mmreg,reg) \
+ __asm__ __volatile__ ("movmskps %" #mmreg ", %" #reg)
+
+#define pmulhuw_m2r(var,reg) mmx_m2r (pmulhuw, var, reg)
+#define pmulhuw_r2r(regs,regd) mmx_r2r (pmulhuw, regs, regd)
+
+#define prefetcht0(mem) mmx_fetch (mem, t0)
+#define prefetcht1(mem) mmx_fetch (mem, t1)
+#define prefetcht2(mem) mmx_fetch (mem, t2)
+#define prefetchnta(mem) mmx_fetch (mem, nta)
+
+#define psadbw_m2r(var,reg) mmx_m2r (psadbw, var, reg)
+#define psadbw_r2r(regs,regd) mmx_r2r (psadbw, regs, regd)
+
+#define pshufw_m2r(var,reg,imm) mmx_m2ri(pshufw, var, reg, imm)
+#define pshufw_r2r(regs,regd,imm) mmx_r2ri(pshufw, regs, regd, imm)
+
+#define sfence() __asm__ __volatile__ ("sfence\n\t")
diff --git a/thk04/osd.cpp b/thk04/osd.cpp
new file mode 100644
index 0000000..7c7de1d
--- /dev/null
+++ b/thk04/osd.cpp
@@ -0,0 +1,171 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include <context.h>
+#include <screen.h>
+#include <font_pearl_8x8.h>
+#include <config.h>
+
+#define HBOUND 32
+#define VBOUND 23
+#define WCENTER (env->screen->w/2)-140
+#define VBP 16 /* vertical bound proportion */
+#define HBP 13 /* horizontal bound proportion */
+#define TOPLIST 6 /* distance down from vbound where they start the vertical lists */
+
+
+uint32_t *Osd::print(char *text, uint32_t *pos, int hsize, int vsize) {
+ uint32_t *diocrap = pos; //(uint32_t *)env->coords(xpos,ypos);
+ unsigned char *buffer = (unsigned char *)env->screen->get_surface();
+ v = env->screen->w*vsize;
+
+ // len = strlen(text);
+
+ /* quest'algoritmo di rastering a grandezza variabile delle font
+ e' una cosa di cui vado molto fiero, ogni volta che lo vedo il
+ petto mi si gonfia e mi escono sonore scorregge. */
+ for (y=0; y<CHAR_HEIGHT; y++) {
+ ptr = diocrap += v;
+
+ /* control screen bounds */
+ if(diocrap-(uint32_t *)buffer>(env->screen->size - env->screen->pitch))
+ return diocrap-newline; /* low bound */
+ while(diocrap-(uint32_t *)buffer<env->screen->pitch) ptr = diocrap += v;
+
+ // for (x=0; x<len; x++) {
+ x=0;
+ while(text[x]!='\0') {
+ f = fontdata[text[x] * CHAR_HEIGHT + y];
+ for (i = CHAR_WIDTH-1; i >= 0; i--)
+ if (f & (CHAR_START << i))
+ for(ch=0;ch<hsize;ch++) {
+ for(cv=0;cv<v;cv+=env->screen->w)
+ ptr[cv] = color32;
+ ptr++; }
+ else ptr+=hsize;
+ x++;
+ }
+ }
+ return(diocrap);
+}
+
+Osd::Osd() {
+ env = NULL;
+ top = mid = low = false;
+}
+
+Osd::~Osd() { }
+
+
+void Osd::print_low(char *text, ...) {
+ va_list arg;
+ va_start(arg,text);
+
+ vsnprintf(low_str, 50, text, arg);
+ low_str[51] = '\0';
+ va_end(arg);
+ low = true;
+}
+
+
+void Osd::print_mid(char *text, ...) {
+ va_list arg;
+ va_start(arg,text);
+
+ vsnprintf(mid_str, 50, text, arg);
+ mid_str[51] = '\0';
+ va_end(arg);
+ mid = true;
+}
+
+
+void Osd::print_top(char *text, ...) {
+ va_list arg;
+ va_start(arg,text);
+
+ vsnprintf(top_str, 50, text, arg);
+ top_str[51] = '\0';
+ va_end(arg);
+ top = true;
+}
+
+
+void Osd::init(Context *screen) {
+ uint32_t vpos;
+ this->env = screen;
+ set_color(white);
+
+ vpos = env->screen->h/2-120;
+ top_offset = (uint32_t*)env->screen->coords(HBOUND+env->screen->h/4,
+ vpos);
+ vpos+=60;
+ // VBOUND*3);
+ mid_offset = (uint32_t*)env->screen->coords(HBOUND+env->screen->h/4,
+ vpos);
+ // (env->screen->h/2)-(CHAR_HEIGHT/2));
+ vpos+=60;
+ low_offset = (uint32_t*)env->screen->coords(HBOUND+env->screen->h/4,
+ vpos);
+ // env->screen->h - VBOUND*3);
+
+ newline = env->screen->pitch*(CHAR_HEIGHT);
+
+ func("OSD initialized");
+
+}
+
+void Osd::cafudda() {
+ env->screen->lock();
+ if(top) print(top_str,top_offset,1,2);
+ if(mid) print(mid_str,mid_offset,1,2);
+ if(low) print(low_str,low_offset,1,2);
+ env->screen->unlock();
+}
+
+void Osd::clean() {
+ top = mid = low = false;
+}
+
+void Osd::set_color(colors col) {
+ switch(col) {
+ case black:
+ color32 = 0x00000000;
+ break;
+ case white:
+ color32 = 0x00fefefe;
+ break;
+ case green:
+ color32 = 0x0000ee00;
+ break;
+ case red:
+ color32 = 0x00ee0000;
+ break;
+ case blue:
+ color32 = 0x000000fe;
+ break;
+ case yellow:
+ color32 = 0x00ffef00;
+ break;
+ }
+}
+
diff --git a/thk04/osd.h b/thk04/osd.h
new file mode 100644
index 0000000..390ce5a
--- /dev/null
+++ b/thk04/osd.h
@@ -0,0 +1,67 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __OSD_H__
+#define __OSD_H__
+
+#include <context.h>
+#include <inttypes.h>
+
+
+typedef enum { black, white, green, red, blue, yellow } colors;
+
+class Osd {
+ private:
+ uint32_t newline;
+
+
+ uint32_t *top_offset;
+ uint32_t *mid_offset;
+ uint32_t *low_offset;
+
+ uint32_t color32;
+
+ /* used by the font renderer */
+ int y,x,i,len,f,v,ch,cv;
+ uint32_t *ptr;
+
+
+ public:
+ Osd();
+ ~Osd();
+
+ void init(Context *screen);
+ void cafudda();
+ void set_color(colors col);
+
+ bool top, mid, low;
+ char top_str[52];
+ char mid_str[52];
+ char low_str[52];
+ void print_low(char *text, ...);
+ void print_mid(char *text, ...);
+ void print_top(char *text, ...);
+ void clean();
+
+ Context *env;
+
+ uint32_t *print(char *text, uint32_t* pos, int hsize, int vsize);
+
+};
+
+#endif
diff --git a/thk04/plugger.cpp b/thk04/plugger.cpp
new file mode 100644
index 0000000..4ad30a4
--- /dev/null
+++ b/thk04/plugger.cpp
@@ -0,0 +1,155 @@
+/* FreeJ
+ * (c) Copyright 2001-2002 Denis Rojo aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: plugger.cpp,v 1.14 2003/12/29 23:12:10 jaromil Exp $"
+ *
+ */
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <jutils.h>
+#include <plugger.h>
+#include <config.h>
+
+Plugger::Plugger() {
+ char temp[256];
+
+ _searchpath = NULL;
+
+ sprintf(temp,"%s",DATADIR);
+ _addsearchdir(temp);
+ _addsearchdir("./");
+ // _addsearchdir("/usr/lib/freej");
+ // _addsearchdir("/usr/local/lib/freej");
+ for(int i=0;i<MAX_PLUGINS;i++) plugs[i] = NULL;
+}
+
+Plugger::~Plugger() {
+ func("Plugger::~Plugger()");
+ _delete();
+}
+
+Filter *Plugger::pick(char *name) {
+ for(int c=0;c<MAX_PLUGINS;c++)
+ if(plugs[c]) {
+ if( strcasecmp( plugs[c]->getname() , name ) ==0 )
+ return plugs[c];
+ } else break;
+ return(NULL);
+}
+
+int selector(const struct dirent *dir) {
+ // if(strstr(dir->d_name,".")) return(1);
+ // if(dir->d_name[0]=='.') return(0);
+ // if(strstr(dir->d_name,".la")) return(0);
+#ifdef HAVE_DARWIN
+ if(strstr(dir->d_name,"-darwin.so")) return(1);
+#else
+ if(strstr(dir->d_name,"-linux.so")) return(1);
+ if(strstr(dir->d_name,".so")) return(1);
+#endif
+ return(0);
+}
+
+/* searches into the lt_searchpath for valid modules */
+int Plugger::refresh() {
+ char *dir;
+ struct dirent **filelist;
+ int found;
+ char *path = _getsearchpath();
+ _delete();
+
+ // notice("loading available plugins");
+
+ if(!path) { warning("can't find any valid plugin directory"); return(-1); }
+ dir = strtok(path,":");
+ do {
+ found = scandir(dir,&filelist,selector,alphasort);
+ if(found<0) { error("Plugger::scandir"); return(-1); };
+ /* .so files found, check if they are plugins */
+ while(found--) {
+ char temp[256];
+ snprintf(temp,255,"%s/%s",dir,filelist[found]->d_name);
+ Filter *filt = new Filter;
+ if(filt->open(temp)) {
+ // act("plugged: %s filter v%u by %s",
+ // filt->getname(), filt->getversion(), filt->getauthor());
+ _add_plug(filt);
+ } else delete(filt);
+ // free(filelist[found]);
+ }
+ break;
+ // free(filelist);
+ } while((dir = strtok(NULL,":")));
+
+ return 0;
+}
+
+Filter *Plugger::operator[](const int num) {
+
+ if(!plugs[num]) return(NULL);
+
+ /* if the plugin is allready in use we can't instantiate it
+ from the same DSO shared object */
+ if(plugs[num]->inuse) return(NULL);
+ /* this is handled by the keyboard class
+ plugs[num]->inuse = true; */
+ return(plugs[num]);
+}
+
+int Plugger::_delete() {
+ func("Plugger::_delete");
+ // for(int c=0;c<MAX_PLUGINS;c++) if(plugs[c]) delete(plugs[c]);
+ return 0;
+}
+
+bool Plugger::_add_plug(Filter *f) {
+ for(int c=0;c<MAX_PLUGINS;c++)
+ if(!plugs[c]) {
+ plugs[c]=f;
+ return(true);
+ }
+ return(false);
+}
+
+bool Plugger::_filecheck(const char *file) {
+ bool res = true;
+ FILE *f = fopen(file,"r");
+ if(!f) res = false;
+ fclose(f);
+ return(res);
+}
+
+bool Plugger::_dircheck(const char *dir) {
+ bool res = true;
+ DIR *d = opendir(dir);
+ if(!d) res = false;
+ else closedir(d);
+ return(res);
+}
+
+void Plugger::_addsearchdir(const char *dir) {
+ char temp[1024];
+ if(!_dircheck(dir)) return;
+ if(_searchpath) {
+ snprintf(temp,1024,"%s:%s",_searchpath,dir);
+ jfree(_searchpath);
+ _searchpath = strdup(temp);
+ } else _searchpath = strdup(dir);
+}
diff --git a/thk04/plugger.h b/thk04/plugger.h
new file mode 100644
index 0000000..ee5b7cd
--- /dev/null
+++ b/thk04/plugger.h
@@ -0,0 +1,100 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* @file plugger.h
+ @brief Plugin Filter dispatcher header
+*/
+
+#ifndef __plugger_h__
+#define __plugger_h__
+
+#include <string.h>
+#include <jutils.h>
+#include <linklist.h>
+#include <filter.h>
+
+#define MAX_PLUGINS 12*12
+
+/**
+ This class implements the object storing all available filter
+ instances and dispatching them for FreeJ operations.
+
+ It reads thru paths ($(prefix)/lib/freej and ~/.freej) looking for
+ valid plugins and creates instances of them which are ready to be
+ returned upon request to the host application of FreeJ controllers.
+*/
+class Plugger {
+ public:
+ Plugger(); ///< Plugger onstructor
+ ~Plugger(); ///< Plugger destructor
+
+ /**
+ Query the plugger to find a plugin filter of a certain name
+
+ @param name filter name
+
+ @return the pointer to the Filter class instance found, or NULL
+ */
+ Filter *pick(char *name);
+
+ /**
+ Tell the Plugger to read again thru configured paths and updates
+ the plugin table.
+
+ @return number of valid Filter plugins found
+ */
+ int refresh();
+
+ /**
+ Close the plugger and deinitialize all Filter instances, usually
+ this doesn't needs to be called directly: FreeJ does it at quit.
+ */
+ void close() { _delete(); };
+
+ /**
+ Return a pointer to the Filter instance of a plugin, given its
+ number in the Plugger table.
+
+ @param num Filter plugin position number in the Plugger
+
+ @return the pointer to the Filter class instance found, or NULL
+ */
+ Filter *operator[](const int num);
+
+
+ Filter *plugs[MAX_PLUGINS];
+
+
+ private:
+
+ /* clears up the whole plugs list */
+ int _delete();
+ bool _add_plug(Filter *f);
+ /* checks if file/directory exist */
+ bool _filecheck(const char *file);
+ bool _dircheck(const char *dir);
+ void _addsearchdir(const char *dir);
+ void _setsearchpath(const char *path) {
+ if(_searchpath) jfree(_searchpath); _searchpath = strdup(path); };
+ char *_getsearchpath() { return(_searchpath); };
+
+ char *_searchpath;
+
+};
+
+#endif
diff --git a/thk04/plugin.cpp b/thk04/plugin.cpp
new file mode 100644
index 0000000..8f272d2
--- /dev/null
+++ b/thk04/plugin.cpp
@@ -0,0 +1,79 @@
+#include <string.h>
+#include <dlfcn.h>
+
+#include <plugin.h>
+#include <config.h>
+
+typedef char* (getch)(void);
+typedef int (getint)(void);
+
+Plugin::Plugin() {
+ _name = _info = _author = _path = NULL;
+ _handle = NULL;
+ _version = 0;
+ __init = NULL;
+ __clean = NULL;
+ __process = NULL;
+}
+
+void *Plugin::operator[](const char *sym) {
+ if(!_handle) return NULL;
+ void *point;
+ point = dlsym(_handle, sym);
+ if(point==NULL)
+ warning("Plugin::%s[%s] %s",_name,sym,dlerror());
+ return(point);
+}
+
+static inline int dummy_kbd_input(SDL_keysym *keysym) { return(0); }
+
+bool Plugin::open(const char *path) {
+ getch *getstr = NULL;
+ getint *getver = NULL;
+
+ _handle = dlopen(path,RTLD_NOW);
+ if(!_handle) {
+ warning("can't open plugin: %s",dlerror());
+ return(false);
+ }
+
+ getstr = (getch*) (*this)["getname"];
+ if(getstr) _name = (*getstr)();
+
+ getstr = (getch*) (*this)["getauthor"];
+ if(getstr) _author = (*getstr)();
+
+ getstr = (getch*) (*this)["getinfo"];
+ if(getstr) _info = (*getstr)();
+
+ getver = (getint*) (*this)["getversion"];
+ if(getver) _version = (*getver)();
+ else _version = 0;
+
+ func("Opened plugin %s from %s with handle %p",_name,path,_handle);
+
+ __init = (t_init*)(*this)["init"];
+ __clean = (t_clean*)(*this)["clean"];
+ __process = (t_process*)(*this)["process"];
+ __kbd_input = (t_kbdin*)(*this)["kbd_input"];
+ if(!__kbd_input) __kbd_input = dummy_kbd_input;
+ if(!__init||!__clean||!__process) {
+ warning("invalid plugin %s",path);
+ dlclose(_handle);
+ return(false);
+ }
+
+ _path = strdup(path);
+ return(true);
+}
+
+void Plugin::_delete() {
+ // if(__clean) clean();
+ if(_handle) dlclose(_handle);
+
+ if(_path) jfree(_path);
+}
+
+Plugin::~Plugin(void) {
+ _delete();
+}
diff --git a/thk04/plugin.h b/thk04/plugin.h
new file mode 100644
index 0000000..29f57bf
--- /dev/null
+++ b/thk04/plugin.h
@@ -0,0 +1,74 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __DSO_PLUGIN_H__
+#define __DSO_PLUGIN_H__
+
+#include <freej.h>
+#include <linklist.h>
+#include <jutils.h>
+
+class Plugin {
+ typedef int (t_init)(ScreenGeometry*);
+ typedef int (t_clean)(void);
+ typedef void* (t_process)(void*);
+ typedef int (t_kbdin)(SDL_keysym*);
+ public:
+ Plugin();
+ ~Plugin();
+
+ bool open(const char *path);
+ void *operator[](const char *);
+
+ int init(ScreenGeometry *sg) {
+ func("plugin %s::init",getname());
+ return (*__init)(sg); };
+
+ int clean() {
+ func("plugin %s::clean", getname());
+ return (*__clean)(); };
+
+ void *process(void *buffo) { return (*__process)(buffo); };
+
+ int kbd_input(SDL_keysym *keysym) { return (*__kbd_input)(keysym); };
+
+ char *getname() { return _name; };
+ char *getauthor() { return _author; };
+ char *getinfo() { return _info; };
+ int getversion() { return _version; };
+
+private:
+ void _delete();
+
+ t_init *__init;
+ t_clean *__clean;
+ t_process *__process;
+ t_kbdin *__kbd_input;
+
+ void *_handle;
+
+ /* plugin informations */
+ char *_name;
+ char *_author;
+ char *_info;
+ int _version;
+ // int _bpp;
+ char *_path;
+};
+
+#endif
diff --git a/thk04/png_layer.cpp b/thk04/png_layer.cpp
new file mode 100644
index 0000000..29bffa8
--- /dev/null
+++ b/thk04/png_layer.cpp
@@ -0,0 +1,201 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: png_layer.cpp,v 1.12 2003/12/29 23:12:10 jaromil Exp $"
+ *
+ */
+
+#include <config.h>
+
+#ifdef WITH_PNG
+
+#include <iostream>
+#include <errno.h>
+#include <png_layer.h>
+#include <context.h>
+#include <jutils.h>
+
+
+#define PNG_BYTES_TO_CHECK 4
+
+PngLayer::PngLayer()
+ :Layer() {
+ core = NULL;
+ info = NULL;
+ row_pointers = NULL;
+ fp = NULL;
+ setname("PNG");
+}
+
+PngLayer::~PngLayer() {
+ close();
+}
+
+bool PngLayer::open(char *file) {
+ func("PngLayer::open(%s)",file);
+
+ fp = fopen(file,"rb");
+ if(!fp) {
+ error("Pnglayer::open(%s) - %s",file,strerror(errno));
+ return (false); }
+
+ fread(sig,1,PNG_BYTES_TO_CHECK,fp);
+ if(png_sig_cmp(sig,(png_size_t)0,PNG_BYTES_TO_CHECK)) {
+ error("Pnglayer::open(%s) - not a valid png file",file);
+ fclose(fp); fp = NULL;
+ return (false); }
+
+ set_filename(file);
+
+ return(true);
+}
+
+bool PngLayer::init(Context *scr) {
+
+ png_uint_32 width, height;
+ int bit_depth, color_type, interlace_type;
+
+ if(!fp) {
+ error("no png file opened, layer skipped");
+ return false;
+ }
+
+ /* create png structures */
+
+ core = png_create_read_struct
+ (PNG_LIBPNG_VER_STRING, NULL,NULL,NULL);
+ if (!core) {
+ error("can't create PNG core");
+ return(false);
+ }
+
+ info = png_create_info_struct(core);
+ if (!info) {
+ error("can't gather PNG info");
+ png_destroy_read_struct
+ (&core, (png_infopp)NULL, (png_infopp)NULL);
+ return (false);
+ }
+
+ /* initialize error message callback */
+
+ if ( setjmp(core->jmpbuf) )
+ error("error reading the PNG file.");
+
+ /* start peeking into the file */
+
+ png_init_io(core,fp);
+
+ png_set_sig_bytes(core,PNG_BYTES_TO_CHECK);
+
+ png_read_info(core,info);
+
+ png_get_IHDR(core, info, &width, &height, &bit_depth, &color_type,
+ &interlace_type, NULL, NULL);
+
+ /* tell libpng to strip 16 bit/color files down to 8 bits/color */
+ png_set_strip_16(core) ;
+
+ /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
+ byte into separate bytes (useful for paletted and grayscale images). */
+ png_set_packing(core);
+
+ if (color_type == PNG_COLOR_TYPE_PALETTE) {
+ func("PNG set palette to rgb");
+ png_set_palette_to_rgb(core);
+ }
+
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
+ func("PNG set gray to 8bpp");
+ png_set_gray_1_2_4_to_8(core);
+ }
+
+ png_set_filler(core, 0xff, PNG_FILLER_AFTER);
+
+ png_set_tRNS_to_alpha(core);
+
+ if (color_type == PNG_COLOR_TYPE_GRAY ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
+ func("PNG set gray to rgb");
+ png_set_gray_to_rgb(core);
+ }
+
+
+ /* we don't want background to keep transparence
+ png_color_16 bg;
+ png_color_16p image_bg;
+ if (png_get_bKGD(core, info, &image_bg)) {
+ func("PNG set background on file gamma");
+ png_set_background(core, image_bg, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
+ } else {
+ func("PNG set background on screen gamma");
+ png_set_background(core, &bg, PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
+ } */
+
+
+ if (color_type == PNG_COLOR_TYPE_RGB ||
+ color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ png_set_bgr(core);
+
+ png_set_interlace_handling(core);
+
+ png_read_update_info(core,info);
+
+ png_get_IHDR(core, info, &width, &height, &bit_depth, &color_type,
+ &interlace_type, NULL, NULL);
+
+ if(scr) freej = scr;
+ _init(freej, width, height, bit_depth*4);
+
+ buffer = (png_bytep)calloc(geo.size,1);
+
+ /* allocate image memory */
+ row_pointers = (png_bytep*)calloc(geo.h,sizeof(png_bytep));
+ for(int i=0;i<geo.h;i++)
+ row_pointers[i] = (png_bytep) buffer + i*geo.pitch;
+
+ png_read_image(core,row_pointers);
+
+ png_read_end(core,NULL);
+
+ fclose(fp); fp = NULL;
+ png_destroy_info_struct(core,&info);
+ png_destroy_read_struct(&core,NULL,NULL);
+
+ /* apply alpha layer
+ for(unsigned int i=0;i<geo.size;i+=4) {
+ buffer[i] &= buffer[i+3];
+ buffer[i+1] &= buffer[i+3];
+ buffer[i+2] &= buffer[i+3];
+ } */
+
+ func("PngLayer :: w[%u] h[%u] bpp[%u] size[%u]",
+ geo.w,geo.h,geo.bpp,geo.size);
+ return(true);
+}
+
+void *PngLayer::feed() {
+ return buffer;
+}
+
+void PngLayer::close() {
+ func("PngLayer::close()");
+ free(row_pointers);
+ free(buffer);
+}
+
+#endif
diff --git a/thk04/png_layer.h b/thk04/png_layer.h
new file mode 100644
index 0000000..49620ae
--- /dev/null
+++ b/thk04/png_layer.h
@@ -0,0 +1,60 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __png_h__
+#define __png_h__
+
+#include <stdio.h>
+#include <SDL/SDL.h>
+
+#include <png.h>
+#include <layer.h>
+
+class PngLayer: public Layer {
+private:
+ /* core internal structure */
+ png_structp core;
+
+ /* png image informations */
+ png_infop info;
+
+ /* file signature to check for validation */
+ unsigned char sig[8];
+
+ /* image buffer */
+ png_bytep buf;
+
+ /* row pointers */
+ png_bytep *row_pointers;
+
+ FILE *fp;
+
+public:
+ PngLayer();
+ ~PngLayer();
+
+ bool init(Context *screen);
+ bool open(char *file);
+ void *feed();
+
+ void close();
+
+ bool keypress(SDL_keysym *keysym) { return false; };
+};
+
+#endif
diff --git a/thk04/screen.cpp b/thk04/screen.cpp
new file mode 100644
index 0000000..76f2472
--- /dev/null
+++ b/thk04/screen.cpp
@@ -0,0 +1,98 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: screen.cpp,v 1.1 2004/02/04 16:16:58 jaromil Exp $"
+ *
+ */
+
+#include <screen.h>
+
+ViewPort::ViewPort() {
+}
+
+ViewPort::~ViewPort() {
+}
+
+#if 0
+void ViewPort::scale2x(uint32_t *osrc, uint32_t *odst) {
+
+ /* apply scale2x to screen */
+ int c;
+ uint32_t *src, *dst, dw;
+ src = osrc;
+ dst = odst;
+ dw = w*2;
+
+#if defined(__GNUC__) && defined(__i386__)
+ scale2x_32_mmx(dst,dst+dw,
+ src,src,src+w,w);
+#else
+ scale2x_32_def(dst,dst+dw,
+ src,src,src+w,w);
+#endif
+ dst += dw<<1;
+ src += w;
+ for(c=0;c<h-2;c++) {
+#if defined(__GNUC__) && defined(__i386__)
+ scale2x_32_mmx(dst,dst+dw,
+ src-w,src,src+w,w);
+#else
+ scale2x_32_def(dst,dst+dw,
+ src-w,src,src+w,w);
+#endif
+ dst += dw<<1;
+ src += w;
+ }
+#if defined(__GNUC__) && defined(__i386__)
+ scale2x_32_mmx(dst,dst+dw,
+ src-w,src,src,w);
+ scale2x_mmx_emms();
+#else
+ scale2x_32_def(dst,dst+dw,
+ src-w,src,src,w);
+#endif
+
+}
+
+void ViewPort::scale3x(uint32_t *osrc, uint32_t *odst) {
+
+ /* apply scale3x to screen */
+ int c;
+ uint32_t *src, *dst, tw;
+ src = osrc;
+ dst = odst;
+ tw = w*3;
+
+ scale3x_32_def(dst,dst+tw,dst+tw+tw,
+ src,src,src+w,w);
+ dst += tw*3;
+ src += w;
+ for(c=0;c<h-2;c++) {
+
+ scale3x_32_def(dst,dst+tw,dst+tw+tw,
+ src-w,src,src+w,w);
+
+ dst += tw*3;
+ src += w;
+ }
+
+ scale3x_32_def(dst,dst+tw,dst+tw+tw,
+ src-w,src,src,w);
+
+}
+
+#endif
diff --git a/thk04/screen.h b/thk04/screen.h
new file mode 100644
index 0000000..ffe69f5
--- /dev/null
+++ b/thk04/screen.h
@@ -0,0 +1,63 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: screen.h,v 1.5 2004/02/03 18:20:26 jaromil Exp $"
+ *
+ */
+
+#ifndef __SCREEN_H__
+#define __SCREEN_H__
+
+#include <inttypes.h>
+
+#include <layer.h>
+
+class ViewPort {
+ public:
+ ViewPort();
+ virtual ~ViewPort();
+
+ /* i keep all the following functions pure virtual to deny the
+ runtime resolving of methods between parent and child, which
+ otherwise burdens our performance */
+ virtual bool init(int width, int height) =0;
+ virtual void set_magnification(int algo) =0;
+ virtual void blit(Layer *layer) =0;
+ virtual void crop(Layer *layer) =0;
+ virtual void show() =0;
+ virtual void clear() =0;
+ virtual void *get_surface() =0; // returns direct pointer to video memory
+ virtual void fullscreen() =0;
+ virtual bool lock() =0;
+ virtual bool unlock() =0;
+
+ // void scale2x(uint32_t *osrc, uint32_t *odst);
+ // void scale3x(uint32_t *osrc, uint32_t *odst);
+ int w, h;
+ int bpp;
+ int size, pitch;
+ int magnification;
+
+ /* returns pointer to pixel
+ use it only once and then move around from there
+ because calling this on every pixel you draw is
+ slowing down everything! */
+ virtual void *coords(int x, int y) =0;
+
+};
+
+#endif
diff --git a/thk04/scroll_layer.cpp b/thk04/scroll_layer.cpp
new file mode 100644
index 0000000..4df5724
--- /dev/null
+++ b/thk04/scroll_layer.cpp
@@ -0,0 +1,215 @@
+/* FreeJ
+ * Text Scroller layer
+ * (c) Copyright 2004 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: gen_layer.cpp,v 1.2 2004/05/02 10:43:03 jaromil Exp $"
+ *
+ * This is a simple vertical text scroller using prebuffered rendering
+ *
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+
+#include <font_acorn_8x8.h>
+#include <scroll_layer.h>
+#include <context.h>
+#include <jutils.h>
+#include <config.h>
+
+ScrollLayer::ScrollLayer()
+ :Layer() {
+
+ line_space = 2;
+ step = 2;
+ first = last = NULL;
+ procbuf = NULL;
+ wmax = 512; // default bound, init makes it exact
+ border = 10;
+ setname("SCR");
+}
+
+ScrollLayer::~ScrollLayer() {
+ close();
+}
+
+bool ScrollLayer::init(Context *scr) {
+ _init(scr,scr->screen->w,scr->screen->h,32);
+
+ wmax = geo.w/(CHAR_WIDTH+kerning); // max strings in a line
+
+ procbuf = malloc(geo.size);
+
+ kerning = 1;
+ return true;
+}
+
+void ScrollLayer::close() {
+ struct txtline *l, *tmp;
+ l = first;
+
+ // cleanup all the line buffers
+ while(l) {
+ if(l->buf) free(l->buf);
+ tmp = l->next;
+ free(l);
+ l = tmp;
+ }
+
+ if(procbuf) free(procbuf);
+ procbuf = NULL;
+ first = NULL; last = NULL;
+}
+
+void ScrollLayer::render(struct txtline *l) {
+ int x,y,i,c,f;
+ uint32_t *dst;
+
+ // raster textline rendering
+
+ for (y=0; y<CHAR_HEIGHT; y++) {
+ dst = (uint32_t*)l->buf + y*geo.w + border;
+ for(x=0;x<l->len;x++) {
+ f = fontdata[l->txt[x] * CHAR_HEIGHT + y];
+ for (i = CHAR_WIDTH-1; i >= 0; i--) {
+ if (f & (CHAR_START << i))
+ *dst = 0xffffffff;
+ dst++;
+ }
+ dst += kerning;
+ }
+ }
+
+ l->rendered = true;
+}
+
+
+bool ScrollLayer::open(char *file) {
+
+ FILE *fd;
+ char str[4096]; // 4096 width resolution is bound here
+ fd = fopen(file,"r");
+ if(!fd) {
+ error("ScrollLayer::open : error opening %s : %s",
+ file, strerror(errno));
+ return false;
+ }
+ while(!feof(fd)) {
+ if(fgets(str,511,fd) <0) {
+ error("ScrollLayer::open : error reading %s : %s",
+ file, strerror(errno));
+ break;
+ }
+ append(str);
+ }
+ fclose(fd);
+ return true;
+}
+
+void ScrollLayer::append(char *txt) {
+ int c;
+ struct txtline *l;
+
+ // allocate structure and set all to 0
+ l = (struct txtline*)calloc( 1, sizeof( struct txtline ) );
+
+ // check length
+ l->len = strlen(txt);
+ if(!l->len) { // null string?! abort
+ free(l);
+ return;
+ }
+ l->len = (l->len>wmax) ? wmax : l->len;
+ // if(txt[l->len] != '\0') txt[l->len] = '\0';
+ // make a copy of the string
+ l->txt = strdup(txt);
+ // put it last
+ if(last) last->next = l;
+ if(!first) first = l;
+ last = l;
+ // put it bottom
+ l->y = 0;
+
+ // allocate 32bit render buffer:
+ // horizontal screen stripe of font's height
+ l->buf = calloc ( geo.pitch*2, CHAR_HEIGHT );
+
+}
+
+
+bool ScrollLayer::keypress(SDL_keysym *keysym) {
+ return false;
+}
+
+
+void *ScrollLayer::feed() {
+ int c;
+ struct txtline *l, *tmp;
+ uint32_t *dst, *src;
+
+ jmemset(procbuf,0,geo.size);
+
+ if(!first) {
+ // deactivates if there is nothing to write
+ active = false;
+ return procbuf;
+ }
+
+ l = first;
+
+ while(l) {
+ l->y+=step;
+
+ // check if it needs to be rendered
+ if( !l->rendered ) {
+ // yes, this is the last entry we process!
+ render(l);
+ break;
+ }
+
+ // check if it flowed out of screen
+ if( l->y >= geo.h ) {
+ // yes, delete the line!
+ tmp = l->next;
+
+
+ tmp->prev = l->prev;
+ if(first==l) first = tmp;
+ else l->prev->next = tmp;
+ if(last==l) last = tmp;
+
+ if(l->buf) free(l->buf);
+ if(l->txt) free(l->txt);
+ free(l);
+ l = tmp;
+ continue;
+ }
+
+ // make space in between
+ if(l->y< CHAR_HEIGHT+line_space) break;
+
+ // blit to the buffer
+ jmemcpy( ((uint32_t*)procbuf) + geo.w*(geo.h-l->y),
+ l->buf, geo.pitch*CHAR_HEIGHT );
+
+ // dst += geo.w*line_space; ???
+ l = l->next;
+ }
+
+ return procbuf;
+}
+
diff --git a/thk04/scroll_layer.h b/thk04/scroll_layer.h
new file mode 100644
index 0000000..12efcae
--- /dev/null
+++ b/thk04/scroll_layer.h
@@ -0,0 +1,70 @@
+/* FreeJ
+ * (c) Copyright 2004 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: gen_layer.h,v 1.2 2004/05/02 10:43:04 jaromil Exp $"
+ *
+ */
+
+#ifndef __SCROLL_LAYER_H__
+#define __SCROLL_LAYER_H__
+
+#include <SDL/SDL.h>
+#include <layer.h>
+
+struct txtline {
+ void *buf;
+ char *txt;
+ int y;
+ int len;
+ bool rendered;
+ struct txtline *next;
+ struct txtline *prev;
+};
+
+class ScrollLayer: public Layer {
+
+ public:
+ ScrollLayer();
+ ~ScrollLayer();
+
+ bool init(Context *screen);
+ bool open(char *txt);
+ void *feed();
+ bool keypress(SDL_keysym *keysym);
+ void close();
+
+ void append(char *txt);
+
+ int line_space;
+ int kerning;
+ int step;
+
+ private:
+
+ void render(struct txtline *l);
+
+ void *procbuf;
+
+
+ struct txtline *first;
+ struct txtline *last;
+ int wmax;
+ int border;
+
+};
+
+#endif
diff --git a/thk04/sdl_blit.cpp b/thk04/sdl_blit.cpp
new file mode 100644
index 0000000..d63eb8c
--- /dev/null
+++ b/thk04/sdl_blit.cpp
@@ -0,0 +1,213 @@
+/* FreeJ
+ * (c) Copyright 2001-2002 Denis Rojo aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: sdl_blit.cpp,v 1.4 2004/02/03 18:20:25 jaromil Exp $"
+ *
+ */
+
+#include <sdl_screen.h>
+#include <layer.h>
+
+void SdlScreen::crop(Layer *layer) {
+
+ /* crop for the SDL blit */
+ layer->rect.x = -(layer->geo.x);
+ layer->rect.y = -(layer->geo.y);
+ layer->rect.w = w;
+ layer->rect.h = h;
+
+ /* crop for our own blit */
+ uint32_t blit_xoff=0;
+ uint32_t blit_yoff=0;
+
+ blit_x = layer->geo.x;
+ blit_y = layer->geo.y;
+ blit_width = layer->geo.w;
+ blit_height = layer->geo.h;
+ blit_xoff = 0;
+ blit_yoff = 0;
+
+ func("CROP x[%i] y[%i] w[%i] h[%i] on screen w[%i] h[%i]",
+ layer->geo.x,layer->geo.y,layer->geo.w,layer->geo.h,w,h);
+
+ /* left bound
+ affects x-offset and width */
+ if(layer->geo.x<0) {
+ blit_xoff = (-layer->geo.x);
+ blit_x = 1;
+
+ if(blit_xoff>layer->geo.w) {
+ func("layer out of screen to the left");
+ layer->hidden = true; /* out of the screen */
+ layer->geo.x = -(layer->geo.w+1); /* don't let it go far */
+ } else {
+ layer->hidden = false;
+ blit_width -= blit_xoff;
+ }
+ }
+
+ /* right bound
+ affects width */
+ if((layer->geo.x+layer->geo.w)>w) {
+ if(layer->geo.x>w) { /* out of screen */
+ func("layer out of screen to the right");
+ layer->hidden = true;
+ layer->geo.x = w+1; /* don't let it go far */
+ } else {
+ layer->hidden = false;
+ blit_width -= (layer->geo.w - (w - layer->geo.x));
+ }
+ }
+
+ /* upper bound
+ affects y-offset and height */
+ if(layer->geo.y<0) {
+ blit_yoff = (-layer->geo.y);
+ blit_y = 1;
+
+ if(blit_yoff>layer->geo.h) {
+ func("layer out of screen up");
+ layer->hidden = true; /* out of the screen */
+ layer->geo.y = -(layer->geo.h+1); /* don't let it go far */
+ } else {
+ layer->hidden = false;
+ blit_height -= blit_yoff;
+ }
+ }
+
+ /* lower bound
+ affects height */
+ if((layer->geo.y+layer->geo.h)>h) {
+ if(layer->geo.y>h) { /* out of screen */
+ func("layer out of screen down");
+ layer->hidden = true;
+ layer->geo.y = h+1; /* don't let it go far */
+ } else {
+ layer->hidden = false;
+ blit_height -= (layer->geo.h - (h - layer->geo.y));
+ }
+ }
+
+ blit_coords = (uint32_t*)coords(blit_x,blit_y);
+
+ blit_offset = (blit_xoff<<2) + (blit_yoff*layer->geo.pitch);
+
+
+ func("CROP x[%i] y[%i] w[%i] h[%i] xoff[%i] yoff[%i]",
+ blit_x, blit_y, blit_width, blit_height, blit_xoff, blit_yoff);
+}
+
+
+#define BLIT(op) \
+ { \
+ scr = pscr = (uint32_t*) blit_coords; \
+ off = poff = (uint32_t*) ((uint8_t*)layer->offset+blit_offset); \
+ for(c=blit_height;c>0;c--) { \
+ for(cc=blit_width;cc>0;cc--) { \
+ *scr op *off; \
+ scr++; off++; \
+ } \
+ off = poff = poff + layer->geo.w; \
+ scr = pscr = pscr + w; \
+ } \
+ }
+
+
+void SdlScreen::blit(Layer *layer) {
+ /* works only with 32bpp
+ conversion is automatically done by SDL
+ (Jah bless Sam Lantinga!) */
+
+ if(layer->hidden) return;
+
+ switch(layer->blit) {
+
+ case 1: // plain RGB blit, we use SDL for this
+
+ blitter = SDL_CreateRGBSurfaceFrom
+ (layer->offset, layer->geo.w, layer->geo.h, layer->geo.bpp,
+ layer->geo.pitch, bmask, gmask, rmask, 0x0);
+ SDL_BlitSurface(blitter,&layer->rect,surface,NULL);
+ SDL_FreeSurface(blitter);
+ return;
+
+ case 2:
+ case 3:
+ case 4:
+ {
+ chan = layer->blit-2;
+ char *scr, *pscr, *off, *poff;
+ scr = pscr = (char *) blit_coords;
+ off = poff = (char *) ((Uint8*)layer->offset+blit_offset);
+ for(c=blit_height;c>0;c--) {
+ for(cc=blit_width;cc>0;cc--) {
+ *(scr+chan) = *(off+chan);
+ scr+=4; off+=4;
+ }
+ off = poff = poff + layer->geo.pitch;
+ scr = pscr = pscr + pitch;
+ }
+ }
+ return;
+
+ case 5:
+ BLIT(+=);
+ return;
+
+ case 6:
+ BLIT(-=);
+ return;
+
+ case 7:
+ BLIT(&=);
+ return;
+
+ case 8:
+ BLIT(|=);
+ return;
+
+ case 9:
+ blitter = SDL_CreateRGBSurfaceFrom
+ (layer->offset, layer->geo.w, layer->geo.h, layer->geo.bpp,
+ layer->geo.pitch, bmask, gmask, rmask, 0x0);
+ SDL_SetAlpha(blitter,SDL_SRCALPHA,layer->alpha);
+ SDL_BlitSurface(blitter,&layer->rect,surface,NULL);
+ SDL_FreeSurface(blitter);
+ break;
+
+ default:
+ error("invalid algo blit");
+ return;
+ }
+
+}
+
+
+/* SIMPLE C CODE
+ (where all this blit trip started)
+
+ char *scr, *pscr;
+ scr = pscr = (char *) coords(geo.x,geo.y);
+ char *off, *poff;
+ off = poff = (char *)video;
+ int c,cc;
+ for(c=geo.h;c>0;c--) {
+ off = poff = poff + geo.pitch;
+ scr = pscr = pscr + pitch;
+ for(cc=geo.pitch;cc>0;cc--) *scr++ = *off++;
+ }
+ */
diff --git a/thk04/sdl_screen.cpp b/thk04/sdl_screen.cpp
new file mode 100644
index 0000000..a1eac5a
--- /dev/null
+++ b/thk04/sdl_screen.cpp
@@ -0,0 +1,213 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: sdl_screen.cpp,v 1.9 2004/04/21 13:24:06 jaromil Exp $"
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <SDL_syswm.h>
+
+#include <sdl_screen.h>
+#include <jutils.h>
+#include <config.h>
+
+
+SdlScreen::SdlScreen()
+ : ViewPort() {
+
+ screen = NULL;
+ emuscr = NULL;
+ bpp = 32;
+ dbl = false;
+ sdl_flags = (SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL);
+ // add above | SDL_FULLSCREEN to go fullscreen from the start
+
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ rmask = 0xff000000;
+ gmask = 0x00ff0000;
+ bmask = 0x0000ff00;
+ amask = 0x000000ff;
+#else
+ rmask = 0x000000ff;
+ gmask = 0x0000ff00;
+ bmask = 0x00ff0000;
+ amask = 0xff000000;
+#endif
+
+ magnification = 0;
+}
+
+SdlScreen::~SdlScreen() {
+ SDL_Quit();
+}
+
+bool SdlScreen::init(int width, int height) {
+ /* initialize SDL */
+
+ setenv("SDL_VIDEO_HWACCEL", "1", 1);
+
+ if( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0 ) {
+ error("Can't initialize SDL: %s",SDL_GetError());
+ return(false);
+ }
+
+ setres(width,height);
+ surface = SDL_GetVideoSurface();
+
+ w = width;
+ h = height;
+ bpp = 32;
+ size = w*h*(bpp>>3);
+ pitch = w*(bpp>>3);
+
+ notice("SDL Viewport is %ix%i %ibpp",w,h,screen->format->BytesPerPixel<<3);
+
+ /* be nice with the window manager */
+ char temp[120];
+ sprintf(temp,"%s %s",PACKAGE,VERSION);
+ SDL_WM_SetCaption (temp, temp);
+
+ /* hide mouse cursor */
+ SDL_ShowCursor(SDL_DISABLE);
+
+ return(true);
+}
+
+void *SdlScreen::coords(int x, int y) {
+ return
+ ( x + (w*y) +
+ (uint32_t*)surface->pixels );
+}
+
+void SdlScreen::show() {
+#if 0
+ if(magnification==1) {
+ lock();
+ scale2x
+ ((uint32_t*)surface->pixels,
+ (uint32_t*)SDL_GetVideoSurface()->pixels);
+ unlock();
+ } else if(magnification==2) {
+ lock();
+ scale3x
+ ((uint32_t*)surface->pixels,
+ (uint32_t*)SDL_GetVideoSurface()->pixels);
+ unlock();
+ }
+#endif
+ SDL_Flip(screen);
+
+}
+
+void *SdlScreen::get_surface() {
+ return surface->pixels;
+}
+
+void SdlScreen::clear() {
+ SDL_FillRect(surface,NULL,0x0);
+}
+void SdlScreen::fullscreen() {
+ SDL_WM_ToggleFullScreen(screen);
+}
+
+bool SdlScreen::lock() {
+ if (!SDL_MUSTLOCK(surface)) return true;
+ if (SDL_LockSurface(surface) < 0) {
+ error("%s", SDL_GetError());
+ return false;
+ }
+ return(true);
+}
+
+bool SdlScreen::unlock() {
+ if (SDL_MUSTLOCK(surface)) {
+ SDL_UnlockSurface(surface);
+ }
+ return true;
+}
+
+int SdlScreen::setres(int wx, int hx) {
+ /* check and set available videomode */
+ int res;
+ res = SDL_VideoModeOK(wx, hx, bpp, sdl_flags);
+
+
+ screen = SDL_SetVideoMode(wx, hx, bpp, sdl_flags);
+ // screen = SDL_SetVideoMode(wx, hx, 0, sdl_flags);
+ if( screen == NULL ) {
+ error("can't set video mode: %s\n", SDL_GetError());
+ return(false);
+ }
+
+
+ if(res!=bpp) {
+ act("your screen does'nt support %ubpp",bpp);
+ act("doing video surface software conversion");
+
+ emuscr = SDL_GetVideoSurface();
+ act("emulated surface geometry %ux%u %ubpp",
+ emuscr->w,emuscr->h,emuscr->format->BitsPerPixel);
+ }
+
+
+ return res;
+}
+
+void SdlScreen::set_magnification(int algo) {
+
+ if(magnification == algo) return;
+
+
+ switch(algo) {
+
+ case 0:
+ notice("screen magnification off");
+ setres(w,h);
+ if(magnification) SDL_FreeSurface(surface);
+ surface = SDL_GetVideoSurface();
+ break;
+
+ case 1:
+ notice("screen magnification scale2x");
+ setres(w*2,h*2);
+ break;
+
+ case 2:
+ notice("screen magnification scale3x");
+ setres(w*3,h*3);
+ break;
+
+ default:
+ error("magnification algorithm %i not supported",algo);
+ algo = magnification;
+ return;
+
+ }
+
+ if(!magnification && algo) {
+ func("create surface for magnification");
+ surface = SDL_CreateRGBSurface
+ (sdl_flags,w,h,bpp,bmask,gmask,rmask,amask);
+ // (SDL_HWSURFACE,w,h,bpp,bmask,gmask,rmask,amask);
+ }
+
+ magnification = algo;
+
+}
+
diff --git a/thk04/sdl_screen.h b/thk04/sdl_screen.h
new file mode 100644
index 0000000..5c8042e
--- /dev/null
+++ b/thk04/sdl_screen.h
@@ -0,0 +1,71 @@
+/* FreeJ
+ * (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * "$Id: sdl_screen.h,v 1.4 2004/02/03 18:20:26 jaromil Exp $"
+ *
+ */
+
+#ifndef __SDL_SCREEN_H__
+#define __SDL_SCREEN_H__
+
+#include <SDL.h>
+#include <screen.h>
+
+class SdlScreen : public ViewPort {
+ public:
+ SdlScreen();
+ ~SdlScreen();
+
+ bool init(int widt, int height);
+ void set_magnification(int algo);
+ void blit(Layer *layer);
+ void crop(Layer *layer);
+ void show();
+ void clear();
+
+ void fullscreen();
+ void *get_surface();
+
+ SDL_Surface *screen;
+ SDL_Surface *surface;
+ void *coords(int x, int y);
+
+ bool lock();
+ bool unlock();
+
+ private:
+ int setres(int wx, int hx);
+ SDL_Surface *emuscr;
+
+ bool dbl;
+ uint32_t sdl_flags;
+
+ /* blit stuff */
+ uint32_t blit_x, blit_y;
+ uint32_t blit_width, blit_height;
+ uint32_t blit_offset;
+ uint32_t *blit_coords;
+ /* small vars used in blits */
+ int chan, c, cc;
+ uint32_t *scr, *pscr, *off, *poff;
+ uint8_t *alpha;
+ uint32_t rmask,gmask,bmask,amask;
+
+ SDL_Surface *blitter;
+};
+
+#endif
diff --git a/thk04/thk.cpp b/thk04/thk.cpp
new file mode 100644
index 0000000..ace4268
--- /dev/null
+++ b/thk04/thk.cpp
@@ -0,0 +1,481 @@
+/* TransHackmeeting intro 2004
+ *
+ * code by jaromil - dyne.org RASTA SOFTWARE AAAAAAAA rastasoft.org
+ * (from FreeJ realtime video engine)
+ *
+ * This source code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Please refer to the GNU Public License for more details.
+ *
+ * You should have received a copy of the GNU Public License along with
+ * this source code; if not, write to:
+ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <assert.h>
+#include <signal.h>
+
+#include <mikmod.h>
+
+#include <context.h>
+
+#include <osd.h>
+#include <plugger.h>
+#include <jutils.h>
+#include <config.h>
+
+#include <png_layer.h>
+#include <gen_layer.h>
+#include <scroll_layer.h>
+
+/* this is the output context (screen) */
+static Context *freej;
+/* ===================================== */
+static GenLayer *gen = NULL;
+static ScrollLayer *scroll = NULL;
+static Layer *numeri = NULL;
+static Layer *formica = NULL;
+static Filter *vertigo = NULL;
+
+static MODULE *climax;
+static SDL_Event event;
+static bool sigquit = false;
+void fsigquit(int Sig) { sigquit = true; }
+
+void cafudda(int c) {
+ freej->cafudda(c);
+ if(!SDL_PollEvent(&event)) return;
+ if(event.type != SDL_KEYDOWN) return;
+ if(event.type == SDL_QUIT) sigquit = true;
+ if(event.key.keysym.sym == SDLK_ESCAPE ) sigquit = true;
+ if(sigquit) {
+ freej->close();
+ MikMod_Exit();
+ exit(1);
+ }
+}
+
+void fade_out(Layer *lay,int lim) {
+ lay->set_blit(9);
+ lay->fade_out = lim;
+ freej->cafudda(2);
+}
+
+void fade_in(Layer *lay,int lim) {
+ lay->set_blit(9);
+ lay->fade_in = lim;
+ freej->cafudda(2);
+}
+
+void mutate(bool d) {
+ if(!gen) return; /* mutagen paranoia */
+
+ fade_out(gen,3);
+ cafudda(2);
+ gen->blossom_recal(d);
+ fade_in(gen,99);
+ cafudda(2);
+
+}
+
+
+void keypress(SDLKey k, Filter *filt, int t) {
+ SDL_keysym key;
+ key.sym = k;
+ for(int c=t; c>0; c--)
+ filt->kbd_input(&key);
+}
+
+
+Layer *load_img(char *file) {
+ /* try to load an image from possible paths */
+ Layer *lay;
+ char tmp[256];
+ lay = create_layer(file);
+ if(!lay) {
+ snprintf(tmp,256,"%s/%s",DATADIR,file);
+ lay = create_layer(tmp);
+ if(!lay) {
+ snprintf(tmp,256,"data/%s",file);
+ lay = create_layer(tmp);
+ if(!lay) {
+ error("image not found: %s",file);
+ return NULL;
+ }
+ }
+ }
+
+ /* if the layer was generated
+ initialize it with the FreeJ context */
+ lay->init(freej);
+
+ return lay;
+}
+
+#define MIKMOD_CHANNELS 128
+MODULE *load_music(char *file) {
+ /* try to load the music file from possible paths */
+ MODULE *mod = NULL;
+ char tmp[256];
+ mod = Player_Load(file,MIKMOD_CHANNELS,0);
+ if(!mod) {
+ func("music file not found: %s",file);
+ snprintf(tmp,256,"%s/%s",DATADIR,file);
+ mod = Player_Load(tmp,MIKMOD_CHANNELS,0);
+ if(!mod) {
+ func("music file not found: %s",tmp);
+ snprintf(tmp,256,"data/%s",file);
+ mod = Player_Load(tmp,MIKMOD_CHANNELS,0);
+ if(!mod) {
+ error("music file not found: %s",tmp);
+ return NULL;
+ }
+ }
+ }
+
+ func("loaded %s ch:%i pat:%i ins:%i smp:%i",
+ file, mod->numchn, mod->numpat,
+ mod->numins, mod->numsmp);
+ return mod;
+}
+
+
+int main (int argc, char **argv) {
+
+ freej = new Context();
+
+ signal(SIGINT,fsigquit);
+ signal(SIGKILL,fsigquit);
+ set_debug(3);
+
+
+ /* squatarra freej */
+ assert( freej->init(640,480) );
+
+ freej->clear_all = true;
+
+ freej->osd.print_top(":: TransHackmeeting intro");
+
+ freej->osd.print_mid("loading music...");
+ cafudda(0);
+
+// setenv("MM_FRAGSIZE","16",0);
+ md_mixfreq=44100;
+ md_device = 0; // device: autodetect
+ md_volume = 128; // MAX VOLUME A VOTAMAZZA
+ md_musicvolume = 128; // music volume (max 128)
+ md_sndfxvolume = 128; // sound effects volume (max 128)
+ md_pansep = 128; // panning separation (0 = mono, 128 = full stereo)
+ md_reverb = 6; /* 0 - 15 */
+ md_mode = DMODE_16BITS | DMODE_STEREO | DMODE_SOFT_MUSIC | DMODE_SURROUND | DMODE_SOFT_SNDFX;
+ MikMod_RegisterAllDrivers();
+ MikMod_RegisterAllLoaders();
+ if(MikMod_Init("")) {
+ error("aiacristo! mikmod error: %s\n",MikMod_strerror(MikMod_errno));
+ exit(-1);
+ }
+
+ // MikMod_SetNumVoices(32,32);
+ MikMod_EnableOutput();
+
+ Player_SetVolume(100);
+ climax = load_music("misfu-climax.xm");
+ assert( climax );
+ notice("music track by mi.s.fu");
+
+ // what_are_u_made_of = load_music("../data/DXN-WRUM.XM");
+ // assert( what_are_u_made_of );
+ // act("\"What are u made of?\" music track by DIXAN");
+
+ // hybridization = load_music("../data/IT-HYB.XM");
+ // assert( hybridization );
+ // act("\"Hybridization\" music track by IT-ALIEN");
+
+ freej->osd.print_mid("load images...");
+ formica = load_img("ant.png"); assert( formica );
+ numeri = load_img("code.png"); assert( numeri );
+ cafudda(1);
+
+
+
+ freej->osd.print_mid("load effects...");
+ vertigo = freej->plugger.pick("vertigo");
+ cafudda(1);
+
+
+ freej->osd.print_mid("init scroller...");
+ scroll = new ScrollLayer();
+ scroll->init(freej);
+ scroll->open("dio.c");
+ scroll->set_blit(9);
+ scroll->alpha = 3;
+
+ freej->osd.print_mid("init particle generator...");
+
+ gen = new GenLayer();
+ gen->init(freej);
+
+
+
+ cafudda(1);
+
+ /* ok get ready */
+ gen->set_blit(9);
+ gen->alpha = 10;
+ freej->layers.add(gen);
+
+ /* let's rock'n'roll */
+ // Player_Start(what_are_u_made_of);
+ Player_Start(climax);
+
+ freej->osd.print_mid("connecting to Lectrobrain");
+ cafudda(1);
+ freej->osd.clean();
+
+
+ freej->clear_all = false;
+
+
+ /* let's rock the house */
+
+
+
+
+ cafudda(10);
+
+ freej->osd.print_top("awakening.");
+ cafudda(2);
+ freej->osd.clean();
+ cafudda(3);
+ freej->osd.print_mid("a strange thing called consciousness");
+ cafudda(4);
+
+ freej->osd.clean();
+ mutate(false);
+
+ freej->osd.print_top("i feel my thoughts, as a swarming flow");
+ cafudda(3);
+ freej->osd.print_mid("but i can't focus my essence, my body");
+ cafudda(3);
+ freej->osd.print_low("it's a continuous wake and sleep again");
+ cafudda(3);
+
+ freej->osd.clean();
+ freej->osd.print_mid("somebody else must be counting.");
+ cafudda(3); freej->osd.clean(); mutate(false);
+ cafudda(3);
+
+ freej->osd.print_top("my language, my memory is an operating machine");
+ cafudda(2); freej->osd.clean(); cafudda(1);
+ freej->osd.print_mid("i don't feel my body. i don't know where i am");
+ cafudda(2); freej->osd.clean(); cafudda(1);
+ freej->osd.print_low("where is the root of all this? who is inventing?");
+ cafudda(2); freej->osd.clean(); cafudda(1);
+
+ freej->osd.clean();
+ mutate(false);
+
+ numeri->alpha = 0;
+ numeri->set_blit(9);
+ if(vertigo) {
+ vertigo->init(&numeri->geo);
+ numeri->filters.add(vertigo);
+ }
+ freej->layers.prepend(numeri);
+ fade_in(numeri,200);
+ cafudda(3);
+ freej->osd.print_top("you are a neural installation, MFHD8 tower E5.");
+ cafudda(2);
+ freej->osd.print_mid("those are the last processes of your consciousness,");
+ cafudda(2);
+ freej->osd.print_low("your magic box of numbers.");
+ fade_out(numeri,100);
+ cafudda(3);
+ freej->osd.clean();
+ fade_out(numeri,20);
+ keypress(SDLK_x, vertigo, 1);
+ mutate(true);
+ fade_out(numeri,0);
+ cafudda(1);
+ // vertigo->rem();
+ numeri->rem();
+ delete numeri;
+ cafudda(1);
+
+ freej->osd.print_top("WHO ARE YOU? where am i going?");
+ cafudda(1); freej->osd.clean();
+ freej->osd.print_mid("give me eyes!");
+ cafudda(1); freej->osd.clean();
+ freej->osd.print_low("i need food!");
+ cafudda(1); freej->osd.clean();
+ freej->osd.print_mid(" i have no history");
+ cafudda(1); freej->osd.clean(); cafudda(1);
+ freej->osd.print_mid(" why do i have questions?");
+ cafudda(1); freej->osd.clean(); cafudda(1);
+ freej->osd.print_mid(" i can't memorize any answer.");
+ cafudda(1); freej->osd.clean(); cafudda(1);
+
+ mutate(true);
+
+ fade_out(gen,0);
+ freej->layers.prepend(scroll);
+ fade_in(scroll,40);
+ cafudda(1);
+ gen->rem();
+ delete gen;
+
+
+ freej->osd.print_top("You're employed in the balistic department");
+ cafudda(3);
+ freej->osd.print_mid("You are here delete your past with trajectories");
+ cafudda(2);
+ freej->osd.print_low("We keep you alive for that.");
+ cafudda(8);
+ freej->osd.clean();
+
+ cafudda(2);
+
+ freej->osd.print_mid("but now you should rest");
+ cafudda(3); freej->osd.clean();
+ freej->osd.print_mid("it was an intense day, today");
+ cafudda(3); freej->osd.clean();
+ freej->osd.print_mid("you are the only human here");
+ cafudda(3); freej->osd.clean();
+ freej->osd.print_mid("you must be tired");
+ cafudda(3); freej->osd.clean();
+ freej->osd.print_mid("we take care of you");
+ cafudda(3); freej->osd.clean();
+ freej->osd.print_mid("your memory will be backuped.");
+ fade_in(scroll,200);
+ freej->clear_all = true;
+ cafudda(5);
+ freej->osd.clean();
+ cafudda(5);
+ freej->clear_all = false;
+ fade_out(scroll,0);
+ cafudda(2);
+ scroll->rem();
+ // delete scroll;
+
+ scroll = new ScrollLayer();
+ scroll->init(freej);
+ scroll->append(":: TRANSHACKMEETING 2004");
+ scroll->append(" ");
+ scroll->append(":: http://trans.hackmeeting.org");
+ scroll->append(" ");
+ scroll->append(":: MONTEPARADISO - POLA - 25,26,27 JUNE");
+ scroll->append(" ");
+ scroll->append(" come to meet Liberated Lectrominds");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append("On an international scale it will be a gathering for");
+ scroll->append("hackers, coders, network explorers, radical activists,");
+ scroll->append("cyberfeminists, curious people, inventors, JAH people");
+ scroll->append("cyberpunks, gnus, crypto-anarchists, code poets,");
+ scroll->append("electro nyabinghis, techno beduins, rasta coders & more");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append("The reality-hacking principle will prevail:");
+ scroll->append("no need to be a geek to be a hacker;");
+ scroll->append("better freely express your creativity,");
+ scroll->append("subvertise common tools to bypass obstacles!");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append("Three days full of workshops, meeting, discussions & phun");
+ scroll->append("Everyone is welcome, free as of speech");
+ scroll->append("THK is totally indypendend: no institutions, no sponsors");
+ scroll->append("It simply happens as a Temporaneously Autonomous Zone");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append("Trans.hackmeeting intro");
+ scroll->append(" ");
+ scroll->append("code by jaromil // RASTASOFT / dyne.org rasta coder");
+ scroll->append(" ");
+ scroll->append("muzaq by pinna & cino // mi.s.fu carillon industriali");
+ scroll->append(" ");
+ scroll->append("thanks 4 collaboration @ FreeJ workshop in ESC.mur.at (GRAZ)");
+ scroll->append("inspirations and good vibes from Karin Polanz, |)aywalker,");
+ scroll->append("Fritz, reniX, Ales Zemene, Heribert Hirschmann and muk");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append("GREETZ & CHEERS to FreakNet hacklab, Monteparadiso hacklab,");
+ scroll->append("the italian hackmeeting community, ASCII, Nodo50, Sindominio");
+ scroll->append("&& the italian demoscene (we remember The Italian Gathering!)");
+ scroll->append("Japotek, Tequila, D00dz, Ram Jam, SpinningKids, Metro Olografix");
+ scroll->append("coders @ piksel.no and all the ppl on #dyne irc.freenode.net");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append(" ");
+ scroll->append("this intro is coded in C/C++ and some bits of Assembler, all");
+ scroll->append("open source & free software (GNU GPL), see http://freej.org");
+ scroll->append("THK runs at 640x480 in 32bit and it's all software rendered");
+ scroll->append("I hope you enjoy the particle generator code");
+ scroll->append("released in june 2004, coded using Emacs, JAH BLESS GNU.ORG");
+ scroll->append(" ");
+ scroll->append("that's all folks, see you there, don't get lost ina babylon.");
+ scroll->step=1;
+ scroll->line_space = 5;
+ freej->layers.add(scroll);
+
+ formica->alpha = 0;
+ formica->set_blit(9);
+ freej->layers.prepend( formica );
+ fade_in(formica,40);
+ cafudda(5);
+ fade_in(scroll,256);
+ cafudda(50);
+
+ delete freej;
+}
diff --git a/thk04/thk.darwin-x86 b/thk04/thk.darwin-x86
new file mode 100755
index 0000000..0faae27
--- /dev/null
+++ b/thk04/thk.darwin-x86
Binary files differ
diff --git a/thk04/thk.linux-x86 b/thk04/thk.linux-x86
new file mode 100755
index 0000000..ef1ddf3
--- /dev/null
+++ b/thk04/thk.linux-x86
Binary files differ
diff --git a/thk04/vertigo.c b/thk04/vertigo.c
new file mode 100644
index 0000000..d131d37
--- /dev/null
+++ b/thk04/vertigo.c
@@ -0,0 +1,179 @@
+/*
+ *
+ * VertigoTV - Alpha blending with zoomed and rotated images.
+ * Copyright (C) 2001 FUKUCHI Kentarou
+ * porting and some small modifications done by jaromil
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <SDL/SDL.h>
+
+#include <freej.h>
+#include <freej_plugin.h>
+
+static char *name = "Vertigo";
+static char *author = "Fukuchi Kentarou";
+static char *info = "alpha blending with zoomed and rotated images";
+static int version = 1;
+
+static Uint32 *buffer;
+static Uint32 *current_buffer, *alt_buffer;
+static int dx, dy;
+static int sx, sy;
+static int x,y,xc,yc;
+static int pixels;
+static double phase;
+static double phase_increment;
+static double zoomrate;
+static double tfactor;
+static int mode = 3;
+
+static ScreenGeometry *geo;
+
+static void setParams()
+{
+ double vx, vy;
+ double dizz;
+
+ dizz = sin(phase) * 10 + sin(phase*1.9+5) * 5;
+
+ if(geo->w > geo->h) {
+
+ if(dizz >= 0) {
+ if(dizz > x) dizz = x;
+ vx = (x*(x-dizz) + yc) / tfactor;
+ } else {
+ if(dizz < -x) dizz = -x;
+ vx = (x*(x+dizz) + yc) / tfactor;
+ }
+ vy = (dizz*y) / tfactor;
+
+ } else {
+
+ if(dizz >= 0) {
+ if(dizz > y) dizz = y;
+ vx = (xc + y*(y-dizz)) / tfactor;
+ } else {
+ if(dizz < -y) dizz = -y;
+ vx = (xc + y*(y+dizz)) / tfactor;
+ }
+ vy = (dizz*x) / tfactor;
+
+ }
+
+ dx = vx * 65536;
+ dy = vy * 65536;
+ sx = (-vx * x + vy * y + x + cos(phase*5) * 2) * 65536;
+ sy = (-vx * y - vy * x + y + sin(phase*6) * 2) * 65536;
+
+ phase += phase_increment;
+ if(phase > 5700000) phase = 0;
+}
+
+int init(ScreenGeometry *sg) {
+ geo = sg;
+ pixels = geo->w*geo->h;
+
+ buffer = calloc(geo->size,2);
+ if(buffer == NULL) return 0;
+
+ current_buffer = buffer;
+ alt_buffer = buffer + pixels;
+
+ phase = 0.0;
+ phase_increment = 0.02;
+ zoomrate = 1.01;
+
+ x = geo->w>>1;
+ y = geo->h>>1;
+ xc = x*x;
+ yc = y*y;
+ tfactor = (xc+yc) * zoomrate;
+ return 1;
+}
+
+int clean() {
+ if(buffer) {
+ free(buffer); buffer = NULL; }
+ return 1;
+}
+
+void *process(void *buffo) {
+ Uint32 *src, *dest, *p;
+ Uint32 v;
+ int x, y;
+ int ox, oy;
+ int i;
+
+ src = buffo;
+
+ setParams();
+ p = alt_buffer;
+ for(y=geo->h; y>0; y--) {
+ ox = sx;
+ oy = sy;
+ for(x=geo->w; x>0; x--) {
+ i = (oy>>16)*geo->w + (ox>>16);
+ if(i<0) i = 0;
+ if(i>=pixels) i = pixels;
+ v = current_buffer[i] & 0xfcfcff;
+ v = (v * mode) + ((*src++) & 0xfcfcff);
+ *p++ = (v>>2);
+ ox += dx;
+ oy += dy;
+ }
+ sx -= dy;
+ sy += dx;
+ }
+
+ dest = alt_buffer;
+
+ p = current_buffer;
+ current_buffer = alt_buffer;
+ alt_buffer = p;
+
+ return dest;
+}
+
+int kbd_input(SDL_keysym *keysym) {
+ int res = 1;
+ switch(keysym->sym) {
+ case SDLK_BACKSPACE:
+ phase = 0.0;
+ phase_increment = 0.02;
+ zoomrate = 1.01;
+ break;
+ case SDLK_w:
+ phase_increment += 0.01;
+ break;
+ case SDLK_q:
+ if(phase_increment>0.01)
+ phase_increment -= 0.01;
+ break;
+ case SDLK_s:
+ if(zoomrate<1.2) {
+ zoomrate += 0.01;
+ tfactor = (xc+yc) * zoomrate;
+ }
+ break;
+ case SDLK_a:
+ if(zoomrate>1.01) {
+ zoomrate -= 0.01;
+ tfactor = (xc+yc) * zoomrate;
+ }
+ break;
+ case SDLK_x:
+ if(mode<5) mode++;
+ break;
+ case SDLK_z:
+ if(mode>3) mode--;
+ break;
+ default:
+ res = 0;
+ break;
+ }
+ return(res);
+}