From 9479b28f9c7178437e478a547417b43dde7889f6 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 25 Feb 2018 22:01:56 +0100 Subject: [PATCH 1/5] Implemented IDE seek commands from 0x71 to 0x7F (they behave identically to 0x70, per the specification). --- src/disk/hdc_ide.c | 52 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 2de441abb..50651cd1f 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -9,7 +9,7 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdc_ide.c 1.0.26 2018/02/14 + * Version: @(#)hdc_ide.c 1.0.27 2018/02/25 * * Authors: Sarah Walker, * Miran Grca, @@ -1137,6 +1137,33 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) { cdrom[atapi_cdrom_drives[ide->channel]].error = 0; } + if (val >= WIN_SEEK) && (val <= 0x7F) + { + if (ide_drive_is_zip(ide)) + { + zip[atapi_zip_drives[ide->channel]].status = READY_STAT; + } + else if (ide_drive_is_cdrom(ide)) + { + cdrom[atapi_cdrom_drives[ide->channel]].status = READY_STAT; + } + else + { + ide->atastat = READY_STAT; + } + timer_process(); + if (ide_drive_is_zip(ide)) + { + zip[atapi_zip_drives[ide->channel]].callback = 100LL*IDE_TIME; + } + if (ide_drive_is_cdrom(ide)) + { + cdrom[atapi_cdrom_drives[ide->channel]].callback = 100LL*IDE_TIME; + } + idecallback[ide_board]=100LL*IDE_TIME; + timer_update_outstanding(); + return; + } switch (val) { case WIN_SRST: /* ATAPI Device Reset */ @@ -1166,7 +1193,6 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) return; case WIN_RESTORE: - case WIN_SEEK: if (ide_drive_is_zip(ide)) { zip[atapi_zip_drives[ide->channel]].status = READY_STAT; @@ -1888,6 +1914,27 @@ void callbackide(int ide_board) zip_id = atapi_zip_drives[cur_ide[ide_board]]; zip_id_other = atapi_zip_drives[cur_ide[ide_board] ^ 1]; + if ((ide->command >= WIN_SEEK) && (ide->command <= 0x7F)) + { + if (ide_drive_is_zip(ide) || ide_drive_is_cdrom(ide)) + { + goto abort_cmd; + } + if (ide_drive_is_zip(ide)) + { + zip[zip_id].status = READY_STAT | DSC_STAT; + } + else if (ide_drive_is_cdrom(ide)) + { + cdrom[cdrom_id].status = READY_STAT | DSC_STAT; + } + else + { + ide->atastat = READY_STAT | DSC_STAT; + } + ide_irq_raise(ide); + return; + } switch (ide->command) { /* Initialize the Task File Registers as follows: Status = 00h, Error = 01h, Sector Count = 01h, Sector Number = 01h, @@ -1920,7 +1967,6 @@ void callbackide(int ide_board) return; case WIN_RESTORE: - case WIN_SEEK: if (ide_drive_is_zip(ide) || ide_drive_is_cdrom(ide)) { goto abort_cmd; From 8c5976e9295812d923201e48f7cf623f88c22514 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 25 Feb 2018 22:15:14 +0100 Subject: [PATCH 2/5] Fixed a compile-breaking mistake in hdc_ide.c. --- src/disk/hdc_ide.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 50651cd1f..d215ec77c 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -9,7 +9,7 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdc_ide.c 1.0.27 2018/02/25 + * Version: @(#)hdc_ide.c 1.0.28 2018/02/25 * * Authors: Sarah Walker, * Miran Grca, @@ -1137,7 +1137,7 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) { cdrom[atapi_cdrom_drives[ide->channel]].error = 0; } - if (val >= WIN_SEEK) && (val <= 0x7F) + if ((val >= WIN_SEEK) && (val <= 0x7F)) { if (ide_drive_is_zip(ide)) { From 7b5420571c73c8cc0c8a39b194bda53fe55d8296 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 25 Feb 2018 23:17:25 +0100 Subject: [PATCH 3/5] Fixed the ET4000AX, OS/2 now boots with it again. --- src/video/vid_et4000.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/video/vid_et4000.c b/src/video/vid_et4000.c index d3aa90572..6e76d2ecb 100644 --- a/src/video/vid_et4000.c +++ b/src/video/vid_et4000.c @@ -8,13 +8,13 @@ * * Emulation of the Tseng Labs ET4000. * - * Version: @(#)vid_et4000.c 1.0.3 2017/11/04 + * Version: @(#)vid_et4000.c 1.0.4 2018/02/25 * * Authors: Sarah Walker, * Miran Grca, * - * Copyright 2008-2017 Sarah Walker. - * Copyright 2016,2017 Miran Grca. + * Copyright 2008-2018 Sarah Walker. + * Copyright 2016-2018 Miran Grca. */ #include #include @@ -45,6 +45,18 @@ typedef struct et4000_t uint8_t banking; } et4000_t; +static uint8_t crtc_mask[0x40] = +{ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + void et4000_out(uint16_t addr, uint8_t val, void *p) { et4000_t *et4000 = (et4000_t *)p; @@ -75,6 +87,7 @@ void et4000_out(uint16_t addr, uint8_t val, void *p) if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) val = (svga->crtc[7] & ~0x10) | (val & 0x10); old = svga->crtc[svga->crtcreg]; + val &= crtc_mask[svga->crtcreg]; svga->crtc[svga->crtcreg] = val; if (old != val) { From 99f53633efa24d8462366642878813cac2f7b713 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 26 Feb 2018 13:38:57 +0100 Subject: [PATCH 4/5] Readded the CRTC register masks for the Trident TVGA8900D, those were also from PCem and should not have been removed. --- src/video/vid_tvga.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/video/vid_tvga.c b/src/video/vid_tvga.c index b7792e7cd..abc00de10 100644 --- a/src/video/vid_tvga.c +++ b/src/video/vid_tvga.c @@ -8,13 +8,13 @@ * * Trident TVGA (8900D) emulation. * - * Version: @(#)vid_tvga.c 1.0.3 2017/11/04 + * Version: @(#)vid_tvga.c 1.0.4 2018/02/26 * * Authors: Sarah Walker, * Miran Grca, * - * Copyright 2008-2017 Sarah Walker. - * Copyright 2016,2017 Miran Grca. + * Copyright 2008-2018 Sarah Walker. + * Copyright 2016-2018 Miran Grca. */ #include #include @@ -52,6 +52,18 @@ typedef struct tvga_t uint32_t vram_mask; } tvga_t; +static uint8_t crtc_mask[0x40] = +{ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x7f, 0xff, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xef, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x7f, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + static void tvga_recalcbanking(tvga_t *tvga); void tvga_out(uint16_t addr, uint8_t val, void *p) { @@ -123,6 +135,7 @@ void tvga_out(uint16_t addr, uint8_t val, void *p) if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) val = (svga->crtc[7] & ~0x10) | (val & 0x10); old = svga->crtc[svga->crtcreg]; + val &= crtc_mask[svga->crtcreg]; svga->crtc[svga->crtcreg] = val; if (old != val) { From 081d114cf1055a082e4ed6f0972819fa9f0c65a6 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 26 Feb 2018 13:45:11 +0100 Subject: [PATCH 5/5] Modified midi_fluidsynth.c so fluidsynth.h (and with it, libfluidsynth) is no longer needed. --- src/sound/midi_fluidsynth.c | 68 ++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 12c76d44f..71aebb31c 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -5,7 +5,6 @@ #include #include #include -#include #include "../86box.h" #include "../config.h" #include "../device.h" @@ -17,10 +16,31 @@ #include "sound.h" +#define FLUID_CHORUS_DEFAULT_N 3 +#define FLUID_CHORUS_DEFAULT_LEVEL 2.0f +#define FLUID_CHORUS_DEFAULT_SPEED 0.3f +#define FLUID_CHORUS_DEFAULT_DEPTH 8.0f +#define FLUID_CHORUS_DEFAULT_TYPE FLUID_CHORUS_MOD_SINE + #define RENDER_RATE 100 #define BUFFER_SEGMENTS 10 +enum fluid_chorus_mod { + FLUID_CHORUS_MOD_SINE = 0, + FLUID_CHORUS_MOD_TRIANGLE = 1 +}; + +enum fluid_interp { + FLUID_INTERP_NONE = 0, + FLUID_INTERP_LINEAR = 1, + FLUID_INTERP_DEFAULT = 4, + FLUID_INTERP_4THORDER = 4, + FLUID_INTERP_7THORDER = 7, + FLUID_INTERP_HIGHEST = 7 +}; + + extern void givealbuffer_midi(void *buf, uint32_t size); extern void pclog(const char *format, ...); extern void al_set_midi(int freq, int buf_size); @@ -29,27 +49,27 @@ extern int soundon; static void *fluidsynth_handle; /* handle to FluidSynth DLL */ /* Pointers to the real functions. */ -static fluid_settings_t*(*f_new_fluid_settings)(void); -static void (*f_delete_fluid_settings)(fluid_settings_t *settings); -static int (*f_fluid_settings_setnum)(fluid_settings_t *settings, const char *name, double val); -static int (*f_fluid_settings_getnum)(fluid_settings_t *settings, const char *name, double *val); -static fluid_synth_t * (*f_new_fluid_synth)(fluid_settings_t *settings); -static int (*f_delete_fluid_synth)(fluid_synth_t *synth); -static int (*f_fluid_synth_noteon)(fluid_synth_t *synth, int chan, int key, int vel); -static int (*f_fluid_synth_noteoff)(fluid_synth_t *synth, int chan, int key); -static int (*f_fluid_synth_cc)(fluid_synth_t *synth, int chan, int ctrl, int val); -static int (*f_fluid_synth_sysex)(fluid_synth_t *synth, const char *data, int len, char *response, int *response_len, int *handled, int dryrun); -static int (*f_fluid_synth_pitch_bend)(fluid_synth_t *synth, int chan, int val); -static int (*f_fluid_synth_program_change)(fluid_synth_t *synth, int chan, int program); -static int (*f_fluid_synth_sfload)(fluid_synth_t *synth, const char *filename, int reset_presets); -static int (*f_fluid_synth_sfunload)(fluid_synth_t *synth, unsigned int id, int reset_presets); -static int (*f_fluid_synth_set_interp_method)(fluid_synth_t *synth, int chan, int interp_method); -static void (*f_fluid_synth_set_reverb)(fluid_synth_t *synth, double roomsize, double damping, double width, double level); -static void (*f_fluid_synth_set_reverb_on)(fluid_synth_t *synth, int on); -static void (*f_fluid_synth_set_chorus)(fluid_synth_t *synth, int nr, double level, double speed, double depth_ms, int type); -static void (*f_fluid_synth_set_chorus_on)(fluid_synth_t *synth, int on); -static int (*f_fluid_synth_write_s16)(fluid_synth_t *synth, int len, void *lout, int loff, int lincr, void *rout, int roff, int rincr); -static int (*f_fluid_synth_write_float)(fluid_synth_t *synth, int len, void *lout, int loff, int lincr, void *rout, int roff, int rincr); +static void * (*f_new_fluid_settings)(void); +static void (*f_delete_fluid_settings)(void *settings); +static int (*f_fluid_settings_setnum)(void *settings, const char *name, double val); +static int (*f_fluid_settings_getnum)(void *settings, const char *name, double *val); +static void * (*f_new_fluid_synth)(void *settings); +static int (*f_delete_fluid_synth)(void *synth); +static int (*f_fluid_synth_noteon)(void *synth, int chan, int key, int vel); +static int (*f_fluid_synth_noteoff)(void *synth, int chan, int key); +static int (*f_fluid_synth_cc)(void *synth, int chan, int ctrl, int val); +static int (*f_fluid_synth_sysex)(void *synth, const char *data, int len, char *response, int *response_len, int *handled, int dryrun); +static int (*f_fluid_synth_pitch_bend)(void *synth, int chan, int val); +static int (*f_fluid_synth_program_change)(void *synth, int chan, int program); +static int (*f_fluid_synth_sfload)(void *synth, const char *filename, int reset_presets); +static int (*f_fluid_synth_sfunload)(void *synth, unsigned int id, int reset_presets); +static int (*f_fluid_synth_set_interp_method)(void *synth, int chan, int interp_method); +static void (*f_fluid_synth_set_reverb)(void *synth, double roomsize, double damping, double width, double level); +static void (*f_fluid_synth_set_reverb_on)(void *synth, int on); +static void (*f_fluid_synth_set_chorus)(void *synth, int nr, double level, double speed, double depth_ms, int type); +static void (*f_fluid_synth_set_chorus_on)(void *synth, int on); +static int (*f_fluid_synth_write_s16)(void *synth, int len, void *lout, int loff, int lincr, void *rout, int roff, int rincr); +static int (*f_fluid_synth_write_float)(void *synth, int len, void *lout, int loff, int lincr, void *rout, int roff, int rincr); static char* (*f_fluid_version_str)(void); static dllimp_t fluidsynth_imports[] = { { "new_fluid_settings", &f_new_fluid_settings }, @@ -80,8 +100,8 @@ static dllimp_t fluidsynth_imports[] = { typedef struct fluidsynth { - fluid_settings_t* settings; - fluid_synth_t* synth; + void* settings; + void* synth; int samplerate; int sound_font;