commit
29076d4cef
@ -0,0 +1,81 @@
|
||||
|
||||
GNUBOY INSTALLATION
|
||||
|
||||
|
||||
*NIX SYSTEMS
|
||||
|
||||
One or more of the following is required to compile on *nix: X, SDL,
|
||||
svgalib, or Linux fbcon. Since basically everyone has X, this should
|
||||
not be a problem. Please note that the SDL and fbcon ports are the
|
||||
most functional, however. In the future, Sun console may also be
|
||||
supported.
|
||||
|
||||
The best and easiest way to build gnuboy for *nix is with the
|
||||
configure script:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
By default, heavy optimization and asm cpu and graphics cores will be
|
||||
used if available on your platform. For information on compiletime
|
||||
options related to performance and debugging, type:
|
||||
|
||||
./configure --help
|
||||
|
||||
Alternatively, if you don't like the GNU configure script, you may
|
||||
copy the Makefile.nix to Makefile and edit it by hand to work with
|
||||
your system. Make sure you uncomment -DIS_LITTLE_ENDIAN if your cpu is
|
||||
little endian. Please note that not everything is supported when
|
||||
compiling this way, and that it should only be done as a last resort.
|
||||
The generic Makefile.nix may be removed in the future since it's extra
|
||||
work to maintain.
|
||||
|
||||
Running make should produce the binaries xgnuboy, fbgnuboy, sgnuboy
|
||||
and/or sdlgnuboy, depending on the availability of the various
|
||||
interface libraries on your host. The install target will install
|
||||
these to $(prefix)/bin, where prefix is specified to configure in the
|
||||
usual way. The default prefix is of course /usr/local/.
|
||||
|
||||
Binary packages may be available for some platforms, but they are
|
||||
usually not quite up to date, and are not built or supported by the
|
||||
gnuboy team.
|
||||
|
||||
Binary package maintainers should be aware that, by default, gnuboy
|
||||
will be built with optimizations specific to the exact host cpu it's
|
||||
being compiled on, and may not work on older models. If you want your
|
||||
binaries to work with older systems too, run configure with the
|
||||
--disable-arch option to disable architecture specific compiler flags.
|
||||
|
||||
|
||||
WINDOWS
|
||||
|
||||
Mingw32 and the SDL development files are required to compile gnuboy
|
||||
for Windows. They may be obtained from www.mingw.org and
|
||||
www.libsdl.org, respectively.
|
||||
|
||||
Just copy Makefile.mingw32 to Makefile and run make. When done, put
|
||||
the resulting gnuboy.exe wherever you wish to install it.
|
||||
|
||||
Precompiled binaries are also available for Windows; check the site
|
||||
from which you obtained gnuboy to see if it provides copies.
|
||||
|
||||
|
||||
DOS
|
||||
|
||||
You'll need djgpp to use the included Makefile. Theoretically it
|
||||
shouldn't be hard to port the dos-specific modules to work with other
|
||||
compilers, but I see no reason why it should be necessary.
|
||||
|
||||
Since all DOS systems are basically alike, just copy Makefile.dos to
|
||||
Makefile and type "make" to compile gnuboy. No configuration should be
|
||||
necessary. If you do have build problems, let us know.
|
||||
|
||||
After compiling, place gnuboy.exe wherever you want.
|
||||
|
||||
Precompiled binaries are also available for DOS; check the site from
|
||||
which you obtained gnuboy to see if it provides copies.
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
AS = $(CC)
|
||||
LD = $(CC)
|
||||
|
||||
CFLAGS = -O3 -fstrength-reduce -fomit-frame-pointer -I./asm/i386
|
||||
ASFLAGS = -x assembler-with-cpp
|
||||
LDFLAGS = -s
|
||||
|
||||
THIN_NAMES = tl_main tl_log tl_timer tl_key tl_mouse tl_joy tl_dpp tl_event \
|
||||
tl_bmp tl_vesa tl_vga tl_video tl_sb tl_sound tl_int
|
||||
THIN_OBJS = $(THIN_NAMES:%=sys/thinlib/lib/%.o)
|
||||
|
||||
SYS_DEFS = -DIS_LITTLE_ENDIAN -DALLOW_UNALIGNED_IO -DALT_PATH_SEP -DUSE_ASM
|
||||
|
||||
SYS_INCS = -I./sys/dos -I./sys/thinlib/lib
|
||||
SYS_OBJS = sys/dos/dos.o sys/thinlib/thinlib.o sys/thinlib/keymap.o $(THIN_OBJS) \
|
||||
asm/i386/cpu.o asm/i386/lcd.o asm/i386/refresh.o
|
||||
|
||||
all: gnuboy.exe
|
||||
|
||||
include Rules
|
||||
|
||||
gnuboy.exe: $(OBJS) $(SYS_OBJS)
|
||||
$(LD) $(CFLAGS) $(LDFLAGS) $(OBJS) $(SYS_OBJS) -o $@
|
||||
|
||||
clean:
|
||||
rm -f gnuboy.exe gmon.out *.o sys/*.o sys/dos/*.o sys/pc/*.o asm/i386/*.o \
|
||||
sys/thinlib/*.o sys/thinlib/*.exe sys/thinlib/*.o
|
@ -0,0 +1,70 @@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
|
||||
CC = @CC@
|
||||
LD = $(CC)
|
||||
AS = $(CC)
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = $(CFLAGS) @LDFLAGS@
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
TARGETS = @TARGETS@
|
||||
|
||||
ASM_OBJS = @ASM_OBJS@
|
||||
|
||||
SYS_DEFS = @DEFS@ @ENDIAN@ @ASM@ @SYS_DEFS@
|
||||
SYS_OBJS = sys/nix/nix.o $(ASM_OBJS)
|
||||
SYS_INCS = -I/usr/local/include @XINCS@ -I./sys/nix
|
||||
|
||||
FB_OBJS = @FB_OBJS@ @JOY@ @SOUND@
|
||||
FB_LIBS =
|
||||
|
||||
SVGA_OBJS = sys/svga/svgalib.o sys/pc/keymap.o @JOY@ @SOUND@
|
||||
SVGA_LIBS = -L/usr/local/lib -lvga
|
||||
|
||||
SDL_OBJS = sys/sdl/sdl.o sys/sdl/keymap.o
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
|
||||
X11_OBJS = sys/x11/xlib.o sys/x11/keymap.o @JOY@ @SOUND@
|
||||
X11_LIBS = @XLIBS@ -lX11 -lXext
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
include Rules
|
||||
|
||||
fbgnuboy: $(OBJS) $(SYS_OBJS) $(FB_OBJS)
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(SYS_OBJS) $(FB_OBJS) -o $@ $(FB_LIBS)
|
||||
|
||||
sgnuboy: $(OBJS) $(SYS_OBJS) $(SVGA_OBJS)
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(SYS_OBJS) $(SVGA_OBJS) -o $@ $(SVGA_LIBS)
|
||||
|
||||
sdlgnuboy: $(OBJS) $(SYS_OBJS) $(SDL_OBJS)
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(SYS_OBJS) $(SDL_OBJS) -o $@ $(SDL_LIBS)
|
||||
|
||||
sys/sdl/sdl.o: sys/sdl/sdl.c
|
||||
$(MYCC) $(SDL_CFLAGS) -c $< -o $@
|
||||
|
||||
sys/sdl/keymap.o: sys/sdl/keymap.c
|
||||
$(MYCC) $(SDL_CFLAGS) -c $< -o $@
|
||||
|
||||
xgnuboy: $(OBJS) $(SYS_OBJS) $(X11_OBJS)
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(SYS_OBJS) $(X11_OBJS) -o $@ $(X11_LIBS)
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d $(bindir)
|
||||
$(INSTALL) -m 755 $(TARGETS) $(bindir)
|
||||
|
||||
clean:
|
||||
rm -f *gnuboy gmon.out *.o sys/*.o sys/*/*.o asm/*/*.o
|
||||
|
||||
distclean: clean
|
||||
rm -f config.* sys/nix/config.h Makefile
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,64 @@
|
||||
#
|
||||
# Makefile.nix
|
||||
#
|
||||
# This is a *bare minimum* makefile for building gnuboy on *nix systems.
|
||||
# If you have trouble with the configure script you can try using this,
|
||||
# but *please* try the configure script first. This file is mostly
|
||||
# unmaintained and may break.
|
||||
#
|
||||
# If you *do* insist on using this makefile, you at least need to check
|
||||
# SYS_DEFS below and uncomment -DIS_LITTLE_ENDIAN if your system is
|
||||
# little endian. Also, you may want to enable the OSS sound module if
|
||||
# your system supports it.
|
||||
#
|
||||
|
||||
prefix = /usr/local
|
||||
bindir = /bin
|
||||
|
||||
CC = gcc
|
||||
AS = $(CC)
|
||||
LD = $(CC)
|
||||
INSTALL = /bin/install -c
|
||||
|
||||
CFLAGS = -O3
|
||||
LDFLAGS =
|
||||
ASFLAGS =
|
||||
|
||||
SYS_DEFS = #-DIS_LITTLE_ENDIAN
|
||||
ASM_OBJS =
|
||||
#SND_OBJS = sys/oss/oss.o
|
||||
SND_OBJS = sys/dummy/nosound.o
|
||||
JOY_OBJS = sys/dummy/nojoy.o
|
||||
|
||||
TARGETS = xgnuboy
|
||||
|
||||
SYS_OBJS = sys/nix/nix.o $(ASM_OBJS) $(SND_OBJS) $(JOY_OBJS)
|
||||
SYS_INCS = -I/usr/local/include -I/usr/X11R6/include -I./sys/nix
|
||||
|
||||
X11_OBJS = sys/x11/xlib.o sys/x11/keymap.o
|
||||
X11_LIBS = -L/usr/X11R6/lib -lX11 -lXext
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
include Rules
|
||||
|
||||
xgnuboy: $(OBJS) $(SYS_OBJS) $(X11_OBJS)
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(SYS_OBJS) $(X11_OBJS) -o $@ $(X11_LIBS)
|
||||
|
||||
install: all
|
||||
$(INSTALL) -m 755 $(TARGETS) $(prefix)$(bindir)
|
||||
|
||||
clean:
|
||||
rm -f *gnuboy gmon.out *.o sys/*.o sys/*/*.o asm/*/*.o
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
|
||||
CC = gcc
|
||||
AS = $(CC)
|
||||
LD = $(CC)
|
||||
|
||||
CFLAGS = -O3 -I./asm/i386 -Dmain=SDL_main
|
||||
LDFLAGS = -s -lmingw32 -lSDLmain -lSDL
|
||||
ASFLAGS = -x assembler-with-cpp
|
||||
|
||||
SYS_DEFS = -DIS_LITTLE_ENDIAN -DALT_PATH_SEP -DUSE_ASM
|
||||
ASM_OBJS = asm/i386/cpu.o asm/i386/lcd.o asm/i386/refresh.o
|
||||
#SND_OBJS = sys/dummy/nosound.o
|
||||
|
||||
SYS_OBJS = $(ASM_OBJS) $(SND_OBJS) sys/windows/windows.o sys/windows/resource.o
|
||||
SYS_INCS = -I./sys/windows
|
||||
|
||||
SDL_OBJS = sys/sdl/sdl.o sys/sdl/keymap.o
|
||||
SDL_LIBS = -lSDL
|
||||
|
||||
all: gnuboy
|
||||
|
||||
include Rules
|
||||
|
||||
%.o: %.rc
|
||||
windres -o $@ $<
|
||||
|
||||
gnuboy: $(OBJS) $(SYS_OBJS) $(SDL_OBJS)
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(SYS_OBJS) $(SDL_OBJS) -o $@ $(SDL_LIBS)
|
||||
|
||||
clean:
|
||||
rm -f gnuboy.exe *.o sys/*.o sys/*/*.o asm/*/*.o
|
@ -0,0 +1,199 @@
|
||||
|
||||
GNUBOY README
|
||||
|
||||
|
||||
INTRO
|
||||
|
||||
Welcome to gnuboy, one of the few pieces of Free Software to emulate
|
||||
the Game Boy handheld game console. Written in ANSI C with a few
|
||||
optional assembler optimizations for particular cpus, gnuboy supports
|
||||
a wide range of host systems, and has been tested successfully on:
|
||||
|
||||
GNU/Linux
|
||||
FreeBSD
|
||||
OpenBSD
|
||||
BeOS
|
||||
Linux/390 (IBM S/390 Mainframe)
|
||||
SunOS/Sun Ultra60
|
||||
IRIX/SGI O2
|
||||
IRIX/SGI Indy
|
||||
AIX/Unknown
|
||||
DR-DOS
|
||||
MS-DOS
|
||||
Windows DOS box
|
||||
Windows 9x/NT/2k
|
||||
|
||||
Additionally, gnuboy should run on any other *nix variants that have
|
||||
ANSI C compilers and that are remotely POSIX compliant. As gnuboy is
|
||||
Free Software, you're welcome to fix any problems you encounter
|
||||
building it for a particular system, or to port it to entirely new
|
||||
systems.
|
||||
|
||||
|
||||
EMULATION
|
||||
|
||||
gnuboy emulates nearly all aspects of the (Color) Gameboy, including
|
||||
all of the following and much more:
|
||||
|
||||
Full GBZ80 instruction set.
|
||||
Scanline-based LCD engine.
|
||||
Ten sprites per scanline limit.
|
||||
Support for all CGB graphics extensions.
|
||||
Sprite DMA, HDMA, and GDMA.
|
||||
All four sound channels including digital samples.
|
||||
MBC1, MBC2, MBC3 (including clock), and MBC5 mappers.
|
||||
Wave pattern memory corruption when sound channel 3 is played.
|
||||
Pad, timer, divide counter, and other basic hardware registers.
|
||||
CGB double-speed CPU mode.
|
||||
|
||||
Aspects not emulated at this time include:
|
||||
|
||||
* Serial IO (link cable).
|
||||
Undocumented 'extra' ram in OAM space on Gameboy Color.
|
||||
All Super Gameboy extensions.
|
||||
* GBC, HuC1, and HuC3 IR ports.
|
||||
* Obscure mappers such as TAMA5.
|
||||
Sorting sprites by X coordinate in DMG mode.
|
||||
HALT instruction skipping in DMG mode.
|
||||
CPU stalls during HDMA and GDMA.
|
||||
|
||||
Only the two marked by * are known to affect the playability of
|
||||
actual games or demos; the rest are just listed for completeness'
|
||||
sake.
|
||||
|
||||
|
||||
FEATURES
|
||||
|
||||
In addition to basic emulation, gnuboy provides the following
|
||||
features:
|
||||
|
||||
Highly flexible keybinding and configuration subsystem.
|
||||
State saving and loading at any point.
|
||||
Very precise timing/synchronization, preserved across save/load.
|
||||
Joystick support on Linux, DOS, and all SDL-based ports.
|
||||
Fully customizable palettes for DMG games.
|
||||
Screen scaling by a factor of 2, 3, or 4 in all ports.
|
||||
Hardware-based screen scaling on platforms where it's available.
|
||||
Debug traces to stdout.
|
||||
Dynamic palette allocation when run in 256-color modes...
|
||||
OR simulated 3/3/2 bits per channel in 256-color modes.
|
||||
|
||||
For information on configuring and using these features, see the
|
||||
additional documentation in the "docs" directory.
|
||||
|
||||
|
||||
COMPATIBILITY
|
||||
|
||||
Out of over 300 results reported by testers, all games are known to
|
||||
work perfectly on gnuboy with the following exceptions:
|
||||
|
||||
Fighting Phoenix (Japanese) may or may not work since it uses the
|
||||
HuC1 memory controller, which is not implemented properly. There has
|
||||
been no report either way so far.
|
||||
|
||||
Pocket Bomberman (Japanese version, which uses HuC1) runs, but can
|
||||
be made to crash if the player jumps into the ceiling in the first
|
||||
level. It's not clear whether this bug is MBC-related, something
|
||||
else, or an actual bug in the original game.
|
||||
|
||||
Monster Go! Go! Go! (Japanese) is unplayable. The cause of the
|
||||
problem is not fully known, but it's either a very bad dump or it's
|
||||
using some sort of specialized MBC that's not documented.
|
||||
|
||||
Final Fantasy Adventure has visual problems with the fade between
|
||||
screens. Does not affect gameplay.
|
||||
|
||||
Bubble Bobble 2 has some minor tile glitches right before gameplay
|
||||
actually begins. Cause unknown. Does not affect gameplay.
|
||||
|
||||
Alone in the Dark is reported to have minor visual glitches. I
|
||||
haven't seen it myself so I can't judge their severity.
|
||||
|
||||
Both new Zelda games are reported to have a visual glitch at the
|
||||
beginning of the game, and on certain other screens. I haven't seen
|
||||
the problem myself, but supposedly it impacts gameplay to some
|
||||
extent.
|
||||
|
||||
Please report any other incompatibilities discovered directly to
|
||||
gnuboy@unix-fu.org, so that they can be documented and hopefully
|
||||
fixed.
|
||||
|
||||
|
||||
FUTURE / WISHLIST
|
||||
|
||||
Here's a brief list of what may appear in gnuboy in the future:
|
||||
|
||||
Screenshots.
|
||||
Integrated debugger.
|
||||
Super Gameboy support.
|
||||
Serial link over the internet.
|
||||
Serial link to a real Gameboy with a custom cable.
|
||||
Configurable color filters to provide more authentic LCD look.
|
||||
Custom colorization of DMG games on a per-tile basis.
|
||||
Support for more colorspaces in the hardware scaler.
|
||||
Recording audio.
|
||||
GBS player built from the same source tree.
|
||||
Full recording and playback of emulation.
|
||||
So-called "high level emulation" of certain typical dumb loops.
|
||||
|
||||
Features that are not likely to appear soon or at all include:
|
||||
|
||||
Rumble support - this would be nice, but SDL doesn't seem to support
|
||||
force-feedback yet. We'll see about it in the long-term though.
|
||||
|
||||
Eagle/2xSaI/etc. - probably not feasible since these libraries don't
|
||||
appear to be compatible with the terms of the GPL. We might work on
|
||||
our own interpolation engine eventually, but that's low priority.
|
||||
|
||||
GUI/GUI-like features - such things are best handled by external
|
||||
front-ends. We might eventually add a mechanism for external
|
||||
programs to communicate with gnuboy and reconfigure it while it's
|
||||
running, however.
|
||||
|
||||
Plugins - NO! The way I see it, plugins are just an attempt to work
|
||||
around the GPL. In any case, even if you are adding plugin support
|
||||
yourself, you are bound by the terms of the GPL when linking ANY
|
||||
code to gnuboy, including dynamic-linked modules. However we'd
|
||||
rather not deal with this mess to begin with.
|
||||
|
||||
Compressed ROMs/Saves - this one is very iffy. On most systems, this
|
||||
is redundant; *nix users can just pipe the rom through a
|
||||
decompression program, and Windows users can just double-click or
|
||||
drag files from their favorite GUI unzipper program. Linking to zlib
|
||||
isn't really acceptable since it's massively bloated and we don't
|
||||
want to include it with gnuboy or add external dependencies. We may,
|
||||
however, write our own tiny decompressor to use at some point.
|
||||
|
||||
Ideas and suggestions for other features are welcome, but won't
|
||||
necessarily be used. You're of course also free to add features
|
||||
yourself, and if they fit well into the main tree they may eventually
|
||||
get included in the official release. See the file HACKING for more
|
||||
details on modifying and/or contributing.
|
||||
|
||||
|
||||
THANKS
|
||||
|
||||
Thanks goes out to everyone who's expressed interest in gnuboy by
|
||||
writing -- users, porters, authors of other emulators, and so forth.
|
||||
Apologies if we don't get a personal response out to everyone, but
|
||||
either way, consider your feedback appreciated.
|
||||
|
||||
|
||||
EPILOGUE
|
||||
|
||||
OK, that looks like about it. More to come, stick around...
|
||||
|
||||
|
||||
|
||||
-Laguna <laguna@aerifal.cx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
|
||||
include Version
|
||||
|
||||
OBJS = lcd.o refresh.o lcdc.o palette.o cpu.o mem.o rtc.o hw.o sound.o \
|
||||
events.o keytable.o \
|
||||
loader.o save.o debug.o emu.o main.o \
|
||||
rccmds.o rckeys.o rcvars.o rcfile.o exports.o \
|
||||
split.o path.o inflate.o
|
||||
|
||||
INCS = -I.
|
||||
|
||||
MYCC = $(CC) $(CFLAGS) $(INCS) $(SYS_INCS) $(SYS_DEFS)
|
||||
MYAS = $(AS) $(ASFLAGS) $(INCS) $(SYS_INCS) $(SYS_DEFS)
|
||||
|
||||
main.o: Version
|
||||
|
||||
.c.o:
|
||||
$(MYCC) -c $< -o $@
|
||||
|
||||
.s.o:
|
||||
$(MYAS) -c $< -o $@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
#ifndef __ASM_H__
|
||||
#define __ASM_H__
|
||||
|
||||
|
||||
|
||||
#define ASM_CPU_EMULATE
|
||||
#define ASM_CPU_STEP
|
||||
|
||||
#define ASM_REFRESH_1
|
||||
#define ASM_REFRESH_2
|
||||
#define ASM_REFRESH_3
|
||||
#define ASM_REFRESH_4
|
||||
|
||||
#define ASM_REFRESH_1_2X
|
||||
#define ASM_REFRESH_2_2X
|
||||
#define ASM_REFRESH_4_2X
|
||||
|
||||
#define ASM_REFRESH_1_3X
|
||||
#define ASM_REFRESH_2_3X
|
||||
#define ASM_REFRESH_4_3X
|
||||
|
||||
#define ASM_REFRESH_4_4X
|
||||
|
||||
#define ASM_UPDATEPATPIX
|
||||
|
||||
#define ASM_BG_SCAN_COLOR
|
||||
|
||||
|
||||
|
||||
#endif /* __ASM_H__ */
|
||||
|
||||
|
||||
|
@ -0,0 +1,41 @@
|
||||
|
||||
|
||||
#define cpu _cpu
|
||||
#define hw _hw
|
||||
#define ram _ram
|
||||
#define mbc _mbc
|
||||
#define lcd _lcd
|
||||
#define scan _scan
|
||||
#define patpix _patpix
|
||||
#define anydirty _anydirty
|
||||
#define patdirty _patdirty
|
||||
#define cpu_emulate _cpu_emulate
|
||||
#define cpu_step _cpu_step
|
||||
#define lcdc_trans _lcdc_trans
|
||||
#define debug_trace _debug_trace
|
||||
#define updatepatpix _updatepatpix
|
||||
#define debug_disassemble _debug_disassemble
|
||||
#define bg_scan_color _bg_scan_color
|
||||
#define refresh_1 _refresh_1
|
||||
#define refresh_2 _refresh_2
|
||||
#define refresh_3 _refresh_3
|
||||
#define refresh_4 _refresh_4
|
||||
#define refresh_1_2x _refresh_1_2x
|
||||
#define refresh_2_2x _refresh_2_2x
|
||||
#define refresh_3_2x _refresh_3_2x
|
||||
#define refresh_4_2x _refresh_4_2x
|
||||
#define refresh_1_3x _refresh_1_3x
|
||||
#define refresh_2_3x _refresh_2_3x
|
||||
#define refresh_3_3x _refresh_3_3x
|
||||
#define refresh_4_3x _refresh_4_3x
|
||||
#define refresh_1_4x _refresh_1_4x
|
||||
#define refresh_2_4x _refresh_2_4x
|
||||
#define refresh_3_4x _refresh_3_4x
|
||||
#define refresh_4_4x _refresh_4_4x
|
||||
#define mem_read _mem_read
|
||||
#define mem_write _mem_write
|
||||
#define cpu_idle _cpu_idle
|
||||
#define die _die
|
||||
#define printf _printf
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,290 @@
|
||||
|
||||
#include "asmnames.h"
|
||||
|
||||
.set vram, lcd
|
||||
.set buf, scan+512
|
||||
.set pal1, scan+768
|
||||
.set pal2, scan+896
|
||||
.set pal4, scan+1024
|
||||
|
||||
.set bg, scan
|
||||
.set buf, scan+512
|
||||
.set u, scan+1792+24
|
||||
.set v, scan+1792+28
|
||||
.set wx, scan+1792+32
|
||||
|
||||
.data
|
||||
.balign 4
|
||||
|
||||
|
||||
.text
|
||||
.balign 32
|
||||
|
||||
debug: .string "%08x\n"
|
||||
|
||||
.macro _print arg=0
|
||||
pushf
|
||||
pusha
|
||||
movl \arg, %eax
|
||||
pushl %eax
|
||||
pushl $debug
|
||||
call printf
|
||||
addl $8, %esp
|
||||
popa
|
||||
popf
|
||||
.endm
|
||||
|
||||
.macro _patexpand k=0
|
||||
movw (%esi,%ecx,2), %ax
|
||||
andl $(0x0101<<\k), %eax
|
||||
addb $0xff, %al
|
||||
sbbb %bl, %bl
|
||||
addb $0xff, %ah
|
||||
sbbb %bh, %bh
|
||||
andl $0x0201, %ebx
|
||||
orb %bh, %bl
|
||||
movb %bl, patpix+7-\k(%ebp,%ecx,8)
|
||||
.endm
|
||||
|
||||
.macro _fastswap k=0
|
||||
movl patpix+(16*\k)(%ebp), %eax
|
||||
movl patpix+4+(16*\k)(%ebp), %ebx
|
||||
movl patpix+8+(16*\k)(%ebp), %ecx
|
||||
movl patpix+12+(16*\k)(%ebp), %edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
movl %eax, patpix+1024*64+4+(16*\k)(%ebp)
|
||||
movl %ebx, patpix+1024*64+(16*\k)(%ebp)
|
||||
movl %ecx, patpix+1024*64+12+(16*\k)(%ebp)
|
||||
movl %edx, patpix+1024*64+8+(16*\k)(%ebp)
|
||||
.endm
|
||||
|
||||
|
||||
|
||||
.globl updatepatpix
|
||||
updatepatpix:
|
||||
movb anydirty, %al
|
||||
testb %al, %al
|
||||
jnz .Lupdatepatpix
|
||||
ret
|
||||
|
||||
.Lupdatepatpix:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
movl $895, %edi
|
||||
.Lmainloop:
|
||||
cmpl $511, %edi
|
||||
jnz .Lnoskip
|
||||
movl $383, %edi
|
||||
.Lnoskip:
|
||||
movb patdirty(%edi), %al
|
||||
testb %al, %al
|
||||
jnz .Lpatdirty
|
||||
decl %edi
|
||||
jnl .Lmainloop
|
||||
jmp .Lend
|
||||
.Lpatdirty:
|
||||
movb $0, %al
|
||||
movb %al, patdirty(%edi)
|
||||
movl %edi, %eax
|
||||
movl $vram, %esi
|
||||
shll $4, %eax
|
||||
addl %eax, %esi
|
||||
|
||||
movl $7, %ecx
|
||||
movl %edi, %ebp
|
||||
shll $6, %ebp
|
||||
.Lexpandline:
|
||||
_patexpand 0
|
||||
_patexpand 1
|
||||
_patexpand 2
|
||||
_patexpand 3
|
||||
_patexpand 4
|
||||
_patexpand 5
|
||||
_patexpand 6
|
||||
_patexpand 7
|
||||
decl %ecx
|
||||
jnl .Lexpandline
|
||||
|
||||
_fastswap 0
|
||||
_fastswap 1
|
||||
_fastswap 2
|
||||
_fastswap 3
|
||||
|
||||
movl patpix(%ebp), %eax
|
||||
movl patpix+4(%ebp), %ebx
|
||||
movl patpix+8(%ebp), %ecx
|
||||
movl patpix+12(%ebp), %edx
|
||||
movl %eax, patpix+2048*64+56(%ebp)
|
||||
movl %ebx, patpix+2048*64+60(%ebp)
|
||||
movl %ecx, patpix+2048*64+48(%ebp)
|
||||
movl %edx, patpix+2048*64+52(%ebp)
|
||||
movl patpix+16(%ebp), %eax
|
||||
movl patpix+20(%ebp), %ebx
|
||||
movl patpix+24(%ebp), %ecx
|
||||
movl patpix+28(%ebp), %edx
|
||||
movl %eax, patpix+2048*64+40(%ebp)
|
||||
movl %ebx, patpix+2048*64+44(%ebp)
|
||||
movl %ecx, patpix+2048*64+32(%ebp)
|
||||
movl %edx, patpix+2048*64+36(%ebp)
|
||||
movl patpix+32(%ebp), %eax
|
||||
movl patpix+36(%ebp), %ebx
|
||||
movl patpix+40(%ebp), %ecx
|
||||
movl patpix+44(%ebp), %edx
|
||||
movl %eax, patpix+2048*64+24(%ebp)
|
||||
movl %ebx, patpix+2048*64+28(%ebp)
|
||||
movl %ecx, patpix+2048*64+16(%ebp)
|
||||
movl %edx, patpix+2048*64+20(%ebp)
|
||||
movl patpix+48(%ebp), %eax
|
||||
movl patpix+52(%ebp), %ebx
|
||||
movl patpix+56(%ebp), %ecx
|
||||
movl patpix+60(%ebp), %edx
|
||||
movl %eax, patpix+2048*64+8(%ebp)
|
||||
movl %ebx, patpix+2048*64+12(%ebp)
|
||||
movl %ecx, patpix+2048*64(%ebp)
|
||||
movl %edx, patpix+2048*64+4(%ebp)
|
||||
|
||||
movl patpix+1024*64(%ebp), %eax
|
||||
movl patpix+1024*64+4(%ebp), %ebx
|
||||
movl patpix+1024*64+8(%ebp), %ecx
|
||||
movl patpix+1024*64+12(%ebp), %edx
|
||||
movl %eax, patpix+3072*64+56(%ebp)
|
||||
movl %ebx, patpix+3072*64+60(%ebp)
|
||||
movl %ecx, patpix+3072*64+48(%ebp)
|
||||
movl %edx, patpix+3072*64+52(%ebp)
|
||||
movl patpix+1024*64+16(%ebp), %eax
|
||||
movl patpix+1024*64+20(%ebp), %ebx
|
||||
movl patpix+1024*64+24(%ebp), %ecx
|
||||
movl patpix+1024*64+28(%ebp), %edx
|
||||
movl %eax, patpix+3072*64+40(%ebp)
|
||||
movl %ebx, patpix+3072*64+44(%ebp)
|
||||
movl %ecx, patpix+3072*64+32(%ebp)
|
||||
movl %edx, patpix+3072*64+36(%ebp)
|
||||
movl patpix+1024*64+32(%ebp), %eax
|
||||
movl patpix+1024*64+36(%ebp), %ebx
|
||||
movl patpix+1024*64+40(%ebp), %ecx
|
||||
movl patpix+1024*64+44(%ebp), %edx
|
||||
movl %eax, patpix+3072*64+24(%ebp)
|
||||
movl %ebx, patpix+3072*64+28(%ebp)
|
||||
movl %ecx, patpix+3072*64+16(%ebp)
|
||||
movl %edx, patpix+3072*64+20(%ebp)
|
||||
movl patpix+1024*64+48(%ebp), %eax
|
||||
movl patpix+1024*64+52(%ebp), %ebx
|
||||
movl patpix+1024*64+56(%ebp), %ecx
|
||||
movl patpix+1024*64+60(%ebp), %edx
|
||||
movl %eax, patpix+3072*64+8(%ebp)
|
||||
movl %ebx, patpix+3072*64+12(%ebp)
|
||||
movl %ecx, patpix+3072*64(%ebp)
|
||||
movl %edx, patpix+3072*64+4(%ebp)
|
||||
|
||||
decl %edi
|
||||
jnl .Lmainloop
|
||||
.Lend:
|
||||
movb $0, %al
|
||||
movb %al, anydirty
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
|
||||
|
||||
.globl bg_scan_color
|
||||
bg_scan_color:
|
||||
movb wx, %ch
|
||||
cmpb $0, %ch
|
||||
jb .Lbsc_done_nopop
|
||||
pushl %ebx
|
||||
pushl %ebp
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl v, %eax
|
||||
movl $bg, %esi
|
||||
movl $buf, %edi
|
||||
leal patpix(,%eax,8), %ebp
|
||||
movl (%esi), %eax
|
||||
movl u, %ebx
|
||||
shll $6, %eax
|
||||
movb $-8, %cl
|
||||
addl %ebx, %eax
|
||||
addb %bl, %cl
|
||||
movb 4(%esi), %bl
|
||||
addl $8, %esi
|
||||
addb %cl, %ch
|
||||
.Lbsc_preloop:
|
||||
movb (%ebp,%eax), %dl
|
||||
incl %eax
|
||||
orb %bl, %dl
|
||||
movb %dl, (%edi)
|
||||
incl %edi
|
||||
incb %cl
|
||||
jnz .Lbsc_preloop
|
||||
cmpb $0, %ch
|
||||
jb .Lbsc_done
|
||||
subb $8, %ch
|
||||
.Lbsc_loop:
|
||||
movl (%esi), %eax
|
||||
movl 4(%esi), %edx
|
||||
shll $6, %eax
|
||||
movb %dl, %dh
|
||||
addl $8, %esi
|
||||
movl %edx, %ebx
|
||||
rorl $16, %edx
|
||||
orl %edx, %ebx
|
||||
movl (%ebp,%eax), %edx
|
||||
orl %ebx, %edx
|
||||
movl %edx, (%edi)
|
||||
movl 4(%ebp,%eax), %edx
|
||||
orl %ebx, %edx
|
||||
movl %edx, 4(%edi)
|
||||
addl $8, %edi
|
||||
subb $8, %ch
|
||||
jae .Lbsc_loop
|
||||
addb $8, %ch
|
||||
jz .Lbsc_done
|
||||
movl (%esi), %eax
|
||||
shll $6, %eax
|
||||
movb 4(%esi), %bl
|
||||
.Lbsc_postloop:
|
||||
movb (%ebp,%eax), %dl
|
||||
incl %eax
|
||||
orb %bl, %dl
|
||||
movb %dl, (%edi)
|
||||
incl %edi
|
||||
decb %ch
|
||||
jnz .Lbsc_postloop
|
||||
.Lbsc_done:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebp
|
||||
popl %ebx
|
||||
.Lbsc_done_nopop:
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,285 @@
|
||||
|
||||
|
||||
#include "asmnames.h"
|
||||
|
||||
.text
|
||||
|
||||
.macro _enter
|
||||
pushl %ebx
|
||||
pushl %ebp
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl 20(%esp), %edi
|
||||
movl 24(%esp), %esi
|
||||
movl 28(%esp), %ebp
|
||||
movl 32(%esp), %ecx
|
||||
xorl %eax, %eax
|
||||
xorl %ebx, %ebx
|
||||
.endm
|
||||
|
||||
.macro _leave
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebp
|
||||
popl %ebx
|
||||
ret
|
||||
.endm
|
||||
|
||||
|
||||
.globl refresh_1
|
||||
refresh_1:
|
||||
_enter
|
||||
subl $4, %esi
|
||||
subl $4, %edi
|
||||
shrl $2, %ecx
|
||||
.Lrefresh_1:
|
||||
movb 2(%esi,%ecx,4), %al
|
||||
movb 3(%esi,%ecx,4), %bl
|
||||
movb (%ebp, %eax), %dl
|
||||
movb (%esi,%ecx,4), %al
|
||||
movb (%ebp, %ebx), %dh
|
||||
movb 1(%esi,%ecx,4), %bl
|
||||
rorl $16, %edx
|
||||
movb (%ebp, %eax), %dl
|
||||
movb (%ebp, %ebx), %dh
|
||||
movl %edx, (%edi,%ecx,4)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_1
|
||||
_leave
|
||||
|
||||
.globl refresh_2
|
||||
refresh_2:
|
||||
_enter
|
||||
subl $2, %esi
|
||||
subl $4, %edi
|
||||
shrl $1, %ecx
|
||||
.Lrefresh_2:
|
||||
movb 1(%esi,%ecx,2), %al
|
||||
movb (%esi,%ecx,2), %bl
|
||||
movw (%ebp,%eax,2), %dx
|
||||
rorl $16, %edx
|
||||
movw (%ebp,%ebx,2), %dx
|
||||
movl %edx, (%edi,%ecx,4)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_2
|
||||
_leave
|
||||
|
||||
.globl refresh_3
|
||||
refresh_3:
|
||||
_enter
|
||||
subl $2, %esi
|
||||
leal (%ecx,%ecx,2), %edx
|
||||
shrl $1, %ecx
|
||||
addl %edx, %edi
|
||||
.Lrefresh_3:
|
||||
movb (%esi,%ecx,2), %al
|
||||
subl $6, %edi
|
||||
movb 1(%esi,%ecx,2), %bl
|
||||
movl (%ebp,%eax,4), %edx
|
||||
movb %dl, (%edi)
|
||||
movb 2(%ebp,%eax,4), %dl
|
||||
movb %dh, 1(%edi)
|
||||
movb %dl, 2(%edi)
|
||||
movl (%ebp,%ebx,4), %edx
|
||||
movb %dl, 3(%edi)
|
||||
movb 2(%ebp,%ebx,4), %dl
|
||||
movb %dh, 4(%edi)
|
||||
movb %dl, 5(%edi)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_3
|
||||
_leave
|
||||
|
||||
.globl refresh_4
|
||||
refresh_4:
|
||||
_enter
|
||||
subl $2, %esi
|
||||
subl $8, %edi
|
||||
shrl $1, %ecx
|
||||
.Lrefresh_4:
|
||||
movb (%esi,%ecx,2), %al
|
||||
movb 1(%esi,%ecx,2), %bl
|
||||
movl (%ebp,%eax,4), %edx
|
||||
movl %edx, (%edi,%ecx,8)
|
||||
movl (%ebp,%ebx,4), %edx
|
||||
movl %edx, 4(%edi,%ecx,8)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_4
|
||||
_leave
|
||||
|
||||
|
||||
|
||||
.globl refresh_1_2x
|
||||
refresh_1_2x:
|
||||
_enter
|
||||
subl $2, %esi
|
||||
subl $4, %edi
|
||||
shrl $1, %ecx
|
||||
.Lrefresh_1_2x:
|
||||
movb 1(%esi,%ecx,2), %al
|
||||
movb (%esi,%ecx,2), %bl
|
||||
movb (%ebp,%eax), %al
|
||||
movb %al, %dl
|
||||
movb %al, %dh
|
||||
movb (%ebp,%ebx), %bl
|
||||
rorl $16, %edx
|
||||
movb %bl, %dl
|
||||
movb %bl, %dh
|
||||
movl %edx, (%edi,%ecx,4)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_1_2x
|
||||
_leave
|
||||
|
||||
|
||||
|
||||
|
||||
.globl refresh_2_2x
|
||||
refresh_2_2x:
|
||||
_enter
|
||||
subl $2, %esi
|
||||
subl $8, %edi
|
||||
shrl $1, %ecx
|
||||
.Lrefresh_2_2x:
|
||||
movb (%esi,%ecx,2), %al
|
||||
movb 1(%esi,%ecx,2), %bl
|
||||
movw (%ebp,%eax,2), %dx
|
||||
rorl $16, %edx
|
||||
movw (%ebp,%eax,2), %dx
|
||||
movl %edx, (%edi,%ecx,8)
|
||||
movw (%ebp,%ebx,2), %dx
|
||||
rorl $16, %edx
|
||||
movw (%ebp,%ebx,2), %dx
|
||||
movl %edx, 4(%edi,%ecx,8)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_2_2x
|
||||
_leave
|
||||
|
||||
|
||||
|
||||
.globl refresh_4_2x
|
||||
refresh_4_2x:
|
||||
_enter
|
||||
subl $2, %esi
|
||||
subl $16, %edi
|
||||
.Lrefresh_4_2x:
|
||||
movb (%esi,%ecx), %al
|
||||
movb 1(%esi,%ecx), %bl
|
||||
movl (%ebp,%eax,4), %edx
|
||||
movl %edx, (%edi,%ecx,8)
|
||||
movl %edx, 4(%edi,%ecx,8)
|
||||
movl (%ebp,%ebx,4), %edx
|
||||
movl %edx, 8(%edi,%ecx,8)
|
||||
movl %edx, 12(%edi,%ecx,8)
|
||||
subl $2, %ecx
|
||||
jnz .Lrefresh_4_2x
|
||||
_leave
|
||||
|
||||
|
||||
|
||||
|
||||
.globl refrsh_1_3x
|
||||
refresh_1_3x:
|
||||
_enter
|
||||
leal (%ecx,%ecx,2), %edx
|
||||
shrl $1, %ecx
|
||||
addl %edx, %edi
|
||||
subl $2, %esi
|
||||
.Lrefresh_1_3x:
|
||||
movb (%esi,%ecx,2), %al
|
||||
subl $6, %edi
|
||||
movb 1(%esi,%ecx,2), %bl
|
||||
movb (%ebp,%eax,2), %dl
|
||||
movb %dl, (%edi)
|
||||
movb %dl, 1(%edi)
|
||||
movb %dl, 2(%edi)
|
||||
movb (%ebp,%ebx,2), %dl
|
||||
movb %dl, 3(%edi)
|
||||
movb %dl, 4(%edi)
|
||||
movb %dl, 5(%edi)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_1_3x
|
||||
_leave
|
||||
|
||||
|
||||
.globl refresh_2_3x
|
||||
refresh_2_3x:
|
||||
_enter
|
||||
shll $1, %ecx
|
||||
addl %ecx, %edi
|
||||
addl %ecx, %edi
|
||||
addl %ecx, %edi
|
||||
shrl $2, %ecx
|
||||
subl $2, %esi
|
||||
.Lrefresh_2_3x:
|
||||
movb (%esi,%ecx,2), %al
|
||||
subl $12, %edi
|
||||
movb 1(%esi,%ecx,2), %bl
|
||||
movw (%ebp,%eax,2), %dx
|
||||
movw %dx, (%edi)
|
||||
movw %dx, 2(%edi)
|
||||
movw %dx, 4(%edi)
|
||||
movw (%ebp,%ebx,2), %dx
|
||||
movw %dx, 6(%edi)
|
||||
movw %dx, 8(%edi)
|
||||
movw %dx, 10(%edi)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_2_3x
|
||||
_leave
|
||||
|
||||
|
||||
|
||||
.globl refresh_4_3x
|
||||
refresh_4_3x:
|
||||
_enter
|
||||
shll $2, %ecx
|
||||
addl %ecx, %edi
|
||||
addl %ecx, %edi
|
||||
addl %ecx, %edi
|
||||
shrl $3, %ecx
|
||||
subl $2, %esi
|
||||
.Lrefresh_4_3x:
|
||||
movb (%esi,%ecx,2), %al
|
||||
subl $24, %edi
|
||||
movb 1(%esi,%ecx,2), %bl
|
||||
movl (%ebp,%eax,4), %edx
|
||||
movl %edx, (%edi)
|
||||
movl %edx, 4(%edi)
|
||||
movl %edx, 8(%edi)
|
||||
movl (%ebp,%ebx,4), %edx
|
||||
movl %edx, 12(%edi)
|
||||
movl %edx, 16(%edi)
|
||||
movl %edx, 20(%edi)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_4_3x
|
||||
_leave
|
||||
|
||||
|
||||
.globl refresh_4_4x
|
||||
refresh_4_4x:
|
||||
_enter
|
||||
shll $4, %ecx
|
||||
addl %ecx, %edi
|
||||
shrl $5, %ecx
|
||||
subl $2, %esi
|
||||
.Lrefresh_4_4x:
|
||||
movb (%esi,%ecx,2), %al
|
||||
subl $32, %edi
|
||||
movb 1(%esi,%ecx,2), %bl
|
||||
movl (%ebp,%eax,4), %edx
|
||||
movl %edx, (%edi)
|
||||
movl %edx, 4(%edi)
|
||||
movl %edx, 8(%edi)
|
||||
movl %edx, 12(%edi)
|
||||
movl (%ebp,%ebx,4), %edx
|
||||
movl %edx, 16(%edi)
|
||||
movl %edx, 20(%edi)
|
||||
movl %edx, 24(%edi)
|
||||
movl %edx, 28(%edi)
|
||||
decl %ecx
|
||||
jnz .Lrefresh_4_4x
|
||||
_leave
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,259 @@
|
||||
|
||||
AC_INIT(cpu.c)
|
||||
|
||||
CFLAGS="$CFLAGS"
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
|
||||
|
||||
test "$cross_compiling" = "yes" || AC_C_BIGENDIAN
|
||||
test "$ac_cv_c_bigendian" = "no" && ENDIAN="-DIS_LITTLE_ENDIAN"
|
||||
|
||||
|
||||
|
||||
AC_CHECK_FUNCS(usleep, ,[
|
||||
AC_CHECK_FUNCS(select, ,[
|
||||
AC_MSG_ERROR(your system must support either usleep or select)
|
||||
])])
|
||||
|
||||
|
||||
|
||||
|
||||
LIBS="$LIBS -L/usr/local/lib -L/usr/X11R6/lib"
|
||||
|
||||
|