From bb717201a434ee60b5c6f0ed41c4e66f43cb2e44 Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Sat, 25 Jan 2014 11:19:44 +0000 Subject: [PATCH] Update to E-UAE 0.8.29 (only the relevant files for WII port) --- Makefile.wii | 6 +- README | 69 ++-- docs/compiling.txt | 25 +- docs/configuration.txt | 7 - docs/make_hdf.txt | 55 +++ src/audio.c | 229 ++--------- src/blitter.c | 30 +- src/caps/caps.c | 94 +++-- src/cfgfile.c | 30 +- src/compemu_support.c | 29 +- src/custom.c | 250 ++++++------ src/disk.c | 151 ++++---- src/drawing.c | 46 +-- src/filesys.asm | 23 +- src/filesys_bootrom.c | 349 ++++++++--------- src/genblitter.c | 25 +- src/gfx-sdl/sdlgfx.c | 4 +- src/hardfile.c | 23 +- src/hardfile_unix.c | 22 +- src/include/autoconf.h | 1 + src/include/commpipe.h | 8 +- src/include/filesys.h | 4 + src/include/gensound.h | 5 - src/include/options.h | 845 ++++++++++++++++++++--------------------- src/include/sysdeps.h | 2 +- src/include/version.h | 17 +- src/inputdevice.c | 4 + src/keybuf.c | 10 +- src/main.c | 53 +-- src/make_hdf.c | 184 +++++++++ src/misc.c | 38 +- src/newcpu.c | 43 ++- src/picasso96.c | 205 ++++++---- src/sd-sdl/sound.c | 479 ++++++++++++----------- src/sd-sdl/sound.h | 3 - src/sysconfig.h.in | 37 +- src/sysconfig.h.wii | 156 ++++---- src/tools/Makefile.wii | 18 +- src/tools/sysconfig.h | 8 +- src/uaelib.c | 2 + 40 files changed, 1888 insertions(+), 1701 deletions(-) create mode 100644 docs/make_hdf.txt create mode 100644 src/make_hdf.c diff --git a/Makefile.wii b/Makefile.wii index 820e27e..d3e3341 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -29,6 +29,7 @@ SRCS := $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/caps/*.c $(SRC_DIR)/dms/*.c $(SRC_D $(SRC_DIR)/gfxdep/sdlkeys.c \ $(SRC_DIR)/guidep/gui-sdl.c \ $(SRC_DIR)/guidep/menu.c \ + $(SRC_DIR)/guidep/VirtualKeyboard.c \ $(SRC_DIR)/joydep/joystick.c \ $(SRC_DIR)/machdep/support.c \ $(SRC_DIR)/osdep/main.c \ @@ -61,6 +62,7 @@ SRCS := $(filter-out \ src/gengenblitter.c \ src/genlinetoscr.c \ src/linetoscr.c \ + src/make_hdf.c \ src/readdisk.c \ src/scsiemul.c \ src/svgancui.c \ @@ -70,7 +72,7 @@ SRCS := $(filter-out \ genlinetoscr_args="-b" # Library object files. -OBJS := $(subst $(SRC_DIR),$(OBJ_DIR),$(SRCS:.c=.o)) $(OBJ_DIR)/guidep/VirtualKeyboard.o +OBJS := $(subst $(SRC_DIR),$(OBJ_DIR),$(SRCS:.c=.o)) # Test source files. # It can be useful to switch this variable around to select individual tests which are problematic. @@ -165,7 +167,7 @@ uae.dol: uae.elf @echo ---- # Compilation flags. -COMMON_FLAGS := -g -O2 -ftree-vectorize -ffast-math -pipe -fomit-frame-pointer -fdiagnostics-show-option $(MACHDEP) -Wall -Wno-unused -Wno-format +COMMON_FLAGS := -g -O2 -ftree-vectorize -ffast-math -pipe -fdiagnostics-show-option $(MACHDEP) -Wall -Wno-unused -Wno-format INCLUDES := -Isrc/md-generic/ -Isrc/include -Isrc -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/SDL -I$(PORTLIBS)/include DEFINES := -DOS_WITHOUT_MEMORY_MANAGEMENT -DSAVESTATE -DUSE_SDL -DSUPPORT_THREADS -DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 \ -DFPUEMU -DAGA -DAUTOCONFIG -DFILESYS \ diff --git a/README b/README index 9cd0b73..babd90a 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -E-UAE 0.8.29-WIP4 -================= +E-UAE 0.8.29 +============ 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 @@ -40,43 +40,42 @@ 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 +What's new since 0.8.29-WIP4 ============================ -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: +New features: +* Added a command-line tool for generating blank hardfile images, + called make_hdf +* Support for IPF floppy images now supported on OS X (and officially + on AMD64/Linux now that libcapsimage is publically available). Go to + http://www.softpres.org/ to download the plug-in. +* X-Arcade joystick supported (thanks to Robert Hurst for the patch). +* Build scripts now include a compile-time option --disable-fpu to + disable building of FPU emulation. -* 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). +Performance improvements: +* Some small custom chip and blitter tweaks merged from WinUAE 1.4.3. +* Some minor performance optimizations to blitter emulation, floppy + controller emulation and rendering code. (Thanks to Mustafa Tufan, + developer of PSP and GP2x ports of E-UAE, for a couple of these). +Bug fixes: +* Version 0.8.29-WIP4 broke the interrupt controller emulation. Fixed. + This also makes Action Replay cartridge emulation work again. +* HDToolbox would hang when scanning for hard drives. Mostly fixed (I + still have one unreproducible report of HDToolbox hanging). +* Hardfile emulation will no longer leak threads following a reset + This also fixes crashes on exit on AmigaOS and clone hosts. +* Building on MacOS X no longer fails when building supporting tools + like readdisk. +* Exiting E-UAE on OS X when started from Hi-Toro would cause 'load + config file' dialog to be displayed. Fixed. +* BeOS sound driver was broken in recent changes to audio layer. Now + fixed (fingers crossed). + +Other: + +* Removed support for 8-bit sound (since the official UAE did so). Still to do =========== diff --git a/docs/compiling.txt b/docs/compiling.txt index f1c4298..713255e 100644 --- a/docs/compiling.txt +++ b/docs/compiling.txt @@ -30,11 +30,26 @@ 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-fpu + Build CPU emulation with suppport for optional emulation of a math + coprocessor (Motoroloa 68881/2, etc.). Defaults to true. + +--enable-compatible-cpu + Build CPU emulation with support for optional emulation of + instruction prefetch. Defaults to true. + +--enable-cycle-exact-cpu + Build CPU/custom chip emulation with support for optional + cycle-exact emulation of interactions between the CPU and Amiga chip + set. Defaults to true. + --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. + Build CPU emulation with support for optional JIT compiler. The JIT + (which compiles 680x0 instructions to native instructions) is + currently only supported on x86 platforms. (It is 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 @@ -68,7 +83,7 @@ selecting what features are built into UAE. Here's a selection: --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). + (including Linux, Solaris and OS X). --with-caps Build with support for IPF (CAPS) images. This requires the IPF diff --git a/docs/configuration.txt b/docs/configuration.txt index ef20316..5b54bdd 100644 --- a/docs/configuration.txt +++ b/docs/configuration.txt @@ -708,13 +708,6 @@ sound_output= exact - audio emulation is enabled and exact output enabled. -sound_bits= - - Selects the resolution of audio output. 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= Selects the frequency of emulated audio output in Hertz. Typically, diff --git a/docs/make_hdf.txt b/docs/make_hdf.txt new file mode 100644 index 0000000..3d3345d --- /dev/null +++ b/docs/make_hdf.txt @@ -0,0 +1,55 @@ +make_hdf +======== + +make_hdf is a command-line tool for creating unformatted hard disk +images (hard files) for E-UAE (and other versions of UAE). It will +also print a config option that can be added to a UAE config file to +mount the created disk image. + +Usage +----- + +make_hdf accepts the following parameters: + +make_hdf [] + + The path to the file to create. Note that any directories + included in this path must already exist; make_hdf will not + create them for you. + + The size of the hard disk image to create in MB. Add a trailing + 'G' to the size to specify a size in GB or a 'K' for a size + in KB. + + Device name to be included in the generated config option. + This is optional and defaults to DH0: if omitted. + +Example +------- + +> make_hdf hdf/my_disk.hdf 2G DH5: + +Will generate a 1 GB disk as the file 'hdf/my_disk.hdf' and the +following config options are output (see configuration.txt). + +hardfile2=rw,DH5:hdf/my_disk.hdf,32,2,2,512,0, +hardfile=rw,32,2,2,512,hdf/my_disk.hdf + + +Limits +------ + +On systems that do not support large files sizes (i.e, systems without +support for 64-bit file sizes), make_hdf is limited to creating hard +files up to 2GB in size. + +On systems that do support large file sizes, make_hdf can create hard +files up to around 2TB in size (whether you can make use of disks that +in AmigaOS is another question). + +Sparse files +------------ + +Where supported (e.g., Linux, MacOS X), make_hdf will create sparse +files. This allows hard disk images which are not full to take up less +space on disk. diff --git a/src/audio.c b/src/audio.c index 637a589..12d4f25 100644 --- a/src/audio.c +++ b/src/audio.c @@ -56,8 +56,7 @@ static int debugchannel (unsigned int ch) #define SINC_QUEUE_LENGTH (SINC_QUEUE_MAX_AGE / MIN_ALLOWED_PERIOD + NUMBER_OF_CPU_UPDATES_ALLOWED) typedef struct { - int age; - int output; + int age, output; } sinc_queue_t; struct audio_channel_data { @@ -108,31 +107,18 @@ void init_sound_table16 (void) for (j = 0; j < 64; j++) sound_table[j][i] = j * (uae_s8)i * (currprefs.sound_stereo ? 2 : 1); } - -#ifdef HAVE_8BIT_AUDIO_SUPPORT -void init_sound_table8 (void) -{ - int i,j; - - for (i = 0; i < 256; i++) - for (j = 0; j < 64; j++) - sound_table[j][i] = (j * (uae_s8)i * (currprefs.sound_stereo ? 2 : 1)) / 256; -} -#endif #endif #ifdef MULTIPLICATION_PROFITABLE typedef uae_s8 sample8_t; #define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].vol; } while (0) -#define SBASEVAL8(logn) ((logn) == 1 ? SOUND8_BASE_VAL << 7 : SOUND8_BASE_VAL << 8) #define SBASEVAL16(logn) ((logn) == 1 ? SOUND16_BASE_VAL >> 1 : SOUND16_BASE_VAL) -#define FINISH_DATA(data,b,logn) do { if (14 - (b) + (logn) > 0) (data) >>= 14 - (b) + (logn); else (data) <<= (b) - 14 - (logn); } while (0); +#define FINISH_DATA(data, logn) do { (data) <<= 2 - (logn); } while (0); #else typedef uae_u8 sample8_t; #define DO_CHANNEL_1(v, c) do { (v) = audio_channel[c].voltbl[(v)]; } while (0) -#define SBASEVAL8(logn) SOUND8_BASE_VAL #define SBASEVAL16(logn) SOUND16_BASE_VAL -#define FINISH_DATA(data,b,logn) +#define FINISH_DATA(data, logn) #endif /* Always put the right word before the left word. */ @@ -154,7 +140,7 @@ STATIC_INLINE void put_sound_word_right (uae_u32 w) PUT_SOUND_WORD_RIGHT (w); } -STATIC_INLINE void put_sound_word_left (uae_u32 w) +STATIC_INLINE void put_sound_word_left (uae_u32 w) { if (mixed_on) { uae_u32 rold, lold, rnew, lnew, tmp; @@ -177,9 +163,6 @@ STATIC_INLINE void put_sound_word_left (uae_u32 w) } #endif -#define DO_CHANNEL(v, c) do { (v) &= audio_channel[c].adk_mask; data += v; } while (0); - - static void sinc_prehandler (unsigned long best_evtime) { @@ -208,7 +191,7 @@ static void sinc_prehandler (unsigned long best_evtime) } /* make room for new and add the new value */ memmove (&acd->sinc_queue[1], &acd->sinc_queue[0], - sizeof(acd->sinc_queue[0]) * acd->sinc_queue_length); + sizeof(acd->sinc_queue[0]) * acd->sinc_queue_length); acd->sinc_queue_length += 1; acd->sinc_queue[0].age = best_evtime; acd->sinc_queue[0].output = output - acd->sinc_output_state; @@ -242,14 +225,14 @@ STATIC_INLINE void samplexx_sinc_handler (int *datasp) winsinc = winsinc_integral[n]; for (i = 0; i < 4; i += 1) { - int j, v; - struct audio_channel_data *acd = &audio_channel[i]; - /* The sum rings with harmonic components up to infinity... */ + int j, v; + struct audio_channel_data *acd = &audio_channel[i]; + /* The sum rings with harmonic components up to infinity... */ int sum = acd->sinc_output_state << 17; - /* ...but we cancel them through mixing in BLEPs instead */ - for (j = 0; j < acd->sinc_queue_length; j += 1) - sum -= winsinc[acd->sinc_queue[j].age] * acd->sinc_queue[j].output; - v = sum >> 17; + /* ...but we cancel them through mixing in BLEPs instead */ + for (j = 0; j < acd->sinc_queue_length; j += 1) + sum -= winsinc[acd->sinc_queue[j].age] * acd->sinc_queue[j].output; + v = sum >> 17; if (v > 32767) v = 32767; else if (v < -32768) @@ -264,7 +247,7 @@ static void sample16i_sinc_handler (void) samplexx_sinc_handler (datas); data1 = datas[0] + datas[3] + datas[1] + datas[2]; - FINISH_DATA (data1, 16, 2); + FINISH_DATA (data1, 2); PUT_SOUND_WORD_MONO (data1); check_sound_buffers (); } @@ -288,7 +271,7 @@ void sample16_handler (void) data0 += data3; { uae_u32 data = SBASEVAL16(2) + data0; - FINISH_DATA (data, 16, 2); + FINISH_DATA (data, 2); PUT_SOUND_WORD_MONO (data); } check_sound_buffers (); @@ -337,9 +320,10 @@ static void sample16i_rh_handler (void) delta = audio_channel[3].per; ratio = ((audio_channel[3].evtime % delta) << 8) / delta; data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8; + { uae_u32 data = SBASEVAL16(2) + data0; - FINISH_DATA (data, 16, 2); + FINISH_DATA (data, 2); PUT_SOUND_WORD_MONO (data); } check_sound_buffers (); @@ -410,64 +394,13 @@ static void sample16i_crux_handler (void) data0 += data1; { uae_u32 data = SBASEVAL16(2) + data0; - FINISH_DATA (data, 16, 2); + FINISH_DATA (data, 2); PUT_SOUND_WORD_MONO (data); } check_sound_buffers (); } -#ifdef HAVE_8BIT_AUDIO_SUPPORT -void sample8_handler (void) -{ - uae_u32 data0 = audio_channel[0].current_sample; - uae_u32 data1 = audio_channel[1].current_sample; - uae_u32 data2 = audio_channel[2].current_sample; - uae_u32 data3 = audio_channel[3].current_sample; - DO_CHANNEL_1 (data0, 0); - DO_CHANNEL_1 (data1, 1); - DO_CHANNEL_1 (data2, 2); - DO_CHANNEL_1 (data3, 3); - data0 &= audio_channel[0].adk_mask; - data1 &= audio_channel[1].adk_mask; - data2 &= audio_channel[2].adk_mask; - data3 &= audio_channel[3].adk_mask; - data0 += data1; - data0 += data2; - data0 += data3; - { - uae_u32 data = SBASEVAL8(2) + data0; - FINISH_DATA (data, 8, 2); - PUT_SOUND_BYTE (data); - } - check_sound_buffers (); -} -#endif - #ifdef HAVE_STEREO_SUPPORT -void sample16ss_handler (void) -{ - uae_u32 data0 = audio_channel[0].current_sample; - uae_u32 data1 = audio_channel[1].current_sample; - uae_u32 data2 = audio_channel[2].current_sample; - uae_u32 data3 = audio_channel[3].current_sample; - DO_CHANNEL_1 (data0, 0); - DO_CHANNEL_1 (data1, 1); - DO_CHANNEL_1 (data2, 2); - DO_CHANNEL_1 (data3, 3); - - data0 &= audio_channel[0].adk_mask; - data1 &= audio_channel[1].adk_mask; - data2 &= audio_channel[2].adk_mask; - data3 &= audio_channel[3].adk_mask; - - PUT_SOUND_WORD (data0 << 2); - PUT_SOUND_WORD (data1 << 2); - PUT_SOUND_WORD (data3 << 2); - PUT_SOUND_WORD (data2 << 2); - - check_sound_buffers (); -} - static void sample16si_sinc_handler (void) { int datas[4], data1, data2; @@ -475,9 +408,9 @@ static void sample16si_sinc_handler (void) samplexx_sinc_handler (datas); data1 = datas[0] + datas[3]; data2 = datas[1] + datas[2]; - FINISH_DATA (data1, 16, 1); + FINISH_DATA (data1, 1); put_sound_word_left (data1); - FINISH_DATA (data2, 16, 1); + FINISH_DATA (data2, 1); put_sound_word_right (data2); check_sound_buffers (); } @@ -501,14 +434,14 @@ void sample16s_handler (void) data0 += data3; { uae_u32 data = SBASEVAL16(1) + data0; - FINISH_DATA (data, 16, 1); + FINISH_DATA (data, 1); put_sound_word_left (data); } data1 += data2; { uae_u32 data = SBASEVAL16(1) + data1; - FINISH_DATA (data, 16, 1); + FINISH_DATA (data, 1); put_sound_word_right (data); } @@ -579,14 +512,14 @@ static void sample16si_crux_handler (void) data1 += data2; data0 += data3; { - uae_u32 data = SBASEVAL16(1) + data0; - FINISH_DATA (data, 16, 1); + uae_u32 data = SBASEVAL16 (1) + data0; + FINISH_DATA (data, 1); put_sound_word_left (data); } { - uae_u32 data = SBASEVAL16(1) + data1; - FINISH_DATA (data, 16, 1); + uae_u32 data = SBASEVAL16 (1) + data1; + FINISH_DATA (data, 1); put_sound_word_right (data); } check_sound_buffers (); @@ -638,57 +571,19 @@ static void sample16si_rh_handler (void) data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8; { uae_u32 data = SBASEVAL16(1) + data0; - FINISH_DATA (data, 16, 1); + FINISH_DATA (data, 1); put_sound_word_left (data); } { uae_u32 data = SBASEVAL16(1) + data1; - FINISH_DATA (data, 16, 1); + FINISH_DATA (data, 1); put_sound_word_right (data); } check_sound_buffers (); } -#ifdef HAVE_8BIT_AUDIO_SUPPORT -void sample8s_handler (void) -{ - uae_u32 data0 = audio_channel[0].current_sample; - uae_u32 data1 = audio_channel[1].current_sample; - uae_u32 data2 = audio_channel[2].current_sample; - uae_u32 data3 = audio_channel[3].current_sample; - DO_CHANNEL_1 (data0, 0); - DO_CHANNEL_1 (data1, 1); - DO_CHANNEL_1 (data2, 2); - DO_CHANNEL_1 (data3, 3); - - data0 &= audio_channel[0].adk_mask; - data1 &= audio_channel[1].adk_mask; - data2 &= audio_channel[2].adk_mask; - data3 &= audio_channel[3].adk_mask; - - data0 += data3; - { - uae_u32 data = SBASEVAL8(1) + data0; - FINISH_DATA (data, 8, 1); - PUT_SOUND_BYTE_RIGHT (data); - } - data1 += data2; - { - uae_u32 data = SBASEVAL8(1) + data1; - FINISH_DATA (data, 8, 1); - PUT_SOUND_BYTE_LEFT (data); - } - check_sound_buffers (); -} -#endif #else -#ifdef HAVE_8BIT_AUDIO_SUPPORT -void sample8s_handler (void) -{ - sample8_handler(); -} -#endif void sample16s_handler (void) { @@ -708,64 +603,8 @@ static void sample16si_sinc_handler (void) } #endif -#ifdef HAVE_ULAW_AUDIO_SUPPORT -static uae_u8 int2ulaw (int ch) -{ - int mask; - - if (ch < 0) { - ch = -ch; - mask = 0x7f; - } else - mask = 0xff; - - if (ch < 32) - ch = 0xF0 | (15 - (ch / 2)); - else if (ch < 96) - ch = 0xE0 | (15 - (ch - 32) / 4); - else if (ch < 224) - ch = 0xD0 | (15 - (ch - 96) / 8); - else if (ch < 480) - ch = 0xC0 | (15 - (ch - 224) / 16); - else if (ch < 992 ) - ch = 0xB0 | (15 - (ch - 480) / 32); - else if (ch < 2016) - ch = 0xA0 | (15 - (ch - 992) / 64); - else if (ch < 4064) - ch = 0x90 | (15 - (ch - 2016) / 128); - else if (ch < 8160) - ch = 0x80 | (15 - (ch - 4064) / 256); - else - ch = 0x80; - - return (uae_u8)(mask & ch); -} - -void sample_ulaw_handler (void) -{ - unsigned int nr; - uae_u32 data = 0; - - for (nr = 0; nr < 4; nr++) { - if (!(adkcon & (0x11 << nr))) { - uae_u32 d = audio_channel[nr].current_sample; - DO_CHANNEL_1 (d, nr); - data += d; - } - } - PUT_SOUND_BYTE (int2ulaw (data)); - check_sound_buffers (); -} -#endif - void switch_audio_interpol (void) { -#if defined HAVE_8BIT_AUDIO_SUPPORT || defined HAVE_ULAW_AUDIO_SUPPORT - if (currprefs.sound_bits == 8) - /* only supported for 16-bit audio */ - return; -#endif - if (currprefs.sound_interpol == 0) { changed_prefs.sound_interpol = 1; write_log ("Interpol on: rh\n"); @@ -791,6 +630,7 @@ void schedule_audio (void) eventtab[ev_audio].oldcycles = get_cycles (); for (i = 0; i < 4; i++) { struct audio_channel_data *cdp = audio_channel + i; + if (cdp->evtime != MAX_EV) { if (best > cdp->evtime) { best = cdp->evtime; @@ -877,8 +717,7 @@ static void audio_handler (unsigned int nr, int timed) unsigned long evtime = cdp->evtime; cdp->evtime = MAX_EV; - switch (cdp->state) - { + switch (cdp->state) { case 0: cdp->request_word = 0; cdp->request_word_skip = 0; @@ -1029,7 +868,7 @@ void audio_reset (void) } } -#ifndef MULTIPLICATION_PROFITABLE +#ifndef MULTIPLICATION_PROFITABLE for (i = 0; i < 4; i++) audio_channel[i].voltbl = sound_table[audio_channel[i].vol]; #endif @@ -1048,9 +887,6 @@ STATIC_INLINE int sound_prefs_changed (void) || changed_prefs.sound_mixed_stereo != currprefs.sound_mixed_stereo || changed_prefs.sound_latency != currprefs.sound_latency || changed_prefs.sound_freq != currprefs.sound_freq -#if defined HAVE_8BIT_AUDIO_SUPPORT || defined HAVE_ULAW_AUDIO_SUPPORT - || changed_prefs.sound_bits != currprefs.sound_bits -#endif || changed_prefs.sound_adjust != currprefs.sound_adjust || changed_prefs.sound_interpol != currprefs.sound_interpol || changed_prefs.sound_volume != currprefs.sound_volume); @@ -1074,9 +910,6 @@ void check_prefs_changed_audio (void) currprefs.sound_adjust = changed_prefs.sound_adjust; currprefs.sound_interpol = changed_prefs.sound_interpol; currprefs.sound_freq = changed_prefs.sound_freq; -#if defined HAVE_8BIT_AUDIO_SUPPORT || defined HAVE_ULAW_AUDIO_SUPPORT - currprefs.sound_bits = changed_prefs.sound_bits; -#endif currprefs.sound_latency = changed_prefs.sound_latency; currprefs.sound_volume = changed_prefs.sound_volume; if (currprefs.produce_sound >= 2) { @@ -1243,7 +1076,7 @@ void audio_hsync (int dmaaction) #ifdef DEBUG_AUDIO if (debugchannel (nr)) write_log ("AUD%dDMA %d->%d (%d) LEN=%d/%d %08.8X\n", nr, cdp->dmaen, chan_ena, - cdp->state, cdp->wlen, cdp->len, m68k_getpc()); + cdp->state, cdp->wlen, cdp->len, m68k_getpc ()); #endif cdp->dmaen = chan_ena; if (cdp->dmaen) diff --git a/src/blitter.c b/src/blitter.c index 6dc0ecf..8797ad7 100644 --- a/src/blitter.c +++ b/src/blitter.c @@ -148,7 +148,7 @@ static const uae_s8 blit_cycle_diagram[][10] = { 3, 3, 1,3,4, 1,3,0 }, /* B */ { 2, 3, 1,2,0, 1,2 }, /* C */ { 3, 3, 1,2,4, 1,2,0 }, /* D */ - { 0, 4, 1,2,3,0 }, /* E */ + { 0, 3, 1,2,3 }, /* E */ { 4, 4, 1,2,3,4, 1,2,3,0 } /* F */ }; @@ -157,7 +157,7 @@ static const uae_s8 blit_cycle_diagram[][10] = static const uae_s8 blit_cycle_diagram_fill[][10] = { { 0, 3, 0,5,0 }, /* 0 */ - { 0, 3, 3,5,4 }, /* 1 */ + { 0, 3, 0,5,4 }, /* 1 */ { 0, 3, 0,3,0 }, /* 2 */ { 2, 3, 3,5,4, 3,0 }, /* 3 */ { 0, 3, 0,2,5 }, /* 4 */ @@ -170,7 +170,7 @@ static const uae_s8 blit_cycle_diagram_fill[][10] = { 3, 3, 1,3,4, 1,3,0 }, /* B */ { 2, 3, 1,2,5, 1,2 }, /* C */ { 3, 4, 1,2,5,4, 1,2,0 }, /* D */ - { 0, 4, 1,2,3,0 }, /* E */ + { 0, 3, 1,2,3 }, /* E */ { 4, 4, 1,2,3,4, 1,2,3,0 } /* F */ }; @@ -511,7 +511,7 @@ STATIC_INLINE void blitter_line_incy (void) static void blitter_line (void) { - uae_u16 blitahold = blinea >> blinea_shift; + uae_u16 blitahold = (blinea & blt_info.bltafwm) >> blinea_shift; uae_u16 blitbhold = blineb & 1 ? 0xFFFF : 0; uae_u16 blitchold = blt_info.bltcdat; @@ -598,11 +598,11 @@ static void decide_blitter_line (unsigned int hpos) cycle_line[blit_last_hpos] |= CYCLE_BLITTER; if (blt_info.vblitsize == 0) { bltdpt = bltcpt; - blitter_done(); - return; + blitter_done(); + return; } } - break; + break; } blit_last_hpos++; } @@ -956,9 +956,8 @@ static void blit_bltset (unsigned int con) blit_diag = blitfill ? blit_cycle_diagram_fill[blit_ch] : blit_cycle_diagram[blit_ch]; } if ((bltcon1 & 0x80) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) - write_log("warning: BLTCON1 DOFF-bit set\n"); + write_log ("warning: ECS BLTCON1 DOFF-bit set\n"); - ddat1use = ddat2use = 0; blit_dmacount = blit_dmacount2 = 0; blit_nod = 1; for (i = 0; i < blit_diag[1]; i++) { @@ -1025,7 +1024,9 @@ void do_blitter (unsigned int hpos) blit_last_hpos = hpos; #endif - reset_blit (1|2); + blit_bltset (1|2); + blit_modset (); + ddat1use = ddat2use = 0; if (blitline) { blitsing = bltcon1 & 0x2; @@ -1044,7 +1045,7 @@ void do_blitter (unsigned int hpos) if (1) { if (oldstate != BLT_done) write_log ("blitter was already active!\n"); - write_log("blitstart: v=%03.3d h=%03.3d %dx%d %d (%d) d=%d f=%02.2X n=%d pc=%p l=%d dma=%d\n", + write_log ("blitstart: v=%03.3d h=%03.3d %dx%d %d (%d) d=%d f=%02.2X n=%d pc=%p l=%d dma=%4x\n", vpos, hpos, blt_info.hblitsize, blt_info.vblitsize, cycles, blit_ch, blitdesc ? 1 : 0, blitfill, dmaen(DMA_BLITPRI) ? 1 : 0, m68k_getpc (®s), blitline, dmaen(DMA_BLITTER)); @@ -1088,13 +1089,14 @@ void do_blitter (unsigned int hpos) events_schedule(); } - void maybe_blit (unsigned int hpos, int hack) { static int warned; if (bltstate == BLT_done) return; + if (savestate_state) + return; if (!warned && dmaen (DMA_BLITTER)) { #ifndef BLITTER_DEBUG @@ -1110,15 +1112,13 @@ void maybe_blit (unsigned int hpos, int hack) goto end; } - if (!eventtab[ev_blitter].active) - write_log ("FOO!!?\n"); if (hack == 1 && get_cycles() < blit_firstline_cycles) goto end; blitter_handler (); end:; #ifdef BLITTER_DEBUG - blitter_delayed_debug = 1; + blitter_delayed_debug = 1; #endif } diff --git a/src/caps/caps.c b/src/caps/caps.c index eab7a3a..aca9ce2 100644 --- a/src/caps/caps.c +++ b/src/caps/caps.c @@ -3,7 +3,7 @@ * * Support for IPF/CAPS disk images * - * Copyright 2004-2006 Richard Drummond + * Copyright 2004-2007 Richard Drummond * * Based on Win32 CAPS code by Toni Wilen */ @@ -23,7 +23,11 @@ static int caps_flags = DI_LOCK_DENVAR|DI_LOCK_DENNOISE|DI_LOCK_NOISE|DI_LOCK_UP #define LIB_TYPE 1 -#ifndef TARGET_AMIGAOS +#if defined HAVE_DLOPEN && !defined HAVE_FRAMEWORK_CAPSIMAGE + +#include + +#define CAPSLIB_NAME "libcapsimage.so.2" /* * Repository for function pointers to the CAPSLib routines @@ -50,12 +54,6 @@ struct { CapsLong (*CAPSGetVersionInfo)(struct CapsVersionInfo *pi, CapsULong flag); } capslib; -#ifdef HAVE_DLOPEN - -#include - -#define CAPSLIB_NAME "libcapsimage.so.2" - /* * The Unix/dlopen method for loading and linking the CAPSLib plug-in */ @@ -83,10 +81,50 @@ static int load_capslib (void) write_log ("Unable to open " CAPSLIB_NAME "\n."); return 0; } -#endif // HAVE_DLOPEN + +/* + * 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 + +#else +#ifdef HAVE_FRAMEWORK_CAPSIMAGE + +/* + * On OS X we link weakly to the CAPSImage framework. Thus we can + * let the dynamic linker take care of everything. + */ + +/* We check for the existence of this symbol to tell whether the + * the framework could be linked or not. + */ +extern CapsLong CAPSInit(void) __attribute__((weak)); + +static int load_capslib (void) +{ + if (CAPSInit != NULL) + return 1; + else + return 0; +} #else +#ifdef TARGET_AMIGAOS #ifdef __amigaos4__ #define __USE_BASETYPE__ #include @@ -323,10 +361,7 @@ LONG CAPSGetVersionInfo (struct CapsVersionInfo *pi, CapsULong flag) return retval; } -#endif - - -#ifdef TARGET_AMIGAOS +#else #if 0 /* proto file is broken in current CAPS API */ @@ -337,6 +372,7 @@ LONG CAPSGetVersionInfo (struct CapsVersionInfo *pi, CapsULong flag) static struct Device *CapsImageBase; #endif #endif +#endif #include @@ -386,32 +422,8 @@ static int load_capslib (void) #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 * @@ -431,8 +443,8 @@ int caps_init (void) 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"); + "which is available from\n" + "http//www.caps-project.org/download.shtml\n"); noticed = 1; return 0; } @@ -476,10 +488,8 @@ int caps_loadimage (struct zfile *zf, unsigned int drv, unsigned int *num_tracks return 0; ret = CAPSLockImageMemory (caps_cont[drv], buf, len, 0); free (buf); - if (ret != imgeOk) { - free (buf); + if (ret != imgeOk) return 0; - } caps_locked[drv] = 1; CAPSGetImageInfo (&ci, caps_cont[drv]); *num_tracks = (ci.maxcylinder - ci.mincylinder + 1) * (ci.maxhead - ci.minhead + 1); diff --git a/src/cfgfile.c b/src/cfgfile.c index 297ecc9..a752510 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -81,7 +81,6 @@ static const struct cfg_lines opttable[] = {"keyboard_leds", "Keyboard LEDs" }, {"sound_output", "" }, {"sound_frequency", "" }, - {"sound_bits", "" }, {"sound_channels", "" }, {"sound_latency", "" }, #ifdef JIT @@ -153,7 +152,7 @@ static const char *obsolete[] = { "sound_pri_cutoff", "sound_pri_time", "avoid_dga", "override_dga_address", "avoid_vid", "avoid_cmov", "comp_midopt", "comp_lowopt", - "fast_copper", "sound_max_buf", + "fast_copper", "sound_max_buf", "sound_bits", 0 }; #define UNEXPANDED "$(FILE_PATH)" @@ -401,7 +400,6 @@ void save_options (FILE *f, const struct uae_prefs *p, int type) #endif cfgfile_write (f, "sound_output=%s\n", soundmode1[p->produce_sound]); - cfgfile_write (f, "sound_bits=%d\n", p->sound_bits); cfgfile_write (f, "sound_channels=%s\n", stereomode[p->sound_stereo]); cfgfile_write (f, "sound_stereo_separation=%d\n", p->sound_stereo_separation); cfgfile_write (f, "sound_stereo_mixing_delay=%d\n", p->sound_mixed_stereo >= 0 ? p->sound_mixed_stereo : 0); @@ -807,7 +805,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) if (cfgfile_path (option, value, "hardfile_path")) return 1; #ifdef SAVESTATE - if (cfgfile_path (option, value, "savestate_path")) + if (cfgfile_path (option, value, "savestate_path")) return 1; #endif #ifndef _WIN32 @@ -838,7 +836,6 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) } if (cfgfile_intval (option, value, "sound_latency", &p->sound_latency, 1) - || cfgfile_intval (option, value, "sound_bits", &p->sound_bits, 1) || cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1) || cfgfile_intval (option, value, "sound_adjust", &p->sound_adjust, 1) || cfgfile_intval (option, value, "sound_volume", &p->sound_volume, 1) @@ -905,11 +902,11 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) if (cfgfile_string (option, value, "config_info", p->info, 256) || cfgfile_string (option, value, "config_description", p->description, 256)) - return 1; + return 1; #ifdef DEBUGGER if (cfgfile_yesno (option, value, "use_debugger", &p->start_debugger)) - return 1; + return 1; #endif if (cfgfile_yesno (option, value, "log_illegal_mem", &p->illegal_mem) @@ -1172,7 +1169,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu return 1; #endif if (cfgfile_strval (option, value, "collision_level", &p->collision_level, collmode, 0)) - return 1; + return 1; if (cfgfile_string (option, value, "kickstart_rom_file", p->romfile, 256) || cfgfile_string (option, value, "kickstart_ext_rom_file", p->romextfile, 256) || cfgfile_string (option, value, "kickstart_key_file", p->keyfile, 256) @@ -1295,7 +1292,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu write_log ("Error: %s\n", err_msg); free (str); - } + } #endif return 1; } @@ -1377,7 +1374,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu write_log ("Error: %s\n", err_msg); free (str); - } + } #endif return 1; @@ -1565,7 +1562,7 @@ int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real, int *ty fh = fopen (filename, "r"); #ifndef SINGLEFILE if (! fh) { - write_log ("failed\n"); + write_log ("failed\n"); return 0; } #endif @@ -1739,8 +1736,8 @@ static void parse_sound_spec (struct uae_prefs *p, char *spec) else p->sound_stereo = 0; } - if (x2) - p->sound_bits = atoi (x2); +// if (x2) +// p->sound_bits = atoi (x2); if (x3) p->sound_freq = atoi (x3); // if (x4) @@ -1848,7 +1845,7 @@ static void parse_hardfile_spec (char *spec) err_msg = add_filesys_unit (currprefs.mountinfo, 0, 0, x4, 0, atoi (x0), atoi (x1), atoi (x2), atoi (x3), 0, 0, 0); if (err_msg) - write_log ("%s\n", err_msg); + write_log ("%s\n", err_msg); } #endif @@ -2020,8 +2017,8 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg) p->color_mode = 0; } #else - p->amiga_screen_type = atoi (arg); - if (p->amiga_screen_type < 0 || p->amiga_screen_type > 2) { + p->amiga_screen_type = atoi (arg); + if (p->amiga_screen_type < 0 || p->amiga_screen_type > 2) { write_log ("Bad screen-type selected. Defaulting to public screen.\n"); p->amiga_screen_type = 2; } @@ -2374,7 +2371,6 @@ void default_prefs (struct uae_prefs *p, int type) p->sound_stereo = 1; p->sound_stereo_separation = 7; p->sound_mixed_stereo = 0; - p->sound_bits = DEFAULT_SOUND_BITS; p->sound_freq = DEFAULT_SOUND_FREQ; p->sound_latency = DEFAULT_SOUND_LATENCY; p->sound_interpol = 0; diff --git a/src/compemu_support.c b/src/compemu_support.c index 5af1247..6e30c43 100644 --- a/src/compemu_support.c +++ b/src/compemu_support.c @@ -667,17 +667,17 @@ STATIC_INLINE void log_dump(void) return; - write_log("----------------------\n"); + write_log ("----------------------\n"); for (i=0;inexthandler=current_compile_p; + raise_in_cl_list(bi); + bi->nexthandler=current_compile_p; - /* We will flush soon, anyway, so let's do it now */ - if (current_compile_p>=max_compile_start) - flush_icache_hard(7); + /* We will flush soon, anyway, so let's do it now */ + if (current_compile_p>=max_compile_start) + flush_icache_hard(7); - do_extra_cycles(totcycles); /* for the compilation time */ + do_extra_cycles(totcycles); /* for the compilation time */ } } diff --git a/src/custom.c b/src/custom.c index 6db7a77..1543adf 100644 --- a/src/custom.c +++ b/src/custom.c @@ -212,6 +212,7 @@ enum diw_states unsigned int plffirstline, plflastline; unsigned int plfstrt; unsigned int plfstop; +static int first_bpl_vpos; static int last_diw_pix_hpos, last_ddf_pix_hpos; static int last_decide_line_hpos, last_sprite_decide_line_hpos; static int last_fetch_hpos; @@ -375,7 +376,7 @@ static void hsyncdelay(void) #if 0 static unsigned int prevhpos; while (current_hpos () == prevhpos) - do_cycles (CYCLE_UNIT); + do_cycles (CYCLE_UNIT); prevhpos = current_hpos (); #endif } @@ -603,16 +604,16 @@ static void debug_cycle_diagram (void) write_log ("FMODE %d\n=======\n", fm); for (res = 0; res <= 2; res++) { for (planes = 0; planes <= 8; planes++) { - write_log("%d: ",planes); + write_log ("%d: ",planes); for (cycle = 0; cycle < 32; cycle++) { v=cycle_diagram_table[fm][res][planes][cycle]; if (v==0) aa='-'; else if(v>0) aa='1'; else aa='X'; - write_log("%c",aa); + write_log ("%c",aa); } - write_log(" %d:%d\n", + write_log (" %d:%d\n", cycle_diagram_free_cycles[fm][res][planes], cycle_diagram_total_cycles[fm][res][planes]); } - write_log("\n"); + write_log ("\n"); } } fm=0; @@ -732,7 +733,7 @@ STATIC_INLINE void compute_delay_offset (void) delayoffset = 16; else /* what about 40 and 56? */ delayoffset = 0; - //write_log("%d:%d ", vpos, delayoffset); + //write_log ("%d:%d ", vpos, delayoffset); #endif } @@ -1480,6 +1481,8 @@ STATIC_INLINE void decide_fetch (int hpos) static void start_bpl_dma (unsigned int hpos, int hstart) { + if (first_bpl_vpos < 0) + first_bpl_vpos = vpos; fetch_start (hpos); fetch_cycle = 0; last_fetch_hpos = hstart; @@ -2047,7 +2050,7 @@ static void finish_decisions (void) if (thisline_decision.plfleft != -1 && thisline_decision.plflinelen == -1) { if (fetch_state != fetch_not_started) { - write_log("fetch_state=%d plfleft=%d,len=%d,vpos=%d,hpos=%d\n", + write_log ("fetch_state=%d plfleft=%d,len=%d,vpos=%d,hpos=%d\n", fetch_state, thisline_decision.plfleft, thisline_decision.plflinelen, vpos, hpos); uae_abort ("fetch_state != fetch_not_started"); @@ -2264,6 +2267,8 @@ void init_hz (void) minfirstline = vsstop; if (minfirstline < 2) minfirstline = 2; + if (minfirstline >= maxvpos) + minfirstline = maxvpos - 1; sprite_vblank_endline = minfirstline - 2; dumpsync (); } @@ -2316,24 +2321,10 @@ static void calcdiw (void) plffirstline = vstrt; plflastline = vstop; -#if 0 - /* This happens far too often. */ - if (plffirstline < minfirstline_bpl) { - write_log ("Warning: Playfield begins before line %d (%d)!\n", minfirstline_bpl, plffirstline); - } -#endif - -#if 0 /* this comparison is not needed but previous is.. */ - if (plflastline > 313) { - /* Turrican does this */ - write_log ("Warning: Playfield out of range!\n"); - plflastline = 313; - } -#endif - plfstrt = ddfstrt; plfstop = ddfstop; /* probably not the correct place.. */ + /* ECS/AGA and ddfstop > maxhpos = always-on display */ if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { if (ddfstop > maxhpos) plfstrt = 0; @@ -2523,19 +2514,14 @@ static void DMACON (unsigned int hpos, uae_u16 v) } } if ((dmacon & DMA_BLITPRI) > (oldcon & DMA_BLITPRI) && bltstate != BLT_done) { - static int count = 0; - if (!count) { - count = 1; - write_log ("warning: program is doing blitpri hacks.\n"); - } - set_special (®s, SPCFLAG_BLTNASTY); decide_blitter (hpos); + set_special (®s, SPCFLAG_BLTNASTY); } if (dmaen (DMA_BLITTER) && bltstate == BLT_init) bltstate = BLT_work; if ((dmacon & (DMA_BLITPRI | DMA_BLITTER | DMA_MASTER)) != (DMA_BLITPRI | DMA_BLITTER | DMA_MASTER)) { - unset_special (®s, SPCFLAG_BLTNASTY); decide_blitter (hpos); + unset_special (®s, SPCFLAG_BLTNASTY); } if (changed & (DMA_MASTER | 0x0f)) audio_hsync (0); @@ -2550,86 +2536,103 @@ static void DMACON (unsigned int hpos, uae_u16 v) #ifdef CPUEMU_6 -static int irq_pending[15]; /* If true, an IRQ is pending arrival at the CPU. */ -static unsigned long irq_due[15]; /* Cycle time that IRQ will arrive at CPU */ +static int irq_pending[15]; /* If true, an IRQ is pending arrival at the CPU. If false, + * an IRQ has arrived or is disabled. */ +static unsigned long irq_time[15]; /* Cycle time an IRQ will arrive at the CPU if that IRQ is + * pending or has arrived; otherwise 0, if an IRQ is disabled. */ /* - * Handle interrupt delay in cycle-exact mode. + * Get priority level of IRQ (cycle-exact mode) */ -static int intlev_2 (void) +STATIC_INLINE int intlev_exact (uae_u16 imask) { - uae_u16 imask = intreq & intena; - int il = -1; +#if 0 + assert ((imask & 0x7FFF) != 0); +#endif - if (imask && (intena & 0x4000)) { - unsigned long cycles = get_cycles (); - int i; + unsigned long curr_time = get_cycles (); + int i; - for (i = 14; i >= 0; i--) { - if (imask & (1 << i)) { - if (irq_pending[i] && (cycles >= irq_due[i])) { - irq_pending[i] = 0; + for (i = 14; i >= 0; i--) { + if (imask & (1 << i)) { + if (irq_pending[i] == 0 || ((curr_time - irq_time[i]) > 4 * CYCLE_UNIT)) { + /* Mark IRQ as arrived. */ + irq_pending[i] = 0; - if (i == 13 || i == 14) - il = -1; - else if (i == 11 || i == 12) - return 5; - else if (i >= 7 && i <= 10) - return 4; - else if (i >= 4 && i <= 6) - return 3; - else if (i == 3) - return 2; - else - return 1; - } + /* Get priority level of IRQ. */ + if (i == 13 || i == 14) + return 6; + if (i == 11 || i == 12) + return 5; + if (i >= 7 && i <= 10) + return 4; + if (i >= 4 && i <= 6) + return 3; + if (i == 3) + return 2; + else + return 1; } } - } else - unset_special (®s, SPCFLAG_INT); - - return il; + } + /* If we got here, then an at least one IRQ must be pending, + * but has not yet arrived at the CPU. */ + return 0; } #endif /* - * Get interrupt level of IRQ. + * Get priority level of IRQ (not cycle-exact mode) + */ +STATIC_INLINE int intlev_simple (uae_u16 imask) +{ +#if 0 + assert ((imask & 0x7FFF) != 0); +#endif + + if (imask & 0x6000) + return 6; + if (imask & 0x1800) + return 5; + if (imask & 0x0780) + return 4; + if (imask & 0x0070) + return 3; + if (imask & 0x0008) + return 2; + else + return 1; +} + +/* + * Get level of interrupt request presented to CPU. + * + * If no IRQs are active and enabled, returns -1. + * If none of the active IRQs have yet reached the CPU, returns 0. + * Otherwise, returns the priority level of the highest priorty active IRQ. */ int intlev (void) { - int il = -1; + uae_u16 imask = intreq & intena; + if (imask && (intena & 0x4000)) { #ifdef CPUEMU_6 - if (currprefs.cpu_cycle_exact) { - il = intlev_2 (); - if (il >= 0 && il <= (int) regs.intmask) - unset_special (®s, SPCFLAG_INT); - } else + if (currprefs.cpu_cycle_exact) + return intlev_exact (imask); + else #endif - { - uae_u16 imask = intreq & intena; - if (imask && (intena & 0x4000)) { - if (imask & 0x6000) - il = 6; - if (imask & 0x1800) - il = 5; - if (imask & 0x0780) - il = 4; - if (imask & 0x0070) - il = 3; - if (imask & 0x0008) - il = 2; - if (imask & 0x0007) - il = 1; - } + return intlev_simple (imask); } - - return il; + return -1; } +/* + * Enable/disable an IRQ. + */ static void doint (void) { - set_special (®s, SPCFLAG_INT); + if (intena & 0x4000) + set_special (®s, SPCFLAG_INT); #ifdef CPUEMU_6 if (currprefs.cpu_cycle_exact) { @@ -2639,12 +2642,12 @@ static void doint (void) imask = intreq & intena; if (imask && (intena & 0x4000)) { - /* Set up delay for IRQ to arrive at the CPU. */ - unsigned long cycle_irq_due = get_cycles () + 4 * CYCLE_UNIT; + /* Set up time for IRQ to arrive at the CPU. */ + unsigned long curr_time = get_cycles (); for (i = 0; i < 15; i++) { if ((imask & (1 << i)) && irq_pending[i] == 0) { irq_pending[i] = 1; - irq_due[i] = cycle_irq_due; + irq_time[i] = curr_time; } } } @@ -2657,7 +2660,7 @@ STATIC_INLINE void INTENA (uae_u16 v) setclr (&intena,v); #if 0 if (v & 0x40) - write_log("INTENA %04.4X (%04.4X) %p\n", intena, v, m68k_getpc (®s)); + write_log ("INTENA %04.4X (%04.4X) %p\n", intena, v, m68k_getpc (®s)); #endif if (v & 0x8000) doint (); @@ -2677,14 +2680,17 @@ void INTREQ_0 (uae_u16 v) * pending status. */ int i; for (i = 0; i < 15; i++) { - if (v & (1 << i)) + if (v & (1 << i)) { irq_pending[i] = 0; + irq_time[i] = 0; + } } } } #endif - doint (); + if (intena & 0x4000) + doint (); } void INTREQ (uae_u16 v) @@ -2770,7 +2776,7 @@ static void BPLxPTH (unsigned int hpos, uae_u16 v, int num) decide_line (hpos); decide_fetch (hpos); bplpt[num] = (bplpt[num] & 0xffff) | ((uae_u32)v << 16); - //write_log("%d:%d:BPL%dPTH %08.8X\n", hpos, vpos, num, v); + //write_log ("%d:%d:BPL%dPTH %08.8X\n", hpos, vpos, num, v); } static void BPLxPTL (unsigned int hpos, uae_u16 v, int num) { @@ -2782,7 +2788,7 @@ static void BPLxPTL (unsigned int hpos, uae_u16 v, int num) if (is_bitplane_dma(hpos - 1) == num + 1 && num > 0) delta = 2 << fetchmode; bplpt[num] = (bplpt[num] & ~0xffff) | ((v + delta) & 0xfffe); - //write_log("%d:%d:BPL%dPTL %08.8X\n", hpos, vpos, num, v); + //write_log ("%d:%d:BPL%dPTL %08.8X\n", hpos, vpos, num, v); } static void BPLCON0 (unsigned int hpos, uae_u16 v) @@ -2924,6 +2930,7 @@ static void DIWHIGH (int hpos, uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; + v &= ~(0x8000 | 0x4000 | 0x0080 | 0x0040); if (diwhigh_written && diwhigh == v) return; decide_line (hpos); @@ -3056,8 +3063,10 @@ static void BLTSIZE (uae_u16 v) blt_info.vblitsize = v >> 6; blt_info.hblitsize = v & 0x3F; - if (!blt_info.vblitsize) blt_info.vblitsize = 1024; - if (!blt_info.hblitsize) blt_info.hblitsize = 64; + if (!blt_info.vblitsize) + blt_info.vblitsize = 1024; + if (!blt_info.hblitsize) + blt_info.hblitsize = 64; do_blitter (current_hpos()); } @@ -3090,7 +3099,7 @@ STATIC_INLINE void spr_arm (unsigned int num, int state) spr[num].armed = 0; break; default: - nr_armed += 1 - spr[num].armed; + nr_armed += 1 - spr[num].armed; spr[num].armed = 1; break; } @@ -3443,12 +3452,7 @@ static int isagnus[]= { static void dump_copper (const char *error, unsigned int until_hpos) { - static int warned = 10; - - if (warned < 0) - return; - warned--; - write_log("%s: vpos=%d until_hpos=%d\n", + write_log ("%s: vpos=%d until_hpos=%d\n", error, vpos, until_hpos); write_log("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%#4.4X ci2=%#4.4X\n", cop_state.vcmp,cop_state.hcmp,cop_state.hpos,cop_state.vpos,cop_state.saved_i1,cop_state.saved_i2); @@ -3664,11 +3668,6 @@ static void update_copper (unsigned int until_hpos) static int skipped_before; unsigned int vcmp, hcmp, vp1, hp1; - if (! skipped_before) { - skipped_before = 1; - write_log ("Program uses Copper SKIP instruction.\n"); - } - if (c_hpos >= (maxhpos & ~1)) break; @@ -3799,7 +3798,7 @@ STATIC_INLINE void do_sprites_1 (unsigned int num, int cycle, unsigned int hpos) #if SPRITE_DEBUG > 3 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) - write_log("%d:%d:slot%d:%d\n", vpos, hpos, num, cycle); + write_log ("%d:%d:slot%d:%d\n", vpos, hpos, num, cycle); #endif if (vpos == s->vstart) { #if SPRITE_DEBUG > 0 @@ -4034,6 +4033,7 @@ static void adjust_array_sizes (void) static void init_hardware_frame (void) { + first_bpl_vpos = -1; next_lineno = 0; nextline_how = nln_normal; diwstate = DIW_waiting_start; @@ -4115,7 +4115,7 @@ static frame_time_t framewait_friendly (frame_time_t end_time) static int count = 0; static int total = 0; - uae_msleep (2); + uae_msleep (2); /* Callibrate time we slept for and try to adjust to * changing lantencies. @@ -4131,7 +4131,7 @@ static frame_time_t framewait_friendly (frame_time_t end_time) count = 0; } } else - break; + break; } } @@ -4286,8 +4286,6 @@ static void vsync_handler (void) picasso_handle_vsync (); #endif - vsync_handle_redraw (lof, lof_changed); - { static int cnt = 0; if (cnt == 0) { @@ -4303,6 +4301,8 @@ static void vsync_handler (void) record_copper_reset(); #endif + vsync_handle_redraw (lof, lof_changed); + /* For now, let's only allow this to change at vsync time. It gets too * hairy otherwise. */ if ((beamcon0 & (0x20|0x80)) != (new_beamcon0 & (0x20|0x80)) || hack_vpos) @@ -4313,11 +4313,11 @@ static void vsync_handler (void) eventtab[ev_copper].active = 0; COPJMP (1); - init_hardware_frame (); - if (timehack_alive > 0) timehack_alive--; inputdevice_vsync (); + + init_hardware_frame (); } #ifdef JIT @@ -4545,6 +4545,9 @@ void customreset (void) bplcon4 = 0x11; /* Get AGA chipset into ECS compatibility mode */ bplcon3 = 0xC00; + diwhigh = 0; + diwhigh_written = 0; + FMODE (0); CLXCON (0); } @@ -4604,7 +4607,7 @@ void customreset (void) sprite_buffer_res = currprefs.chipset_mask & CSMASK_AGA ? RES_HIRES : RES_LORES; if (savestate_state == STATE_RESTORE) { - unsigned int i; + unsigned int i; uae_u16 v; uae_u32 vv; @@ -4725,8 +4728,8 @@ static int allocate_sprite_tables (void) delta_color_change = 0; if (!sprite_entries[0]) { - max_sprite_entry = DEFAULT_MAX_SPRITE_ENTRY; - max_color_change = DEFAULT_MAX_COLOR_CHANGE; + max_sprite_entry = DEFAULT_MAX_SPRITE_ENTRY; + max_color_change = DEFAULT_MAX_COLOR_CHANGE; for (num = 0; num < 2; num++) { sprite_entries[num] = xmalloc (max_sprite_entry * sizeof (struct sprite_entry)); @@ -4736,7 +4739,7 @@ static int allocate_sprite_tables (void) memset (sprite_entries[num], 0, max_sprite_entry * sizeof (struct sprite_entry)); memset (color_changes[num], 0, max_color_change * sizeof (struct color_change)); } else - return 0; + return 0; } } @@ -5124,14 +5127,20 @@ void REGPARAM2 custom_wput (uaecptr addr, uae_u32 value) write_log ("%d:%d:wput: %04.4X %04.4X pc=%p\n", hpos, vpos, addr & 0x01fe, value & 0xffff, m68k_getpc (®s)); #endif sync_copper_with_cpu (hpos, 1); + if (addr & 1) { + addr &= ~1; + custom_wput_1 (hpos, addr, (value >> 8) | (value & 0xff00), 0); + custom_wput_1 (hpos, addr + 2, (value << 8) | (value & 0x00ff), 0); + return; + } custom_wput_1 (hpos, addr, value, 0); } void REGPARAM2 custom_bput (uaecptr addr, uae_u32 value) { + uae_u16 rval = (value << 8) | (value & 0xFF); static int warned; - uae_u16 rval = (value << 8) | (value & 0xFF); #ifdef JIT special_mem |= SPECIAL_MEM_WRITE; #endif @@ -5280,8 +5289,7 @@ const uae_u8 *restore_custom (const uae_u8 *src) vsstrt = RW; /* 1E0 VSSTT */ hcenter = RW; /* 1E2 HCENTER */ diwhigh = RW; /* 1E4 DIWHIGH */ - if (diwhigh & 0x8000) - diwhigh_written = 1; + diwhigh_written = (diwhigh & 0x8000) ? 1 : 0; diwhigh &= 0x7fff; RW; /* 1E6 ? */ RW; /* 1E8 ? */ diff --git a/src/disk.c b/src/disk.c index 9a98a30..8f1f08e 100644 --- a/src/disk.c +++ b/src/disk.c @@ -1025,7 +1025,7 @@ static void rand_shifter (void) } } -static int drive_empty (drive * drv) +STATIC_INLINE int drive_empty (const drive * drv) { #ifdef CATWEASEL if (drv->catweasel) @@ -1055,7 +1055,7 @@ static void drive_step (drive * drv) #endif if (drv->steplimit && get_cycles () - drv->steplimitcycle < MIN_STEPLIMIT_CYCLE) { if (disk_debug_logging > 1) - write_log (" step ignored %d", (int)((get_cycles () - drv->steplimitcycle) / CYCLE_UNIT)); + write_log (" step ignored %d", (int)((get_cycles () - drv->steplimitcycle) / CYCLE_UNIT)); return; } /* A1200's floppy drive needs at least 30 raster lines between steps @@ -1074,7 +1074,7 @@ static void drive_step (drive * drv) #endif } /* else - write_log("program tried to step beyond track zero\n"); + write_log ("program tried to step beyond track zero\n"); "no-click" programs does that */ } else { @@ -1094,7 +1094,7 @@ static void drive_step (drive * drv) } rand_shifter (); if (disk_debug_logging > 1) - write_log (" ->step %d", drv->cyl); + write_log (" ->step %d", drv->cyl); } static int drive_track0 (drive * drv) @@ -1237,7 +1237,7 @@ static void decode_pcdos (drive *drv) mfm2[93] = 0x5224; mfm2[94] = 0x5224; for (i = 0; i < drv->num_secs; i++) { - mfm2 = dstmfmbuf; + mfm2 = dstmfmbuf; memset (secbuf, 0x00, 12); secbuf[12] = 0xa1; secbuf[13] = 0xa1; @@ -1270,11 +1270,11 @@ static void decode_pcdos (drive *drv) mfm2[58] = 0x4489; } for (i = 0; i < 200; i++) - *dstmfmbuf++ = 0x9254; + *dstmfmbuf++ = 0x9254; drv->skipoffset = 0; drv->tracklen = (dstmfmbuf - drv->bigmfmbuf) * 16; if (disk_debug_logging > 0) - write_log ("pcdos read track %d\n", tr); + write_log ("pcdos read track %d\n", tr); } static void decode_amigados (drive *drv) @@ -1293,39 +1293,39 @@ static void decode_amigados (drive *drv) drv->tracklen = len * 2 * 8; for (sec = 0; sec < drv->num_secs; sec++) { - uae_u8 secbuf[544]; - uae_u16 mfmbuf[544]; - int i; - uae_u32 deven, dodd; - uae_u32 hck = 0, dck = 0; + uae_u8 secbuf[544]; + uae_u16 mfmbuf[544]; + int i; + 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] = tr; - secbuf[6] = sec; - secbuf[7] = drv->num_secs - sec; + secbuf[0] = secbuf[1] = 0x00; + secbuf[2] = secbuf[3] = 0xa1; + secbuf[4] = 0xff; + secbuf[5] = tr; + secbuf[6] = sec; + secbuf[7] = drv->num_secs - sec; - for (i = 8; i < 24; i++) + for (i = 8; i < 24; i++) secbuf[i] = 0; read_floppy_data (drv->diskfile, ti, sec * 512, &secbuf[32], 512); - mfmbuf[0] = mfmbuf[1] = 0xaaaa; - mfmbuf[2] = mfmbuf[3] = 0x4489; + mfmbuf[0] = mfmbuf[1] = 0xaaaa; + mfmbuf[2] = mfmbuf[3] = 0x4489; - deven = ((secbuf[4] << 24) | (secbuf[5] << 16) + deven = ((secbuf[4] << 24) | (secbuf[5] << 16) | (secbuf[6] << 8) | (secbuf[7])); - dodd = deven >> 1; - deven &= 0x55555555; - dodd &= 0x55555555; + dodd = deven >> 1; + deven &= 0x55555555; + dodd &= 0x55555555; - mfmbuf[4] = dodd >> 16; - mfmbuf[5] = dodd; - mfmbuf[6] = deven >> 16; - mfmbuf[7] = deven; + mfmbuf[4] = dodd >> 16; + mfmbuf[5] = dodd; + mfmbuf[6] = deven >> 16; + mfmbuf[7] = deven; - for (i = 8; i < 48; i++) + 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) @@ -1342,32 +1342,32 @@ static void decode_amigados (drive *drv) 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; + 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) + 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); + deven = dodd = dck; + dodd >>= 1; + mfmbuf[28] = dodd >> 16; + mfmbuf[29] = dodd; + mfmbuf[30] = deven >> 16; + mfmbuf[31] = deven; + mfmcode (mfmbuf + 4, 544 - 4); - for (i = 0; i < 544; i++) { + for (i = 0; i < 544; i++) { dstmfmbuf[dstmfmoffset % len] = mfmbuf[i]; dstmfmoffset++; } } if (disk_debug_logging > 0) - write_log ("amigados read track %d\n", tr); + write_log ("amigados read track %d\n", tr); } static void drive_fill_bigbuf (drive * drv, int force) @@ -1807,7 +1807,7 @@ static void drive_eject (drive * drv) drv->crc32 = 0; drive_settype_id (drv); /* Back to 35 DD */ if (disk_debug_logging > 0) - write_log ("eject drive %d\n", drv - &floppy[0]); + write_log ("eject drive %d\n", drv - &floppy[0]); } /* We use this function if we have no Kickstart ROM. @@ -2122,7 +2122,7 @@ static char *tobin (uae_u8 v) static char buf[10]; for ( i = 7; i >= 0; i--) buf[7 - i] = v & (1 << i) ? '1' : '0'; - buf[i] = 0; + buf[8] = 0; return buf; } @@ -2213,7 +2213,7 @@ void DISK_select (uae_u8 data) } prevdata = data; if (disk_debug_logging > 1) - write_log ("\n"); + write_log ("\n"); } uae_u8 DISK_status (void) @@ -2262,7 +2262,7 @@ uae_u8 DISK_status (void) return st; } -static int unformatted (drive *drv) +STATIC_INLINE int unformatted (const drive *drv) { unsigned int tr = drv->cyl * 2 + side; if (tr >= drv->num_tracks) @@ -2442,20 +2442,20 @@ static void updatetrackspeed (drive *drv, unsigned int mfmpos) } } -static void disk_doupdate_predict (drive * drv, unsigned int startcycle) +STATIC_INLINE void disk_doupdate_predict (drive * drv, unsigned int startcycle, int write) { unsigned int firstcycle = startcycle; + unsigned int endcycle = maxhpos << 8; uae_u32 tword = word; unsigned int mfmpos = drv->mfmpos; - int indexhack = drv->indexhack; int is_empty = drive_empty (drv); int is_unformatted = unformatted (drv); + unsigned int event_flag = 0; - diskevent_flag = 0; - while (startcycle < (maxhpos << 8) && !diskevent_flag) { + while (startcycle < endcycle && !event_flag) { if (drv->tracktiming[0]) updatetrackspeed (drv, mfmpos); - if (dskdmaen != 3) { + if (!write) { tword <<= 1; if (!is_empty) { if (is_unformatted) @@ -2464,34 +2464,31 @@ static void disk_doupdate_predict (drive * drv, unsigned int startcycle) tword |= getonebit (drv->bigmfmbuf, mfmpos); } if ((tword & 0xffff) == dsksync) - diskevent_flag |= DISK_WORDSYNC; + event_flag |= DISK_WORDSYNC; } mfmpos++; mfmpos %= drv->tracklen; if (mfmpos == 0) - diskevent_flag |= DISK_REVOLUTION << (drv - floppy); - if (mfmpos == drv->indexoffset) { - diskevent_flag |= DISK_INDEXSYNC; - indexhack = 0; - } - if (dskdmaen != 3 && (int)mfmpos == drv->skipoffset) { + event_flag |= DISK_REVOLUTION << (drv - floppy); + if (mfmpos == drv->indexoffset) + event_flag |= DISK_INDEXSYNC; + if (!write && (int)mfmpos == drv->skipoffset) { int skipcnt = disk_jitter; while (skipcnt-- > 0) { mfmpos++; mfmpos %= drv->tracklen; if (mfmpos == 0) - diskevent_flag |= DISK_REVOLUTION << (drv - floppy); - if (mfmpos == drv->indexoffset) { - diskevent_flag |= DISK_INDEXSYNC; - indexhack = 0; - } + event_flag |= DISK_REVOLUTION << (drv - floppy); + if (mfmpos == drv->indexoffset) + event_flag |= DISK_INDEXSYNC; } } startcycle += drv->trackspeed; } if (drv->tracktiming[0]) updatetrackspeed (drv, drv->mfmpos); - if (diskevent_flag) { + diskevent_flag = event_flag; + if (event_flag) { disk_sync_cycle = startcycle >> 8; eventtab[ev_disk].oldcycles = get_cycles (); eventtab[ev_disk].evtime = get_cycles () + startcycle - firstcycle; @@ -2534,7 +2531,7 @@ static void disk_doupdate_read (drive * drv, int floppybits) if (drv->tracktiming[0]) updatetrackspeed (drv, drv->mfmpos); word <<= 1; - if (!is_empty) { + if (!is_empty) { if (is_unformatted) word |= (rand () & 0x1000) ? 1 : 0; else @@ -2554,7 +2551,7 @@ static void disk_doupdate_read (drive * drv, int floppybits) } if (bitoffset == 15 && dma_enable && dskdmaen == 2 && dsklength >= 0) { if (dsklength > 0) { - do_chipmem_wput (dskpt, word); + do_chipmem_wput (dskpt, word); dskpt += 2; #ifdef CPUEMU_6 cycle_line[7] |= CYCLE_MISC; @@ -2708,7 +2705,7 @@ void DISK_hsync (unsigned int tohpos) void DISK_update (unsigned int tohpos) { unsigned int dr; - unsigned int cycles = (tohpos << 8) - disk_hpos; + int cycles = (int)((tohpos << 8) - disk_hpos); disk_jitter = ((rand () >> 4) & 3) + 1; if (disk_jitter > 2) @@ -2744,11 +2741,13 @@ void DISK_update (unsigned int tohpos) continue; if (selected & (1 << dr)) continue; - if (dskdmaen == 3) + if (dskdmaen == 3) { disk_doupdate_write (drv, drv->floppybitcounter); - else + disk_doupdate_predict (drv, disk_hpos, 1); + } else { disk_doupdate_read (drv, drv->floppybitcounter); - disk_doupdate_predict (drv, disk_hpos); + disk_doupdate_predict (drv, disk_hpos, 0); + } drv->floppybitcounter %= drv->trackspeed; break; } @@ -2828,7 +2827,7 @@ void DSKLEN (uae_u16 v, unsigned int hpos) dskdmaen == 3 ? "write" : "read", selected ^ 15, floppy[dr].cyl * 2 + side, floppy[dr].mfmpos); } - disk_dma_debugmsg (); + disk_dma_debugmsg (); } for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) @@ -2890,7 +2889,7 @@ void DSKLEN (uae_u16 v, unsigned int hpos) } else if (dskdmaen == 3) { /* TURBO write */ - int i; + int i; for (i = 0; i < dsklength; i++) { drv->bigmfmbuf[pos >> 4] = get_word (dskpt + i * 2); pos += 16; diff --git a/src/drawing.c b/src/drawing.c index 34f1bc1..e9d0595 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -75,8 +75,6 @@ static int dblpfofs[] = { 0, 2, 4, 8, 16, 32, 64, 128 }; static int sprite_offs[256]; -static uae_u32 clxtab[256]; - /* Video buffer description structure. Filled in by the graphics system * dependent code. */ @@ -653,14 +651,6 @@ static void gen_pfield_tables (void) dblpf_ind2[i] = i >= 128 ? i & 0x7F : (plane2 == 0 ? plane1 : plane2); sprite_offs[i] = (i & 15) ? 0 : 2; - - clxtab[i] = ((((i & 3) && (i & 12)) << 9) - | (((i & 3) && (i & 48)) << 10) - | (((i & 3) && (i & 192)) << 11) - | (((i & 12) && (i & 48)) << 12) - | (((i & 12) && (i & 192)) << 13) - | (((i & 48) && (i & 192)) << 14)); - } } @@ -1221,22 +1211,22 @@ static void pfield_expand_dp_bplcon2 (int regno, int v) regno -= 0x1000; switch (regno) { - case 0x100: - dp_for_drawing->bplcon0 = v; - dp_for_drawing->bplres = GET_RES(v); - dp_for_drawing->nr_planes = GET_PLANES(v); + case 0x100: + dp_for_drawing->bplcon0 = v; + dp_for_drawing->bplres = GET_RES(v); + dp_for_drawing->nr_planes = GET_PLANES(v); dp_for_drawing->ham_seen = !! (v & 0x800); - break; - case 0x104: - dp_for_drawing->bplcon2 = v; - break; + break; + case 0x104: + dp_for_drawing->bplcon2 = v; + break; #ifdef AGA case 0x106: - dp_for_drawing->bplcon3 = v; - break; - case 0x108: - dp_for_drawing->bplcon4 = v; - break; + dp_for_drawing->bplcon3 = v; + break; + case 0x108: + dp_for_drawing->bplcon4 = v; + break; #endif } pfield_expand_dp_bplcon (); @@ -1826,12 +1816,14 @@ void finish_drawing_frame (void) #endif for (i = 0; i < max_ypos_thisframe; i++) { int where; - int i1 = i + min_ypos_for_screen; + int i1; int line = i + thisframe_y_adjust_real; if (linestate[line] == LINE_UNDECIDED) break; + i1 = i + min_ypos_for_screen; + where = amiga2aspect_line_map[i1]; if (where >= gfxvidinfo.height) break; @@ -1841,8 +1833,8 @@ void finish_drawing_frame (void) pfield_draw_line (line, where, amiga2aspect_line_map[i1 + 1]); } if (currprefs.leds_on_screen) { - for (i = 0; i < TD_TOTAL_HEIGHT; i++) { - int line = gfxvidinfo.height - TD_TOTAL_HEIGHT + i; + int line = gfxvidinfo.height - TD_TOTAL_HEIGHT; + for (i = TD_TOTAL_HEIGHT; i--; line++) { draw_status_line (line); do_flush_line (line); } @@ -2024,7 +2016,7 @@ void reset_drawing (void) lores_reset (); - for (i = 0; i < sizeof linestate / sizeof *linestate; i++) + for (i = sizeof linestate / sizeof *linestate; i--;) linestate[i] = LINE_UNDECIDED; init_aspect_maps (); diff --git a/src/filesys.asm b/src/filesys.asm index e763e67..efacf10 100644 --- a/src/filesys.asm +++ b/src/filesys.asm @@ -12,6 +12,7 @@ ; 200?.??.?? Picasso96 vblank hack (TW) ; 2006.03.04 Mousehack code integrated (TW) ; 2006.18.07 FileSystem.resource find routine access fault fixed (TW) +; 2007.03.30 mousehack do not start multiple times anymore (TW) AllocMem = -198 FreeMem = -210 @@ -160,7 +161,7 @@ general_ret: exter_data: exter_server: movem.l a2,-(sp) - move.w #$FF50,d0 + move.w #$FF50,d0 ; exter_int_helper bsr.w getrtbase moveq.l #0,d0 jsr (a0) @@ -169,7 +170,7 @@ exter_server: ; This is the hard part - we have to send some messages. move.l 4.w,a6 EXTS_loop: - move.w #$FF50,d0 ;exter_int_helper + move.w #$FF50,d0 ; exter_int_helper bsr.w getrtbase moveq.l #2,d0 jsr (a0) @@ -621,8 +622,10 @@ filesys_mainloop: FSML_loop: bsr.w mousehack_init + move.l a5,a0 jsr -384(a6) ; WaitPort + move.l a5,a0 jsr -372(a6) ; GetMsg move.l d0,a4 @@ -665,7 +668,7 @@ nonotif move.l (a2),a0 FSML_check_old: move.l a0,d0 - beq.b FSML_loop + beq.w FSML_loop move.l (a0),a1 move.l d0,a0 ; This field may be accessed concurrently by several UAE threads. @@ -697,7 +700,7 @@ FSML_FromDOS: FSML_DoCommand: bsr.b LockCheck ; Make sure there are enough locks for the C code to grab. - move.w #$FF30,d0 + move.w #$FF30,d0 ; filesys_handler bsr.w getrtbase jsr (a0) tst.l d0 @@ -799,14 +802,14 @@ p96vsyncfix1 jsr -$12c(a6) ; SetTaskPri lea p96flag(pc),a0 move.w (a0),d1 -p962 cmp.w (a0),d1 +p962 cmp.w (a0),d1 beq.s p962 move.l a2,a1 jsr -$12c(a6) ; SetTaskPri moveq #1,d1 movem.l (sp)+,d0-d1/a0-a2/a6 addq.l #4,sp ; return directly to caller -p961 rts +p961 rts ; mouse hack @@ -903,12 +906,16 @@ mousehack_init: tst.b 157(a3) bne.s .no lea mousehack_e(pc),a0 - tst.w (a0) - beq.s .no + cmp.b #1,(a0) + bne.s .no lea mhname(pc),a0 lea mousehack_task(pc),a1 bsr createtask st 157(a3) + ;tell native side that mousehack is active + move.w #$FF38,d0 + bsr.w getrtbase + jsr (a0) .no move.l (sp)+,a0 rts diff --git a/src/filesys_bootrom.c b/src/filesys_bootrom.c index fdf17df..6c62c9e 100644 --- a/src/filesys_bootrom.c +++ b/src/filesys_bootrom.c @@ -1,35 +1,35 @@ db(0x00); db(0x00); db(0x00); db(0x10); db(0x00); db(0x00); db(0x00); db(0x00); - db(0x60); db(0x00); db(0x04); db(0xf6); db(0x00); db(0x00); db(0x03); db(0xb2); + db(0x60); db(0x00); db(0x04); db(0xee); db(0x00); db(0x00); db(0x03); db(0xaa); db(0x00); db(0x00); db(0x00); db(0x34); db(0x00); db(0x00); db(0x00); db(0xd4); db(0x00); db(0x00); db(0x00); db(0x20); db(0x00); db(0x00); db(0x01); db(0x8e); - db(0x00); db(0x00); db(0x06); db(0xb6); db(0x00); db(0x00); db(0x07); db(0xda); - db(0x43); db(0xfa); db(0x09); db(0xa6); db(0x4e); db(0xae); db(0xff); db(0xa0); + db(0x00); db(0x00); db(0x06); db(0xb0); db(0x00); db(0x00); db(0x07); db(0xd4); + db(0x43); db(0xfa); db(0x09); db(0xac); db(0x4e); db(0xae); db(0xff); db(0xa0); db(0x20); db(0x40); db(0x20); db(0x28); db(0x00); db(0x16); db(0x20); db(0x40); db(0x4e); db(0x90); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0xff); db(0xfe); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x30); db(0x3c); db(0xff); db(0xfc); - db(0x61); db(0x00); db(0x06); db(0x64); db(0x2a); db(0x50); db(0x43); db(0xfa); - db(0x09); db(0x9e); db(0x70); db(0x24); db(0x7a); db(0x00); db(0x4e); db(0xae); + db(0x61); db(0x00); db(0x06); db(0x5e); db(0x2a); db(0x50); db(0x43); db(0xfa); + db(0x09); db(0xa4); db(0x70); db(0x24); db(0x7a); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x4a); db(0x80); db(0x66); db(0x0c); db(0x43); db(0xfa); - db(0x09); db(0x8e); db(0x70); db(0x00); db(0x7a); db(0x01); db(0x4e); db(0xae); + db(0x09); db(0x94); db(0x70); db(0x00); db(0x7a); db(0x01); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x28); db(0x40); db(0x20); db(0x3c); db(0x00); db(0x00); db(0x02); db(0x2c); db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x26); db(0x40); db(0x27); db(0x4c); db(0x01); db(0x9c); db(0x7c); db(0x00); db(0xbc); db(0xad); db(0x01); db(0x0c); db(0x64); db(0x24); db(0x2f); db(0x06); db(0x7e); db(0x01); db(0x2f); db(0x0b); db(0x20); db(0x4b); db(0x61); db(0x00); - db(0x03); db(0x2a); db(0x26); db(0x5f); db(0x0c); db(0x80); db(0xff); db(0xff); + db(0x03); db(0x22); db(0x26); db(0x5f); db(0x0c); db(0x80); db(0xff); db(0xff); db(0xff); db(0xfe); db(0x67); db(0x08); db(0x48); db(0x46); db(0x52); db(0x46); db(0x48); db(0x46); db(0x60); db(0xe4); db(0x2c); db(0x1f); db(0x52); db(0x46); db(0x60); db(0xd6); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0x62); db(0x30); db(0x3c); db(0xff); db(0x80); - db(0x61); db(0x00); db(0x05); db(0xf4); db(0x4e); db(0x90); db(0x72); db(0x03); + db(0x61); db(0x00); db(0x05); db(0xee); db(0x4e); db(0x90); db(0x72); db(0x03); db(0x74); db(0xf6); db(0x20); db(0x7c); db(0x00); db(0x20); db(0x00); db(0x00); db(0x90); db(0x88); db(0x65); db(0x0a); db(0x67); db(0x08); db(0x78); db(0x00); db(0x22); db(0x44); db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x4c); db(0xdf); db(0x7f); db(0xff); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x00); db(0x20); - db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00); db(0x05); db(0xc8); + db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00); db(0x05); db(0xc2); db(0x70); db(0x00); db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x00); db(0x00); db(0xa0); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x30); db(0x3c); - db(0xff); db(0x50); db(0x61); db(0x00); db(0x05); db(0xb2); db(0x70); db(0x02); + db(0xff); db(0x50); db(0x61); db(0x00); db(0x05); db(0xac); db(0x70); db(0x02); db(0x4e); db(0x90); db(0x0c); db(0x40); db(0x00); db(0x01); db(0x6d); db(0x7a); db(0x6e); db(0x06); db(0x4e); db(0xae); db(0xfe); db(0x92); db(0x60); db(0xe6); db(0x0c); db(0x40); db(0x00); db(0x02); db(0x6e); db(0x08); db(0x20); db(0x01); @@ -47,11 +47,11 @@ db(0x25); db(0x49); db(0x00); db(0x1a); db(0x20); db(0x69); db(0x00); db(0x10); db(0x22); db(0x4a); db(0x4e); db(0xae); db(0xfe); db(0x92); db(0x60); db(0x00); db(0xff); db(0x76); db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00); - db(0x05); db(0x26); db(0x70); db(0x04); db(0x4e); db(0x90); db(0x70); db(0x01); + db(0x05); db(0x20); db(0x70); db(0x04); db(0x4e); db(0x90); db(0x70); db(0x01); db(0x4c); db(0xdf); db(0x04); db(0x00); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0xc0); db(0xc0); db(0x70); db(0x1a); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x22); db(0x40); - db(0x41); db(0xfa); db(0x08); db(0x17); db(0x23); db(0x48); db(0x00); db(0x0a); + db(0x41); db(0xfa); db(0x08); db(0x1d); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x41); db(0xfa); db(0xff); db(0x2a); db(0x23); db(0x48); db(0x00); db(0x0e); db(0x41); db(0xfa); db(0xff); db(0x22); db(0x23); db(0x48); db(0x00); db(0x12); db(0x33); db(0x7c); db(0x02); db(0x14); db(0x00); db(0x08); db(0x70); db(0x03); @@ -64,24 +64,23 @@ db(0x00); db(0x00); db(0x00); db(0x0e); db(0x52); db(0x40); db(0x0c); db(0x40); db(0x00); db(0x8c); db(0x66); db(0xf2); db(0x20); db(0x0a); db(0xe4); db(0x88); db(0x21); db(0x40); db(0x00); db(0x36); db(0x22); db(0x48); db(0x41); db(0xfa); - db(0x07); db(0xb1); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x20); db(0x6b); + db(0x07); db(0xb7); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x20); db(0x6b); db(0x01); db(0x98); db(0x41); db(0xe8); db(0x00); db(0x12); db(0x4e); db(0xae); db(0xff); db(0x10); db(0x4c); db(0xdf); db(0x4f); db(0x03); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x7f); db(0x7e); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x24); db(0x48); db(0x0c); db(0x9a); db(0x00); db(0x00); db(0x03); db(0xf3); - db(0x66); db(0x00); db(0x00); db(0xec); db(0x50); db(0x8a); db(0x2e); db(0x2a); + db(0x66); db(0x00); db(0x00); db(0xe4); db(0x50); db(0x8a); db(0x2e); db(0x2a); db(0x00); db(0x04); db(0x9e); db(0x92); db(0x50); db(0x8a); db(0x52); db(0x87); db(0x26); db(0x4a); db(0x20); db(0x07); db(0xd0); db(0x80); db(0xd0); db(0x80); db(0xd7); db(0xc0); db(0x28); db(0x4a); db(0x9b); db(0xcd); db(0x7c); db(0x00); - db(0x24); db(0x12); db(0xe5); db(0x8a); db(0x72); db(0x01); db(0x08); db(0x03); - db(0x00); db(0x1e); db(0x67); db(0x04); db(0x08); db(0xc1); db(0x00); db(0x01); - db(0x08); db(0xc1); db(0x00); db(0x10); db(0x08); db(0x83); db(0x00); db(0x1f); - db(0x08); db(0x83); db(0x00); db(0x1e); db(0x20); db(0x02); db(0x66); db(0x04); + db(0x24); db(0x12); db(0x72); db(0x01); db(0x08); db(0x02); db(0x00); db(0x1e); + db(0x67); db(0x04); db(0x08); db(0xc1); db(0x00); db(0x01); db(0x08); db(0xc1); + db(0x00); db(0x10); db(0xe5); db(0x8a); db(0x20); db(0x02); db(0x66); db(0x04); db(0x42); db(0x9a); db(0x60); db(0x1e); db(0x50); db(0x80); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x00); db(0x00); db(0xa0); db(0x20); db(0x40); db(0x20); db(0xc2); db(0x24); db(0xc8); db(0x22); db(0x0d); db(0x67); db(0x06); db(0x20); db(0x08); db(0xe4); db(0x88); db(0x2a); db(0x80); - db(0x2a); db(0x48); db(0x52); db(0x86); db(0xbe); db(0x86); db(0x66); db(0xb8); + db(0x2a); db(0x48); db(0x52); db(0x86); db(0xbe); db(0x86); db(0x66); db(0xc0); db(0x7c); db(0x00); db(0x22); db(0x06); db(0xd2); db(0x81); db(0xd2); db(0x81); db(0x20); db(0x74); db(0x18); db(0x00); db(0x58); db(0x88); db(0x26); db(0x1b); db(0x28); db(0x1b); db(0xe5); db(0x8c); db(0x0c); db(0x83); db(0x00); db(0x00); @@ -106,48 +105,48 @@ db(0x60); db(0xd4); db(0x48); db(0xe7); db(0x40); db(0xe2); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x41); db(0xee); db(0x01); db(0x50); db(0x20); db(0x50); db(0x4a); db(0x90); db(0x67); db(0x1a); db(0x22); db(0x68); db(0x00); db(0x0a); - db(0x45); db(0xfa); db(0x06); db(0x9e); db(0x10); db(0x19); db(0x12); db(0x1a); + db(0x45); db(0xfa); db(0x06); db(0xac); db(0x10); db(0x19); db(0x12); db(0x1a); db(0xb0); db(0x01); db(0x66); db(0x06); db(0x4a); db(0x00); db(0x67); db(0x42); db(0x60); db(0xf2); db(0x20); db(0x50); db(0x60); db(0xe2); db(0x70); db(0x20); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x24); db(0x40); db(0x15); db(0x7c); db(0x00); db(0x08); - db(0x00); db(0x08); db(0x41); db(0xfa); db(0x06); db(0x74); db(0x25); db(0x48); - db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x06); db(0x2d); db(0x25); db(0x48); + db(0x00); db(0x08); db(0x41); db(0xfa); db(0x06); db(0x82); db(0x25); db(0x48); + db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x06); db(0x3b); db(0x25); db(0x48); db(0x00); db(0x0e); db(0x41); db(0xea); db(0x00); db(0x12); db(0x20); db(0x88); db(0x58); db(0x90); db(0x21); db(0x48); db(0x00); db(0x08); db(0x41); db(0xee); db(0x01); db(0x50); db(0x22); db(0x4a); db(0x4e); db(0xae); db(0xff); db(0x0a); db(0x20); db(0x4a); db(0x20); db(0x08); db(0x4c); db(0xdf); db(0x47); db(0x02); db(0x4e); db(0x75); db(0x61); db(0x00); db(0xff); db(0x8e); db(0x21); db(0x40); db(0x01); db(0x98); db(0x2f); db(0x08); db(0x30); db(0x3c); db(0xff); db(0xfc); - db(0x61); db(0x00); db(0x02); db(0xe4); db(0x2a); db(0x50); db(0x30); db(0x3c); - db(0xff); db(0x28); db(0x61); db(0x00); db(0x02); db(0xda); db(0x22); db(0x48); + db(0x61); db(0x00); db(0x02); db(0xe6); db(0x2a); db(0x50); db(0x30); db(0x3c); + db(0xff); db(0x28); db(0x61); db(0x00); db(0x02); db(0xdc); db(0x22); db(0x48); db(0x20); db(0x5f); db(0x42); db(0xa8); db(0x01); db(0x90); db(0x42); db(0xa8); db(0x01); db(0x94); db(0x4e); db(0x91); db(0x26); db(0x00); db(0x0c); db(0x83); - db(0xff); db(0xff); db(0xff); db(0xfe); db(0x67); db(0x00); db(0xfc); db(0xec); + db(0xff); db(0xff); db(0xff); db(0xfe); db(0x67); db(0x00); db(0xfc); db(0xf4); db(0x0c); db(0x83); db(0x00); db(0x00); db(0x00); db(0x02); db(0x67); db(0x0c); db(0xc0); db(0x85); db(0x67); db(0x08); db(0x4a); db(0xa8); db(0x01); db(0x90); - db(0x67); db(0x00); db(0xfc); db(0xd8); db(0x20); db(0x28); db(0x01); db(0x90); + db(0x67); db(0x00); db(0xfc); db(0xe0); db(0x20); db(0x28); db(0x01); db(0x90); db(0x67); db(0x12); db(0x2f); db(0x08); db(0x72); db(0x01); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x5f); db(0x21); db(0x40); db(0x01); db(0x94); db(0x4a); db(0x83); db(0x6a); db(0x10); db(0x22); db(0x48); db(0x30); db(0x3c); db(0xff); db(0x20); db(0x61); db(0x00); - db(0x02); db(0x86); db(0x4e); db(0x90); db(0x60); db(0x00); db(0x00); db(0x28); + db(0x02); db(0x88); db(0x4e); db(0x90); db(0x60); db(0x00); db(0x00); db(0x28); db(0x2c); db(0x4c); db(0x2f); db(0x08); db(0x4e); db(0xae); db(0xff); db(0x70); db(0x20); db(0x5f); db(0x22); db(0x48); db(0x26); db(0x40); db(0x30); db(0x3c); - db(0xff); db(0x20); db(0x61); db(0x00); db(0x02); db(0x6a); db(0x4e); db(0x90); + db(0xff); db(0x20); db(0x61); db(0x00); db(0x02); db(0x6c); db(0x4e); db(0x90); db(0x70); db(0x00); db(0x27); db(0x40); db(0x00); db(0x08); db(0x27); db(0x40); db(0x00); db(0x10); db(0x27); db(0x40); db(0x00); db(0x20); db(0x4a); db(0xa9); db(0x01); db(0x94); db(0x67); db(0x28); db(0x20); db(0x69); db(0x01); db(0x94); - db(0x61); db(0x00); db(0xfd); db(0xc6); db(0x48); db(0xe7); db(0x80); db(0xc0); + db(0x61); db(0x00); db(0xfd); db(0xce); db(0x48); db(0xe7); db(0x80); db(0xc0); db(0x20); db(0x29); db(0x01); db(0x90); db(0x22); db(0x69); db(0x01); db(0x94); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x4c); db(0xdf); db(0x03); db(0x01); db(0x4a); db(0x80); db(0x67); db(0x04); - db(0x61); db(0x00); db(0xfd); db(0x50); db(0x4a); db(0x83); db(0x6b); db(0x00); - db(0xfc); db(0x52); db(0x30); db(0x3c); db(0xff); db(0x18); db(0x61); db(0x00); - db(0x02); db(0x1e); db(0x4e); db(0x90); db(0x20); db(0x03); db(0x16); db(0x29); + db(0x61); db(0x00); db(0xfd); db(0x58); db(0x4a); db(0x83); db(0x6b); db(0x00); + db(0xfc); db(0x5a); db(0x30); db(0x3c); db(0xff); db(0x18); db(0x61); db(0x00); + db(0x02); db(0x20); db(0x4e); db(0x90); db(0x20); db(0x03); db(0x16); db(0x29); db(0x00); db(0x4f); db(0x4a); db(0x80); db(0x66); db(0x1a); db(0x27); db(0x7c); db(0x00); db(0x00); db(0x0f); db(0xa0); db(0x00); db(0x14); db(0x43); db(0xfa); - db(0xfb); db(0x5c); db(0x20); db(0x09); db(0xe4); db(0x88); db(0x27); db(0x40); + db(0xfb); db(0x64); db(0x20); db(0x09); db(0xe4); db(0x88); db(0x27); db(0x40); db(0x00); db(0x20); db(0x70); db(0xff); db(0x27); db(0x40); db(0x00); db(0x24); db(0x4a); db(0x87); db(0x67); db(0x36); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x70); db(0x14); db(0x72); db(0x00); db(0x4e); db(0xae); db(0xff); db(0x3a); @@ -160,7 +159,7 @@ db(0x70); db(0xff); db(0x2c); db(0x4c); db(0x4e); db(0xee); db(0xff); db(0x6a); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x70); db(0x00); db(0x22); db(0x40); db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x20); db(0x40); db(0x4b); db(0xe8); - db(0x00); db(0x5c); db(0x43); db(0xfa); db(0x04); db(0xbc); db(0x70); db(0x00); + db(0x00); db(0x5c); db(0x43); db(0xfa); db(0x04); db(0xca); db(0x70); db(0x00); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x24); db(0x40); db(0x20); db(0x3c); db(0x00); db(0x00); db(0x00); db(0x9e); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x26); db(0x40); @@ -168,9 +167,9 @@ db(0x27); db(0x46); db(0x00); db(0x08); db(0x7a); db(0x00); db(0x20); db(0x4d); db(0x4e); db(0xae); db(0xfe); db(0x80); db(0x20); db(0x4d); db(0x4e); db(0xae); db(0xfe); db(0x8c); db(0x28); db(0x40); db(0x26); db(0x2c); db(0x00); db(0x0a); - db(0x30); db(0x3c); db(0xff); db(0x40); db(0x61); db(0x00); db(0x01); db(0x58); - db(0x70); db(0x00); db(0x4e); db(0x90); db(0x61); db(0x00); db(0x02); db(0x88); - db(0x60); db(0x00); db(0x00); db(0xd8); db(0x61); db(0x00); db(0x02); db(0x80); + db(0x30); db(0x3c); db(0xff); db(0x40); db(0x61); db(0x00); db(0x01); db(0x5a); + db(0x70); db(0x00); db(0x4e); db(0x90); db(0x61); db(0x00); db(0x02); db(0x8a); + db(0x60); db(0x00); db(0x00); db(0xda); db(0x61); db(0x00); db(0x02); db(0x82); db(0x20); db(0x4d); db(0x4e); db(0xae); db(0xfe); db(0x80); db(0x20); db(0x4d); db(0x4e); db(0xae); db(0xfe); db(0x8c); db(0x28); db(0x40); db(0x0c); db(0x6c); db(0x00); db(0x26); db(0x00); db(0x12); db(0x66); db(0x4a); db(0x0c); db(0xac); @@ -183,142 +182,144 @@ db(0x00); db(0x10); db(0x22); db(0x4c); db(0x12); db(0xbc); db(0x00); db(0x08); db(0x4e); db(0xae); db(0xfe); db(0x92); db(0x60); db(0xa6); db(0x22); db(0x4c); db(0x70); db(0x26); db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x60); db(0x9c); - db(0x26); db(0x2c); db(0x00); db(0x0a); db(0x66); db(0x3c); db(0x30); db(0x3c); - db(0xff); db(0x50); db(0x61); db(0x00); db(0x00); db(0xda); db(0x70); db(0x01); + db(0x26); db(0x2c); db(0x00); db(0x0a); db(0x66); db(0x3e); db(0x30); db(0x3c); + db(0xff); db(0x50); db(0x61); db(0x00); db(0x00); db(0xdc); db(0x70); db(0x01); db(0x4e); db(0x90); db(0x45); db(0xeb); db(0x00); db(0x04); db(0x20); db(0x52); - db(0x20); db(0x08); db(0x67); db(0x80); db(0x22); db(0x50); db(0x20); db(0x40); - db(0x20); db(0x28); db(0x00); db(0x04); db(0x6a); db(0x16); db(0x48); db(0xe7); - db(0x00); db(0xc0); db(0x28); db(0x68); db(0x00); db(0x0a); db(0x61); db(0x4a); - db(0x53); db(0x85); db(0x4c); db(0xdf); db(0x03); db(0x00); db(0x24); db(0x89); - db(0x20); db(0x49); db(0x60); db(0xdc); db(0x24); db(0x48); db(0x20); db(0x49); - db(0x60); db(0xd6); db(0x0c); db(0x85); db(0x00); db(0x00); db(0x00); db(0x14); - db(0x65); db(0x00); db(0x00); db(0x0a); db(0x70); db(0x01); db(0x29); db(0x40); - db(0x00); db(0x04); db(0x60); db(0x12); db(0x61); db(0x32); db(0x30); db(0x3c); - db(0xff); db(0x30); db(0x61); db(0x00); db(0x00); db(0x8a); db(0x4e); db(0x90); - db(0x4a); db(0x80); db(0x67); db(0x0e); db(0x52); db(0x85); db(0x28); db(0xab); - db(0x00); db(0x04); db(0x27); db(0x4c); db(0x00); db(0x04); db(0x60); db(0x00); - db(0xff); db(0x2c); db(0x28); db(0x43); db(0x61); db(0x04); db(0x60); db(0x00); - db(0xff); db(0x24); db(0x22); db(0x54); db(0x20); db(0x6c); db(0x00); db(0x04); - db(0x29); db(0x4d); db(0x00); db(0x04); db(0x4e); db(0xee); db(0xfe); db(0x92); - db(0x2f); db(0x05); db(0x7a); db(0xfc); db(0x24); db(0x53); db(0x2e); db(0x0a); - db(0x22); db(0x0a); db(0x67); db(0x00); db(0x00); db(0x0c); db(0x52); db(0x85); - db(0x67); db(0x1e); db(0x22); db(0x4a); db(0x24); db(0x52); db(0x60); db(0xf0); - db(0x52); db(0x85); db(0x67); db(0x3c); db(0x24); db(0x47); db(0x70); db(0x18); - db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x52); db(0x46); - db(0x24); db(0x40); db(0x24); db(0x87); db(0x2e); db(0x0a); db(0x60); db(0xe8); - db(0x20); db(0x12); db(0x67); db(0x24); db(0x20); db(0x40); db(0x20); db(0x10); - db(0x67); db(0x1e); db(0x20); db(0x40); db(0x20); db(0x10); db(0x67); db(0x18); - db(0x70); db(0x00); db(0x22); db(0x80); db(0x22); db(0x4a); db(0x24); db(0x51); - db(0x70); db(0x18); db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x06); db(0x86); - db(0x00); db(0x01); db(0x00); db(0x00); db(0x20); db(0x0a); db(0x66); db(0xec); - db(0x26); db(0x87); db(0x2a); db(0x1f); db(0x4e); db(0x75); db(0x41); db(0xfa); - db(0xf9); db(0x4c); db(0x02); db(0x80); db(0x00); db(0x00); db(0xff); db(0xff); - db(0xd1); db(0xc0); db(0x4e); db(0x75); db(0x00); db(0x00); db(0x0c); db(0xaf); - db(0x00); db(0x00); db(0x00); db(0x22); db(0x00); db(0x08); db(0x66); db(0x30); - db(0x48); db(0xe7); db(0xc0); db(0xe2); db(0x2c); db(0x78); db(0x00); db(0x04); - db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x24); db(0x40); - db(0x22); db(0x4a); db(0x70); db(0xec); db(0x4e); db(0xae); db(0xfe); db(0xd4); - db(0x41); db(0xfa); db(0xff); db(0xda); db(0x32); db(0x10); db(0xb2); db(0x50); - db(0x67); db(0xfc); db(0x22); db(0x4a); db(0x4e); db(0xae); db(0xfe); db(0xd4); - db(0x72); db(0x01); db(0x4c); db(0xdf); db(0x47); db(0x03); db(0x58); db(0x8f); - db(0x4e); db(0x75); db(0x20); db(0x88); db(0x58); db(0x90); db(0x42); db(0xa8); - db(0x00); db(0x04); db(0x21); db(0x48); db(0x00); db(0x08); db(0x4e); db(0x75); - db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x79); db(0x00); db(0x00); - db(0x00); db(0x04); db(0x70); db(0xff); db(0x4e); db(0xae); db(0xfe); db(0xb6); - db(0x91); db(0xc8); db(0x24); db(0x00); db(0x6b); db(0x32); db(0x70); db(0x22); - db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); - db(0xff); db(0x3a); db(0x91); db(0xc8); db(0x24); db(0x40); db(0x4a); db(0x80); - db(0x67); db(0x1e); db(0x15); db(0x7c); db(0x00); db(0x04); db(0x00); db(0x08); - db(0x15); db(0x42); db(0x00); db(0x0f); db(0x93); db(0xc9); db(0x4e); db(0xae); - db(0xfe); db(0xda); db(0x25); db(0x40); db(0x00); db(0x10); db(0x41); db(0xea); - db(0x00); db(0x14); db(0x61); db(0x00); db(0xff); db(0xae); db(0x20); db(0x4a); - db(0x20); db(0x08); db(0x4c); db(0xdf); db(0x44); db(0x04); db(0x4e); db(0x75); - db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x79); db(0x00); db(0x00); - db(0x00); db(0x04); db(0x4a); db(0x80); db(0x67); db(0x20); db(0x24); db(0x40); - db(0x74); db(0x30); db(0x20); db(0x02); db(0x22); db(0x3c); db(0x00); db(0x01); - db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x40); - db(0x11); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x08); db(0x21); db(0x42); - db(0x00); db(0x12); db(0x21); db(0x4a); db(0x00); db(0x0e); db(0x4c); db(0xdf); - db(0x44); db(0x04); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x30); db(0x32); - db(0x2c); db(0x79); db(0x00); db(0x00); db(0x00); db(0x04); db(0x24); db(0x08); - db(0x26); db(0x09); db(0x20); db(0x3c); db(0x00); db(0x00); db(0x08); db(0x5c); - db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); - db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x00); db(0x00); db(0x2c); - db(0x24); db(0x40); db(0x15); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x08); - db(0x25); db(0x42); db(0x00); db(0x0a); db(0x47); db(0xea); db(0x00); db(0x5c); - db(0x25); db(0x4b); db(0x00); db(0x3a); db(0x47); db(0xeb); db(0x08); db(0x00); - db(0x25); db(0x4b); db(0x00); db(0x3e); db(0x25); db(0x4b); db(0x00); db(0x36); - db(0x22); db(0x4a); db(0x24); db(0x43); db(0x97); db(0xcb); db(0x4e); db(0xae); - db(0xfe); db(0xe6); db(0x4c); db(0xdf); db(0x4c); db(0x0c); db(0x4e); db(0x75); - db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); db(0x2f); db(0x08); - db(0x4a); db(0x2b); db(0x00); db(0x9d); db(0x66); db(0x18); db(0x41); db(0xfa); - db(0xff); db(0xf0); db(0x4a); db(0x50); db(0x67); db(0x10); db(0x41); db(0xfa); - db(0x01); db(0xba); db(0x43); db(0xfa); db(0x00); db(0x0e); db(0x61); db(0x00); - db(0xff); db(0x8c); db(0x50); db(0xeb); db(0x00); db(0x9d); db(0x20); db(0x5f); - db(0x4e); db(0x75); db(0x2c); db(0x79); db(0x00); db(0x00); db(0x00); db(0x04); - db(0x70); db(0xff); db(0x4e); db(0xae); db(0xfe); db(0xb6); db(0x74); db(0x00); - db(0x01); db(0xc2); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda); - db(0x28); db(0x40); db(0x70); db(0x14); db(0x22); db(0x4c); db(0x4e); db(0xae); - db(0xfe); db(0xd4); db(0x70); db(0x00); db(0x43); db(0xfa); db(0x01); db(0xae); - db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x2e); db(0x00); db(0x70); db(0x00); - db(0x30); db(0x3c); db(0x00); db(0x44); db(0x22); db(0x3c); db(0x00); db(0x01); - db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x2a); db(0x40); - db(0x61); db(0x00); db(0xfe); db(0xbe); db(0x61); db(0x00); db(0xff); db(0x0a); - db(0x2b); db(0x40); db(0x00); db(0x3c); db(0x67); db(0x00); db(0x00); db(0x7a); - db(0x22); db(0x40); db(0x41); db(0xfa); db(0x01); db(0x3c); db(0x70); db(0x00); - db(0x72); db(0x00); db(0x4e); db(0xae); db(0xfe); db(0x44); db(0x4a); db(0x80); - db(0x66); db(0x00); db(0x00); db(0x66); db(0x61); db(0x00); db(0xfe); db(0x9a); - db(0x61); db(0x00); db(0xfe); db(0xe6); db(0x2b); db(0x40); db(0x00); db(0x40); - db(0x67); db(0x00); db(0x00); db(0x56); db(0x22); db(0x40); db(0x41); db(0xfa); - db(0x01); db(0x25); db(0x70); db(0x00); db(0x72); db(0x00); db(0x4e); db(0xae); - db(0xfe); db(0x44); db(0x4a); db(0x80); db(0x66); db(0x00); db(0x00); db(0x42); - db(0x47); db(0xed); db(0x00); db(0x16); db(0x27); db(0x4c); db(0x00); db(0x0c); - db(0x27); db(0x42); db(0x00); db(0x08); db(0x70); db(0xff); db(0x26); db(0x80); - db(0x27); db(0x40); db(0x00); db(0x04); db(0x43); db(0xed); db(0x00); db(0x00); - db(0x13); db(0x7c); db(0x00); db(0x02); db(0x00); db(0x08); db(0x13); db(0x7c); - db(0x00); db(0x05); db(0x00); db(0x09); db(0x41); db(0xfa); db(0x00); db(0xfc); - db(0x23); db(0x48); db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x00); db(0xa0); - db(0x23); db(0x48); db(0x00); db(0x12); db(0x23); db(0x4b); db(0x00); db(0x0e); - db(0x70); db(0x05); db(0x4e); db(0xae); db(0xff); db(0x58); db(0x60); db(0x02); - db(0x4e); db(0x75); db(0x20); db(0x02); db(0x4e); db(0xae); db(0xfe); db(0xc2); - db(0x22); db(0x6d); db(0x00); db(0x3c); db(0x45); db(0xed); db(0x00); db(0x26); - db(0x33); db(0x7c); db(0x00); db(0x0b); db(0x00); db(0x1c); db(0x23); db(0x7c); - db(0x00); db(0x00); db(0x00); db(0x16); db(0x00); db(0x24); db(0x23); db(0x4a); - db(0x00); db(0x28); db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e); - db(0x15); db(0x7c); db(0x00); db(0x04); db(0x00); db(0x04); db(0x42); db(0x2a); - db(0x00); db(0x05); db(0x42); db(0x6a); db(0x00); db(0x06); db(0x42); db(0x6a); - db(0x00); db(0x08); db(0x20); db(0x47); db(0x20); db(0x2d); db(0x00); db(0x16); - db(0x32); db(0x28); db(0x00); db(0x30); db(0xd2); db(0x41); db(0x90); db(0x41); - db(0x35); db(0x40); db(0x00); db(0x0a); db(0x20); db(0x2d); db(0x00); db(0x1a); - db(0x32); db(0x28); db(0x00); db(0x2e); db(0xd2); db(0x41); db(0x90); db(0x41); - db(0x48); db(0xc0); db(0x35); db(0x40); db(0x00); db(0x0c); db(0x22); db(0x6d); - db(0x00); db(0x40); db(0x33); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x1c); - db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e); db(0x4e); db(0xae); - db(0xfe); db(0x38); db(0x22); db(0x6d); db(0x00); db(0x40); db(0x25); db(0x69); - db(0x00); db(0x20); db(0x00); db(0x0e); db(0x25); db(0x69); db(0x00); db(0x24); - db(0x00); db(0x12); db(0x22); db(0x6d); db(0x00); db(0x3c); db(0x4e); db(0xae); - db(0xfe); db(0x38); db(0x60); db(0x00); db(0xff); db(0x76); db(0x30); db(0x3a); - db(0xfe); db(0x82); db(0x48); db(0xc0); db(0x32); db(0x3a); db(0xfe); db(0x7e); - db(0x48); db(0xc1); db(0xb0); db(0x91); db(0x66); db(0x00); db(0x00); db(0x0a); - db(0xb2); db(0xa9); db(0x00); db(0x04); db(0x67); db(0x00); db(0x00); db(0x18); - db(0x23); db(0x41); db(0x00); db(0x04); db(0x22); db(0x80); db(0x20); db(0x29); - db(0x00); db(0x08); db(0x22); db(0x69); db(0x00); db(0x0c); db(0x2c); db(0x78); - db(0x00); db(0x04); db(0x4e); db(0xae); db(0xfe); db(0xbc); db(0x41); db(0xf9); - db(0x00); db(0xdf); db(0xf0); db(0x00); db(0x70); db(0x00); db(0x4e); db(0x75); - db(0x69); db(0x6e); db(0x70); db(0x75); db(0x74); db(0x2e); db(0x64); db(0x65); - db(0x76); db(0x69); db(0x63); db(0x65); db(0x00); db(0x74); db(0x69); db(0x6d); - db(0x65); db(0x72); db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); db(0x63); - db(0x65); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x6d); db(0x6f); - db(0x75); db(0x73); db(0x65); db(0x20); db(0x68); db(0x61); db(0x63); db(0x6b); - db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x66); db(0x69); db(0x6c); - db(0x65); db(0x73); db(0x79); db(0x73); db(0x74); db(0x65); db(0x6d); db(0x00); - db(0x64); db(0x6f); db(0x73); db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72); - db(0x61); db(0x72); db(0x79); db(0x00); db(0x69); db(0x6e); db(0x74); db(0x75); - db(0x69); db(0x74); db(0x69); db(0x6f); db(0x6e); db(0x2e); db(0x6c); db(0x69); - db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00); db(0x65); db(0x78); - db(0x70); db(0x61); db(0x6e); db(0x73); db(0x69); db(0x6f); db(0x6e); db(0x2e); - db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00); - db(0x46); db(0x69); db(0x6c); db(0x65); db(0x53); db(0x79); db(0x73); db(0x74); - db(0x65); db(0x6d); db(0x2e); db(0x72); db(0x65); db(0x73); db(0x6f); db(0x75); - db(0x72); db(0x63); db(0x65); db(0x00); db(0x00); db(0x00); db(0x03); db(0xf2); + db(0x20); db(0x08); db(0x67); db(0x00); db(0xff); db(0x80); db(0x22); db(0x50); + db(0x20); db(0x40); db(0x20); db(0x28); db(0x00); db(0x04); db(0x6a); db(0x16); + db(0x48); db(0xe7); db(0x00); db(0xc0); db(0x28); db(0x68); db(0x00); db(0x0a); + db(0x61); db(0x4a); db(0x53); db(0x85); db(0x4c); db(0xdf); db(0x03); db(0x00); + db(0x24); db(0x89); db(0x20); db(0x49); db(0x60); db(0xda); db(0x24); db(0x48); + db(0x20); db(0x49); db(0x60); db(0xd4); db(0x0c); db(0x85); db(0x00); db(0x00); + db(0x00); db(0x14); db(0x65); db(0x00); db(0x00); db(0x0a); db(0x70); db(0x01); + db(0x29); db(0x40); db(0x00); db(0x04); db(0x60); db(0x12); db(0x61); db(0x32); + db(0x30); db(0x3c); db(0xff); db(0x30); db(0x61); db(0x00); db(0x00); db(0x8a); + db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x0e); db(0x52); db(0x85); + db(0x28); db(0xab); db(0x00); db(0x04); db(0x27); db(0x4c); db(0x00); db(0x04); + db(0x60); db(0x00); db(0xff); db(0x2a); db(0x28); db(0x43); db(0x61); db(0x04); + db(0x60); db(0x00); db(0xff); db(0x22); db(0x22); db(0x54); db(0x20); db(0x6c); + db(0x00); db(0x04); db(0x29); db(0x4d); db(0x00); db(0x04); db(0x4e); db(0xee); + db(0xfe); db(0x92); db(0x2f); db(0x05); db(0x7a); db(0xfc); db(0x24); db(0x53); + db(0x2e); db(0x0a); db(0x22); db(0x0a); db(0x67); db(0x00); db(0x00); db(0x0c); + db(0x52); db(0x85); db(0x67); db(0x1e); db(0x22); db(0x4a); db(0x24); db(0x52); + db(0x60); db(0xf0); db(0x52); db(0x85); db(0x67); db(0x3c); db(0x24); db(0x47); + db(0x70); db(0x18); db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); + db(0x52); db(0x46); db(0x24); db(0x40); db(0x24); db(0x87); db(0x2e); db(0x0a); + db(0x60); db(0xe8); db(0x20); db(0x12); db(0x67); db(0x24); db(0x20); db(0x40); + db(0x20); db(0x10); db(0x67); db(0x1e); db(0x20); db(0x40); db(0x20); db(0x10); + db(0x67); db(0x18); db(0x70); db(0x00); db(0x22); db(0x80); db(0x22); db(0x4a); + db(0x24); db(0x51); db(0x70); db(0x18); db(0x4e); db(0xae); db(0xff); db(0x2e); + db(0x06); db(0x86); db(0x00); db(0x01); db(0x00); db(0x00); db(0x20); db(0x0a); + db(0x66); db(0xec); db(0x26); db(0x87); db(0x2a); db(0x1f); db(0x4e); db(0x75); + db(0x41); db(0xfa); db(0xf9); db(0x52); db(0x02); db(0x80); db(0x00); db(0x00); + db(0xff); db(0xff); db(0xd1); db(0xc0); db(0x4e); db(0x75); db(0x00); db(0x00); + db(0x0c); db(0xaf); db(0x00); db(0x00); db(0x00); db(0x22); db(0x00); db(0x08); + db(0x66); db(0x30); db(0x48); db(0xe7); db(0xc0); db(0xe2); db(0x2c); db(0x78); + db(0x00); db(0x04); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda); + db(0x24); db(0x40); db(0x22); db(0x4a); db(0x70); db(0xec); db(0x4e); db(0xae); + db(0xfe); db(0xd4); db(0x41); db(0xfa); db(0xff); db(0xda); db(0x32); db(0x10); + db(0xb2); db(0x50); db(0x67); db(0xfc); db(0x22); db(0x4a); db(0x4e); db(0xae); + db(0xfe); db(0xd4); db(0x72); db(0x01); db(0x4c); db(0xdf); db(0x47); db(0x03); + db(0x58); db(0x8f); db(0x4e); db(0x75); db(0x20); db(0x88); db(0x58); db(0x90); + db(0x42); db(0xa8); db(0x00); db(0x04); db(0x21); db(0x48); db(0x00); db(0x08); + db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x79); + db(0x00); db(0x00); db(0x00); db(0x04); db(0x70); db(0xff); db(0x4e); db(0xae); + db(0xfe); db(0xb6); db(0x91); db(0xc8); db(0x24); db(0x00); db(0x6b); db(0x32); + db(0x70); db(0x22); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); + db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x91); db(0xc8); db(0x24); db(0x40); + db(0x4a); db(0x80); db(0x67); db(0x1e); db(0x15); db(0x7c); db(0x00); db(0x04); + db(0x00); db(0x08); db(0x15); db(0x42); db(0x00); db(0x0f); db(0x93); db(0xc9); + db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x25); db(0x40); db(0x00); db(0x10); + db(0x41); db(0xea); db(0x00); db(0x14); db(0x61); db(0x00); db(0xff); db(0xae); + db(0x20); db(0x4a); db(0x20); db(0x08); db(0x4c); db(0xdf); db(0x44); db(0x04); + db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x79); + db(0x00); db(0x00); db(0x00); db(0x04); db(0x4a); db(0x80); db(0x67); db(0x20); + db(0x24); db(0x40); db(0x74); db(0x30); db(0x20); db(0x02); db(0x22); db(0x3c); + db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); + db(0x20); db(0x40); db(0x11); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x08); + db(0x21); db(0x42); db(0x00); db(0x12); db(0x21); db(0x4a); db(0x00); db(0x0e); + db(0x4c); db(0xdf); db(0x44); db(0x04); db(0x4e); db(0x75); db(0x48); db(0xe7); + db(0x30); db(0x32); db(0x2c); db(0x79); db(0x00); db(0x00); db(0x00); db(0x04); + db(0x24); db(0x08); db(0x26); db(0x09); db(0x20); db(0x3c); db(0x00); db(0x00); + db(0x08); db(0x5c); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); + db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x00); + db(0x00); db(0x2c); db(0x24); db(0x40); db(0x15); db(0x7c); db(0x00); db(0x01); + db(0x00); db(0x08); db(0x25); db(0x42); db(0x00); db(0x0a); db(0x47); db(0xea); + db(0x00); db(0x5c); db(0x25); db(0x4b); db(0x00); db(0x3a); db(0x47); db(0xeb); + db(0x08); db(0x00); db(0x25); db(0x4b); db(0x00); db(0x3e); db(0x25); db(0x4b); + db(0x00); db(0x36); db(0x22); db(0x4a); db(0x24); db(0x43); db(0x97); db(0xcb); + db(0x4e); db(0xae); db(0xfe); db(0xe6); db(0x4c); db(0xdf); db(0x4c); db(0x0c); + db(0x4e); db(0x75); db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); + db(0x2f); db(0x08); db(0x4a); db(0x2b); db(0x00); db(0x9d); db(0x66); db(0x24); + db(0x41); db(0xfa); db(0xff); db(0xf0); db(0x0c); db(0x10); db(0x00); db(0x01); + db(0x66); db(0x1a); db(0x41); db(0xfa); db(0x01); db(0xc4); db(0x43); db(0xfa); + db(0x00); db(0x18); db(0x61); db(0x00); db(0xff); db(0x8a); db(0x50); db(0xeb); + db(0x00); db(0x9d); db(0x30); db(0x3c); db(0xff); db(0x38); db(0x61); db(0x00); + db(0xfe); db(0xa0); db(0x4e); db(0x90); db(0x20); db(0x5f); db(0x4e); db(0x75); + db(0x2c); db(0x79); db(0x00); db(0x00); db(0x00); db(0x04); db(0x70); db(0xff); + db(0x4e); db(0xae); db(0xfe); db(0xb6); db(0x74); db(0x00); db(0x01); db(0xc2); + db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x28); db(0x40); + db(0x70); db(0x14); db(0x22); db(0x4c); db(0x4e); db(0xae); db(0xfe); db(0xd4); + db(0x70); db(0x00); db(0x43); db(0xfa); db(0x01); db(0xae); db(0x4e); db(0xae); + db(0xfd); db(0xd8); db(0x2e); db(0x00); db(0x70); db(0x00); db(0x30); db(0x3c); + db(0x00); db(0x44); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); + db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x2a); db(0x40); db(0x61); db(0x00); + db(0xfe); db(0xb2); db(0x61); db(0x00); db(0xfe); db(0xfe); db(0x2b); db(0x40); + db(0x00); db(0x3c); db(0x67); db(0x00); db(0x00); db(0x7a); db(0x22); db(0x40); + db(0x41); db(0xfa); db(0x01); db(0x3c); db(0x70); db(0x00); db(0x72); db(0x00); + db(0x4e); db(0xae); db(0xfe); db(0x44); db(0x4a); db(0x80); db(0x66); db(0x00); + db(0x00); db(0x66); db(0x61); db(0x00); db(0xfe); db(0x8e); db(0x61); db(0x00); + db(0xfe); db(0xda); db(0x2b); db(0x40); db(0x00); db(0x40); db(0x67); db(0x00); + db(0x00); db(0x56); db(0x22); db(0x40); db(0x41); db(0xfa); db(0x01); db(0x25); + db(0x70); db(0x00); db(0x72); db(0x00); db(0x4e); db(0xae); db(0xfe); db(0x44); + db(0x4a); db(0x80); db(0x66); db(0x00); db(0x00); db(0x42); db(0x47); db(0xed); + db(0x00); db(0x16); db(0x27); db(0x4c); db(0x00); db(0x0c); db(0x27); db(0x42); + db(0x00); db(0x08); db(0x70); db(0xff); db(0x26); db(0x80); db(0x27); db(0x40); + db(0x00); db(0x04); db(0x43); db(0xed); db(0x00); db(0x00); db(0x13); db(0x7c); + db(0x00); db(0x02); db(0x00); db(0x08); db(0x13); db(0x7c); db(0x00); db(0x05); + db(0x00); db(0x09); db(0x41); db(0xfa); db(0x00); db(0xfc); db(0x23); db(0x48); + db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x00); db(0xa0); db(0x23); db(0x48); + db(0x00); db(0x12); db(0x23); db(0x4b); db(0x00); db(0x0e); db(0x70); db(0x05); + db(0x4e); db(0xae); db(0xff); db(0x58); db(0x60); db(0x02); db(0x4e); db(0x75); + db(0x20); db(0x02); db(0x4e); db(0xae); db(0xfe); db(0xc2); db(0x22); db(0x6d); + db(0x00); db(0x3c); db(0x45); db(0xed); db(0x00); db(0x26); db(0x33); db(0x7c); + db(0x00); db(0x0b); db(0x00); db(0x1c); db(0x23); db(0x7c); db(0x00); db(0x00); + db(0x00); db(0x16); db(0x00); db(0x24); db(0x23); db(0x4a); db(0x00); db(0x28); + db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e); db(0x15); db(0x7c); + db(0x00); db(0x04); db(0x00); db(0x04); db(0x42); db(0x2a); db(0x00); db(0x05); + db(0x42); db(0x6a); db(0x00); db(0x06); db(0x42); db(0x6a); db(0x00); db(0x08); + db(0x20); db(0x47); db(0x20); db(0x2d); db(0x00); db(0x16); db(0x32); db(0x28); + db(0x00); db(0x30); db(0xd2); db(0x41); db(0x90); db(0x41); db(0x35); db(0x40); + db(0x00); db(0x0a); db(0x20); db(0x2d); db(0x00); db(0x1a); db(0x32); db(0x28); + db(0x00); db(0x2e); db(0xd2); db(0x41); db(0x90); db(0x41); db(0x48); db(0xc0); + db(0x35); db(0x40); db(0x00); db(0x0c); db(0x22); db(0x6d); db(0x00); db(0x40); + db(0x33); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x1c); db(0x13); db(0x7c); + db(0x00); db(0x01); db(0x00); db(0x1e); db(0x4e); db(0xae); db(0xfe); db(0x38); + db(0x22); db(0x6d); db(0x00); db(0x40); db(0x25); db(0x69); db(0x00); db(0x20); + db(0x00); db(0x0e); db(0x25); db(0x69); db(0x00); db(0x24); db(0x00); db(0x12); + db(0x22); db(0x6d); db(0x00); db(0x3c); db(0x4e); db(0xae); db(0xfe); db(0x38); + db(0x60); db(0x00); db(0xff); db(0x76); db(0x30); db(0x3a); db(0xfe); db(0x76); + db(0x48); db(0xc0); db(0x32); db(0x3a); db(0xfe); db(0x72); db(0x48); db(0xc1); + db(0xb0); db(0x91); db(0x66); db(0x00); db(0x00); db(0x0a); db(0xb2); db(0xa9); + db(0x00); db(0x04); db(0x67); db(0x00); db(0x00); db(0x18); db(0x23); db(0x41); + db(0x00); db(0x04); db(0x22); db(0x80); db(0x20); db(0x29); db(0x00); db(0x08); + db(0x22); db(0x69); db(0x00); db(0x0c); db(0x2c); db(0x78); db(0x00); db(0x04); + db(0x4e); db(0xae); db(0xfe); db(0xbc); db(0x41); db(0xf9); db(0x00); db(0xdf); + db(0xf0); db(0x00); db(0x70); db(0x00); db(0x4e); db(0x75); db(0x69); db(0x6e); + db(0x70); db(0x75); db(0x74); db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); + db(0x63); db(0x65); db(0x00); db(0x74); db(0x69); db(0x6d); db(0x65); db(0x72); + db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); db(0x63); db(0x65); db(0x00); + db(0x55); db(0x41); db(0x45); db(0x20); db(0x6d); db(0x6f); db(0x75); db(0x73); + db(0x65); db(0x20); db(0x68); db(0x61); db(0x63); db(0x6b); db(0x00); db(0x55); + db(0x41); db(0x45); db(0x20); db(0x66); db(0x69); db(0x6c); db(0x65); db(0x73); + db(0x79); db(0x73); db(0x74); db(0x65); db(0x6d); db(0x00); db(0x64); db(0x6f); + db(0x73); db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61); db(0x72); + db(0x79); db(0x00); db(0x69); db(0x6e); db(0x74); db(0x75); db(0x69); db(0x74); + db(0x69); db(0x6f); db(0x6e); db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72); + db(0x61); db(0x72); db(0x79); db(0x00); db(0x65); db(0x78); db(0x70); db(0x61); + db(0x6e); db(0x73); db(0x69); db(0x6f); db(0x6e); db(0x2e); db(0x6c); db(0x69); + db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00); db(0x46); db(0x69); + db(0x6c); db(0x65); db(0x53); db(0x79); db(0x73); db(0x74); db(0x65); db(0x6d); + db(0x2e); db(0x72); db(0x65); db(0x73); db(0x6f); db(0x75); db(0x72); db(0x63); + db(0x65); db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); db(0x03); db(0xf2); diff --git a/src/genblitter.c b/src/genblitter.c index ba37b37..e4b6707 100644 --- a/src/genblitter.c +++ b/src/genblitter.c @@ -93,11 +93,15 @@ static void generate_func(void) #endif if (a_is_on) printf("uae_u32 preva = 0;\n"); if (b_is_on) printf("uae_u32 prevb = 0, srcb = b->bltbhold;\n"); - printf("uae_u32 srcc = b->bltcdat;\n"); + if (c_is_on) printf("uae_u32 srcc = b->bltcdat;\n"); printf("uae_u32 dstd=0;\n"); printf("uaecptr dstp = 0;\n"); printf("for (j = b->vblitsize; j--; ) {\n"); - printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n\n"); + if (a_is_on) { + printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n\n"); + } else { + printf("\tfor (i = b->hblitsize; i--; ) {\n\t\tuae_u32 bltadat, srca;\n\n"); + } if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget (ptc); ptc += 2; }\n"); if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = blt_info.bltbdat = chipmem_wget (ptb); ptb += 2;\n"); if (b_is_on) printf("\t\t\tsrcb = (((uae_u32)prevb << 16) | bltbdat) >> b->blitbshift;\n"); @@ -116,8 +120,8 @@ static void generate_func(void) if (c_is_on) printf("\tif (ptc) ptc += b->bltcmod;\n"); printf("\tif (ptd) ptd += b->bltdmod;\n"); printf("}\n"); - if (b_is_on) printf("b->bltbhold = srcb;\n"); - printf("b->bltcdat = srcc;\n"); + if (b_is_on) printf("\tb->bltbhold = srcb;\n"); + if (c_is_on) printf("\tb->bltcdat = srcc;\n"); printf("\t\tif (dstp) chipmem_wput (dstp, dstd);\n"); #if 0 printf("}\n"); @@ -170,11 +174,15 @@ static void generate_func(void) #endif if (a_is_on) printf("uae_u32 preva = 0;\n"); if (b_is_on) printf("uae_u32 prevb = 0, srcb = b->bltbhold;\n"); - printf("uae_u32 srcc = b->bltcdat;\n"); + if (c_is_on) printf("uae_u32 srcc = b->bltcdat;\n"); printf("uae_u32 dstd=0;\n"); printf("uaecptr dstp = 0;\n"); printf("for (j = b->vblitsize; j--; ) {\n"); - printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n"); + if (a_is_on) { + printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n"); + } else { + printf("\tfor (i = b->hblitsize; i--; ) {\n\t\tuae_u32 bltadat, srca;\n"); + } if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget (ptc); ptc -= 2; }\n"); if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = blt_info.bltbdat = chipmem_wget (ptb); ptb -= 2;\n"); if (b_is_on) printf("\t\t\tsrcb = ((bltbdat << 16) | prevb) >> b->blitdownbshift;\n"); @@ -193,8 +201,8 @@ static void generate_func(void) if (c_is_on) printf("\tif (ptc) ptc -= b->bltcmod;\n"); printf("\tif (ptd) ptd -= b->bltdmod;\n"); printf("}\n"); - if (b_is_on) printf("b->bltbhold = srcb;\n"); - printf("b->bltcdat = srcc;\n"); + if (b_is_on) printf("\tb->bltbhold = srcb;\n"); + if (c_is_on) printf("\tb->bltcdat = srcc;\n"); printf("\t\tif (dstp) chipmem_wput (dstp, dstd);\n"); #if 0 printf("}\n"); @@ -268,4 +276,3 @@ int main(int argc, char **argv) } return 0; } - diff --git a/src/gfx-sdl/sdlgfx.c b/src/gfx-sdl/sdlgfx.c index 7a9513b..b82718b 100644 --- a/src/gfx-sdl/sdlgfx.c +++ b/src/gfx-sdl/sdlgfx.c @@ -52,7 +52,7 @@ #ifdef DEBUG #define DEBUG_LOG write_log #else -#define DEBUG_LOG(...) do ; while(0) +#define DEBUG_LOG(...) do {} while(0) #endif static SDL_Surface *display; @@ -1159,7 +1159,7 @@ void handle_events (void) switch (rEvent.type) { case SDL_QUIT: DEBUG_LOG ("Event: quit\n"); - uae_stop (); + uae_quit (); break; case SDL_MOUSEBUTTONDOWN: diff --git a/src/hardfile.c b/src/hardfile.c index aa05cb0..964ffef 100644 --- a/src/hardfile.c +++ b/src/hardfile.c @@ -263,7 +263,7 @@ static int handle_scsi (uaecptr request, struct hardfiledata *hfd) ls = 12; break; default: - lr = -1; + lr = -1; write_log ("UAEHF: unsupported scsi command %#2.2X\n", cmd); status = 2; /* CHECK CONDITION */ s[0] = 0x70; @@ -408,7 +408,7 @@ static uae_u32 REGPARAM2 hardfile_open (TrapContext *context) /* Check unit number */ if (unit >= 0 && get_hardfile_data (unit) && start_thread (unit)) { hfpd->opencount++; - put_word (m68k_areg(&context->regs, 6) + 32, get_word (m68k_areg(&context->regs, 6) + 32) + 1); + put_word (m68k_areg (&context->regs, 6) + 32, get_word (m68k_areg (&context->regs, 6) + 32) + 1); put_long (tmp1 + 24, unit); /* io_Unit */ put_byte (tmp1 + 31, 0); /* io_Error */ put_byte (tmp1 + 8, 7); /* ln_type = NT_REPLYMSG */ @@ -432,8 +432,12 @@ static uae_u32 REGPARAM2 hardfile_close (TrapContext *context) if (!hfpd->opencount) return 0; hfpd->opencount--; - if (hfpd->opencount == 0) + + if (hfpd->opencount == 0) { write_comm_pipe_u32 (&hfpd->requests, 0, 1); + uae_sem_wait (&hfpd->sync_sem); + } + put_word (m68k_areg (&context->regs, 6) + 32, get_word (m68k_areg (&context->regs, 6) + 32) - 1); return 0; } @@ -663,7 +667,7 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata error = handle_scsi (request, hfd); } else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */ error = -3; /* IOERR_NOCMD */ - write_log ("UAEHF: HD_SCSICMD tried on regular HDF, unit %d", unit); + write_log ("UAEHF: HD_SCSICMD tried on regular HDF, unit %d\n", unit); } break; @@ -676,7 +680,7 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata put_byte (request + 31, error); hf_log2 ("hf: unit=%d, request=%p, cmd=%d offset=%u len=%d, actual=%d error%=%d\n", unit, request, - get_word(request + 28), get_long (request + 44), get_long (request + 36), actual, error); + get_word (request + 28), get_long (request + 44), get_long (request + 36), actual, error); return async; } @@ -793,11 +797,20 @@ void hardfile_reset (void) if ((request = hfpd->d_request[i])) abort_async (hfpd, request, 0, 0); } + + write_comm_pipe_u32 (&hfpd->requests, 0, 1); + uae_sem_wait (&hfpd->sync_sem); } + memset (hfpd, 0, sizeof (struct hardfileprivdata)); } } +void hardfile_cleanup (void) +{ + hardfile_reset (); +} + void hardfile_install (void) { uae_u32 functable, datatable; diff --git a/src/hardfile_unix.c b/src/hardfile_unix.c index 8230d32..b7cc443 100644 --- a/src/hardfile_unix.c +++ b/src/hardfile_unix.c @@ -14,9 +14,9 @@ //#define HDF_DEBUG #ifdef HDF_DEBUG -#define DEBUG_LOG write_log( "%s: ", __func__); write_log +#define DEBUG_LOG write_log ( "%s: ", __func__); write_log #else -#define DEBUG_LOG(...) do ; while(0) +#define DEBUG_LOG(...) do {} while(0) #endif @@ -47,7 +47,7 @@ static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset) return -1; } - ret = lseek ((int)hfd->handle, offset, SEEK_SET); + ret = lseek (hfd->handle, offset, SEEK_SET); if (ret == -1) { DEBUG_LOG ("seek failed\n"); @@ -67,7 +67,7 @@ static void poscheck (struct hardfiledata *hfd, int len) abort (); } - pos = lseek ((int)hfd->handle, 0, SEEK_CUR); + pos = lseek (hfd->handle, 0, SEEK_CUR); if (pos == -1 ) { gui_message ("hd: poscheck failed. seek failure, error %d", errno); @@ -101,7 +101,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name) if ((handle = open (name, hfd->readonly ? O_RDONLY : O_RDWR)) != -1) { int i; strcpy (hfd->path, name); - hfd->handle = (void *) handle; + hfd->handle = handle; hfd->cache = 0; i = strlen (name) - 1; @@ -131,8 +131,8 @@ extern int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd) { DEBUG_LOG ("called\n"); - if ((int)shfd->handle >= 0) { - dhfd->handle = (void *)dup ((int)shfd->handle); + if (shfd->handle >= 0) { + dhfd->handle = dup (shfd->handle); } return 0; @@ -142,8 +142,8 @@ void hdf_close (struct hardfiledata *hfd) { DEBUG_LOG ("called\n"); - close ((int)hfd->handle); - hfd->handle = (void *)-1; + close (hfd->handle); + hfd->handle = -1; } int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) @@ -155,7 +155,7 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) hfd->cache_valid = 0; hdf_seek (hfd, offset); poscheck (hfd, len); - n = read ((int)hfd->handle, buffer, len); + n = read (hfd->handle, buffer, len); DEBUG_LOG ("read %d bytes\n", n); @@ -171,7 +171,7 @@ int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) hfd->cache_valid = 0; hdf_seek (hfd, offset); poscheck (hfd, len); - n = write ((int)hfd->handle, buffer, len); + n = write (hfd->handle, buffer, len); DEBUG_LOG ("Wrote %d bytes\n", n); diff --git a/src/include/autoconf.h b/src/include/autoconf.h index 1e98ba1..30de4c6 100644 --- a/src/include/autoconf.h +++ b/src/include/autoconf.h @@ -45,6 +45,7 @@ extern void filesys_install_code (void); extern void filesys_store_devinfo (uae_u8 *); extern void hardfile_install (void); extern void hardfile_reset (void); +extern void hardfile_cleanup (void); extern void emulib_install (void); extern void expansion_init (void); extern void expansion_cleanup (void); diff --git a/src/include/commpipe.h b/src/include/commpipe.h index 2fe3bab..5176d2f 100644 --- a/src/include/commpipe.h +++ b/src/include/commpipe.h @@ -9,7 +9,7 @@ typedef union { int i; uae_u32 u32; - void *pv; + const void *pv; } uae_pt; /* These currently require the maximum size to be known at initialization @@ -71,7 +71,7 @@ STATIC_INLINE void write_comm_pipe_pt (smp_comm_pipe *p, uae_pt data, int no_buf maybe_wake_reader (p, no_buffer); return; } - + uae_sem_wait (&p->lock); if (nxwrp == p->rdp) { /* Pipe full! */ @@ -128,7 +128,7 @@ STATIC_INLINE uae_u32 read_comm_pipe_u32_blocking (smp_comm_pipe *p) return foo.u32; } -STATIC_INLINE void *read_comm_pipe_pvoid_blocking (smp_comm_pipe *p) +STATIC_INLINE const void *read_comm_pipe_pvoid_blocking (smp_comm_pipe *p) { uae_pt foo = read_comm_pipe_pt_blocking (p); return foo.pv; @@ -148,7 +148,7 @@ STATIC_INLINE void write_comm_pipe_u32 (smp_comm_pipe *p, int data, int no_buffe write_comm_pipe_pt (p, foo, no_buffer); } -STATIC_INLINE void write_comm_pipe_pvoid (smp_comm_pipe *p, void *data, int no_buffer) +STATIC_INLINE void write_comm_pipe_pvoid (smp_comm_pipe *p, const void *data, int no_buffer) { uae_pt foo; foo.pv = data; diff --git a/src/include/filesys.h b/src/include/filesys.h index ee9b2ac..c0c2af3 100644 --- a/src/include/filesys.h +++ b/src/include/filesys.h @@ -14,7 +14,11 @@ struct hardfiledata { int surfaces; int reservedblocks; unsigned int blocksize; +#ifdef WIN32 void *handle; +#else + int handle; +#endif int readonly; int flags; uae_u8 *cache; diff --git a/src/include/gensound.h b/src/include/gensound.h index 939e78e..334483f 100644 --- a/src/include/gensound.h +++ b/src/include/gensound.h @@ -28,16 +28,11 @@ extern void sound_volume (int dir); extern void switch_audio_interpol (void); extern void sample16_handler (void); -extern void sample8_handler (void); extern void sample16s_handler (void); extern void sample16ss_handler (void); -extern void sample8s_handler (void); -extern void sample_ulaw_handler (void); #ifdef MULTIPLICATION_PROFITABLE STATIC_INLINE void init_sound_table16 (void) { } -STATIC_INLINE void init_sound_table8 (void) { } #else extern void init_sound_table16 (void); -extern void init_sound_table8 (void); #endif diff --git a/src/include/options.h b/src/include/options.h index 213bbe8..de8e0bb 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -1,423 +1,422 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * Stuff - * - * Copyright 1995, 1996 Ed Hanway - * Copyright 1995-2001 Bernd Schmidt - */ - -typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang; - -struct uaedev_mount_info; - -struct strlist { - struct strlist *next; - char *option, *value; - int unknown; -}; - -// Device Port -enum Porttype { - PORT_DEFAULT, // Load from device of dol file - PORT_SD, // Load from SD card - PORT_USB, // Load from USB port - PORT_SMB //Load from network -}; - -/* maximum number native input devices supported (single type) */ -#define MAX_INPUT_DEVICES 6 -/* maximum number of native input device's buttons and axles supported */ -#define MAX_INPUT_DEVICE_EVENTS 256 -/* 4 different customization settings */ -#define MAX_INPUT_SETTINGS 4 -#define MAX_INPUT_SUB_EVENT 4 -#define MAX_INPUT_SIMULTANEOUS_KEYS 4 - -struct uae_input_device { - char *name; - uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; - char *custom [MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; - uae_u16 flags [MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; - uae_s16 extra [MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SIMULTANEOUS_KEYS]; - uae_u8 enabled; -}; - -#define MAX_SPARE_DRIVES 20 - -#define CONFIG_TYPE_HARDWARE 1 -#define CONFIG_TYPE_HOST 2 - -struct uae_prefs { - - struct strlist *all_lines; - - char description[256]; - char info[256]; - int config_version; - - int illegal_mem; - int use_serial; - int serial_demand; - int serial_hwctsrts; - int serial_direct; - int parallel_demand; - int socket_emu; - -#ifdef DEBUGGER - int start_debugger; -#endif - int start_gui; - - KbdLang keyboard_lang; - int test_drawing_speed; - - int produce_sound; - int sound_stereo; - int sound_stereo_separation; - int sound_mixed_stereo; - int sound_bits; - int sound_freq; - int sound_latency; - int sound_interpol; - int sound_adjust; - int sound_volume; - -#ifdef JIT - int comptrustbyte; - int comptrustword; - int comptrustlong; - int comptrustnaddr; - int compnf; - int compforcesettings; - int compfpu; - - int comp_hardflush; - int comp_constjump; - int comp_oldsegv; - - int cachesize; - int optcount[10]; -#endif - - int gfx_framerate; - int gfx_width_win, gfx_height_win; - int gfx_width_fs, gfx_height_fs; - int gfx_width, gfx_height; - int gfx_refreshrate; - int gfx_vsync; - int gfx_lores; - int gfx_linedbl; - int gfx_correct_aspect; - int gfx_afullscreen; - int gfx_pfullscreen; - int gfx_xcenter; - int gfx_ycenter; - -#ifdef GFXFILTER - int gfx_filter; - int gfx_filter_scanlines; - int gfx_filter_scanlineratio; - int gfx_filter_scanlinelevel; - int gfx_filter_horiz_zoom, gfx_filter_vert_zoom; - int gfx_filter_horiz_offset, gfx_filter_vert_offset; - int gfx_filter_filtermode; -#endif - - int color_mode; - - int immediate_blits; - unsigned int chipset_mask; - int ntscmode; - int genlock; - int chipset_refreshrate; - int collision_level; - int leds_on_screen; - int keyboard_leds[3]; - int keyboard_leds_in_use; - int scsi; - int catweasel_io; - int cpu_idle; - int cpu_cycle_exact; - int blitter_cycle_exact; - int floppy_speed; - int tod_hack; - uae_u32 maprom; - - char df[4][256]; - char dfxlist[MAX_SPARE_DRIVES][256]; - char romfile[256]; - char romextfile[256]; - char keyfile[256]; - char flashfile[256]; -#ifdef ACTION_REPLAY - char cartfile[256]; -#endif - char prtname[256]; - char sername[256]; -#ifndef WIN32 - char scsi_device[256]; -#endif - - int m68k_speed; - int cpu_level; - int cpu_compatible; - int address_space_24; - -#ifdef HAVE_MACHDEP_TIMER - int use_processor_clock; -#endif - - uae_u32 z3fastmem_size; - uae_u32 fastmem_size; - uae_u32 chipmem_size; - uae_u32 bogomem_size; - uae_u32 a3000mem_size; - uae_u32 gfxmem_size; - - int kickshifter; - int filesys_no_uaefsdb; - - struct uaedev_mount_info *mountinfo; - - int nr_floppies; - int dfxtype[4]; -#ifdef DRIVESOUND - int dfxclick[4]; - char dfxclickexternal[4][256]; - int dfxclickvolume; -#endif - - int hide_cursor; /* Whether to hide host WM cursor or not */ - - /* Target specific options */ -#ifdef USE_X11_GFX - int x11_use_low_bandwidth; - int x11_use_mitshm; - int x11_use_dgamode; -#endif - -#ifdef USE_SVGALIB_GFX - int svga_no_linear; -#endif - -#ifdef _WIN32 - int win32_middle_mouse; - int win32_logfile; - - int win32_active_priority; - int win32_inactive_priority; - int win32_inactive_pause; - int win32_inactive_nosound; - int win32_iconified_priority; - int win32_iconified_pause; - int win32_iconified_nosound; - - int win32_no_overlay; /* If this is set, we won't try and use any RGB overlays */ - int win32_ctrl_F11_is_quit; - int win32_automount_drives; - int win32_midioutdev; - int win32_midiindev; - int win32_aspi; - int win32_soundcard; -#endif - -#ifdef USE_CURSES_GFX - int curses_reverse_video; -#endif - -#if defined USE_SDL_GFX || defined USE_X11_GFX - int map_raw_keys; -#endif -#ifdef USE_SDL_GFX - int use_gl; -#endif - -#ifdef USE_AMIGA_GFX - int amiga_screen_type; - char amiga_publicscreen[256]; - int amiga_use_grey; - int amiga_use_dither; -#endif - -#ifdef SAVESTATE - int statecapture; - int statecapturerate, statecapturebuffersize; -#endif - - int use_wheel_input; - int logfile; -#ifdef GEKKO - int smb_enable; - char SmbUser[32]; - char SmbPwd[32]; - char SmbShare[32]; - char SmbIp[32]; - int Port; //SD, USB or SMB - int rumble; - int gfx_correct_ratio; -#endif - - /* input */ - - int jport0; - int jport1; - int input_selected_setting; - int input_joymouse_multiplier; - int input_joymouse_deadzone; - int input_joystick_deadzone; - int input_joymouse_speed; - int input_autofire_framecnt; - int input_mouse_speed; - struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES]; - struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES]; - struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES]; -}; - -extern void save_options (FILE *, const struct uae_prefs *, int); -extern void cfgfile_write (FILE *f, const char *format,...); - -extern void default_prefs (struct uae_prefs *, int); -extern void discard_prefs (struct uae_prefs *, int); - -extern void prefs_set_attr (const char *key, const char *value); -extern const char *prefs_get_attr (const char *key); - - -int parse_cmdline_option (struct uae_prefs *, char, char *); - -extern int cfgfile_yesno (const char *option, const char *value, const char *name, int *location); -extern int cfgfile_intval (const char *option, const char *value, const char *name, int *location, int scale); -extern int cfgfile_strval (const char *option, const char *value, const char *name, int *location, const char *table[], int more); -extern int cfgfile_string (const char *option, const char *value, const char *name, char *location, int maxsz); -extern char *cfgfile_subst_path (const char *path, const char *subst, const char *file); -extern void cfgfile_subst_home (char *path, unsigned int maxlen); - -extern int machdep_parse_option (struct uae_prefs *, const char *option, const char *value); -extern void machdep_save_options (FILE *, const struct uae_prefs *); -extern void machdep_default_options (struct uae_prefs *); - -extern int target_parse_option (struct uae_prefs *, const char *option, const char *value); -extern void target_save_options (FILE *, const struct uae_prefs *); -extern void target_default_options (struct uae_prefs *); - -extern int gfx_parse_option (struct uae_prefs *, const char *option, const char *value); -extern void gfx_save_options (FILE *, const struct uae_prefs *); -extern void gfx_default_options (struct uae_prefs *); - -extern void audio_default_options (struct uae_prefs *p); -extern void audio_save_options (FILE *f, const struct uae_prefs *p); -extern int audio_parse_option (struct uae_prefs *p, const char *option, const char *value); - -extern int cfgfile_load (struct uae_prefs *, const char *filename, int *); -extern int cfgfile_save (const struct uae_prefs *, const char *filename, int); -extern void cfgfile_parse_line (struct uae_prefs *p, char *, int); -extern int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value, int); -extern int cfgfile_get_description (const char *filename, char *description, int*); -extern void cfgfile_show_usage (void); -extern uae_u32 cfgfile_uaelib(int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen); -extern uae_u32 cfgfile_uaelib_modify (uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize); -extern uae_u32 cfgfile_modify (uae_u32 index, char *parms, uae_u32 size, char *out, uae_u32 outsize); -extern void cfgfile_addcfgparam (char *); -extern unsigned int cmdlineparser (const char *s, char *outp[], unsigned int max); -extern int cfgfile_configuration_change(int); - -extern void fixup_prefs_dimensions (struct uae_prefs *prefs); - -extern void check_prefs_changed_custom (void); -extern void check_prefs_changed_cpu (void); -extern void check_prefs_changed_audio (void); -extern int check_prefs_changed_gfx (void); - -extern struct uae_prefs currprefs, changed_prefs; - -extern void machdep_init (void); - -/* AIX doesn't think it is Unix. Neither do I. */ -#if defined(_ALL_SOURCE) || defined(_AIX) -#undef __unix -#define __unix -#endif - -#define MAX_COLOR_MODES 5 - -/* #define NEED_TO_DEBUG_BADLY */ - -#if !defined(USER_PROGRAMS_BEHAVE) -#define USER_PROGRAMS_BEHAVE 0 -#endif - -/* Some memsets which know that they can safely overwrite some more memory - * at both ends and use that knowledge to align the pointers. */ - -#define QUADRUPLIFY(c) (((c) | ((c) << 8)) | (((c) | ((c) << 8)) << 16)) - -/* When you call this routine, bear in mind that it rounds the bounds and - * may need some padding for the array. */ - -#define fuzzy_memset(p, c, o, l) fuzzy_memset_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 4) >> 2) -STATIC_INLINE void fuzzy_memset_1 (void *p, uae_u32 c, int offset, int len) -{ - uae_u32 *p2 = (uae_u32 *)((char *)p + offset); - int a = len & 7; - len >>= 3; - switch (a) { - case 7: p2--; goto l1; - case 6: p2-=2; goto l2; - case 5: p2-=3; goto l3; - case 4: p2-=4; goto l4; - case 3: p2-=5; goto l5; - case 2: p2-=6; goto l6; - case 1: p2-=7; goto l7; - case 0: if (!--len) return; break; - } - - for (;;) { - p2[0] = c; - l1: - p2[1] = c; - l2: - p2[2] = c; - l3: - p2[3] = c; - l4: - p2[4] = c; - l5: - p2[5] = c; - l6: - p2[6] = c; - l7: - p2[7] = c; - - if (!len) - break; - len--; - p2 += 8; - } -} - -/* This one knows it will never be asked to clear more than 32 bytes. Make sure you call this with a - constant for the length. */ -#define fuzzy_memset_le32(p, c, o, l) fuzzy_memset_le32_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 7) >> 2) -STATIC_INLINE void fuzzy_memset_le32_1 (void *p, uae_u32 c, int offset, int len) -{ - uae_u32 *p2 = (uae_u32 *)((char *)p + offset); - - switch (len) { - case 9: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; p2[8] = c; break; - case 8: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; break; - case 7: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; break; - case 6: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; break; - case 5: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; break; - case 4: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; break; - case 3: p2[0] = c; p2[1] = c; p2[2] = c; break; - case 2: p2[0] = c; p2[1] = c; break; - case 1: p2[0] = c; break; - case 0: break; - default: printf("Hit the programmer.\n"); break; - } -} - -#if defined TARGET_AMIGAOS && defined(__GNUC__) -#include "od-amiga/amiga-kludges.h" -#endif + /* + * UAE - The Un*x Amiga Emulator + * + * Stuff + * + * Copyright 1995, 1996 Ed Hanway + * Copyright 1995-2001 Bernd Schmidt + */ + +typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang; + +struct uaedev_mount_info; + +struct strlist { + struct strlist *next; + char *option, *value; + int unknown; +}; + +// Device Port +enum Porttype { + PORT_DEFAULT, // Load from device of dol file + PORT_SD, // Load from SD card + PORT_USB, // Load from USB port + PORT_SMB //Load from network +}; + +/* maximum number native input devices supported (single type) */ +#define MAX_INPUT_DEVICES 6 +/* maximum number of native input device's buttons and axles supported */ +#define MAX_INPUT_DEVICE_EVENTS 256 +/* 4 different customization settings */ +#define MAX_INPUT_SETTINGS 4 +#define MAX_INPUT_SUB_EVENT 4 +#define MAX_INPUT_SIMULTANEOUS_KEYS 4 + +struct uae_input_device { + char *name; + uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; + char *custom [MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; + uae_u16 flags [MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT]; + uae_s16 extra [MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SIMULTANEOUS_KEYS]; + uae_u8 enabled; +}; + +#define MAX_SPARE_DRIVES 20 + +#define CONFIG_TYPE_HARDWARE 1 +#define CONFIG_TYPE_HOST 2 + +struct uae_prefs { + + struct strlist *all_lines; + + char description[256]; + char info[256]; + int config_version; + + int illegal_mem; + int use_serial; + int serial_demand; + int serial_hwctsrts; + int serial_direct; + int parallel_demand; + int socket_emu; + +#ifdef DEBUGGER + int start_debugger; +#endif + int start_gui; + + KbdLang keyboard_lang; + int test_drawing_speed; + + int produce_sound; + int sound_stereo; + int sound_stereo_separation; + int sound_mixed_stereo; + int sound_freq; + int sound_latency; + int sound_interpol; + int sound_adjust; + int sound_volume; + +#ifdef JIT + int comptrustbyte; + int comptrustword; + int comptrustlong; + int comptrustnaddr; + int compnf; + int compforcesettings; + int compfpu; + + int comp_hardflush; + int comp_constjump; + int comp_oldsegv; + + int cachesize; + int optcount[10]; +#endif + + int gfx_framerate; + int gfx_width_win, gfx_height_win; + int gfx_width_fs, gfx_height_fs; + int gfx_width, gfx_height; + int gfx_refreshrate; + int gfx_vsync; + int gfx_lores; + int gfx_linedbl; + int gfx_correct_aspect; + int gfx_afullscreen; + int gfx_pfullscreen; + int gfx_xcenter; + int gfx_ycenter; + +#ifdef GFXFILTER + int gfx_filter; + int gfx_filter_scanlines; + int gfx_filter_scanlineratio; + int gfx_filter_scanlinelevel; + int gfx_filter_horiz_zoom, gfx_filter_vert_zoom; + int gfx_filter_horiz_offset, gfx_filter_vert_offset; + int gfx_filter_filtermode; +#endif + + int color_mode; + + int immediate_blits; + unsigned int chipset_mask; + int ntscmode; + int genlock; + int chipset_refreshrate; + int collision_level; + int leds_on_screen; + int keyboard_leds[3]; + int keyboard_leds_in_use; + int scsi; + int catweasel_io; + int cpu_idle; + int cpu_cycle_exact; + int blitter_cycle_exact; + int floppy_speed; + int tod_hack; + uae_u32 maprom; + + char df[4][256]; + char dfxlist[MAX_SPARE_DRIVES][256]; + char romfile[256]; + char romextfile[256]; + char keyfile[256]; + char flashfile[256]; +#ifdef ACTION_REPLAY + char cartfile[256]; +#endif + char prtname[256]; + char sername[256]; +#ifndef WIN32 + char scsi_device[256]; +#endif + + int m68k_speed; + int cpu_level; + int cpu_compatible; + int address_space_24; + +#ifdef HAVE_MACHDEP_TIMER + int use_processor_clock; +#endif + + uae_u32 z3fastmem_size; + uae_u32 fastmem_size; + uae_u32 chipmem_size; + uae_u32 bogomem_size; + uae_u32 a3000mem_size; + uae_u32 gfxmem_size; + + int kickshifter; + int filesys_no_uaefsdb; + + struct uaedev_mount_info *mountinfo; + + int nr_floppies; + int dfxtype[4]; +#ifdef DRIVESOUND + int dfxclick[4]; + char dfxclickexternal[4][256]; + int dfxclickvolume; +#endif + + int hide_cursor; /* Whether to hide host WM cursor or not */ + + /* Target specific options */ +#ifdef USE_X11_GFX + int x11_use_low_bandwidth; + int x11_use_mitshm; + int x11_use_dgamode; +#endif + +#ifdef USE_SVGALIB_GFX + int svga_no_linear; +#endif + +#ifdef _WIN32 + int win32_middle_mouse; + int win32_logfile; + + int win32_active_priority; + int win32_inactive_priority; + int win32_inactive_pause; + int win32_inactive_nosound; + int win32_iconified_priority; + int win32_iconified_pause; + int win32_iconified_nosound; + + int win32_no_overlay; /* If this is set, we won't try and use any RGB overlays */ + int win32_ctrl_F11_is_quit; + int win32_automount_drives; + int win32_midioutdev; + int win32_midiindev; + int win32_aspi; + int win32_soundcard; +#endif + +#ifdef USE_CURSES_GFX + int curses_reverse_video; +#endif + +#if defined USE_SDL_GFX || defined USE_X11_GFX + int map_raw_keys; +#endif +#ifdef USE_SDL_GFX + int use_gl; +#endif + +#ifdef USE_AMIGA_GFX + int amiga_screen_type; + char amiga_publicscreen[256]; + int amiga_use_grey; + int amiga_use_dither; +#endif + +#ifdef SAVESTATE + int statecapture; + int statecapturerate, statecapturebuffersize; +#endif + + int use_wheel_input; + int logfile; +#ifdef GEKKO + int smb_enable; + char SmbUser[32]; + char SmbPwd[32]; + char SmbShare[32]; + char SmbIp[32]; + int Port; //SD, USB or SMB + int rumble; + int gfx_correct_ratio; +#endif + + /* input */ + + int jport0; + int jport1; + int input_selected_setting; + int input_joymouse_multiplier; + int input_joymouse_deadzone; + int input_joystick_deadzone; + int input_joymouse_speed; + int input_autofire_framecnt; + int input_mouse_speed; + struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES]; + struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES]; + struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES]; +}; + +extern void save_options (FILE *, const struct uae_prefs *, int); +extern void cfgfile_write (FILE *f, const char *format,...); + +extern void default_prefs (struct uae_prefs *, int); +extern void discard_prefs (struct uae_prefs *, int); + +extern void prefs_set_attr (const char *key, const char *value); +extern const char *prefs_get_attr (const char *key); + + +int parse_cmdline_option (struct uae_prefs *, char, char *); + +extern int cfgfile_yesno (const char *option, const char *value, const char *name, int *location); +extern int cfgfile_intval (const char *option, const char *value, const char *name, int *location, int scale); +extern int cfgfile_strval (const char *option, const char *value, const char *name, int *location, const char *table[], int more); +extern int cfgfile_string (const char *option, const char *value, const char *name, char *location, int maxsz); +extern char *cfgfile_subst_path (const char *path, const char *subst, const char *file); +extern void cfgfile_subst_home (char *path, unsigned int maxlen); + +extern int machdep_parse_option (struct uae_prefs *, const char *option, const char *value); +extern void machdep_save_options (FILE *, const struct uae_prefs *); +extern void machdep_default_options (struct uae_prefs *); + +extern int target_parse_option (struct uae_prefs *, const char *option, const char *value); +extern void target_save_options (FILE *, const struct uae_prefs *); +extern void target_default_options (struct uae_prefs *); + +extern int gfx_parse_option (struct uae_prefs *, const char *option, const char *value); +extern void gfx_save_options (FILE *, const struct uae_prefs *); +extern void gfx_default_options (struct uae_prefs *); + +extern void audio_default_options (struct uae_prefs *p); +extern void audio_save_options (FILE *f, const struct uae_prefs *p); +extern int audio_parse_option (struct uae_prefs *p, const char *option, const char *value); + +extern int cfgfile_load (struct uae_prefs *, const char *filename, int *); +extern int cfgfile_save (const struct uae_prefs *, const char *filename, int); +extern void cfgfile_parse_line (struct uae_prefs *p, char *, int); +extern int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value, int); +extern int cfgfile_get_description (const char *filename, char *description, int*); +extern void cfgfile_show_usage (void); +extern uae_u32 cfgfile_uaelib(int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen); +extern uae_u32 cfgfile_uaelib_modify (uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize); +extern uae_u32 cfgfile_modify (uae_u32 index, char *parms, uae_u32 size, char *out, uae_u32 outsize); +extern void cfgfile_addcfgparam (char *); +extern unsigned int cmdlineparser (const char *s, char *outp[], unsigned int max); +extern int cfgfile_configuration_change(int); + +extern void fixup_prefs_dimensions (struct uae_prefs *prefs); + +extern void check_prefs_changed_custom (void); +extern void check_prefs_changed_cpu (void); +extern void check_prefs_changed_audio (void); +extern int check_prefs_changed_gfx (void); + +extern struct uae_prefs currprefs, changed_prefs; + +extern void machdep_init (void); + +/* AIX doesn't think it is Unix. Neither do I. */ +#if defined(_ALL_SOURCE) || defined(_AIX) +#undef __unix +#define __unix +#endif + +#define MAX_COLOR_MODES 5 + +/* #define NEED_TO_DEBUG_BADLY */ + +#if !defined(USER_PROGRAMS_BEHAVE) +#define USER_PROGRAMS_BEHAVE 0 +#endif + +/* Some memsets which know that they can safely overwrite some more memory + * at both ends and use that knowledge to align the pointers. */ + +#define QUADRUPLIFY(c) (((c) | ((c) << 8)) | (((c) | ((c) << 8)) << 16)) + +/* When you call this routine, bear in mind that it rounds the bounds and + * may need some padding for the array. */ + +#define fuzzy_memset(p, c, o, l) fuzzy_memset_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 4) >> 2) +STATIC_INLINE void fuzzy_memset_1 (void *p, uae_u32 c, int offset, int len) +{ + uae_u32 *p2 = (uae_u32 *)((char *)p + offset); + int a = len & 7; + len >>= 3; + switch (a) { + case 7: p2--; goto l1; + case 6: p2-=2; goto l2; + case 5: p2-=3; goto l3; + case 4: p2-=4; goto l4; + case 3: p2-=5; goto l5; + case 2: p2-=6; goto l6; + case 1: p2-=7; goto l7; + case 0: if (!--len) return; break; + } + + for (;;) { + p2[0] = c; + l1: + p2[1] = c; + l2: + p2[2] = c; + l3: + p2[3] = c; + l4: + p2[4] = c; + l5: + p2[5] = c; + l6: + p2[6] = c; + l7: + p2[7] = c; + + if (!len) + break; + len--; + p2 += 8; + } +} + +/* This one knows it will never be asked to clear more than 32 bytes. Make sure you call this with a + constant for the length. */ +#define fuzzy_memset_le32(p, c, o, l) fuzzy_memset_le32_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 7) >> 2) +STATIC_INLINE void fuzzy_memset_le32_1 (void *p, uae_u32 c, int offset, int len) +{ + uae_u32 *p2 = (uae_u32 *)((char *)p + offset); + + switch (len) { + case 9: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; p2[8] = c; break; + case 8: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; break; + case 7: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; break; + case 6: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; break; + case 5: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; break; + case 4: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; break; + case 3: p2[0] = c; p2[1] = c; p2[2] = c; break; + case 2: p2[0] = c; p2[1] = c; break; + case 1: p2[0] = c; break; + case 0: break; + default: printf("Hit the programmer.\n"); break; + } +} + +#if defined TARGET_AMIGAOS && defined(__GNUC__) +#include "od-amiga/amiga-kludges.h" +#endif diff --git a/src/include/sysdeps.h b/src/include/sysdeps.h index 18ecca9..7c20fc0 100644 --- a/src/include/sysdeps.h +++ b/src/include/sysdeps.h @@ -340,7 +340,7 @@ extern int gui_message_multibutton (int flags, const char *format,...); # define rmdir unlink /* Definately problems! */ -# define chmod(a,b) +//# define chmod(a,b) # define dup(fd) fd # define utime(filename, buf) 0 #endif diff --git a/src/include/version.h b/src/include/version.h index a82d5ba..6e6c633 100644 --- a/src/include/version.h +++ b/src/include/version.h @@ -11,14 +11,9 @@ #include "sysconfig.h" -/* TODO: Version details currently are currently defined - * twice: once in the configure script and once here. - * Need to fix this. - */ - -#define UAEMAJOR 0 -#define UAEMINOR 8 -#define UAESUBREV 29 +#define UAEMAJOR UAE_VERSION_MAJOR +#define UAEMINOR UAE_VERSION_MINOR +#define UAESUBREV UAE_VERSION_REVISION #define UAEVERSION (256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV) @@ -28,10 +23,6 @@ # define UAE_NAME "E-UAE" #endif -#define STRINGIZE(x) #x -#define MAKE_VERSION_STRING(x,y,z) STRINGIZE(x) "." STRINGIZE(y) "." STRINGIZE(z) - -#define UAE_VERSION_STRING \ - UAE_NAME " " MAKE_VERSION_STRING (UAEMAJOR, UAEMINOR, UAESUBREV) +#define UAE_VERSION_STRING UAE_NAME " " UAE_VERSION #endif diff --git a/src/inputdevice.c b/src/inputdevice.c index 0796853..cd89b22 100644 --- a/src/inputdevice.c +++ b/src/inputdevice.c @@ -530,15 +530,18 @@ int mousehack_alive (void) static void mousehack_enable (void) { +#ifdef FILESYS /* Internal mousehack depends on filesys boot-rom */ if (!mousehack_allowed ()) return; if (rtarea[get_long (RTAREA_BASE + 40) + 12 - 1]) return; rtarea[get_long (RTAREA_BASE + 40) + 12 - 1] = 1; +#endif } static void mousehack_helper (void) { +#ifdef FILESYS /* Internal mousehack depends on filesys boot-rom */ int mousexpos, mouseypos; uae_u8 *p; @@ -561,6 +564,7 @@ static void mousehack_helper (void) p[1] = mousexpos; p[2] = mouseypos >> 8; p[3] = mouseypos; +#endif } STATIC_INLINE int adjust (int val) diff --git a/src/keybuf.c b/src/keybuf.c index 86daa4e..6451d8d 100644 --- a/src/keybuf.c +++ b/src/keybuf.c @@ -29,7 +29,7 @@ static int *fs_np; static int *fs_np; static int *fs_ck; static int *fs_se; -#ifdef ARCADIA +#ifdef XARCADE static int *fs_xa1; static int *fs_xa2; #endif @@ -114,7 +114,7 @@ void record_key (int kc) case AK_LSH: fs = 1; fs_se[5] = b; break; } } -#ifdef ARCADIA +#ifdef XARCADE if (fs_xa1 != 0) { switch (k) { case AK_NP8: fs = 1; fs_xa1[0] = b; break; @@ -149,7 +149,7 @@ void record_key (int kc) kc ^= AK_RCTRL << 1; kc ^= AK_CTRL << 1; } -#ifdef ARCADIA +#ifdef XARCADE if (fs_xa1 || fs_xa2) { int k2 = k; if (k == AK_1) @@ -187,7 +187,7 @@ void record_key (int kc) void joystick_setting_changed (void) { fs_np = fs_ck = fs_se = 0; -#ifdef ARCADIA +#ifdef XARCADE fs_xa1 = fs_xa2 = 0; #endif @@ -206,7 +206,7 @@ void joystick_setting_changed (void) else if (JSEM_ISSOMEWHEREELSE (1, &currprefs)) fs_se = fakestate[1]; -#ifdef ARCADIA +#ifdef XARCADE if (JSEM_ISXARCADE1 (0, &currprefs)) fs_xa1 = fakestate[0]; else if (JSEM_ISXARCADE1 (1, &currprefs)) diff --git a/src/main.c b/src/main.c index d14ff72..083f3d2 100644 --- a/src/main.c +++ b/src/main.c @@ -458,11 +458,7 @@ void usage (void) static void show_version (void) { -#ifdef PACKAGE_VERSION - write_log (PACKAGE_NAME " " PACKAGE_VERSION "\n"); -#else - write_log ("UAE %d.%d.%d\n", UAEMAJOR, UAEMINOR, UAESUBREV); -#endif + write_log (UAE_VERSION_STRING "\n"); write_log ("Build date: " __DATE__ " " __TIME__ "\n"); } @@ -533,29 +529,7 @@ static void parse_cmdline (int argc, char **argv) } } #endif -/* -static void parse_user_conf_file(const char *extension) -{ - // FIXME! ska: This is temporary, and will be removed when you can - // pass command line options in meta.xml for the homebrew channel - char user_options[255] = ""; - char *user_argv[] = {"program", "-f", user_options}; -#ifdef OPTIONS_IN_HOME - char *home = getenv ("HOME"); - if (home != NULL && strlen (home) < 240) - { - strcpy (user_options, home); - strcat (user_options, "/"); - } -#endif - strcat(user_options, OPTIONSFILENAME); - strcat(user_options, extension); - // Allow the user uaerc to override the default one - //parse_cmdline (3, user_argv); - // Until here -} -*/ static void parse_cmdline_and_init_file (int argc, char **argv) { char *home; @@ -585,7 +559,7 @@ static void parse_cmdline_and_init_file (int argc, char **argv) #ifdef OPTIONS_IN_HOME /* sam: if not found in $HOME then look in current directory */ - char *saved_path = strdup (optionsfile); + char *saved_path = strdup (optionsfile); strcpy (optionsfile, OPTIONSFILENAME); if (! cfgfile_load (&currprefs, optionsfile, 0) ) { /* If not in current dir either, change path back to home @@ -593,7 +567,7 @@ static void parse_cmdline_and_init_file (int argc, char **argv) strcpy (optionsfile, saved_path); } - free (saved_path); + free (saved_path); #endif } @@ -741,13 +715,13 @@ static int do_preinit_machine (int argc, char **argv) init_shm (); #endif - rtarea_init (); #ifdef FILESYS + rtarea_init (); hardfile_install (); #endif if (restart_config[0]) - parse_cmdline_and_init_file (argc, argv); + parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; @@ -952,6 +926,7 @@ static void do_exit_machine (void) #endif #ifdef FILESYS filesys_cleanup (); + hardfile_cleanup (); #endif #ifdef SAVESTATE savestate_free (); @@ -968,7 +943,7 @@ void real_main (int argc, char **argv) { show_version (); -#if defined(FILESYS) +#ifdef FILESYS currprefs.mountinfo = changed_prefs.mountinfo = &options_mountinfo; #endif restart_program = 1; @@ -987,11 +962,11 @@ void real_main (int argc, char **argv) do_preinit_machine (argc, argv); - /* Should we open the GUI? TODO: This mess needs to go away */ + /* Should we open the GUI? TODO: This mess needs to go away */ want_gui = currprefs.start_gui; - if (restart_program == 2) + if (restart_program == 2) want_gui = 0; - else if (restart_program == 3) + else if (restart_program == 3) want_gui = 1; changed_prefs = currprefs; @@ -1041,7 +1016,7 @@ void real_main (int argc, char **argv) uae_target_state = UAE_STATE_RUNNING; /* - * Main Loop + * Main Loop */ do { set_state (uae_target_state); @@ -1063,7 +1038,7 @@ void real_main (int argc, char **argv) handle_events (); /* Manually pump input device */ - inputdevicefunc_keyboard.read (); + inputdevicefunc_keyboard.read (); inputdevicefunc_mouse.read (); inputdevicefunc_joystick.read (); inputdevice_handle_inputcode (); @@ -1096,7 +1071,7 @@ void real_main (int argc, char **argv) do_exit_machine (); - /* TODO: This stuff is a hack. What we need to do is + /* TODO: This stuff is a hack. What we need to do is * check whether a config GUI is available. If not, * then quit. */ @@ -1110,7 +1085,7 @@ int init_sdl (void) { int result = (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER /*| SDL_INIT_AUDIO*/) == 0); if (result) - atexit (SDL_Quit); + atexit (SDL_Quit); return result; } diff --git a/src/make_hdf.c b/src/make_hdf.c new file mode 100644 index 0000000..06107ff --- /dev/null +++ b/src/make_hdf.c @@ -0,0 +1,184 @@ + /* + * E-UAE - The portable Amiga Emulator + * + * make_hdf + * + * A quick hack to generate a hard file image and associated config option. + * Anybody want to show this rubbish some love, feel free. + * + * Copyright Richard Drummond 2007 + * + */ + +#include "sysconfig.h" +#include "sysdeps.h" + +#include + +static void print_help (void) +{ + fprintf (stderr, "make_hdf []\n"); + fprintf (stderr, "\n"); + fprintf (stderr, " = file path to hdf image to create\n"); + fprintf (stderr, " = size of image to create in MB\n"); + fprintf (stderr, " follow by G to specify size in GB\n"); + fprintf (stderr, " = device name to include in config option\n"); + fprintf (stderr, " defaults to DH0 if omitted\n"); +} + +static int create_hdf (const char *path, off_t size) +{ + FILE *f; + void *buf; + const size_t CHUNK_SIZE = 4096; + + f = fopen (path, "wb+"); + + if (f) { + if (size == 0) { + fclose (f); + return 0; + } + + /* + * Try it the easy way. + */ + if (fseeko (f, size - 1, SEEK_SET) == 0) { + fputc (0, f); + if (fseeko (f, 0, SEEK_SET) == 0) { + fclose (f); + return 0; + } + } + + /* + * Okay. That failed. Let's assume seeking passed + * the end of a file ain't supported. Do it the + * hard way. + */ + fseeko (f, 0, SEEK_SET); + buf = calloc (1, CHUNK_SIZE); + + while (size >= (off_t) CHUNK_SIZE) { + if (fwrite (buf, CHUNK_SIZE, 1, f) != 1) + break; + size -= CHUNK_SIZE; + } + + if (size < (off_t) CHUNK_SIZE) { + if (size == 0 || fwrite (buf, (size_t)size, 1, f) == 1) { + fclose (f); + return 0; + } + } + } + + perror ("Failed creating hdf"); + + if (f) { + fclose (f); + /* TODO: Should probably delete failed image here. */ + } + + return -1; +} + +int main (int argc, char *argv[]) +{ + const char *hdf_path; + const char *device_name = "DH0"; + + uae_u64 size; + char *size_spec; + + uae_u32 block_size = 512; + uae_u64 num_blocks; + + uae_u32 cylinders; + uae_u32 blocks_per_track; + uae_u32 surfaces; + + if (argc < 3 || strcmp (argv[1], "-h") == 0) { + print_help (); + exit (EXIT_SUCCESS); + } + + hdf_path = argv[1]; + size = strtoll(argv[2], &size_spec, 10); + if (argv[3]) + device_name = argv[3]; + + /* Munge size specifier */ + if (size > 0) { + char c = (toupper(*size_spec)); + + if (c == 'K') + size *= 1024; + else if (c == 'M' || c == '\0') + size *= 1024 * 1024; + else if (c == 'G') + size *= 1024 * 1024 * 1024; + else + size = 0; + } + + if (size <= 0) { + fprintf (stderr, "Invalid size\n"); + exit (EXIT_FAILURE); + } + + if ((size >= (1LL << 31)) && (sizeof (off_t) < sizeof (uae_u64))) { + fprintf (stderr, "Specified size too large (2GB file size is maximum).\n"); + exit (EXIT_FAILURE); + } + + num_blocks = size / block_size; + + /* We don't want more than (2^32)-1 blocks */ + if (num_blocks >= (1LL << 32)) { + fprintf (stderr, "Specified size too large (too many blocks).\n"); + exit (EXIT_FAILURE); + } + + /* + * Try and work out some plausible geometry + * + * We try and set surfaces and blocks_per_track to keep + * cylinders < 65536. Prior to OS 3.9, FFS had problems with + * more cylinders than that. + */ + + /* The default practice in UAE hardfiles, so let's start there. */ + blocks_per_track = 32; + surfaces = 1; + + cylinders = num_blocks / (blocks_per_track * surfaces); + + if (cylinders == 0) { + fprintf (stderr, "Specified size is too small.\n"); + exit (EXIT_FAILURE); + } + + while (cylinders > 65535 && surfaces < 255) { + surfaces++; + cylinders = num_blocks / (blocks_per_track * surfaces); + } + + while (cylinders > 65535 && blocks_per_track < 255) { + blocks_per_track++; + cylinders = num_blocks / (blocks_per_track * surfaces); + } + + /* Calculate size based on above geometry */ + num_blocks = (uae_u64)cylinders * surfaces * blocks_per_track; + + /* make file */ + if (create_hdf (hdf_path, num_blocks * block_size) < 0) + return EXIT_FAILURE; + + /* output_spec */ + printf ("hardfile2=rw,%s:%s,%d,%d,%d,%d,%d,\n", device_name, hdf_path, blocks_per_track, surfaces, 2, block_size, 0); + printf ("hardfile=rw,%d,%d,%d,%d,%s\n", blocks_per_track, surfaces, 2, block_size, hdf_path); + + return EXIT_SUCCESS; +} diff --git a/src/misc.c b/src/misc.c index 3c3f40a..a935e73 100644 --- a/src/misc.c +++ b/src/misc.c @@ -26,19 +26,19 @@ static uae_u32 REGPARAM2 misc_demux (TrapContext *context) // d0 3=readsamples d1=unit a0=addr read samples from card ret: d0=samples read // make sure you have from amigaside blksize*4 mem alloced // d0=-1 no data available d0=-2 no recording open - // d0 > 0 there are more blksize Data in the que - // do the loop until d0 get 0 - // if d0 is greater than 200 bring a message - // that show the user that data is lost - // maximum blocksbuffered are 250 (8,5 sec) + // d0 > 0 there are more blksize Data in the que + // do the loop until d0 get 0 + // if d0 is greater than 200 bring a message + // that show the user that data is lost + // maximum blocksbuffered are 250 (8,5 sec) // d0 4=writeinterrupt d1=unit d0=0 no interrupt happen for this unit - // d0=-2 no playing open + // d0=-2 no playing open - //note units for now not support use only unit 0 + //note units for now not support use only unit 0 // d0=10 get clipboard size d0=size in bytes // d0=11 get clipboard data a0=clipboarddata - //Note: a get clipboard size must do before + //Note: a get clipboard size must do before // d0=12 write clipboard data a0=clipboarddata // d0=13 setp96mouserate d1=hz value // d0=100 open dll d1=dll name in windows name conventions @@ -55,14 +55,14 @@ static uae_u32 REGPARAM2 misc_demux (TrapContext *context) int opcode = m68k_dreg (&context->regs, 0); switch (opcode) { - int i, slen, t, todo, byte1, byte2; - uae_u32 src, num_vars; - static int cap_pos, clipsize; + int i, slen, t, todo, byte1, byte2; + uae_u32 src, num_vars; + static int cap_pos, clipsize; #if 0 - LPTSTR p, p2, pos1, pos2; - static LPTSTR clipdat; + LPTSTR p, p2, pos1, pos2; + static LPTSTR clipdat; #endif - int cur_pos; + int cur_pos; /* * AHI emulation support @@ -82,7 +82,7 @@ static uae_u32 REGPARAM2 misc_demux (TrapContext *context) case 2: addr=(char *)m68k_areg (&context->regs, 0); for (i = 0; i < (amigablksize*4); i += 4) { - ahisndbufpt[0] = get_long((unsigned int)addr + i); + ahisndbufpt[0] = get_long ((unsigned int)addr + i); ahisndbufpt+=1; /*ahisndbufpt[0]=chipmem_bget((unsigned int)addr+i+2); ahisndbufpt+=1; @@ -106,7 +106,7 @@ static uae_u32 REGPARAM2 misc_demux (TrapContext *context) else todo = cur_pos + (RECORDBUFFER * t) - cap_pos; if (todo < t) { - //if no complete buffer ready exit + //if no complete buffer ready exit return -1; } i = IDirectSoundCaptureBuffer_Lock (lpDSB2r, cap_pos, t, &pos1, &byte1, &pos2, &byte2, 0); @@ -253,7 +253,7 @@ static uae_u32 REGPARAM2 misc_demux (TrapContext *context) oldnum = uaevar.changenum; return 1; } - case 105: //returns memory offset + case 105: //returns memory offset return (uae_u32) get_real_address (0); case 106: //byteswap 16bit vars //a0 = start address @@ -319,7 +319,7 @@ static uae_u32 REGPARAM2 misc_demux (TrapContext *context) BSWAP_WORD_END: } return (uae_u32) bswap_buffer; - case 107: //byteswap 32bit vars - see case 106 + case 107: //byteswap 32bit vars - see case 106 //a0 = start address //d1 = number of 32bit vars //returns address of new array @@ -389,6 +389,7 @@ static uae_u32 REGPARAM2 misc_demux (TrapContext *context) void misc_hsync_stuff (void) { +#ifdef FILESYS static int misc_demux_installed; #ifdef AHI @@ -413,4 +414,5 @@ void misc_hsync_stuff (void) org (a); misc_demux_installed = 1; } +#endif } diff --git a/src/newcpu.c b/src/newcpu.c index b3ddb86..7920ee6 100644 --- a/src/newcpu.c +++ b/src/newcpu.c @@ -373,9 +373,9 @@ void init_m68k (void) struct regstruct regs; static uae_s32 m68kpc_offset; -#define get_ibyte_1(regs, o) get_byte((regs)->pc + ((regs)->pc_p - (regs)->pc_oldp) + (o) + 1) -#define get_iword_1(regs, o) get_word((regs)->pc + ((regs)->pc_p - (regs)->pc_oldp) + (o)) -#define get_ilong_1(regs, o) get_long((regs)->pc + ((regs)->pc_p - (regs)->pc_oldp) + (o)) +#define get_ibyte_1(regs, o) get_byte ((regs)->pc + ((regs)->pc_p - (regs)->pc_oldp) + (o) + 1) +#define get_iword_1(regs, o) get_word ((regs)->pc + ((regs)->pc_p - (regs)->pc_oldp) + (o)) +#define get_ilong_1(regs, o) get_long ((regs)->pc + ((regs)->pc_p - (regs)->pc_oldp) + (o)) static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes size, char *buf, uae_u32 *eaddr, int safemode) { @@ -690,11 +690,14 @@ void REGPARAM2 MakeFromSR (struct regstruct *regs) } } + /* Interrupt priority level may have changed. Assert SPCFLAG_INT + * to check if there's an IRQ ready to go at the new level. */ set_special (regs, SPCFLAG_INT); + if (regs->t1 || regs->t0) set_special (regs, SPCFLAG_TRACE); else - /* Keep SPCFLAG_DOTRACE, we still want a trace exception for + /* Keep SPCFLAG_DOTRACE, we still want a trace exception for SR-modifying instructions (including STOP). */ unset_special (regs, SPCFLAG_TRACE); } @@ -976,15 +979,12 @@ void REGPARAM2 Exception (int nr, struct regstruct *regs, uaecptr oldpc) STATIC_INLINE void service_interrupt (unsigned int level, struct regstruct *regs) { - if (level > regs->intmask) { + regs->stopped = 0; + unset_special (regs, SPCFLAG_STOP); - regs->stopped = 0; - unset_special (regs, SPCFLAG_STOP); + Exception (level + 24, regs, 0); - Exception (level + 24, regs, 0); - - regs->intmask = level; - } + regs->intmask = level; } /* @@ -1472,7 +1472,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode, struct regstruct *regs) if ((opcode & 0xF000) == 0xF000) { if (warned < 20) { - write_log ("B-Trap %04x at %08x (%p)\n", opcode, m68k_getpc (regs) + m68kpc_offset, regs->pc_p); + write_log ("B-Trap %04x at %08x (%p)\n", opcode, m68k_getpc (regs) + m68kpc_offset, regs->pc_p); warned++; } Exception (0xB, regs, 0); @@ -1600,13 +1600,13 @@ static NOINLINE void do_stop (struct regstruct *regs) /* Avoid small numbers of STOP cycles. Arbitrary number here. */ if (stop_count > 32) { - frame_time_t curr_time = uae_gethrtime (); + frame_time_t curr_time = uae_gethrtime (); uae_msleep (1); idletime += uae_gethrtime() - curr_time; } - } + } } } @@ -1697,12 +1697,14 @@ STATIC_INLINE int do_specialties (int cycles, struct regstruct *regs) * In non-cycle-exact mode we handle this by separating the interrupt request * pending (SPCFLAG_INT) and interrupt request arrived (SPCFLAG_DOINT) events. * This ensures that there's always a delay of one opcode (and so at least 2 - * machine cycles) between the interrupt controller requesting an interrupt - * and us servicing it here. + * machine cycles) between the interrupt controller requesting an interrupt or + * the processor changing its interrupt priority level and us servicing it here. * * In cycle-exact mode, there's just one event (SPCFLAG_INT) and the delay is * handled internally by the interrupt controller code in custom.c - intlev() * and friends. + * + * This stuff needs some tidying up! */ if ((regs->spcflags & SPCFLAG_DOINT) || (currprefs.cpu_cycle_exact && (regs->spcflags & SPCFLAG_INT))) { @@ -1711,8 +1713,15 @@ STATIC_INLINE int do_specialties (int cycles, struct regstruct *regs) unset_special (regs, SPCFLAG_DOINT); - if (intr != -1) + if (intr > (int)regs->intmask) { + if (currprefs.cpu_cycle_exact) + unset_special(regs, SPCFLAG_INT); + service_interrupt (intr, regs); + } else { + if (intr < 0 && currprefs.cpu_cycle_exact) + unset_special (regs, SPCFLAG_INT); + } } if ((regs->spcflags & SPCFLAG_INT) && !currprefs.cpu_cycle_exact) { diff --git a/src/picasso96.c b/src/picasso96.c index 8384511..6f86bde 100644 --- a/src/picasso96.c +++ b/src/picasso96.c @@ -466,8 +466,8 @@ static void do_fillrect (uae_u8 *src, int x, int y, int width, int height, * display-emulation on a 16-bit or higher screen. */ if (picasso_vidinfo.rgbformat == picasso96_state.RGBFormat) { # ifndef WORDS_BIGENDIAN - if (Bpp > 1) - if (!(Bpp == 4 && need_argb32_hack)) + if (Bpp > 1) + if (!(Bpp == 4 && need_argb32_hack)) pen = bswap_32 (pen); # else if (Bpp == 4 && need_argb32_hack) @@ -586,7 +586,7 @@ static void do_blit (struct RenderInfo *ri, int Bpp, int srcx, int srcy, * Call OS blitting function that can do it in video memory. * Should return if it was successful */ - if (DX_Blit (srcx, srcy, dstx, dsty, width, height, opcode)) + if (DX_Blit (srcx, srcy, dstx, dsty, width, height, opcode)) return; } @@ -733,9 +733,9 @@ STATIC_INLINE void write_currline (uae_u8 *srcp, int line_no, int first_byte, in dstp += line_no * picasso_vidinfo.rowbytes + first_byte; if (need_argb32_hack && Bpp == 4) - memcpy_bswap32 (dstp, srcp, byte_count); + memcpy_bswap32 (dstp, srcp, byte_count); else - memcpy (dstp, srcp, byte_count); + memcpy (dstp, srcp, byte_count); } else { dstp += line_no * picasso_vidinfo.rowbytes + first_byte * Bpp; @@ -755,7 +755,7 @@ STATIC_INLINE void write_currline (uae_u8 *srcp, int line_no, int first_byte, in } } } - gfx_unlock_picasso (); + gfx_unlock_picasso (); } } @@ -850,7 +850,7 @@ void picasso_refresh (int call_setpalette) ri.BytesPerRow = picasso96_state.BytesPerRow; ri.RGBFormat = picasso96_state.RGBFormat; - if (set_panning_called) { + if (set_panning_called) { width = picasso96_state.VirtualWidth; height = picasso96_state.VirtualHeight; } else { @@ -976,7 +976,7 @@ STATIC_INLINE void do_blitrect_frame_buffer (struct RenderInfo *ri, break; } case BLIT_LAST: - write_log( "P96: ERROR - do_blitrect_frame_buffer shouldn't get BLIT_LAST!\n"); + write_log ( "P96: ERROR - do_blitrect_frame_buffer shouldn't get BLIT_LAST!\n"); break; } /* switch opcode */ } // for end @@ -1048,7 +1048,7 @@ STATIC_INLINE void do_blitrect_frame_buffer (struct RenderInfo *ri, dst += dstri->BytesPerRow; } /* for height */ } - return; + return; } // (mask != 0xFF && Bpp <= 1) tmp3 = tmp2 = tmp = xmalloc (linewidth * height); /* allocate enough memory for the src-rect */ @@ -1153,28 +1153,84 @@ static void FillBoardInfo (uaecptr amigamemptr, struct LibResolution *res, dm->res.width * dm->res.height * dm->refresh); } -static uae_u32 AssignModeID (int i, int count) +struct modeids { + int width, height; + int id; +}; +static const struct modeids mi[] = { - if (DisplayModes[i].res.width == 320 && DisplayModes[i].res.height == 200) - return 0x50001000; - else if (DisplayModes[i].res.width == 320 && DisplayModes[i].res.height == 240) - return 0x50011000; - else if (DisplayModes[i].res.width == 640 && DisplayModes[i].res.height == 400) - return 0x50021000; - else if (DisplayModes[i].res.width == 640 && DisplayModes[i].res.height == 480) - return 0x50031000; - else if (DisplayModes[i].res.width == 800 && DisplayModes[i].res.height == 600) - return 0x50041000; - else if (DisplayModes[i].res.width == 1024 && DisplayModes[i].res.height == 768) - return 0x50051000; - else if (DisplayModes[i].res.width == 1152 && DisplayModes[i].res.height == 864) - return 0x50061000; - else if (DisplayModes[i].res.width == 1280 && DisplayModes[i].res.height == 1024) - return 0x50071000; - else if (DisplayModes[i].res.width == 1600 && DisplayModes[i].res.height == 1280) - return 0x50081000; + /* "original" modes */ - return 0x50091000 + count * 0x10000; + { 320, 200, 0 }, + { 320, 240, 1 }, + { 640, 400, 2 }, + { 640, 480, 3 }, + { 800, 600, 4 }, + { 1024, 768, 5 }, + { 1152, 864, 6 }, + { 1280,1024, 7 }, + { 1600,1280, 8 }, + + /* new modes */ + + { 704, 480, 129 }, + { 704, 576, 130 }, + { 720, 480, 131 }, + { 720, 576, 132 }, + { 768, 483, 133 }, + { 768, 576, 134 }, + { 800, 480, 135 }, + { 848, 480, 136 }, + { 854, 480, 137 }, + { 948, 576, 138 }, + { 1024, 576, 139 }, + { 1152, 768, 140 }, + { 1152, 864, 141 }, + { 1280, 720, 142 }, + { 1280, 768, 143 }, + { 1280, 800, 144 }, + { 1280, 854, 145 }, + { 1280, 960, 146 }, + { 1366, 768, 147 }, + { 1440, 900, 148 }, + { 1440, 960, 149 }, + { 1600,1200, 150 }, + { 1680,1050, 151 }, + { 1920,1080, 152 }, + { 1920,1200, 153 }, + { 2048,1152, 154 }, + { 2048,1536, 155 }, + { 2560,1600, 156 }, + { 2560,2048, 157 }, + { 400, 300, 158 }, + { 512, 384, 159 }, + { 640, 432, 160 }, + { 1360, 768, 161 }, + { 1360,1024, 162 }, + { 1400,1050, 163 }, + { 1792,1344, 164 }, + { 1800,1440, 165 }, + { 1856,1392, 166 }, + { 1920,1440, 167 }, + { 480, 360, 168 }, + { 640, 350, 169 }, + { 1600, 900, 170 }, + { 960, 600, 171 }, + { 1088, 612, 172 }, + { -1, -1, 0 } +}; + +static uae_u32 AssignModeID (int w, int h, unsigned int *non_standard_count) +{ + unsigned int i; + + for (i = 0; mi[i].width > 0; i++) { + if (w == mi[i].width && h == mi[i].height) + return 0x50001000 | (mi[i].id * 0x10000); + } + (*non_standard_count)++; + write_log ("P96: Non-stanard mode %dx%d\n", w, h); + return 0x51001000 - (*non_standard_count) * 0x10000; } /**************************************** @@ -1204,6 +1260,7 @@ uae_u32 REGPARAM2 picasso_InitCard (struct regstruct *regs) { struct LibResolution res; int i; + unsigned int non_standard_count = 0; int ModeInfoStructureCount = 1, LibResolutionStructureCount = 0; uaecptr amigamemptr = 0; uaecptr AmigaBoardInfo = m68k_areg (regs, 2); @@ -1226,7 +1283,7 @@ uae_u32 REGPARAM2 picasso_InitCard (struct regstruct *regs) for (i = 0; i < mode_count;) { int j = i; /* Add a LibResolution structure to the ResolutionsList MinList in our BoardInfo */ - res.DisplayID = AssignModeID (i, LibResolutionStructureCount); + res.DisplayID = AssignModeID (DisplayModes[i].res.width, DisplayModes[i].res.height, &non_standard_count); res.BoardInfo = AmigaBoardInfo; res.Width = DisplayModes[i].res.width; res.Height = DisplayModes[i].res.height; @@ -1462,7 +1519,7 @@ static void init_picasso_screen (void) if (set_panning_called) { picasso96_state.Extent = picasso96_state.Address - + (picasso96_state.BytesPerRow * vheight); + + (picasso96_state.BytesPerRow * vheight); xoff = picasso96_state.XOffset; yoff = picasso96_state.YOffset; } @@ -1647,8 +1704,8 @@ uae_u32 REGPARAM2 picasso_InvertRect (struct regstruct *regs) do_invertrect (&ri, Bpp, X, Y, Width, Height); else do_blit (&ri, Bpp, X, Y, X, Y, Width, Height, BLIT_SRC, 0); - } - result = 1; + } + result = 1; } return result; } @@ -1840,7 +1897,7 @@ uae_u32 REGPARAM2 picasso_FillRect (struct regstruct *regs) do_blit (&ri, Bpp, X, Y, X, Y, Width, Height, BLIT_SRC, 0); result = 1; } - } + } } return result; } @@ -1902,8 +1959,8 @@ STATIC_INLINE int BlitRectHelper (void) int can_do_visible_blit = 0; if (opcode == BLIT_DST) { - write_log ("P96: WARNING - BlitRect() being called with opcode of BLIT_DST\n"); - return 1; + write_log ("P96: WARNING - BlitRect() being called with opcode of BLIT_DST\n"); + return 1; } /* @@ -1941,16 +1998,16 @@ STATIC_INLINE int BlitRectHelper (void) P96TRACE (("P96: Did do_blit 1 in BlitRect()\n")); } else { - P96TRACE (("P96: Did not do_blit 1 in BlitRect()\n")); + P96TRACE (("P96: Did not do_blit 1 in BlitRect()\n")); } return 1; } STATIC_INLINE int BlitRect (uaecptr ri, uaecptr dstri, - unsigned long srcx, unsigned long srcy, + unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty, - unsigned long width, unsigned long height, + unsigned long width, unsigned long height, uae_u8 mask, BLIT_OPCODE opcode) { /* Set up the params */ @@ -2011,7 +2068,7 @@ uae_u32 REGPARAM2 picasso_BlitRect (struct regstruct *regs) P96TRACE (("P96: BlitRect(%d, %d, %d, %d, %d, %d, 0x%x)\n", srcx, srcy, dstx, dsty, width, height, Mask)); - result = BlitRect (renderinfo, (uaecptr)NULL, srcx, srcy, dstx, dsty, + result = BlitRect (renderinfo, 0, srcx, srcy, dstx, dsty, width, height, Mask, BLIT_SRC); return result; @@ -2164,7 +2221,7 @@ uae_u32 REGPARAM picasso_BlitPattern (struct regstruct *regs) wgfx_flushline (); if (CopyRenderInfoStructureA2U (rinf, &ri) - && CopyPatternStructureA2U (pinf, &pattern)) { + && CopyPatternStructureA2U (pinf, &pattern)) { Bpp = GetBytesPerPixel (ri.RGBFormat); uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp; /* offset with address */ @@ -2179,7 +2236,7 @@ uae_u32 REGPARAM picasso_BlitPattern (struct regstruct *regs) if( pattern.DrawMode == COMP) P96TRACE (("P96: WARNING - BlitPattern() has unhandled mask 0x%x with"\ - " COMP DrawMode. Using fall-back routine.\n", Mask)); + " COMP DrawMode. Using fall-back routine.\n", Mask)); else result = 1; } else @@ -2255,17 +2312,17 @@ uae_u32 REGPARAM picasso_BlitPattern (struct regstruct *regs) } /* switch (Bpp) */ } break; - } /* switch (pattern.DrawMode) */ - } /* for (bits) */ - } /* for (cols) */ - } /* for (rows) */ + } /* switch (pattern.DrawMode) */ + } /* for (bits) */ + } /* for (cols) */ + } /* for (rows) */ /* If we need to update a second-buffer (extra_mem is set), then do it only if visible! */ - if (picasso_vidinfo.extra_mem && renderinfo_is_current_screen (&ri)) + if (picasso_vidinfo.extra_mem && renderinfo_is_current_screen (&ri)) do_blit (&ri, Bpp, X, Y, X, Y, W, H, BLIT_SRC, 0); result = 1; - } + } } return result; } @@ -2337,13 +2394,13 @@ uae_u32 REGPARAM2 picasso_BlitTemplate (struct regstruct *regs) # endif return 0; } else - result = 1; - } else - result = 1; + result = 1; + } else + result = 1; #if 1 - if (tmp.DrawMode == COMP) { - /* workaround, let native blitter handle COMP mode */ + if (tmp.DrawMode == COMP) { + /* workaround, let native blitter handle COMP mode */ # if 0 //def _WIN32 flushpixels(); # endif @@ -2499,7 +2556,7 @@ static void PlanarToChunky (struct RenderInfo *ri, struct BitMap *bm, uae_u8 *PLANAR[8]; uae_u8 *image = ri->Memory + dstx * GetBytesPerPixel (ri->RGBFormat) - + dsty * ri->BytesPerRow; + + dsty * ri->BytesPerRow; int Depth = bm->Depth; unsigned long rows, bitoffset = srcx & 7; long eol_offset; @@ -2600,7 +2657,7 @@ uae_u32 REGPARAM2 picasso_BlitPlanar2Chunky (struct regstruct *regs) return 0; } if (!CopyRenderInfoStructureA2U (ri, &local_ri) - || !CopyBitMapStructureA2U (bm, &local_bm)) + || !CopyBitMapStructureA2U (bm, &local_bm)) return 0; P96TRACE (("P96: BlitPlanar2Chunky(%d, %d, %d, %d, %d, %d) Minterm 0x%x," @@ -2774,7 +2831,7 @@ uae_u32 REGPARAM2 picasso_BlitPlanar2Direct (struct regstruct *regs) " Using fall-back routine.\n")); } } else { - P96TRACE (("P96: WARNING - BlitPlanar2Direct () has unhandled op-code" + P96TRACE (("P96: WARNING - BlitPlanar2Direct () has unhandled op-code" " 0x%x. Using fall-back routine.\n", minterm)); } return result; @@ -2803,22 +2860,22 @@ uae_u32 REGPARAM2 picasso_BlitPlanar2Direct (struct regstruct *regs) STATIC_INLINE void flush_write (uaecptr addr, uae_u8 size) { if (picasso_on) { - /* Is this data on the same framebuffer line as previous + /* Is this data on the same framebuffer line as previous * successive writes? */ - if (addr >= currline_start && (addr + size) <= currline_end) { + if (addr >= currline_start && (addr + size) <= currline_end) { /* Yes. Don't flush now. We'll flush the whole line later */ if (addr < currline_min) - currline_min = addr; + currline_min = addr; if ((addr + size) > currline_max) - currline_max = addr + size; + currline_max = addr + size; } else { /* Otherwise, this data is on different line, or * we don't have a current line */ - int line_no; + int line_no; /* If there is a current line, flush it to the display now */ if (currline_start != 0xFFFFFFFF) - flush_currline (); + flush_currline (); /* Now we need to set up a new current line, starting with this * write.*/ @@ -2827,13 +2884,13 @@ STATIC_INLINE void flush_write (uaecptr addr, uae_u8 size) /* If this line is outside of the p96 screen in the framebuffer * we ignore it */ if ((line_no >= picasso96_state.YOffset) && (line_no < picasso96_state.YOffset + picasso96_state.Height)) { - currline_start = picasso96_state.Address + line_no * picasso96_state.BytesPerRow; - currline_end = currline_start + picasso96_state.BytesPerRow; - currline_min = addr; - currline_max = addr+size; - currline_y = line_no; + currline_start = picasso96_state.Address + line_no * picasso96_state.BytesPerRow; + currline_end = currline_start + picasso96_state.BytesPerRow; + currline_min = addr; + currline_max = addr+size; + currline_y = line_no; } - } + } } } @@ -2939,13 +2996,13 @@ int picasso_display_mode_index (uae_u32 x, uae_u32 y, uae_u32 d) { int i; for (i = 0; i < mode_count; i++) { - if (DisplayModes[i].res.width == x + if (DisplayModes[i].res.width == x && DisplayModes[i].res.height == y && DisplayModes[i].depth == (int)d) - break; + break; } if (i == mode_count) - i = -1; + i = -1; return i; } @@ -2988,14 +3045,14 @@ void InitPicasso96 (void) } mode_count = DX_FillResolutions (&picasso96_pixel_format); - qsort (DisplayModes, mode_count, sizeof (struct PicassoResolution), + qsort (DisplayModes, mode_count, sizeof (struct PicassoResolution), resolution_compare); - /* Work-around for possible P96 bug. A8R8G8B8 modes have + /* Work-around for possible P96 bug. A8R8G8B8 modes have * palette emulation issues. Tell the world we have a * a BGRA mode instead (and we'll byte-swap all pixels output). */ - if (picasso_vidinfo.rgbformat == RGBFB_A8R8G8B8) { + if (picasso_vidinfo.rgbformat == RGBFB_A8R8G8B8) { picasso_vidinfo.rgbformat = RGBFB_B8G8R8A8; picasso96_pixel_format &= RGBFF_CHUNKY; picasso96_pixel_format |= 1 << picasso_vidinfo.rgbformat; diff --git a/src/sd-sdl/sound.c b/src/sd-sdl/sound.c index 9fbd5e2..6d8bcc6 100644 --- a/src/sd-sdl/sound.c +++ b/src/sd-sdl/sound.c @@ -1,242 +1,237 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * Support for SDL sound - * - * Copyright 1997 Bernd Schmidt - * Copyright 2003-2006 Richard Drummond - */ - -#include "sysconfig.h" -#include "sysdeps.h" - -#include "options.h" -#include "gensound.h" -#include "sounddep/sound.h" -#include "threaddep/thread.h" -#include -#include - -static int have_sound = 0; - -uae_u16 sndbuffer[44100]; -uae_u16 *sndbufpt; -int sndbufsize; -static SDL_AudioSpec spec; - -static smp_comm_pipe to_sound_pipe; -static uae_sem_t data_available_sem, callback_done_sem, sound_init_sem; - -static int in_callback, closing_sound; - -static void clearbuffer (void) -{ - memset (sndbuffer, (spec.format == AUDIO_U8) ? SOUND8_BASE_VAL : SOUND16_BASE_VAL, sizeof (sndbuffer)); -} - -/* This shouldn't be necessary . . . */ -static void dummy_callback (void *userdata, Uint8 *stream, int len) -{ - return; -} - -static void sound_callback (void *userdata, Uint8 *stream, int len) -{ - if (closing_sound) - return; - in_callback = 1; - /* Wait for data to finish. */ - uae_sem_wait (&data_available_sem); - if (! closing_sound) { - memcpy (stream, sndbuffer, sndbufsize); - /* Notify writer that we're done. */ - uae_sem_post (&callback_done_sem); - } - in_callback = 0; -} - -void finish_sound_buffer (void) -{ - uae_sem_post (&data_available_sem); - uae_sem_wait (&callback_done_sem); -} - -/* Try to determine whether sound is available. */ -int setup_sound (void) -{ - int success = 0; - - if (SDL_InitSubSystem (SDL_INIT_AUDIO) == 0) { - spec.freq = currprefs.sound_freq; - spec.format = currprefs.sound_bits == 8 ? AUDIO_U8 : AUDIO_S16SYS; - spec.channels = currprefs.sound_stereo ? 2 : 1; - spec.callback = dummy_callback; - spec.samples = spec.freq * currprefs.sound_latency / 1000; - spec.callback = sound_callback; - spec.userdata = 0; - - if (SDL_OpenAudio (&spec, 0) < 0) { - write_log ("Couldn't open audio: %s\n", SDL_GetError()); - SDL_QuitSubSystem (SDL_INIT_AUDIO); - } else { - success = 1; - SDL_CloseAudio (); - } - } - - sound_available = success; - - return sound_available; -} - -static int open_sound (void) -{ - spec.freq = currprefs.sound_freq; - spec.format = currprefs.sound_bits == 8 ? AUDIO_U8 : AUDIO_S16SYS; - spec.channels = currprefs.sound_stereo ? 2 : 1; - spec.samples = spec.freq * currprefs.sound_latency / 1000; - spec.callback = sound_callback; - spec.userdata = 0; - - clearbuffer(); - if (SDL_OpenAudio (&spec, NULL) < 0) { - write_log ("Couldn't open audio: %s\n", SDL_GetError()); - return 0; - } - - if (spec.format == AUDIO_S16SYS) { - init_sound_table16 (); - sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler; - } else { - init_sound_table8 (); - sample_handler = currprefs.sound_stereo ? sample8s_handler : sample8_handler; - } - have_sound = 1; - - sound_available = 1; - obtainedfreq = currprefs.sound_freq; - sndbufsize = spec.samples * currprefs.sound_bits / 8 * spec.channels; - write_log ("SDL sound driver found and configured for %d bits at %d Hz, buffer is %d ms (%d bytes).\n", - currprefs.sound_bits, spec.freq, spec.samples * 1000 / spec.freq, sndbufsize); - sndbufpt = sndbuffer; - - return 1; -} - -static void *sound_thread (void *dummy) -{ - for (;;) { - int cmd = read_comm_pipe_int_blocking (&to_sound_pipe); - int n; - - switch (cmd) { - case 0: - open_sound (); - uae_sem_post (&sound_init_sem); - break; - case 1: - uae_sem_post (&sound_init_sem); - return 0; - } - } -} - -/* We need a thread for this, since communication between finish_sound_buffer - * and the callback works through semaphores. In theory, this is unnecessary, - * since SDL uses a sound thread internally, and the callback runs in its - * context. But we don't want to depend on SDL's internals too much. */ -static void init_sound_thread (void) -{ - uae_thread_id tid; - - init_comm_pipe (&to_sound_pipe, 20, 1); - uae_sem_init (&data_available_sem, 0, 0); - uae_sem_init (&callback_done_sem, 0, 0); - uae_sem_init (&sound_init_sem, 0, 0); - uae_start_thread (sound_thread, NULL, &tid); -} - -void close_sound (void) -{ - if (! have_sound) - return; - - SDL_PauseAudio (1); - clearbuffer(); - if (in_callback) { - closing_sound = 1; - uae_sem_post (&data_available_sem); - } - write_comm_pipe_int (&to_sound_pipe, 1, 1); - uae_sem_wait (&sound_init_sem); - SDL_CloseAudio (); - uae_sem_destroy (&data_available_sem); - uae_sem_destroy (&sound_init_sem); - uae_sem_destroy (&callback_done_sem); - have_sound = 0; - - #ifdef DRIVESOUND - driveclick_free(); - #endif -} - -int init_sound (void) -{ - in_callback = 0; - closing_sound = 0; - - init_sound_thread (); - write_comm_pipe_int (&to_sound_pipe, 0, 1); - uae_sem_wait (&sound_init_sem); - SDL_PauseAudio (0); - - #ifdef DRIVESOUND - driveclick_init(); - #endif - - return have_sound; -} - -void pause_sound (void) -{ - - SDL_PauseAudio (1); - clearbuffer(); - if (in_callback) { - closing_sound = 1; - uae_sem_post (&data_available_sem); - } -} - -void resume_sound (void) -{ - clearbuffer(); - SDL_PauseAudio (0); - closing_sound = 0; -} - -void reset_sound (void) -{ - clearbuffer(); - return; -} - -void sound_volume (int dir) -{ -} - -/* - * Handle audio specific cfgfile options - */ -void audio_default_options (struct uae_prefs *p) -{ -} - -void audio_save_options (FILE *f, const struct uae_prefs *p) -{ -} - -int audio_parse_option (struct uae_prefs *p, const char *option, const char *value) -{ - return 0; -} + /* + * UAE - The Un*x Amiga Emulator + * + * Support for SDL sound + * + * Copyright 1997 Bernd Schmidt + * Copyright 2003-2006 Richard Drummond + */ + +#include "sysconfig.h" +#include "sysdeps.h" + +#include "options.h" +#include "gensound.h" +#include "sounddep/sound.h" +#include "threaddep/thread.h" +#include +#include + +static int have_sound = 0; + +uae_u16 sndbuffer[44100]; +uae_u16 *sndbufpt; +int sndbufsize; +static SDL_AudioSpec spec; + +static smp_comm_pipe to_sound_pipe; +static uae_sem_t data_available_sem, callback_done_sem, sound_init_sem; + +static int in_callback, closing_sound; + +static void clearbuffer (void) +{ + memset (sndbuffer, 0, sizeof (sndbuffer)); +} + +/* This shouldn't be necessary . . . */ +static void dummy_callback (void *userdata, Uint8 *stream, int len) +{ + return; +} + +static void sound_callback (void *userdata, Uint8 *stream, int len) +{ + if (closing_sound) + return; + in_callback = 1; + /* Wait for data to finish. */ + uae_sem_wait (&data_available_sem); + if (! closing_sound) { + memcpy (stream, sndbuffer, sndbufsize); + /* Notify writer that we're done. */ + uae_sem_post (&callback_done_sem); + } + in_callback = 0; +} + +void finish_sound_buffer (void) +{ + uae_sem_post (&data_available_sem); + uae_sem_wait (&callback_done_sem); +} + +/* Try to determine whether sound is available. */ +int setup_sound (void) +{ + int success = 0; + + if (SDL_InitSubSystem (SDL_INIT_AUDIO) == 0) { + spec.freq = currprefs.sound_freq; + spec.format = AUDIO_S16SYS; + spec.channels = currprefs.sound_stereo ? 2 : 1; + spec.callback = dummy_callback; + spec.samples = spec.freq * currprefs.sound_latency / 1000; + spec.callback = sound_callback; + spec.userdata = 0; + + if (SDL_OpenAudio (&spec, 0) < 0) { + write_log ("Couldn't open audio: %s\n", SDL_GetError()); + SDL_QuitSubSystem (SDL_INIT_AUDIO); + } else { + success = 1; + SDL_CloseAudio (); + } + } + + sound_available = success; + + return sound_available; +} + +static int open_sound (void) +{ + spec.freq = currprefs.sound_freq; + spec.format = AUDIO_S16SYS; + spec.channels = currprefs.sound_stereo ? 2 : 1; + spec.samples = spec.freq * currprefs.sound_latency / 1000; + spec.callback = sound_callback; + spec.userdata = 0; + + clearbuffer(); + if (SDL_OpenAudio (&spec, NULL) < 0) { + write_log ("Couldn't open audio: %s\n", SDL_GetError()); + return 0; + } + + init_sound_table16 (); + sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler; + + have_sound = 1; + sound_available = 1; + obtainedfreq = currprefs.sound_freq; + sndbufsize = spec.samples * 2 * spec.channels; + write_log ("SDL sound driver found and configured at %d Hz, buffer is %d ms (%d bytes).\n", + spec.freq, spec.samples * 1000 / spec.freq, sndbufsize); + sndbufpt = sndbuffer; + + return 1; +} + +static void *sound_thread (void *dummy) +{ + for (;;) { + int cmd = read_comm_pipe_int_blocking (&to_sound_pipe); + int n; + + switch (cmd) { + case 0: + open_sound (); + uae_sem_post (&sound_init_sem); + break; + case 1: + uae_sem_post (&sound_init_sem); + return 0; + } + } +} + +/* We need a thread for this, since communication between finish_sound_buffer + * and the callback works through semaphores. In theory, this is unnecessary, + * since SDL uses a sound thread internally, and the callback runs in its + * context. But we don't want to depend on SDL's internals too much. */ +static void init_sound_thread (void) +{ + uae_thread_id tid; + + init_comm_pipe (&to_sound_pipe, 20, 1); + uae_sem_init (&data_available_sem, 0, 0); + uae_sem_init (&callback_done_sem, 0, 0); + uae_sem_init (&sound_init_sem, 0, 0); + uae_start_thread (sound_thread, NULL, &tid); +} + +void close_sound (void) +{ + if (! have_sound) + return; + + SDL_PauseAudio (1); + clearbuffer(); + if (in_callback) { + closing_sound = 1; + uae_sem_post (&data_available_sem); + } + write_comm_pipe_int (&to_sound_pipe, 1, 1); + uae_sem_wait (&sound_init_sem); + SDL_CloseAudio (); + uae_sem_destroy (&data_available_sem); + uae_sem_destroy (&sound_init_sem); + uae_sem_destroy (&callback_done_sem); + have_sound = 0; + + #ifdef DRIVESOUND + driveclick_free(); + #endif +} + +int init_sound (void) +{ + in_callback = 0; + closing_sound = 0; + + init_sound_thread (); + write_comm_pipe_int (&to_sound_pipe, 0, 1); + uae_sem_wait (&sound_init_sem); + SDL_PauseAudio (0); + + #ifdef DRIVESOUND + driveclick_init(); + #endif + + return have_sound; +} + +void pause_sound (void) +{ + + SDL_PauseAudio (1); + clearbuffer(); + if (in_callback) { + closing_sound = 1; + uae_sem_post (&data_available_sem); + } +} + +void resume_sound (void) +{ + clearbuffer(); + SDL_PauseAudio (0); + closing_sound = 0; +} + +void reset_sound (void) +{ + clearbuffer(); + return; +} + +void sound_volume (int dir) +{ +} + +/* + * Handle audio specific cfgfile options + */ +void audio_default_options (struct uae_prefs *p) +{ +} + +void audio_save_options (FILE *f, const struct uae_prefs *p) +{ +} + +int audio_parse_option (struct uae_prefs *p, const char *option, const char *value) +{ + return 0; +} diff --git a/src/sd-sdl/sound.h b/src/sd-sdl/sound.h index 9c2d482..1ace33d 100644 --- a/src/sd-sdl/sound.h +++ b/src/sd-sdl/sound.h @@ -42,10 +42,7 @@ STATIC_INLINE void check_sound_buffers (void) #define PUT_SOUND_WORD_RIGHT(b) PUT_SOUND_WORD(b) #define PUT_SOUND_WORD_MONO(b) PUT_SOUND_WORD_LEFT(b) #define SOUND16_BASE_VAL 0 -#define SOUND8_BASE_VAL 128 -#define DEFAULT_SOUND_BITS 16 #define DEFAULT_SOUND_FREQ 44100 #define DEFAULT_SOUND_LATENCY 100 #define HAVE_STEREO_SUPPORT -#define HAVE_8BIT_AUDIO_SUPPORT diff --git a/src/sysconfig.h.in b/src/sysconfig.h.in index 1cb7ac2..41f6bf1 100644 --- a/src/sysconfig.h.in +++ b/src/sysconfig.h.in @@ -15,9 +15,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CAPS_CAPSIMAGE_H -/* Define to 1 if you have the `cfmakeraw' function. */ -#undef HAVE_CFMAKERAW - /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H @@ -40,11 +37,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H -/* Define to 1 if you have the `getcwd' function. */ -#undef HAVE_GETCWD - -/* Define to 1 if you have the `getopt' function. */ -#undef HAVE_GETOPT +/* Define to 1 if you have the CAPS framework. */ +#undef HAVE_FRAMEWORK_CAPSIMAGE /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY @@ -68,9 +62,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LIBRARIES_CYBERGRAPHICS_H -/* Define to 1 if you have the `z' library (-lz). */ -#undef HAVE_LIBZ - /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R @@ -83,9 +74,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H -/* Define to 1 if you have the `mkdir' function. */ -#undef HAVE_MKDIR - /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP @@ -101,9 +89,6 @@ /* Define to 1 if you have the `readdir_r' function. */ #undef HAVE_READDIR_R -/* Define to 1 if you have the `rmdir' function. */ -#undef HAVE_RMDIR - /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT @@ -231,9 +216,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VFS_H -/* Define to 1 if you have the `tcgetattr' function. */ -#undef HAVE_TCGETATTR - /* Define to 1 if you have the `timegm' function. */ #undef HAVE_TIMEGM @@ -359,6 +341,21 @@ /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME +/* Define to the UAE version */ +#undef UAE_VERSION + +/* Define to the UAE major version number */ +#undef UAE_VERSION_MAJOR + +/* Define to the UAE minor version number */ +#undef UAE_VERSION_MINOR + +/* Define to the UAE revision number */ +#undef UAE_VERSION_REVISION + +/* Define to the optional UAE version tag */ +#undef UAE_VERSION_TAG + /* Version number of package */ #undef VERSION diff --git a/src/sysconfig.h.wii b/src/sysconfig.h.wii index 20760c5..a4dbe84 100644 --- a/src/sysconfig.h.wii +++ b/src/sysconfig.h.wii @@ -1,6 +1,9 @@ /* src/sysconfig.h. Generated from sysconfig.h.in by configure. */ /* src/sysconfig.h.in. Generated from configure.in by autoheader. */ +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + /* Define to 1 if you have the `alarm' function. */ #define HAVE_ALARM 1 @@ -19,11 +22,8 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_CAPS_CAPSIMAGE_H */ -/* Define to 1 if you have the `cfmakeraw' function. */ -#define HAVE_CFMAKERAW 1 - /* Define to 1 if you have the header file. */ -#define HAVE_CURSES_H 1 +/* #undef HAVE_CURSES_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_CYBERGRAPHX_CYBERGRAPHICS_H */ @@ -36,7 +36,7 @@ #define HAVE_DIRENT_H 1 /* "Define to 1 if you have 'dlopen' function */ -#define HAVE_DLOPEN 1 +/* #undef HAVE_DLOPEN */ /* Define to 1 if you have the header file. */ /* #undef HAVE_DUSTAT_H */ @@ -44,11 +44,8 @@ /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 -/* Define to 1 if you have the `getcwd' function. */ -#define HAVE_GETCWD 1 - -/* Define to 1 if you have the `getopt' function. */ -#define HAVE_GETOPT 1 +/* Define to 1 if you have the CAPS framework. */ +/* #undef HAVE_FRAMEWORK_CAPSIMAGE */ /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 @@ -72,9 +69,6 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBRARIES_CYBERGRAPHICS_H */ -/* Define to 1 if you have the `z' library (-lz). */ -#define HAVE_LIBZ 1 - /* Define to 1 if you have the `localtime_r' function. */ #define HAVE_LOCALTIME_R 1 @@ -85,16 +79,13 @@ /* #undef HAVE_MACHINE_SOUNDCARD_H */ /* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mkdir' function. */ -#define HAVE_MKDIR 1 +/* #undef HAVE_MEMORY_H */ /* Define to 1 if you have the `nanosleep' function. */ #define HAVE_NANOSLEEP 1 /* Define to 1 if you have the header file. */ -#define HAVE_NCURSES_H 1 +/* #undef HAVE_NCURSES_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ @@ -105,9 +96,6 @@ /* Define to 1 if you have the `readdir_r' function. */ #define HAVE_READDIR_R 1 -/* Define to 1 if you have the `rmdir' function. */ -#undef HAVE_RMDIR - /* Define to 1 if you have the `select' function. */ #define HAVE_SELECT 1 @@ -115,7 +103,7 @@ #define HAVE_SETITIMER 1 /* Define to 1 if you have the `sigaction' function. */ -#undef HAVE_SIGACTION +#define HAVE_SIGACTION 1 /* Define to 1 if you have the `sleep' function. */ #define HAVE_SLEEP 1 @@ -137,7 +125,7 @@ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the `strcmpi' function. */ -/* #undef HAVE_STRCMPI */ +#define HAVE_STRCMPI 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 @@ -146,12 +134,10 @@ #define HAVE_STRERROR 1 /* Define to 1 if you have the `stricmp' function. */ -/* #undef HAVE_STRICMP */ +#define HAVE_STRICMP 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 -/*#undef HAVE_STRINGS_H */ - /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 @@ -159,7 +145,7 @@ /* Define to 1 if you have the `strstr' function. */ #define HAVE_STRSTR 1 -/* Define to 1 if `st_blocks' is member of `struct stat'. */ +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_BLOCKS 1 /* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use @@ -193,17 +179,16 @@ /* #undef HAVE_SYS_FS_TYPES_H */ /* Define to 1 if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 +/* #undef HAVE_SYS_IOCTL_H */ /* Define to 1 if you have the header file. */ -#define HAVE_SYS_IPC_H 1 +/* #undef HAVE_SYS_IPC_H */ /* Define to 1 if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 +/* #undef HAVE_SYS_MMAN_H */ /* Define to 1 if you have the header file. */ -/*#define HAVE_SYS_MOUNT_H 1 */ -#undef HAVE_SYS_MOUNT_H +/* #undef HAVE_SYS_MOUNT_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ @@ -213,24 +198,22 @@ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ -#define HAVE_SYS_SHM_H 1 +/* #undef HAVE_SYS_SHM_H */ /* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOUNDCARD_H 1 +/* #undef HAVE_SYS_SOUNDCARD_H */ /* Define to 1 if you have the header file. */ -/*#define HAVE_SYS_STATFS_H 1*/ -#undef HAVE_SYS_STATFS_H +/* #undef HAVE_SYS_STATFS_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_STATVFS_H 1 -/* #undef HAVE_SYS_STATVFS_H1 */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ -#define HAVE_SYS_TERMIOS_H 1 +/* #undef HAVE_SYS_TERMIOS_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 @@ -239,14 +222,10 @@ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ -/* #define HAVE_SYS_VFS_H 1 */ -#undef HAVE_SYS_VFS_H - -/* Define to 1 if you have the `tcgetattr' function. */ -#define HAVE_TCGETATTR 1 +/* #undef HAVE_SYS_VFS_H */ /* Define to 1 if you have the `timegm' function. */ -#undef HAVE_TIMEGM +//#define HAVE_TIMEGM 1 /* Define if you have the 'uintmax_t' type in or . */ #define HAVE_UINTMAX_T 1 @@ -267,8 +246,7 @@ #define HAVE_UTIME_NULL 1 /* Define to 1 if you have the header file. */ -/*#define HAVE_VALUES_H 1 */ -#undef HAVE_VALUES_H +/* #undef HAVE_VALUES_H */ /* Define to 1 if you have the `vfprintf' function. */ #define HAVE_VFPRINTF 1 @@ -295,13 +273,16 @@ #define PACKAGE_NAME "E-UAE" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "E-UAE 0.8.29-WIP4" +#define PACKAGE_STRING "E-UAE 0.8.29" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "e-uae" +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + /* Define to the version of this package. */ -#define PACKAGE_VERSION "0.8.29-WIP4" +#define PACKAGE_VERSION "0.8.29" /* Define to the necessary symbol if this constant uses a non-standard name on your system. */ @@ -343,8 +324,7 @@ /* Define if statfs takes 2 args and struct statfs has a field named f_bsize. (4.3BSD, SunOS 4, HP-UX, AIX PS/2) */ -/*#define STAT_STATFS2_BSIZE 1*/ -#undef STAT_STATFS2_BSIZE +/* #undef STAT_STATFS2_BSIZE */ /* Define if statfs takes 2 args and struct statfs has a field named f_fsize. (4.4BSD, NetBSD) */ @@ -361,7 +341,7 @@ /* #undef STAT_STATFS4 */ /* Define if there is a function named statvfs. (SVR4) */ -/* #undef STAT_STATVFS */ +#define STAT_STATVFS 1 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -372,29 +352,77 @@ /* Define to 1 if your declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ -/* Version number of package */ -#define VERSION "0.8.29-WIP4" +/* Define to the UAE version */ +#define UAE_VERSION "0.8.29" -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#define WORDS_BIGENDIAN 1 +/* Define to the UAE major version number */ +#define UAE_VERSION_MAJOR 0 -/* Define to 1 if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ +/* Define to the UAE minor version number */ +#define UAE_VERSION_MINOR 8 -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ +/* Define to the UAE revision number */ +#define UAE_VERSION_REVISION 29 + +/* Define to the optional UAE version tag */ +#define UAE_VERSION_TAG "" + +/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE -/* # undef _ALL_SOURCE */ +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 #endif + +/* Version number of package */ +#define VERSION "0.8.29" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# define WORDS_BIGENDIAN 1 +# endif +#endif + +/* Define to 1 if the X Window System is missing or not being used. */ +#define X_DISPLAY_MISSING 1 + /* Number of bits in a file offset, on hosts where this is settable. */ -#define _FILE_OFFSET_BITS 64 +/* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ @@ -414,7 +442,7 @@ /* #undef size_t */ /* Substitute for socklen_t */ -/* #undef socklen_t */ +#define socklen_t int /* Define to unsigned long or unsigned long long if and don't define. */ diff --git a/src/tools/Makefile.wii b/src/tools/Makefile.wii index 7c1773e..78eb16c 100644 --- a/src/tools/Makefile.wii +++ b/src/tools/Makefile.wii @@ -10,7 +10,21 @@ LDFLAGS = CFLAGS = -I../include LIBRARIES = -all: gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe +all: copy gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe + + +copy: + cp ../genblitter.c genblitter.c + cp ../blitops.c blitops.c + cp ../writelog.c writelog.c + cp ../build68k.c build68k.c + cp ../gencpu.c gencpu.c + cp ../readcpu.c readcpu.c + cp ../missing.c missing.c + cp ../gencomp.c gencomp.c + cp ../genlinetoscr.c genlinetoscr.c + cp ../cpudefs.c cpudefs.c + install: @@ -18,7 +32,7 @@ install: clean: -rm -f *.o -rm cpudefs.c - -rm -f gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe + -rm -f gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe genblitter.c blitops.c writelog.c build68k.c gencpu.c readcpu.c missing.c gencomp.c genlinetoscr.c cpudefs.c distclean: clean diff --git a/src/tools/sysconfig.h b/src/tools/sysconfig.h index 21aeed4..0169b22 100644 --- a/src/tools/sysconfig.h +++ b/src/tools/sysconfig.h @@ -20,13 +20,13 @@ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the `strcmpi' function. */ -/* #undef HAVE_STRCMPI */ +#define HAVE_STRCMPI 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `stricmp' function. */ -/* #undef HAVE_STRICMP */ +#define HAVE_STRICMP 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 @@ -80,7 +80,7 @@ #define SIZEOF_VOID_P 4 /* The size of `__int64', as computed by sizeof. */ -#define SIZEOF___INT64 0 +#define SIZEOF___INT64 8 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -89,7 +89,7 @@ System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE -/* # undef _ALL_SOURCE */ +# define _ALL_SOURCE 1 #endif /* Define to empty if `const' does not conform to ANSI C. */ diff --git a/src/uaelib.c b/src/uaelib.c index 777328b..3118023 100644 --- a/src/uaelib.c +++ b/src/uaelib.c @@ -303,6 +303,7 @@ static uae_u32 emulib_Debug (void) */ static uae_u32 FindFunctionInObject (uae_u8 *objectptr) { +#if 0 uae_u8 *text_hdr; uae_u8 offset; text_hdr = (uae_u8 *)strstr ("text", (char *)objectptr); @@ -310,6 +311,7 @@ static uae_u32 FindFunctionInObject (uae_u8 *objectptr) offset = *(text_hdr + 19); return (uae_u32)(objectptr + offset); } +#endif return 0; }