Imported upstream source for E-UAE WIP4

This commit is contained in:
simon.kagstrom 2009-05-05 15:36:48 +00:00
commit 21fae99949
488 changed files with 200786 additions and 0 deletions

541
CHANGES Normal file
View File

@ -0,0 +1,541 @@
20040302
- Fix building of SCSI emulation on OS X. Update config script to link with
IOKit framework when building against libscg on OS X. Update install_scg
script to re-run ranlib on libscg/libschily on OS X after copying.
- Tweaks for building scsi emulation on BeOS.
- Tidied up sleep code. Reimplemented my_usleep() to uae_msleep() which
takes a sleep duration in milliseconds rather then usecs.
- Misc clean-ups in preparation for getting stuff merged in WinUAE tree.
- Hacked support in config script for compiling against libscg/libschily
external to source tree (this needs tidying up). Yet more options -
--with-libscg-prefix etc.
- Bug in libscg block driver was causing segfault when CD32 was reset. Fixed.
- Libscg block driver wasn't clearing SCSI error codes before executing SCSI
inquiry or test unit ready commands (I was passing args in the wrong order
to memset. Ooops!). This was causing problems when scanning the SCSI bus
(particularly for real SCSI busses on the host) and was causing CD32
emulation to fail to detect disk changes. Fixed.
20040222
- Only build enforcer when we have JIT/natmem support.
- Begin merging GTK+ changes back (bearing in mind that this time GTK thread
is secondary again). GUI can again be opened after emulation proper has
been started and failure to open GTK+ GUI will not cause UAE to fail.
- Fix configure script with regard to libscg. When building in source tree,
add current directory to library path.
- Fix configure script with regard to CAPS. Use CPPFLAGS rather than CFLAGS
to specify directory to include CAPS header from.
- Fix install_libscg script to work on *BSD (and OS X). Problems still exist
linking on OS X due to the whacky linker there.
- Replace mode sense/select 6 to 10 translation in libscg block device driver
with calls to the new generic code imported from WinUAE 0.8.25.
- Merged WinUAE 0.8.25
- Back out GTK+ GUI changes. It seems that running the GUI as the primary
thread and SDL as the secondary really hurts performance. Also back out
SDL timers for clock speed calibration since it's not needed now.
- Added config option --enable-enforcer
- Added AHI emulation glue from WinUAE (this includes support for WinUAE
enforcer, etc.) This hodge-podge of code is in misc.c (for want of a
better place to put it). AHI emulation still needs porting and back-ends
for the various sound drivers supported (which will be fun).
- Merged changes from WinUAE 0.8.24
- Fixed bug in libscg driver which was causing segfault on reset
20040219 (not publicly released)
- CD led display now works.
- Assorted fixes for building akiko (CD32) emulation.
- Implemented block device driver using cdrtools 2.0.x's libscg (this is
largely based on the old scsidev driver). CD/DVD devices only are
currently supported.
- Quick fix for the Unix bsdsocket emulation, so that it no longer directly
requires POSIX threads, semaphores and thread-local storage. This fixes
many problems when UAE is built against SDL. It should also now work
on OS X with SDL now, but it still doesn't on BeOS due to limitations with
the BeOS socket API. Many problems remain, and a re-write is still needed.
- Support for IPF (CAPS) floppy images added.
- Use SDL timers for calibration in md-i386-gcc when building with SDL.
Using POSIX timers directly can screw threading. This is currently less
accurate, and requires a longer calibration period.
- Fix for building on older SDL versions without mousewheel support.
- Fixes for SDL sound which were causing threading problems.
- Implement the Gtk+ LEDs updates as a separate callback. This lets us
schedule the events callback more frequently.
- Make GTK+ GUI thread the main thread which launches the UAE thread (rather
than vice-versa). Makes the code slightly cleaner, and allows the GUI to
be opened after the emulation is started. The use_gui config file option
now means that the GUI is not opened at start-up, but may be opened later.
Added hotkey combination F12 + Enter to SDL and X11 targets to for this
purpose.
- Work-around that allows filesystems to be mounted from host ISO filesystems
when flagged as read/write in the config file. On systems with statvfs() and
on Linux (where statvfs() is not used because of broken implementations) UAE
will now mount such filesystems as read-only. More work needed here.
- On md-ppc-gcc target, make m68k CPU flags a bitfield. This generates better
code.
- SDL gfx driver was broken on 8-bit host displays. Fixed for both native and
P96 screens. Try running UAE on the Linux framebuffer device at 8-bit if
you want to see some serious speed.
20040129
- Ta da! JIT now works on BeOS/x86 (albeit without direct memory support).
Still, it gives 10x the speed of pure interpretation. I finally sussed
what was causing the stack problems - cpuopti! Solution: don't run cpuopti
on platforms that can't handle the x86 assembly magic in newcpu.c for
calling opcode handlers - e.g. BeOS. Obvious when ya think about it. ;-)
- Merged and updated Axel's BeOS sound driver from BeUAE. Sound quality is
still poor on my system - but somewhat less so. ;-)
- Config file support for running xres/mimeset on the compiled binary when
targetting BeOS. Added Axel's resource file to the dist.
- Tidied up BeOS floppy image dialog. If invoked in full-screen mode, UAE
will now try and switch to windowed mode before opening the dialog.
20040126
- Dist was missing a file from src/gfx-x11. Fixed.
- Typo in OS x raw key driver. Fixed.
20040125
- In Amiga target, set the UAE processes's pr_WindowPtr to ensure requesters
appear on UAE's screen.
- Tidy up Amiga gfx target. Remove Graffiti support. Add new Amiga-specific
options to configure the type of screen UAE runs on (still more to do).
- Allow comments again in cfgfiles. Lines beginning with '#' will be ignored.
- Remove hacks in sleep.c.
- Add support for popping up floppy dialogs in Gtk+ UI in response to
gui_display() callback from UAE.
- Fix raw keyboard handling with SDL target. If the SDL window loses focus
when keys are held down, SDL generates key-up events with 0 keycode for
the keys that are pressed. UAE couldn't generate proper key-up events and
keys were 'sticking'. Respond to loss of focus and force keys to be
'released'.
- Initial implementation of main.cpp for BeOS.
- Break out gui stubs from beos.cpp into separate file gui.cpp. Implemented
gui_message() via a BAlert and implemented file dialog for inserting disk
images.
- Fix fsusage.c on BeOS. The K&R declaration for adjust_blocks() was
screwing up the compiler for some reason.
- Fix to fsusage.c to build on systems with a working SVR4 statvfs() (many
non-glibc Unices). I had forgotten to revert back to using STAT_STATVFS
rather than HAVE_STATVFS. Thanks to Ian Chapman for reporting the problem
and testing the fix.
- Comment out JIT debugging messages in the Linux segv handler with
#ifdef JIT_DEBUG like the win32 handler does. The user doesn't need to be
worried by all those scary messages.
- Fix GCC-specific abort() macro to call exit() rather than abort(). This
ensures that any atexit() routines are called - and the user will get
their X display back.
- Fix AmigaOS POSIX semaphore emulation so that the semaphore thread is always
killed at exit (previously it wouldn't be unless all sempahores had been
deleted).
- Move disk image requester code from ami-win.c to ami-gui.c. Now used in
response to an appropriate gui_display() call.
- Re-implemented gui_message() in AmigaOS target to display messages as
EasyRequest requesters.
- Re-implemented and cleaned up keyboard handling in AmigaOS target to fully use
inputdevice.c and new hotkey key code. AmigaOS now supports a similar range
of hotkeys as X11 and SDL targets - all starting with Ctrl+LAlt rather
than F12.
- Implemented os-target main.c support (e.g., for start-up and support code).
Factored out break handling from the gfx targets and implemented it in the
various os targets.
- Added option sdl.map_raw_keys to allow the choice between mapping cooked
or raw keys with SDL gfx target.
- Added support for parsing gfx-target options.
- Separated gfx target from OS target. Unix target is now called 'unix'
rather than the previously confusing 'x11'. Gfx targets include 'x11',
'sdl', etc.
- Inputdevice handling overhaul (work-in-progress)
* Got rid of the input-dummy.c hack and implemented the necessary code in
each of the gfx drivers.
* Cleaned up and simplified input handling in X11 and SDL targets, now
re-using more code from inputdevice.c.
* Implemented mouse wheel support in X11 and SDL targets.
* Initial implementation of target-independent hotkey handling.
* Initial support for target-independent raw key mapping (currently used in
SDL only).
- Screen mode tweaks to SDL gfx target. SDL not supplying precisely the mode
you asked for should cause fewer problems now. UAE also now asks for a hardware
surface (which works with, e.g., the dga and fbcon SDL video drivers).
- Implemented simple on-screen P96 RectFills and Blits using SDL blitting
functions (this can double the scroll speed of CON: windows even when
running in a SW surface).
- Lots of changes to the P96 emulation bringing in new code from Win32
version - fixes the annoying scroll bug with CON: windows. (The big-endian
red/blue swapping bug which can occur with some types of blits on 32-bit
screens remains - and I'm convinced it's a bug in P96 itself. ;-)
- GUI tweaks to go with the --disable-natmem option.
- Added new config option --disable-natmem to build the JIT without direct
memory access. This should let the JIT build on other x86 Unices and
Unix-likes (JIT direct memory is currently dependent on x86/Linux segv
signal handling) until we can make it more portable. It'll also now
build on BeOS, although it bombs at run-time. Something strange seems to
be going on with the stack there, I think.
- Tweaks to let compemu_support.c build without sys/mman.h (e.g. on BeOS)
- Merged changes from my 0.8.23 branch. This means we're now based on WinUAE
0.8.23.
- Hacked in support for building GTK+ GUI with GTK+2.x (the config script
will prefer GTK+2.x over GTK+1.x if both are available).
- Began importing new GTK+ GUI elements, starting with new CPU prefs page.
This'll now let you play with idling (if you're JIT-enabled) and my
busy-wait switch. (I'm not happy with the layout of this page, however, so]
it'll change again for the next release.)
- Bumped AmigaOS default stack to 32k (it uses a lot more when run on
AmigaOS < 3.9 for some reason).
- Tweaks for building on MorphOS. It now builds against ixemul, but not
libnix (there appears to be a lot missing from MorphOS's implementation of
libnix). I cannot test it, however, 'cos I ain't got MorphOS.
20040107
- Fix for floppy data not being initialized to 0 when allocated on the heap
(when SAVE_MEMORY is defined).
- Fix for typo in gfx-x11/xwin.c which was causing compilation to fail
(thanks to Giacomo Magnini for spotting this one).
- Add __stack declaration to AmigaOS target to enable automatic enlargement
of stack with libnix's swapstack module if the stack size is too low on
start-up. Set min size to 16384 for now, which stack snooping reveals is
erring heavily on the side of caution. I don't want to use stack
checking/extension code because UAE is already slow enough on a classic
Amiga. ;-)
20040106
- Fix for libnix auto-opening libraries on AmigaOS target and thus asking
for inflated version numbers (it asks for v37 of everything by default).
- Fix typos in BeOS implementation of fsusage.
20040104
- Use sample8_handler() rather than ULAW handler for 8-bit mono audio in SDL
sound driver.
- Fix switching of audio interpolation mode in x11 and SDL gfx targets.
- Define PICASSO96_SUPPORTED declaration in targets/t-beos.h when building
with SDL so that P96 support will be included.
- Renamed set_alarm function in md-i386-gcc/support.c since it conflicts
with a BeOS kernel function.
- Added a -version command-line option.
- Added full package version string to about page in Gtk UI (if defined).
- Fixed HD LED on no-gui, AmigaOS and BeOS targets.
- Re-did my implementation of POSIX semaphores for AmigaOS target. My
previous version didn't work, since it was pretty much a straightforward
mapping of POSIX semaphores onto Exec semaphores - but, since POSIX sems
don't have an owner whereas Exec sems do, this obviously wasn't going to
do the job. Doh! Should read docs more carefully in future. The new
implementation uses message-passing with a semaphore server thread to
achieve locking - and, as an added bonus, locking now obeys break signals.
Filesystem threads and hardfile support now both work on AmigaOS. Yay!
- Implemented fsuage for BeOS.
- Implemented new BeOS sound driver.
- Detect libossaudio in config script to enable use of OSS audio on
NetBSD/OpenBSD. Swap order of OSS and Sun audio in config script, so that
Sun audio is preferred over OSS on NetBSD etc.
- Port od-beos/beos.cpp to new inputdevice API.
- Disable BeOS sound driver. Needs to be rewritten.
- Break out BeOS joystick code to separate file (joystick.cpp) and port to new
inputdevice API. Now uses enhanced joystick API (although currently
support only 1 stick).
- Tweaks to od-beos/beos.cpp to get it closer to compiling.
- Use snooze() for my_usleep() on BeOS
- Fix x11 gfx target so it'll build without P96 support.
- Don't define NO_MAIN_IN_MAIN_C when compiling against SDL on BeOS. This'll
need to be changed later if we want the BeOS GUI to work with SDL target.
- Fixed P96 support in x11 target
- Added a log statement when retrying a hardfile mounted as read/write but
without write permission as read-only.
- Fixed hardfile-unix.c to obey read-only flag.
- Fixed expansion.c to build without P96
- Fixed display of FPS counter on AmigaOS, GTK+ and no-gui targets.
- Merged new autoconf 2.5x/automake build system. Still very much a
work-in-progress. Advanatges: more flexible, more config options, better
support for cross-compiling and for building in separate directory.
- Fixed a serious typo: sleep was being used instead of usleep (if nanosleep
was not available).
- Merged updated sleep code from my 0.8.23 branch. For systems with rpt, UAE
will now test the chosen sleep routine and decide whether busy waiting is
necessary or not. (If it takes 10ms or more to do a 1ms sleep, then busy-wait
by default. The user will be eevntually able to turn this off with a config
option.)
- When building with the SAVE_MEMORY option, allocate floppy data at
run-time. This shaves MBs off the BSS size and means that the AmigaOS
binary doesn't need such a large unfragmented piece of memory to run.
- Make memory.h include osdep/memory.h to pick up OS-specific options.
AmigaOS version now picks up the SAVE_MEMORY option correctly.
- Fixed AmigaOS gfx driver not clearing screen properly
- Implemented fsusage for AmigaOS
- Implemented frame timing for classic (m68k) AmigaOS using the EClock.
- Implemented AmigaOS threading/semaphore code (not complete).
- Implemented AmigaOS joystick driver using gameport.device
- Applied patch from Giuseppe Ghibò to re-enable the -h command-line option
to show information about config options.
- Renamed the bsdsocket.c to bsdsocket-posix.c and imported the old
bsdsocket.c file (as used by WinUAE). Hopefully one day there can be some
reconciliation between the two. ;-)
- Modified the bsdsocket emulation so that a trap is installed even when the
emulation proper is not built. This stops UAE crashing when the Amiga side
of the emulation is used, but no emulation is present in UAE itself.
- Fixed bsdsocket emulation so that it really (this time) obeys the bsdsock
config file option.
20031215
- If options file not found in home directory or current directory, then
use home directory as default path. This enables the GTK+ UI to save
a newly generated config file in a sane place.
- In SDL target, changed full-screen mode to always grab mouse input. This
works around mouse motion problems in full-screen mode in OS X.
- Kludged on a widget for selecting cycle-exact CPU mode in the gtk UI. I
don't want to add much to the GUI just now because it's in the process of
being rewritten - but this was cheap to do and it doesn't make sense to
build in cycle-exact mode if it cannot be easily used.
- Tweaks to allow building without cycle-exact CPU (CPUEMU_6 undefined).
There's no config file support for this as yet, but if you want to save
buckets of time when compiling, load up src/Makefile and remove that
define in CFLAGS and cpuemu_*_6.o/compemu_*_6.o from OBJS.
- Fixed a race condition which caused the name of a newly selected kickstart
image or key file sometimes not to be displayed.
- Added a scale factor to read_processor_time() on x86 target. People were
reporting timing problems on fast machines, and I believe the problem is due
to the number of ticks per second of the processor clock (syncbase) not
fitting in a signed int (on 2GHz+ machines). By scaling down the clock
(currently by a factor of 16), hopefully this problem is solved. Also
modified the RDTSC call to return the processor time as a full 64-bits. This
is needed so that scaled down clock still rolls over in 32 bits (and indeed
read_processor_time() still returns time as 32 bits).
- Added a patch from Stephen Anthony to make the floppy file dialog in gtkui
remember the last path used (saves all that searching through folders to
find the right ADF file).
- Initial implementation of hardfile support on Unix (no LFS or Gtk GUI
support yet). RDB hardfiles cause problems with recent versions of HDToolBox
which needs to be further investigated.
- Some minor tweaks to AmigaOS and BeOS targets (AmigaOS target should now
build out of the box, but still a lot of work to do on BeOS).
- Lots of tidying doing trivial syncs with WinUAE 0.8.22r9.
- Cleaned up sleep_millis() and sleep_millis_busy(). They're now in sleep.c
and will call my_usleep() - which will be replaced with an apropriate libc
or OS call depending on what's available (e.g., nanosleep(), usleep() or
SDL_Delay()). sleep_millis() will now busy wait if possible when asked to
sleep for less than 10ms (the granularity of most system sleep routines will
not allow sleeping for shorter periods - according to the docs).
sleep_millis_busy() will now only sleep if busy waiting is not required (for
sub-10ms sleeps).
- Cleaned up MAX_PATH nonsense. Arbitrarily assigned a value of 512 if it's
not defined. (We could use MAXPATHLEN from POSIX headers, but this value
is just as arbitrary and rather wasteful. E.g., it's 2048 on Linux. Anybody
really need paths that long?)
- Commented out unused routines createinputfile(), etc. in zfile.c which were
there to support external dms tool but are no longer required (and anyway
don't build on AmigaOS without ixemul due to the lack of the dubious
tempnam() function).
- Tidied up usage of strcmpi() and stricmp(). Replaced with strcasecmp() and
added configure support for substituting strcasecmp() for one of these if
it isn't available. (Shouldn't be necessary. strcasecmp() is a BSD standard,
but the other two are aren't always available - e.g. Linux doesn't have them.)
- Fixed configure script to build bsdsocket emulation by default only on
Unix platforms.
- Fixed misreporting of bsdsocket emulation not being built when it has been.
20031202
- Modified gencpu (and build scripts) to generate cpuemu.c in three pieces
like it does in WinUAE. This should require less memory to build the CPU
emulation and should thus speed up compilation on GCC3 (it also opens the
door to compile-time configuration of the CPU emulation).
- Modified configure script to omit X86_ASSEMBLY option when building for
x86 BeOS (it doesn't work there).
- Modified configure script to allow building with GCC 3 on x86 (this was
already possible on other archs). The cpuopti step is simply omitted
(since cpuopti won't currently work with GCC 3 output).
- Updated Amiga target. Closer to building now (with GCC at least). Sound and
joystick support still to do, and config options probably need tweaking.
- Add updated Solaris sound driver from Elmar Plischke.
- Added patch from Elmar to allow bsdsocket emulation to compile on Solaris.
- Removed GNU varargs macros throughout (this should allow UAE to be compiled
without GCC once more). Thanks to Elmar for pointing this out.
- Freeing memory in mapped_free() was broken when JIT was compiled in but
direct memory access disabled. Fixed
- Imported support for using DMS floppy images from WinUAE.
- Support for using zipped or gzipped ADF files was broken. Fixed.
- Accept __POWERPC__ and __ppc__ as a synonyms of __powerpc__ when
testing for PPC architecture in configure script (GCC on MacOS X uses
these).
- Cleaned up custom.c and drawing.c in preparation for merge with WinUAE. (This
breaks P96 in SDL and X11 targets. I've fixed SDL, but X11 fix is still to
do).
- Added support for switching between windowed/full-screen mode on SDL target,
even when SDL doesn't support SDL_WM_ToggleFullScreen (e.g. MacOS X).
- Added hack to allow the use of F11 as the hot-key modifier in SDL target.
F12 doesn't work as other keys under MacOS X it seems. Key up/down events
are generated only when the key is released - so it's no good for a hot-key
modifier.
- When changing from a P96 screen mode to an Amiga screen mode, a segfault
could occur. Fixed.
- JIT causes segfault on start-up on 2.6 kernels (and some 2.4 kernels).
Problem is due to messing about with the processes's LDT (Local Descriptor
Table) to accelerate access to VM's memory. Disabled this for now until I
find a solution.
- Partial support for Danish keyboards in SDL target (some keys aren't
currently supported by SDL keysyms).
20031118
- Added scripts to build debian package
- Added Carl Drougge's bsdsocket.library and source to package (this handles
the Amiga side of his bsdsocket emulation, which is already included in this
tree).
- Added this changelog to package
- Updated docs dir from uae-0.8.22 (I still had 0.8.21).
- Added 1280x960 screen mode to SDL and X11 targets - I prefer square pixels!
- Changing Amiga/P96 screen mode in SDL target while mouse was grabbed would
screw mouse motion because UAE would forget mouse mode. Fixed.
- Changing Amiga/P96 screen mode in SDL target would cause full-screen mode
to be lost. Fixed.
- Changing P96 screen mode to a larger mode in SDL target caused a crash. Fixed.
- Re-did video mode selection in SDL target. 15-bit modes now work for P96.
- Ensured that files which include the SDL headers do so with the proper
path (That is, no path. It's provided by sdl-config).
- Lots of clean-ups in preparation for getting stuff merged in the WinUAE tree.
- Removed code for the Windows target from this tree. Eventually I want to
get it building with MinGW, Cygwin and maybe even OpenWatcom - but we're
some way from that goal, so for right now we'll just save some bandwidth.
- Removed code for Acorn, pOS, DOS, OS/2 and NeXT targets. I'm sure that these
don't work now, and I don't have the facilities to test them anyway.
- Recoded source files to ensure the use of Unix-style end-of-line markers.
GCC on BeOS was barfing on the DOS CR/LF codes that accidentally got imported
from the WinUAE tree.
20031113
- Added mapping of left and right "super" keys (Windows keys on a Windows
keyboard) to left and right Amiga keys in SDL and X targets.
- Swapped mapping of apostrophe and back quote keys in SDL target
20031106
- Silly me. Timehack was demanding clocks to be exactly in sync with 1us
accuracy. Made it less strict and only update amiga time if it is out by
more than 1ms.
- Added dummy set_thread_priority() function in sdl and posix thread
wrappers (require if using filesystem threads).
- Tweaks for configure script:
* Better detection of when thread support is required (currently
filesystem code requires threads - even when not building with
UAE_FILESYS_THREADS option - due to dependency on hardfile code).
* Filesystem threads will now be compiled in by default
* Configure now works again on BeOS (whether it will build is another
story.)
- Fixes to re-enable building without a GUI.
- Made bsdsocket emulation a compile-time option.
- Really fix dummy joystick driver in od-generic.
- Fixed joystick counting in Linux joystick driver.
- Fixed mouse button mapping in X target.
- Fixed moused movement in DGA mode and when grabbed in X target
- Fixed X pointer being displayed in UAE window after grabbing and
ungrabbing mouse with X target.
- Fixed various functions which should have been exported from
gfxutil.c but were declared static.
20031011
- Fixed UAE side of timehack which was translating Unix Epoch UTC
time to Amiga Epoch UTC+2.
- Added support in Amiga side of timehack for setting clock to local time
using offset from UTC read from environment variable TZ. Added
break handling, so you can now kill the damn thing.
- Ported dummy sound driver in generic target to new sound API.
- Put back big-endian fixes for OSS sound target (which for some reason
never made it into this tree).
- Got X11 target compiling again. Still needs work on mouse handling.
- Linux joystick driver now works. (Did it ever work before?) Not tested
on BSD, though. This uses the old and crap v0.x Linux joystick API.
Need to add a driver for the new API.
- Lots of of clean-up in input layer. Ported all the joystick drivers
to the new inputdevice API and thus got rid of some of my hacks
in input-dummy.c (this will eventually go away all together).
- GTK+ GUI now works on Darwin/MacOS X with SDL threads. POSIX semaphores
appear to be broken there, however.
- Cleaned up threads targets. Implemented the sleep_millis() function
in each of the thread.h targets (previously, SDL implementation was
in sdlgfx.c). Now you can build with SDL threads without SDL gfx.
- Added debug logging to GTK+ GUI.
- Lots of clean-up in GTK+ GUI. Reworked pausing and quitting code.
Verified that no GTK+ widgets are directly accessed from main UAE
thread - hopefully clearing up GUI lock-up problems that have been
reported. Moved more code into gtk_gui_thread() and added a semaphore
to sync with UAE thread on GUI start-up.
- Started documenting GTK+ code.
- Fixed font problem in About page of GTK+ GUI. The code was changing
the default font style, not just applying style to widget (although
this bug didn't seem to effect any of my Linux boxes, it did show up on
Darwin).
- Fixed sizing policy of GTK+ main window. When the window's vertical
size was increased, the Snaphots gadgets would expand - which looked
very ugly. Now they don't.
20031005
- First stab at a GTK message box implementation that is used to report
certain warnings to the user via a GUI dialog rather than just dumping a
message on the console. (It's not used much, yet, but is used to report
problems in loading a Kickstart image, etc.)
- More mucking about with memory.c. Verified that differences with WinUAE
are either bugs in WinUAE or differences in the way Windows does things.
Did some more tidying up and started doing some documentation.
- Fixed a bug that would cause a segfault if the ROM keyfile (for encoded
Cloanto ROMs) was unable to be read.
- Hacked a solution to the problem that most config changes effected in the
GTK GUI wouldn't be saved out to a config file unless the VM was running
(to accept the changes).
- Fixed a bug with the new input subsystem and the GTK UI that that meant
changes in joystick port preferences didn't take effect and couldn't be
saved out in the config file.
- Added config file support for 8-bit sound back in.
- Started bringing back some of the snaphost code (still not ready to go yet,
though).
20031003
- Fixed problem with SDL not cleaning up if UAE dies horribly or is killed.
Now, when running full-screen and UAE dies, you should get your X display
back.
- Finished merging the new config-file code from WinUAE (many of the new
config options aren't actually used yet, though). New filesys config code
may cause problems with config files from my earlier versions and cause
duplicate disks to be mounted. Just go into the hard drive section of the
config and remove any duplicates. (In hindsight, I should have merged all
the new config code in one go.)
- Disabled the load and save snapshot buttons in the GTK+ UI. The snapshot
function isn't actually useable yet. I'll re-enable them when it is.
- Merged latest ShapeShifter hack from WinUAE and did some tidying up
of memory.c.
- Switched a lot of the debugging output in bsdsocket.c to be generated only
with a compile-time option (cut down the rubbish dumped to the console).
20031001
- Fixed endian problem with P96 screens on SDL on big-endian hardware such as
the PPC. This is a quick fix and just chooses the right byte-order for pixel
encoding depending on the host machine's byte-order. A better fix would take
account of the display's byte-order rather than the host's (similar applies to
the previous AGA fix). This and a fix for plain X11 target to do. There
appears to still be an occasional problem with P96 on 32-bit screens where red
and blue guns are swapped. Possibly a bug somewhere in the blitting code
in the P96 emulation. Need more time to investigate.
20030930 (mistakenly tagged the release as 20030330)
- Fixed endian problem with AGA screens on big-endian hardware such as the
PPC.
- Fixed bug in the GTK+ UI which stopped the AGA option in the chipset page
being selected even when it was selected in your config.
20030928-3
- Fixed problem with processor time calculations on the ppc-gcc target. This
fix will have wide-ranging effects on UAE's performance on the PPC, since
the processor timer (the PPC's timebase counter) is used to
synchronize m68k emulation with custom chip emulation. 'Adjustable' cpu mode
now works.
20030928-2
- Binary only release due to hosed PPC binary. Ooops.
20030928
- First release to the A1g3dev mailing list.
- Loads and loads of changes and fixes to plain old UAE-0.8.22 including:
* Latest CPU, x86 JIT and custom-chip emulations from WinUAE 0.8.22r9
* Latest filesystem code from WinUAE 0.8.22r9 (notification on a virtual
filesystem should now work).
* New input device code merged from WinUAE. Needs testing and attention.
* Several SDL fixes, particularly with clean-up and exiting.
* Fixed 16-bit SDL and OSS sound for big-endian machines
* Loads of GTK+ UI fixes, particularly with threading and exiting.
* Fixed bugs in floppy section of GTK+ UI (as a plus the LEDs now work).
* Replaced hard drive section of the GTK+ UI. A lot more useable.
* Assorted config and make script tweaks
* Assorted fixes to clean up code and cut down on compiler warnings.
* Possibly more that have I forgotten about . . .

340
COPYING Normal file
View File

@ -0,0 +1,340 @@
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
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program 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.
This program 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
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

5745
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

13
Makefile.am Normal file
View File

@ -0,0 +1,13 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = m4 amiga docs CHANGES README
SUBDIRS = src
dist_noinst_SCRIPTS = bootstrap.sh
dist-hook:
rm -rf `find $(distdir) -name CVS`
rm -rf `find $(distdir) -name *.bak`
rm -rf `find $(distdir) -name *~`
rm -rf `find $(distdir) -name *.orig`

601
Makefile.in Normal file
View File

@ -0,0 +1,601 @@
# Makefile.in generated by automake 1.7.9 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ASMOBJS = @ASMOBJS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BSDSOCKOBJS = @BSDSOCKOBJS@
BUILD_MACOSX_BUNDLE_FALSE = @BUILD_MACOSX_BUNDLE_FALSE@
BUILD_MACOSX_BUNDLE_TRUE = @BUILD_MACOSX_BUNDLE_TRUE@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CDOBJS = @CDOBJS@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPUOBJS = @CPUOBJS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUGOBJS = @DEBUGOBJS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRAOBJS = @EXTRAOBJS@
FILEPRG = @FILEPRG@
FILESYSOBJS = @FILESYSOBJS@
GENCPUOPTS = @GENCPUOPTS@
GFX_DEP = @GFX_DEP@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
GUI_DEP = @GUI_DEP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JITOBJS = @JITOBJS@
JOY_DEP = @JOY_DEP@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MACHDEP = @MACHDEP@
MAKEDEPPRG = @MAKEDEPPRG@
MAKEINFO = @MAKEINFO@
MATHLIB = @MATHLIB@
NO_SCHED_CFLAGS = @NO_SCHED_CFLAGS@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJC_LDFLAGS = @OBJC_LDFLAGS@
OBJEXT = @OBJEXT@
OSDEP = @OSDEP@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RCLPRG = @RCLPRG@
RESOBJS = @RESOBJS@
SCSIOBJS = @SCSIOBJS@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SND_DEP = @SND_DEP@
STRIP = @STRIP@
TARGET = @TARGET@
TARGET_BEOS_FALSE = @TARGET_BEOS_FALSE@
TARGET_BEOS_TRUE = @TARGET_BEOS_TRUE@
TARGET_BIGENDIAN_FALSE = @TARGET_BIGENDIAN_FALSE@
TARGET_BIGENDIAN_TRUE = @TARGET_BIGENDIAN_TRUE@
TARGET_WIN32_FALSE = @TARGET_WIN32_FALSE@
TARGET_WIN32_TRUE = @TARGET_WIN32_TRUE@
THREADDEP = @THREADDEP@
UAE_RSRCFILE = @UAE_RSRCFILE@
VERSION = @VERSION@
WRCPRG = @WRCPRG@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_OBJC = @ac_ct_OBJC@
ac_cv_c_inline = @ac_cv_c_inline@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@
am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = m4 amiga docs CHANGES README
SUBDIRS = src
dist_noinst_SCRIPTS = bootstrap.sh
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/sysconfig.h
CONFIG_CLEAN_FILES =
SCRIPTS = $(dist_noinst_SCRIPTS)
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = README $(dist_noinst_SCRIPTS) $(srcdir)/Makefile.in \
$(srcdir)/configure COPYING ChangeLog Makefile.am aclocal.m4 \
config.guess config.sub configure configure.in depcomp \
install-sh missing mkinstalldirs
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
.SUFFIXES:
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): configure.in m4/ac_var_timezone_externals.m4 m4/acx_pthread.m4 m4/as-objc.m4 m4/check_zlib.m4 m4/fsusage.m4 m4/gtk-2.0.m4 m4/gtk.m4 m4/sdl.m4 m4/type_socklen_t.m4 m4/uintmax_t.m4
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
else \
include_option=--include; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
distdir = $(PACKAGE)-$(VERSION)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkinstalldirs) $(distdir)/src/od-macosx
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist dist-all: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(SCRIPTS)
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-recursive ctags ctags-recursive dist \
dist-all dist-bzip2 dist-gzip distcheck distclean \
distclean-generic distclean-recursive distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am \
dvi-recursive info info-am info-recursive install install-am \
install-data install-data-am install-data-recursive \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
ps-recursive tags tags-recursive uninstall uninstall-am \
uninstall-info-am uninstall-info-recursive uninstall-recursive
dist-hook:
rm -rf `find $(distdir) -name CVS`
rm -rf `find $(distdir) -name *.bak`
rm -rf `find $(distdir) -name *~`
rm -rf `find $(distdir) -name *.orig`
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

154
README Normal file
View File

@ -0,0 +1,154 @@
E-UAE 0.8.29-WIP4
=================
E-UAE is an Amiga emulator, a program that allows you to run software
designed for Amiga computers on other platforms, such as Linux or Mac
OS. It is based on UAE, the original Ubiquitous Amiga Emulator, and
WinUAE, the Windows version of UAE. While it owes a huge debt to these
two great projects, E-UAE diverges from both, aiming to improve
performance and features on a variety of host platforms.
The name E-UAE stemmed from the fact that this project needed a name,
and, since it was an 'experimental' version of UAE, everybody was
calling it 'Experimental' UAE. While I have long since accepted that
moniker, I still don't intend the 'E' to mean anything it particular.
Although the project is currently 'experimental' - that is, it is a
long way from being anything close to finished - it should still be
robust enough to use.
E-UAE currently builds and runs - with varying degrees of supported
features - on Unix and Unix-like platforms (including Linux, Solaris
and Mac OS X), BeOS, AmigaOS and clones (including AmigaOS 3.x,
AmigaOS 4.0, MorphOS and AROS), and Windows (with Cygwin or MinGW32).
E-UAE is open-source software and is made available under the terms of
the GPL. See the COPYING file included with the E-UAE archive for
details.
E-UAE is based on the work of dozens of contributors including Bernd
Schmidt (the original author and maintainer of UAE), Bernie Meyer (the
author of the x86 JIT compiler), Toni Wilen (the current maintainer of
WinUAE), and many more.
Note that to make full use of E-UAE you will need access to an image
of some version of the Amiga Kickstart ROM (although E-UAE does include
a ROM emulation which may work with some old games). The Amiga
Kickstart ROMs are copyrighted material and may not be freely
distributed (so don't ask me for a copy). If you don't have an Amiga
from which you can legally make a ROM image, a selection of ROM images
are available for purchase online from Cloanto (publishers of the
Amiga Forever distribution). See http://www.amigaforever.com/
What's new since 0.8.29-WIP3
============================
A huge amount of work has gone into E-UAE since the last public
release. Not of all of this work will be readily apparent to users
since it took place under the surface. However, some user-visible
changes include:
* Emulation core from WinUAE 1.3.x merged.
* Much more stable on SMP hosts.
* Builds on Solaris x86 (with GCC).
* Integrated mouse-hack feature merged from WinUAE (this synchronizes
the Amiga mouse pointer with the host pointer when E-UAE is running
in a window on your desktop) merged from WinUAE. The old AmigaOS
mousehack tool is no longer required.
* New, easier-to-use Linux SCSI back-end (Jochen Becher).
* Experimental GL renderer in SDL display back-end (originally from
Jochen Becher but mostly re-written). On most platforms this is yet
to offer much over the existing 2D renderer, but on Mac OS X it
offers significantly better performance. Enabled with
'sdl.use_gl=true'.
* Support for the 'uae-configuration' tool merged from WinUAE. This is
an AmigaOS shell command which allows UAE settings to be queried and
modified from within the emulation environment.
* Better, smoother performance when cpu_speed=real (A500 speed). E-UAE
adapts better to changing system latencies.
* 'Sinc' audio interpolation added (Antti Lankila).
* Minor performance improvements in interpretive CPU emulator and JIT
engine.
* Mac OS X icon added (from Daniel Pimley).
* Lots of bugs fixes, including:
- Broken 'delayed' interrupt handling when JIT was disabled.
- Inconsistent refreshing of P96 screens.
- Filesystems being mounted twice.
- Hardfiles broken following a reset.
- Broken detection of XKB path in X11 driver (fix from Peter Volkov).
Still to do
===========
The following features of UAE and/or WinUAE are not yet supported yet
in E-UAE. These include:
* Serial and parallel port emulation.
* AHI soundcard emulation.
* Catweasel support.
* Graphics filters, scaling, etc.
* Floppy drive sounds.
Known problems
==============
Some significant misfeatures that I know about and am/will be working
to fix (eventually):
* Only platforms supporting the GTK+ toolkit have a useable
configuration GUI (and the GTK+ GUI is still incomplete). However,
Mac OS X users may like to try Daniel Pimley's graphical front-end,
Hi Toro. See http://www.pimley.net/projects/.
* JIT direct memory access only works on Linux/x86 and, by default,
you may only emulate up to 32MB of direct ZIII RAM; select more than
that and the JIT will fall back on indirect memory access and hence
will be slower. This is due to a system limit on the size of a POSIX
shared memory segment. You can overcome this limit my modifying the
value of the procfs setting, /proc/sys/kernel/shmmax.
* Virtual filesystem doesn't support platforms which use UTF-8 for
filenames (e.g., OS X, Linux with a UTF-8 locale, etc.). Filenames
with characters outside of the core ASCII range will be mangled.
* OpenGL renderer is experimental, unfinished and has no error
recovery.
* Tear-free graphical output (with the gfx_vsync=true option) doesn't
work on most platforms yet (the exceptions being Mac OS X with the
SDL/GL renderer and AmigaOS4.0 with SDL).
* The Mac OS X version is currently for PowerPC hardware only (I don't
have an Intel Mac). Users with Macintel hardware may wish to try
Jens Weichert's Intel builds. See http://e-uae.de.vu/.
* The build scripts are a horrible, unmaintainable mess.
* Full documentation is lacking.
Using E-UAE
===========
Documentation is a work-in-progress. See the docs directory.
Compiling E-UAE yourself
========================
See the docs/compiling.txt file for more information about building
E-UAE.
CVS
===
Details about how to access the CVS repository containing the current
development version of E-UAE can be found at:
http://sourceforge.net/cvs/?group_id=109723
Contact
=======
See http://www.freelists.org/list/uae for details of a mailing list
discussing problems with and development of E-UAE.
Send bug reports, comments, patches, etc. to the above list or to:
Richard Drummond <uae@rcdrummond.net>

2173
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

11
amiga/source/Makefile.gcc Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/make -f
# Makefile to build UAE amiga tools with GCC
CC = gcc
CFLAGS = -O2 -noixemul -fomit-frame-pointer -msmall-code -fbaserel
LDFLAGS = $(CFLAGS) -s
timehack: timehack.o
clean:
-rm timehack timehack.o

25
amiga/source/mhint.asm Normal file
View File

@ -0,0 +1,25 @@
SECTION code
xdef _mousehackint
_mousehackint:
moveq.l #1,d0
jsr.l $F0FF70
move.l d0,d1
moveq.l #2,d0
jsr.l $F0FF70
cmp.l (a1),d1
bne l1
cmp.l 4(a1),d0
beq l2
l1:
move.l d0,4(a1)
move.l d1,(a1)
move.l 8(a1),d0
move.l 12(a1),a1
move.l 4.w,a6
jsr -324(a6) ; Signal
l2:
lea $DFF000,a0
moveq.l #0,d0
rts
END

141
amiga/source/mousehack.c Normal file
View File

@ -0,0 +1,141 @@
/*
* IEvent mouse hack
*
* Compile with DCC
*
* Copyright 1997 Bernd Schmidt
*/
#include <stdio.h>
#include <exec/devices.h>
#include <exec/interrupts.h>
#include <exec/nodes.h>
#include <exec/io.h>
#include <exec/memory.h>
#include <intuition/intuitionbase.h>
#include <intuition/preferences.h>
#include <devices/input.h>
#include <devices/inputevent.h>
#include <devices/timer.h>
#include <hardware/intbits.h>
#include <clib/alib_protos.h>
#include <clib/exec_protos.h>
int (*calltrap)(__d0 int) = 0xF0FF70;
extern void mousehackint(void);
struct {
ULONG mx;
ULONG my;
ULONG sigbit;
struct Task *mt;
} foo;
struct Interrupt myint = {
{ 0, 0, NT_INTERRUPT, 5, "UAE mouse hack" },
&foo,
mousehackint
};
int main(int argc, char **argv)
{
struct IntuitionBase *ibase;
struct InputEvent *iev;
struct IOStdReq *ioreq = 0;
struct MsgPort *port;
struct timerequest *timereq = 0;
struct MsgPort *timeport;
int oldx = 0, oldy = 0;
int i;
i = (*calltrap) (0);
if (i == 0) {
fprintf(stderr, "mousehack not needed for this version of UAE.\n");
exit (0);
}
if (i == -1) {
fprintf(stderr, "mousehack already running.\n");
exit (5);
}
i = AllocSignal (-1);
if (i < 0)
goto fail;
foo.sigbit = 1 << i;
port = CreatePort(0, 0);
timeport = CreatePort (0, 0);
if (port)
ioreq = CreateStdIO(port);
if (timeport)
timereq = CreateStdIO(timeport);
if (ioreq == 0)
goto fail;
if (timereq == 0)
goto fail;
iev = AllocMem (sizeof (struct InputEvent), MEMF_CLEAR + MEMF_PUBLIC);
if (iev == 0)
goto fail;
if (OpenDevice ("input.device", 0, ioreq, 0) != 0)
goto fail;
if (OpenDevice ("timer.device", 0, timereq, 0) != 0)
goto fail;
foo.mx = (ULONG)-1;
foo.my = (ULONG)-1;
foo.mt = FindTask (0);
AddIntServer(INTB_VERTB, &myint);
ibase = OpenLibrary ("intuition.library", 0);
SetTaskPri (foo.mt, 20); /* same as input.device */
for (;;) {
int newx, newy;
Wait (foo.sigbit);
ioreq->io_Command = IND_WRITEEVENT;
ioreq->io_Length = sizeof (struct InputEvent);
ioreq->io_Data = iev;
ioreq->io_Flags = IOF_QUICK;
iev->ie_Class = IECLASS_POINTERPOS;
iev->ie_SubClass = 0;
iev->ie_Code = 0;
iev->ie_Qualifier = 0;
#if 0
newx = (*calltrap) (1);
newy = (*calltrap) (2);
if (oldy != newy || oldx != newx)
#endif
{
timereq->tr_node.io_Flags = IOF_QUICK;
timereq->tr_node.io_Command = TR_GETSYSTIME;
DoIO (timereq);
iev->ie_TimeStamp = timereq->tr_time;
/* Those are signed, so I hope negative values are OK... */
/* I wonder why I have to multiply those by 2... but it works,
* at least for me. */
iev->ie_position.ie_xy.ie_x = foo.mx - ibase->ViewLord.DxOffset*2;
iev->ie_position.ie_xy.ie_y = foo.my - ibase->ViewLord.DyOffset*2;
oldx = newx;
oldy = newy;
DoIO(ioreq);
}
#if 0
timereq->tr_node.io_Flags = IOF_QUICK;
timereq->tr_time.tv_secs = 0;
timereq->tr_time.tv_micro = 20000;
timereq->tr_node.io_Command = TR_ADDREQUEST;
DoIO(timereq);
#endif
}
fail:
fprintf (stderr, "Couldn't start mousehack (that's bad!)\n");
exit (5);
}

172
amiga/source/timehack.c Normal file
View File

@ -0,0 +1,172 @@
/*
* synchronize system time with the host's time
*
* Compile with DCC (or SAS/C) or GCC
*
* Copyright 1997, 1999 Bernd Schmidt
* Copyright 1999 Patrick Ohly
* Copyright 2003 Richard Drummond
*
* 0.3 - 20031106
* Silly me. Timehack was demanding clock be exactly in sync
* to 1us accuracy. Make it less strict and only update amiga
* time if it's out by more than 1ms.
* 0.2 - 20031011
* Oops. I got the the sign of the offset wrong in TZ. Apparently
* negative values are ahead of UTC. Go figure . . .
* 0.1 - 20031011
* Quick and dirty support for using TZ offset added.
* Can now be killed with ^C
* Can now be built with GCC
* Replaced fprintf() with fputs() for smaller code size with GCC.
*/
#include <stdio.h>
#include <stdlib.h>
#include <exec/devices.h>
#include <exec/interrupts.h>
#include <exec/nodes.h>
#include <exec/io.h>
#include <exec/memory.h>
#include <intuition/intuitionbase.h>
#include <intuition/preferences.h>
#include <devices/input.h>
#include <devices/inputevent.h>
#include <devices/timer.h>
#include <hardware/intbits.h>
#include <clib/alib_protos.h>
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>
#include <clib/timer_protos.h>
#ifdef __GNUC__
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/timer.h>
#include <inline/alib.h>
#endif
#ifdef _DCC
int (*calltrap)(__d0 int, __a0 struct timeval *) = 0xF0FFA0;
#elif defined (__GNUC__)
int (*calltrap)(int __asm("d0"),struct timeval * __asm("a0")) = (APTR)0xF0FFA0;
#else
/* SAS */
__asm int (*calltrap)(register __d0 int, register __a0 struct timeval *) = (APTR)0xF0FFA0;
#endif
#ifdef __GNUC__
/* Don't link with command-line parser to save code size */
int __nocommandline = 0;
#endif
/* We'll give this a verson number now. We have to
* to start somewhere - Rich */
char verstag[] = "\0$VER: timehack 0.3";
#ifndef ABS
#define ABS(x) ((x)>=0?(x):-(x))
#endif
/*
* get_tz_offset()
*
* Get offset from local time to UTC and return it as
* a timeval (seconds and usecs). The local timezone
* is read from the env variable TZ and this is expected
* to be in standard format, for example, EST+5.
* If TZ isn't present or can't be parsed, this will
* return an offset 0 seconds.
*/
struct timeval *get_tz_offset()
{
static struct timeval tz_offset;
BPTR file;
char tz_str[7];
if ((file = Open ("ENV:TZ", MODE_OLDFILE))!=NULL) {
int len;
if ((len = Read (file, &tz_str[0], 6)) >= 4) {
tz_str[len]='\0';
// N.B.: negative offsets in ENV:TZ are ahead of UTC
tz_offset.tv_secs = -1 * atol(&tz_str[3]) * 3600;
}
Close(file);
} else
tz_offset.tv_secs = 0;
tz_offset.tv_micro = 0;
return &tz_offset;
}
int main (int argc, char **argv)
{
struct timerequest *timereq = 0;
struct MsgPort *timeport;
struct timeval *tz_offset;
struct Device *TimerBase;
int quit = 0;
int result = calltrap (0, 0);
if (result == 1)
fputs ("timehack already running.\n", stderr);
else if (result == 2)
fputs ("timehack not supported with this version of UAE.\n", stderr);
if (result != 0)
exit (5);
timeport = (struct MsgPort *) CreatePort (0, 0);
if (timeport)
timereq = (struct timerequest *) CreateStdIO(timeport);
if (timereq == 0)
goto fail;
if (OpenDevice ("timer.device", UNIT_VBLANK, (struct IORequest *) timereq, 0) != 0)
goto fail;
TimerBase = timereq->tr_node.io_Device;
SetTaskPri (FindTask (NULL), 20); /* same as input.device */
tz_offset = get_tz_offset();
while (!quit) {
struct timeval cur_sys_time;
timereq->tr_node.io_Command = TR_GETSYSTIME;
DoIO ((struct IORequest *)timereq);
cur_sys_time = timereq->tr_time;
calltrap (1, &timereq->tr_time);
if (timereq->tr_time.tv_secs != cur_sys_time.tv_secs
|| (timereq->tr_time.tv_secs == cur_sys_time.tv_secs
&& ABS(timereq->tr_time.tv_micro - cur_sys_time.tv_micro) > 1000))
{
AddTime (&timereq->tr_time, tz_offset);
timereq->tr_node.io_Command = TR_SETSYSTIME;
DoIO ((struct IORequest *)timereq);
}
timereq->tr_time.tv_secs = 1;
timereq->tr_time.tv_micro = 0;
timereq->tr_node.io_Command = TR_ADDREQUEST;
DoIO ((struct IORequest *)timereq);
if (SetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
quit = TRUE;
}
/* Exit and error handling badly needs tidying up - Rich */
CloseDevice ((struct IORequest *)timereq);
DeleteStdIO ((struct IOStdReq *)timereq);
DeletePort (timeport);
exit (0);
fail:
fputs ("Couldn't start timehack (that's bad!)\n", stderr);
exit (5);
}

166
amiga/source/transdisk.c Normal file
View File

@ -0,0 +1,166 @@
/*
* Transdisk V4.2
* Copyright 1995-97 Bernd Schmidt, Marcus Sundberg, Stefan Ropke,
* Rodney Hester, Joanne Dow
*
* Use DICE and 2.0 includes or above to compile. SAS C should work too.
*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <strings.h>
#include <exec/devices.h>
#include <exec/io.h>
#include <exec/memory.h>
#include <devices/trackdisk.h>
#include <clib/alib_protos.h>
#include <clib/exec_protos.h>
static void usage(void);
static void usage(void)
{
fprintf(stderr, "Usage: transdisk options\n");
fprintf(stderr, "Recognized options:\n");
fprintf(stderr, "-h: Assume device is high density\n");
fprintf(stderr, "-d device unit: Use this device instead of DF0:\n");
fprintf(stderr, "-s n: Begin transfer at track n\n");
fprintf(stderr, "-e n: End transfer at track n\n");
fprintf(stderr, "-w filename: writes the ADF file <filename> to disk\n\n");
fprintf(stderr, "Example:\n");
fprintf(stderr, "transdisk >RAM:df1.adf.1 -d trackdisk 1 -s 0 -e 39\n");
fprintf(stderr, "transfers the first half of the floppy in DF1: into\n");
fprintf(stderr, "a file in the RAM disk.\n");
fprintf(stderr, "Or:\n");
fprintf(stderr, "transdisk -w test.adf\n");
fprintf(stderr, "writes the ADF-file test.adf to the disk in df0:\n");
}
int main(int argc, char **argv)
{
char *filename, *openMode="rb";
FILE *ADFFile;
int write=0;
struct IOStdReq *ioreq;
struct MsgPort *port;
UBYTE *buffer;
char devicebuf[256];
char *devicename = "trackdisk.device";
char devicenum = 0;
int i;
int starttr = 0, endtr = 79;
int sectors = 11;
for (i = 1; i < argc;) {
if (argv[i][0] != '-' || argv[i][2] != 0) {
usage();
exit(1);
}
switch (argv[i][1]) {
case 'h':
sectors = 22;
i++;
break;
case 'd':
if (i+2 >= argc) {
usage();
exit(1);
}
devicenum = atoi(argv[i+2]);
sprintf(devicebuf, "%s.device", argv[i+1]);
devicename = devicebuf;
i += 3;
break;
case 's':
if (i+1 >= argc) {
usage();
exit(1);
}
starttr = atoi(argv[i+1]);
i += 2;
break;
case 'e':
if (i+1 >= argc) {
usage();
exit(1);
}
endtr = atoi(argv[i+1]);
i += 2;
break;
case 'w':
if (i+1 >= argc) {
usage();
exit(1);
}
filename=argv[i+1];
write=1;
i += 2;
break;
default:
usage();
exit(1);
}
}
fprintf(stderr,"Using %s unit %d\n", devicename, devicenum);
fprintf(stderr,"Tracks are %d sectors\n", sectors);
fprintf(stderr,"First track %d, last track %d\n", starttr, endtr);
buffer = AllocMem(512, MEMF_CHIP);
if (write) {
ADFFile = fopen(filename,openMode);
if (!ADFFile) {
fprintf(stderr,"Error while opening input file\n");
exit (1);
}
}
port = CreatePort(0, 0);
if (port) {
ioreq = CreateStdIO(port);
if (ioreq) {
if (OpenDevice(devicename, devicenum, (struct IORequest *) ioreq, 0) == 0) {
int tr, sec;
ioreq->io_Command = write ? CMD_WRITE : CMD_READ;
ioreq->io_Length = 512;
ioreq->io_Data = buffer;
for (tr = starttr*2; tr < (endtr+1)*2; tr++) {
fprintf(stderr,"Track: %d\r",tr/2);
for (sec = 0; sec < sectors; sec++) {
fflush(stderr);
if (write)
if (fread(buffer, sizeof(UBYTE), 512, ADFFile) < 512) {
fprintf(stderr, "Error: ADF file to short?\n");
exit(1);
}
ioreq->io_Offset = 512 * (tr * sectors + sec);
DoIO( (struct IORequest *) ioreq);
if (!write)
fwrite(buffer, sizeof(UBYTE), 512, stdout);
}
}
if (write) { /* Make sure the last track is written to disk */
ioreq->io_Command = CMD_UPDATE;
DoIO( (struct IORequest *) ioreq);
}
ioreq->io_Command = TD_MOTOR; /* Turn Disk-motor off */
ioreq->io_Length = 0;
DoIO( (struct IORequest *) ioreq);
CloseDevice( (struct IORequest *) ioreq);
} else
fprintf(stderr,"Unable to open %s unit %d\n", devicename, devicenum);
DeleteStdIO(ioreq);
}
DeletePort(port);
}
fprintf(stderr,"\n");
FreeMem(buffer, 512);
if (write)
fclose (ADFFile);
return 0;
}

29
amiga/source/transrom.c Normal file
View File

@ -0,0 +1,29 @@
/*
* Transrom V4.1
* Copyright 1995,1996 Bernd Schmidt, Marcus Sundberg, Stefan Ropke,
* Rodney Hester
*
* Use DICE and 2.0 includes or above to compile
*/
#include <stdio.h>
int main(int argc, char **argv)
{
int l;
if (l=OpenLibrary("exec.library",35L)) /* Not sure about V35 */
{
fprintf(stderr,"Writing 512K Kickstart image...\n");
fflush(stderr);
fwrite((char *)0xF80000,sizeof(char),0x80000,stdout);
CloseLibrary(l);
}
else
{
fprintf(stderr,"Writing 256K Kickstart image...\n");
fflush(stderr);
fwrite((char *)0xF80000,sizeof(char),0x40000,stdout);
}
return 0;
}

View File

@ -0,0 +1,66 @@
#define __NOLIBBASE__
#include <proto/exec.h>
#include <proto/dos.h>
#define OUTBUFSIZE 1000
long (*UaeConf) (...);
struct Library *SysBase;
struct Library *DOSBase;
char outbuf[OUTBUFSIZE+1];
__saveds long start (register __a0 param,register __d0 paramlen)
{
long rc = 20;
long index;
BPTR out;
char *s;
BOOL brk = FALSE;
UaeConf = (void *) 0xf0ff60;
SysBase = *((struct Library **)4);
if (DOSBase = OpenLibrary ("dos.library",0))
{
out = Output();
if (*((ULONG *)UaeConf))
{
index = -1;
do {
outbuf[0] = 0;
rc = UaeConf (82,index,param,paramlen,outbuf,OUTBUFSIZE);
if (outbuf[0] && out)
{
for (s = outbuf; *s; s++);
*s++ = '\n';
Write (out,outbuf,s - outbuf);
}
index++;
if (SetSignal(0,0) & SIGBREAKF_CTRL_C)
brk = TRUE;
} while (!brk && rc < 0);
if (brk && out)
{
Write (out,"*** Break\n",10);
rc = 10;
}
}
else
if (out)
Write (out,"Your version of WinUAE is too old\n",34);
CloseLibrary (DOSBase);
}
return (rc);
}

View File

@ -0,0 +1,86 @@
; uae-configuration Amiga-side part
; (c) Toni Wilen 2004
OUTBUFSIZE = 1000
move.l a0,a3
move.l d0,d3
sub.l a4,a4
moveq #20,d7
lea $f0ff60,a5
tst.l (a5)
beq.s end
move.l 4,a6
lea dos(pc),a1
moveq #0,d0
jsr -$228(a6) ;OpenLibrary
tst.l d0
beq.s end
move.l d0,a4
move.l a4,a6
moveq #-1,d6
loop
lea outbuf,a2
move.l #OUTBUFSIZE,-(sp) ;out len
move.l a2,-(sp) ;out
clr.b (a2)
move.l d3,-(sp) ;param len
move.l a3,-(sp) ;param
move.l d6,-(sp) ;index
moveq #82,d0
move.l d0,-(sp)
jsr (a5)
lea 6*4(sp),sp
move.l d0,d7
; do we have output?
move.l d3,-(sp)
tst.b (a2)
beq.s noout
jsr -$003c(a6) ;Output
move.l d0,d4
beq.s noout
move.l d4,d1
move.l a2,d2
moveq #-1,d3
out1
addq.l #1,d3
tst.b (a2)+
bne.s out1
jsr -$0030(a6) ; Write
move.l d4,d1
lea lf(pc),a0
move.l a0,d2
moveq #1,d3
jsr -$0030(a6) ; Write
noout
move.l (sp)+,d3
tst.l d7
bpl.s end
; list all -mode
addq.l #1,d6
bra loop
end
move.l a4,d0
beq.s end2
move.l d0,a1
move.l 4,a6
jsr -$19e(a6) ;CloseLibrary
end2
move.l d7,d0
rts
dos dc.b "dos.library",0
lf dc.b 10
section 2,bss
outbuf
ds.b OUTBUFSIZE

563
amiga/source/uae-control.c Normal file
View File

@ -0,0 +1,563 @@
/***********************************************************
* UAE - The U*nix Amiga Emulator *
* *
* UAE-Control - Emulator control from inside emulation *
* (c) 1996 Tauno Taipaleenmaki <tataipal@raita.oulu.fi> *
* (c) 1998 Cloanto <info@cloanto.com> *
* *
* Version 1.1 *
* *
* Requires Amiga OS v. 36 or higher. Compiled with SAS/C *
* *
* Users with KS 1.3 or below should use the command line *
* version "uaectrl" *
***********************************************************/
#define VERSION_STRING "\0$VER: UAE-Control 1.1"
#define VERSION_SHELL " UAE-Control v. 1.1\n © 1996 Tauno Taipaleenmaki, © 1998 Cloanto\n\n"
#include <intuition/intuition.h>
#ifndef _DCC
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/gadtools.h>
#include <proto/graphics.h>
#include <proto/dos.h>
#else
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/dos_protos.h>
#endif
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include "UAE-Control.h"
#include "uae_pragmas.h"
#define MAX_DRV_NAME 25
struct Window *window;
struct Screen *scr;
struct Gadget *glist;
APTR VisInfo;
struct UAE_CONFIG config;
UBYTE *version_string = VERSION_STRING;
struct TextAttr topaz8 =
{
(STRPTR) "topaz.font", 8, 0x00, 0x01
};
struct NewWindow newwindow =
{
0, 0, 0, 0, 0, 1,
IDCMP_CLOSEWINDOW | BUTTONIDCMP | CYCLEIDCMP | INTEGERIDCMP | STRINGIDCMP,
WFLG_DRAGBAR | WFLG_CLOSEGADGET | WFLG_ACTIVATE | WFLG_DEPTHGADGET,
NULL, NULL, NULL, NULL, NULL,
0, 0, 0, 0, CUSTOMSCREEN
};
int setup_window(void);
void quit_program(int error, char *text);
void print_drive_status(void);
BOOL get_string(UBYTE * buff, LONG max_len);
/*****************************************
* Main program *
*****************************************/
int main()
{
int quit = 0, i;
struct IntuiMessage *msg;
struct Gadget *button;
struct StringInfo *strinfo;
char buf[257];
UWORD koodi, msgID;
ULONG classi, number;
APTR address;
ULONG CycleTags[3];
CycleTags[0] = GTCY_Active;
CycleTags[1] = (ULONG) & number;
CycleTags[2] = TAG_DONE;
/* Read UAE configuration */
i = GetUaeConfig(&config);
i = setup_window();
if (i == 0) {
quit_program(1, "Cannot setup a window!");
return 1;
}
while (quit == 0) {
WaitPort(window->UserPort);
while (msg = (struct IntuiMessage *) GT_GetIMsg(window->UserPort)) {
classi = msg->Class;
koodi = msg->Code;
address = msg->IAddress;
if (classi == IDCMP_GADGETUP) {
msgID = ((struct Gadget *) msg->IAddress)->GadgetID;
button = (struct Gadget *) msg->IAddress;
if (button->SpecialInfo) {
strinfo = (struct StringInfo *) button->SpecialInfo;
}
} else
msgID = msg->Code;
GT_ReplyIMsg((struct IntuiMessage *) msg);
switch (classi) {
case IDCMP_CLOSEWINDOW:
quit = 1;
break;
case IDCMP_GADGETUP:
switch (msgID) {
case GAD_EXITEMU:
ExitEmu();
break;
case GAD_EJECT_DF0:
EjectDisk(0);
Delay(30);
GetUaeConfig(&config);
print_drive_status();
break;
case GAD_EJECT_DF1:
EjectDisk(1);
Delay(30);
GetUaeConfig(&config);
print_drive_status();
break;
case GAD_EJECT_DF2:
EjectDisk(2);
Delay(30);
GetUaeConfig(&config);
print_drive_status();
break;
case GAD_EJECT_DF3:
EjectDisk(3);
Delay(30);
GetUaeConfig(&config);
print_drive_status();
break;
case GAD_SOUND:
if (config.do_output_sound)
DisableSound();
else
EnableSound();
Delay(30);
GetUaeConfig(&config);
break;
case GAD_JOYSTICK:
if (config.do_fake_joystick)
DisableJoystick();
else
EnableJoystick();
Delay(30);
GetUaeConfig(&config);
break;
case GAD_FRAMERATE:
SetFrameRate(strinfo->LongInt);
Delay(30);
GetUaeConfig(&config);
break;
case GAD_INSERT_DF0:
strcpy(buf, config.df0_name);
if (get_string(buf, 255)) {
InsertDisk((UBYTE *) buf, 0);
Delay(30);
GetUaeConfig(&config);
print_drive_status();
}
break;
case GAD_INSERT_DF1:
strcpy(buf, config.df1_name);
if (get_string(buf, 255)) {
InsertDisk((UBYTE *) buf, 1);
Delay(30);
GetUaeConfig(&config);
print_drive_status();
}
break;
case GAD_INSERT_DF2:
strcpy(buf, config.df2_name);
if (get_string(buf, 255)) {
InsertDisk((UBYTE *) buf, 2);
Delay(30);
GetUaeConfig(&config);
print_drive_status();
}
break;
case GAD_INSERT_DF3:
strcpy(buf, config.df3_name);
if (get_string(buf, 255)) {
InsertDisk((UBYTE *) buf, 3);
Delay(30);
GetUaeConfig(&config);
print_drive_status();
}
break;
case GAD_LANGUAGE:
number = config.keyboard;
number++;
if (number == 5)
number = 0;
ChangeLanguage(number);
Delay(30);
GetUaeConfig(&config);
break;
case GAD_RESET:
ColdReboot();
break;
case GAD_DEBUG:
DebugFunc();
break;
default:
break;
}
break;
default:
break;
}
}
}
quit_program(0, "");
return (0);
}
/*****************************************
* Quits the program *
*****************************************/
void quit_program(int error, char *text)
{
if (error > 0) {
printf(VERSION_SHELL);
printf(" ERROR: %s\n", text);
}
if (scr)
UnlockPubScreen(NULL, scr);
if (window)
CloseWindow(window);
if (VisInfo)
FreeVisualInfo(VisInfo);
if (glist)
FreeGadgets(glist);
}
/*****************************************
* Opens up the window & sets the gadgets *
*****************************************/
int setup_window(void)
{
struct Gadget *g;
struct NewGadget ng;
UWORD offy;
ULONG drawtags[20];
static const char *keyb_langs[] =
{
"US",
"DE",
"SE",
"FR",
"IT",
NULL
};
scr = LockPubScreen(NULL);
if (!scr)
return (0);
VisInfo = GetVisualInfo(scr, TAG_DONE);
if (!VisInfo)
return (0);
offy = scr->WBorTop + scr->RastPort.TxHeight + 1;
/* Create buttons */
g = CreateContext(&glist);
if (!g)
return (0);
ng.ng_TextAttr = &topaz8;
ng.ng_VisualInfo = VisInfo;
ng.ng_Flags = PLACETEXT_IN;
ng.ng_LeftEdge = 284;
ng.ng_TopEdge = offy + 86;
ng.ng_Width = 96;
ng.ng_Height = 15;
ng.ng_GadgetText = (UBYTE *) "Hard Reset";
ng.ng_GadgetID = GAD_RESET;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_TopEdge = offy + 105;
ng.ng_GadgetText = (UBYTE *) "Debug";
ng.ng_GadgetID = GAD_DEBUG;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_TopEdge = offy + 135;
ng.ng_GadgetText = (UBYTE *) "Quit UAE";
ng.ng_GadgetID = GAD_EXITEMU;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
/* Eject buttons */
ng.ng_LeftEdge = 262;
ng.ng_TopEdge = offy + 11;
ng.ng_Width = 70;
ng.ng_GadgetID = GAD_EJECT_DF0;
ng.ng_GadgetText = (UBYTE *) "Eject";
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_TopEdge = offy + 28;
ng.ng_GadgetID = GAD_EJECT_DF1;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_TopEdge = offy + 45;
ng.ng_GadgetID = GAD_EJECT_DF2;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_TopEdge = offy + 62;
ng.ng_GadgetID = GAD_EJECT_DF3;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
/* Insert buttons */
ng.ng_LeftEdge = 332;
ng.ng_TopEdge = offy + 11;
ng.ng_GadgetID = GAD_INSERT_DF0;
ng.ng_GadgetText = (UBYTE *) "Insert";
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_TopEdge = offy + 28;
ng.ng_GadgetID = GAD_INSERT_DF1;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_TopEdge = offy + 45;
ng.ng_GadgetID = GAD_INSERT_DF2;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_TopEdge = offy + 62;
ng.ng_GadgetID = GAD_INSERT_DF3;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
/* Sound & Joystick buttons */
ng.ng_LeftEdge = 133;
ng.ng_TopEdge = 97;
ng.ng_GadgetID = GAD_SOUND;
ng.ng_GadgetText = (UBYTE *) "Sound:";
ng.ng_Flags = PLACETEXT_LEFT;
g = CreateGadget(CHECKBOX_KIND, g, &ng, GTCB_Checked, config.do_output_sound ? 1 : 0, TAG_DONE);
ng.ng_TopEdge = 114;
ng.ng_GadgetID = GAD_JOYSTICK;
ng.ng_GadgetText = (UBYTE *) "Fake Joystick:";
g = CreateGadget(CHECKBOX_KIND, g, &ng, GTCB_Checked, config.do_fake_joystick ? 1 : 0, TAG_DONE);
ng.ng_TopEdge = 129;
ng.ng_GadgetID = GAD_LANGUAGE;
ng.ng_GadgetText = (UBYTE *) "Language:";
g = CreateGadget(CYCLE_KIND, g, &ng,
GTCY_Labels, (ULONG) keyb_langs,
GTCY_Active, config.keyboard,
TAG_DONE);
ng.ng_TopEdge = 146;
ng.ng_GadgetID = GAD_FRAMERATE;
ng.ng_GadgetText = (UBYTE *) "Framerate:";
g = CreateGadget(INTEGER_KIND, g, &ng, GTIN_Number, config.framerate, TAG_DONE);
newwindow.Title = "UAE-Control";
newwindow.Width = 419;
newwindow.Height = 171;
newwindow.LeftEdge = 20;
newwindow.TopEdge = 20;
newwindow.FirstGadget = glist;
newwindow.Screen = scr; /* Store screen ptr */
window = OpenWindow(&newwindow);
if (!window)
return (0);
/* Draw texts etc... */
SetAPen(window->RPort, 1);
SetDrMd(window->RPort, JAM2);
Move(window->RPort, 19, offy + 11 + 10);
Text(window->RPort, (UBYTE *) "DF0:", 4);
Move(window->RPort, 19, offy + 28 + 10);
Text(window->RPort, (UBYTE *) "DF1:", 4);
Move(window->RPort, 19, offy + 45 + 10);
Text(window->RPort, (UBYTE *) "DF2:", 4);
Move(window->RPort, 19, offy + 62 + 10);
Text(window->RPort, (UBYTE *) "DF3:", 4);
drawtags[0] = GT_VisualInfo;
drawtags[1] = (ULONG) VisInfo;
drawtags[2] = GTBB_Recessed;
drawtags[3] = 1;
drawtags[4] = TAG_DONE;
DrawBevelBoxA(window->RPort, 14, offy + 10, 390, 17, (struct TagItem *) &drawtags);
DrawBevelBoxA(window->RPort, 14, offy + 27, 390, 17, (struct TagItem *) &drawtags);
DrawBevelBoxA(window->RPort, 14, offy + 44, 390, 17, (struct TagItem *) &drawtags);
DrawBevelBoxA(window->RPort, 14, offy + 61, 390, 17, (struct TagItem *) &drawtags);
print_drive_status();
return (1);
}
void print_drive_status(void)
{
char empty[80];
int len;
UWORD offy = scr->WBorTop + scr->RastPort.TxHeight + 1;
for (len = 0; len < 80; len++)
empty[len] = ' ';
empty[79] = '\0';
SetAPen(window->RPort, 1);
SetDrMd(window->RPort, JAM2);
Move(window->RPort, 59, offy + 11 + 10);
if (config.disk_in_df0) {
len = strlen(config.df0_name);
if (len > MAX_DRV_NAME)
len = MAX_DRV_NAME;
Text(window->RPort, (UBYTE *) config.df0_name, len);
} else {
Text(window->RPort, (UBYTE *) empty, MAX_DRV_NAME);
}
Move(window->RPort, 59, offy + 28 + 10);
if (config.disk_in_df1) {
len = strlen(config.df1_name);
if (len > MAX_DRV_NAME)
len = MAX_DRV_NAME;
Text(window->RPort, (UBYTE *) config.df1_name, len);
} else {
Text(window->RPort, (UBYTE *) empty, MAX_DRV_NAME);
}
Move(window->RPort, 59, offy + 45 + 10);
if (config.disk_in_df2) {
len = strlen(config.df2_name);
if (len > MAX_DRV_NAME)
len = MAX_DRV_NAME;
Text(window->RPort, (UBYTE *) config.df2_name, len);
} else {
Text(window->RPort, (UBYTE *) empty, MAX_DRV_NAME);
}
Move(window->RPort, 59, offy + 62 + 10);
if (config.disk_in_df3) {
len = strlen(config.df3_name);
if (len > MAX_DRV_NAME)
len = MAX_DRV_NAME;
Text(window->RPort, (UBYTE *) config.df3_name, len);
} else {
Text(window->RPort, (UBYTE *) empty, MAX_DRV_NAME);
}
}
BOOL
get_string(UBYTE * buff, LONG max_len)
{
struct Gadget *g, *sg;
struct NewGadget ng;
struct Gadget *gl;
struct Window *win;
struct IntuiMessage *msg;
struct StringInfo *strinfo;
UWORD koodi, msgID;
ULONG classi;
APTR address;
UWORD offy;
BOOL quit, ok;
g = CreateContext(&gl);
if (!g)
return FALSE;
offy = scr->WBorTop + scr->RastPort.TxHeight + 1;
ng.ng_TextAttr = &topaz8;
ng.ng_VisualInfo = VisInfo;
ng.ng_Flags = PLACETEXT_IN;
ng.ng_LeftEdge = 14;
ng.ng_TopEdge = offy + 34;
ng.ng_Width = 90;
ng.ng_Height = 15;
ng.ng_GadgetText = (UBYTE *) "OK";
ng.ng_GadgetID = GAD_OK;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_LeftEdge = 246;
ng.ng_TopEdge = offy + 34;
ng.ng_GadgetText = (UBYTE *) "Cancel";
ng.ng_GadgetID = GAD_CANCEL;
g = CreateGadget(BUTTON_KIND, g, &ng, TAG_DONE);
ng.ng_LeftEdge = 14;
ng.ng_TopEdge = offy + 10;
ng.ng_Width = 322;
ng.ng_Height = 15;
ng.ng_GadgetText = NULL;
ng.ng_GadgetID = GAD_STRING;
sg = CreateGadget(STRING_KIND, g, &ng,
GTST_String, buff,
GTST_MaxChars, max_len,
TAG_DONE);
strinfo = (struct StringInfo *) sg->SpecialInfo;
ok = FALSE;
newwindow.Title = "Amiga Disk File";
newwindow.Width = 350;
newwindow.Height = 65;
newwindow.FirstGadget = gl;
newwindow.Screen = scr;
newwindow.LeftEdge = scr->MouseX - (newwindow.Width / 2);
if (newwindow.LeftEdge + newwindow.Width > scr->Width)
newwindow.LeftEdge = scr->Width - newwindow.Width;
newwindow.TopEdge = scr->MouseY - (newwindow.Height / 2);
if (newwindow.TopEdge + newwindow.Height > scr->Height)
newwindow.TopEdge = scr->Height - newwindow.Height;
win = OpenWindow(&newwindow);
if (win) {
ActivateGadget(sg, win, NULL);
quit = FALSE;
while (!quit) {
WaitPort(win->UserPort);
while (msg = (struct IntuiMessage *) GT_GetIMsg(win->UserPort)) {
classi = msg->Class;
koodi = msg->Code;
address = msg->IAddress;
if (classi == IDCMP_GADGETUP)
msgID = ((struct Gadget *) msg->IAddress)->GadgetID;
else
msgID = msg->Code;
GT_ReplyIMsg((struct IntuiMessage *) msg);
switch (classi) {
case IDCMP_CLOSEWINDOW:
quit = TRUE;
break;
case IDCMP_GADGETUP:
switch (msgID) {
case GAD_CANCEL:
quit = TRUE;
break;
case GAD_OK:
case GAD_STRING:
strcpy(buff, strinfo->Buffer);
quit = ok = TRUE;
break;
}
break;
default:
break;
}
}
}
CloseWindow(win);
}
FreeGadgets(gl);
return ok;
}

View File

@ -0,0 +1,53 @@
/*
* UAE - The U*nix Amiga Emulator
*
* UAE-Control - Emulator control from inside emulation
* (c) 1996 Tauno Taipaleenmaki <tataipal@raita.oulu.fi>
* (c) 1998 Cloanto <info@cloanto.com>
*/
#define GAD_RESET 1
#define GAD_DEBUG 2
#define GAD_EXITEMU 3
#define GAD_EJECT_DF0 4
#define GAD_INSERT_DF0 5
#define GAD_EJECT_DF1 6
#define GAD_INSERT_DF1 7
#define GAD_EJECT_DF2 8
#define GAD_INSERT_DF2 9
#define GAD_EJECT_DF3 10
#define GAD_INSERT_DF3 11
#define GAD_SOUND 12
#define GAD_JOYSTICK 13
#define GAD_FRAMERATE 14
#define GAD_CHIPMEMSIZE 15
#define GAD_SLOWMEMSIZE 16
#define GAD_FASTMEMSIZE 17
#define GAD_LANGUAGE 18
#define GAD_OK 1
#define GAD_CANCEL 2
#define GAD_STRING 3
/*
* Configuration structure
*/
struct UAE_CONFIG
{
ULONG version;
ULONG chipmemsize;
ULONG slowmemsize;
ULONG fastmemsize;
ULONG framerate;
ULONG do_output_sound;
ULONG do_fake_joystick;
ULONG keyboard;
UBYTE disk_in_df0;
UBYTE disk_in_df1;
UBYTE disk_in_df2;
UBYTE disk_in_df3;
char df0_name[256];
char df1_name[256];
char df2_name[256];
char df3_name[256];
};

View File

@ -0,0 +1,78 @@
static int (*calltrap)(...) = (int (*)(...))0xF0FF60;
static int GetVersion(void)
{
calltrap (0);
}
static int GetUaeConfig(struct UAE_CONFIG *a)
{
calltrap (1, a);
}
static int SetUaeConfig(struct UAE_CONFIG *a)
{
calltrap (2, a);
}
static int HardReset(void)
{
calltrap (3);
}
static int Reset(void)
{
calltrap (4);
}
static int EjectDisk(ULONG drive)
{
calltrap (5, "", drive);
}
static int InsertDisk(UBYTE *name, ULONG drive)
{
calltrap (5, name, drive);
}
static int EnableSound(void)
{
calltrap (6, 2);
}
static int DisableSound(void)
{
calltrap (6, 1);
}
static int EnableJoystick(void)
{
calltrap (7, 1);
}
static int DisableJoystick(void)
{
calltrap (7, 0);
}
static int SetFrameRate(ULONG rate)
{
calltrap (8, rate);
}
static int ChgCMemSize(ULONG mem)
{
calltrap (9, mem);
}
static int ChgSMemSize(ULONG mem)
{
calltrap (10, mem);
}
static int ChgFMemSize(ULONG mem)
{
calltrap (11, mem);
}
static int ChangeLanguage(ULONG lang)
{
calltrap (12, lang);
}
static int ExitEmu(void)
{
calltrap (13);
}
static int GetDisk(ULONG drive, UBYTE *name)
{
calltrap (14, drive, name);
}
static int DebugFunc(void)
{
calltrap (15);
}

201
amiga/source/uae_rcli.c Normal file
View File

@ -0,0 +1,201 @@
;/* compile with: execute uae_rcli.c
failat 11
sc uae_rcli.c opt link to uae_rcli noicons
if ERROR
gcc uae_rcli.c -O3 -o uae_rcli -noixemul
endif
quit
*/
/*
* uae_rcli.c - UAE remote cli
*
* (c) 1997 by Samuel Devulder
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <libraries/dosextens.h>
#ifdef __GNUC__
#include "../../src/include/uaeexe.h"
#else
#include "//src/include/uaeexe.h"
#endif
#define NAME "uae_rcli"
#define LEN 512
static int (*calltrap)(char *, int) = (void*)UAEEXE_ORG;
static int delay = 20;
static int debug = 0;
static int nofifo = 0;
static ULONG fifo;
static char buf[LEN];
/*
* lowlevel I/O
*/
static void WR(ULONG f,char *s)
{
Write(f,s,strlen(s));
}
static void PR(char *s)
{
WR(Output(),s);
}
/*
* self explanatory
*/
static void usage(char *name)
{
PR("Usage: ");PR(name);PR(" [-h|?] [-debug] [-nofifo] [<delay>]\n");
exit(0);
}
/*
* grab options
*/
static void parse_cmdline(int ac, char **av)
{
char *name = *av++;
for(;--ac;++av) {
if(!strcmp(*av,"-debug")) debug = 1; else
if(!strcmp(*av,"-nofifo")) nofifo = 1; else
if(!strcmp(*av,"-h")) usage(name); else
if(!strcmp(*av,"?")) usage(name); else
if(**av>='0' && **av<='9') delay = atoi(*av); else
{PR("Bad argument: \"");PR(*av);PR("\"\n");exit(0);}
}
if(!delay) delay = 1;
}
/*
* See if command matches. Returns pointer to arguments.
*/
static char *match(char *src,char *cmd)
{
while(*src == ' ' || *src == '\t') ++src;
while(*src && tolower(*src) == tolower(*cmd)) {++src;++cmd;}
while(*src==' ' || *src=='\t') ++src;
return (*cmd)?NULL:src;
}
/*
* get command
*/
static int getcmd(void)
{
if(debug) PR("-> Calltrap\n");
if(calltrap(buf, LEN-1)) {
if(debug) PR("-> 1\n");
return 1;
} else {
if(debug) PR("-> 0\n");
return 0;
}
/*
PR(">> ");
if(fgets(buf,LEN-1,stdin) == NULL) strcpy(buf,"quit");
if(*buf=='\n') return 0;
return 1;
*/
}
/*
* execute command
*/
static void my_exec(void)
{
if(debug) {PR("-> Exec \"");PR(buf);PR("\"\n");}
if(fifo) {
WR(fifo,buf);
WR(fifo,"\n");
} else { /* nofifo => emulate cli */
char *s;
if((s=match(buf,"cd"))) {
if(*s==';' || !*s) {
char buff[128];
getcwd(buff,sizeof(buff)-1);
PR(buff);PR("\n");
} else {
chdir(s);
}
} else {
System(buf, NULL);
}
}
*buf = '\0';
}
/*
* Open without requester
*/
ULONG myOpen(char *name, ULONG mode)
{
ULONG rt, wd;
struct Process *pr;
pr = (void*)FindTask(NULL);
if(pr->pr_Task.tc_Node.ln_Type != NT_PROCESS) return 0;
wd = (ULONG)pr->pr_WindowPtr;
pr->pr_WindowPtr = (APTR)-1;
rt = Open(name,mode);
pr->pr_WindowPtr = (APTR)wd;
return rt;
}
/*
* Guess :)
*/
int main(int ac, char **av)
{
int running = 1;
parse_cmdline(ac,av);
if(!nofifo) {
if(debug) PR("-> Open fifo\n");
fifo = myOpen("fifo:"NAME"/wmke",MODE_NEWFILE);
if(!fifo) {
if(debug) PR("-> Starting fifo-handler\n");
System("run <nil: >nil: l:fifo-handler",NULL);
Delay(100);
if(debug) PR("-> Reopen fifo\n");
fifo = myOpen("fifo:"NAME"/wmke",MODE_NEWFILE);
}
}
if(fifo) {
if(debug) PR("-> Spawning shell\n");
System("run execute fifo:"NAME"/rsk",NULL);
if(debug) WR(fifo,"echo \"-> Remote cli running\"\n");
} else if(debug) PR("-> No fifo found\n");
do {
while(running && getcmd()) {
if(match(buf,"endcli")) running = 0; else
if(match(buf,"endshell")) running = 0; else
if(match(buf,"quit")) running = 0;
if(SetSignal(0L, SIGBREAKF_CTRL_C|SIGBREAKF_CTRL_D) &
(SIGBREAKF_CTRL_C|SIGBREAKF_CTRL_D)) {
running = 0;
}
if(running) my_exec();
}
if(running) Delay(delay);
} while(running);
if(debug) PR("-> Exiting\n");
(*calltrap)(0,0);
if(fifo) {
Close(fifo);
}
}

164
amiga/source/uaectrl.c Normal file
View File

@ -0,0 +1,164 @@
/***********************************************************
* UAE - The U*nix Amiga Emulator *
* *
* UAE-Ctrl -- Emulator Control from Inside Emulation *
* (c) 1996 Tauno Taipaleenmaki <tataipal@raita.oulu.fi> *
* *
* Version 0.1 *
* *
* Command line version, Should work with any KS version *
* *
***********************************************************/
#include <clib/exec_protos.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "uae-control.h"
#include "uae_pragmas.h"
#define MAX_DRV_NAME 20
struct UAE_CONFIG config;
void print_drive_status(void);
void quit_program(int error, char *text);
/************************************
* Main program *
************************************/
int main()
{
int quit = 0,i, correct,number;
char buf[257];
char *langs[]={
"US\0","DE\0","SE\0","FR\0","IT\0",
};
/* Read UAE configuration */
i = GetUaeConfig( &config );
while( quit == 0 ) {
printf(" UAE-Control v0.1\n\n");
printf(" 1) Reset\n");
printf(" 2) Debug\n");
printf(" 3) Exit Emulator\n");
printf(" 4) Change framerate (Currently : %ld)\n", config.framerate);
printf(" 5) Toggle sound (Currently : %s)\n", config.do_output_sound ? "ON" : "OFF");
printf(" 6) Toggle fake joystick (Currently : %s)\n", config.do_fake_joystick ? "ON" : "OFF");
printf(" 7) Change language (Currently : %s)\n", langs[config.keyboard]);
printf(" 8) Eject a disk\n");
printf(" 9) Insert a disk\n");
printf("10) Exit UAE-Control\n\n");
correct = 0;
while( correct == 0 ) {
printf(" Command : ");
gets( buf );
i = atoi( buf );
if ((i > 0) && (i < 11))
correct = 1;
}
switch( i ) {
case 1:
HardReset();
break;
case 2:
DebugFunc();
break;
case 3:
ExitEmu();
break;
case 4:
printf(" Enter new framerate (1-20) :");
gets( buf );
number = atoi( buf );
if (SetFrameRate (number))
GetUaeConfig(&config);
else
printf(" Illegal value, not changed.\n");
break;
case 5:
if (config.do_output_sound)
DisableSound();
else
EnableSound();
GetUaeConfig( &config );
break;
case 6:
if (config.do_fake_joystick)
DisableJoystick();
else
EnableJoystick();
GetUaeConfig( &config );
break;
case 7:
printf(" 1 = US, 2 = DE, 3 = SE, 4 = FR, 5 = IT\n");
printf(" What will it be : ");
gets( buf );
number = atoi( buf );
if ((number >= 1) && (number <= 5)) {
ChangeLanguage( number-1 );
GetUaeConfig( &config );
} else {
printf(" Illegal value, not changed.\n");
}
break;
case 8:
print_drive_status();
printf(" Eject which drive (1-4): ");
gets( buf );
number = atoi( buf );
if ((number >= 1) && (number <=4 )) {
EjectDisk( number-1 );
GetUaeConfig( &config );
} else {
printf(" Illegal drive, not changed.\n");
}
break;
case 9:
print_drive_status();
printf(" Enter disk to drive (1-4): ");
gets( buf );
number = atoi( buf );
if ((number >= 1) && (number <= 4)) {
printf("Name of diskfile :");
gets( buf );
InsertDisk( (UBYTE *)&buf, number - 1 );
GetUaeConfig( &config );
} else {
printf(" Illegal drive, not changed.\n");
}
break;
case 10:
quit = 1;
break;
}
}
quit_program(0, "");
return(0);
}
/******************************************
* Prints drive status *
******************************************/
void print_drive_status(void)
{
printf(" DF0 : %s\n", config.disk_in_df0 ? config.df0_name : "EMPTY");
printf(" DF1 : %s\n", config.disk_in_df1 ? config.df1_name : "EMPTY");
printf(" DF2 : %s\n", config.disk_in_df2 ? config.df2_name : "EMPTY");
printf(" DF3 : %s\n", config.disk_in_df3 ? config.df3_name : "EMPTY");
}
/******************************************
* Quits the program *
******************************************/
void quit_program(int error, char *text)
{
if (error > 0) {
printf(" UAE-Control v0.1\n");
printf(" (c)1996 Tauno Taipaleenmaki\n\n");
printf(" ERROR: %s\n", text);
}
}

9
bootstrap.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
aclocal -I m4 \
&& automake --foreign --add-missing \
&& autoconf
cd src/tools
aclocal
autoconf

1415
config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1510
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

21264
configure vendored Executable file

File diff suppressed because it is too large Load Diff

1544
configure.in Normal file

File diff suppressed because it is too large Load Diff

479
depcomp Executable file
View File

@ -0,0 +1,479 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
# This program 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, or (at your option)
# any later version.
# This program 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.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0

33
docs/bsdsocket.txt Normal file
View File

@ -0,0 +1,33 @@
Networking
==========
The Amiga environment running within UAE may share the host machine's
network access via an emulation of the bsdsocket.library (this library
provides the standard Amiga networking API). This isn't supported on
all target platforms yet, but it should work on Linux, Unix and
Mac OS X.
The emulation of the bsdsocket.library API is not complete, but should
be sufficient to allow you to use most popular AmigaOS network
clients, such as web browsers and mail readers.
To enable the bsdsocket.library emulation (assuming you are using a
version of E-UAE with this feature compiled in), add the option
bsdsocket_emu=true
to your config file.
Note that you do not need to install any real Amiga network stack - such
as AmiTCP or Miami - to be able to use the bsdsocket emulation.
Also note that when using the bsdsocket.library emulation that your
AmigaOS environment will use the same IP address as the host platform.
This may limit the types of networking software you can run in the
emulated Amiga environment. For example, Amiga software will not be
able to bind to ports already in use by host software, and your host
operating system may impose access controls on certain ranges of ports.
Older versions of E-UAE required that a bsdsocket.library wrapper file
be installed somewhere in the LIBS: path in your Amiga environment.
This is no longer the case, and this file should now be removed.

196
docs/cmd-line.txt Normal file
View File

@ -0,0 +1,196 @@
Command line options for E-UAE
==============================
E-UAE supports the following command-line options. Note that, where
applicable, these will over-ride any similar options specified in the
default configuration file.
In the following, <path> should be substituted with an appropriate file path
and <n> with an integer.
This document (like the rest of the documentation) is a work-in-progress.
-h
Displays summary of configuration options.
-f <path>
Load the configuration file specified by <path>. See configuration.txt for
more information about configuration files. For example:
-f ~/my_uae_configs/a1200.uaerc
-s <option>
Specify an option in configuration file (<key>=<value>) format. For
example, use
-s ntsc=true
to start E-UAE in NTSC mode.
See configuration.txt for supported options.
-0 <path>
-1 <path>
-2 <path>
-3 <path>
Mount the floppy disk image specified by <path> in drive 0/1/2/3. For
example:
-0 somedisk.adf
-r <path>
Load the ROM image specified by <path>.
-K <path>
Use the key file specified by <path> to decrypt an encrypted ROM image (from
Cloanto's AmigaForever package).
-C<n>
Selects type of CPU to emulate. The value <n> corresponds to CPU types as
follows:
0: 6800
1: 68010
2: 68020
3: 68020/68881
4: 68040
-w<n>
Selects the performance model for the CPU emulation.
A value of 0 for <n> corresponds to 'real' CPU speed, that is,
approximately A500 speed; a value of -1 corresponds to the 'max' CPU speed,
that is, the emulation will run as fast as your system allows. A positive
value for <n> will select 'adjustable' CPU speed, where <n> specifies the
number of virtual emulator cycles that each CPU instructions will take and
can be between 1 and 5120. (Positive values for <n> correspond to the same
values specified with the 'finegrain_cpu_speed=' configuration option).
-v<n>
Selects the type of Amiga chip set to emulate. The value <n> corresponds to
chip set types as follows:
0: OCS
1: OCS but with the ECS or "Fat" Agnus.
3: ECS
4: AGA
-c<n>
Emulate <n> * 512 KB of Chip memory. The valid range of values for <n> is
from 1 to 16, which corresponds to 512 KB to 8 MB of Chip memory. For example:
-c4
will cause E-UAE to emulate 2 MB of Chip memory.
-b<n>
Emulate <n> * 256 KB of Slow memory. Valid values for <n> include 0, 2, 4
and 6, which corresponds to 0 KB, 512 KB, 1 MB and 1.5 MB, respectively.
-F<n>
Emulate <n> MB of ZorroII Fast memory. A maximum of 8 MB is supported.
-Z<n>
Emulate <n> MB of ZorroIII Fast memory. A maximum of 512 MB is supported.
-U<n>
Emulate <n> MB of video memory on the virtual Picasso96 graphics card.
Selecting <n> greater than 0, enables the Picasso96 emulation, and a maximum
of 32 MB of video memory may be emulated.
-m/M
Use filesystem as Amiga volume, arguments are: access,'Amiga
volume-name':'host directory path' - where 'access' can be 'read-only' or
'read-write'
-W
Hardfile specifications, arguments are: access, sectors, surfaces,
reserved, blocksize, path format
-S
parse_sound_spec
-R
frame-skip rate, between 1 and 20
-i
print illegal memory access by Amiga software?
-J
joystick: Use -J xy, where x and y can be 0 for joystick 0, 1 for joystick
1, M for mouse, and a, b or c for different keyboard settings.
-t
test drawing speed
-G
disable GUI and goes straight to emulator
-D
Enable the debugger
-n
Perform blits immediately, 0: disable, 1: enable
-l
keyboard language: (possible arguments: de, dk, us, se, fr, it, es)
-O
The format to use is: "width:height:modifiers", where modifiers are: l:
Treat display as lo-res, x: Center display horizontally, y: Center display
vertically, d: double line, a: fullscreen Amiga, p: fullscreen Picasso96,
c: Correct aspect ratio
-H
color_mode, or amiga_screen_type (if compiled with Amiga GFX support)
Options specific to the X11 graphics driver
===========================================
-L
Use "low-bandwidth" mode, which may reduce the amount of data transferred
between E-UAE and the X server. That's particularly an advantage when these
are running on two different machines in a network.
-T
Use the MIT-SHM extension. This may not be available on all machines, and
it will not work if E-UAE and the X server are not running on the same
machine. In all other configurations, turning on this option will give you
a huge speed improvement.
-x
Turn off the X11 mouse cursor.
Options specific to the AmigaOS graphics driver
===============================================
-T
If using a palette-mapped display (256 colours or fewer), render the output
in grey-scale rather than colour.
-x
If using a palette-mapped display (256 colours or fewer), don't dither the
output.
Options specific to the Curses graphics driver
==============================================
-x
Enable reverse video.

134
docs/compiling.txt Normal file
View File

@ -0,0 +1,134 @@
Compiling E-UAE
===============
E-UAE should be able to compile on any platform with a POSIX-like shell
environment, a C compiler and make. Version 2.95 or newer of the GNU C
Compiler is recommended as is GNU make, but alternative compilers and
versions of make may work. Some features may be GCC-specific, however.
Currently, for example, the JIT - the compiler which dynamically
translate 68k opcodes to x86 opcodes - does require GCC (and GAS, the
GNU assembler).
Currently zlib is also required to build E-UAE for all supported
platforms. This isn't much of hardship since zlib is available
everywhere, but shout loudly enough and I'll fix this.
Configuring
===========
The first step to compiling E-UAE is to generate a makefile suitable
for your intended target system. This is done by running the configure
script.
Run ./configure --help to see the list of options that the configure
script supports. Most options will automatically default to
appropriate values.
Here are a selection of the the supported options:
The config script for UAE supports a bunch of compile-time options for
selecting what features are built into UAE. Here's a selection:
--enable-jit
Build CPU emulation with JIT compiler. Currently only supported on
x86 platforms (known to work on Linux, Solaris, AROS, and BeOS, but
should work on most Unix-like platforms, providing you are building
with GCC). Defaults to enabled when building for x86.
--enable-natmem
If building the JIT, include support for direct memory access (which
greatly improves performance). Currently only supported on Linux.
Defaults to enabled when building for Linux/x86.
--enable-autoconfig
Include emulation of the Amiga's autoconfig expansion system.
Required for emulating ZII or ZIII memory, emulating disks, SCSI
devices, network stacks - in fact, most of the cool stuff that UAE
can do. Currently defaults to enabled providing thread support is
available (which should be on all the supported host platforms).
This dependency on threads will eventually be removed.
--enable-aga
Support emulation of AGA chipset. Defaults to true. Required if you
want to emulate an A1200, A4000 or CD32.
--enable-scsi-device
Build with SCSI emulation. This requires the libscg and libschily
libraries and headers from cdrtools 2.0.x (see below).
--enable-cdtv
Enable CDTV emulation. Requires SCSI emulation. Defaults to enabled
if SCSI emulation is enabled.
--enable-cd32
Enable CD32 emulation. Requires SCSI emulation and AGA support be
enabled. Defaults to enabled if both these are enabled.
--enable-bsdsock
Build with support for emulated network stack (an emulated
bsdsocket.library). This works only on Unix platforms at the moment
(including Linux and OS X).
--with-caps
Build with support for IPF (CAPS) images. This requires the IPF
development files from http://www.caps-project.org/
--with-caps-prefix=<dir>
Optional absolute path to where the CAPS API is installed on your
system.
--with-sdl-gfx
Use SDL library for graphics output.
--with-sdl-gl
Use SDL library for graphics output and enable OpenGL display output.
--with-sdl-sound
Use SDL library for audio output.
Note that the '--enable-xyz' options all have a '--disable-xyz'
counterpart to disable that feature.
Compiling on MacOS X
--------------------
At the moment, only building against the SDL framework is supported.
Configure with
./configure --with-sdl-gfx --with-sdl-sound
and any other options you fancy.
If you are building on an x86 OS X box, then the SDL test in the
configure script currently fails. It should build okay if you disable
the SDL test. That is, configure with:
./configure --with-sdl-gfx --with-sdl-sound --disable-sdltest
I've not tested this myself, however, since I don't have a MacIntel
box.
Building the SCSI emulation
---------------------------
E-UAE's SCSI emulation may use libscg, the SCSI transport layer from
the cdrtools project (see http://cdrecord.berlios.de). Note, however,
due to a license change in the cdrtools project, only versions of
cdrtools up to 2.01.01a08 inclusive may be used.
If libscg is not available on your build system, download a recent
version of cdrecord and compile it. Then run the ./src/install_libscg
script in the E-UAE source archive to move the relevant files from
cdrecord to the E-UAE source directory.
If your system has the libscg headers and library installed in a
non-standard location, you can pass the --with-libscg-prefix option or
the --with-libscg-includedir and --with-libscg-libdir options to the
configure script to specify where these are installed.
On Linux systems, if libscg is not available, E-UAE tries to use a
Linux-specific SCSI emulation that is based on some ioctl() commands.

971
docs/configuration.txt Normal file
View File

@ -0,0 +1,971 @@
Configuring E-UAE
=================
E-UAE may be configured via options supplied in a plain-text configuration
file. This configuration file contains options of the form <key>=<value> and
each new option must begin a new line. Blanks lines are ignored, and lines
beginning with a '#' character are treated as comments and thus also
ignored.
When E-UAE is started it tries to load a default configuration file. Where
it looks for this file is platform-dependent, but typically it will look for
a file called '.uaerc' in the current directory and (on multi-user
platforms) in the user's home directory. On MacOS X, the default is called
'default.uaerc' instead since 'dot files' are not visible in Finder,
the OS X file manager.
You may tell E-UAE to load a configuration file in addition to the default by
passing the '-f' switch to E-UAE on the command line. Any options found in
this file will override the values of the same options in the default file.
The '-s' switch may also be used to specify a single <key>=<value> option on
the command line, which, again, will override options found in the default
file.
The default values for E-UAE's configuration options will cause E-UAE to
emulate a 68000-based ECS system with 512 KB of Chip memory and 512 KB of
Slow memory. The only option you absolutely need to specify is the path to
the Kickstart image you want to use (unless you wish to use E-UAE's minimal
Kickstart emulation, in which case you must instead supply the path to a
floppy disk image to boot from).
In the following descriptions of E-UAE's configuration options, the template
<n> refers to an integer value, <boolean> to a value of 'true' or 'false',
and <path> refers to a file path using whatever conventions the host platform
uses to specify paths.
This document is a work-in-progress.
General options
===============
The following options all have a prefix of the form <target>. The value of
<target> corresponds to the host platform on which you are running E-UAE.
Target Platform
------ --------
amiga AmigaOS (and clones such as AROS and MorphOS)
beos BeOS
unix Unix-like platforms - including Linux and Max OS X
<target>.rom_path=<path>
Set the default path where Kernel ROM images may be found. The default is
platform-dependent.
Examples:
unix.rom_path=/home/evilrich/UAE/roms/
<target>.floppy_path=<path>
Set the default path where floppy disk images may be found. The default is
platform-dependent.
Examples:
amiga.floppy_path=WORK:Apps/UAE/ADFs/
<target>.hardfile_path=<path>
Set the default path where file-based hard disk images can be found. The
default is platform-dependent.
use_gui=<boolean> (default=true)
Open a configuration GUI at start-up before starting the emulation proper.
This option is ignored on platforms without a configuration GUI or if
E-UAE has been built without such a GUI.
use_debugger=<boolean> (default=false)
Open the built-in debugger when the emulation starts. This option is
ignored if E-UAE has been built without debugging support or if the
debugger cannot be opened due to platform-specific restrictions (at
the moment the debugger requires a terminal/console window, so it
typically only works if you start E-UAE from a shell terminal).
Host CPU-specific options
=========================
x86.use_tsc=<boolean> (default=true)
On x86 machines, if this option is true then the processor's timestamp
counter will be used for timing in E-UAE. This used to be a problem for
machines which did power-saving by scaling down the CPU's clock frequency,
but with E-UAE 0.8.28 and above this should no longer be an issue on
Linux. If you are running E-UAE on some other x86 platform which
does frequency scaling, then set this option to false. Performance
will suffer, but at least timing won't be affected by changes in CPU
frequency.
amd64.use_tsc=<boolean> (default=true)
Same as the option above, but applies to AMD64 processors.
ppc.use_tbc=<boolean> (default=true)
On PPC machines, if this option is true then use the processor's timebase
register for timing in E-UAE. Since the PPC's TBC isn't affected by
frequency scaling, this option is of little use and is supported only for
completeness. It may be useful if E-UAE misdetects or miscalibrates your
machine's timebase frequency (if it does, please let me know).
CPU emulation options
=====================
cpu_type=<type> (default=68000)
Select model of 68k processor to emulate. Valid values for <type> are
68000, 68010, 68ec020, 68ec020/68881, 68020, 68020/68881, 68040 and 68060.
Note:
1) The values '68ec020' and '68ec20/68881' correspond to the 68020 model
with a 24-bit address bus (as found in the A1200). Zorro III memory
and/or a RTG graphics card cannot be emulated.
2) The values '68ec020/68881' and '68020/68881' correspond to an 020 with a
68881 floating point co-processor.
3) The 68060 emulation is incomplete and not yet useful.
cpu_speed=<speed> (default=real)
<speed> configures the performance of the interpretive CPU emulation
relative to the Amiga chipset. This may have the value 'real', 'max' or
can be an integer between 1 and 20.
If set to 'real', E-UAE will try to emulate the performance of an original
7MHz 68000-based Amiga such as an A500. That is, the relative balance of
time spent emulating the CPU and the Amiga chipset will be similar to the
performance of a real Amiga and E-UAE will try do the same amount of CPU
work per display frame as a real 68000-based Amiga. Additionally, if
any time is left over after emulating the A500's CPU and chipset in
each display frame, then E-UAE will wait until until the next
display frame is due.
Thus, the setting 'real' is recommended for games designed to run on
an A500-class Amiga but which won't work on faster Amigas. This includes
many classic Amiga games.
If set to 'max', the CPU emulation will run at the maximum speed that the
host CPU can achieve. E-UAE will spend as much time as it can
emulating the 68000 CPU and will not wait at all per frame.
Integer values for <speed> adjust the relative amounts of time devoted to
the CPU and custom chip emulations. Lower values increase the speed of
the CPU emulation at the expense of the custom chips; higher values do
vice-versa. Adjusting this value may allow better performance with some
software. For example, when running Workbench on an RTG screen, better
performance can be achieved from the interpretive emulation with a low
value for 'cpu_speed'.
finegrain_cpu_speed=<n> (default=N/A)
This option adjusts the relative speeds of the CPU and custom chip
emulations just like supplying an integer value in cpu_speed= does, but it
allows a more precise setting of the balance. The value <n> corresponds to
the value supplied in cpu_speed= multiplied by 512.
cpu_compatible=<boolean> (default=false)
If enabled, E-UAE will use a slower but more compatible version of the CPU
emulation. This may be necessary to run some some demos and games
correctly.
This option currently only applies when emulating a plain 68000 CPU.
cpu_cycle_exact=<boolean> (default=false)
If enabled, E-UAE will employ a CPU emulation which tries to fully
emulate the relative timing of CPU and chipset cycles. This is much more
demanding even than the "compatible" CPU emulation, but more accurate -
and so may be necessary to correctly run software which aggressively uses
the Amiga chipset.
This option only applies when emulating a plain 68000 CPU.
JIT compiler options
====================
The following options configure the dynamically-recompiling CPU emulation
(or JIT compiler). The JIT engine translates 68k instructions for
the Amiga CPU directly into instructions for the host CPU and caches
these translated instructions in host memory. It's thus much faster
than the interpretative emulation, but it may be less compatible
with some software.
Notes:
1) The JIT is currently only supported on x86 host systems.
2) Direct memory access in JIT compiled code (a method used to speed up
memory access when using the JIT - this has nothing to do with hardware
DMA) is currently only supported when hosting on x86 Linux.
3) You must emulate a 68ec020 CPU or better to be able to use the JIT
compiler.
4) To enable direct memory access in compiled code, you must emulate a
32-bit CPU, e.g., a full 68020, or a 68040.
cachesize=<n> (default=0)
Use a cache of <n> KBs for storing code generated by the JIT compiler. If
set to 0, the JIT compiler will be disabled. Setting this option between
1024 and 8192 (i.e., 1 to 8 MB of cache) should allow the best performance.
compfpu=<boolean>
If true, translate m68k FPU instructions to native FPU instructions.
If false, interpret FPU instructions. Only applies if a CPU with a
floating-point unit is selected.
Chipset options
===============
chipset=<type> (default=ecs_agnus)
Specifies the model of Amiga chipset to emulate. Valid value for type are:
Type Description
---- -----------
ocs The original Amiga chipset, as found in the A1000, A500, etc.
ecs_agnus The OCS chipset, but with the ECS or "Fat" Agnus.
ecs The full ECS chipset, as found in the A500+ and the A600.
aga The AGA chipset, as found in the A1200 and A4000.
ntsc=<boolean> (default=false that is, PAL)
If enabled, the NTSC variant of the chipset model is emulated. If
disabled, the PAL variant is emulated.
immediate_blits=<boolean> (default=false)
If enabled then blits performed by the Amiga chipset emulation will be
reported as finishing immediately. This may improve performance at the
price of compatibility. This option is ignored in cycle-exact mode.
collision_level=<type> (default=playfields)
Specifies the level of collision-detection performed by the Amiga chipset
emulation. Valid values for <type> are
Type Description
---- -----------
none No collision-detection is emulated.
sprites Sprite-to-sprite collisions are detected.
playfields Sprite-to-sprite and sprite-to-playfield collisions (that is
collisions of sprites with the background) are detected.
full Full collision-detection (including collisions between the
background and itself).
The table above is ordered by the amount of work required to do the
emulation. Thus, emulating just sprite-to-sprite collisions is faster
than also emulating playfield collisions which is faster than full
collision-detection.
Full collision-detection is rarely required by software and much software
(even games) will work with collision-detection disabled.
ROM options
===========
kickstart_rom_file=<path>
The file path of a Kickstart ROM image to load. <path> may either be an
absolute path or a path relative to the current directory when E-UAE was
run. The token '$(FILE_PATH)' at the start of a path will be expanded to
the path specified by the <target>.rom_path= option.
If <path> is empty, E-UAE will use its built-in Kickstart emulation rather
than a real Kickstart image. This requires a valid floppy disk to boot
from mounted in the emulated DF0: drive. The Kickstart emulation is
sufficient to play many classic Amiga games.
Examples:
kickstart_rom_file=/home/evilrich/UAE/ROMs/kick130.rom
kickstart_rom_file=../shared/roms/kick310.rom
kickstart_rom_file=$(FILE_PATH)/kick.rom
kickstart_key_file=<path>
Kickstart ROM images provided by Cloanto in its Amiga Forever
distribution are encrypted. This option specifies the key file required
to decrypt such an image. <path> may either be an absolute path to the ROM
key file or a path relative to the current directory when E-UAE was run.
The token '$(FILE_PATH)' at the start of a path will be expanded to the
path specified by the <target>.rom_path= option.
Examples:
kickstart_key_file=~/rom.key
kickstart_ext_rom_file=<path>
The ROM images required to emulate a CDTV or CD32 are available as two
files: a standard image (loaded via the kickstart_rom_file= option above)
and an 'extended' image.
This option specifies the file path of an extended ROM image to load.
<path> may either be an absolute path or a path relative to the current
directory when E-UAE was run. The token '$(FILE_PATH)' at the start of a
path will be expanded to the path specified by the <target>.rom_path=
option.
If E-UAE has been compiled without support for emulating the CDTV or CD32,
then this option will be ignored.
cart_file=<path>
The path of a cartridge ROM to load. This is used to load a ROM image
from an Action Replay cartridge.
kickshifter=<boolean> (default=false)
If enabled, the Kickstart ROM image will be patched after it is loaded into
memory to support the running of Shapeshifter, the software-based classic Mac
emulation for AmigaOS, within E-UAE.
RAM options
===========
chipmem_size=<n> (default=1, that is, 512 KB)
Emulate <n> * 512 KB of Chip memory (memory that is accessible by the Amiga
chipset). The valid range of values for <n> is between 1 and 16, that is,
from 512 KB to 8 MB.
Note that E-UAE must emulate an ECS ("Fat") Agnus to be able to use 1 MB
of Chip memory or more. Also note that Fast memory cannot be used if you
select more than 2MB of Chip memory.
Example:
chipmem_size=2
would provide 1 MB of Chip memory.
bogomem_size=<n> (default=2, that is, 512 KB)
Emulate <n> * 256 KB of "Slow" memory. The valid range of values for <n>
is 0, 2, 4 and 7, that is 0 KB, 512 KB, 1 MB and 1.8 MB,
respectively. If AGA emulation is enabled, then the maximum is 1 MB.
"Slow" memory is the type of memory provided by the A500 trapdoor slot.
It cannot be accessed by the Amiga chipset like Chip memory, but, unlike
Fast memory, this memory cannot be accessed by the CPU when the custom
chipset is busy - hence the term "Slow".
Some old games and demos may require this type of memory. If E-UAE
reports strange exceptions occuring when booting a floppy or weird
accesses to custom chip registers, then try adding some "Slow" memory.
Really old games may fail when "Slow" memory is added.
fastmem_size=<n> (default=0)
Emulate <n> MB of Zorro II Fast memory. This is type of memory found on
memory expansions cards for the A2000 and the A1200 trapdoor slot.
z3mem_size=<n> (default=0)
Emulate <n> MB of Zorro III Fast memory.
E-UAE must emulate a 32-bit CPU (a 68020 or better, not an 68ec020) to
support the emulation of Zorro III memory.
gfxcard_size=<n> (default=0)
Emulate an RTG graphics card with <n> MB of graphics memory. Selecting <n>
greater than 0, enables the graphics card or so-called 'Picasso96'
emulation. A maximum of 32 MB of graphics card memory may be emulated.
E-UAE must emulate a 32-bit CPU (a 68020 or better, not an 68ec020) to
support the graphics card emulation.
Floppy drive options
====================
In the following options, the template <drive> specifies the emulated drive
number. Up to four floppy drives may be emulated, numbered 0 to 3,
corresponding to the AmigaDOS devices DF0: to DF3:, respectively. Drive 0 is
the first drive, and drive in which you would typically insert a floppy disk
to boot from.
E-UAE supports file-based images of Amiga floppy disks in a number of
different file formats (see floppies.txt).
floppy<drive>=<path>
Specifies the path of a floppy disk image to mount in drive DF<drive>:.
<path> may either be an absolute path or a path relative to the current
directory when E-UAE was run. The token '$(FILE_PATH)/' at the start of a
path will be expanded to the path specified by the <target>.floppy_path=
option.
floppy<drive>type=<type> (default=0 for drives 0 and 1, -1 for drives 2 and 3)
Specifies the type of disk mounted in the emulated for drive DF<drive>:.
<type> may have the following values
Type Disk type
---- ---------
0 A 3.5" double-density disk. This is the disk type supported by
standard Amiga floppy drives. Such disks have a capacity of 880 KB
when formatted under AmigaDOS.
1 A 3.5" high-density disk. This type of disk was supported by some
add-on Amiga drives and in the drives shipped with some A4000s. A
high-density disk formatted under AmigaDOS has a capacity of 1.76 MB.
2 A 5.25" single-density disk. This disk type is for legacy
compatibility and was rarely used by real Amigas.
This option may also be set to -1 to disable the drive.
floppy_speed=<speed> (default=100)
E-UAE's floppy drive emulation will work at <speed> per cent of a real
Amiga floppy drive (relative to the speed of the rest of the emulation).
Valid values are from '100' to '800', that is 1x to 8x the speed of a
standard Amiga floppy drive.
Setting 'floppy_speed=' to values other then 100 may affect compatibility
with Amiga software, especially the floppy-based copy-protection systems
included with some games.
Hard disk options
=================
E-UAE may emulate hard drive partitions (AmigaOS volumes) or full,
partitionable hard disks. Two basic types of emulation are supported: the
virtual filesystem and the hard file.
A virtual filesystem is a directory on the host system mounted as a
virtual AmigaOS volume. The main advantages of a virtual filesystem are
ease of use (no special setting-up is required) and the fact that both
the host system and the emulated environment can access it at the same
time (although this is not guaranteed to be safe, especially if host and
emulated environment write to a directory simultaneously).
A hard file is a file containing the raw image of a real AmigaOS
filesystem or disk (an image of a partitionable disk is known as an "RDB"
filesystem). A hard file is not so easy to set up, but provides faster
access than a virtual filesystem and is more compatible with AmigaOS
software (it can be formatted with any AmigaOS filesystem, de-fragmented,
etc. just like a real Amiga partition). An RDB hard file can even be
partitioned just like a real Amiga disk.
filesystem2=<access>,<device>:<volume>:<path>,<bootpri>
Mounts the host directory specified by the path <path> as a virtual
filesystem under AmigaOS with the volume name <volume> and a faked device
name of <device>. The volume will have the boot priory <bootpri>. The
token <access> specifies whether the volume is writable. If this is set
to 'rw' then the device is writable; if it's 'ro' then the volume is
read-only.
Examples:
filesystem2=rw,DH0:System:/home/evilrich/UAE/System,1
Mounts the directory /home/evilrich/UAE/System as the volume 'System' and
AmigaDOS device 'DH0:' with a boot priority of 1. This volume can be
written to.
filesystem2=ro,CD0:CD0:/cdrom,0
Mount the host directory /cdrom as volume 'CD0:' and device 'CD0:' with
boot priority 0. This volume may not be written to.
filesystem=<access>,<volume>:<path>
This is an older and simpler form of the filesystem2= option.
You can use both the filesystem2= and filesystem= options to specify the
same volume (for instance, for compatibility with older versions of UAE),
but the filesystem= option must be after the filesystem2= option in the
config file.
hardfile2=<access>,<device>:<path>,<sectors>,<surfaces>,<reserved>,<blocksize>,<bootpri>,<handler>
Mount the hard file (partition or drive image) <path>. The token <access>
specifies whether the hard file is writable. If it has the value 'rw',
then the hard file is writable; if it is 'ro', then it's not writable.
If the specified hard file is a partition image, then the partition will
be mounted on the AmigaDOS device <device> (the volume name will be taken
from the filesystem that the partition contains).
For a hard file containing a partition image, the geometry of the
partition must be specified.
<sectors> = the number of sectors per track
<surfaces> = the number of heads or surfaces on the disk (typically 1)
<reserved> = the number of reserved blocks at the start of the partition
(typically 2).
<blocksize> = the number of bytes per block (typically 512).
<bootpri> specifies the boot priority of the volume.
<handler> is optional and specifies a host path to locate the AmigaOS
filesystem handler to use to mount this image. This option is useful when
you wish to mount a volume that has been formatted with a filesystem not
present in Kickstart - for example, SFS or PFS.
If the specified hard file is an RDB hard file, that is, it's the image of
a partitionable hard drive, you do not need to specify the geometry (the
RDB - the Rigid Disk Block - in the hard file itself specifies the
geometry). If <blocksize> is 0, then the hard file is assumed to be an RDB
hard file. All other components of the hardfile2= option will be ignored
apart from <path> and <access>.
Examples:
hardfile2=rw,DH1:/home/evilrich/myhardfile,32,1,2,512,1,
hardfile2=rw,:/home/evilrich/rdbimage,0,0,0,0,0,
Display options
===============
The following options configure the emulation of native Amiga screenmodes
(displays generated by the built-in Amiga chipset - not of display generated
by Picasso96).
Todo: need some general blurb about how Amiga screens are output,
resolution, etc.
gfx_framerate=<n> (default=1)
Specifies the rate at which display frames are rendered when emulating
graphics output from the Amiga chipset. <n> can be a number between 1 and
20, where 1 means that every display frame is rendered and 20 means only 1
in every 20 frames is rendered.
Increasing <n> increases the speed of emulation (there's less work to
do), but decreases the quality of the display output.
For example, when emulating a PAL display (50 Hz), for full-quality output
(gfx_framerate=1), E-UAE must update its display 50 times a
second. Setting gfx_framerate=4 will cause E-UAE to draw only 1
frame in 4 and thus its display will updated only 12.5 times a second.
gfx_width_windowed=<n> (default=720)
gfx_height_windowed=<n> (default=568)
gfx_width_fullscreen=<n> (default=800)
gfx_height_fullscreen=<n> (defaullt=600)
Specify the dimensions of the E-UAE display for graphical output from the
Amiga chipset.
Ideally, the gfx_*_windowed options should specify the dimensions when
E-UAE is running in a window on your desktop and the gfx_*_fullscreen
options will apply when running full-screen. However, this is not supported
yet, and E-UAE will use the gfx_*_windowed dimensions in both windowed and
full-screen modes.
To emulate a high-resolution, fully overscanned PAL screen - either
non-interlaced with line-doubling, or interlaced - you need to use a
display of at least 720 by 568 pixels. If you specify a smaller size,
E-UAE's display will be clipped to fit (and you can use the gfx_center_*
options - see below - to centre the clipped region of the display).
Similarly, to fully display an over-scanned lo-res PAL screen, you need a
display of 360 by 284 pixels.
gfx_width=<n>
gfx_height=<n>
These option are for backwards-compatibility and have been superceded by
the gfx_*_windowed and gfx_*_fullscreen options above.
gfx_fullscreen_amiga=<bool> (default=false)
E-UAE will open it's display for Amiga screens in full-screen mode by
default - not as a window on the desktop.
This option is not supported on all platforms.
gfx_lores=<boolean> (default=false)
Determines the fundamental horizontal resolution of output. If true, then
E-UAE will emulate a low-resolution output; high-res Amiga screens will
have their horizontal resolution halved (only every other horizontal pixel
will be drawn). If false, E-UAE will emulate a high-resolution output;
low-resolution Amiga screens will have their horizontal resolution doubled.
Most classic games employ low-resolution screens; Workbench uses a
high-resolution screen by default.
gfx_linemode=<type> (default=double)
Determines how many times each display line is drawn. Valid values for
<type> are:
Type Description
---- -----------
none Each line is drawn once.
double Each line is drawn twice.
scanlines Each line is drawn once followed by an black line.
gfx_correct_aspect=<boolean> (default=false)
If set to true and the emulated Amiga screen has a larger vertical size
than the display window, E-UAE will fit the screen to the display by
leaving out certain lines. This is useful, for example, if you wish
to fit a 640x512 Amiga screen into a 640x480 window.
Don't use the option with gfx_linemode=scanlines. It'll look ugly.
gfx_center_horizontal=<type> (default=none)
If the Amiga screen emulated is wider than the E-UAE display, then this
option will try to cause the screen to be rendered centred on the display.
Type Description
---- -----------
false/none No centring will be performed.
true/simple Simple centring will be performed.
smart Smart centring will be performed.
gfx_center_vertical=<type> (default=none)
Similar to gfx_center_horizontal, but centres the screen vertically within
the E-UAE display.
show_leds=<bool> (default=false)
If true, show drive activity and power LEDs at the bottom right corner of
the E-UAE display.
hide_cursor=<bool> (default=true)
If this option is set to true and E-UAE is displaying in windowed mode,
then the host window manager's cursor is hidden; otherwise it is shown.
This option may not be implemented on all platforms yet.
Sound options
=============
sound_output=<type>
Selects how native Amiga audio is emulated and output. Supported values
for <type> include:
none - audio emulation is disabled.
interrupts - audio emulation is enabled but audio output is disabled.
normal - audio emulation is enabled and output enabled.
exact - audio emulation is enabled and exact output enabled.
sound_bits=<n>
Selects the resolution of audio output. <n> can be 8 or 16 for 8-bit and
16-bit output, respectively. Most hosts will use 16-bit output and this
will be the default.
sound_frequency=<n>
Selects the frequency of emulated audio output in Hertz. Typically,
higher frequencies will require more work, but have better quality. The
default is dependent on the host audio system used, but most will default
to 44100 Hz (that is, CD-quality output).
Typical values for <n> include 11025, 22050 and 44100.
sound_channels=<type>
The Amiga supports 4-voice stereo sound, with two channels output on the
left channel and two on the right. This option selects how the Amiga's
voices are output on the host audio system. Supported values for <type>
are:
mono - monophonic output; all Amiga voices are output on a single channel.
stereo - stereo output; two Amiga voices are output on the left channel and
two on the right.
mixed - stereo output; the four Amiga voices are mixed and output on both
left and right channels.
sound_latency=<t> (default=100)
Specifies the length of the audio buffer used by the audio emulation in
microseconds independent of the other audio settings, and, hence, also the
time lag between when a sample is played in the emulated Amiga environment
and in the underlying host sound system (thus 'latency').
The default value of 100 ms attempts to strike a balance between
acceptable latency and CPU usage. Larger values of <t> may require less
CPU time and lead to fewer drop-outs (gaps) in audio emulation, but will
suffer increased latency (a latency of more than about 150ms becomes very
noticeable). Smaller values will require more CPU power but reduce latency.
Note that not all host sound systems will support arbitrary values of <t>.
For example, the Open Sound System will round the supplied value to one
that corresponds to the nearest power-of-2 audio buffer size.
sound_max_buff=<n>
From E-UAE 0.8.29, this option is obsolete and has been replaced by the
option sound_latency.
sound_interpol=<type> (default=none)
Selects the sound interpolation mode used for audio output (only supported
when audio output is in 16-bit resolution). Interpolation is a technique
which "smoothes out" the audio waveform generated by E-UAE and thus may
lead to higher quality audio output. Supported values for <type> are:
none - no interpolation.
rh - 'rh' method of interpolation is used.
crux - 'crux' method of interpolation is used.
sinc - 'sinc' meethod of interpolation is used.
Input device options
====================
joyport0=<mode>
Selects the method used to emulate the device attached to the Amiga
joystick port 0 (the mouse port).
none - no device is connected to this port.
mouse - a mouse will be emulated on this port and input will be supplied
from the host's default mouse (the device you use to move the
mouse pointer on the host).
joy0 - a joystick will be emulated on this port and input will be supplied
from the first joystick found on the host.
joy1 - a joystick will be emulated on this port and input will be
supplied from the second joystick found on the host.
kbd1 - a joystick will be emulated using the numeric keypad (8, 2, 4 and
6 are directions up, down, left and right, respectively, and 5 is
the fire button).
kbd2 - a joystick will be emulated using the cursor keys and the Right Ctrl
key or Right Alt key for the fire button.
kbd3 - a joystick will be emulated using the keys T, B, F and H for up,
down, left and right, respectively, and the Left Alt key for the
fire button.
joyport1=<mode>
Selects the method used to emulate the device attached to the Amiga
joystick port 1 (the joystick port). Supported values for <mode> are the
same as for the joyport0= option.
SCSI emulation options
======================
E-UAE can provide direct access to a host optical drive like a CD-ROM drive
to AmigaOS via an Exec device wrapper called uaescsi.device. The SCSI device
emulation is not supported on all platforms. See the SCSI emulation section
of the documentation for more details.
scsi=<bool> (default=false)
Enable or disabled the SCSI emulation.
scsi_device=<config>
This option is used for passing a platform-specific configuration to the
SCSI emulation layer.
Network emulation
=================
E-UAE can provide network access to AmigaOS applications via an emulated
bsdsocket.library. This emulated bsdsocket.library is simply a wrapper
around the host's networking stack. The AmigaOS environment within E-UAE
will share the same IP address as the host. The bsdsocket.library emulation
is not supported on all platforms. See the bsdsocket emulation section of
the documentation for more details.
bsdsocket_emu=<bool> (default=false)
Enable or disable the bsdsocket.library emulation.
X11-specific options
====================
The following options apply when E-UAE has been built with the X11 graphics
driver.
x11.map_raw_keys=<bool> (default=false)
If true, the X11 driver maps raw host key codes to Amiga key codes;
otherwise, the driver tries to map translated key codes, possible leading
to poorer support for international keyboard layouts (see
docs/keyboard.txt).
For raw key-mapping to be supported, your X server must support the XKB
extension. Also note that X keyboards that generate xfree86 key codes
(typicallying PC and Mac keyboards with XFree86 or X.org servers) only are
supported at the moment.
x11.low_bandwidth=<bool> (default=false)
If this option is set to true, then E-UAE will try to minimize the amount
of data sent to the X server by only redrawing areas of the amiga screen
that have changed. This may increase frame rate on slow machines or when
running E-UAE on a separate host from the X server.
x11.use_mitshm=<bool> (default=true)
If this option is set to true, your X server supports the MITSHM extension
and E-UAE is running on the same host as the server, then E-UAE will use
memory shared between itself and the server for display buffers. This will
increase display refresh speed.
x11.hide_cursor=<bool>
Deprecated. This option has been replaced by hide_cursor=<bool>.
SDL-specific options
====================
The following options apply when E-UAE has been built with the SDL graphics
driver.
sdl.map_raw_keys=<bool> (default=false)
If true, the SDL driver maps raw host key codes to Amiga key codes;
otherwise, the driver tries to map translated key codes, possible leading
to poorer support for international keyboard layouts (see
docs/keyboard.txt).
sdl.use_gl=<bool> (default=false)
If true, the SDL driver uses OpenGL for display output. Depending on your
OpenGL driver this may increase or decrease the speed of emulation.
Note: This setting does not enable a OpenGL emulation for Amiga (e.g. Warp3D)
but simply uses an OpenGL texture for the 2D Amiga and Picasso96 display.
AmigaOS-specific options
========================
The following options apply when E-UAE has been built for AmigaOS (or
similar platform) with the AmigaOS graphics driver.
amiga.screen_type=<type> (default=public)
Specifies the type of screen that E-UAE will open it's display on. Valid
values for <type> are:
Type Description
---- -----------
public The display will be a window on the default or named public
screen.
custom E-UAE will open a custom screen for its display. The best
screenmode matching the configured dimensions will be used.
ask E-UAE will present you with a requester to select the screenmode
to use for display. If this requester is cancelled, E-UAE will
use a window on the default or named public screen.
amiga.publicscreen=<name>
Specifies the name of the public screen to open a window on. If <name> is
empty, the default public screen will be used.
amiga.use_dither=<bool> (default=true)
When displaying on a palette-mapped screen (that is, a screen with depth
of 8 or less), dither output to compensate for lack of colour.
amiga.use_grey=<bool> (default=false)
When displaying on a palette-mapped screen (that is, a screen with depth
of 8 or less), output in greyscale rather than colour. This option is
particularly useful when displaying on a public screen with few free pens.
ALSA-specific options
=====================
The following options apply when E-UAE has been built with the ALSA audio
driver.
alsa.device=<device> (default=default)
Specifies the ALSA device to output to. The default value is 'default',
which obviously uses the default ALSA PCM device. On recent ALSA
installations, this may use ALSA's dmix plug-in (the dmix plug-in allows
multiple applications to share an ALSA device for output) which may result
in unacceptable latency and/or increased CPU load. If that is the case,
add the option 'alsa.device=plughw:' to by-pass the dmix plug-in.
See the libasound documentation for full details on how to specify ALSA
devices.
alsa.verbose=<bool> (default=false)
If this options is set to true, the ALSA driver will log additional
information about how it configures the specified ALSA device. This may
help to diagnose problems with ALSA configuration, etc.

54
docs/floppies.txt Normal file
View File

@ -0,0 +1,54 @@
Floppy drive emulation
======================
E-UAE emulates up to four floppy drives. Standard PC floppy drives cannot
read Amiga floppies, so floppy disks are currently supported as image files
(support for Catweasel hardware, a floppy controller which can read Amiga
floppies - and other unusual disk formats - will be added in a future
version).
E-UAE supports a number of floppy image formats, optionally compressed by
gzip or packed inside a Zip archive.
ADF
---
The classic floppy image format for UAE, a plain raw image of the disk's
formatted contents.
DMS
---
DMS was a popular disk image cruncher. E-UAE can transparently read DMS
images.
FDI
---
FDI is a floppy image format used by the Disk2FDI tool. See
http://www.oldskool.org/disk2fdi.
IPF
---
IPF is the floppy image format employed by the CAPS project (see
http://caps-project.org/). A suitable plug-in, downloadble from the CAPS web
site, must be installed on the host system to allow IPF images to be used.
(At the time of writing, the plug-in is available for only x86 and PPC Linux
hosts and AmigaOS hosts.)
Creating blank ADF images
=========================
On Unix-like platforms, a blank floppy image can be created as follows. To
create a standard 3.5" DD image, use:
dd if=/dev/zero of=blank.adf count=1760
To create a 3.5" HD image, use:
dd if=/dev/zero of=blank.adf count=3520

91
docs/joystick.txt Normal file
View File

@ -0,0 +1,91 @@
Joystick port emulation
=======================
An Amiga has two joystick ports. Port 0 typically has a mouse attached to it
and port 1 may have a digital joystick, joypad or some other device
connected. E-UAE can emulate Amiga mice and joysticks using either input
from a physical mouse or joystick or by using specific key presses on the
keyboard to synthesize mouse and joystick movements or button clicks.
The device connected to port 0 can be configured with the joyport0=<mode>
configuration file option and the device at port 1 with joyport1=<mode>.
Additionally, some versions of E-UAE may supply a GUI controls to configure
the joystick.
Here <mode> can be one of:
none - no device is connected to this port.
mouse - a mouse will be emulated on this port using the host's default
mouse (usually the device you use to move the mouse pointer on your
desktop). Up to three mouse buttons are supported and a scroll
wheel is currently supported when using E-UAE's X11 or SDL
graphics drivers.
joy0 - a digital joystick will be emulated on this port using input from
the first joystick detected on the host. This host device can be
either a digital or analog joystick.
Typically Amiga software supports up to three joystick fire buttons
(although most games only require one or two) and these will be
emulated by the first three fire buttons on the host joystick
(additional buttons, if present, may be used when emulating a CD32
controller - see below).
joy1 - a digital joystick will be emulated using the second host joystick.
joy<n> - a digital joystick will be emulated using the <n-1>th host
joystick.
kbd1 - a digital joystick is emulated using keys on the numeric keypad of
the host keyboard, where:
key pad 4 = joystick left
key pad 6 = joystick right
key pad 8 = joystick up
key pad 2 = joystick down
key pad 5 = joystick fire button 1
kbd2 - a digital joystick is emulated using the cursor keys and right Ctrl
or right Alt key on the host keyboard, where:
cursor left = joystick left
cursor right = joystick right
cursor up = joystick up
cursor down = joystick down
right Ctrl = joystick fire button 1
right Alt = joystick fire button 1
Note that both the right Alt and right Ctrl keys produce fire
button events since some keyboards (e.g. PC/USB keyboards on an
Amiga, ADB Mac keyboards) don't produce unique events for right
and left Ctrl and other keyboards (e.g Amiga keyboards and some
laptop keyboards) don't even have a right Ctrl key.
kbd3 - a digital joystick is emulated using the following keys:
F = joystick left
H = joystick right
T = joystick up
B = joystick down
left Alt = joystick fire button 1
Note that, when you employ any of the above keyboard-based joystick
emulations, the keys used by the joystick emulation are used exclusively for
joystick input - they will not produce normal key presses.
Emulating a CD32 controller
===========================
When emulating a CD32 (to do this, E-UAE must be booted with CD32 ROMs) the
joystick configured to port 1 may emulate a CD32 controller. The buttons on
the joystick will be mapped to CD32 controller buttons as follows:
button 1 = CD32 Red (Fire/Select) button
button 2 = CD32 Blue (Second fire/Stop) button
button 3 = CD32 Yellow (Loop) button
button 4 = CD32 Green (Shuffle) button
button 5 = CD32 FFW button
button 6 = CD32 RWD button
button 7 = CD32 Play button

182
docs/keyboard.txt Normal file
View File

@ -0,0 +1,182 @@
Keyboard emulation
==================
E-UAE emulates an Amiga keyboard layout by a straightforward mapping - where
possible - of host keys to Amiga keys. In general, the alphanumeric keys,
function keys, numbers, punctuation, cursor keys, numeric keypad, etc.
should work as expected (that is, the symbol on the key cap should be
produced in AmigaOS when the key is pressed). There are some difficulties,
however, particularly with international keyboard layouts, and we shall discuss
these in a moment.
In addition, the following keys are mapped to the Amiga keys and Help key:
Left Super Left Amiga
Right Super Right Amiga
PageDown Left Amiga
PageUp Right Amiga
Menu key Right Amiga
Insert Help
The "Super" keys are the Windows keys on a PC keyboard, Command keys on a Mac
keyboard, Amiga keys on an Amiga keyboard, etc. Note that most Mac keyboards
don't differentiate between left and right Option keys, and both will
produce a Left Amiga.
Currently, E-UAE's keyboard mapping is not user-configurable. This will be
addressed in a future release.
International keyboards
=======================
If you are using E-UAE built with the X11 or SDL graphics drivers then you
may set the kbd_lang= option to specify your keyboard layout (you also need
to pick an appropriate keyboard driver in AmigaOS).
Supported layouts currently include:
de - German
dk - Danish
es - Spanish
us - USA (default)
se - Swedish
fr - French
it - Italian
Pick the layout that best fits your keyboard (e.g. use 'us' for British
keyboards).
Support for some layouts is currently poor - for example, numeric and
punctuation keys are interchanged on the French layout - and SDL poorly
supports international keys.
A partial solution is to use E-UAE's raw key mapping (see below).
Command key sequences
=====================
The following key combinations invoke UAE commands or functions:
F12 + Q Quit UAE
F12 + R Reset UAE (warm reset)
F12 + Left Shift + R Reset UAE (cold reset)
F12 + D Open built-in debugger/monitor
F12 + S Toggle between windowed display and full-screen mode
(if supported by the graphics driver).
F12 + G Toggle mouse-grab mode (in windowed mode)
F12 + I (or Toggle display inhibit (Amiga screenmodes, not P96)
Scroll Lock)
F12 + A Cycle through audio interpolation modes
(interpolation works with 16-bit audio only)
F12 + Numpad Plus Increase frame-skip rate
F12 + Numpad Minus Decrease frame-skip rate
F12 + F1 Open dialog to insert floppy image in drive 0
F12 + F2 Open dialog to insert floppy image in drive 1
F12 + F3 Open dialog to insert floppy image in drive 2
F12 + F4 Open dialog to insert floppy image in drive 3
F12 + Left Shift + F1 Eject floppy image in drive 0
F12 + Left Shift + F2 Eject floppy image in drive 1
F12 + Left Shift + F3 Eject floppy image in drive 2
F12 + Left Shift + F4 Eject floppy image in drive 3
F12 + F5 Open dialog to load emulator state file.
F12 + Left Shift + F5 Open dialog to save emulator state file.
F12 + Nampad 0 Quick save emulator state.
F12 + Right Shift + Numpad 0 Quick load emulator state.
F12 + Numpad 1 Quick save emulator state to slot 1.
F12 + Right Shift + Numpad 1 Quick load emulator state from slot 1.
F12 + Numpad 'n' Quick save emulator state to slot 'n'.
F12 + Right Shift + Numpad 'n' Quick load emulator state from slot 'n'.
F12 + F Emulates freeze button of Action Replay cartridge
(if you have a cartridge ROM loaded).
On Mac OS X, use F11 rather than F12 in the key sequences above (reason: F12
is used by Finder on OS X to eject a CD. On OS 10.3, I believe F11 may be
used by Expose, so you may need to change your Expose settings.) On AmigaOS,
use CTRL+Left Alt instead of F12 (reason: most Amigas don't have F12 keys).
Raw key-mapping
===============
When emulating an Amiga keyboard in UAE, the tricky thing is how to translate
key-presses on the host to virtual key-presses on the emulated Amiga.
Traditionally, when running UAE on Unix systems using X or SDL, UAE maps
host key symbols (cooked keys, the translated symbols produced according to
your operating system's keymap settings) to raw Amiga key-presses. This
approach has a number of problems, especially with international keyboards.
This is mainly due to the number of translations involved in this process
and the fact that it requires that apples be converted into oranges, back
into apples and then into oranges again for a key-press on the host keyboard
to eventually end up on your virtual Amiga screen.
When mapping cooked keys, what happens is this. You press a key. Ignoring
the really low-level stuff, your host operating system produces a raw
key code denoting which key on the keyboard is pressed (this keycode
identifies the position of the key on the keyboard, not the symbol that is
painted on the key cap). Your OS then translates this to a key symbol using
your keymap settings to produce (if your keymap is correct) a value which
actually does correspond to the symbol painted on the physical key on your
keyboard.
If E-UAE tries to work with this translated key symbol, it then has to
somehow convert that back into a raw keycode appropriate to if that key
were pressed on an Amiga keyboard (and then AmigaOS will use its keymap
settings to translate it into a key symbol again). This requires that E-UAE
know about international keyboard layouts, and requires the graphics system
to report unique events for all host keys (SDL does not completely support
some international layouts, for example).
One solution is for UAE to instead ask the host operating system for the raw
keycode corresponding to a key-press and map that to a raw Amiga keycode.
This is potentially easier and more accurate, since we are now converting
like to like, apples to apples, raw key-presses to raw key-presses. The
problem now is, instead of having to support different international
keyboard layouts, UAE has to understand different keyboard types (e.g.,
standard PC104/5 keyboards, Mac keyboards, Sun keyboards) and - more
annoyingly - the different raw keycodes that different operating systems and
different graphics systems on the same operating system assign to what are
logically or even physically identical keys.
The upshot of all this is that raw key-mapping is currently (optionally)
supported when:
a) E-UAE is built with the X11 graphics driver, your X server supports the
XKB extension and you are using a keyboard which produces xfree86
keycodes (e.g., PC and Mac keyboards with XFree86 on Linux do);
b) E-UAE is built with the SDL graphics driver and you are running it on
Linux on XFree86 with a PC or Mac keyboard, on MacOS X, on BeOS or on
AmigaOS (or an AmigaOS clone);
c) E-UAE is built with the BeOS graphics driver; or
d) E-UAE is built with the AmigaOS graphics driver.
As I said above, raw key-mapping better supports international keyboards, so
is recommended for most users, although its not terribly well tested and
some problems may exist. One such problem is that the command-key sequences
listed above will work as if you had a US keyboard rather than whatever
international flavour of keyboard you actually have. I'll fix this eventually.
When raw key-mapping is optional, it is enabled with a config option. When
using the SDL graphics driver, add
sdl.map_raw_keys=true
to your config file. When using X11, add
x11.map_raw_keys=true
Both the SDL and X11 graphics driver will try to enable raw key-mapping by
default if they can support it on your host platform.
Note that the AmigaOS version of E-UAE when built with native AmigaOS
graphic support and the BeOS version when built with native BeOS graphics
support both always do raw key mapping, so no comparable config options is
supported or required in these situations. Note also, however, that the
command-key problem described above is exhibited in both cases.

184
docs/scsi.txt Normal file
View File

@ -0,0 +1,184 @@
SCSI emulation
==============
E-UAE's SCSI emulation allows any CD-ROM drives on the host machine to be
used as Amiga SCSI devices within the emulation. You can use this to fully
support CD-ROMs, audio discs, CD-writing, etc. in AmigaOS. SCSI emulation is
also required to emulate a CD-TV or CD32.
In general, to enable SCSI emulation simply add the 'scsi=true' option to
your config file. Any useable CD or DVD devices that E-UAE finds will be
available to AmigaOS via the device driver 'uaescsi.device' on consecutive
unit numbers starting at unit 0. However, depending on your host platform,
there may a number of host configuration issues which can make using the
SCSI emulation problematic.
I'll start with the easy stuff. If you're running E-UAE on AmigaOS (or a
clone) or BeOS, then don't worry. The SCSI emulation works transparently.
Just set the 'scsi=true' config option and away you go.
Linux
-----
Starting with version 0.8.29, E-UAE's SCSI emulation can directly
communicate with the Linux kernel's CD-ROM driver to access a single
CD/DVD drive (it currently doesn't support multiple drives, unlike the
libscg back-end).
To use, simply specify the drive's device file with the configuration
option 'scsi_device=' (as well as, obviously, 'scsi=true'. For example:
scsi_device=/dev/hdc
You should ensure that the account you use to run E-UAE has permission
to access this device file.
You may run into problems if your Linux distribution has the HAL
daemon installed. This software continually polls your removable media
drives to detect insertion/removal of discs, and this activity may
interfere with E-UAE's SCSI emulation. A solution to this problem
needs to be investigated.
This Linux-native SCSI back-end is less well-tested than the libscg
back-end. It has not been tested with real SCSI devices (only ATAPI
devices) and depending on the bugginess of your Linux ATAPI driver
and/or the firmware of your drive, problems may occur.
Linux and libscg
----------------
Using the libscg-based SCSI emulation on Linux can be troublesome,
depending on how your Linux system is set up. If cdrecord works on
your set-up, then there's a good chance that the SCSI emulation will
too since it uses cdrecord's SCSI transport layer, libscg. There are
some points to be aware of, however.
Firstly, you need a kernel module installed which support sending SCSI
commands to your CD/DVD device. For real SCSI devices, this will be the sg
(SCSI generic) module. For ATAPI devices on 2.4 kernels, you need the
ide-scsi (SCSI over ATA) module and the sg module. (On 2.6 kernels, the
ide-cd driver directly supports sending SCSI commands to ATAPI devices, but
we'll come to that in a minute.)
If you're using sg or ide-scsi and sg, then your devices are accessed via
device nodes of the form /dev/sg0, /dev/sg1, etc. You need read and write
permission on all of these for SCSI emulation in E-UAE to work (Note that
cdrecord is typically installed SUID root, so typically the default
permissions on the /dev/sgx nodes will not be sufficient. Installing E-UAE as
SUID root is one possibility, but not a terribly good idea security-wise.
One solution to this is to set the owner of the /dev/sgx nodes as the group
'cdrom' and add you own user account to that group. For example, as root, do
# chgrp cdrom /dev/sg*
# adduser evilrich cdrom
Use your own account ID, of course, rather than 'evilrich', which is me.
If your system doesn't have the adduser command, you can always manually
edit the /etc/group file or use some whizz-bang, GUI-based user/group
configuration utility to do the job.
If you log in as yourself again and start E-UAE (remember to add 'scsi=true'
to your config file first), then the SCSI emulation should work. If so you'll
see something like this logged to the console when E-UAE starts up.
scsibus0:
0,0,0 0 'BTC ' 'BCE1610IM ' 'A.20' CD-ROM
0,1,0 1 *
0,2,0 2 *
0,3,0 3 *
0,4,0 4 *
0,5,0 5 *
0,6,0 6 *
0,7,0 7 *
SCSIDEV: 1 devices found
support_scsi = 1 support_ioctl = 0
If you're using a 2.6 kernel, E-UAE can access ATAPI devices on the host
directly via the kernel ide-cd driver without the sg kernel module. To do
this on older 2.6 kernels, add the config option
scsi_device=ATAPI
in your config file (remember to add scsi=true also) and make sure you have
read and write access to the necessary device nodes corresponding to the
devices you wish to use with UAE (for example, /dev/hdc or whatever).
For newer 2.6 kernels (>=2.6.12?), the libscg ATAPI transport method no
longer works and you have to use the ATA method. To do this, specify the
device path to your CD/DVD drive with the scsi_device= option. For example:
scsi_device=/dev/hdc
MacOS X
-------
Now we get to the real problems. SCSI emulation with E-UAE on OS X is
currently a real pig, due to some features and limitations of OS X. The big
problem is that you need a writable device - a CD or DVD burner - for SCSI
emulation to work at all. This is because the OS X kernel will only let you
send SCSI commands to a writable device (for this problem to be solved, UAE
would need to support a real SCSI emulation - the current implementation is
simply a wrapper around a host SCSI device).
The second problem is that the Finder does not like sharing a removable
media device with any other application. For SCSI emulation to work, you
must start UAE without a disc inserted in your CD or DVD writer. Otherwise,
Finder will auto-mount the disc and not let UAE access the device. A
different (more drastic) solution is to kill OS X's auto-mount daemon, but the
procedure for doing this differs depending on which version of OS X you
have. Somebody remind me to look this up and fill in the details here.
The third problem is getting UAE to locate your CD or DVD writer. libscg on
OS X (the SCSI transport layer which UAE uses) doesn't support bus-scanning
on OS X. Only one device can currently be used with UAE, and you have to
name it explicitly with the 'scsi_device=' option in your config file.
For the first CD writer, this will be:
scsi_device=IOCompactDiscServices/0
For the first DVD writer, this will be
scsi_device=IODVDServices/0
Also remember to add the 'scsi=true' option to your config.
If set up correctly, UAE will output something similar to the following when
starting up:
scsibus:0
0,0,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,1,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,2,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,3,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,4,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,5,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,6,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,7,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,8,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,9,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,10,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,11,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,12,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,13,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,14,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
0,15,0 0 'YAMAHA ' 'CRW842S ' '1.0f' CD-ROM
SCSIDEV: 16 devices found
support_scsi = 1 support_ioctl = 0
and then it'll complain a bit about being unable to get exclusive access and
then it'll say
(0,0,0) = uaescsi.device:0
Okay. Don't look so worried. What's happening here is that UAE is trying to
scan for SCSI devices, can't, and ends up finding the same device 16 times.
Not very elegant, I know, but it works. I will tidy this up eventually. If
Finder has an exclusive lock on your device because it has mounted a disc,
UAE will just say 'Unable to get exclusive access to device' once and say:
SCSIDEV: 0 devices found

294
install-sh Executable file
View File

@ -0,0 +1,294 @@
#!/bin/sh
#
# install - install a program, script, or datafile
#
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd=$cpprog
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "$0: no input file specified" >&2
exit 1
else
:
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "$0: $src does not exist" >&2
exit 1
fi
if [ x"$dst" = x ]
then
echo "$0: no destination specified" >&2
exit 1
else
:
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp=$pathcomp$1
shift
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "$pathcomp"
else
:
fi
pathcomp=$pathcomp/
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename "$dst"`
else
:
fi
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}

View File

@ -0,0 +1,33 @@
dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_var_timezone_externals.html
dnl
AC_DEFUN([AC_VAR_TIMEZONE_EXTERNALS],
[ AC_REQUIRE([AC_STRUCT_TIMEZONE])dnl
AC_CACHE_CHECK(for timezone external, mb_cv_var_timezone,
[ AC_TRY_LINK([#include <time.h>], [return (int)timezone;],
mb_cv_var_timezone=yes,
mb_cv_var_timezone=no)
])
AC_CACHE_CHECK(for altzone external, mb_cv_var_altzone,
[ AC_TRY_LINK([#include <time.h>], [return (int)altzone;],
mb_cv_var_altzone=yes,
mb_cv_var_altzone=no)
])
AC_CACHE_CHECK(for daylight external, mb_cv_var_daylight,
[ AC_TRY_LINK([#include <time.h>], [return (int)daylight;],
mb_cv_var_daylight=yes,
mb_cv_var_daylight=no)
])
if test $mb_cv_var_timezone = yes; then
AC_DEFINE([HAVE_TIMEZONE], 1,
[Define if you have the external `timezone' variable.])
fi
if test $mb_cv_var_altzone = yes; then
AC_DEFINE([HAVE_ALTZONE], 1,
[Define if you have the external `altzone' variable.])
fi
if test $mb_cv_var_daylight = yes; then
AC_DEFINE([HAVE_DAYLIGHT], 1,
[Define if you have the external `daylight' variable.])
fi
])

190
m4/acx_pthread.m4 Normal file
View File

@ -0,0 +1,190 @@
dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
dnl
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# pthread: Linux, etcetera
# --thread-safe: KAI C++
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthread or
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
;;
esac
if test x"$acx_pthread_ok" = xno; then
for flag in $acx_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($acx_pthread_ok)
if test "x$acx_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$acx_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
[Define to the necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_RESULT(${ok})
if test x"$ok" = xunknown; then
AC_MSG_WARN([we do not know how to create joinable pthreads])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with cc_r
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
acx_pthread_ok=no
$2
fi
AC_LANG_RESTORE
])dnl ACX_PTHREAD

54
m4/as-objc.m4 Normal file
View File

@ -0,0 +1,54 @@
# AC_PROG_OBJC([LIST-OF-COMPILERS])
#
AC_DEFUN([AS_PROG_OBJC],
[
AC_CHECK_TOOLS(OBJC,
[m4_default([$1], [objcc objc gcc cc CC])],
none)
AC_SUBST(OBJC)
OBJC_LDFLAGS="-lobjc"
AC_SUBST(OBJC_LDFLAGS)
if test "x$OBJC" != xnone ; then
_AM_DEPENDENCIES(OBJC)
AC_MSG_CHECKING([if Objective C compiler works])
cat >>conftest.m <<EOF
#include <objc/Object.h>
@interface Moo:Object
{
}
- moo;
int main();
@end
@implementation Moo
- moo
{
exit(0);
}
int main()
{
id moo;
moo = [[Moo new]];
[[moo moo]];
return 1;
}
@end
EOF
${OBJC} conftest.m ${OBJC_LDFLAGS} >&5 2>&5
if test -f a.out -o -f a.exe ; then
result=yes
else
result=no
echo failed program is: >&5
cat conftest.m >&5
fi
rm -f conftest.m a.out a.exe
AC_MSG_RESULT([$result])
fi
])

61
m4/check_zlib.m4 Normal file
View File

@ -0,0 +1,61 @@
dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/check_zlib.html
dnl
AC_DEFUN([CHECK_ZLIB],
#
# Handle user hints
#
[AC_MSG_CHECKING(if zlib is wanted)
AC_ARG_WITH(zlib,
[ --with-zlib=DIR root directory path of zlib installation [defaults to
/usr/local or /usr if not found in /usr/local]
--without-zlib to disable zlib usage completely],
[if test "$withval" != no ; then
AC_MSG_RESULT(yes)
ZLIB_HOME="$withval"
else
AC_MSG_RESULT(no)
fi], [
AC_MSG_RESULT(yes)
ZLIB_HOME=/usr/local
if test ! -f "${ZLIB_HOME}/include/zlib.h"
then
ZLIB_HOME=/usr
fi
])
#
# Locate zlib, if wanted
#
if test -n "${ZLIB_HOME}"
then
ZLIB_OLD_LDFLAGS=$LDFLAGS
ZLIB_OLD_CPPFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
AC_LANG_SAVE
AC_LANG_C
AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no])
AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cvs_zlib_h=no])
AC_LANG_RESTORE
if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
then
#
# If both library and header were found, use them
#
AC_CHECK_LIB(z, inflateEnd)
AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
AC_MSG_RESULT(ok)
else
#
# If either header or library was not found, revert and bomb
#
AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
LDFLAGS="$ZLIB_OLD_LDFLAGS"
CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
AC_MSG_RESULT(failed)
AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib)
fi
fi
])

261
m4/fsusage.m4 Normal file
View File

@ -0,0 +1,261 @@
# file-type.m4 serial 1
dnl Copyright (C) 2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
AC_DEFUN([gl_FILE_TYPE],
[
dnl Prerequisites of lib/file-type.h.
AC_REQUIRE([AC_HEADER_STAT])
])
#serial 11
# From fileutils/configure.in
AC_DEFUN([gl_FSUSAGE],
[
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs_types.h)
jm_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
if test $gl_cv_fs_space = yes; then
AC_LIBOBJ(fsusage)
gl_PREREQ_FSUSAGE_EXTRA
fi
])
# Try to determine how a program can obtain filesystem usage information.
# If successful, define the appropriate symbol (see fsusage.c) and
# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND.
#
# jm_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
AC_DEFUN([jm_FILE_SYSTEM_USAGE],
[
echo "checking how to get filesystem space usage..."
ac_fsusage_space=no
# Perform only the link test since it seems there are no variants of the
# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
# because that got a false positive on SCO OSR5. Adding the declaration
# of a `struct statvfs' causes this test to fail (as it should) on such
# systems. That system is reported to work fine with STAT_STATFS4 which
# is what it gets when this test fails.
if test $ac_fsusage_space = no; then
# SVR4
AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
[AC_TRY_LINK([#include <sys/types.h>
#ifdef __GLIBC__
Do not use statvfs on systems with GNU libc, because that function stats
all preceding entries in /proc/mounts, and that makes df hang if even
one of the corresponding file systems is hard-mounted, but not available.
#endif
#include <sys/statvfs.h>],
[struct statvfs fsd; statvfs (0, &fsd);],
fu_cv_sys_stat_statvfs=yes,
fu_cv_sys_stat_statvfs=no)])
if test $fu_cv_sys_stat_statvfs = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATVFS, 1,
[ Define if there is a function named statvfs. (SVR4)])
fi
fi
if test $ac_fsusage_space = no; then
# DEC Alpha running OSF/1
AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
[AC_TRY_RUN([
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mount.h>
main ()
{
struct statfs fsd;
fsd.f_fsize = 0;
exit (statfs (".", &fsd, sizeof (struct statfs)));
}],
fu_cv_sys_stat_statfs3_osf1=yes,
fu_cv_sys_stat_statfs3_osf1=no,
fu_cv_sys_stat_statfs3_osf1=no)])
AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS3_OSF1, 1,
[ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
fi
fi
if test $ac_fsusage_space = no; then
# AIX
AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
member (AIX, 4.3BSD)])
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
[AC_TRY_RUN([
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
main ()
{
struct statfs fsd;
fsd.f_bsize = 0;
exit (statfs (".", &fsd));
}],
fu_cv_sys_stat_statfs2_bsize=yes,
fu_cv_sys_stat_statfs2_bsize=no,
fu_cv_sys_stat_statfs2_bsize=no)])
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
if test $fu_cv_sys_stat_statfs2_bsize = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS2_BSIZE, 1,
[ Define if statfs takes 2 args and struct statfs has a field named f_bsize.
(4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
fi
fi
if test $ac_fsusage_space = no; then
# SVR3
AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
[AC_TRY_RUN([#include <sys/types.h>
#include <sys/statfs.h>
main ()
{
struct statfs fsd;
exit (statfs (".", &fsd, sizeof fsd, 0));
}],
fu_cv_sys_stat_statfs4=yes,
fu_cv_sys_stat_statfs4=no,
fu_cv_sys_stat_statfs4=no)])
AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
if test $fu_cv_sys_stat_statfs4 = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS4, 1,
[ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
fi
fi
if test $ac_fsusage_space = no; then
# 4.4BSD and NetBSD
AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
member (4.4BSD and NetBSD)])
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
[AC_TRY_RUN([#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
main ()
{
struct statfs fsd;
fsd.f_fsize = 0;
exit (statfs (".", &fsd));
}],
fu_cv_sys_stat_statfs2_fsize=yes,
fu_cv_sys_stat_statfs2_fsize=no,
fu_cv_sys_stat_statfs2_fsize=no)])
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
if test $fu_cv_sys_stat_statfs2_fsize = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS2_FSIZE, 1,
[ Define if statfs takes 2 args and struct statfs has a field named f_fsize.
(4.4BSD, NetBSD)])
fi
fi
if test $ac_fsusage_space = no; then
# Ultrix
AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
[AC_TRY_RUN([#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_FS_TYPES_H
#include <sys/fs_types.h>
#endif
main ()
{
struct fs_data fsd;
/* Ultrix's statfs returns 1 for success,
0 for not mounted, -1 for failure. */
exit (statfs (".", &fsd) != 1);
}],
fu_cv_sys_stat_fs_data=yes,
fu_cv_sys_stat_fs_data=no,
fu_cv_sys_stat_fs_data=no)])
AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
if test $fu_cv_sys_stat_fs_data = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
[ Define if statfs takes 2 args and the second argument has
type struct fs_data. (Ultrix)])
fi
fi
if test $ac_fsusage_space = no; then
# SVR2
AC_TRY_CPP([#include <sys/filsys.h>
],
AC_DEFINE(STAT_READ_FILSYS, 1,
[Define if there is no specific function for reading filesystems usage
information and you have the <sys/filsys.h> header file. (SVR2)])
ac_fsusage_space=yes)
fi
AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
])
# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
# enable the work-around code in fsusage.c.
AC_DEFUN([jm_STATFS_TRUNCATES],
[
AC_MSG_CHECKING([for statfs that truncates block counts])
AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if !defined(sun) && !defined(__sun)
choke -- this is a workaround for a Sun-specific problem
#endif
#include <sys/types.h>
#include <sys/vfs.h>]],
[[struct statfs t; long c = *(t.f_spare);]])],
[fu_cv_sys_truncating_statfs=yes],
[fu_cv_sys_truncating_statfs=no])])
if test $fu_cv_sys_truncating_statfs = yes; then
AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
[Define if the block counts reported by statfs may be truncated to 2GB
and the correct values may be stored in the f_spare array.
(SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
SunOS 4.1.1 seems not to be affected.)])
fi
AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
])
# Prerequisites of lib/fsusage.c not done by jm_FILE_SYSTEM_USAGE.
AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
[
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h sys/statvfs.h)
jm_STATFS_TRUNCATES
])

196
m4/gtk-2.0.m4 Normal file
View File

@ -0,0 +1,196 @@
# Configure paths for GTK+
# Owen Taylor 1997-2001
dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
dnl pass to pkg-config
dnl
AC_DEFUN([AM_PATH_GTK_2_0],
[dnl
dnl Get the cflags and libraries from pkg-config
dnl
AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
, enable_gtktest=yes)
pkg_config_args=gtk+-2.0
for module in . $4
do
case "$module" in
gthread)
pkg_config_args="$pkg_config_args gthread-2.0"
;;
esac
done
no_gtk=""
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test x$PKG_CONFIG != xno ; then
if pkg-config --atleast-pkgconfig-version 0.7 ; then
:
else
echo "*** pkg-config too old; version 0.7 or better required."
no_gtk=yes
PKG_CONFIG=no
fi
else
no_gtk=yes
fi
min_gtk_version=ifelse([$1], ,2.0.0,$1)
AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
if test x$PKG_CONFIG != xno ; then
## don't try to run the test against uninstalled libtool libs
if $PKG_CONFIG --uninstalled $pkg_config_args; then
echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
enable_gtktest=no
fi
if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
:
else
no_gtk=yes
fi
fi
if test x"$no_gtk" = x ; then
GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_gtktest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$GTK_LIBS $LIBS"
dnl
dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
dnl checks the results of pkg-config to some extent)
dnl
rm -f conf.gtktest
AC_TRY_RUN([
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.gtktest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_gtk_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_gtk_version");
exit(1);
}
if ((gtk_major_version != $gtk_config_major_version) ||
(gtk_minor_version != $gtk_config_minor_version) ||
(gtk_micro_version != $gtk_config_micro_version))
{
printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf ("*** was found! If pkg-config was correct, then it is best\n");
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
printf("*** to point to the correct configuration files\n");
}
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
(gtk_minor_version != GTK_MINOR_VERSION) ||
(gtk_micro_version != GTK_MICRO_VERSION))
{
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
}
else
{
if ((gtk_major_version > major) ||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
printf("*** correct copy of pkg-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_gtk" = x ; then
AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$PKG_CONFIG" = "no" ; then
echo "*** A new enough version of pkg-config was not found."
echo "*** See http://pkgconfig.sourceforge.net"
else
if test -f conf.gtktest ; then
:
else
echo "*** Could not run GTK+ test program, checking why..."
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
AC_TRY_LINK([
#include <gtk/gtk.h>
#include <stdio.h>
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GTK_CFLAGS=""
GTK_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
rm -f conf.gtktest
])

194
m4/gtk.m4 Normal file
View File

@ -0,0 +1,194 @@
# Configure paths for GTK+
# Owen Taylor 97-11-3
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
dnl
AC_DEFUN(AM_PATH_GTK,
[dnl
dnl Get the cflags and libraries from the gtk-config script
dnl
AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
gtk_config_prefix="$withval", gtk_config_prefix="")
AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
, enable_gtktest=yes)
for module in . $4
do
case "$module" in
gthread)
gtk_config_args="$gtk_config_args gthread"
;;
esac
done
if test x$gtk_config_exec_prefix != x ; then
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
if test x${GTK_CONFIG+set} != xset ; then
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
fi
fi
if test x$gtk_config_prefix != x ; then
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
if test x${GTK_CONFIG+set} != xset ; then
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
fi
fi
AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
min_gtk_version=ifelse([$1], ,0.99.7,$1)
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
no_gtk=""
if test "$GTK_CONFIG" = "no" ; then
no_gtk=yes
else
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_gtktest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$GTK_LIBS $LIBS"
dnl
dnl Now check if the installed GTK is sufficiently new. (Also sanity
dnl checks the results of gtk-config to some extent
dnl
rm -f conf.gtktest
AC_TRY_RUN([
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.gtktest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_gtk_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_gtk_version");
exit(1);
}
if ((gtk_major_version != $gtk_config_major_version) ||
(gtk_minor_version != $gtk_config_minor_version) ||
(gtk_micro_version != $gtk_config_micro_version))
{
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf ("*** was found! If gtk-config was correct, then it is best\n");
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
(gtk_minor_version != GTK_MINOR_VERSION) ||
(gtk_micro_version != GTK_MICRO_VERSION))
{
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
}
#endif /* defined (GTK_MAJOR_VERSION) ... */
else
{
if ((gtk_major_version > major) ||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
printf("*** correct copy of gtk-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_gtk" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$GTK_CONFIG" = "no" ; then
echo "*** The gtk-config script installed by GTK could not be found"
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the GTK_CONFIG environment variable to the"
echo "*** full path to gtk-config."
else
if test -f conf.gtktest ; then
:
else
echo "*** Could not run GTK test program, checking why..."
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
AC_TRY_LINK([
#include <gtk/gtk.h>
#include <stdio.h>
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GTK or finding the wrong"
echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
echo "***"
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
echo "*** came with the system with the command"
echo "***"
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means GTK was incorrectly installed"
echo "*** or that you have moved GTK since it was installed. In the latter case, you"
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GTK_CFLAGS=""
GTK_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
rm -f conf.gtktest
])

175
m4/sdl.m4 Normal file
View File

@ -0,0 +1,175 @@
# Configure paths for SDL
# Sam Lantinga 9/21/99
# stolen from Manish Singh
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl
AC_DEFUN([AM_PATH_SDL],
[dnl
dnl Get the cflags and libraries from the sdl-config script
dnl
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
sdl_prefix="$withval", sdl_prefix="")
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
sdl_exec_prefix="$withval", sdl_exec_prefix="")
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
, enable_sdltest=yes)
if test x$sdl_exec_prefix != x ; then
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
fi
fi
if test x$sdl_prefix != x ; then
sdl_args="$sdl_args --prefix=$sdl_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_prefix/bin/sdl-config
fi
fi
AC_REQUIRE([AC_CANONICAL_HOST])
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
min_sdl_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
no_sdl=""
if test "$SDL_CONFIG" = "no" ; then
no_sdl=yes
else
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_sdltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
dnl
dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent
dnl
rm -f conf.sdltest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[])
{
int major, minor, micro;
char *tmp_version;
/* This hangs on some systems (?)
system ("touch conf.sdltest");
*/
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_sdl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_sdl_version");
exit(1);
}
if (($sdl_major_version > major) ||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$SDL_CONFIG" = "no" ; then
echo "*** The sdl-config script installed by SDL could not be found"
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the SDL_CONFIG environment variable to the"
echo "*** full path to sdl-config."
else
if test -f conf.sdltest ; then
:
else
echo "*** Could not run SDL test program, checking why..."
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include "SDL.h"
int main(int argc, char *argv[])
{ return 0; }
#undef main
#define main K_and_R_C_main
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding SDL or finding the wrong"
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
SDL_CFLAGS=""
SDL_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
rm -f conf.sdltest
])

25
m4/type_socklen_t.m4 Normal file
View File

@ -0,0 +1,25 @@
dnl @synopsis TYPE_SOCKLEN_T
dnl
dnl Check whether sys/socket.h defines type socklen_t. Please note that
dnl some systems require sys/types.h to be included before sys/socket.h
dnl can be compiled.
dnl
dnl @category Misc
dnl @author Lars Brinkhoff <lars@nocrew.org>
dnl @version 2005-01-11
dnl @license GPLWithACException
AC_DEFUN([TYPE_SOCKLEN_T],
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
[
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[socklen_t len = 42; return 0;],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no)
])
if test $ac_cv_type_socklen_t != yes; then
AC_DEFINE(socklen_t, int, [Substitute for socklen_t])
fi
])

115
m4/uintmax_t.m4 Normal file
View File

@ -0,0 +1,115 @@
# uintmax_t.m4 serial 7 (gettext-0.12)
dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Paul Eggert.
AC_PREREQ(2.13)
# Define uintmax_t to 'unsigned long' or 'unsigned long long'
# if it is not already defined in <stdint.h> or <inttypes.h>.
AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
[
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
AC_REQUIRE([jm_AC_HEADER_STDINT_H])
if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
test $ac_cv_type_unsigned_long_long = yes \
&& ac_type='unsigned long long' \
|| ac_type='unsigned long'
AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
[Define to unsigned long or unsigned long long
if <stdint.h> and <inttypes.h> don't define.])
else
AC_DEFINE(HAVE_UINTMAX_T, 1,
[Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
fi
])
# inttypes_h.m4 serial 5 (gettext-0.12)
dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Paul Eggert.
# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
# doesn't clash with <sys/types.h>, and declares uintmax_t.
AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
[
AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <inttypes.h>],
[uintmax_t i = (uintmax_t) -1;],
jm_ac_cv_header_inttypes_h=yes,
jm_ac_cv_header_inttypes_h=no)])
if test $jm_ac_cv_header_inttypes_h = yes; then
AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
and declares uintmax_t. ])
fi
])
# stdint_h.m4 serial 3 (gettext-0.12)
dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Paul Eggert.
# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
# doesn't clash with <sys/types.h>, and declares uintmax_t.
AC_DEFUN([jm_AC_HEADER_STDINT_H],
[
AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <stdint.h>],
[uintmax_t i = (uintmax_t) -1;],
jm_ac_cv_header_stdint_h=yes,
jm_ac_cv_header_stdint_h=no)])
if test $jm_ac_cv_header_stdint_h = yes; then
AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
[Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
and declares uintmax_t. ])
fi
])
# ulonglong.m4 serial 3
dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Paul Eggert.
# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
[
AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
[AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
[unsigned long long ullmax = (unsigned long long) -1;
return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
ac_cv_type_unsigned_long_long=yes,
ac_cv_type_unsigned_long_long=no)])
if test $ac_cv_type_unsigned_long_long = yes; then
AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
[Define if you have the 'unsigned long long' type.])
fi
])

336
missing Executable file
View File

@ -0,0 +1,336 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program 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, or (at your option)
# any later version.
# This program 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.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.4 - GNU automake"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

111
mkinstalldirs Executable file
View File

@ -0,0 +1,111 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage" 1>&2
exit 0
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi
;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi
;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# End:
# mkinstalldirs ends here

2347
src/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

288
src/Makefile.am Normal file
View File

@ -0,0 +1,288 @@
INCLUDES = \
-I$(top_srcdir)/src/include -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_srcdir)
SUBDIRS = \
tools @MACHDEP@ @THREADDEP@ @GFX_DEP@ @SND_DEP@ @JOY_DEP@ @GUI_DEP@ \
@OSDEP@ keymap dms caps
DIST_SUBDIRS = \
md-generic md-68k md-i386-gcc md-ppc md-ppc-gcc md-amd64-gcc \
gfx-amigaos gfx-beos gfx-x11 gfx-sdl gfx-curses gfx-svga \
sd-none sd-alsa sd-amigaos sd-beos sd-sdl sd-solaris sd-uss \
jd-none jd-amigainput jd-amigaos jd-beos jd-linuxold jd-sdl \
gui-none gui-beos gui-cocoa gui-gtk gui-muirexx \
od-generic od-amiga od-beos od-linux od-macosx od-win32 \
td-none td-amigaos td-beos td-posix td-sdl td-win32 \
keymap \
caps dms
BUILT_SOURCES = \
blit.h blitfunc.h blitfunc.c blittable.c \
linetoscr.c \
cpudefs.c \
cpuemu_0.c cpuemu_5.c cpuemu_6.c \
cpustbl.c cputbl.h \
compemu.c \
compstbl.c comptbl.h
CLEANFILES = \
blit.h blitfunc.h blitfunc.c blittable.c \
cpudefs.c \
cpuemu_0.c cpuemu_5.c cpuemu_6.c \
cpustbl.c cputbl.h \
compemu.c \
compstbl.c comptbl.h \
linetoscr.c
DISTCLEANFILES = \
machdep osdep threaddep gfxdep sounddep joydep guidep \
target.h md-fpp.h
bin_PROGRAMS = \
uae readdisk
if BUILD_MACOSX_BUNDLE
bundle = @PACKAGE_NAME@.app
bundle_contents = $(bundle)/Contents
endif
if TARGET_BIGENDIAN
genlinetoscr_args = -b
endif
uae$(EXEEXT): $(uae_OBJECTS) $(uae_DEPENDENCIES)
@rm -f uae$(EXEEXT)
$(LINK) $(uae_LDFLAGS) $(uae_OBJECTS) $(uae_LDADD) $(LIBS)
if TARGET_BEOS
xres -o $@ @UAE_RSRCFILE@
mimeset -f $@
endif
if BUILD_MACOSX_BUNDLE
rm -fr $(bundle)
mkdir -p $(bundle_contents)/MacOS
mkdir -p $(bundle_contents)/Resources
$(INSTALL_DATA) od-macosx/Info.plist $(bundle_contents)
$(INSTALL_PROGRAM) uae$(EXEEXT) $(bundle_contents)/MacOS/
$(INSTALL_DATA) $(srcdir)/od-macosx/euae.icns $(bundle_contents)/Resources/
endif
noinst_LIBRARIES = \
libcpuemu.a
dist_noinst_DATA = \
table68k inputevents.def filesys.asm
noinst_HEADERS = \
include/akiko.h include/ar.h \
include/audio.h include/autoconf.h \
include/blitter.h include/blkdev.h \
include/bsdsocket.h include/caps.h \
include/catweasel.h include/cdrom.h \
include/cia.h \
include/commpipe.h include/compemu.h \
include/cpu_prefetch.h include/custom.h \
include/custom_private.h \
include/crc32.h \
include/debug.h include/disk.h \
include/drawing.h include/driveclick.h \
include/enforcer.h include/ersatz.h \
include/events.h include/execlib.h \
include/fdi2raw.h include/filesys.h \
include/fpp-ieee.h include/fpp-unknown.h \
include/fsdb.h include/fsusage.h \
include/genblitter.h include/gensound.h \
include/gfxfilter.h include/gui.h \
include/hotkeys.h \
include/hrtimer.h include/identify.h \
include/inputdevice.h include/joystick.h \
include/keyboard.h include/keybuf.h \
include/memory.h \
include/native2amiga.h include/newcpu.h \
include/noflags.h include/options.h \
include/osemu.h include/picasso96.h \
include/readcpu.h include/savestate.h \
include/scsidev.h include/serial.h \
include/sinctable.h \
include/sleep.h include/sysdeps.h \
include/traps.h \
include/tui.h include/uae.h \
include/uaeexe.h \
include/uae_endian.h \
include/uae_malloc.h \
include/uae_string.h \
include/uae_types.h \
include/unzip.h \
include/version.h \
include/writelog.h \
include/xwin.h include/zfile.h \
targets/t-amiga.h targets/t-beos.h \
targets/t-unix.h targets/t-win32.h
dist_noinst_SCRIPTS = \
filesys.sh install_libscg
EXTRA_DIST = \
tools/configure.in tools/configure tools/sysconfig.h.in \
tools/target.h tools/Makefile.in \
test/test_optflag.c test/Makefile.in test/Makefile.am
uae_SOURCES = \
main.c newcpu.c fpp.c memory.c events.c custom.c serial.c cia.c \
blitter.c autoconf.c traps.c ersatz.c keybuf.c expansion.c \
zfile.c cfgfile.c picasso96.c inputdevice.c \
gfxutil.c audio.c sinctable.c drawing.c \
native2amiga.c disk.c crc32.c savestate.c unzip.c \
uaeexe.c uaelib.c fdi2raw.c hotkeys.c \
ar.c driveclick.c enforcer.c misc.c \
missing.c readcpu.c
EXTRA_uae_SOURCES = \
bsdsocket.c bsdsocket-posix-new.c build68k.c catweasel.c cdrom.c \
compemu_fpp.c compemu_raw_x86.c compemu_support.c \
debug.c identify.c filesys.c filesys_bootrom.c fsdb.c fsdb_unix.c fsusage.c genblitter.c \
gencpu.c gengenblitter.c gencomp.c genlinetoscr.c hardfile.c \
hardfile_unix.c scsi-none.c \
scsiemul.c svgancui.c tui.c \
blkdev-libscg.c filesys_unix.c \
akiko.c ar.c blkdev.c blitops.c \
writelog.c
uae_DEPENDENCIES = \
@MACHDEP@/libmachdep.a \
@JOY_DEP@/libjoydep.a \
@SND_DEP@/libsnddep.a \
@GFX_DEP@/libgfxdep.a \
@GUI_DEP@/libguidep.a \
keymap/libkeymap.a \
dms/libdms.a \
caps/libcaps.a \
blitfunc.o blittable.o \
cpustbl.o cpudefs.o \
libcpuemu.a \
@EXTRAOBJS@ \
@FILESYSOBJS@ \
@BSDSOCKOBJS@ \
@SCSIOBJS@ \
@CDOBJS@ \
@DEBUGOBJS@ \
@ASMOBJS@ \
@THREADDEP@/libthreaddep.a \
@OSDEP@/libosdep.a
uae_LDADD = \
@MACHDEP@/libmachdep.a \
@JOY_DEP@/libjoydep.a \
@SND_DEP@/libsnddep.a \
@GFX_DEP@/libgfxdep.a \
@GUI_DEP@/libguidep.a \
keymap/libkeymap.a \
dms/libdms.a \
caps/libcaps.a \
blitfunc.o blittable.o \
cpustbl.o cpudefs.o \
libcpuemu.a \
@EXTRAOBJS@ \
@FILESYSOBJS@ \
@BSDSOCKOBJS@ \
@SCSIOBJS@ \
@CDOBJS@ \
@DEBUGOBJS@ \
@ASMOBJS@ \
@THREADDEP@/libthreaddep.a \
@OSDEP@/libosdep.a
readdisk_SOURCES = \
readdisk.c missing.c
libcpuemu_a_SOURCES =
libcpuemu_a_LIBADD = @CPUOBJS@ @JITOBJS@
libcpuemu_a_DEPENDENCIES = @CPUOBJS@ @JITOBJS@
cpuemu_0.c: tools/gencpu
./tools/gencpu @GENCPUOPTS@
cpustbl.c: cpuemu_0.c
cputbl.h: cpuemu_0.c
cpuemu_5.c: cpuemu_0.c
cpuemu_6.c: cpuemu_0.c
compemu.c: tools/gencomp
./tools/gencomp
compstbl.c: compemu.c
comptbl.h: compemu.c
cpuemu_nf_%.o: cpuemu_%.c
$(CC) $(INCLUDES) -c $(CPPFLAGS) $(CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) -DNOFLAGS $< -o $@
cpuemu_%.o: cpuemu_%.c
$(CC) $(INCLUDES) -c $(CPPFLAGS) $(CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o $@
cpustbl_nf.o: cpustbl.c
$(CC) $(INCLUDES) -c $(CPPFLAGS) $(CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) -DNOFLAGS cpustbl.c -o $@
blit.h: tools/genblitter
./tools/genblitter i >blit.h
blitfunc.c: tools/genblitter blitfunc.h
./tools/genblitter f >blitfunc.c
blitfunc.h: tools/genblitter
./tools/genblitter h >blitfunc.h
blittable.c: tools/genblitter blitfunc.h
./tools/genblitter t >blittable.c
linetoscr.c: tools/genlinetoscr
./tools/genlinetoscr $(genlinetoscr_args) >linetoscr.c
tools/genblitter:
$(MAKE) -C tools genblitter
tools/build68k:
$(MAKE) -C tools build68k
tools/gencpu:
$(MAKE) -C tools gencpu
tools/gencomp:
$(MAKE) -C tools gencomp
tools/genlinetoscr:
$(MAKE) -C tools genlinetoscr
cpudefs.c: tools/build68k @top_srcdir@/src/table68k
./tools/build68k <@top_srcdir@/src/table68k >cpudefs.c
machdep/libmachdep.a:
$(MAKE) -C @MACHDEP@ libmachdep.a
gfxdep/libgfxdep.a:
$(MAKE) -C @GFX_DEP@ libgfxdep.a
sounddep/libsnddep.a:
$(MAKE) -C @SND_DEP@ libsnddep.a
joydep/libjoydep.a:
$(MAKE) -C @JOY_DEP@ libjoydep.a
guidep/libguidep.a:
$(MAKE) -C @GUI_DEP@ libguidep.a
osdep/libosdep.a:
$(MAKE) -C @OSDEP@ libosdep.a
osdep/libthreaddep.a:
$(MAKE) -C @THREADDEP@ libthreaddep.a
keymap/libkeymap.a:
$(MAKE) -C keymap libkeymap.a
clean-local:
$(MAKE) -C tools clean
distclean-local:
$(MAKE) -C tools distclean

1024
src/Makefile.in Normal file

File diff suppressed because it is too large Load Diff

1497
src/akiko.c Normal file

File diff suppressed because it is too large Load Diff

1640
src/ar.c Normal file

File diff suppressed because it is too large Load Diff

1482
src/audio.c Normal file

File diff suppressed because it is too large Load Diff

250
src/autoconf.c Normal file
View File

@ -0,0 +1,250 @@
/*
* UAE - The Un*x Amiga Emulator
*
* AutoConfig devices
*
* Copyright 1995, 1996 Bernd Schmidt
* Copyright 1996 Ed Hanway
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "uae.h"
#include "memory.h"
#include "custom.h"
#include "events.h"
#include "newcpu.h"
#include "autoconf.h"
#include "traps.h"
#include "version.h"
/* Commonly used autoconfig strings */
uaecptr EXPANSION_explibname, EXPANSION_doslibname, EXPANSION_uaeversion;
uaecptr EXPANSION_uaedevname, EXPANSION_explibbase = 0, EXPANSION_haveV36;
uaecptr EXPANSION_bootcode, EXPANSION_nullfunc;
uaecptr EXPANSION_cddevice;
/* ROM tag area memory access */
uae_u8 *rtarea;
static uae_u32 rtarea_lget (uaecptr) REGPARAM;
static uae_u32 rtarea_wget (uaecptr) REGPARAM;
static uae_u32 rtarea_bget (uaecptr) REGPARAM;
static void rtarea_lput (uaecptr, uae_u32) REGPARAM;
static void rtarea_wput (uaecptr, uae_u32) REGPARAM;
static void rtarea_bput (uaecptr, uae_u32) REGPARAM;
static uae_u8 *rtarea_xlate (uaecptr) REGPARAM;
addrbank rtarea_bank = {
rtarea_lget, rtarea_wget, rtarea_bget,
rtarea_lput, rtarea_wput, rtarea_bput,
rtarea_xlate, default_check, NULL
};
uae_u8 REGPARAM2 *rtarea_xlate (uaecptr addr)
{
addr &= 0xFFFF;
return rtarea + addr;
}
uae_u32 REGPARAM2 rtarea_lget (uaecptr addr)
{
#ifdef JIT
special_mem |= SPECIAL_MEM_READ;
#endif
addr &= 0xFFFF;
return (uae_u32)(rtarea_wget (addr) << 16) + rtarea_wget (addr+2);
}
uae_u32 REGPARAM2 rtarea_wget (uaecptr addr)
{
#ifdef JIT
special_mem |= SPECIAL_MEM_READ;
#endif
addr &= 0xFFFF;
return (rtarea[addr]<<8) + rtarea[addr+1];
}
uae_u32 REGPARAM2 rtarea_bget (uaecptr addr)
{
#ifdef JIT
special_mem |= SPECIAL_MEM_READ;
#endif
addr &= 0xFFFF;
return rtarea[addr];
}
void REGPARAM2 rtarea_lput (uaecptr addr, uae_u32 value)
{
#ifdef JIT
special_mem |= SPECIAL_MEM_WRITE;
#endif
}
void REGPARAM2 rtarea_wput (uaecptr addr, uae_u32 value)
{
#ifdef JIT
special_mem |= SPECIAL_MEM_WRITE;
#endif
}
void REGPARAM2 rtarea_bput (uaecptr addr, uae_u32 value)
{
#ifdef JIT
special_mem |= SPECIAL_MEM_WRITE;
#endif
}
/* some quick & dirty code to fill in the rt area and save me a lot of
* scratch paper
*/
static int rt_addr;
static int rt_straddr;
uae_u32 addr (int ptr)
{
return (uae_u32)ptr + RTAREA_BASE;
}
void db (uae_u8 data)
{
rtarea[rt_addr++] = data;
}
void dw (uae_u16 data)
{
rtarea[rt_addr++] = (uae_u8)(data >> 8);
rtarea[rt_addr++] = (uae_u8)data;
}
void dl (uae_u32 data)
{
rtarea[rt_addr++] = data >> 24;
rtarea[rt_addr++] = data >> 16;
rtarea[rt_addr++] = data >> 8;
rtarea[rt_addr++] = data;
}
/* store strings starting at the end of the rt area and working
* backward. store pointer at current address
*/
uae_u32 ds (const char *str)
{
int len = strlen (str) + 1;
rt_straddr -= len;
strcpy ((char *)rtarea + rt_straddr, str);
return addr (rt_straddr);
}
void calltrap (uae_u32 n)
{
dw (0xA000 + n);
}
void org (uae_u32 a)
{
rt_addr = a - RTAREA_BASE;
}
uae_u32 here (void)
{
return addr (rt_addr);
}
void align (int b)
{
rt_addr = (rt_addr + b - 1) & ~(b - 1);
}
static uae_u32 REGPARAM2 nullfunc (TrapContext *context)
{
write_log ("Null function called\n");
return 0;
}
static uae_u32 REGPARAM2 getchipmemsize (TrapContext *context)
{
return allocated_chipmem;
}
static uae_u32 REGPARAM2 uae_puts (TrapContext *context)
{
puts ((char *)get_real_address (m68k_areg (&context->regs, 0)));
return 0;
}
static void rtarea_init_mem (void)
{
rtarea = mapped_malloc (0x10000, "rtarea");
if (!rtarea) {
write_log ("virtual memory exhausted (rtarea)!\n");
abort ();
}
rtarea_bank.baseaddr = rtarea;
}
void rtarea_init (void)
{
uae_u32 a;
char uaever[100];
rt_straddr = 0xFF00 - 2;
rt_addr = 0;
init_traps ();
rtarea_init_mem ();
sprintf (uaever, "uae-%d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
EXPANSION_uaeversion = ds (uaever);
EXPANSION_explibname = ds ("expansion.library");
EXPANSION_doslibname = ds ("dos.library");
EXPANSION_uaedevname = ds ("uae.device");
deftrap (NULL); /* Generic emulator trap */
EXPANSION_nullfunc = here ();
calltrap (deftrap (nullfunc));
dw (RTS);
a = here();
/* Dummy trap - removing this breaks the filesys emulation. */
org (RTAREA_BASE + 0xFF00);
calltrap (deftrap2 (nullfunc, TRAPFLAG_NO_RETVAL, ""));
org (RTAREA_BASE + 0xFF80);
calltrap (deftrap2 (getchipmemsize, TRAPFLAG_DORET, ""));
org (RTAREA_BASE + 0xFF10);
calltrap (deftrap2 (uae_puts, TRAPFLAG_NO_RETVAL, ""));
dw (RTS);
org (a);
#ifdef FILESYS
filesys_install_code ();
#endif
init_extended_traps ();
}
volatile int uae_int_requested = 0;
void set_uae_int_flag (void)
{
rtarea[0xFFFB] = uae_int_requested;
}
void rtarea_setup (void)
{
}

262
src/blitops.c Normal file
View File

@ -0,0 +1,262 @@
/* This file generated automatically - do not edit */
#include "genblitter.h"
struct blitop blitops[256] = {
/* 00 */ { "0", 0 },
/* 01 */ { "~(srca | srcb | srcc)", 7 },
/* 02 */ { "(srcc & ~(srca | srcb))", 7 },
/* 03 */ { "~(srca | srcb)", 3 },
/* 04 */ { "(srcb & ~(srca | srcc))", 7 },
/* 05 */ { "~(srca | srcc)", 5 },
/* 06 */ { "(~srca & (srcb ^ srcc))", 7 },
/* 07 */ { "~(srca | (srcb & srcc))", 7 },
/* 08 */ { "(~srca & srcb & srcc)", 7 },
/* 09 */ { "~(srca | (srcb ^ srcc))", 7 },
/* 0a */ { "(~srca & srcc)", 5 },
/* 0b */ { "~(srca | (srcb & ~srcc))", 7 },
/* 0c */ { "(~srca & srcb)", 3 },
/* 0d */ { "~(srca | (~srcb & srcc))", 7 },
/* 0e */ { "(~srca & (srcb | srcc))", 7 },
/* 0f */ { "~srca", 1 },
/* 10 */ { "(srca & ~(srcb | srcc))", 7 },
/* 11 */ { "~(srcb | srcc)", 6 },
/* 12 */ { "(~srcb & (srca ^ srcc))", 7 },
/* 13 */ { "~(srcb | (srca & srcc))", 7 },
/* 14 */ { "(~srcc & (srca ^ srcb))", 7 },
/* 15 */ { "~(srcc | (srca & srcb))", 7 },
/* 16 */ { "(srca ^ ((srca & srcb) | (srcb ^ srcc)))", 7 },
/* 17 */ { "~(srca ^ ((srca ^ srcb) & (srca ^ srcc)))", 7 },
/* 18 */ { "((srca ^ srcb) & (srca ^ srcc))", 7 },
/* 19 */ { "(srcb ^ (~srcc | (srca & srcb)))", 7 },
/* 1a */ { "(srca ^ (srcc | (srca & srcb)))", 7 },
/* 1b */ { "(srca ^ (srcc | ~(srca ^ srcb)))", 7 },
/* 1c */ { "(srca ^ (srcb | (srca & srcc)))", 7 },
/* 1d */ { "(srca ^ (srcb | ~(srca ^ srcc)))", 7 },
/* 1e */ { "(srca ^ (srcb | srcc))", 7 },
/* 1f */ { "~(srca & (srcb | srcc))", 7 },
/* 20 */ { "(srca & ~srcb & srcc)", 7 },
/* 21 */ { "~(srcb | (srca ^ srcc))", 7 },
/* 22 */ { "(~srcb & srcc)", 6 },
/* 23 */ { "~(srcb | (srca & ~srcc))", 7 },
/* 24 */ { "((srca ^ srcb) & (srcb ^ srcc))", 7 },
/* 25 */ { "(srca ^ (~srcc | (srca & srcb)))", 7 },
/* 26 */ { "(srcb ^ (srcc | (srca & srcb)))", 7 },
/* 27 */ { "~(srca ^ (srcc & (srca ^ srcb)))", 7 },
/* 28 */ { "(srcc & (srca ^ srcb))", 7 },
/* 29 */ { "~(srca ^ srcb ^ (srcc | (srca & srcb)))", 7 },
/* 2a */ { "(srcc & ~(srca & srcb))", 7 },
/* 2b */ { "~(srca ^ ((srca ^ srcb) & (srcb ^ srcc)))", 7 },
/* 2c */ { "(srcb ^ (srca & (srcb | srcc)))", 7 },
/* 2d */ { "(srca ^ (srcb | ~srcc))", 7 },
/* 2e */ { "(srca ^ (srcb | (srca ^ srcc)))", 7 },
/* 2f */ { "~(srca & (srcb | ~srcc))", 7 },
/* 30 */ { "(srca & ~srcb)", 3 },
/* 31 */ { "~(srcb | (~srca & srcc))", 7 },
/* 32 */ { "(~srcb & (srca | srcc))", 7 },
/* 33 */ { "~srcb", 2 },
/* 34 */ { "(srcb ^ (srca | (srcb & srcc)))", 7 },
/* 35 */ { "(srcb ^ (srca | ~(srcb ^ srcc)))", 7 },
/* 36 */ { "(srcb ^ (srca | srcc))", 7 },
/* 37 */ { "~(srcb & (srca | srcc))", 7 },
/* 38 */ { "(srca ^ (srcb & (srca | srcc)))", 7 },
/* 39 */ { "(srcb ^ (srca | ~srcc))", 7 },
/* 3a */ { "(srcb ^ (srca | (srcb ^ srcc)))", 7 },
/* 3b */ { "~(srcb & (srca | ~srcc))", 7 },
/* 3c */ { "(srca ^ srcb)", 3 },
/* 3d */ { "(srca ^ (srcb | ~(srca | srcc)))", 7 },
/* 3e */ { "(srca ^ (srcb | (srca ^ (srca | srcc))))", 7 },
/* 3f */ { "~(srca & srcb)", 3 },
/* 40 */ { "(srca & srcb & ~srcc)", 7 },
/* 41 */ { "~(srcc | (srca ^ srcb))", 7 },
/* 42 */ { "((srca ^ srcc) & (srcb ^ srcc))", 7 },
/* 43 */ { "(srca ^ (~srcb | (srca & srcc)))", 7 },
/* 44 */ { "(srcb & ~srcc)", 6 },
/* 45 */ { "~(srcc | (srca & ~srcb))", 7 },
/* 46 */ { "(srcc ^ (srcb | (srca & srcc)))", 7 },
/* 47 */ { "~(srca ^ (srcb & (srca ^ srcc)))", 7 },
/* 48 */ { "(srcb & (srca ^ srcc))", 7 },
/* 49 */ { "~(srca ^ srcc ^ (srcb | (srca & srcc)))", 7 },
/* 4a */ { "(srcc ^ (srca & (srcb | srcc)))", 7 },
/* 4b */ { "(srca ^ (~srcb | srcc))", 7 },
/* 4c */ { "(srcb & ~(srca & srcc))", 7 },
/* 4d */ { "(srca ^ ((srca ^ srcb) | ~(srca ^ srcc)))", 7 },
/* 4e */ { "(srca ^ (srcc | (srca ^ srcb)))", 7 },
/* 4f */ { "~(srca & (~srcb | srcc))", 7 },
/* 50 */ { "(srca & ~srcc)", 5 },
/* 51 */ { "~(srcc | (~srca & srcb))", 7 },
/* 52 */ { "(srcc ^ (srca | (srcb & srcc)))", 7 },
/* 53 */ { "~(srcb ^ (srca & (srcb ^ srcc)))", 7 },
/* 54 */ { "(~srcc & (srca | srcb))", 7 },
/* 55 */ { "~srcc", 4 },
/* 56 */ { "(srcc ^ (srca | srcb))", 7 },
/* 57 */ { "~(srcc & (srca | srcb))", 7 },
/* 58 */ { "(srca ^ (srcc & (srca | srcb)))", 7 },
/* 59 */ { "(srcc ^ (srca | ~srcb))", 7 },
/* 5a */ { "(srca ^ srcc)", 5 },
/* 5b */ { "(srca ^ (srcc | ~(srca | srcb)))", 7 },
/* 5c */ { "(srcc ^ (srca | (srcb ^ srcc)))", 7 },
/* 5d */ { "~(srcc & (srca | ~srcb))", 7 },
/* 5e */ { "(srca ^ (srcc | (srca ^ (srca | srcb))))", 7 },
/* 5f */ { "~(srca & srcc)", 5 },
/* 60 */ { "(srca & (srcb ^ srcc))", 7 },
/* 61 */ { "~(srcb ^ srcc ^ (srca | (srcb & srcc)))", 7 },
/* 62 */ { "(srcc ^ (srcb & (srca | srcc)))", 7 },
/* 63 */ { "(srcb ^ (~srca | srcc))", 7 },
/* 64 */ { "(srcb ^ (srcc & (srca | srcb)))", 7 },
/* 65 */ { "(srcc ^ (~srca | srcb))", 7 },
/* 66 */ { "(srcb ^ srcc)", 6 },
/* 67 */ { "(srcb ^ (srcc | ~(srca | srcb)))", 7 },
/* 68 */ { "((srca & srcb) ^ (srcc & (srca | srcb)))", 7 },
/* 69 */ { "~(srca ^ srcb ^ srcc)", 7 },
/* 6a */ { "(srcc ^ (srca & srcb))", 7 },
/* 6b */ { "~(srca ^ srcb ^ (srcc & (srca | srcb)))", 7 },
/* 6c */ { "(srcb ^ (srca & srcc))", 7 },
/* 6d */ { "~(srca ^ srcc ^ (srcb & (srca | srcc)))", 7 },
/* 6e */ { "((~srca & srcb) | (srcb ^ srcc))", 7 },
/* 6f */ { "(~srca | (srcb ^ srcc))", 7 },
/* 70 */ { "(srca & ~(srcb & srcc))", 7 },
/* 71 */ { "~(srca ^ ((srca ^ srcb) | (srca ^ srcc)))", 7 },
/* 72 */ { "(srcb ^ (srcc | (srca ^ srcb)))", 7 },
/* 73 */ { "~(srcb & (~srca | srcc))", 7 },
/* 74 */ { "(srcc ^ (srcb | (srca ^ srcc)))", 7 },
/* 75 */ { "~(srcc & (~srca | srcb))", 7 },
/* 76 */ { "(srcb ^ (srcc | (srca ^ (srca & srcb))))", 7 },
/* 77 */ { "~(srcb & srcc)", 6 },
/* 78 */ { "(srca ^ (srcb & srcc))", 7 },
/* 79 */ { "~(srcb ^ srcc ^ (srca & (srcb | srcc)))", 7 },
/* 7a */ { "((srca & ~srcb) | (srca ^ srcc))", 7 },
/* 7b */ { "(~srcb | (srca ^ srcc))", 7 },
/* 7c */ { "((srca ^ srcb) | (srca & ~srcc))", 7 },
/* 7d */ { "(~srcc | (srca ^ srcb))", 7 },
/* 7e */ { "((srca ^ srcb) | (srca ^ srcc))", 7 },
/* 7f */ { "~(srca & srcb & srcc)", 7 },
/* 80 */ { "(srca & srcb & srcc)", 7 },
/* 81 */ { "~((srca ^ srcb) | (srca ^ srcc))", 7 },
/* 82 */ { "(srcc & ~(srca ^ srcb))", 7 },
/* 83 */ { "(srca ^ (~srcb | (srca & ~srcc)))", 7 },
/* 84 */ { "(srcb & ~(srca ^ srcc))", 7 },
/* 85 */ { "(srca ^ (~srcc | (srca & ~srcb)))", 7 },
/* 86 */ { "(srcb ^ srcc ^ (srca & (srcb | srcc)))", 7 },
/* 87 */ { "~(srca ^ (srcb & srcc))", 7 },
/* 88 */ { "(srcb & srcc)", 6 },
/* 89 */ { "(srcb ^ (~srcc & (~srca | srcb)))", 7 },
/* 8a */ { "(srcc & (~srca | srcb))", 7 },
/* 8b */ { "(srca ^ (~srcb | (srca ^ srcc)))", 7 },
/* 8c */ { "(srcb & (~srca | srcc))", 7 },
/* 8d */ { "(srca ^ (~srcc | (srca ^ srcb)))", 7 },
/* 8e */ { "(srca ^ ((srca ^ srcb) | (srca ^ srcc)))", 7 },
/* 8f */ { "(~srca | (srcb & srcc))", 7 },
/* 90 */ { "(srca & ~(srcb ^ srcc))", 7 },
/* 91 */ { "(srcb ^ (~srcc | (~srca & srcb)))", 7 },
/* 92 */ { "(srca ^ srcc ^ (srcb & (srca | srcc)))", 7 },
/* 93 */ { "~(srcb ^ (srca & srcc))", 7 },
/* 94 */ { "(srca ^ srcb ^ (srcc & (srca | srcb)))", 7 },
/* 95 */ { "~(srcc ^ (srca & srcb))", 7 },
/* 96 */ { "(srca ^ srcb ^ srcc)", 7 },
/* 97 */ { "(srca ^ srcb ^ (srcc | ~(srca | srcb)))", 7 },
/* 98 */ { "(srcb ^ (~srcc & (srca | srcb)))", 7 },
/* 99 */ { "~(srcb ^ srcc)", 6 },
/* 9a */ { "(srcc ^ (srca & ~srcb))", 7 },
/* 9b */ { "~(srcb ^ (srcc & (srca | srcb)))", 7 },
/* 9c */ { "(srcb ^ (srca & ~srcc))", 7 },
/* 9d */ { "~(srcc ^ (srcb & (srca | srcc)))", 7 },
/* 9e */ { "(srcb ^ srcc ^ (srca | (srcb & srcc)))", 7 },
/* 9f */ { "~(srca & (srcb ^ srcc))", 7 },
/* a0 */ { "(srca & srcc)", 5 },
/* a1 */ { "(srca ^ (~srcc & (srca | ~srcb)))", 7 },
/* a2 */ { "(srcc & (srca | ~srcb))", 7 },
/* a3 */ { "(srcb ^ (~srca | (srcb ^ srcc)))", 7 },
/* a4 */ { "(srca ^ (~srcc & (srca | srcb)))", 7 },
/* a5 */ { "~(srca ^ srcc)", 5 },
/* a6 */ { "(srcc ^ (~srca & srcb))", 7 },
/* a7 */ { "~(srca ^ (srcc & (srca | srcb)))", 7 },
/* a8 */ { "(srcc & (srca | srcb))", 7 },
/* a9 */ { "~(srcc ^ (srca | srcb))", 7 },
/* aa */ { "srcc", 4 },
/* ab */ { "(srcc | ~(srca | srcb))", 7 },
/* ac */ { "(srcb ^ (srca & (srcb ^ srcc)))", 7 },
/* ad */ { "~(srcc ^ (srca | (srcb & srcc)))", 7 },
/* ae */ { "(srcc | (~srca & srcb))", 7 },
/* af */ { "(~srca | srcc)", 5 },
/* b0 */ { "(srca & (~srcb | srcc))", 7 },
/* b1 */ { "~(srca ^ (srcc | (srca ^ srcb)))", 7 },
/* b2 */ { "(srca ^ ((srca ^ srcc) & (srcb ^ srcc)))", 7 },
/* b3 */ { "(~srcb | (srca & srcc))", 7 },
/* b4 */ { "(srca ^ (srcb & ~srcc))", 7 },
/* b5 */ { "~(srcc ^ (srca & (srcb | srcc)))", 7 },
/* b6 */ { "(srca ^ srcc ^ (srcb | (srca & srcc)))", 7 },
/* b7 */ { "~(srcb & (srca ^ srcc))", 7 },
/* b8 */ { "(srca ^ (srcb & (srca ^ srcc)))", 7 },
/* b9 */ { "~(srcc ^ (srcb | (srca & srcc)))", 7 },
/* ba */ { "(srcc | (srca & ~srcb))", 7 },
/* bb */ { "(~srcb | srcc)", 6 },
/* bc */ { "((srca ^ srcb) | (srca & srcc))", 7 },
/* bd */ { "((srca ^ srcb) | ~(srca ^ srcc))", 7 },
/* be */ { "(srcc | (srca ^ srcb))", 7 },
/* bf */ { "(srcc | ~(srca & srcb))", 7 },
/* c0 */ { "(srca & srcb)", 3 },
/* c1 */ { "(srca ^ (~srcb & (srca | ~srcc)))", 7 },
/* c2 */ { "(srca ^ (~srcb & (srca | srcc)))", 7 },
/* c3 */ { "~(srca ^ srcb)", 3 },
/* c4 */ { "(srcb & (srca | ~srcc))", 7 },
/* c5 */ { "~(srcb ^ (srca | (srcb ^ srcc)))", 7 },
/* c6 */ { "(srcb ^ (~srca & srcc))", 7 },
/* c7 */ { "~(srca ^ (srcb & (srca | srcc)))", 7 },
/* c8 */ { "(srcb & (srca | srcc))", 7 },
/* c9 */ { "~(srcb ^ (srca | srcc))", 7 },
/* ca */ { "(srcc ^ (srca & (srcb ^ srcc)))", 7 },
/* cb */ { "~(srcb ^ (srca | (srcb & srcc)))", 7 },
/* cc */ { "srcb", 2 },
/* cd */ { "(srcb | ~(srca | srcc))", 7 },
/* ce */ { "(srcb | (~srca & srcc))", 7 },
/* cf */ { "(~srca | srcb)", 3 },
/* d0 */ { "(srca & (srcb | ~srcc))", 7 },
/* d1 */ { "~(srca ^ (srcb | (srca ^ srcc)))", 7 },
/* d2 */ { "(srca ^ (~srcb & srcc))", 7 },
/* d3 */ { "~(srcb ^ (srca & (srcb | srcc)))", 7 },
/* d4 */ { "(srca ^ ((srca ^ srcb) & (srcb ^ srcc)))", 7 },
/* d5 */ { "(~srcc | (srca & srcb))", 7 },
/* d6 */ { "(srca ^ srcb ^ (srcc | (srca & srcb)))", 7 },
/* d7 */ { "~(srcc & (srca ^ srcb))", 7 },
/* d8 */ { "(srca ^ (srcc & (srca ^ srcb)))", 7 },
/* d9 */ { "~(srcb ^ (srcc | (srca & srcb)))", 7 },
/* da */ { "((srca & srcb) | (srca ^ srcc))", 7 },
/* db */ { "~((srca ^ srcb) & (srcb ^ srcc))", 7 },
/* dc */ { "(srcb | (srca & ~srcc))", 7 },
/* dd */ { "(srcb | ~srcc)", 6 },
/* de */ { "(srcb | (srca ^ srcc))", 7 },
/* df */ { "(srcb | ~(srca & srcc))", 7 },
/* e0 */ { "(srca & (srcb | srcc))", 7 },
/* e1 */ { "~(srca ^ (srcb | srcc))", 7 },
/* e2 */ { "(srcc ^ (srcb & (srca ^ srcc)))", 7 },
/* e3 */ { "~(srca ^ (srcb | (srca & srcc)))", 7 },
/* e4 */ { "(srcb ^ (srcc & (srca ^ srcb)))", 7 },
/* e5 */ { "~(srca ^ (srcc | (srca & srcb)))", 7 },
/* e6 */ { "((srca & srcb) | (srcb ^ srcc))", 7 },
/* e7 */ { "~((srca ^ srcb) & (srca ^ srcc))", 7 },
/* e8 */ { "(srca ^ ((srca ^ srcb) & (srca ^ srcc)))", 7 },
/* e9 */ { "(srca ^ srcb ^ (~srcc | (srca & srcb)))", 7 },
/* ea */ { "(srcc | (srca & srcb))", 7 },
/* eb */ { "(srcc | ~(srca ^ srcb))", 7 },
/* ec */ { "(srcb | (srca & srcc))", 7 },
/* ed */ { "(srcb | ~(srca ^ srcc))", 7 },
/* ee */ { "(srcb | srcc)", 6 },
/* ef */ { "(~srca | srcb | srcc)", 7 },
/* f0 */ { "srca", 1 },
/* f1 */ { "(srca | ~(srcb | srcc))", 7 },
/* f2 */ { "(srca | (~srcb & srcc))", 7 },
/* f3 */ { "(srca | ~srcb)", 3 },
/* f4 */ { "(srca | (srcb & ~srcc))", 7 },
/* f5 */ { "(srca | ~srcc)", 5 },
/* f6 */ { "(srca | (srcb ^ srcc))", 7 },
/* f7 */ { "(srca | ~(srcb & srcc))", 7 },
/* f8 */ { "(srca | (srcb & srcc))", 7 },
/* f9 */ { "(srca | ~(srcb ^ srcc))", 7 },
/* fa */ { "(srca | srcc)", 5 },
/* fb */ { "(srca | ~srcb | srcc)", 7 },
/* fc */ { "(srca | srcb)", 3 },
/* fd */ { "(srca | srcb | ~srcc)", 7 },
/* fe */ { "(srca | srcb | srcc)", 7 },
/* ff */ { "0xFFFFFFFF", 0 }
};

1216
src/blitter.c Normal file

File diff suppressed because it is too large Load Diff

629
src/blkdev-libscg.c Normal file
View File

@ -0,0 +1,629 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Block device access using libscg
*
* Copyright 2004-2005 Richard Drummond
*
* Heavily based on code:
* Copyright 1995 Bernd Schmidt
* Copyright 1999 Patrick Ohly
*
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "memory.h"
#include "threaddep/thread.h"
#include "blkdev.h"
#include "scsidev.h"
#include "sleep.h"
#include "gui.h"
//#define DEBUG_ME
#ifdef DEBUG_ME
#define DEBUG_LOG write_log
#else
#define DEBUG_LOG(...) do { ; } while (0);
#endif
typedef int BOOL;
#include "scg/scgcmd.h"
#include "scg/scsidefs.h"
#include "scg/scsireg.h"
#include "scg/scsitransp.h"
#define MAX_DRIVES 16
struct scsidevdata {
int bus, target, lun;
int isatapi;
int max_dma;
SCSI *scgp;
};
static struct scsidevdata drives[MAX_DRIVES];
static int total_drives;
static const uae_u8 *execscsicmd_in (int unitnum, const uae_u8 *data, int len, int *outlen);
/*
* scg_isatapi() is not implemented on all platforms. Therefore,
* this little piece of magic from Toni Wilen is needed to detect
* ATAPI devices.
*/
static int is_atapi_drive (int unitnum)
{
static const uae_u8 cmd[6] = {0x12, 0, 0, 0, 36, 0}; /* INQUIRY */
uae_u8 out[36];
int outlen = sizeof (out);
const uae_u8 *p = execscsicmd_in (unitnum, cmd, sizeof (cmd), &outlen);
if (!p)
return 0;
if (outlen >= 2 && (p[0] & 31) == 5 && (p[2] & 7) == 0)
return 1;
return 0;
}
static int add_drive (SCSI *scgp)
{
int result = 0;
if (total_drives < MAX_DRIVES) {
int isatapi;
drives [total_drives].bus = scgp->addr.scsibus;
drives [total_drives].target = scgp->addr.target;
drives [total_drives].lun = scgp->addr.lun;
isatapi = scg_isatapi (scgp);
/* If scg_isatapi returned false, we need to double-check
* because it may not be implemented on the target platform
*/
if (!isatapi) {
drives [total_drives].scgp = scgp;
isatapi = is_atapi_drive (total_drives);
drives [total_drives].scgp = 0;
}
drives [total_drives].isatapi = isatapi;
total_drives++;
result = 1;
}
return result;
}
/* Global lock - this needs to be replaced with a per-device lock */
uae_sem_t scgp_sem;
/********** generic SCSI stuff stolen from cdrecord and scsitransp.c *********/
static int inquiry (SCSI *scgp, void *bp, int cnt)
{
struct scg_cmd *scmd = scgp->scmd;
int result;
memset (bp, 0, cnt);
memset ((void *)scmd, 0, sizeof(*scmd));
scmd->addr = bp;
scmd->size = cnt;
scmd->flags = SCG_RECV_DATA|SCG_DISRE_ENA;
scmd->cdb_len = SC_G0_CDBLEN;
scmd->sense_len = CCS_SENSE_LEN;
scmd->cdb.g0_cdb.cmd = SC_INQUIRY;
scmd->cdb.g0_cdb.lun = scg_lun(scgp);
scmd->cdb.g0_cdb.count = cnt;
scgp->cmdname = "inquiry";
result = scg_cmd(scgp);
return result;
}
static int test_unit_ready (SCSI *scgp)
{
struct scg_cmd *scmd = scgp->scmd;
int result;
memset ((void *)scmd, 0, sizeof(*scmd));
scmd->addr = (caddr_t)0;
scmd->size = 0;
scmd->flags = SCG_DISRE_ENA | (scgp->silent ? SCG_SILENT:0);
scmd->cdb_len = SC_G0_CDBLEN;
scmd->sense_len = CCS_SENSE_LEN;
scmd->cdb.g0_cdb.cmd = SC_TEST_UNIT_READY;
scmd->cdb.g0_cdb.lun = scg_lun(scgp);
scgp->cmdname = "test unit ready";
result = scg_cmd (scgp);
return result;
}
static int unit_ready (SCSI *scgp)
{
register struct scg_cmd *scmd = scgp->scmd;
if (test_unit_ready(scgp) >= 0) /* alles OK */
return 1;
else if (scmd->error >= SCG_FATAL) /* nicht selektierbar */
return 0;
if (scg_sense_key(scgp) == SC_UNIT_ATTENTION) {
if (test_unit_ready(scgp) >= 0) /* alles OK */
return 1;
}
if ((scg_cmd_status(scgp) & ST_BUSY) != 0) {
/* Busy/reservation_conflict */
uae_msleep (500);
if (test_unit_ready(scgp) >= 0) /* alles OK */
return 1;
}
if (scg_sense_key(scgp) == -1) { /* non extended Sense */
if (scg_sense_code(scgp) == 4) /* NOT_READY */
return 0;
return 1;
}
/* FALSE wenn NOT_READY */
return (scg_sense_key (scgp) != SC_NOT_READY);
}
static void print_product (const struct scsi_inquiry *ip)
{
write_log ("'%.8s' ", ip->vendor_info);
write_log ("'%.16s' ", ip->prod_ident);
write_log ("'%.4s' ", ip->prod_revision);
if (ip->type == INQ_ROMD)
write_log ("CD-ROM");
else if (ip->type == INQ_DASD)
write_log ("Disk");
}
/* get integer value from env or return default value, if unset */
static int getenvint (const char *varname, int def)
{
const char *val = getenv (varname);
return val ? atoi (val) : def;
}
static SCSI *openscsi (int scsibus, int target, int lun)
{
SCSI *scgp = scg_smalloc ();
if (scgp) {
char *device;
scgp->debug = getenvint ("UAE_SCSI_DEBUG", 0);
scgp->kdebug = getenvint ("UAE_SCSI_KDEBUG", 0);
scgp->silent = getenvint ("UAE_SCSI_SILENT", 1);
scgp->verbose = getenvint ("UAE_SCSI_VERBOSE", 0);
device = getenv ("UAE_SCSI_DEVICE");
if (!device || (strlen(device) == 0))
device = currprefs.scsi_device;
write_log ("SCSIDEV: Device '%s'\n", device);
scg_settarget (scgp, scsibus, target, lun);
scg_settimeout (scgp, 80*60);
if (scg__open (scgp, device) <= 0) {
if (scgp->errstr)
write_log ("SCSIDEV: Failed to open '%s': %s\n",
device, scgp->errstr);
scg_sfree (scgp);
scgp = 0;
}
}
return scgp;
}
static void closescsi (SCSI *scgp)
{
scg__close (scgp);
scg_sfree (scgp);
}
/********************* start of our own code ************************/
static uae_u8 scsibuf [DEVICE_SCSI_BUFSIZE];
static int execscsicmd (int unitnum, const uae_u8 *data, int len, uae_u8 *inbuf,
int inlen)
{
int sactual = 0;
struct scsidevdata *sdd = &drives[unitnum];
SCSI *scgp = sdd->scgp;
struct scg_cmd *scmd;
scmd = scgp->scmd;
DEBUG_LOG ("SCSIDEV: execscicmd data=%08lx len=%d, inbuf=%08lx"\
" inlen=%d\n", data, len, inbuf, inlen);
uae_sem_wait (&scgp_sem);
memset (scmd, 0, sizeof (*scmd));
scmd->timeout = 80 * 60;
if (inbuf) {
scmd->addr = (caddr_t) inbuf;
scmd->size = inlen;
scmd->flags = SCG_RECV_DATA;
memset (inbuf, 0, inlen);
} else {
scmd->flags = SCG_DISRE_ENA;
}
scmd->cdb_len = len;
memcpy (&scmd->cdb, data, len);
scmd->target = sdd->target;
scmd->sense_len = -1;
scmd->sense_count = 0;
*(uae_u8 *)&scmd->scb = 0;
scg_settarget (scgp, sdd->bus, sdd->target, sdd->lun);
scgp->cmdname = "???";
scgp->curcmdname = "???";
DEBUG_LOG ("SCSIDEV: sending command: 0x%2x\n", scmd->cdb.g0_cdb.cmd);
gui_cd_led (1);
scg_cmd (scgp);
uae_sem_post (&scgp_sem);
DEBUG_LOG ("SCSIDEV: result: %d %d\n", scmd->error, scmd->ux_errno);
return scmd->size;
}
static int execscsicmd_direct (int unitnum, uaecptr acmd)
{
int sactual = 0;
struct scsidevdata *sdd = &drives[unitnum];
SCSI *scgp = sdd->scgp;
struct scg_cmd *scmd = scgp->scmd;
uaecptr scsi_data = get_long (acmd + 0);
uae_u32 scsi_len = get_long (acmd + 4);
uaecptr scsi_cmd = get_long (acmd + 12);
int scsi_cmd_len = get_word (acmd + 16);
int scsi_cmd_len_orig = scsi_cmd_len;
uae_u8 scsi_flags = get_byte (acmd + 20);
uaecptr scsi_sense = get_long (acmd + 22);
uae_u16 scsi_sense_len = get_word (acmd + 26);
int io_error = 0;
int parm;
addrbank *bank_data = &get_mem_bank (scsi_data);
addrbank *bank_cmd = &get_mem_bank (scsi_cmd);
uae_u8 *scsi_datap;
uae_u8 *scsi_datap_org;
DEBUG_LOG ("SCSIDEV: unit=%d: execscsicmd_direct\n", unitnum);
/* do transfer directly to and from Amiga memory */
if (!bank_data || !bank_data->check (scsi_data, scsi_len))
return -5; /* IOERR_BADADDRESS */
uae_sem_wait (&scgp_sem);
memset (scmd, 0, sizeof (*scmd));
/* the Amiga does not tell us how long the timeout shall be, so make it
* _very_ long (specified in seconds) */
scmd->timeout = 80 * 60;
scsi_datap = scsi_datap_org = scsi_len
? bank_data->xlateaddr (scsi_data) : 0;
scmd->size = scsi_len;
scmd->flags = (scsi_flags & 1) ? SCG_RECV_DATA : SCG_DISRE_ENA;
memcpy (&scmd->cdb, bank_cmd->xlateaddr (scsi_cmd), scsi_cmd_len);
scmd->target = sdd->target;
scmd->sense_len = (scsi_flags & 4) ? 4 : /* SCSIF_OLDAUTOSENSE */
(scsi_flags & 2) ? scsi_sense_len : /* SCSIF_AUTOSENSE */
-1;
scmd->sense_count = 0;
*(uae_u8 *)&scmd->scb = 0;
if (sdd->isatapi)
scsi_atapi_fixup_pre (scmd->cdb.cmd_cdb, &scsi_cmd_len, &scsi_datap,
&scsi_len, &parm);
scmd->addr = (caddr_t)scsi_datap;
scmd->cdb_len = scsi_cmd_len;
scg_settarget (scgp, sdd->bus, sdd->target, sdd->lun);
scgp->cmdname = "???";
scgp->curcmdname = "???";
DEBUG_LOG ("SCSIDEV: sending command: 0x%2x\n", scmd->cdb.g0_cdb.cmd);
scg_cmd (scgp);
DEBUG_LOG ("SCSIDEV: result: %d %d %s\n", scmd->error, scmd->ux_errno,\
scgp->errstr);
gui_cd_led (1);
put_word (acmd + 18, scmd->error == SCG_FATAL
? 0 : scsi_cmd_len); /* fake scsi_CmdActual */
put_byte (acmd + 21, *(uae_u8 *)&scmd->scb); /* scsi_Status */
if (*(uae_u8 *)&scmd->scb) {
io_error = 45; /* HFERR_BadStatus */
/* copy sense? */
for (sactual = 0;
scsi_sense && sactual < scsi_sense_len && sactual < scmd->sense_count;
sactual++) {
put_byte (scsi_sense + sactual, scmd->u_sense.cmd_sense[sactual]);
}
put_long (acmd + 8, 0); /* scsi_Actual */
} else {
int i;
for (i = 0; i < scsi_sense_len; i++)
put_byte (scsi_sense + i, 0);
sactual = 0;
if (scmd->error != SCG_NO_ERROR || scmd->ux_errno != 0) {
/* We might have been limited by the hosts DMA limits,
which is usually indicated by ENOMEM */
if (scsi_len > (unsigned int)sdd->max_dma && scmd->ux_errno == ENOMEM)
io_error = (uae_u8)-4; /* IOERR_BADLENGTH */
else {
io_error = 20; /* io_Error, but not specified */
put_long (acmd + 8, 0); /* scsi_Actual */
}
} else {
scsi_len = scmd->size;
if (sdd->isatapi)
scsi_atapi_fixup_post (scmd->cdb.cmd_cdb, scsi_cmd_len,
scsi_datap_org, scsi_datap,
&scsi_len, parm);
io_error = 0;
put_long (acmd + 8, scsi_len); /* scsi_Actual */
}
}
put_word (acmd + 28, sactual);
uae_sem_post (&scgp_sem);
if (scsi_datap != scsi_datap_org)
free (scsi_datap);
return io_error;
}
static const uae_u8 *execscsicmd_out (int unitnum, const uae_u8 *data, int len)
{
DEBUG_LOG ("SCSIDEV: unit=%d: execscsicmd_out\n", unitnum);
if (execscsicmd (unitnum, data, len, 0, 0) < 0)
return 0;
return data;
}
static const uae_u8 *execscsicmd_in (int unitnum, const uae_u8 *data, int len, int *outlen)
{
int v;
DEBUG_LOG ("SCSIDEV: unit=%d: execscsicmd_in\n", unitnum);
v = execscsicmd (unitnum, data, len, scsibuf, DEVICE_SCSI_BUFSIZE);
if (v < 0)
return 0;
if (v == 0)
return 0;
if (outlen)
*outlen = v;
return scsibuf;
}
/*
* Scan SCSI busses to detect any devices
* that we want to supply to the Amgia.
*
* Based on code from cdrecord
*/
static int scanscsi (SCSI *scgp)
{
int bus;
int tgt;
int lun = 0;
int initiator;
int have_tgt;
int n;
scgp->silent++;
for (bus = 0; bus < 16; bus++) {
scg_settarget (scgp, bus, 0, 0);
if (!scg_havebus (scgp, bus))
continue;
initiator = scg_initiator_id (scgp);
write_log ("scsibus%d:\n", bus);
for (tgt = 0; tgt < 16; tgt++) {
n = bus * 100 + tgt;
scg_settarget (scgp, bus, tgt, lun);
have_tgt = unit_ready (scgp) || scgp->scmd->error != SCG_FATAL;
if (!have_tgt && tgt > 7) {
if (scgp->scmd->ux_errno == EINVAL)
break;
continue;
}
write_log (" %d,%d,%d %d ", bus, tgt, lun, n);
if (tgt == initiator) {
write_log ("HOST ADAPTOR\n");
continue;
}
if (!have_tgt) {
/* Hack: fd -> -2 means no access */
write_log( "%c\n", scgp->fd == -2 ? '?':'*');
continue;
}
if ((scgp->scmd->error < SCG_FATAL)
|| (scgp->scmd->scb.chk && scgp->scmd->sense_count > 0)) {
struct scsi_inquiry *inq = scgp->inq;
inquiry (scgp, inq, sizeof (*inq));
print_product (inq);
/* Just CD/DVD drives for now */
if (inq->type == INQ_ROMD)
add_drive (scgp);
}
write_log ("\n");
}
}
scgp->silent--;
return 0;
}
static int open_scsi_bus (int flags)
{
int result = 0;
int debug, verbose;
SCSI *scgp_scan;
char *device;
char errstr[128];
static int init = 0;
DEBUG_LOG ("SCSIDEV: open_scsi_bus\n");
if (!init) {
init = 1;
uae_sem_init (&scgp_sem, 0, 1);
/* TODO: replace global lock with per-device locks */
}
debug = getenvint ("UAE_SCSI_DEBUG", 0);
verbose = getenvint ("UAE_SCSI_VERBOSE", 0);
device = getenv ("UAE_SCSI_DEVICE");
if (!device || (strlen (device) == 0))
device = currprefs.scsi_device;
if ((scgp_scan = scg_open (device, errstr, sizeof (errstr),
debug, verbose)) != (SCSI *)0) {
scanscsi (scgp_scan);
result = 1;
scg_close (scgp_scan);
} else {
write_log ("SCSIDEV: can't open bus: %s\n", errstr);
}
write_log ("SCSIDEV: %d devices found\n", total_drives);
return result;
}
static void close_scsi_bus (void)
{
int i;
DEBUG_LOG ("SCSIDEV: close_scsi_bus\n");
for (i = 0; i < total_drives; i++) {
closescsi (drives[i].scgp);
drives[i].scgp = 0;
}
}
static int open_scsi_device (int unitnum)
{
int result = 0;
DEBUG_LOG ("SCSIDEV: unit=%d: open_scsi_device\n", unitnum);
if (unitnum < total_drives) {
struct scsidevdata *sdd = &drives[unitnum];
if (!sdd->scgp) {
if ((sdd->scgp = openscsi (sdd->bus, sdd->target, sdd->lun)) != 0)
result = 1;
} else
/* already open */
result = 1;
}
return result;
}
static void close_scsi_device (int unitnum)
{
DEBUG_LOG ("SCSIDEV: unit=%d: close_scsi_device\n", unitnum);
/* do nothing - leave devices open until the bus is closed */
}
static int media_check (SCSI *scgp)
{
int media = 0;
uae_sem_wait (&scgp_sem);
if (test_unit_ready (scgp) >= 0)
media = 1;
uae_sem_post (&scgp_sem);
DEBUG_LOG ("SCSIDEV: media check :%d\n", media);
return media;
}
static struct device_info *info_device (int unitnum, struct device_info *di)
{
DEBUG_LOG ("SCSIDEV: unit=%d: info_device\n", unitnum);
if (unitnum < total_drives) {
struct scsidevdata *sdd = &drives[unitnum];
di->bus = 0;
di->target = unitnum;
di->lun = 0;
di->media_inserted = media_check (sdd->scgp);
di->write_protected = 1;
di->bytespersector = 2048;
di->cylinders = 1;
di->type = INQ_ROMD; /* We only support CD/DVD drives for now */
di->id = unitnum + 1;
/* TODO: Create a more informative device label */
sprintf (di->label, "(%d,%d,%d)", sdd->bus, sdd->target, sdd->lun);
} else
di = 0;
return di;
}
static int check_isatapi (int unitnum)
{
return drives[unitnum].isatapi;
}
struct device_functions devicefunc_scsi_libscg = {
open_scsi_bus,
close_scsi_bus,
open_scsi_device,
close_scsi_device,
info_device,
execscsicmd_out,
execscsicmd_in,
execscsicmd_direct,
0, 0, 0, 0, 0, 0, 0,
check_isatapi,
0, 0
};

388
src/blkdev.c Normal file
View File

@ -0,0 +1,388 @@
/*
* UAE - The Un*x Amiga Emulator
*
* lowlevel device glue
*
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "memory.h"
#include "blkdev.h"
static struct device_functions *device_func[2];
static int have_ioctl;
#ifdef WIN32
#include "od-win32/win32.h"
extern struct device_functions devicefunc_win32_aspi;
extern struct device_functions devicefunc_win32_spti;
extern struct device_functions devicefunc_win32_ioctl;
static void install_driver (int flags)
{
device_func[DF_SCSI] = &devicefunc_win32_aspi;
#ifdef WINDDK
if (os_winnt && os_winnt_admin) {
device_func[DF_IOCTL] = &devicefunc_win32_ioctl;
device_func[DF_SCSI] = &devicefunc_win32_spti;
}
if (currprefs.win32_aspi) {
device_func[DF_SCSI] = &devicefunc_win32_aspi;
device_func[DF_IOCTL] = 0;
}
#endif
}
#else
# ifdef TARGET_AMIGAOS
extern struct device_functions devicefunc_scsi_amiga;
static void install_driver (int flags)
{
device_func[DF_SCSI] = &devicefunc_scsi_amiga;
device_func[DF_IOCTL] = 0;
}
# else
# ifdef SCSIEMU_LINUX_IOCTL
extern struct device_functions devicefunc_scsi_linux_ioctl;
static void install_driver (int flags)
{
device_func[DF_SCSI] = &devicefunc_scsi_linux_ioctl;
device_func[DF_IOCTL] = 0;
}
# else
extern struct device_functions devicefunc_scsi_libscg;
static void install_driver (int flags)
{
device_func[DF_SCSI] = &devicefunc_scsi_libscg;
device_func[DF_IOCTL] = 0;
}
# endif
# endif
#endif
int sys_command_open (int mode, int unitnum)
{
if (mode == DF_SCSI || !have_ioctl)
return device_func[DF_SCSI]->opendev (unitnum);
else
return device_func[DF_IOCTL]->opendev (unitnum);
}
void sys_command_close (int mode, int unitnum)
{
if (mode == DF_SCSI || !have_ioctl)
device_func[DF_SCSI]->closedev (unitnum);
else
device_func[DF_IOCTL]->closedev (unitnum);
}
int sys_command_open_thread (int mode, int unitnum)
{
int result = 0;
if (mode == DF_SCSI || !have_ioctl) {
if (device_func[DF_SCSI]->opendevthread)
result = device_func[DF_SCSI]->opendevthread (unitnum);
} else {
if (device_func[DF_IOCTL]->opendevthread)
result= device_func[DF_IOCTL]->opendevthread (unitnum);
}
return result;
}
void sys_command_close_thread (int mode, int unitnum)
{
if (mode == DF_SCSI || !have_ioctl) {
if (device_func[DF_SCSI]->closedevthread)
device_func[DF_SCSI]->closedevthread (unitnum);
} else {
if (device_func[DF_IOCTL]->closedevthread)
device_func[DF_IOCTL]->closedevthread (unitnum);
}
}
int device_func_init (int flags)
{
static int initialized;
int support_scsi = 0, support_ioctl = 0;
int oflags = (flags & DEVICE_TYPE_SCSI) ? 0 : (1 << INQ_ROMD);
if (initialized)
return initialized;
install_driver (flags);
if (device_func[DF_IOCTL])
have_ioctl = 1;
else
have_ioctl = 0;
support_scsi = device_func[DF_SCSI]->openbus (oflags) ? 1 : 0;
if (have_ioctl)
support_ioctl = device_func[DF_IOCTL]->openbus (1 << INQ_ROMD) ? 1 : 0;
initialized = 1;
write_log ("support_scsi = %d support_ioctl = %d\n", support_scsi, support_ioctl);
return (support_scsi ? (1 << DF_SCSI) : 0) | (support_ioctl ? (1 << DF_IOCTL) : 0);
}
static int audiostatus (int unitnum)
{
static const uae_u8 cmd[10] = {
0x42, 2, 0x40, 1, 0, 0, 0, DEVICE_SCSI_BUFSIZE >> 8, DEVICE_SCSI_BUFSIZE & 0xff, 0
};
const uae_u8 *p = device_func[DF_SCSI]->exec_in (unitnum, cmd, sizeof (cmd), 0);
if (!p)
return 0;
return p[1];
}
/* pause/unpause CD audio */
void sys_command_pause (int mode, int unitnum, int paused)
{
if (mode == DF_SCSI || !have_ioctl) {
int as = audiostatus (unitnum);
if ((paused && as == 0x11) && (!paused && as == 0x12)) {
uae_u8 cmd[10] = {
0x4b, 0, 0, 0, 0, 0, 0, 0, paused ? 0 :1, 0
};
device_func[DF_SCSI]->exec_out (unitnum, cmd, sizeof (cmd));
}
return;
}
device_func[DF_IOCTL]->pause (unitnum, paused);
}
/* stop CD audio */
void sys_command_stop (int mode, int unitnum)
{
if (mode == DF_SCSI || !have_ioctl) {
int as = audiostatus (unitnum);
if (as == 0x11) {
static const uae_u8 cmd[6] = {
0x4e, 0, 0, 0, 0, 0
};
device_func[DF_SCSI]->exec_out (unitnum, cmd, sizeof (cmd));
}
return;
}
device_func[DF_IOCTL]->stop (unitnum);
}
/* play CD audio */
int sys_command_play (int mode, int unitnum, uae_u32 startmsf, uae_u32 endmsf, int scan)
{
if (mode == DF_SCSI || !have_ioctl) {
uae_u8 cmd[12] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#if 0
if (scan) {
cmd[0] = 0xba;
cmd[1] = scan < 0 ? 0x10 : 0x0;
cmd[3] = (uae_u8)(startmsf >> 16);
cmd[4] = (uae_u8)(startmsf >> 8);
cmd[5] = (uae_u8)(startmsf >> 0);
cmd[9] = 0x40;
} else {
#endif
cmd[0] = 0x47;
cmd[3] = (uae_u8)(startmsf >> 16);
cmd[4] = (uae_u8)(startmsf >> 8);
cmd[5] = (uae_u8)(startmsf >> 0);
cmd[6] = (uae_u8)(endmsf >> 16);
cmd[7] = (uae_u8)(endmsf >> 8);
cmd[8] = (uae_u8)(endmsf >> 0);
#if 0
}
#endif
return device_func[DF_SCSI]->exec_out (unitnum, cmd, sizeof (cmd)) == 0 ? 0 : 1;
}
return device_func[DF_IOCTL]->play (unitnum, startmsf, endmsf, scan);
}
/* read qcode */
const uae_u8 *sys_command_qcode (int mode, int unitnum)
{
if (mode == DF_SCSI || !have_ioctl) {
static const uae_u8 cmd[10] = {
0x42, 2, 0x40, 1, 0, 0, 0, DEVICE_SCSI_BUFSIZE >> 8, DEVICE_SCSI_BUFSIZE & 0xff, 0
};
return device_func[DF_SCSI]->exec_in (unitnum, cmd, sizeof (cmd), 0);
}
return device_func[DF_IOCTL]->qcode (unitnum);
};
/* read table of contents */
const uae_u8 *sys_command_toc (int mode, int unitnum)
{
if (mode == DF_SCSI || !have_ioctl) {
static const uae_u8 cmd[10] = {
0x43, 0, 2, 0, 0, 0, 1, DEVICE_SCSI_BUFSIZE >> 8, DEVICE_SCSI_BUFSIZE & 0xFF, 0
};
return device_func[DF_SCSI]->exec_in (unitnum, cmd, sizeof(cmd), 0);
}
return device_func[DF_IOCTL]->toc (unitnum);
}
/* read one sector */
const uae_u8 *sys_command_read (int mode, int unitnum, int offset)
{
if (mode == DF_SCSI || !have_ioctl) {
uae_u8 cmd[12] = {
0xbe, 0, 0, 0, 0, 0, 0, 0, 1, 0x10, 0, 0
};
cmd[3] = (uae_u8)(offset >> 16);
cmd[4] = (uae_u8)(offset >> 8);
cmd[5] = (uae_u8)(offset >> 0);
return device_func[DF_SCSI]->exec_in (unitnum, cmd, sizeof (cmd), 0);
}
return device_func[DF_IOCTL]->read (unitnum, offset);
}
struct device_info *sys_command_info (int mode, int unitnum, struct device_info *di)
{
if (mode == DF_SCSI || !have_ioctl)
return device_func[DF_SCSI]->info (unitnum, di);
else
return device_func[DF_IOCTL]->info (unitnum, di);
}
#define MODE_SELECT_6 0x15
#define MODE_SENSE_6 0x1a
#define MODE_SELECT_10 0x55
#define MODE_SENSE_10 0x5a
void scsi_atapi_fixup_pre (uae_u8 *scsi_cmd, int *len, uae_u8 **datap, unsigned int *datalenp, int *parm)
{
uae_u8 cmd, *p, *data = *datap;
unsigned int l, datalen = *datalenp;
*parm = 0;
cmd = scsi_cmd[0];
if (cmd != MODE_SELECT_6 && cmd != MODE_SENSE_6)
return;
l = scsi_cmd[4];
if (l > 4)
l += 4;
scsi_cmd[7] = l >> 8;
scsi_cmd[8] = l;
if (cmd == MODE_SELECT_6) {
scsi_cmd[0] = MODE_SELECT_10;
scsi_cmd[9] = scsi_cmd[5];
scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[4] = scsi_cmd[5] = scsi_cmd[6] = 0;
*len = 10;
p = xmalloc (8 + datalen + 4);
if (datalen > 4)
memcpy (p + 8, data + 4, datalen - 4);
p[0] = 0;
p[1] = data[0];
p[2] = data[1];
p[3] = data[2];
p[4] = p[5] = p[6] = 0;
p[7] = data[3];
if (l > 8)
datalen += 4;
*parm = MODE_SELECT_10;
*datap = p;
} else {
scsi_cmd[0] = MODE_SENSE_10;
scsi_cmd[9] = scsi_cmd[5];
scsi_cmd[3] = scsi_cmd[4] = scsi_cmd[5] = scsi_cmd[6] = 0;
if (l > 8)
datalen += 4;
*datap = xmalloc (datalen);
*len = 10;
*parm = MODE_SENSE_10;
}
*datalenp = datalen;
}
void scsi_atapi_fixup_post (uae_u8 *scsi_cmd, int len, uae_u8 *olddata, uae_u8 *data, unsigned int *datalenp, int parm)
{
unsigned int datalen = *datalenp;
if (!data || !datalen)
return;
if (parm == MODE_SENSE_10) {
olddata[0] = data[1];
olddata[1] = data[2];
olddata[2] = data[3];
olddata[3] = data[7];
datalen -= 4;
if (datalen > 4)
memcpy (olddata + 4, data + 8, datalen - 4);
*datalenp = datalen;
}
}
static void scsi_atapi_fixup_inquiry (uaecptr req)
{
uaecptr scsi_data = get_long (req + 0);
uae_u32 scsi_len = get_long (req + 4);
uaecptr scsi_cmd = get_long (req + 12);
uae_u8 cmd;
cmd = get_byte (scsi_cmd);
/* CDROM INQUIRY: most Amiga programs expect ANSI version == 2
* (ATAPI normally responds with zero)
*/
if (cmd == 0x12 && scsi_len > 2 && scsi_data) {
uae_u8 per = get_byte (scsi_data + 0);
uae_u8 b = get_byte (scsi_data + 2);
/* CDROM and ANSI version == 0 ? */
if ((per & 31) == 5 && (b & 7) == 0) {
b |= 2;
put_byte (scsi_data + 2, b);
}
}
}
int sys_command_scsi_direct (int unitnum, uaecptr request)
{
int ret = device_func[DF_SCSI]->exec_direct (unitnum, request);
if (!ret && device_func[DF_SCSI]->isatapi(unitnum))
scsi_atapi_fixup_inquiry (request);
return ret;
}
void scsi_log_before (const uae_u8 *cdb, int cdblen, const uae_u8 *data, int datalen)
{
int i;
for (i = 0; i < cdblen; i++) {
write_log("%s%02.2X", i > 0 ? "." : "", cdb[i]);
}
write_log("\n");
if (data) {
write_log ("DATAOUT: %d\n", datalen);
for (i = 0; i < datalen && i < 100; i++)
write_log("%s%02.2X", i > 0 ? "." : "", data[i]);
if (datalen > 0)
write_log("\n");
}
}
void scsi_log_after (const uae_u8 *data, int datalen, const uae_u8 *sense, int senselen)
{
int i;
if (data) {
write_log ("DATAIN: %d\n", datalen);
for (i = 0; i < datalen && i < 100; i++)
write_log("%s%02.2X", i > 0 ? "." : "", data[i]);
if (datalen > 0)
write_log("\n");
}
if (senselen > 0) {
write_log("SENSE: ");
for (i = 0; i < senselen && i < 32; i++) {
write_log("%s%02.2X", i > 0 ? "." : "", sense[i]);
}
write_log("\n");
}
}

1716
src/bsdsocket-posix-new.c Normal file

File diff suppressed because it is too large Load Diff

1481
src/bsdsocket.c Normal file

File diff suppressed because it is too large Load Diff

249
src/build68k.c Normal file
View File

@ -0,0 +1,249 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Read 68000 CPU specs from file "table68k" and build table68k.c
*
* Copyright 1995,1996 Bernd Schmidt
*/
#include "sysconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "uae_string.h"
#include "uae_types.h"
#include <ctype.h>
#include "readcpu.h"
static FILE *tablef;
static int nextch = 0;
static void getnextch(void)
{
do {
nextch = fgetc(tablef);
if (nextch == '%') {
do {
nextch = fgetc(tablef);
} while (nextch != EOF && nextch != '\n');
}
} while (nextch != EOF && isspace(nextch));
}
static int nextchtohex(void)
{
switch (isupper (nextch) ? tolower (nextch) : nextch) {
case '0': return 0;
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
case 'a': return 10;
case 'b': return 11;
case 'c': return 12;
case 'd': return 13;
case 'e': return 14;
case 'f': return 15;
default: abort();
}
}
int main(int argc, char **argv)
{
int no_insns = 0;
printf ("#include \"sysconfig.h\"\n");
printf ("#include \"uae_types.h\"\n");
printf ("#include \"readcpu.h\"\n");
printf ("struct instr_def defs68k[] = {\n");
#if 0
tablef = fopen("table68k","r");
if (tablef == NULL) {
fprintf(stderr, "table68k not found\n");
exit(1);
}
#else
tablef = stdin;
#endif
getnextch();
while (nextch != EOF) {
int cpulevel, plevel, sduse;
int i;
char patbits[16];
char opcstr[256];
int bitpos[16];
int flagset[5], flaguse[5];
unsigned int bitmask,bitpattern;
int n_variable;
n_variable = 0;
bitmask = bitpattern = 0;
memset (bitpos, 0, sizeof(bitpos));
for(i=0; i<16; i++) {
int currbit;
bitmask <<= 1;
bitpattern <<= 1;
switch (nextch) {
case '0': currbit = bit0; bitmask |= 1; break;
case '1': currbit = bit1; bitmask |= 1; bitpattern |= 1; break;
case 'c': currbit = bitc; break;
case 'C': currbit = bitC; break;
case 'f': currbit = bitf; break;
case 'i': currbit = biti; break;
case 'I': currbit = bitI; break;
case 'j': currbit = bitj; break;
case 'J': currbit = bitJ; break;
case 'k': currbit = bitk; break;
case 'K': currbit = bitK; break;
case 's': currbit = bits; break;
case 'S': currbit = bitS; break;
case 'd': currbit = bitd; break;
case 'D': currbit = bitD; break;
case 'r': currbit = bitr; break;
case 'R': currbit = bitR; break;
case 'z': currbit = bitz; break;
case 'p': currbit = bitp; break;
default: abort();
}
if (!(bitmask & 1)) {
bitpos[n_variable] = currbit;
n_variable++;
}
if (nextch == '0' || nextch == '1')
bitmask |= 1;
if (nextch == '1')
bitpattern |= 1;
patbits[i] = nextch;
getnextch();
}
while (isspace(nextch) || nextch == ':') /* Get CPU and privilege level */
getnextch();
switch (nextch) {
case '0': cpulevel = 0; break;
case '1': cpulevel = 1; break;
case '2': cpulevel = 2; break;
case '3': cpulevel = 3; break;
case '4': cpulevel = 4; break;
case '5': cpulevel = 5; break;
case '6': cpulevel = 6; break;
case '7': cpulevel = 7; break;
default: abort();
}
getnextch();
switch (nextch) {
case '0': plevel = 0; break;
case '1': plevel = 1; break;
case '2': plevel = 2; break;
case '3': plevel = 3; break;
default: abort();
}
getnextch();
while (isspace(nextch)) /* Get flag set information */
getnextch();
if (nextch != ':')
abort();
for(i = 0; i < 5; i++) {
getnextch();
switch(nextch){
case '-': flagset[i] = fa_unset; break;
case '/': flagset[i] = fa_isjmp; break;
case '+': flagset[i] = fa_isbranch; break;
case '0': flagset[i] = fa_zero; break;
case '1': flagset[i] = fa_one; break;
case 'x': flagset[i] = fa_dontcare; break;
case '?': flagset[i] = fa_unknown; break;
default: flagset[i] = fa_set; break;
}
}
getnextch();
while (isspace(nextch))
getnextch();
if (nextch != ':') /* Get flag used information */
abort();
for(i = 0; i < 5; i++) {
getnextch();
switch(nextch){
case '-': flaguse[i] = fu_unused; break;
case '/': flaguse[i] = fu_isjmp; break;
case '+': flaguse[i] = fu_maybecc; break;
case '?': flaguse[i] = fu_unknown; break;
default: flaguse[i] = fu_used; break;
}
}
getnextch();
while (isspace(nextch))
getnextch();
if (nextch != ':') /* Get source/dest usage information */
abort();
getnextch();
sduse = nextchtohex() << 4;
getnextch();
sduse |= nextchtohex();
getnextch();
while (isspace(nextch))
getnextch();
if (nextch != ':')
abort();
fgets(opcstr, 250, tablef);
getnextch();
{
int j;
/* Remove superfluous spaces from the string */
char *opstrp = opcstr, *osendp;
int slen = 0;
while (isspace(*opstrp))
opstrp++;
osendp = opstrp;
while (*osendp) {
if (!isspace (*osendp))
slen = osendp - opstrp + 1;
osendp++;
}
opstrp[slen] = 0;
if (no_insns > 0)
printf(",\n");
no_insns++;
printf("{ %d, %d, {", bitpattern, n_variable);
for (j = 0; j < 16; j++) {
printf("%d", bitpos[j]);
if (j < 15)
printf(",");
}
printf ("}, %d, %d, %d, { ", bitmask, cpulevel, plevel);
for(i = 0; i < 5; i++) {
printf("{ %d, %d }%c ", flaguse[i], flagset[i], i == 4 ? ' ' : ',');
}
printf("}, %d, \"%s\"}", sduse, opstrp);
}
}
printf("};\nint n_defs68k = %d;\n", no_insns);
return 0;
}

5
src/caps/Makefile.am Normal file
View File

@ -0,0 +1,5 @@
INCLUDES = -I$(top_srcdir)/src/include -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_srcdir)
noinst_LIBRARIES = libcaps.a
libcaps_a_SOURCES = caps.c

443
src/caps/Makefile.in Normal file
View File

@ -0,0 +1,443 @@
# Makefile.in generated by automake 1.7.9 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ASMOBJS = @ASMOBJS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BSDSOCKOBJS = @BSDSOCKOBJS@
BUILD_MACOSX_BUNDLE_FALSE = @BUILD_MACOSX_BUNDLE_FALSE@
BUILD_MACOSX_BUNDLE_TRUE = @BUILD_MACOSX_BUNDLE_TRUE@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CDOBJS = @CDOBJS@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPUOBJS = @CPUOBJS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUGOBJS = @DEBUGOBJS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRAOBJS = @EXTRAOBJS@
FILEPRG = @FILEPRG@
FILESYSOBJS = @FILESYSOBJS@
GENCPUOPTS = @GENCPUOPTS@
GFX_DEP = @GFX_DEP@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
GUI_DEP = @GUI_DEP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JITOBJS = @JITOBJS@
JOY_DEP = @JOY_DEP@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MACHDEP = @MACHDEP@
MAKEDEPPRG = @MAKEDEPPRG@
MAKEINFO = @MAKEINFO@
MATHLIB = @MATHLIB@
NO_SCHED_CFLAGS = @NO_SCHED_CFLAGS@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJC_LDFLAGS = @OBJC_LDFLAGS@
OBJEXT = @OBJEXT@
OSDEP = @OSDEP@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RCLPRG = @RCLPRG@
RESOBJS = @RESOBJS@
SCSIOBJS = @SCSIOBJS@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SND_DEP = @SND_DEP@
STRIP = @STRIP@
TARGET = @TARGET@
TARGET_BEOS_FALSE = @TARGET_BEOS_FALSE@
TARGET_BEOS_TRUE = @TARGET_BEOS_TRUE@
TARGET_BIGENDIAN_FALSE = @TARGET_BIGENDIAN_FALSE@
TARGET_BIGENDIAN_TRUE = @TARGET_BIGENDIAN_TRUE@
TARGET_WIN32_FALSE = @TARGET_WIN32_FALSE@
TARGET_WIN32_TRUE = @TARGET_WIN32_TRUE@
THREADDEP = @THREADDEP@
UAE_RSRCFILE = @UAE_RSRCFILE@
VERSION = @VERSION@
WRCPRG = @WRCPRG@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_OBJC = @ac_ct_OBJC@
ac_cv_c_inline = @ac_cv_c_inline@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@
am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
INCLUDES = -I$(top_srcdir)/src/include -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_srcdir)
noinst_LIBRARIES = libcaps.a
libcaps_a_SOURCES = caps.c
subdir = src/caps
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/sysconfig.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
libcaps_a_AR = $(AR) cru
libcaps_a_LIBADD =
am_libcaps_a_OBJECTS = caps.$(OBJEXT)
libcaps_a_OBJECTS = $(am_libcaps_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/caps.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libcaps_a_SOURCES)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(libcaps_a_SOURCES)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign src/caps/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libcaps.a: $(libcaps_a_OBJECTS) $(libcaps_a_DEPENDENCIES)
-rm -f libcaps.a
$(libcaps_a_AR) libcaps.a $(libcaps_a_OBJECTS) $(libcaps_a_LIBADD)
$(RANLIB) libcaps.a
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/caps.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

548
src/caps/caps.c Normal file
View File

@ -0,0 +1,548 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Support for IPF/CAPS disk images
*
* Copyright 2004-2006 Richard Drummond
*
* Based on Win32 CAPS code by Toni Wilen
*/
#include "sysconfig.h"
#include "sysdeps.h"
#ifdef CAPS
#include <caps/capsimage.h>
#include "zfile.h"
#include "caps.h"
static CapsLong caps_cont[4]= {-1, -1, -1, -1};
static int caps_locked[4];
static int caps_flags = DI_LOCK_DENVAR|DI_LOCK_DENNOISE|DI_LOCK_NOISE|DI_LOCK_UPDATEFD|DI_LOCK_TYPE;
#define LIB_TYPE 1
#ifndef TARGET_AMIGAOS
/*
* Repository for function pointers to the CAPSLib routines
* which gets filled when we link at run-time
*
* We don't symbolically link on the Amiga, so don't need
* this there
*/
struct {
void *handle;
CapsLong (*CAPSInit)(void);
CapsLong (*CAPSExit)(void);
CapsLong (*CAPSAddImage)(void);
CapsLong (*CAPSRemImage)(CapsLong id);
CapsLong (*CAPSLockImage)(CapsLong id, char *name);
CapsLong (*CAPSLockImageMemory)(CapsLong id, CapsUByte *buffer, CapsULong length, CapsULong flag);
CapsLong (*CAPSUnlockImage)(CapsLong id);
CapsLong (*CAPSLoadImage)(CapsLong id, CapsULong flag);
CapsLong (*CAPSGetImageInfo)(struct CapsImageInfo *pi, CapsLong id);
CapsLong (*CAPSLockTrack)(struct CapsTrackInfo *pi, CapsLong id, CapsULong cylinder, CapsULong head, CapsULong flag);
CapsLong (*CAPSUnlockTrack)(CapsLong id, CapsULong cylinder, CapsULong head);
CapsLong (*CAPSUnlockAllTracks)(CapsLong id);
char *(*CAPSGetPlatformName)(CapsULong pid);
CapsLong (*CAPSGetVersionInfo)(struct CapsVersionInfo *pi, CapsULong flag);
} capslib;
#ifdef HAVE_DLOPEN
#include <dlfcn.h>
#define CAPSLIB_NAME "libcapsimage.so.2"
/*
* The Unix/dlopen method for loading and linking the CAPSLib plug-in
*/
static int load_capslib (void)
{
/* This could be done more elegantly ;-) */
if ((capslib.handle = dlopen(CAPSLIB_NAME, RTLD_LAZY))) {
capslib.CAPSInit = dlsym (capslib.handle, "CAPSInit"); if (dlerror () != 0) return 0;
capslib.CAPSExit = dlsym (capslib.handle, "CAPSExit"); if (dlerror () != 0) return 0;
capslib.CAPSAddImage = dlsym (capslib.handle, "CAPSAddImage"); if (dlerror () != 0) return 0;
capslib.CAPSRemImage = dlsym (capslib.handle, "CAPSRemImage"); if (dlerror () != 0) return 0;
capslib.CAPSLockImage = dlsym (capslib.handle, "CAPSLockImage"); if (dlerror () != 0) return 0;
capslib.CAPSLockImageMemory = dlsym (capslib.handle, "CAPSLockImageMemory"); if (dlerror () != 0) return 0;
capslib.CAPSUnlockImage = dlsym (capslib.handle, "CAPSUnlockImage"); if (dlerror () != 0) return 0;
capslib.CAPSLoadImage = dlsym (capslib.handle, "CAPSLoadImage"); if (dlerror () != 0) return 0;
capslib.CAPSGetImageInfo = dlsym (capslib.handle, "CAPSGetImageInfo"); if (dlerror () != 0) return 0;
capslib.CAPSLockTrack = dlsym (capslib.handle, "CAPSLockTrack"); if (dlerror () != 0) return 0;
capslib.CAPSUnlockTrack = dlsym (capslib.handle, "CAPSUnlockTrack"); if (dlerror () != 0) return 0;
capslib.CAPSUnlockAllTracks = dlsym (capslib.handle, "CAPSUnlockAllTracks"); if (dlerror () != 0) return 0;
capslib.CAPSGetPlatformName = dlsym (capslib.handle, "CAPSGetPlatformName"); if (dlerror () != 0) return 0;
capslib.CAPSGetVersionInfo = dlsym (capslib.handle, "CAPSGetVersionInfo"); if (dlerror () != 0) return 0;
if (capslib.CAPSInit() == imgeOk)
return 1;
}
write_log ("Unable to open " CAPSLIB_NAME "\n.");
return 0;
}
#endif // HAVE_DLOPEN
#else
#ifdef __amigaos4__
#define __USE_BASETYPE__
#include <exec/emulation.h>
#include <proto/exec.h>
static struct Device *CapsImageBase;
/* Emulation stubs for AmigaOS4. Ideally this should be in a separate
* link library (until a native CAPS plug-in becomes available), but I
* haven't been able to get that to work.
*
* This stuff is adapated from the machine-generated output from fdtrans.
*/
LONG CAPSInit (void)
{
struct Library *LibBase = (struct Library *)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -42, /* Hex: -0x2A */
ET_RegisterA6, LibBase,
TAG_DONE);
regs[14] = save_A6;
return retval;
}
LONG CAPSExit (void)
{
struct Library *LibBase = (struct Library *)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -48, /* Hex: -0x30 */
ET_RegisterA6, LibBase,
TAG_DONE);
regs[14] = save_A6;
return retval;
}
LONG CAPSAddImage (void)
{
struct Library *LibBase = (struct Library *)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -54, /* Hex: -0x36 */
ET_RegisterA6, LibBase,
TAG_DONE);
regs[14] = save_A6;
return retval;
}
LONG CAPSRemImage (LONG id)
{
struct Library *LibBase = (struct Library*) CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -60, /* Hex: -0x3C */
ET_RegisterD0, id,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[14] = save_A6;
return retval;
}
CapsLong CAPSLockImage (CapsLong id, char *name)
{
struct Library *LibBase = (struct Library*)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_a0 = regs[8];
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -66, /* Hex: -0x42 */
ET_RegisterD0, id,
ET_RegisterA0, name,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[8] = save_a0;
regs[14] = save_A6;
return retval;
}
LONG CAPSLockImageMemory (LONG id,
UBYTE * buffer,
ULONG length,
ULONG flag)
{
struct Library *LibBase = (struct Library*)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_a0 = regs[8];
ULONG save_d2 = regs[2];
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -72, /* Hex: -0x48 */
ET_RegisterD0, id,
ET_RegisterA0, buffer,
ET_RegisterD1, length,
ET_RegisterD2, flag,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[8] = save_a0;
regs[2] = save_d2;
regs[14] = save_A6;
return retval;
}
LONG CAPSUnlockImage (LONG id)
{
struct Library *LibBase = (struct Library*)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -78, /* Hex: -0x4E */
ET_RegisterD0, id,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[14] = save_A6;
return retval;
}
LONG CAPSLoadImage (LONG id, ULONG flag)
{
struct Library *LibBase = (struct Library *)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -84, /* Hex: -0x54 */
ET_RegisterD0, id,
ET_RegisterD1, flag,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[14] = save_A6;
return retval;
}
LONG CAPSGetImageInfo (struct CapsImageInfo * pi, LONG id)
{
struct Library *LibBase = (struct Library*)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_a0 = regs[8];
ULONG save_A6 = regs[14];
retval = (LONG)EmulateTags ((APTR)LibBase,
ET_Offset, -90, /* Hex: -0x5A */
ET_RegisterA0, pi,
ET_RegisterD0, id,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[8] = save_a0;
regs[14] = save_A6;
return retval;
}
LONG CAPSLockTrack (struct CapsTrackInfo * pi,
LONG id,
ULONG cylinder,
ULONG head,
ULONG flag)
{
struct Library *LibBase = (struct Library*)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_a0 = regs[8];
ULONG save_d2 = regs[2];
ULONG save_d3 = regs[3];
ULONG save_A6 = regs[14];
retval = (LONG) EmulateTags((APTR)LibBase,
ET_Offset, -96, /* Hex: -0x60 */
ET_RegisterA0, pi,
ET_RegisterD0, id,
ET_RegisterD1, cylinder,
ET_RegisterD2, head,
ET_RegisterD3, flag,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[8] = save_a0;
regs[2] = save_d2;
regs[3] = save_d3;
regs[14] = save_A6;
return retval;
}
LONG CAPSUnlockAllTracks (LONG id)
{
struct Library *LibBase = (struct Library*)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_A6 = regs[14];
retval = (LONG) EmulateTags ((APTR)LibBase,
ET_Offset, -108, /* Hex: -0x6C */
ET_RegisterD0, id,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[14] = save_A6;
return retval;
}
LONG CAPSGetVersionInfo (struct CapsVersionInfo *pi, CapsULong flag)
{
struct Library *LibBase = (struct Library*)CapsImageBase;
LONG retval;
ULONG *regs = (ULONG *)(SysBase->EmuWS);
ULONG save_a0 = regs[8];
ULONG save_A6 = regs[14];
retval = (LONG) EmulateTags ((APTR)LibBase,
ET_Offset, -120, /* Hex: -0x78 */
ET_RegisterA0, pi,
ET_RegisterD0, flag,
ET_RegisterA6, LibBase,
TAG_DONE);
regs[8] = save_a0;
regs[14] = save_A6;
return retval;
}
#endif
#ifdef TARGET_AMIGAOS
#if 0
/* proto file is broken in current CAPS API */
#include <proto/capsimage.h>
#else
#if defined __GNUC__ && !defined __amigaos4__
#include <inline/capsimage.h>
static struct Device *CapsImageBase;
#endif
#endif
#include <proto/exec.h>
static struct MsgPort *CAPS_MsgPort;
static struct IORequest *CAPS_IOReq;
static void unload_capslib (void)
{
CloseDevice (CAPS_IOReq);
DeleteIORequest (CAPS_IOReq);
DeleteMsgPort (CAPS_MsgPort);
}
static int load_capslib (void)
{
if ((CAPS_MsgPort = CreateMsgPort ())) {
if ((CAPS_IOReq = CreateIORequest (CAPS_MsgPort, sizeof(struct IORequest)))) {
if (!OpenDevice(CAPS_NAME, 0, CAPS_IOReq, 0)) {
CapsImageBase = CAPS_IOReq->io_Device;
if (CapsImageBase->dd_Library.lib_Version >= 2) {
if (CAPSInit () == imgeOk) {
atexit (unload_capslib);
return 1;
}
} else
write_log ("CAPS: Please install capsimage.device version 2 or newer.\n");
CloseDevice (CAPS_IOReq);
}
DeleteIORequest (CAPS_IOReq);
}
DeleteMsgPort (CAPS_MsgPort);
}
return 0;
}
#else
/*
* Sorry, we don't know how to load the CAPSLib plug-in
* on other systems yet . ..
*/
static int load_capslib (void)
{
return 0;
}
#endif
#endif
#ifndef TARGET_AMIGAOS
/*
* Some defines so that we don't care that CAPSLib
* isn't statically linked
*/
#define CAPSInit capslib.CAPSInit
#define CAPSExit capslib.CAPSExit
#define CAPSAddImage capslib.CAPSAddImage
#define CAPSRemImage capslib.CAPSRemImage
#define CAPSLockImage capslib.CAPSLockImage
#define CAPSLockImageMemory capslib.CAPSLockImageMemory
#define CAPSUnlockImage capslib.CAPSUnlockImage
#define CAPSLoadImage capslib.CAPSLoadImage
#define CAPSGetImageInfo capslib.CAPSGetImageInfo
#define CAPSLockTrack capslib.CAPSLockTrack
#define CAPSUnlockTrack capslib.CAPSUnlockTrack
#define CAPSUnlockAllTracks capslib.CAPSUnlockAllTracks
#define CAPSGetPlatformName capslib.CAPSGetPlatformName
#define CAPSGetVersionInfo capslib.CAPSGetVersionInfo
#endif
/*
* CAPS support proper starts here
*
* This is more or less a straight copy of Toni's Win32 code
*/
int caps_init (void)
{
static int init, noticed;
unsigned int i;
struct CapsVersionInfo cvi;
if (init)
return 1;
if (!load_capslib ()) {
write_log ("Failed to load CAPS plug-in.\n");
if (noticed)
return 0;
gui_message ("This disk image needs the C.A.P.S. plugin\n"
"which is available from\n"
"http//www.caps-project.org/download.shtml\n");
noticed = 1;
return 0;
}
init = 1;
cvi.type = LIB_TYPE;
CAPSGetVersionInfo (&cvi, 0);
write_log ("CAPS: library version %d.%d\n", cvi.release, cvi.revision);
for (i = 0; i < 4; i++)
caps_cont[i] = CAPSAddImage ();
return 1;
}
void caps_unloadimage (unsigned int drv)
{
if (!caps_locked[drv])
return;
CAPSUnlockAllTracks (caps_cont[drv]);
CAPSUnlockImage (caps_cont[drv]);
caps_locked[drv] = 0;
}
int caps_loadimage (struct zfile *zf, unsigned int drv, unsigned int *num_tracks)
{
struct CapsImageInfo ci;
int len, ret;
uae_u8 *buf;
char s1[100];
struct CapsDateTimeExt *cdt;
if (!caps_init ())
return 0;
caps_unloadimage (drv);
zfile_fseek (zf, 0, SEEK_END);
len = zfile_ftell (zf);
zfile_fseek (zf, 0, SEEK_SET);
buf = xmalloc (len);
if (!buf)
return 0;
if (zfile_fread (buf, len, 1, zf) == 0)
return 0;
ret = CAPSLockImageMemory (caps_cont[drv], buf, len, 0);
free (buf);
if (ret != imgeOk) {
free (buf);
return 0;
}
caps_locked[drv] = 1;
CAPSGetImageInfo (&ci, caps_cont[drv]);
*num_tracks = (ci.maxcylinder - ci.mincylinder + 1) * (ci.maxhead - ci.minhead + 1);
CAPSLoadImage (caps_cont[drv], caps_flags);
cdt = &ci.crdt;
sprintf (s1, "%d.%d.%d %d:%d:%d", cdt->day, cdt->month, cdt->year, cdt->hour, cdt->min, cdt->sec);
write_log ("CAPS: type:%d date:%s rel:%d rev:%d\n",
ci.type, s1, ci.release, ci.revision);
return 1;
}
int caps_loadrevolution (uae_u16 *mfmbuf, unsigned int drv, unsigned int track, unsigned int *tracklength)
{
unsigned int len, i;
uae_u16 *mfm;
struct CapsTrackInfoT1 ci;
ci.type = LIB_TYPE;
CAPSLockTrack ((struct CapsTrackInfo *)&ci, caps_cont[drv], track / 2, track & 1, caps_flags);
len = ci.tracklen;
*tracklength = len * 8;
mfm = mfmbuf;
for (i = 0; i < (len + 1) / 2; i++) {
uae_u8 *data = ci.trackbuf + i * 2;
*mfm++ = 256 * *data + *(data + 1);
}
return 1;
}
int caps_loadtrack (uae_u16 *mfmbuf, uae_u16 *tracktiming, unsigned int drv, unsigned int track, unsigned int *tracklength, int *multirev, unsigned int *gapoffset)
{
unsigned int i, len, type;
uae_u16 *mfm;
struct CapsTrackInfoT1 ci;
ci.type = LIB_TYPE;
*tracktiming = 0;
CAPSLockTrack ((struct CapsTrackInfo *)&ci, caps_cont[drv], track / 2, track & 1, caps_flags);
mfm = mfmbuf;
*multirev = (ci.type & CTIT_FLAG_FLAKEY) ? 1 : 0;
type = ci.type & CTIT_MASK_TYPE;
len = ci.tracklen;
*tracklength = len * 8;
*gapoffset = ci.overlap * 8;
for (i = 0; i < (len + 1) / 2; i++) {
uae_u8 *data = ci.trackbuf + i * 2;
*mfm++ = 256 * *data + *(data + 1);
}
if (ci.timelen > 0) {
for (i = 0; i < ci.timelen; i++)
tracktiming[i] = (uae_u16)ci.timebuf[i];
}
return 1;
}
#else /* #ifdef CAPS */
/* Stop OS X linker complaining about empty link library */
void caps_dummy (void);
void caps_dummy (void)
{
}
#endif

776
src/catweasel.c Normal file
View File

@ -0,0 +1,776 @@
#include "sysconfig.h"
#include "sysdeps.h"
#ifdef CATWEASEL
#include "options.h"
#include "memory.h"
#include "ioport.h"
#include "catweasel.h"
#include "uae.h"
struct catweasel_contr cwc;
static int cwhsync;
static int handshake;
void catweasel_hsync (void)
{
if (cwhsync <= 0)
return;
cwhsync--;
if (cwhsync == 0) {
if (handshake)
ioport_write (currprefs.catweasel_io + 0xd0, 0);
handshake = 0;
}
}
int catweasel_read_joystick (uae_u8 *dir, uae_u8 *buttons)
{
if (cwc.type != CATWEASEL_TYPE_MK3)
return 0;
*dir = ioport_read (currprefs.catweasel_io + 0xc0);
*buttons = ioport_read (currprefs.catweasel_io + 0xc8);
return 1;
}
int catweasel_read_keyboard (uae_u8 *keycode)
{
uae_u8 v;
if (cwc.type != CATWEASEL_TYPE_MK3)
return 0;
v = ioport_read (currprefs.catweasel_io + 0xd4);
if (!(v & 0x80))
return 0;
if (handshake)
return 0;
*keycode = ioport_read (currprefs.catweasel_io + 0xd0);
ioport_write (currprefs.catweasel_io + 0xd0, 0);
handshake = 1;
cwhsync = 10;
return 1;
}
uae_u32 catweasel_do_bget (uaecptr addr)
{
if (cwc.type == CATWEASEL_TYPE_MK3) {
if ((currprefs.catweasel_io & 3) == 0 && addr >= 0xc0 && addr <= 0xfc)
return ioport_read (currprefs.catweasel_io + addr);
} else {
if (addr >= currprefs.catweasel_io && addr <= currprefs.catweasel_io + 8) {
return ioport_read (addr & 0x3ff);
} else if(addr >= 0x10000 + currprefs.catweasel_io && addr <= 0x10000 + currprefs.catweasel_io) {
return ioport_read (addr & 0x3ff);
} else if ((addr & 0x3ff) < 0x200 || (addr & 0x3ff) >= 0x400) {
write_log("catweasel_bget @%08.8X!\n",addr);
}
}
return 0;
}
void catweasel_do_bput (uaecptr addr, uae_u32 b)
{
if (cwc.type == CATWEASEL_TYPE_MK3) {
if ((currprefs.catweasel_io & 3) == 0 && addr >= 0xc0 && addr <= 0xfc)
ioport_write (currprefs.catweasel_io + addr, b);
} else {
if (addr >= currprefs.catweasel_io && addr <= currprefs.catweasel_io + 8) {
ioport_write (addr & 0x3ff, b);
} else if(addr >= 0x10000 + currprefs.catweasel_io && addr <= 0x10000 + currprefs.catweasel_io) {
ioport_write (addr & 0x3ff, b);
} else if ((addr & 0x3ff) < 0x200 || (addr & 0x3ff) >= 0x400) {
write_log("catweasel_bput @%08.8X=%02.2X!\n",addr,b);
}
}
}
int catweasel_init (void)
{
if (!currprefs.catweasel_io)
return 0;
if (!ioport_init ())
return 0;
cwc.type = currprefs.catweasel_io >= 0x400 ? CATWEASEL_TYPE_MK3 : CATWEASEL_TYPE_MK1;
cwc.iobase = currprefs.catweasel_io;
catweasel_init_controller (&cwc);
return 1;
}
void catweasel_free (void)
{
if (!currprefs.catweasel_io)
return;
ioport_free ();
}
#define outb(v,port) ioport_write(port,v)
#define inb(port) ioport_read(port)
#define LONGEST_TRACK 16000
static uae_u8 mfmbuf[LONGEST_TRACK * 4];
static uae_u8 tmpmfmbuffer[LONGEST_TRACK * 2];
static int bitshiftcompare(uae_u8 *src,int bit,int len,uae_u8 *comp)
{
uae_u8 b;
int ones,zeros,len2;
ones=zeros=0;
len2=len;
while(len--) {
b = (comp[0] << bit) | (comp[1] >> (8 - bit));
if(b != *src) return 1;
if(b==0x00) zeros++;
if(b==0xff) ones++;
src++;
comp++;
}
if(ones==len2||zeros==len2) return 1;
return 0;
}
static uae_u8 *mergepieces(uae_u8 *start,int len,int bits,uae_u8 *sync)
{
uae_u8 *dst=tmpmfmbuffer;
uae_u8 b;
int size;
int shift;
size=len-(sync-start);
memcpy(dst,sync,size);
dst+=size;
b=start[len];
b&=~(255>>bits);
b|=start[0]>>bits;
*dst++=b;
shift=8-bits;
while(start<=sync+2000) {
*dst++=(start[0]<<shift)|(start[1]>>(8-shift));
start++;
}
return tmpmfmbuffer;
}
#define SCANOFFSET 1 /* scanning range in bytes, -SCANOFFSET to SCANOFFSET */
#define SCANOFFSET2 20
#define SCANLENGHT 200 /* scanning length in bytes */
static uae_u8* scantrack(uae_u8 *sync1,uae_u8 *sync2,int *trackbytes,int *trackbits)
{
int i,bits,bytes,matched;
uae_u8 *sync2bak=sync2;
sync1+=SCANOFFSET2;
sync2+=SCANOFFSET2;
while(sync1 < sync2bak - 2*SCANOFFSET - SCANOFFSET2 - SCANLENGHT) {
matched=0x7fff;
for(i=0;i<2*SCANOFFSET*8;i++) {
bits=i&7;
bytes=-SCANOFFSET+(i>>3);
if(!bitshiftcompare(sync1,bits,SCANLENGHT,sync2+bytes)) {
if(matched==0x7fff) {
matched=i;
} else {
break;
}
}
}
if(matched!=0x7fff && i>=2*SCANOFFSET*8) {
bits=matched&7;
bytes=-SCANOFFSET+(matched>>3);
*trackbytes=sync2+bytes-sync1;
*trackbits=bits;
return mergepieces(sync1,*trackbytes,*trackbits,sync2bak);
}
sync1++;
sync2++;
}
return 0;
}
static unsigned char threshtab[128];
static void codec_makethresh(int trycnt, const unsigned char *origt, unsigned char *t, int numthresh)
{
static unsigned char tab[10] = { 0, 0, 0, 0, -1, -2, 1, 2, -1, 1 };
if (trycnt >= sizeof (tab))
trycnt = sizeof (tab) - 1;
while(numthresh--)
t[numthresh] = origt[numthresh] + tab[trycnt];
}
static void codec_init_threshtab(int trycnt, const unsigned char *origt)
{
static unsigned char old_thresholds[2] = { 0, 0 };
unsigned char t[2];
int a, i;
codec_makethresh(trycnt, origt, t, 2);
if(*(unsigned short*)t == *(unsigned short*)old_thresholds)
return;
for(i=0,a=2; i<128; i++) {
if(i == t[0] || i == t[1])
a++;
threshtab[i] = a;
}
*(unsigned short*)&old_thresholds = *(unsigned short*)t;
}
static __inline__ void CWSetCReg(catweasel_contr *c, unsigned char clear, unsigned char set)
{
c->control_register = (c->control_register & ~clear) | set;
outb(c->control_register, c->io_sr);
}
static void CWTriggerStep(catweasel_contr *c)
{
CWSetCReg(c, c->crm_step, 0);
CWSetCReg(c, 0, c->crm_step);
}
void catweasel_init_controller(catweasel_contr *c)
{
int i, j;
if(!c->iobase)
return;
switch(c->type) {
case CATWEASEL_TYPE_MK1:
c->crm_sel0 = 1 << 5;
c->crm_sel1 = 1 << 4;
c->crm_mot0 = 1 << 3;
c->crm_mot1 = 1 << 7;
c->crm_dir = 1 << 1;
c->crm_step = 1 << 0;
c->srm_trk0 = 1 << 4;
c->srm_dchg = 1 << 5;
c->srm_writ = 1 << 1;
c->io_sr = c->iobase + 2;
c->io_mem = c->iobase;
break;
case CATWEASEL_TYPE_MK3:
c->crm_sel0 = 1 << 2;
c->crm_sel1 = 1 << 3;
c->crm_mot0 = 1 << 1;
c->crm_mot1 = 1 << 5;
c->crm_dir = 1 << 4;
c->crm_step = 1 << 7;
c->srm_trk0 = 1 << 2;
c->srm_dchg = 1 << 5;
c->srm_writ = 1 << 6;
c->srm_dskready = 1 << 4;
c->io_sr = c->iobase + 0xe8;
c->io_mem = c->iobase + 0xe0;
break;
default:
return;
}
c->control_register = 255;
/* select all drives, step inside */
CWSetCReg(c, c->crm_dir | c->crm_sel0 | c->crm_sel1, 0);
for(i=0;i<2;i++) {
c->drives[i].number = i;
c->drives[i].contr = c;
c->drives[i].diskindrive = 0;
/* select only the respective drive, step to track 0 */
if(i == 0) {
CWSetCReg(c, c->crm_sel0, c->crm_dir | c->crm_sel1);
} else {
CWSetCReg(c, c->crm_sel1, c->crm_dir | c->crm_sel0);
}
for(j = 0; j < 86 && (inb(c->io_sr) & c->srm_trk0); j++) {
CWTriggerStep(c);
sleep_millis(6);
}
if(j < 86) {
c->drives[i].type = 1;
c->drives[i].track = 0;
} else {
c->drives[i].type = 0;
}
}
c->drives[0].sel = c->crm_sel0;
c->drives[0].mot = c->crm_mot0;
c->drives[1].sel = c->crm_sel1;
c->drives[1].mot = c->crm_mot1;
CWSetCReg(c, 0, c->crm_sel0 | c->crm_sel1); /* deselect all drives */
}
void catweasel_free_controller(catweasel_contr *c)
{
if(!c->iobase)
return;
/* all motors off, deselect all drives */
CWSetCReg(c, 0, c->crm_mot0 | c->crm_mot1 | c->crm_sel0 | c->crm_sel1);
}
void catweasel_set_motor(catweasel_drive *d, int on)
{
CWSetCReg(d->contr, d->sel, 0);
if (on)
CWSetCReg(d->contr, d->mot, 0);
else
CWSetCReg(d->contr, 0, d->mot);
CWSetCReg(d->contr, 0, d->sel);
}
int catweasel_step(catweasel_drive *d, int dir)
{
catweasel_contr *c = d->contr;
CWSetCReg(c, d->sel, 0);
if (dir > 0)
CWSetCReg(c, c->crm_dir, 0);
else
CWSetCReg(c, 0, c->crm_dir);
CWTriggerStep (c);
CWSetCReg(c, 0, d->sel);
d->track += dir > 0 ? 1 : -1;
return 1;
}
int catweasel_disk_changed(catweasel_drive *d)
{
int ret;
CWSetCReg(d->contr, d->sel, 0);
ret = (inb(d->contr->io_sr) & d->contr->srm_dchg) ? 0 : 1;
CWSetCReg(d->contr, 0, d->sel);
return ret;
}
int catweasel_diskready(catweasel_drive *d)
{
int ret;
CWSetCReg(d->contr, d->sel, 0);
ret = (inb(d->contr->io_sr) & d->contr->srm_dskready) ? 0 : 1;
CWSetCReg(d->contr, 0, d->sel);
return ret;
}
int catweasel_track0(catweasel_drive *d)
{
int ret;
CWSetCReg(d->contr, d->sel, 0);
ret = (inb(d->contr->io_sr) & d->contr->srm_trk0) ? 0 : 1;
CWSetCReg(d->contr, 0, d->sel);
if (ret)
d->track = 0;
return ret;
}
int catweasel_write_protected(catweasel_drive *d)
{
int ret;
CWSetCReg(d->contr, d->sel, 0);
ret = !(inb(d->contr->io_sr) & 8);
CWSetCReg(d->contr, 0, d->sel);
return ret;
}
uae_u8 catweasel_read_byte(catweasel_drive *d)
{
return inb(d->contr->io_mem);
}
static const unsigned char amiga_thresholds[] = { 0x22, 0x30 }; // 27, 38 for 5.25"
#define FLOPPY_WRITE_LEN 6250
#define MFMMASK 0x55555555
static uae_u32 getmfmlong (uae_u16 * mbuf)
{
return (uae_u32)(((*mbuf << 16) | *(mbuf + 1)) & MFMMASK);
}
static int drive_write_adf_amigados (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *writebuffer, int track)
{
int i, secwritten = 0;
uae_u32 odd, even, chksum, id, dlong;
uae_u8 *secdata;
uae_u8 secbuf[544];
char sectable[22];
int num_sectors = 11;
int ec = 0;
memset (sectable, 0, sizeof (sectable));
mend -= (4 + 16 + 8 + 512);
while (secwritten < num_sectors) {
int trackoffs;
do {
while (*mbuf++ != 0x4489) {
if (mbuf >= mend) {
ec = 1;
goto err;
}
}
} while (*mbuf++ != 0x4489);
odd = getmfmlong (mbuf);
even = getmfmlong (mbuf + 2);
mbuf += 4;
id = (odd << 1) | even;
trackoffs = (id & 0xff00) >> 8;
if (trackoffs > 10) {
ec = 2;
goto err;
}
chksum = odd ^ even;
for (i = 0; i < 4; i++) {
odd = getmfmlong (mbuf);
even = getmfmlong (mbuf + 8);
mbuf += 2;
dlong = (odd << 1) | even;
if (dlong) {
ec = 6;
goto err;
}
chksum ^= odd ^ even;
} /* could check here if the label is nonstandard */
mbuf += 8;
odd = getmfmlong (mbuf);
even = getmfmlong (mbuf + 2);
mbuf += 4;
if (((odd << 1) | even) != chksum) {
ec = 3;
goto err;
}
odd = (id & 0x00ff0000) >> 16;
if (odd != track) {
ec = 7;
goto err;
}
odd = getmfmlong (mbuf);
even = getmfmlong (mbuf + 2);
mbuf += 4;
chksum = (odd << 1) | even;
secdata = secbuf + 32;
for (i = 0; i < 128; i++) {
odd = getmfmlong (mbuf);
even = getmfmlong (mbuf + 256);
mbuf += 2;
dlong = (odd << 1) | even;
*secdata++ = dlong >> 24;
*secdata++ = dlong >> 16;
*secdata++ = dlong >> 8;
*secdata++ = dlong;
chksum ^= odd ^ even;
}
mbuf += 256;
if (chksum) {
ec = 4;
goto err;
}
sectable[trackoffs] = 1;
secwritten++;
memcpy (writebuffer + trackoffs * 512, secbuf + 32, 512);
}
if (secwritten == 0 || secwritten < 0) {
ec = 5;
goto err;
}
return 0;
err:
write_log ("mfm decode error %d. secwritten=%d\n", ec, secwritten);
for (i = 0; i < num_sectors; i++)
write_log ("%d:%d ", i, sectable[i]);
write_log ("\n");
return ec;
}
static void mfmcode (uae_u16 * mfm, int words)
{
uae_u32 lastword = 0;
while (words--) {
uae_u32 v = *mfm;
uae_u32 lv = (lastword << 16) | v;
uae_u32 nlv = 0x55555555 & ~lv;
uae_u32 mfmbits = (nlv << 1) & (nlv >> 1);
*mfm++ = v | mfmbits;
lastword = v;
}
}
#define FLOPPY_GAP_LEN 360
static int amigados_mfmcode (uae_u8 *src, uae_u16 *dst, int num_secs, int track)
{
int sec;
memset (dst, 0xaa, FLOPPY_GAP_LEN * 2);
for (sec = 0; sec < num_secs; sec++) {
uae_u8 secbuf[544];
int i;
uae_u16 *mfmbuf = dst + 544 * sec + FLOPPY_GAP_LEN;
uae_u32 deven, dodd;
uae_u32 hck = 0, dck = 0;
secbuf[0] = secbuf[1] = 0x00;
secbuf[2] = secbuf[3] = 0xa1;
secbuf[4] = 0xff;
secbuf[5] = track;
secbuf[6] = sec;
secbuf[7] = num_secs - sec;
for (i = 8; i < 24; i++)
secbuf[i] = 0;
mfmbuf[0] = mfmbuf[1] = 0xaaaa;
mfmbuf[2] = mfmbuf[3] = 0x4489;
memcpy (secbuf + 32, src + sec * 512, 512);
deven = ((secbuf[4] << 24) | (secbuf[5] << 16)
| (secbuf[6] << 8) | (secbuf[7]));
dodd = deven >> 1;
deven &= 0x55555555;
dodd &= 0x55555555;
mfmbuf[4] = dodd >> 16;
mfmbuf[5] = dodd;
mfmbuf[6] = deven >> 16;
mfmbuf[7] = deven;
for (i = 8; i < 48; i++)
mfmbuf[i] = 0xaaaa;
for (i = 0; i < 512; i += 4) {
deven = ((secbuf[i + 32] << 24) | (secbuf[i + 33] << 16)
| (secbuf[i + 34] << 8) | (secbuf[i + 35]));
dodd = deven >> 1;
deven &= 0x55555555;
dodd &= 0x55555555;
mfmbuf[(i >> 1) + 32] = dodd >> 16;
mfmbuf[(i >> 1) + 33] = dodd;
mfmbuf[(i >> 1) + 256 + 32] = deven >> 16;
mfmbuf[(i >> 1) + 256 + 33] = deven;
}
for (i = 4; i < 24; i += 2)
hck ^= (mfmbuf[i] << 16) | mfmbuf[i + 1];
deven = dodd = hck;
dodd >>= 1;
mfmbuf[24] = dodd >> 16;
mfmbuf[25] = dodd;
mfmbuf[26] = deven >> 16;
mfmbuf[27] = deven;
for (i = 32; i < 544; i += 2)
dck ^= (mfmbuf[i] << 16) | mfmbuf[i + 1];
deven = dodd = dck;
dodd >>= 1;
mfmbuf[28] = dodd >> 16;
mfmbuf[29] = dodd;
mfmbuf[30] = deven >> 16;
mfmbuf[31] = deven;
mfmcode (mfmbuf + 4, 544 - 4);
}
return (num_secs * 544 + FLOPPY_GAP_LEN) * 2 * 8;
}
static uae_u16 amigamfmbuffer[LONGEST_TRACK];
static uae_u8 amigabuffer[512*22];
/* search and align to 0x4489 WORDSYNC markers */
static int isamigatrack(uae_u8 *mfmdata, uae_u8 *mfmdatae, uae_u16 *mfmdst, int track)
{
uae_u16 *dst = amigamfmbuffer;
int len;
int shift, syncshift, sync,ret;
uae_u32 l;
uae_u16 w;
sync = syncshift = shift = 0;
len = (mfmdatae - mfmdata) * 8;
if (len > LONGEST_TRACK * 8)
len = LONGEST_TRACK * 8;
while (len--) {
l = (mfmdata[0] << 16) | (mfmdata[1] << 8) | (mfmdata[2] << 0);
w = l >> (8 - shift);
if (w == 0x4489) {
sync = 1;
syncshift = 0;
}
if (sync) {
if (syncshift == 0) *dst++ = w;
syncshift ++;
if (syncshift == 16) syncshift = 0;
}
shift++;
if (shift == 8) {
mfmdata++;
shift = 0;
}
}
if (sync) {
ret=drive_write_adf_amigados (amigamfmbuffer, dst, amigabuffer, track);
if(!ret)
return amigados_mfmcode (amigabuffer, mfmdst, 11, track);
write_log ("decode error %d\n", ret);
} else {
write_log ("decode error: no sync found\n");
}
return 0;
}
int catweasel_fillmfm (catweasel_drive *d, uae_u16 *mfm, int side, int clock, int rawmode)
{
int i, j, oldsync, syncs[10], synccnt, endcnt;
uae_u32 tt1 = 0, tt2 = 0;
uae_u8 *p1;
int bytes = 0, bits = 0;
static int lasttrack, trycnt;
if (cwc.type == 0)
return 0;
if (d->contr->control_register & d->mot)
return 0;
if (!catweasel_read (d, side, 1, rawmode))
return 0;
if(d->contr->type == CATWEASEL_TYPE_MK1) {
inb(d->contr->iobase + 1);
inb(d->contr->io_mem); /* ignore first byte */
} else {
outb(0, d->contr->iobase + 0xe4);
}
catweasel_read_byte (d);
if (lasttrack == d->track)
trycnt++;
else
trycnt = 0;
lasttrack = d->track;
codec_init_threshtab(trycnt, amiga_thresholds);
i = 0; j = 0;
synccnt = 0;
oldsync = -1;
endcnt = 0;
while (j < LONGEST_TRACK * 4) {
uae_u8 b = catweasel_read_byte (d);
if (b >= 250) {
if (b == 255 - endcnt) {
endcnt++;
if (endcnt == 5)
break;
} else
endcnt = 0;
}
if (rawmode) {
if (b & 0x80) {
if (oldsync < j) {
syncs[synccnt++] = j;
oldsync = j + 300;
}
}
if (synccnt >= 3 && j > oldsync)
break;
}
b = threshtab[b & 0x7f];
tt1 = (tt1 << b) + 1;
tt2 += b;
if (tt2 >= 16) {
tt2 -= 16;
mfmbuf[j++] = tt1 >> (tt2 + 8);
mfmbuf[j++] = tt1 >> tt2;
}
i++;
}
write_log ("cyl=%d, side=%d, length %d, syncs %d\n", d->track, side, j, synccnt);
if (rawmode) {
if (synccnt >= 3) {
p1 = scantrack (mfmbuf + syncs[1], mfmbuf + syncs[2], &bytes, &bits);
if (p1) {
j = 0;
for (i = 0; i < bytes + 2; i+=2) {
mfm[j++] = (p1[i] << 8) | p1[i + 1];
}
return bytes * 8 + bits;
}
}
} else {
return isamigatrack (mfmbuf, mfmbuf + j, mfm, d->track * 2 + side);
}
return 0;
}
int catweasel_read(catweasel_drive *d, int side, int clock, int rawmode)
{
int iobase = d->contr->iobase;
CWSetCReg(d->contr, d->sel, 0);
if(d->contr->type == CATWEASEL_TYPE_MK1) {
CWSetCReg(d->contr, 1<<2, (!side)<<2); /* set disk side */
inb(iobase+1); /* ra reset */
outb(clock*128, iobase+3);
inb(iobase+1);
inb(iobase+0);
// inb(iobase+0);
// outb(0, iobase+3); /* don't store index pulse */
inb(iobase+1);
inb(iobase+7); /* start reading */
sleep_millis(rawmode ? 550 : 225);
outb(0, iobase+1); /* stop reading, don't reset RAM pointer */
outb(128, iobase+0); /* add data end mark */
outb(128, iobase+0);
inb(iobase+1); /* Reset RAM pointer */
} else {
CWSetCReg(d->contr, 1<<6, (!side)<<6); /* set disk side */
outb(0, iobase + 0xe4); /* Reset memory pointer */
switch(clock) {
case 0: /* 28MHz */
outb(128, iobase + 0xec);
break;
case 1: /* 14MHz */
outb(0, iobase + 0xec);
break;
}
inb(iobase + 0xe0);
inb(iobase + 0xe0);
outb(0, iobase + 0xec); /* no IRQs, no MFM predecode */
inb(iobase + 0xe0);
outb(0, iobase + 0xec); /* don't store index pulse */
outb(0, iobase + 0xe4); /* Reset memory pointer */
inb(iobase + 0xf0); /* start reading */
sleep_millis(rawmode ? 550 : 225);
inb(iobase + 0xe4); /* stop reading, don't reset RAM pointer */
outb(255, iobase + 0xe0); /* add data end mark */
outb(254, iobase + 0xe0); /* add data end mark */
outb(253, iobase + 0xe0); /* add data end mark */
outb(252, iobase + 0xe0); /* add data end mark */
outb(251, iobase + 0xe0); /* add data end mark */
outb(0, iobase + 0xe4); /* Reset memory pointer */
}
CWSetCReg(d->contr, 0, d->sel);
return 1;
}
#endif

236
src/cdrom.c Normal file
View File

@ -0,0 +1,236 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include "cdrom.h"
/* CDROM MODE 1 EDC/ECC code (from Reed-Solomon library by Heiko Eissfeldt) */
/*****************************************************************/
/* */
/* CRC LOOKUP TABLE */
/* ================ */
/* The following CRC lookup table was generated automagically */
/* by the Rocksoft^tm Model CRC Algorithm Table Generation */
/* Program V1.0 using the following model parameters: */
/* */
/* Width : 4 bytes. */
/* Poly : 0x8001801BL */
/* Reverse : TRUE. */
/* */
/* For more information on the Rocksoft^tm Model CRC Algorithm, */
/* see the document titled "A Painless Guide to CRC Error */
/* Detection Algorithms" by Ross Williams */
/* (ross@guest.adelaide.edu.au.). This document is likely to be */
/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */
/* */
/*****************************************************************/
static const uae_u32 EDC_crctable[256] =
{
0x00000000L, 0x90910101L, 0x91210201L, 0x01B00300L,
0x92410401L, 0x02D00500L, 0x03600600L, 0x93F10701L,
0x94810801L, 0x04100900L, 0x05A00A00L, 0x95310B01L,
0x06C00C00L, 0x96510D01L, 0x97E10E01L, 0x07700F00L,
0x99011001L, 0x09901100L, 0x08201200L, 0x98B11301L,
0x0B401400L, 0x9BD11501L, 0x9A611601L, 0x0AF01700L,
0x0D801800L, 0x9D111901L, 0x9CA11A01L, 0x0C301B00L,
0x9FC11C01L, 0x0F501D00L, 0x0EE01E00L, 0x9E711F01L,
0x82012001L, 0x12902100L, 0x13202200L, 0x83B12301L,
0x10402400L, 0x80D12501L, 0x81612601L, 0x11F02700L,
0x16802800L, 0x86112901L, 0x87A12A01L, 0x17302B00L,
0x84C12C01L, 0x14502D00L, 0x15E02E00L, 0x85712F01L,
0x1B003000L, 0x8B913101L, 0x8A213201L, 0x1AB03300L,
0x89413401L, 0x19D03500L, 0x18603600L, 0x88F13701L,
0x8F813801L, 0x1F103900L, 0x1EA03A00L, 0x8E313B01L,
0x1DC03C00L, 0x8D513D01L, 0x8CE13E01L, 0x1C703F00L,
0xB4014001L, 0x24904100L, 0x25204200L, 0xB5B14301L,
0x26404400L, 0xB6D14501L, 0xB7614601L, 0x27F04700L,
0x20804800L, 0xB0114901L, 0xB1A14A01L, 0x21304B00L,
0xB2C14C01L, 0x22504D00L, 0x23E04E00L, 0xB3714F01L,
0x2D005000L, 0xBD915101L, 0xBC215201L, 0x2CB05300L,
0xBF415401L, 0x2FD05500L, 0x2E605600L, 0xBEF15701L,
0xB9815801L, 0x29105900L, 0x28A05A00L, 0xB8315B01L,
0x2BC05C00L, 0xBB515D01L, 0xBAE15E01L, 0x2A705F00L,
0x36006000L, 0xA6916101L, 0xA7216201L, 0x37B06300L,
0xA4416401L, 0x34D06500L, 0x35606600L, 0xA5F16701L,
0xA2816801L, 0x32106900L, 0x33A06A00L, 0xA3316B01L,
0x30C06C00L, 0xA0516D01L, 0xA1E16E01L, 0x31706F00L,
0xAF017001L, 0x3F907100L, 0x3E207200L, 0xAEB17301L,
0x3D407400L, 0xADD17501L, 0xAC617601L, 0x3CF07700L,
0x3B807800L, 0xAB117901L, 0xAAA17A01L, 0x3A307B00L,
0xA9C17C01L, 0x39507D00L, 0x38E07E00L, 0xA8717F01L,
0xD8018001L, 0x48908100L, 0x49208200L, 0xD9B18301L,
0x4A408400L, 0xDAD18501L, 0xDB618601L, 0x4BF08700L,
0x4C808800L, 0xDC118901L, 0xDDA18A01L, 0x4D308B00L,
0xDEC18C01L, 0x4E508D00L, 0x4FE08E00L, 0xDF718F01L,
0x41009000L, 0xD1919101L, 0xD0219201L, 0x40B09300L,
0xD3419401L, 0x43D09500L, 0x42609600L, 0xD2F19701L,
0xD5819801L, 0x45109900L, 0x44A09A00L, 0xD4319B01L,
0x47C09C00L, 0xD7519D01L, 0xD6E19E01L, 0x46709F00L,
0x5A00A000L, 0xCA91A101L, 0xCB21A201L, 0x5BB0A300L,
0xC841A401L, 0x58D0A500L, 0x5960A600L, 0xC9F1A701L,
0xCE81A801L, 0x5E10A900L, 0x5FA0AA00L, 0xCF31AB01L,
0x5CC0AC00L, 0xCC51AD01L, 0xCDE1AE01L, 0x5D70AF00L,
0xC301B001L, 0x5390B100L, 0x5220B200L, 0xC2B1B301L,
0x5140B400L, 0xC1D1B501L, 0xC061B601L, 0x50F0B700L,
0x5780B800L, 0xC711B901L, 0xC6A1BA01L, 0x5630BB00L,
0xC5C1BC01L, 0x5550BD00L, 0x54E0BE00L, 0xC471BF01L,
0x6C00C000L, 0xFC91C101L, 0xFD21C201L, 0x6DB0C300L,
0xFE41C401L, 0x6ED0C500L, 0x6F60C600L, 0xFFF1C701L,
0xF881C801L, 0x6810C900L, 0x69A0CA00L, 0xF931CB01L,
0x6AC0CC00L, 0xFA51CD01L, 0xFBE1CE01L, 0x6B70CF00L,
0xF501D001L, 0x6590D100L, 0x6420D200L, 0xF4B1D301L,
0x6740D400L, 0xF7D1D501L, 0xF661D601L, 0x66F0D700L,
0x6180D800L, 0xF111D901L, 0xF0A1DA01L, 0x6030DB00L,
0xF3C1DC01L, 0x6350DD00L, 0x62E0DE00L, 0xF271DF01L,
0xEE01E001L, 0x7E90E100L, 0x7F20E200L, 0xEFB1E301L,
0x7C40E400L, 0xECD1E501L, 0xED61E601L, 0x7DF0E700L,
0x7A80E800L, 0xEA11E901L, 0xEBA1EA01L, 0x7B30EB00L,
0xE8C1EC01L, 0x7850ED00L, 0x79E0EE00L, 0xE971EF01L,
0x7700F000L, 0xE791F101L, 0xE621F201L, 0x76B0F300L,
0xE541F401L, 0x75D0F500L, 0x7460F600L, 0xE4F1F701L,
0xE381F801L, 0x7310F900L, 0x72A0FA00L, 0xE231FB01L,
0x71C0FC00L, 0xE151FD01L, 0xE0E1FE01L, 0x7070FF00L
};
/*****************************************************************/
/* End of CRC Lookup Table */
/*****************************************************************/
static uae_u8 rs_l12_alog[255] = {
1, 2, 4, 8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143, 3, 6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140, 5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141, 7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138, 9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,};
static uae_u8 rs_l12_log[256] = {
0, 0, 1,25, 2,50,26,198, 3,223,51,238,27,104,199,75, 4,100,224,14,52,141,239,129,28,193,105,248,200, 8,76,113, 5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154, 9,120,77,228,114,166, 6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87, 7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175,};
static uae_u8 DQ[2][43] = {
{190,96,250,132,59,81,159,154,200,7,111,245,10,20,41,156,168,79,173,231,229,171,210,240,17,67,215,43,120,8,199,74,102,220,251,95,175,87,166,113,75,198,25,},
{97,251,133,60,82,160,155,201,8,112,246,11,21,42,157,169,80,174,232,230,172,211,241,18,68,216,44,121,9,200,75,103,221,252,96,176,88,167,114,76,199,26,1,},
};
static uae_u8 DP[2][24] = {
{231,229,171,210,240,17,67,215,43,120,8,199,74,102,220,251,95,175,87,166,113,75,198,25,},
{230,172,211,241,18,68,216,44,121,9,200,75,103,221,252,96,176,88,167,114,76,199,26,1,},
};
/* data sector definitions for RSPC */
/* user data bytes per frame */
#define L2_RAW (1024*2)
/* parity bytes for 16 bit units */
#define L2_Q (26*2*2)
#define L2_P (43*2*2)
#define RS_L12_BITS 8
static uae_u32 build_edc (const uae_u8 *inout, int from, int upto)
{
const uae_u8 *p = inout + from;
uae_u32 result = 0;
for (; from <= upto; from++)
result = EDC_crctable[(result ^ *p++) & 0xff] ^ (result >> 8);
return result;
}
static void encode_L2_Q(uae_u8 *inout)
{
uae_u8 *Q;
int i,j;
Q = inout + 4 + L2_RAW + 4 + 8 + L2_P;
memset(Q, 0, L2_Q);
for (j = 0; j < 26; j++) {
for (i = 0; i < 43; i++) {
uae_u8 data;
/* LSB */
data = inout[(j*43*2+i*2*44) % (4 + L2_RAW + 4 + 8 + L2_P)];
if (data != 0) {
uae_u32 base = rs_l12_log[data];
uae_u32 sum = base + DQ[0][i];
if (sum >= ((1 << RS_L12_BITS)-1))
sum -= (1 << RS_L12_BITS)-1;
Q[0] ^= rs_l12_alog[sum];
sum = base + DQ[1][i];
if (sum >= ((1 << RS_L12_BITS)-1))
sum -= (1 << RS_L12_BITS)-1;
Q[26*2] ^= rs_l12_alog[sum];
}
/* MSB */
data = inout[(j*43*2+i*2*44+1) % (4 + L2_RAW + 4 + 8 + L2_P)];
if (data != 0) {
uae_u32 base = rs_l12_log[data];
uae_u32 sum = base+DQ[0][i];
if (sum >= ((1 << RS_L12_BITS)-1))
sum -= (1 << RS_L12_BITS)-1;
Q[1] ^= rs_l12_alog[sum];
sum = base + DQ[1][i];
if (sum >= ((1 << RS_L12_BITS)-1))
sum -= (1 << RS_L12_BITS)-1;
Q[26*2+1] ^= rs_l12_alog[sum];
}
}
Q += 2;
}
}
static void encode_L2_P(uae_u8 inout[4 + L2_RAW + 4 + 8 + L2_P])
{
uae_u8 *P;
int i,j;
P = inout + 4 + L2_RAW + 4 + 8;
memset(P, 0, L2_P);
for (j = 0; j < 43; j++) {
for (i = 0; i < 24; i++) {
uae_u8 data;
/* LSB */
data = inout[i*2*43];
if (data != 0) {
uae_u32 base = rs_l12_log[data];
uae_u32 sum = base + DP[0][i];
if (sum >= ((1 << RS_L12_BITS)-1))
sum -= (1 << RS_L12_BITS)-1;
P[0] ^= rs_l12_alog[sum];
sum = base + DP[1][i];
if (sum >= ((1 << RS_L12_BITS)-1))
sum -= (1 << RS_L12_BITS)-1;
P[43*2] ^= rs_l12_alog[sum];
}
/* MSB */
data = inout[i*2*43+1];
if (data != 0) {
uae_u32 base = rs_l12_log[data];
uae_u32 sum = base + DP[0][i];
if (sum >= ((1 << RS_L12_BITS)-1))
sum -= (1 << RS_L12_BITS)-1;
P[1] ^= rs_l12_alog[sum];
sum = base + DP[1][i];
if (sum >= ((1 << RS_L12_BITS)-1))
sum -= (1 << RS_L12_BITS)-1;
P[43*2+1] ^= rs_l12_alog[sum];
}
}
P += 2;
inout += 2;
}
}
static uae_u8 tobcd (uae_u8 v)
{
return ((v / 10) << 4) | (v % 10);
}
void encode_l2 (uae_u8 *p, int address)
{
uae_u32 v;
p[0] = 0x00;
memset (p + 1, 0xff, 11);
p[12] = tobcd ((uae_u8)(address / (60 * 75)));
p[13] = tobcd ((uae_u8)((address / 75) % 60));
p[14] = tobcd ((uae_u8)(address % 75));
p[15] = 1; /* MODE1 */
v = build_edc (p, 0, 16 + 2048 - 1);
p[2064 + 0] = (uae_u8) (v >> 0);
p[2064 + 1] = (uae_u8) (v >> 8);
p[2064 + 2] = (uae_u8) (v >> 16);
p[2064 + 3] = (uae_u8) (v >> 24);
memset (p + 2064 + 4, 0, 8);
encode_L2_P (p + 12);
encode_L2_Q (p + 12);
}

2468
src/cfgfile.c Normal file

File diff suppressed because it is too large Load Diff

1527
src/cia.c Normal file

File diff suppressed because it is too large Load Diff

1562
src/compemu_fpp.c Normal file

File diff suppressed because it is too large Load Diff

3463
src/compemu_raw_x86.c Normal file

File diff suppressed because it is too large Load Diff

6079
src/compemu_support.c Normal file

File diff suppressed because it is too large Load Diff

50
src/crc32.c Executable file
View File

@ -0,0 +1,50 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include "crc32.h"
static uae_u32 crc_table32[256];
static uae_u16 crc_table16[256];
static void make_crc_table (void)
{
uae_u32 c;
uae_u16 w;
unsigned int n, k;
for (n = 0; n < 256; n++) {
c = (uae_u32) n;
w = n << 8;
for (k = 0; k < 8; k++) {
c = (c >> 1) ^ (c & 1 ? 0xedb88320 : 0);
w = (w << 1) ^ ((w & 0x8000) ? 0x1021 : 0);
}
crc_table32[n] = c;
crc_table16[n] = w;
}
}
uae_u32 get_crc32 (const uae_u8 *buf, unsigned int len)
{
uae_u32 crc;
if (!crc_table32[1])
make_crc_table ();
crc = 0xffffffff;
while (len-- > 0)
crc = crc_table32[(crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
return crc ^ 0xffffffff;
}
uae_u16 get_crc16 (const uae_u8 *buf, unsigned int len)
{
uae_u16 crc;
if (!crc_table32[1])
make_crc_table ();
crc = 0xffff;
while (len-- > 0)
crc = (crc << 8) ^ crc_table16[((crc >> 8) ^ (*buf++)) & 0xff];
return crc;
}

5662
src/custom.c Normal file

File diff suppressed because it is too large Load Diff

1707
src/debug.c Normal file

File diff suppressed because it is too large Load Diff

3207
src/disk.c Normal file

File diff suppressed because it is too large Load Diff

10
src/dms/Makefile.am Normal file
View File

@ -0,0 +1,10 @@
INCLUDES = -I$(top_srcdir)/src/include -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_srcdir)
noinst_LIBRARIES = libdms.a
libdms_a_SOURCES = crc_csum.c getbits.c maketbl.c pfile.c tables.c \
u_deep.c u_heavy.c u_init.c u_medium.c u_quick.c \
u_rle.c
noinst_HEADERS = cdata.h crc_csum.h getbits.h maketbl.h pfile.h tables.h \
u_deep.h u_heavy.h u_init.h u_medium.h u_quick.h u_rle.h

470
src/dms/Makefile.in Normal file
View File

@ -0,0 +1,470 @@
# Makefile.in generated by automake 1.7.9 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ASMOBJS = @ASMOBJS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BSDSOCKOBJS = @BSDSOCKOBJS@
BUILD_MACOSX_BUNDLE_FALSE = @BUILD_MACOSX_BUNDLE_FALSE@
BUILD_MACOSX_BUNDLE_TRUE = @BUILD_MACOSX_BUNDLE_TRUE@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CDOBJS = @CDOBJS@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPUOBJS = @CPUOBJS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUGOBJS = @DEBUGOBJS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRAOBJS = @EXTRAOBJS@
FILEPRG = @FILEPRG@
FILESYSOBJS = @FILESYSOBJS@
GENCPUOPTS = @GENCPUOPTS@
GFX_DEP = @GFX_DEP@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
GUI_DEP = @GUI_DEP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JITOBJS = @JITOBJS@
JOY_DEP = @JOY_DEP@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MACHDEP = @MACHDEP@
MAKEDEPPRG = @MAKEDEPPRG@
MAKEINFO = @MAKEINFO@
MATHLIB = @MATHLIB@
NO_SCHED_CFLAGS = @NO_SCHED_CFLAGS@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJC_LDFLAGS = @OBJC_LDFLAGS@
OBJEXT = @OBJEXT@
OSDEP = @OSDEP@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RCLPRG = @RCLPRG@
RESOBJS = @RESOBJS@
SCSIOBJS = @SCSIOBJS@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SND_DEP = @SND_DEP@
STRIP = @STRIP@
TARGET = @TARGET@
TARGET_BEOS_FALSE = @TARGET_BEOS_FALSE@
TARGET_BEOS_TRUE = @TARGET_BEOS_TRUE@
TARGET_BIGENDIAN_FALSE = @TARGET_BIGENDIAN_FALSE@
TARGET_BIGENDIAN_TRUE = @TARGET_BIGENDIAN_TRUE@
TARGET_WIN32_FALSE = @TARGET_WIN32_FALSE@
TARGET_WIN32_TRUE = @TARGET_WIN32_TRUE@
THREADDEP = @THREADDEP@
UAE_RSRCFILE = @UAE_RSRCFILE@
VERSION = @VERSION@
WRCPRG = @WRCPRG@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_OBJC = @ac_ct_OBJC@
ac_cv_c_inline = @ac_cv_c_inline@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@
am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
INCLUDES = -I$(top_srcdir)/src/include -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_srcdir)
noinst_LIBRARIES = libdms.a
libdms_a_SOURCES = crc_csum.c getbits.c maketbl.c pfile.c tables.c \
u_deep.c u_heavy.c u_init.c u_medium.c u_quick.c \
u_rle.c
noinst_HEADERS = cdata.h crc_csum.h getbits.h maketbl.h pfile.h tables.h \
u_deep.h u_heavy.h u_init.h u_medium.h u_quick.h u_rle.h
subdir = src/dms
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/sysconfig.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
libdms_a_AR = $(AR) cru
libdms_a_LIBADD =
am_libdms_a_OBJECTS = crc_csum.$(OBJEXT) getbits.$(OBJEXT) \
maketbl.$(OBJEXT) pfile.$(OBJEXT) tables.$(OBJEXT) \
u_deep.$(OBJEXT) u_heavy.$(OBJEXT) u_init.$(OBJEXT) \
u_medium.$(OBJEXT) u_quick.$(OBJEXT) u_rle.$(OBJEXT)
libdms_a_OBJECTS = $(am_libdms_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/crc_csum.Po ./$(DEPDIR)/getbits.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/maketbl.Po ./$(DEPDIR)/pfile.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/tables.Po ./$(DEPDIR)/u_deep.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/u_heavy.Po ./$(DEPDIR)/u_init.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/u_medium.Po ./$(DEPDIR)/u_quick.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/u_rle.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libdms_a_SOURCES)
HEADERS = $(noinst_HEADERS)
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am
SOURCES = $(libdms_a_SOURCES)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign src/dms/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libdms.a: $(libdms_a_OBJECTS) $(libdms_a_DEPENDENCIES)
-rm -f libdms.a
$(libdms_a_AR) libdms.a $(libdms_a_OBJECTS) $(libdms_a_LIBADD)
$(RANLIB) libdms.a
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_csum.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getbits.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/maketbl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u_deep.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u_heavy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u_init.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u_medium.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u_quick.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u_rle.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES) $(HEADERS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

80
src/dms/cdata.h Normal file
View File

@ -0,0 +1,80 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Main types of variables used in xDMS, some implementation
* dependant features and other global stuff
*/
#ifndef UCHAR
#define UCHAR unsigned char
#endif
#ifndef USHORT
#define USHORT unsigned short
#endif
#ifndef SHORT
#define SHORT short
#endif
#ifndef ULONG
#define ULONG unsigned long
#endif
#ifndef INLINE
#ifdef __cplusplus
#define INLINE inline
#else
#ifdef __GNUC__
#define INLINE inline
#else
#ifdef __SASC
#define INLINE __inline
#else
#define INLINE static
#endif
#endif
#endif
#endif
#ifndef UNDER_DOS
#ifdef __MSDOS__
#define UNDER_DOS
#else
#ifdef __MSDOS
#define UNDER_DOS
#else
#ifdef _OS2
#define UNDER_DOS
#else
#ifdef _QC
#define UNDER_DOS
#endif
#endif
#endif
#endif
#endif
#ifndef DIR_CHAR
#ifdef UNDER_DOS
/* running under MSDOS or DOS-like OS */
#define DIR_CHAR '\\'
#else
#define DIR_CHAR '/'
#endif
#endif
#define DIR_SEPARATORS ":\\/"
extern UCHAR *text;

69
src/dms/crc_csum.c Normal file
View File

@ -0,0 +1,69 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* CRC16 & CheckSum16 calculation functions
* CreateCRC was written (aparently) by Bjorn Stenberg
*
*/
#include "cdata.h"
#include "crc_csum.h"
USHORT Calc_CheckSum(UCHAR *mem, ULONG size){
USHORT u=0;
while(size--) u += *mem++;
return (USHORT)(u & 0xffff);
}
USHORT CreateCRC(UCHAR* mem, ULONG size ){
static USHORT CRCTab[256]={
0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,
0xC601,0x06C0,0x0780,0xC741,0x0500,0xC5C1,0xC481,0x0440,
0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,
0x0A00,0xCAC1,0xCB81,0x0B40,0xC901,0x09C0,0x0880,0xC841,
0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81,0x1A40,
0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41,
0x1400,0xD4C1,0xD581,0x1540,0xD701,0x17C0,0x1680,0xD641,
0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040,
0xF001,0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240,
0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0,0x3480,0xF441,
0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41,
0xFA01,0x3AC0,0x3B80,0xFB41,0x3900,0xF9C1,0xF881,0x3840,
0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41,
0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40,
0xE401,0x24C0,0x2580,0xE541,0x2700,0xE7C1,0xE681,0x2640,
0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041,
0xA001,0x60C0,0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240,
0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480,0xA441,
0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41,
0xAA01,0x6AC0,0x6B80,0xAB41,0x6900,0xA9C1,0xA881,0x6840,
0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41,
0xBE01,0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40,
0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1,0xB681,0x7640,
0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041,
0x5000,0x90C1,0x9181,0x5140,0x9301,0x53C0,0x5280,0x9241,
0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440,
0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40,
0x5A00,0x9AC1,0x9B81,0x5B40,0x9901,0x59C0,0x5880,0x9841,
0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40,
0x4E00,0x8EC1,0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41,
0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680,0x8641,
0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040
};
register USHORT CRC = 0;
while(size--)
CRC = (USHORT) (CRCTab[((CRC ^ *mem++) & 255)] ^ ((CRC >> 8) & 255));
return CRC;
}

4
src/dms/crc_csum.h Normal file
View File

@ -0,0 +1,4 @@
USHORT Calc_CheckSum(UCHAR *, ULONG);
USHORT CreateCRC(UCHAR *, ULONG);

34
src/dms/getbits.c Normal file
View File

@ -0,0 +1,34 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
* Functions/macros to get a variable number of bits
*
*/
#include "cdata.h"
#include "getbits.h"
ULONG mask_bits[]={
0x000000L,0x000001L,0x000003L,0x000007L,0x00000fL,0x00001fL,
0x00003fL,0x00007fL,0x0000ffL,0x0001ffL,0x0003ffL,0x0007ffL,
0x000fffL,0x001fffL,0x003fffL,0x007fffL,0x00ffffL,0x01ffffL,
0x03ffffL,0x07ffffL,0x0fffffL,0x1fffffL,0x3fffffL,0x7fffffL,
0xffffffL
};
UCHAR *indata, bitcount;
ULONG bitbuf;
void initbitbuf(UCHAR *in){
bitbuf = 0;
bitcount = 0;
indata = in;
DROPBITS(0);
}

10
src/dms/getbits.h Normal file
View File

@ -0,0 +1,10 @@
extern ULONG mask_bits[], bitbuf;
extern UCHAR *indata, bitcount;
#define GETBITS(n) ((USHORT)(bitbuf >> (bitcount-(n))))
#define DROPBITS(n) {bitbuf &= mask_bits[bitcount-=(n)]; while (bitcount<16) {bitbuf = (bitbuf << 8) | *indata++; bitcount += 8;}}
void initbitbuf(UCHAR *);

92
src/dms/maketbl.c Normal file
View File

@ -0,0 +1,92 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Makes decoding table for Heavy LZH decompression
* From UNIX LHA made by Masaru Oki
*
*/
#include "cdata.h"
#include "maketbl.h"
static SHORT c;
static USHORT n, tblsiz, len, depth, maxdepth, avail;
static USHORT codeword, bit, *tbl, TabErr;
static UCHAR *blen;
static USHORT mktbl(void);
USHORT make_table(USHORT nchar, UCHAR bitlen[],USHORT tablebits, USHORT table[]){
n = avail = nchar;
blen = bitlen;
tbl = table;
tblsiz = (USHORT) (1U << tablebits);
bit = (USHORT) (tblsiz / 2);
maxdepth = (USHORT)(tablebits + 1);
depth = len = 1;
c = -1;
codeword = 0;
TabErr = 0;
mktbl(); /* left subtree */
if (TabErr) return TabErr;
mktbl(); /* right subtree */
if (TabErr) return TabErr;
if (codeword != tblsiz) return 5;
return 0;
}
static USHORT mktbl(void){
USHORT i=0;
if (TabErr) return 0;
if (len == depth) {
while (++c < n)
if (blen[c] == len) {
i = codeword;
codeword += bit;
if (codeword > tblsiz) {
TabErr=1;
return 0;
}
while (i < codeword) tbl[i++] = (USHORT)c;
return (USHORT)c;
}
c = -1;
len++;
bit >>= 1;
}
depth++;
if (depth < maxdepth) {
mktbl();
mktbl();
} else if (depth > 32) {
TabErr = 2;
return 0;
} else {
if ((i = avail++) >= 2 * n - 1) {
TabErr = 3;
return 0;
}
left[i] = mktbl();
right[i] = mktbl();
if (codeword >= tblsiz) {
TabErr = 4;
return 0;
}
if (depth == maxdepth) tbl[codeword++] = i;
}
depth--;
return i;
}

5
src/dms/maketbl.h Normal file
View File

@ -0,0 +1,5 @@
extern USHORT left[], right[];
USHORT make_table(USHORT nchar, UCHAR bitlen[], USHORT tablebits, USHORT table[]);

416
src/dms/pfile.c Normal file
View File

@ -0,0 +1,416 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Handles the processing of a single DMS archive
*
*/
#define HEADLEN 56
#define THLEN 20
#define TRACK_BUFFER_LEN 32000
#define TEMP_BUFFER_LEN 32000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "sysconfig.h"
#include "sysdeps.h"
#include "zfile.h"
#include "cdata.h"
#include "u_init.h"
#include "u_rle.h"
#include "u_quick.h"
#include "u_medium.h"
#include "u_deep.h"
#include "u_heavy.h"
#include "crc_csum.h"
#include "pfile.h"
static USHORT Process_Track(struct zfile *, struct zfile *, UCHAR *, UCHAR *, USHORT, USHORT, USHORT);
static USHORT Unpack_Track(UCHAR *, UCHAR *, USHORT, USHORT, UCHAR, UCHAR);
static void printbandiz(UCHAR *, USHORT);
static void dms_decrypt(UCHAR *, USHORT);
static char modes[7][7]={"NOCOMP","SIMPLE","QUICK ","MEDIUM","DEEP ","HEAVY1","HEAVY2"};
static USHORT PWDCRC;
UCHAR *text;
USHORT DMS_Process_File(struct zfile *fi, struct zfile *fo, USHORT cmd, USHORT opt, USHORT PCRC, USHORT pwd){
USHORT from, to, geninfo, c_version, cmode, hcrc, disktype, pv, ret;
ULONG pkfsize, unpkfsize;
UCHAR *b1, *b2;
time_t date;
b1 = (UCHAR *)calloc((size_t)TRACK_BUFFER_LEN,1);
if (!b1) return ERR_NOMEMORY;
b2 = (UCHAR *)calloc((size_t)TRACK_BUFFER_LEN,1);
if (!b2) {
free(b1);
return ERR_NOMEMORY;
}
text = (UCHAR *)calloc((size_t)TEMP_BUFFER_LEN,1);
if (!text) {
free(b1);
free(b2);
return ERR_NOMEMORY;
}
/* if iname is NULL, input is stdin; if oname is NULL, output is stdout */
if (zfile_fread(b1,1,HEADLEN,fi) != HEADLEN) {
free(b1);
free(b2);
free(text);
return ERR_SREAD;
}
if ( (b1[0] != 'D') || (b1[1] != 'M') || (b1[2] != 'S') || (b1[3] != '!') ) {
/* Check the first 4 bytes of file to see if it is "DMS!" */
free(b1);
free(b2);
free(text);
return ERR_NOTDMS;
}
hcrc = (USHORT)((b1[HEADLEN-2]<<8) | b1[HEADLEN-1]);
/* Header CRC */
if (hcrc != CreateCRC(b1+4,(ULONG)(HEADLEN-6))) {
free(b1);
free(b2);
free(text);
return ERR_HCRC;
}
geninfo = (USHORT) ((b1[10]<<8) | b1[11]); /* General info about archive */
date = (time_t) ((((ULONG)b1[12])<<24) | (((ULONG)b1[13])<<16) | (((ULONG)b1[14])<<8) | (ULONG)b1[15]); /* date in standard UNIX/ANSI format */
from = (USHORT) ((b1[16]<<8) | b1[17]); /* Lowest track in archive. May be incorrect if archive is "appended" */
to = (USHORT) ((b1[18]<<8) | b1[19]); /* Highest track in archive. May be incorrect if archive is "appended" */
pkfsize = (ULONG) ((((ULONG)b1[21])<<16) | (((ULONG)b1[22])<<8) | (ULONG)b1[23]); /* Length of total packed data as in archive */
unpkfsize = (ULONG) ((((ULONG)b1[25])<<16) | (((ULONG)b1[26])<<8) | (ULONG)b1[27]); /* Length of unpacked data. Usually 901120 bytes */
c_version = (USHORT) ((b1[46]<<8) | b1[47]); /* version of DMS used to generate it */
disktype = (USHORT) ((b1[50]<<8) | b1[51]); /* Type of compressed disk */
cmode = (USHORT) ((b1[52]<<8) | b1[53]); /* Compression mode mostly used in this archive */
PWDCRC = PCRC;
if ( (cmd == CMD_VIEW) || (cmd == CMD_VIEWFULL) ) {
pv = (USHORT)(c_version/100);
write_log(" Created with DMS version %d.%02d ",pv,c_version-pv*100);
if (geninfo & 0x80)
write_log("Registered\n");
else
write_log("Evaluation\n");
write_log(" Creation date : %s",ctime(&date));
write_log(" Lowest track in archive : %d\n",from);
write_log(" Highest track in archive : %d\n",to);
write_log(" Packed data size : %lu\n",pkfsize);
write_log(" Unpacked data size : %lu\n",unpkfsize);
write_log(" Disk type of archive : ");
/* The original DMS from SDS software (DMS up to 1.11) used other values */
/* in disk type to indicate formats as MS-DOS, AMax and Mac, but it was */
/* not suported for compression. It was for future expansion and was never */
/* used. The newer versions of DMS made by ParCon Software changed it to */
/* add support for new Amiga disk types. */
switch (disktype) {
case 0:
case 1:
/* Can also be a non-dos disk */
write_log("AmigaOS 1.0 OFS\n");
break;
case 2:
write_log("AmigaOS 2.0 FFS\n");
break;
case 3:
write_log("AmigaOS 3.0 OFS / International\n");
break;
case 4:
write_log("AmigaOS 3.0 FFS / International\n");
break;
case 5:
write_log("AmigaOS 3.0 OFS / Dir Cache\n");
break;
case 6:
write_log("AmigaOS 3.0 FFS / Dir Cache\n");
break;
case 7:
write_log("FMS Amiga System File\n");
break;
default:
write_log("Unknown\n");
}
write_log(" Compression mode used : ");
if (cmode>6)
write_log("Unknown !\n");
else
write_log("%s\n",modes[cmode]);
write_log(" General info : ");
if ((geninfo==0)||(geninfo==0x80)) write_log("None");
if (geninfo & 1) write_log("NoZero ");
if (geninfo & 2) write_log("Encrypted ");
if (geninfo & 4) write_log("Appends ");
if (geninfo & 8) write_log("Banner ");
if (geninfo & 16) write_log("HD ");
if (geninfo & 32) write_log("MS-DOS ");
if (geninfo & 64) write_log("DMS_DEV_Fixed ");
if (geninfo & 256) write_log("FILEID.DIZ");
write_log("\n");
write_log(" Info Header CRC : %04X\n\n",hcrc);
}
if (disktype == 7) {
/* It's not a DMS compressed disk image, but a FMS archive */
free(b1);
free(b2);
free(text);
return ERR_FMS;
}
if (cmd == CMD_VIEWFULL) {
write_log(" Track Plength Ulength Cmode USUM HCRC DCRC Cflag\n");
write_log(" ------ ------- ------- ------ ---- ---- ---- -----\n");
}
if (((cmd==CMD_UNPACK) || (cmd==CMD_SHOWBANNER)) && (geninfo & 2) && (!pwd))
return ERR_NOPASSWD;
ret=NO_PROBLEM;
Init_Decrunchers();
if (cmd != CMD_VIEW) {
if (cmd == CMD_SHOWBANNER) /* Banner is in the first track */
ret = Process_Track(fi,NULL,b1,b2,cmd,opt,(geninfo & 2)?pwd:0);
else {
while ( (ret=Process_Track(fi,fo,b1,b2,cmd,opt,(geninfo & 2)?pwd:0)) == NO_PROBLEM ) ;
}
}
if ((cmd == CMD_VIEWFULL) || (cmd == CMD_SHOWDIZ) || (cmd == CMD_SHOWBANNER)) write_log("\n");
if (ret == DMS_FILE_END) ret = NO_PROBLEM;
/* Used to give an error message, but I have seen some DMS */
/* files with texts or zeros at the end of the valid data */
/* So, when we find something that is not a track header, */
/* we suppose that the valid data is over. And say it's ok. */
if (ret == ERR_NOTTRACK) ret = NO_PROBLEM;
free(b1);
free(b2);
free(text);
return ret;
}
static USHORT Process_Track(struct zfile *fi, struct zfile *fo, UCHAR *b1, UCHAR *b2, USHORT cmd, USHORT opt, USHORT pwd){
USHORT hcrc, dcrc, usum, number, pklen1, pklen2, unpklen, l, r;
UCHAR cmode, flags;
l = (USHORT)zfile_fread(b1,1,THLEN,fi);
if (l != THLEN) {
if (l==0)
return DMS_FILE_END;
else
return ERR_SREAD;
}
/* "TR" identifies a Track Header */
if ((b1[0] != 'T')||(b1[1] != 'R')) return ERR_NOTTRACK;
/* Track Header CRC */
hcrc = (USHORT)((b1[THLEN-2] << 8) | b1[THLEN-1]);
if (CreateCRC(b1,(ULONG)(THLEN-2)) != hcrc) return ERR_THCRC;
number = (USHORT)((b1[2] << 8) | b1[3]); /* Number of track */
pklen1 = (USHORT)((b1[6] << 8) | b1[7]); /* Length of packed track data as in archive */
pklen2 = (USHORT)((b1[8] << 8) | b1[9]); /* Length of data after first unpacking */
unpklen = (USHORT)((b1[10] << 8) | b1[11]); /* Length of data after subsequent rle unpacking */
flags = b1[12]; /* control flags */
cmode = b1[13]; /* compression mode used */
usum = (USHORT)((b1[14] << 8) | b1[15]); /* Track Data CheckSum AFTER unpacking */
dcrc = (USHORT)((b1[16] << 8) | b1[17]); /* Track Data CRC BEFORE unpacking */
if (cmd == CMD_VIEWFULL) {
if (number==80)
write_log(" FileID ");
else if (number==0xffff)
write_log(" Banner ");
else if ((number==0) && (unpklen==1024))
write_log(" FakeBB ");
else
write_log(" %2d ",(short)number);
write_log("%5d %5d %s %04X %04X %04X %0d\n", pklen1, unpklen, modes[cmode], usum, hcrc, dcrc, flags);
}
if ((pklen1 > TRACK_BUFFER_LEN) || (pklen2 >TRACK_BUFFER_LEN) || (unpklen > TRACK_BUFFER_LEN)) return ERR_BIGTRACK;
if (zfile_fread(b1,1,(size_t)pklen1,fi) != pklen1) return ERR_SREAD;
if (CreateCRC(b1,(ULONG)pklen1) != dcrc) return ERR_TDCRC;
/* track 80 is FILEID.DIZ, track 0xffff (-1) is Banner */
/* and track 0 with 1024 bytes only is a fake boot block with more advertising */
/* FILE_ID.DIZ is never encrypted */
if (pwd && (number!=80)) dms_decrypt(b1,pklen1);
if ((cmd == CMD_UNPACK) && (number<80) && (unpklen>2048)) {
r = Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags);
if (r != NO_PROBLEM)
if (pwd)
return ERR_BADPASSWD;
else
return r;
if (usum != Calc_CheckSum(b2,(ULONG)unpklen))
if (pwd)
return ERR_BADPASSWD;
else
return ERR_CSUM;
if (zfile_fwrite(b2,1,(size_t)unpklen,fo) != unpklen) return ERR_CANTWRITE;
}
if ((cmd == CMD_SHOWBANNER) && (number == 0xffff)){
r = Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags);
if (r != NO_PROBLEM)
if (pwd)
return ERR_BADPASSWD;
else
return r;
if (usum != Calc_CheckSum(b2,(ULONG)unpklen))
if (pwd)
return ERR_BADPASSWD;
else
return ERR_CSUM;
printbandiz(b2,unpklen);
}
if ((cmd == CMD_SHOWDIZ) && (number == 80)) {
r = Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags);
if (r != NO_PROBLEM) return r;
if (usum != Calc_CheckSum(b2,(ULONG)unpklen)) return ERR_CSUM;
printbandiz(b2,unpklen);
}
return NO_PROBLEM;
}
static USHORT Unpack_Track(UCHAR *b1, UCHAR *b2, USHORT pklen2, USHORT unpklen, UCHAR cmode, UCHAR flags){
switch (cmode){
case 0:
/* No Compression */
memcpy(b2,b1,(size_t)unpklen);
break;
case 1:
/* Simple Compression */
if (Unpack_RLE(b1,b2,unpklen)) return ERR_BADDECR;
break;
case 2:
/* Quick Compression */
if (Unpack_QUICK(b1,b2,pklen2)) return ERR_BADDECR;
if (Unpack_RLE(b2,b1,unpklen)) return ERR_BADDECR;
memcpy(b2,b1,(size_t)unpklen);
break;
case 3:
/* Medium Compression */
if (Unpack_MEDIUM(b1,b2,pklen2)) return ERR_BADDECR;
if (Unpack_RLE(b2,b1,unpklen)) return ERR_BADDECR;
memcpy(b2,b1,(size_t)unpklen);
break;
case 4:
/* Deep Compression */
if (Unpack_DEEP(b1,b2,pklen2)) return ERR_BADDECR;
if (Unpack_RLE(b2,b1,unpklen)) return ERR_BADDECR;
memcpy(b2,b1,(size_t)unpklen);
break;
case 5:
case 6:
/* Heavy Compression */
if (cmode==5) {
/* Heavy 1 */
if (Unpack_HEAVY(b1,b2,flags & 7,pklen2)) return ERR_BADDECR;
} else {
/* Heavy 2 */
if (Unpack_HEAVY(b1,b2,flags | 8,pklen2)) return ERR_BADDECR;
}
if (flags & 4) {
/* Unpack with RLE only if this flag is set */
if (Unpack_RLE(b2,b1,unpklen)) return ERR_BADDECR;
memcpy(b2,b1,(size_t)unpklen);
}
break;
default:
return ERR_UNKNMODE;
}
if (!(flags & 1)) Init_Decrunchers();
return NO_PROBLEM;
}
/* DMS uses a lame encryption */
static void dms_decrypt(UCHAR *p, USHORT len){
USHORT t;
while (len--){
t = (USHORT) *p;
*p++ ^= (UCHAR)PWDCRC;
PWDCRC = (USHORT)((PWDCRC >> 1) + t);
}
}
static void printbandiz(UCHAR *m, USHORT len){
UCHAR *i,*j;
i=j=m;
while (i<m+len) {
if (*i == 10) {
*i=0;
write_log("%s\n",j);
j=i+1;
}
i++;
}
}

43
src/dms/pfile.h Normal file
View File

@ -0,0 +1,43 @@
/* Functions return codes */
#define NO_PROBLEM 0
#define DMS_FILE_END 1
#define ERR_NOMEMORY 2
#define ERR_CANTOPENIN 3
#define ERR_CANTOPENOUT 4
#define ERR_NOTDMS 5
#define ERR_SREAD 6
#define ERR_HCRC 7
#define ERR_NOTTRACK 8
#define ERR_BIGTRACK 9
#define ERR_THCRC 10
#define ERR_TDCRC 11
#define ERR_CSUM 12
#define ERR_CANTWRITE 13
#define ERR_BADDECR 14
#define ERR_UNKNMODE 15
#define ERR_NOPASSWD 16
#define ERR_BADPASSWD 17
#define ERR_FMS 18
#define ERR_GZIP 19
#define ERR_READDISK 20
/* Command to execute */
#define CMD_VIEW 1
#define CMD_VIEWFULL 2
#define CMD_SHOWDIZ 3
#define CMD_SHOWBANNER 4
#define CMD_TEST 5
#define CMD_UNPACK 6
#define CMD_UNPKGZ 7
#define CMD_EXTRACT 8
#define OPT_VERBOSE 1
#define OPT_QUIET 2
USHORT DMS_Process_File(struct zfile *, struct zfile *, USHORT, USHORT, USHORT, USHORT);

87
src/dms/tables.c Normal file
View File

@ -0,0 +1,87 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Tables used in Medium and Deep compression modes
*
*/
#include "cdata.h"
#include "tables.h"
UCHAR d_code[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D,
0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F,
0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11,
0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13,
0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15,
0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17,
0x18, 0x18, 0x19, 0x19, 0x1A, 0x1A, 0x1B, 0x1B,
0x1C, 0x1C, 0x1D, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F,
0x20, 0x20, 0x21, 0x21, 0x22, 0x22, 0x23, 0x23,
0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27,
0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B,
0x2C, 0x2C, 0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
};
UCHAR d_len[256] = {
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
};

3
src/dms/tables.h Normal file
View File

@ -0,0 +1,3 @@
extern UCHAR d_code[], d_len[];

207
src/dms/u_deep.c Normal file
View File

@ -0,0 +1,207 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Lempel-Ziv-DynamicHuffman decompression functions used in Deep
* mode.
* Most routines ripped from LZHUF written by Haruyasu Yoshizaki
*
*/
#include <string.h>
#include "cdata.h"
#include "tables.h"
#include "u_deep.h"
#include "getbits.h"
INLINE USHORT DecodeChar(void);
INLINE USHORT DecodePosition(void);
INLINE void update(USHORT c);
static void reconst(void);
USHORT deep_text_loc;
int init_deep_tabs=1;
#define DBITMASK 0x3fff /* uses 16Kb dictionary */
#define F 60 /* lookahead buffer size */
#define THRESHOLD 2
#define N_CHAR (256 - THRESHOLD + F) /* kinds of characters (character code = 0..N_CHAR-1) */
#define T (N_CHAR * 2 - 1) /* size of table */
#define R (T - 1) /* position of root */
#define MAX_FREQ 0x8000 /* updates tree when the */
USHORT freq[T + 1]; /* frequency table */
USHORT prnt[T + N_CHAR]; /* pointers to parent nodes, except for the */
/* elements [T..T + N_CHAR - 1] which are used to get */
/* the positions of leaves corresponding to the codes. */
USHORT son[T]; /* pointers to child nodes (son[], son[] + 1) */
void Init_DEEP_Tabs(void){
USHORT i, j;
for (i = 0; i < N_CHAR; i++) {
freq[i] = 1;
son[i] = (USHORT)(i + T);
prnt[i + T] = i;
}
i = 0; j = N_CHAR;
while (j <= R) {
freq[j] = (USHORT) (freq[i] + freq[i + 1]);
son[j] = i;
prnt[i] = prnt[i + 1] = j;
i += 2; j++;
}
freq[T] = 0xffff;
prnt[R] = 0;
init_deep_tabs = 0;
}
USHORT Unpack_DEEP(UCHAR *in, UCHAR *out, USHORT origsize){
USHORT i, j, c;
UCHAR *outend;
initbitbuf(in);
if (init_deep_tabs) Init_DEEP_Tabs();
outend = out+origsize;
while (out < outend) {
c = DecodeChar();
if (c < 256) {
*out++ = text[deep_text_loc++ & DBITMASK] = (UCHAR)c;
} else {
j = (USHORT) (c - 255 + THRESHOLD);
i = (USHORT) (deep_text_loc - DecodePosition() - 1);
while (j--) *out++ = text[deep_text_loc++ & DBITMASK] = text[i++ & DBITMASK];
}
}
deep_text_loc = (USHORT)((deep_text_loc+60) & DBITMASK);
return 0;
}
INLINE USHORT DecodeChar(void){
USHORT c;
c = son[R];
/* travel from root to leaf, */
/* choosing the smaller child node (son[]) if the read bit is 0, */
/* the bigger (son[]+1} if 1 */
while (c < T) {
c = son[c + GETBITS(1)];
DROPBITS(1);
}
c -= T;
update(c);
return c;
}
INLINE USHORT DecodePosition(void){
USHORT i, j, c;
i = GETBITS(8); DROPBITS(8);
c = (USHORT) (d_code[i] << 8);
j = d_len[i];
i = (USHORT) (((i << j) | GETBITS(j)) & 0xff); DROPBITS(j);
return (USHORT) (c | i) ;
}
/* reconstruction of tree */
static void reconst(void){
USHORT i, j, k, f, l;
/* collect leaf nodes in the first half of the table */
/* and replace the freq by (freq + 1) / 2. */
j = 0;
for (i = 0; i < T; i++) {
if (son[i] >= T) {
freq[j] = (USHORT) ((freq[i] + 1) / 2);
son[j] = son[i];
j++;
}
}
/* begin constructing tree by connecting sons */
for (i = 0, j = N_CHAR; j < T; i += 2, j++) {
k = (USHORT) (i + 1);
f = freq[j] = (USHORT) (freq[i] + freq[k]);
for (k = (USHORT)(j - 1); f < freq[k]; k--);
k++;
l = (USHORT)((j - k) * 2);
memmove(&freq[k + 1], &freq[k], (size_t)l);
freq[k] = f;
memmove(&son[k + 1], &son[k], (size_t)l);
son[k] = i;
}
/* connect prnt */
for (i = 0; i < T; i++) {
if ((k = son[i]) >= T) {
prnt[k] = i;
} else {
prnt[k] = prnt[k + 1] = i;
}
}
}
/* increment frequency of given code by one, and update tree */
INLINE void update(USHORT c){
USHORT i, j, k, l;
if (freq[R] == MAX_FREQ) {
reconst();
}
c = prnt[c + T];
do {
k = ++freq[c];
/* if the order is disturbed, exchange nodes */
if (k > freq[l = (USHORT)(c + 1)]) {
while (k > freq[++l]);
l--;
freq[c] = freq[l];
freq[l] = k;
i = son[c];
prnt[i] = l;
if (i < T) prnt[i + 1] = l;
j = son[l];
son[l] = i;
prnt[j] = c;
if (j < T) prnt[j + 1] = c;
son[c] = j;
c = l;
}
} while ((c = prnt[c]) != 0); /* repeat up to root */
}

7
src/dms/u_deep.h Normal file
View File

@ -0,0 +1,7 @@
USHORT Unpack_DEEP(UCHAR *, UCHAR *, USHORT);
extern int init_deep_tabs;
extern USHORT deep_text_loc;

175
src/dms/u_heavy.c Normal file
View File

@ -0,0 +1,175 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Lempel-Ziv-Huffman decompression functions used in Heavy 1 & 2
* compression modes. Based on LZH decompression functions from
* UNIX LHA made by Masaru Oki
*
*/
#include "cdata.h"
#include "u_heavy.h"
#include "getbits.h"
#include "maketbl.h"
#define NC 510
#define NPT 20
#define N1 510
#define OFFSET 253
USHORT left[2 * NC - 1], right[2 * NC - 1 + 9];
static UCHAR c_len[NC], pt_len[NPT];
static USHORT c_table[4096], pt_table[256];
static USHORT lastlen, np;
USHORT heavy_text_loc;
static USHORT read_tree_c(void);
static USHORT read_tree_p(void);
INLINE USHORT decode_c(void);
INLINE USHORT decode_p(void);
USHORT Unpack_HEAVY(UCHAR *in, UCHAR *out, UCHAR flags, USHORT origsize){
USHORT j, i, c, bitmask;
UCHAR *outend;
/* Heavy 1 uses a 4Kb dictionary, Heavy 2 uses 8Kb */
if (flags & 8) {
np = 15;
bitmask = 0x1fff;
} else {
np = 14;
bitmask = 0x0fff;
}
initbitbuf(in);
if (flags & 2) {
if (read_tree_c()) return 1;
if (read_tree_p()) return 2;
}
outend = out+origsize;
while (out<outend) {
c = decode_c();
if (c < 256) {
*out++ = text[heavy_text_loc++ & bitmask] = (UCHAR)c;
} else {
j = (USHORT) (c - OFFSET);
i = (USHORT) (heavy_text_loc - decode_p() - 1);
while(j--) *out++ = text[heavy_text_loc++ & bitmask] = text[i++ & bitmask];
}
}
return 0;
}
INLINE USHORT decode_c(void){
USHORT i, j, m;
j = c_table[GETBITS(12)];
if (j < N1) {
DROPBITS(c_len[j]);
} else {
DROPBITS(12);
i = GETBITS(16);
m = 0x8000;
do {
if (i & m) j = right[j];
else j = left [j];
m >>= 1;
} while (j >= N1);
DROPBITS(c_len[j] - 12);
}
return j;
}
INLINE USHORT decode_p(void){
USHORT i, j, m;
j = pt_table[GETBITS(8)];
if (j < np) {
DROPBITS(pt_len[j]);
} else {
DROPBITS(8);
i = GETBITS(16);
m = 0x8000;
do {
if (i & m) j = right[j];
else j = left [j];
m >>= 1;
} while (j >= np);
DROPBITS(pt_len[j] - 8);
}
if (j != np-1) {
if (j > 0) {
j = (USHORT)(GETBITS(i=(USHORT)(j-1)) | (1U << (j-1)));
DROPBITS(i);
}
lastlen=j;
}
return lastlen;
}
static USHORT read_tree_c(void){
USHORT i,n;
n = GETBITS(9);
DROPBITS(9);
if (n>0){
for (i=0; i<n; i++) {
c_len[i] = (UCHAR)GETBITS(5);
DROPBITS(5);
}
for (i=n; i<510; i++) c_len[i] = 0;
if (make_table(510,c_len,12,c_table)) return 1;
} else {
n = GETBITS(9);
DROPBITS(9);
for (i=0; i<510; i++) c_len[i] = 0;
for (i=0; i<4096; i++) c_table[i] = n;
}
return 0;
}
static USHORT read_tree_p(void){
USHORT i,n;
n = GETBITS(5);
DROPBITS(5);
if (n>0){
for (i=0; i<n; i++) {
pt_len[i] = (UCHAR)GETBITS(4);
DROPBITS(4);
}
for (i=n; i<np; i++) pt_len[i] = 0;
if (make_table(np,pt_len,8,pt_table)) return 1;
} else {
n = GETBITS(5);
DROPBITS(5);
for (i=0; i<np; i++) pt_len[i] = 0;
for (i=0; i<256; i++) pt_table[i] = n;
}
return 0;
}

6
src/dms/u_heavy.h Normal file
View File

@ -0,0 +1,6 @@
USHORT Unpack_HEAVY(UCHAR *, UCHAR *, UCHAR, USHORT);
extern USHORT heavy_text_loc;

28
src/dms/u_init.c Normal file
View File

@ -0,0 +1,28 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Decruncher reinitialization
*
*/
#include <string.h>
#include "cdata.h"
#include "u_init.h"
#include "u_quick.h"
#include "u_medium.h"
#include "u_deep.h"
#include "u_heavy.h"
void Init_Decrunchers(void){
quick_text_loc = 251;
medium_text_loc = 0x3fbe;
heavy_text_loc = 0;
deep_text_loc = 0x3fc4;
init_deep_tabs = 1;
memset(text,0,0x3fc8);
}

3
src/dms/u_init.h Normal file
View File

@ -0,0 +1,3 @@
void Init_Decrunchers(void);

58
src/dms/u_medium.c Normal file
View File

@ -0,0 +1,58 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Main decompression functions used in MEDIUM mode
*
*/
#include <string.h>
#include "cdata.h"
#include "u_medium.h"
#include "getbits.h"
#include "tables.h"
#define MBITMASK 0x3fff
USHORT medium_text_loc;
USHORT Unpack_MEDIUM(UCHAR *in, UCHAR *out, USHORT origsize){
USHORT i, j, c;
UCHAR u, *outend;
initbitbuf(in);
outend = out+origsize;
while (out < outend) {
if (GETBITS(1)!=0) {
DROPBITS(1);
*out++ = text[medium_text_loc++ & MBITMASK] = (UCHAR)GETBITS(8);
DROPBITS(8);
} else {
DROPBITS(1);
c = GETBITS(8); DROPBITS(8);
j = (USHORT) (d_code[c]+3);
u = d_len[c];
c = (USHORT) (((c << u) | GETBITS(u)) & 0xff); DROPBITS(u);
u = d_len[c];
c = (USHORT) ((d_code[c] << 8) | (((c << u) | GETBITS(u)) & 0xff)); DROPBITS(u);
i = (USHORT) (medium_text_loc - c - 1);
while(j--) *out++ = text[medium_text_loc++ & MBITMASK] = text[i++ & MBITMASK];
}
}
medium_text_loc = (USHORT)((medium_text_loc+66) & MBITMASK);
return 0;
}

5
src/dms/u_medium.h Normal file
View File

@ -0,0 +1,5 @@
USHORT Unpack_MEDIUM(UCHAR *, UCHAR *, USHORT);
extern USHORT medium_text_loc;

47
src/dms/u_quick.c Normal file
View File

@ -0,0 +1,47 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
*
*/
#include <string.h>
#include "cdata.h"
#include "u_quick.h"
#include "getbits.h"
#define QBITMASK 0xff
USHORT quick_text_loc;
USHORT Unpack_QUICK(UCHAR *in, UCHAR *out, USHORT origsize){
USHORT i, j;
UCHAR *outend;
initbitbuf(in);
outend = out+origsize;
while (out < outend) {
if (GETBITS(1)!=0) {
DROPBITS(1);
*out++ = text[quick_text_loc++ & QBITMASK] = (UCHAR)GETBITS(8); DROPBITS(8);
} else {
DROPBITS(1);
j = (USHORT) (GETBITS(2)+2); DROPBITS(2);
i = (USHORT) (quick_text_loc - GETBITS(8) - 1); DROPBITS(8);
while(j--) {
*out++ = text[quick_text_loc++ & QBITMASK] = text[i++ & QBITMASK];
}
}
}
quick_text_loc = (USHORT)((quick_text_loc+5) & QBITMASK);
return 0;
}

5
src/dms/u_quick.h Normal file
View File

@ -0,0 +1,5 @@
USHORT Unpack_QUICK(UCHAR *, UCHAR *, USHORT);
extern USHORT quick_text_loc;

42
src/dms/u_rle.c Normal file
View File

@ -0,0 +1,42 @@
/*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
*
* Run Length Encoding decompression function used in most
* modes after decompression by other algorithm
*
*/
#include <string.h>
#include "cdata.h"
#include "u_rle.h"
USHORT Unpack_RLE(UCHAR *in, UCHAR *out, USHORT origsize){
USHORT n;
UCHAR a,b, *outend;
outend = out+origsize;
while (out<outend){
if ((a = *in++) != 0x90)
*out++ = a;
else if (!(b = *in++))
*out++ = a;
else {
a = *in++;
if (b == 0xff) {
n = *in++;
n = (USHORT)((n<<8) + *in++);
} else
n = b;
if (out+n > outend) return 1;
memset(out,a,(size_t) n);
out += n;
}
}
return 0;
}

3
src/dms/u_rle.h Normal file
View File

@ -0,0 +1,3 @@
USHORT Unpack_RLE(UCHAR *, UCHAR *, USHORT);

Some files were not shown because too many files have changed in this diff Show More