]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1510b7.zip
authorToni Wilen <twilen@winuae.net>
Thu, 24 Jul 2008 15:47:09 +0000 (18:47 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:42:03 +0000 (21:42 +0200)
15 files changed:
custom.c
debug.c
drawing.c
filesys.c
gayle.c
include/drawing.h
newcpu.c
od-win32/ahidsound_new.c
od-win32/registry.c
od-win32/win32.c
od-win32/win32.h
od-win32/win32_scale2x.c
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/winuaechangelog.txt

index 25b62489790b1825a2e842bb49144eb2dabe4839..7ab9fcddde70fab4967b645e2d5598d8c94dfd13 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -135,7 +135,7 @@ extern uae_u8* compiled_code;
 int vpos;
 int hack_vpos;
 static uae_u16 lof;
-static int next_lineno;
+static int next_lineno, prev_lineno;
 static enum nln_how nextline_how;
 static int lof_changed = 0;
 /* Stupid genlock-detection prevention hack.
@@ -258,21 +258,16 @@ static unsigned int clxdat, clxcon, clxcon2, clxcon_bpl_enable, clxcon_bpl_match
 
 enum copper_states {
     COP_stop,
-    COP_read1_in2,
-    COP_read1_wr_in4,
-    COP_read1_wr_in2,
     COP_read1,
-    COP_read2_wr_in2,
     COP_read2,
     COP_bltwait,
-    COP_wait_in4,
     COP_wait_in2,
-    COP_skip_in4,
     COP_skip_in2,
     COP_wait1,
     COP_wait,
     COP_skip1,
-    COP_strobe_delay
+    COP_strobe_delay1,
+    COP_strobe_delay2
 };
 
 struct copper {
@@ -288,6 +283,7 @@ struct copper {
 
     int strobe; /* COPJMP1 / COPJMP2 accessed */
     int last_write, last_write_hpos;
+    int moveaddr, movedata, movedelay;
 };
 
 static struct copper cop_state;
@@ -408,7 +404,7 @@ STATIC_INLINE void setclr (uae_u16 *p, uae_u16 val)
        *p &= ~val;
 }
 
-STATIC_INLINE alloc_cycle(int hpos, int type)
+STATIC_INLINE alloc_cycle (int hpos, int type)
 {
 #ifdef CPUEMU_12
 #if 0
@@ -422,6 +418,11 @@ STATIC_INLINE alloc_cycle(int hpos, int type)
     cycle_line[hpos] = type;
 #endif
 }
+STATIC_INLINE alloc_cycle_maybe (int hpos, int type)
+{
+    if (cycle_line[hpos] == 0)
+       alloc_cycle (hpos, type);
+}
 
 void alloc_cycle_ext(int hpos, int type)
 {
@@ -1657,14 +1658,22 @@ static void record_color_change (int hpos, int regno, unsigned long value)
        return;
     }
 #endif
+    if (regno < 0x1000 && hpos < HBLANK_OFFSET && !(beamcon0 & 0x80) && prev_lineno >= 0) {
+       struct draw_info *pdip = curr_drawinfo + prev_lineno;
+       int idx = pdip->last_color_change;
+       /* Move color changes in horizontal cycles 0 to HBLANK_OFFSET to end of previous line.
+        * Cycles 0 to HBLANK_OFFSET are visible in right border on real Amigas. (because of late hsync)
+        */
+        pdip->last_color_change++;
+        pdip->nr_color_changes++;
+        curr_color_changes[idx].linepos = hpos + maxhpos + 1;
+        curr_color_changes[idx].regno = regno;
+        curr_color_changes[idx].value = value;
+       curr_color_changes[idx + 1].regno = -1;
+    }
     curr_color_changes[next_color_change].linepos = hpos;
     curr_color_changes[next_color_change].regno = regno;
     curr_color_changes[next_color_change++].value = value;
-    if (hpos < HBLANK_OFFSET) {
-       curr_color_changes[next_color_change].linepos = HBLANK_OFFSET;
-       curr_color_changes[next_color_change].regno = regno;
-       curr_color_changes[next_color_change++].value = value;
-    }
     curr_color_changes[next_color_change].regno = -1;
 }
 
@@ -2241,6 +2250,9 @@ static void finish_decisions (void)
     } else
        /* The only one that may differ: */
        dp->ctable = thisline_decision.ctable;
+
+    /* leave free space for possible extra color changes at the end of line */
+    next_color_change += (HBLANK_OFFSET + 1) / 2;
 }
 
 /* Set the state of all decisions to "undecided" for a new scanline. */
@@ -2698,7 +2710,7 @@ static void COPJMP (int num)
     cop_state.ignore_next = 0;
     if (!oldstrobe)
        cop_state.state_prev = cop_state.state;
-    cop_state.state = COP_read1;
+    cop_state.state = COP_strobe_delay1;
     cop_state.vpos = vpos;
     cop_state.hpos = current_hpos () & ~1;
     copper_enabled_thisline = 0;
@@ -3649,10 +3661,8 @@ static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget)
     return custom_wput_1 (hpos, addr, value, noget);
 }
 
-static void perform_copper_write (int old_hpos)
+static void perform_copper_write (int old_hpos, int address, int data)
 {
-    unsigned int address = cop_state.saved_i1 & 0x1FE;
-
 #ifdef DEBUGGER
     if (debug_copper)
        record_copper (cop_state.saved_ip - 4, old_hpos, vpos);
@@ -3662,16 +3672,16 @@ static void perform_copper_write (int old_hpos)
        return;
     if (address == 0x88) {
        cop_state.ip = cop1lc;
-       cop_state.state = COP_strobe_delay;
+       cop_state.state = COP_strobe_delay1;
     } else if (address == 0x8A) {
        cop_state.ip = cop2lc;
-       cop_state.state = COP_strobe_delay;
+       cop_state.state = COP_strobe_delay1;
     } else {
-       custom_wput_copper (old_hpos, cop_state.saved_i1, cop_state.saved_i2, 0);
-       cop_state.last_write = cop_state.saved_i1;
+       custom_wput_copper (old_hpos, address, data, 0);
+       cop_state.last_write = address;
        cop_state.last_write_hpos = old_hpos;
        old_hpos++;
-       if (!nocustom () && cop_state.saved_i1 >= 0x140 && cop_state.saved_i1 < 0x180 && old_hpos >= SPR0_HPOS && old_hpos < SPR0_HPOS + 4 * MAX_SPRITES) {
+       if (!nocustom () && address >= 0x140 && address < 0x180 && old_hpos >= SPR0_HPOS && old_hpos < SPR0_HPOS + 4 * MAX_SPRITES) {
            //write_log ("%d:%d %04X:%04X\n", vpos, old_hpos, cop_state.saved_i1, cop_state.saved_i2);
            do_sprites (old_hpos);
        }
@@ -3740,99 +3750,99 @@ static void update_copper (int until_hpos)
        /* So we know about the fetch state.  */
        decide_line (c_hpos);
 
-       switch (cop_state.state) {
-       case COP_read1_in2:
-           cop_state.state = COP_read1;
-           break;
-       case COP_read1_wr_in2:
-           cop_state.state = COP_read1;
-           perform_copper_write (old_hpos);
-           /* That could have turned off the copper.  */
-           if (! copper_enabled_thisline)
-               goto out;
-
-           break;
-       case COP_read1_wr_in4:
-           cop_state.state = COP_read1_wr_in2;
-           break;
-       case COP_read2_wr_in2:
-           cop_state.state = COP_read2;
-           perform_copper_write (old_hpos);
-           /* That could have turned off the copper.  */
-           if (! copper_enabled_thisline)
-               goto out;
-
-           break;
-       case COP_wait_in2:
-           cop_state.state = COP_wait1;
-           break;
-       case COP_wait_in4:
-           cop_state.state = COP_wait_in2;
-           break;
-       case COP_skip_in2:
-           cop_state.state = COP_skip1;
-           break;
-       case COP_skip_in4:
-           cop_state.state = COP_skip_in2;
-           break;
-       case COP_strobe_delay:
-           cop_state.state = COP_read1_in2;
-           break;
-
-       default:
-           break;
+       if (cop_state.movedelay > 0) {
+           cop_state.movedelay--;
+           if (cop_state.movedelay == 0) {
+               perform_copper_write (old_hpos, cop_state.moveaddr, cop_state.movedata);
+               if (! copper_enabled_thisline)
+                   goto out;
+           }
        }
 
        c_hpos += 2;
+
        if (cop_state.strobe) {
            if (cop_state.strobe > 0)
                cop_state.ip = cop_state.strobe == 1 ? cop1lc : cop2lc;
            cop_state.strobe = 0;
        }
 
-       switch (cop_state.state) {
+       switch (cop_state.state)
+       {
 
-       case COP_read1_wr_in4:
-           uae_abort ("COP_read1_wr_in4");
+       case COP_wait_in2:
+           if (copper_cant_read (old_hpos))
+               continue;
+           cop_state.state = COP_wait1;
+           break;
+       case COP_skip_in2:
+           if (copper_cant_read (old_hpos))
+               continue;
+           cop_state.state = COP_skip1;
+           break;
+       case COP_strobe_delay1:
+           cop_state.state = COP_strobe_delay2;
+           alloc_cycle_maybe (old_hpos, CYCLE_COPPER);
+           break;
+       case COP_strobe_delay2:
+           if (copper_cant_read (old_hpos))
+               continue;
+           alloc_cycle (old_hpos, CYCLE_COPPER);
+           cop_state.state = COP_read1;
+           break;
 
-       case COP_read1_wr_in2:
        case COP_read1:
            if (copper_cant_read (old_hpos))
                continue;
            cop_state.i1 = chipmem_agnus_wget (cop_state.ip);
            alloc_cycle (old_hpos, CYCLE_COPPER);
            cop_state.ip += 2;
-           cop_state.state = cop_state.state == COP_read1 ? COP_read2 : COP_read2_wr_in2;
+           cop_state.state = COP_read2;
            break;
 
-       case COP_read2_wr_in2:
-           uae_abort ("read2_wr_in2");
-
        case COP_read2:
            if (copper_cant_read (old_hpos))
                continue;
            cop_state.i2 = chipmem_agnus_wget (cop_state.ip);
            alloc_cycle (old_hpos, CYCLE_COPPER);
            cop_state.ip += 2;
-           if (cop_state.ignore_next) {
-               cop_state.ignore_next = 0;
-               cop_state.state = COP_read1;
-               break;
-           }
 
            cop_state.saved_i1 = cop_state.i1;
            cop_state.saved_i2 = cop_state.i2;
            cop_state.saved_ip = cop_state.ip;
 
            if (cop_state.i1 & 1) {
+               cop_state.ignore_next = 0;
                if (cop_state.i2 & 1)
-                   cop_state.state = COP_skip_in4;
+                   cop_state.state = COP_skip_in2;
                else
-                   cop_state.state = COP_wait_in4;
+                   cop_state.state = COP_wait_in2;
            } else {
                unsigned int reg = cop_state.i1 & 0x1FE;
-               cop_state.state = isagnus[reg >> 1] ? COP_read1_wr_in2 : COP_read1_wr_in4;
+               cop_state.state = COP_read1;
+               cop_state.movedelay = isagnus[reg >> 1] ? 1 : 2;
+               cop_state.movedata = cop_state.i2;
+               if (cop_state.ignore_next) {
+                   test_copper_dangerous (cop_state.moveaddr);
+                   reg = 0x1fe;
+                   cop_state.ignore_next = 0;
+               }
+               cop_state.moveaddr = reg;
+               cop_state.movedelay = 0;
+               if (reg == 0x88) {
+                   cop_state.ip = cop1lc;
+                   cop_state.state = COP_strobe_delay1;
+               } else if (reg == 0x8A) {
+                   cop_state.ip = cop2lc;
+                   cop_state.state = COP_strobe_delay1;
+               } else {
+                   cop_state.movedelay = isagnus[reg >> 1] ? 1 : 2;
+               }
            }
+#ifdef DEBUGGER
+           if (debug_copper)
+               record_copper (cop_state.ip - 4, old_hpos, vpos);
+#endif
            break;
 
        case COP_wait1:
@@ -3874,8 +3884,6 @@ static void update_copper (int until_hpos)
 
            /* fall through */
        case COP_wait:
-           if (vp < cop_state.vcmp)
-               uae_abort ("vp < cop_state.vcmp");
            if (copper_cant_read (old_hpos))
                continue;
 
@@ -3907,6 +3915,8 @@ static void update_copper (int until_hpos)
 
            if (c_hpos >= (maxhpos & ~1))
                break;
+           if (copper_cant_read (old_hpos))
+               continue;
 
            vcmp = (cop_state.saved_i1 & (cop_state.saved_i2 | 0x8000)) >> 8;
            hcmp = (cop_state.saved_i1 & cop_state.saved_i2 & 0xFE);
@@ -3916,20 +3926,8 @@ static void update_copper (int until_hpos)
            if ((vp1 > vcmp || (vp1 == vcmp && hp1 >= hcmp))
                && ((cop_state.saved_i2 & 0x8000) != 0 || ! (DMACONR() & 0x4000)))
                cop_state.ignore_next = 1;
-           if (chipmem_agnus_wget (cop_state.ip) & 1) { /* FIXME: HACK!!! */
-               /* copper never skips if following instruction is WAIT or another SKIP... */
-               cop_state.ignore_next = 0;
-           }
-
            cop_state.state = COP_read1;
 
-           if (cop_state.ignore_next && (chipmem_agnus_wget (cop_state.ip) & 1) == 0) {
-               /* another undocumented copper feature:
-                  copper stops if skipped instruction is MOVE to dangerous register...
-               */
-               test_copper_dangerous (chipmem_agnus_wget (cop_state.ip));
-           }
-
 #ifdef DEBUGGER
            if (debug_copper)
                record_copper (cop_state.ip - 4, old_hpos, vpos);
@@ -4244,6 +4242,7 @@ static void init_hardware_frame (void)
 {
     first_bpl_vpos = -1;
     next_lineno = 0;
+    prev_lineno = -1;
     nextline_how = nln_normal;
     diwstate = DIW_waiting_start;
     hdiwstate = DIW_waiting_start;
@@ -4556,7 +4555,7 @@ static void hsync_handler (void)
     if (currprefs.cpu_cycle_exact || currprefs.blitter_cycle_exact) {
        decide_blitter (hpos);
        memset (cycle_line, 0, sizeof cycle_line);
-       alloc_cycle (1, CYCLE_REFRESH); /* strobe */
+       alloc_cycle (1, CYCLE_REFRESH);
        alloc_cycle (3, CYCLE_REFRESH);
        alloc_cycle (5, CYCLE_REFRESH);
        alloc_cycle (7, CYCLE_REFRESH);
@@ -4671,6 +4670,7 @@ static void hsync_handler (void)
                }
            }
        }
+       prev_lineno = next_lineno;
        next_lineno = lineno;
        reset_decisions ();
     }
diff --git a/debug.c b/debug.c
index 34b44be2bfe96cfae2ceb080cbda9b4dfca12f3a..4a1f4e1582b4c9ac5cf3d413c44747918468ad03 100755 (executable)
--- a/debug.c
+++ b/debug.c
@@ -674,7 +674,7 @@ static void disassemble_wait (FILE *file, unsigned long insn)
             vp, ve, hp, he, bfd);
 }
 
-#define NR_COPPER_RECORDS 40000
+#define NR_COPPER_RECORDS 100000
 /* Record copper activity for the debugger.  */
 struct cop_record
 {
@@ -695,8 +695,8 @@ void record_copper (uaecptr addr, int hpos, int vpos)
 {
     int t = nr_cop_records[curr_cop_set];
     if (!cop_record[0]) {
-       cop_record[0] = (struct cop_record*)malloc (NR_COPPER_RECORDS * sizeof (struct cop_record));
-       cop_record[1] = (struct cop_record*)malloc (NR_COPPER_RECORDS * sizeof (struct cop_record));
+       cop_record[0] = xmalloc (NR_COPPER_RECORDS * sizeof (struct cop_record));
+       cop_record[1] = xmalloc (NR_COPPER_RECORDS * sizeof (struct cop_record));
     }
     if (t < NR_COPPER_RECORDS) {
        cop_record[curr_cop_set][t].addr = addr;
@@ -706,11 +706,11 @@ void record_copper (uaecptr addr, int hpos, int vpos)
     }
     if (debug_copper & 2) { /* trace */
        debug_copper &= ~2;
-       activate_debugger();
+       activate_debugger ();
     }
     if ((debug_copper & 4) && addr >= debug_copper_pc && addr <= debug_copper_pc + 3) {
        debug_copper &= ~4;
-       activate_debugger();
+       activate_debugger ();
     }
 }
 
index 31d252a66598ec8802a21040e9467b722390da85..28179593692e650d3ed2c9d8c1772dd1a42deae8 100755 (executable)
--- a/drawing.c
+++ b/drawing.c
@@ -1755,32 +1755,6 @@ STATIC_INLINE void do_color_changes (line_draw_func worker_border, line_draw_fun
     }
 }
 
-/* Move color changes in horizontal cycles 0 to HBLANK_OFFSET - 1 to previous line.
- * Cycles 0 to HBLANK_OFFSET are visible in right border on real Amigas.
- */
-static void mungedip (int lineno, int next)
-{
-    int i = dip_for_drawing->last_color_change;
-    struct draw_info *dip_for_drawing_next = curr_drawinfo + (lineno + next);
-
-    if (dip_for_drawing_next->first_color_change == 0)
-       dip_for_drawing_next = curr_drawinfo + (lineno + 2);
-    while (i < dip_for_drawing_next->last_color_change) {
-       int regno = curr_color_changes[i].regno;
-       int hpos = curr_color_changes[i].linepos;
-       if (regno < 0)
-           break;
-       if (hpos >= HBLANK_OFFSET)
-           break;
-       curr_color_changes[i].linepos += maxhpos + 2;
-       dip_for_drawing->last_color_change++;
-       dip_for_drawing->nr_color_changes++;
-       dip_for_drawing_next->first_color_change++;
-       dip_for_drawing_next->nr_color_changes--;
-       i++;
-    }
-}
-
 enum double_how {
     dh_buf,
     dh_line,
@@ -1796,7 +1770,6 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
 
     dp_for_drawing = line_decisions + lineno;
     dip_for_drawing = curr_drawinfo + lineno;
-    mungedip (lineno, (dp_for_drawing->bplcon0 & 4) ? 2 : 1);
     switch (linestate[lineno]) {
     case LINE_REMEMBERED_AS_PREVIOUS:
        if (!warned)
index 5f577b404be7247b8834537323f9caa4c6bbb6d5..33a075f65907defea3593d0874c91db85425a17f 100755 (executable)
--- a/filesys.c
+++ b/filesys.c
@@ -397,15 +397,7 @@ static int set_filesys_unit_1 (int nr,
     }
 
     ui = &mountinfo.ui[nr];
-    ui->open = 0;
-    ui->devname = 0;
-    ui->volname = 0;
-    ui->rootdir = 0;
-    ui->unit_pipe = 0;
-    ui->back_pipe = 0;
-    ui->hf.handle_valid = 0;
-    ui->bootpri = 0;
-    ui->filesysdir = 0;
+    memset (ui, 0, sizeof (UnitInfo));
 
     if (volname != NULL) {
        int flags = 0;
@@ -1916,7 +1908,7 @@ static Unit *startup_create_unit (UnitInfo *uinfo, int num)
     int i;
     Unit *unit, *u;
 
-    unit = (Unit*)xcalloc (sizeof (Unit), 1);
+    unit = xcalloc (sizeof (Unit), 1);
     /* keep list in insertion order */
     u = units;
     if (u) {
@@ -4720,14 +4712,10 @@ void filesys_free_handles(void)
     }
 }
 
-void filesys_reset (void)
+static void filesys_reset2 (void)
 {
     Unit *u, *u1;
 
-    /* We get called once from customreset at the beginning of the program
-     * before filesys_start_threads has been called. Survive that.  */
-    if (savestate_state == STATE_RESTORE)
-       return;
 
     filesys_free_handles ();
     for (u = units; u; u = u1) {
@@ -4741,14 +4729,19 @@ void filesys_reset (void)
     initialize_mountinfo ();
 }
 
-void filesys_prepare_reset (void)
+void filesys_reset (void)
+{
+    if (savestate_state == STATE_RESTORE)
+       return;
+    filesys_reset2 ();
+}
+
+static void filesys_prepare_reset2 (void)
 {
     UnitInfo *uip;
     Unit *u;
     int i;
 
-    if (savestate_state == STATE_RESTORE)
-       return;
     uip = mountinfo.ui;
 #ifdef UAE_FILESYS_THREADS
     for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
@@ -4773,6 +4766,13 @@ void filesys_prepare_reset (void)
     }
 }
 
+void filesys_prepare_reset (void)
+{
+    if (savestate_state == STATE_RESTORE)
+       return;
+    filesys_prepare_reset2 ();
+}
+
 static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context)
 {
     uaecptr resaddr = m68k_areg (&context->regs, 2) + 0x10;
@@ -6001,9 +6001,9 @@ static uae_u8 *save_filesys_virtual (UnitInfo *ui, uae_u8 *dst)
 uae_u8 *save_filesys_common (int *len)
 {
     uae_u8 *dstbak, *dst;
-    if (nr_units() == 0)
+    if (nr_units () == 0)
        return NULL;
-    dstbak = dst = (uae_u8*)xmalloc (1000);
+    dstbak = dst = xmalloc (1000);
     save_u32 (2);
     save_u64 (a_uniq);
     save_u64 (key_uniq);
@@ -6015,7 +6015,8 @@ uae_u8 *restore_filesys_common (uae_u8 *src)
 {
     if (restore_u32 () != 2)
        return src;
-    free_mountinfo();
+    filesys_prepare_reset2 ();
+    filesys_reset2 ();
     a_uniq = restore_u64 ();
     key_uniq = restore_u64 ();
     return src;
@@ -6034,7 +6035,7 @@ uae_u8 *save_filesys (int num, int *len)
     if (type == FILESYS_VIRTUAL && (ui->self == NULL || ui->volname == NULL))
        return NULL;
     write_log ("FS_FILESYS: '%s' '%s'\n", ui->devname, ui->volname);
-    dstbak = dst = (uae_u8*)xmalloc (100000);
+    dstbak = dst = xmalloc (100000);
     save_u32 (2); /* version */
     save_u32 (ui->devno);
     save_u16 (type);
diff --git a/gayle.c b/gayle.c
index 0d204c50e6bd40589b95a7216f139009ca6d2c03..ea5087d1adfa2c2d21bbedaf05dcbced5c94ed2e 100755 (executable)
--- a/gayle.c
+++ b/gayle.c
@@ -1449,8 +1449,14 @@ static void checkflush (int addr)
 {
     if (pcmcia_card == 0 || pcmcia_sram == 0)
        return;
+    if (addr >= 0 && pcmcia_common[0] == 0 && pcmcia_common[1] == 0 && pcmcia_common[2] == 0)
+       return; // do not flush periodically if used as a ram expension
+    if (addr < 0) {
+       pcmcia_write_min = 0;
+       pcmcia_write_max = pcmcia_common_size;
+    }
     if (pcmcia_write_min >= 0) {
-       if (addr < 0 || abs (pcmcia_write_min - addr) >= 512 || abs (pcmcia_write_max - addr) >= 512) {
+       if (abs (pcmcia_write_min - addr) >= 512 || abs (pcmcia_write_max - addr) >= 512) {
            int blocksize = pcmcia_sram->hfd.blocksize;
            int mask = ~(blocksize - 1);
            int start = pcmcia_write_min & mask;
@@ -1577,11 +1583,27 @@ static void REGPARAM3 gayle_common_lput (uaecptr, uae_u32) REGPARAM;
 static void REGPARAM3 gayle_common_wput (uaecptr, uae_u32) REGPARAM;
 static void REGPARAM3 gayle_common_bput (uaecptr, uae_u32) REGPARAM;
 
+static int REGPARAM2 gayle_common_check (uaecptr addr, uae_u32 size)
+{
+    if (!pcmcia_common_size)
+       return 0;
+    addr -= PCMCIA_COMMON_START & (PCMCIA_COMMON_SIZE - 1);
+    addr &= PCMCIA_COMMON_SIZE - 1;
+    return (addr + size) <= PCMCIA_COMMON_SIZE;
+}
+
+static uae_u8 *REGPARAM2 gayle_common_xlate (uaecptr addr)
+{
+    addr -= PCMCIA_COMMON_START & (PCMCIA_COMMON_SIZE - 1);
+    addr &= PCMCIA_COMMON_SIZE - 1;
+    return pcmcia_common + addr;
+}
+
 static addrbank gayle_common_bank = {
     gayle_common_lget, gayle_common_wget, gayle_common_bget,
     gayle_common_lput, gayle_common_wput, gayle_common_bput,
-    default_xlate, default_check, NULL, "Gayle PCMCIA Common",
-    dummy_lgeti, dummy_wgeti, ABFLAG_RAM
+    gayle_common_xlate, gayle_common_check, NULL, "Gayle PCMCIA Common",
+    gayle_common_lget, gayle_common_wget, ABFLAG_RAM | ABFLAG_SAFE
 };
 
 
index 168435a7d52ae86a43047d56aab52babb5e7decc..ea49b459d4e014f46d87db019954c51b2774c196 100755 (executable)
@@ -21,7 +21,7 @@
    before it appears on-screen.  */
 #define DIW_DDF_OFFSET 9
 /* this many cycles starting from hpos=0 are visible on right border */
-#define HBLANK_OFFSET 4
+#define HBLANK_OFFSET 9
 
 /* We ignore that many lores pixels at the start of the display. These are
  * invisible anyway due to hardware DDF limits. */
index 48a6ab21f4d8d16189642264946556c2b8aa623c..5e1692ae87506e2868587181cd62e18fd6f438eb 100755 (executable)
--- a/newcpu.c
+++ b/newcpu.c
@@ -1630,7 +1630,7 @@ void m68k_reset (int hardreset)
      */
     regs.pcr = 0;
     if (currprefs.cpu_model == 68060) {
-       regs.pcr = currprefs.fpu_model ? MC68060_PCR : MC68EC060_PCR;
+       regs.pcr = currprefs.fpu_model == 68060 ? MC68060_PCR : MC68EC060_PCR;
        regs.pcr |= (currprefs.cpu060_revision & 0xff) << 8;
        if (kickstart_rom)
            regs.pcr |= 2; /* disable FPU */
index b918ec178394f3ab6b3f8af4363b7ebe6ec78175..bb2ff3bb912317ba1739eae19b437f62287c02f4 100755 (executable)
@@ -83,31 +83,6 @@ static int ahi_debug = 1;
 #define FUNCMODE_RECORD 2
 #define FUNCMODE_RECORDALLOC 4
 
-#define ahiac_AudioCtrl 0
-#define ahiac_Flags ahiac_AudioCtrl + 4
-#define ahiac_SoundFunc ahiac_Flags + 4
-#define ahiac_PlayerFunc ahiac_SoundFunc + 4
-#define ahiac_PlayerFreq ahiac_PlayerFunc + 4
-#define ahiac_MinPlayerFreq ahiac_PlayerFreq + 4
-#define ahiac_MaxPlayerFreq ahiac_MinPlayerFreq + 4
-#define ahiac_MixFreq ahiac_MaxPlayerFreq + 4
-#define ahiac_Channels ahiac_MixFreq + 4
-#define ahiac_Sounds ahiac_Channels + 2
-#define ahiac_DriverData ahiac_Sounds + 2
-#define ahiac_MixerFunc ahiac_DriverData + 4
-#define ahiac_SamplerFunc ahiac_MixerFunc + 4 
-#define ahiac_Obsolete ahiac_SamplerFunc + 4 
-#define ahiac_BuffSamples ahiac_Obsolete + 4 
-#define ahiac_MinBuffSamples ahiac_BuffSamples + 4 
-#define ahiac_MaxBuffSamples ahiac_MinBuffSamples + 4 
-#define ahiac_BuffSize ahiac_MaxBuffSamples + 4 
-#define ahiac_BuffType ahiac_BuffSize + 4 
-#define ahiac_PreTimer ahiac_BuffType + 4 
-#define ahiac_PostTimer ahiac_PreTimer + 4 
-#define ahiac_AntiClickSamples ahiac_PostTimer + 4 
-#define ahiac_PreTimerFunc ahiac_AntiClickSamples + 4 
-#define ahiac_PostTimerFunc ahiac_PreTimerFunc + 4 
-
 #define ahie_Effect 0
 #define ahieci_Func 4
 #define ahieci_Channels 8
@@ -158,6 +133,31 @@ struct AHIAudioCtrlDrv
        struct Hook *ahiac_PostTimerFunc;       /* A Hook wrapper for ahiac_PostTimer (V6) */
 #endif
 
+#define ahiac_AudioCtrl 0
+#define ahiac_Flags ahiac_AudioCtrl + 4
+#define ahiac_SoundFunc ahiac_Flags + 4
+#define ahiac_PlayerFunc ahiac_SoundFunc + 4
+#define ahiac_PlayerFreq ahiac_PlayerFunc + 4
+#define ahiac_MinPlayerFreq ahiac_PlayerFreq + 4
+#define ahiac_MaxPlayerFreq ahiac_MinPlayerFreq + 4
+#define ahiac_MixFreq ahiac_MaxPlayerFreq + 4
+#define ahiac_Channels ahiac_MixFreq + 4
+#define ahiac_Sounds ahiac_Channels + 2
+#define ahiac_DriverData ahiac_Sounds + 2
+#define ahiac_MixerFunc ahiac_DriverData + 4
+#define ahiac_SamplerFunc ahiac_MixerFunc + 4 
+#define ahiac_Obsolete ahiac_SamplerFunc + 4 
+#define ahiac_BuffSamples ahiac_Obsolete + 4 
+#define ahiac_MinBuffSamples ahiac_BuffSamples + 4 
+#define ahiac_MaxBuffSamples ahiac_MinBuffSamples + 4 
+#define ahiac_BuffSize ahiac_MaxBuffSamples + 4 
+#define ahiac_BuffType ahiac_BuffSize + 4 
+#define ahiac_PreTimer ahiac_BuffType + 4 
+#define ahiac_PostTimer ahiac_PreTimer + 4 
+#define ahiac_AntiClickSamples ahiac_PostTimer + 4 
+#define ahiac_PreTimerFunc ahiac_AntiClickSamples + 4 
+#define ahiac_PostTimerFunc ahiac_PreTimerFunc + 4 
+
 /* AHIsub_AllocAudio return flags */
 #define AHISF_ERROR            (1<<0)
 #define AHISF_MIXING           (1<<1)
@@ -218,36 +218,6 @@ struct AHIAudioCtrlDrv
 #define AHI_TagBase            (0x80000000)
 #define AHI_TagBaseR           (AHI_TagBase|0x8000)
 
- /* AHI_AllocAudioA tags */
-#define AHIA_AudioID           (AHI_TagBase+1)         /* Desired audio mode */
-#define AHIA_MixFreq           (AHI_TagBase+2)         /* Suggested mixing frequency */
-#define AHIA_Channels          (AHI_TagBase+3)         /* Suggested number of channels */
-#define AHIA_Sounds            (AHI_TagBase+4)         /* Number of sounds to use */
-#define AHIA_SoundFunc         (AHI_TagBase+5)         /* End-of-Sound Hook */
-#define AHIA_PlayerFunc                (AHI_TagBase+6)         /* Player Hook */
-#define AHIA_PlayerFreq                (AHI_TagBase+7)         /* Frequency for player Hook (Fixed)*/
-#define AHIA_MinPlayerFreq     (AHI_TagBase+8)         /* Minimum Frequency for player Hook */
-#define AHIA_MaxPlayerFreq     (AHI_TagBase+9)         /* Maximum Frequency for player Hook */
-#define AHIA_RecordFunc                (AHI_TagBase+10)        /* Sample recording Hook */
-#define AHIA_UserData          (AHI_TagBase+11)        /* What to put in ahiac_UserData */
-#define AHIA_AntiClickSamples  (AHI_TagBase+13)        /* # of samples to smooth (V6)  */
-
-  /* AHI_PlayA tags (V4) */
-#define AHIP_BeginChannel      (AHI_TagBase+40)        /* All command tags should be... */
-#define AHIP_EndChannel                (AHI_TagBase+41)        /* ... enclosed by these tags. */
-#define AHIP_Freq              (AHI_TagBase+50)
-#define AHIP_Vol               (AHI_TagBase+51)
-#define AHIP_Pan               (AHI_TagBase+52)
-#define AHIP_Sound             (AHI_TagBase+53)
-#define AHIP_Offset            (AHI_TagBase+54)
-#define AHIP_Length            (AHI_TagBase+55)
-#define AHIP_LoopFreq          (AHI_TagBase+60)
-#define AHIP_LoopVol           (AHI_TagBase+61)
-#define AHIP_LoopPan           (AHI_TagBase+62)
-#define AHIP_LoopSound         (AHI_TagBase+63)
-#define AHIP_LoopOffset                (AHI_TagBase+64)
-#define AHIP_LoopLength                (AHI_TagBase+65)
-
  /* AHI_ControlAudioA tags */
 #define AHIC_Play              (AHI_TagBase+80)        /* Boolean */
 #define AHIC_Record            (AHI_TagBase+81)        /* Boolean */
@@ -313,45 +283,6 @@ struct AHIAudioCtrlDrv
 /* --- New for V6, they will be ignored by V4 and earlier --- */
 #define AHIDB_MultiChannel     (AHI_TagBase+144)       /* Boolean */
 
- /* AHI_BestAudioIDA tags */
-/* --- New for V4, they will be ignored by V2 and earlier --- */
-#define AHIB_Dizzy             (AHI_TagBase+190)
-
- /* AHI_AudioRequestA tags */
-       /* Window control */
-#define AHIR_Window            (AHI_TagBase+200)       /* Parent window */
-#define AHIR_Screen            (AHI_TagBase+201)       /* Screen to open on if no window */
-#define AHIR_PubScreenName     (AHI_TagBase+202)       /* Name of public screen */
-#define AHIR_PrivateIDCMP      (AHI_TagBase+203)       /* Allocate private IDCMP? */
-#define AHIR_IntuiMsgFunc      (AHI_TagBase+204)       /* Function to handle IntuiMessages */
-#define AHIR_SleepWindow       (AHI_TagBase+205)       /* Block input in AHIR_Window? */
-#define AHIR_ObsoleteUserData  (AHI_TagBase+206)       /* V4 UserData */
-#define AHIR_UserData          (AHI_TagBase+207)       /* What to put in ahiam_UserData (V6) */
-       /* Text display */
-#define AHIR_TextAttr          (AHI_TagBase+220)       /* Text font to use for gadget text */
-#define AHIR_Locale            (AHI_TagBase+221)       /* Locale to use for text */
-#define AHIR_TitleText         (AHI_TagBase+222)       /* Title of requester */
-#define AHIR_PositiveText      (AHI_TagBase+223)       /* Positive gadget text */
-#define AHIR_NegativeText      (AHI_TagBase+224)       /* Negative gadget text */
-       /* Initial settings */
-#define AHIR_InitialLeftEdge   (AHI_TagBase+240)       /* Initial requester coordinates */
-#define AHIR_InitialTopEdge    (AHI_TagBase+241)
-#define AHIR_InitialWidth      (AHI_TagBase+242)       /* Initial requester dimensions */
-#define AHIR_InitialHeight     (AHI_TagBase+243)
-#define AHIR_InitialAudioID    (AHI_TagBase+244)       /* Initial audio mode id */
-#define AHIR_InitialMixFreq    (AHI_TagBase+245)       /* Initial mixing/sampling frequency */
-#define AHIR_InitialInfoOpened (AHI_TagBase+246)       /* Info window initially opened? */
-#define AHIR_InitialInfoLeftEdge (AHI_TagBase+247)     /* Initial Info window coords. */
-#define AHIR_InitialInfoTopEdge (AHI_TagBase+248)
-#define AHIR_InitialInfoWidth  (AHI_TagBase+249)       /* Not used! */
-#define AHIR_InitialInfoHeight (AHI_TagBase+250)       /* Not used! */
-       /* Options */
-#define AHIR_DoMixFreq         (AHI_TagBase+260)       /* Allow selection of mixing frequency? */
-#define AHIR_DoDefaultMode     (AHI_TagBase+261)       /* Allow selection of default mode? (V4) */
-       /* Filtering */
-#define AHIR_FilterTags                (AHI_TagBase+270)       /* Pointer to filter taglist */
-#define AHIR_FilterFunc                (AHI_TagBase+271)       /* Function to filter mode id's */
-
 /* Sound Types */
 #define AHIST_NOTYPE           (~0UL)                  /* Private */
 #define AHIST_SAMPLE           (0UL)                   /* 8 or 16 bit sample */
@@ -369,7 +300,6 @@ struct AHIAudioCtrlDrv
 #define AHIST_S16S             (3UL)                   /* Stereo, 16 bit signed (2×WORD) */
 #define AHIST_M32S             (8UL)                   /* Mono, 32 bit signed (LONG) */
 #define AHIST_S32S             (10UL)                  /* Stereo, 32 bit signed (2×LONG) */
-
 #define AHIST_M8U              (4UL)                   /* OBSOLETE! */
 #define AHIST_L7_1             (0x00c3000aUL)          /* 7.1, 32 bit signed (8×LONG) */
 
@@ -394,15 +324,21 @@ struct dssample {
     uae_u32 offset;
 };
 
+struct chsample {
+    int frequency;
+    int volume;
+    int panning;
+    int backwards;
+    struct dssample *ds;
+    int srcplayoffset;
+    int srcplaylen;
+    int stopit;
+};
+
 struct dschannel {
     int num;
-    int frequency, nextfrequency;
-    int volume, nextvolume;
-    int panning, nextpanning;
-    int backwards;
-    struct dssample *ds, *nextds;
-    int srcplayoffset, nextsrcplayoffset;
-    int srcplaylen, nextsrcplaylen;
+    struct chsample cs;
+    struct chsample csnext;
     LPDIRECTSOUNDBUFFER8 dsb;
 
     uae_u8 *buffer;
@@ -600,7 +536,6 @@ static void ds_freechannel (struct DSAHI *ahidsp, struct dschannel *dc)
        IDirectSoundBuffer8_Release (dc->dsb);
     xfree (dc->buffer);
     memset (dc, 0, sizeof (struct dschannel));
-    dc->ds = NULL;
 }
 
 static void ds_free (struct DSAHI *dsahip)
@@ -708,10 +643,10 @@ static int ds_init (struct DSAHI *dsahip)
     fillsupportedmodes (dsahip->DS, default_freq, supportedmodes);
     dsahip->chout = 2;
     if (SUCCEEDED (IDirectSound8_GetSpeakerConfig (dsahip->DS, &speakerconfig))) {
-       if (speakerconfig >= DSSPEAKER_5POINT1) {
+       if (speakerconfig >= DSSPEAKER_CONFIG (DSSPEAKER_5POINT1)) {
            cansurround = 1;
            dsahip->chout = 6;
-           if (speakerconfig >= DSSPEAKER_7POINT1)
+           if (speakerconfig >= DSSPEAKER_CONFIG (DSSPEAKER_7POINT1))
                dsahip->chout = 8;
        }
     }
@@ -721,7 +656,8 @@ static int ds_init (struct DSAHI *dsahip)
     dsahip->channellength = 65536 * dsahip->chout * dsahip->bytespersampleout;
     dsahip->mixlength = 4000 * dsahip->chout * dsahip->bytespersampleout;
     if (ahi_debug)
-       write_log("AHI: CH=%d BLEN=%d MLEN=%d\n", dsahip->chout, dsahip->channellength, dsahip->mixlength);
+       write_log("AHI: CH=%d BLEN=%d MLEN=%d SC=%08x\n",
+           dsahip->chout, dsahip->channellength, dsahip->mixlength, speakerconfig);
 
     memset (&DSCaps, 0, sizeof (DSCaps));
     DSCaps.dwSize = sizeof (DSCaps);
@@ -770,33 +706,33 @@ static void ds_setvolume (struct DSAHI *dsahip, struct dschannel *dc)
     LONG vol, pan;
 
     if (dc->dsb) {
-       if (abs (dc->volume) != abs (dc->nextvolume)) {
-           vol = (LONG)((DSBVOLUME_MIN / 2) + (-DSBVOLUME_MIN / 2) * log (1 + (2.718281828 - 1) * (abs (dc->nextvolume) / 65536.0)));
+       if (abs (dc->cs.volume) != abs (dc->csnext.volume)) {
+           vol = (LONG)((DSBVOLUME_MIN / 2) + (-DSBVOLUME_MIN / 2) * log (1 + (2.718281828 - 1) * (abs (dc->csnext.volume) / 65536.0)));
            hr = IDirectSoundBuffer_SetVolume (dc->dsb, vol);
            if (FAILED (hr))
                write_log ("AHI: SetVolume(%d,%d) failed: %s\n", dc->num, vol, DXError (hr));
        }
-       if (abs (dc->panning) != abs (dc->nextpanning)) {
-           pan = (abs (dc->nextpanning) - 0x8000) * DSBPAN_RIGHT / 32768;
+       if (abs (dc->cs.panning) != abs (dc->csnext.panning)) {
+           pan = (abs (dc->csnext.panning) - 0x8000) * DSBPAN_RIGHT / 32768;
            hr = IDirectSoundBuffer_SetPan (dc->dsb, pan);
            if (FAILED (hr))
                write_log ("AHI: SetPan(%d,%d) failed: %s\n", dc->num, pan, DXError (hr));
        }
     }
-    dc->volume = dc->nextvolume;
-    dc->panning = dc->nextpanning;
+    dc->cs.volume = dc->csnext.volume;
+    dc->cs.panning = dc->csnext.panning;
 }
 
 static void ds_setfreq (struct DSAHI *dsahip, struct dschannel *dc)
 {
     HRESULT hr;
 
-    if (dc->frequency != dc->nextfrequency && dc->nextfrequency > 0 && dc->dsb) {
-       hr = IDirectSoundBuffer8_SetFrequency (dc->dsb, dc->nextfrequency);
+    if (dc->cs.frequency != dc->csnext.frequency && dc->csnext.frequency > 0 && dc->dsb) {
+       hr = IDirectSoundBuffer8_SetFrequency (dc->dsb, dc->csnext.frequency);
        if (FAILED (hr))
-           write_log ("AHI: SetFrequency(%d,%d) failed: %s\n", dc->num, dc->nextfrequency, DXError (hr));
+           write_log ("AHI: SetFrequency(%d,%d) failed: %s\n", dc->num, dc->csnext.frequency, DXError (hr));
     }
-    dc->frequency = dc->nextfrequency;
+    dc->cs.frequency = dc->csnext.frequency;
 }
 
 static int ds_allocchannel (struct DSAHI *dsahip, struct dschannel *dc)
@@ -869,9 +805,9 @@ static int ds_allocchannel (struct DSAHI *dsahip, struct dschannel *dc)
     IDirectSound_Release (pdsb);
     dc->dsb = pdsb8;
 
-    dc->frequency = -1;
-    dc->volume = -1;
-    dc->panning = -1;
+    dc->cs.frequency = -1;
+    dc->cs.volume = -1;
+    dc->cs.panning = -1;
     ds_setvolume (dsahip, dc);
     ds_setfreq (dsahip, dc);
     dc->mixlength = dsahip->mixlength;
@@ -894,7 +830,7 @@ STATIC_INLINE void makexch (struct DSAHI *dsahip, struct dschannel *dc, uae_u8 *
        uae_s16 *dst2 = (uae_u16*)(&dst[idx * och2]);
        l >>= 8;
        r >>= 8;
-       if (dc->volume < 0) {
+       if (dc->cs.volume < 0) {
            l = -l;
            r = -r;
        }
@@ -904,7 +840,7 @@ STATIC_INLINE void makexch (struct DSAHI *dsahip, struct dschannel *dc, uae_u8 *
            return;
        dst2[4] = dst2[0];
        dst2[5] = dst2[1];
-       if (dc->panning < 0) {
+       if (dc->cs.panning < 0) {
            // surround only
            dst2[2] = 0; // center
            dst2[3] = (dst2[0] + dst2[1]) / 4; // lfe
@@ -1193,7 +1129,7 @@ static int ds_copysample (struct DSAHI *dsahip, struct dschannel *dc)
 static int calcdelay (struct dschannel *dc, int len)
 {
     int rate = vblank_hz * maxvpos;
-    int freq = dc->frequency;
+    int freq = dc->cs.frequency;
     int hsyncs = rate * len / freq;
     hsyncs = hsyncs * 2 / 3;
     if (hsyncs > 0)
@@ -1201,18 +1137,19 @@ static int calcdelay (struct dschannel *dc, int len)
     return hsyncs;
 }
 
+#if 0
 static void checkvolfreq (struct DSAHI *dsahip, struct dschannel *dc)
 {
-    if (dc->frequency != dc->nextfrequency)
+    if (dc->cs.frequency != dc->csnext.frequency)
        ds_setfreq (dsahip, dc);
-    if (dc->volume != dc->nextvolume || dc->panning != dc->nextpanning)
+    if (dc->cs.volume != dc->csnext.volume || dc->cs.panning != dc->csnext.panning)
        ds_setvolume (dsahip, dc);
 }
 
 static void getmixbufferlen (struct DSAHI *dsahip, struct dschannel *dc)
 {
     int olen = dc->mixlength;
-    dc->mixlength = (dc->nextfrequency / 24) * dsahip->bytespersampleout * dsahip->chout;
+    dc->mixlength = (dc->csnext.frequency / 24) * dsahip->bytespersampleout * dsahip->chout;
     if (dc->mixlength > dsahip->mixlength)
        dc->mixlength = dsahip->mixlength;
     if (dc->mixlength < 100)
@@ -1240,7 +1177,7 @@ static void copysample (struct DSAHI *dsahip, struct dschannel *dc)
     dstlenbytes = dc->mixlength - dc->buffercursor;
     dstlen = dstlenbytes / chbytesout;
     
-    ds = dc->ds;
+    ds = dc->cs.ds;
     if (ds == NULL) {
        ds = dc->ds = dc->nextds;
        dc->srcplaylen = dc->nextsrcplaylen;
@@ -1336,16 +1273,42 @@ empty:
     dc->buffercursor += dstlenbytes;
     checkvolfreq (dsahip, dc);
 }
+#endif
+
+static void incchannel (struct DSAHI *dsahip, struct dschannel *dc, int samplecnt)
+{
+    struct chsample *cs = &dc->cs;
+
+    if (cs->ds == NULL)
+       return;
+    dc->srcoffset += samplecnt;
+    while (dc->srcoffset >= cs->srcplaylen) {
+       dc->srcoffset -= cs->srcplaylen;
+        setchannelevent (dsahip, dc);
+       if (dc->csnext.stopit) {
+           memset (cs, 0, sizeof (struct chsample));
+           memset (&dc->csnext, 0, sizeof (struct chsample));
+           dc->srcoffset = 0;
+           return;
+       }
+       if (dc->csnext.ds) {
+           memcpy (cs, &dc->csnext, sizeof (struct chsample));
+           memset (&dc->csnext, 0, sizeof (struct chsample));
+           continue;
+       }
+    }
+}
 
 void ahi_hsync (void)
 {
     struct DSAHI *dsahip = &dsahi[0];
     static int cnt;
-    uae_u32 pbase = get_long (dsahip->audioctrl + ahiac_DriverData);
+    uae_u32 pbase;
     int i, flags;
 
-    if (ahi_paused)
+    if (ahi_paused || !ahi_active)
        return;
+    pbase = get_long (dsahip->audioctrl + ahiac_DriverData);
     if (cnt >= 0)
        cnt--;
     if (cnt < 0) {
@@ -1359,6 +1322,43 @@ void ahi_hsync (void)
     flags = get_long (pbase + pub_ChannelSignalAck);
     for (i = 0; i < UAE_MAXCHANNELS; i++) {
        struct dschannel *dc = &dsahip->channel[i];
+       HRESULT hr;
+       DWORD playc, writec, diff, samplediff;
+
+       if (dc->dsb == NULL)
+           continue;
+       if (dc->dsplaying == 0)
+           continue;
+        hr = IDirectSoundBuffer8_GetCurrentPosition (dc->dsb, &playc, &writec);
+       if (FAILED (hr)) {
+           write_log ("AHI: GetCurrentPosition(%d) failed, %s\n", dc->num, DXError (hr));
+           continue;
+       }
+       if (dc->dscursor >= writec)
+           diff = dc->dscursor - writec;
+       else
+           diff = dsahip->channellength - writec + dc->dscursor;
+       if (diff > dsahip->channellength / 2) {
+           dc->dscursor = writec + dc->mixlength;
+           write_log ("AHI: Resync %d\n", dc->num);
+       }
+
+       if (dc->dscursor < 0) {
+           dc->dscursor = writec;
+           memcpy (&dc->cs, &dc->csnext, sizeof (struct chsample));
+       }
+       samplediff = diff / (dsahip->chout * dsahip->bytespersampleout);
+       incchannel (dsahip, dc, samplediff);
+//     copysample (dsahip, dc, &dc->cs);
+
+
+
+
+       if (diff > dc->mixlength)
+           continue;
+
+
+#if 0
        if (dc->buffer == NULL)
            continue;
        if (dc->hsync > 0) {
@@ -1384,6 +1384,7 @@ void ahi_hsync (void)
                dc->hsync = 100;
            }
        }
+#endif
     }
     put_long (pbase + pub_ChannelSignalAck, flags);
 }
@@ -1436,7 +1437,7 @@ static void ds_play (struct DSAHI *dsahip, struct dschannel *dc)
        return;
     if (dc->dsplaying)
        return;
-    if (dc->frequency == 0)
+    if (dc->cs.frequency == 0)
        return;
     dc->dsplaying = 1;
     if (ahi_debug)
@@ -1804,8 +1805,8 @@ static uae_u32 AHIsub_SetVol (TrapContext *ctx)
        write_log ("AHI: SetVol(%d,%d,%d,%08x,%08x)\n",
            channel, volume, pan, audioctrl, flags);
     if (dc) {
-       dc->nextvolume = volume;
-       dc->nextpanning = pan;
+       dc->csnext.volume = volume;
+       dc->csnext.panning = pan;
        if (flags & AHISF_IMM) {
            ds_setvolume (dsahip, dc);
        }
@@ -1826,7 +1827,7 @@ static uae_u32 AHIsub_SetFreq (TrapContext *ctx)
        write_log ("AHI: SetFreq(%d,%d,%08x,%08x)\n",
            channel, frequency, audioctrl, flags);
     if (dc) {
-       dc->nextfrequency = frequency;
+       dc->csnext.frequency = frequency;
        if (flags & AHISF_IMM) {
            ds_setfreq (dsahip, dc);
            ds_play (dsahip, dc);
@@ -1851,31 +1852,32 @@ static uae_u32 AHIsub_SetSound (TrapContext *ctx)
        write_log ("AHI: SetSound(%d,%d,%08x,%d,%08x,%08x)\n",
            channel, sound, offset, length, audioctrl, flags);
     if (dc == NULL)
-       return 0;
+       return AHIE_UNKNOWN;
+    if (ds->num < 0)
+       return AHIE_UNKNOWN;
     if (sound == 0xffff) {
        if (flags & AHISF_IMM) {
-           dc->ds = NULL;
-           dc->nextds = NULL;
+           dc->cs.ds = NULL;
+           dc->csnext.ds = NULL;
        }
-       dc->nextsrcplaylen = -1;
+       dc->csnext.srcplaylen = -1;
        return 0;
     }
     ds_allocchannel (dsahip, dc);
-    dc->backwards = length < 0;
+    dc->cs.backwards = length < 0;
     length = abs (length);
     if (length == 0)
         length = ds->len;
     if (length > ds->len)
        length = ds->len;
-    dc->nextds = ds;
-    dc->nextsrcplaylen = length;
-    dc->nextsrcplayoffset = offset;
+    dc->csnext.ds = ds;
+    dc->csnext.srcplaylen = length;
+    dc->csnext.srcplayoffset = offset;
     if (flags & AHISF_IMM)
-       dc->ds = NULL;
-    if (dc->ds == NULL) {
+       dc->cs.ds = NULL;
+    if (dc->cs.ds == NULL) {
        dc->buffercursor = 0;
        dc->hsync = 0;
-       getmixbufferlen (dsahip, dc);
     }
     ds_setfreq (dsahip, dc);
     ds_setvolume (dsahip, dc);
@@ -1992,6 +1994,7 @@ static uae_u32 AHIsub_UnloadSound (TrapContext *ctx)
     if (ahi_debug)
        write_log ("AHI: UnloadSound(%d,%08x)\n",
            sound, audioctrl);
+    ds->num = -1;
     return AHIE_OK;
 }
 
index c626132ddc1f587dfbb006a11ee30089c8a4c374..402baf77db49c301185fe3656f8b8fa7bcee3c53 100755 (executable)
@@ -359,11 +359,20 @@ int reginitializeinit (const char *ppath)
     char path[MAX_DPATH], fpath[MAX_PATH];
 
     if (!ppath) {
+       int ok = 0;
        char *posn;
        strcpy (path, _pgmptr);
-       if((posn = strrchr (path, '\\')))
-           posn[1] = 0;
-       strcat (path, "winuae.ini");
+       if (strlen (path) > 4 && !stricmp (path + strlen (path) - 4, ".exe")) {
+           strcpy (path + strlen (path) - 3, "ini");
+           if (GetFileAttributes (path) != INVALID_FILE_ATTRIBUTES)
+               ok = 1;
+       }
+       if (!ok) {
+           strcpy (path, _pgmptr);
+           if((posn = strrchr (path, '\\')))
+               posn[1] = 0;
+           strcat (path, "winuae.ini");
+       }
        if (GetFileAttributes (path) == INVALID_FILE_ATTRIBUTES)
            return 0;
     } else {
index b4a0fa1b06cff9212ba6c3e46566b0c50e5b3b34..b6a13ab545a663aa29043d4c93b1f9c9ab357e81 100755 (executable)
@@ -327,13 +327,25 @@ static void setcursor(int oldx, int oldy)
 }
 
 static int pausemouseactive;
-void resumepaused (void)
+void resumesoundpaused (void)
 {
     resume_sound ();
 #ifdef AHI
     ahi_open_sound ();
     ahi2_pause_sound (0);
 #endif
+}
+void setsoundpaused (void)
+{
+    pause_sound ();
+#ifdef AHI
+    ahi_close_sound ();
+    ahi2_pause_sound (1);
+#endif
+}
+void resumepaused (void)
+{
+    resumesoundpaused ();
 #ifdef CD32
     akiko_exitgui ();
 #endif
@@ -348,15 +360,10 @@ void resumepaused (void)
     rp_pause (pause_emulation);
 #endif
 }
-
 void setpaused (void)
 {
     pause_emulation = TRUE;
-    pause_sound ();
-#ifdef AHI
-    ahi_close_sound ();
-    ahi2_pause_sound (1);
-#endif
+    setsoundpaused ();
 #ifdef CD32
     akiko_entergui ();
 #endif
@@ -519,7 +526,7 @@ static void winuae_active (HWND hWnd, int minimized)
 {
     struct threadpriorities *pri;
 
-    write_log ("winuae_active(%d)\n", minimized);
+//    write_log ("winuae_active(%d)\n", minimized);
     /* without this returning from hibernate-mode causes wrong timing
      */
     timeend ();
@@ -538,7 +545,10 @@ static void winuae_active (HWND hWnd, int minimized)
         clear_inhibit_frame (IHF_WINDOWHIDDEN);
     }
     if (sound_closed) {
-       resumepaused ();
+       if (sound_closed < 0)
+           resumesoundpaused ();
+       else
+           resumepaused ();
        sound_closed = 0;
     }
     if (WIN32GFX_IsPicassoScreen ())
@@ -561,7 +571,7 @@ static void winuae_inactive (HWND hWnd, int minimized)
     struct threadpriorities *pri;
     int wasfocus = focus;
 
-    write_log ("winuae_inactive(%d)\n", minimized);
+//    write_log ("winuae_inactive(%d)\n", minimized);
     if (minimized)
        exit_gui (0);
     focus = 0;
@@ -572,22 +582,23 @@ static void winuae_inactive (HWND hWnd, int minimized)
     if (!quit_program) {
        if (minimized) {
            pri = &priorities[currprefs.win32_iconified_priority];
-           if (currprefs.win32_iconified_nosound) {
-               setpaused ();
+           if (currprefs.win32_iconified_pause) {
+               setpaused ();
                sound_closed = 1;
+           } else if (currprefs.win32_iconified_nosound) {
+               setsoundpaused ();
+               sound_closed = -1;
            }
            if (!avioutput_video) {
                set_inhibit_frame (IHF_WINDOWHIDDEN);
            }
-           if (currprefs.win32_iconified_pause) {
-               if (!sound_closed)
-                   setpaused ();
-               sound_closed = 1;
-           }
        } else {
-           if (currprefs.win32_inactive_nosound) {
+           if (currprefs.win32_inactive_pause) {
                setpaused ();
                sound_closed = 1;
+           } else if (currprefs.win32_inactive_nosound) {
+               setsoundpaused ();
+               sound_closed = -1;
            }
        }
     }
index d9cb29d70d0938c898da925ba1c91fc2a8499d26..fa3d9dde4a4eeba4535c74f6cdeae49de42d48e2 100755 (executable)
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 6
+#define WINUAEBETA 7
 #define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2008, 7, 17)
+#define WINUAEDATE MAKEBD(2008, 7, 24)
 #define WINUAEEXTRA ""
 #define WINUAEREV ""
 
index f8383106d6376fdb99ddb9225bcc0fd6cf7a3afc..7dc9e95eabc64f36352514f627155ef5c925351a 100755 (executable)
@@ -143,8 +143,7 @@ void S2X_configure (int rb, int gb, int bb, int rs, int gs, int bs)
 
 void S2X_free (void)
 {
-    if (currprefs.leds_on_screen & STATUSLINE_TARGET)
-       changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen & ~STATUSLINE_TARGET;
+    changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen & ~STATUSLINE_TARGET;
 
     freesurface (tempsurf);
     tempsurf = 0;
@@ -160,8 +159,7 @@ void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd)
     int res_shift;
 
     S2X_free ();
-    if (currprefs.leds_on_screen & STATUSLINE_CHIPSET)
-       changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen | STATUSLINE_TARGET;
+    changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen | STATUSLINE_TARGET;
 
     if (dd == 32)
        alloc_colors_rgb (8, 8, 8, 16, 8, 0, 0, 0, 0, 0, rc, gc, bc);
index 9d6480a7a14ba436b5f5681c6cc482d85e4e3bf1..0fcdf4229952480c23ea9ac960527b49532fc3ff 100755 (executable)
@@ -260,17 +260,33 @@ static int set_ddraw_2 (void)
 
     if (dxfullscreen)  {
        for (;;) {
+           int i, j, got = FALSE;
            HRESULT olderr;
+           struct MultiDisplay *md = getdisplay (&currprefs);
+           for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+               struct PicassoResolution *pr = &md->DisplayModes[i];
+               if (pr->res.width == width && pr->res.height == height) {
+                   for (j = 0; pr->refresh[j] > 0; j++) {
+                       if (pr->refresh[j] == freq)
+                           got = TRUE;
+                   }
+                   break;
+               }
+           }
+           if (got == FALSE)
+               freq = 0;
            write_log ("set_ddraw: trying %dx%d, bits=%d, refreshrate=%d\n", width, height, bits, freq);
            ddrval = DirectDraw_SetDisplayMode (width, height, bits, freq);
            if (SUCCEEDED (ddrval))
                break;
            olderr = ddrval;
-           write_log ("set_ddraw: failed, trying without forced refresh rate\n");
-           DirectDraw_SetCooperativeLevel (hAmigaWnd, dxfullscreen, TRUE);
-           ddrval = DirectDraw_SetDisplayMode (width, height, bits, 0);
-           if (SUCCEEDED (ddrval))
-               break;
+           if (freq) {
+               write_log ("set_ddraw: failed, trying without forced refresh rate\n");
+               DirectDraw_SetCooperativeLevel (hAmigaWnd, dxfullscreen, TRUE);
+               ddrval = DirectDraw_SetDisplayMode (width, height, bits, 0);
+               if (SUCCEEDED (ddrval))
+                   break;
+           }
            if (olderr != DDERR_INVALIDMODE  && olderr != 0x80004001 && olderr != DDERR_UNSUPPORTEDMODE)
                goto oops;
            return -1;
@@ -2148,6 +2164,7 @@ static BOOL doInit (void)
     init_colors ();
 
 #if defined (GFXFILTER)
+    S2X_free ();
     if ((currentmode->flags & DM_SWSCALE) && !WIN32GFX_IsPicassoScreen ()) {
        S2X_init (currentmode->native_width, currentmode->native_height,
            currentmode->amiga_width, currentmode->amiga_height,
index 79918e5a9c65cf791ab011125f5cce8c16e44733..4c389a062d7669830a4131980df157e5d376df4c 100755 (executable)
@@ -2047,7 +2047,7 @@ static struct ConfigStruct *readconfigcache (const char *path)
            lines = filelines;
            p = strrchr (dirpath, dirsep);
            if (p)
-               *p = 0;
+               p[0] = 0;
            else
                dirpath[0] = 0;
        }
@@ -2106,6 +2106,11 @@ static struct ConfigStruct *readconfigcache (const char *path)
            }
        }
 
+       if (strlen (cs->Path) > 0 && !dirmode) {
+           strcat (cs->Path, "\\");
+           strcat (cs->Fullpath, "\\");
+       }
+
        if (!dirmode) {
            fgetsx (cs->HardwareLink, zcache);
            lines--;
index d4e4446a9d05704c219f069ddcc4a3741d07c71b..f0818228c4b2bf05b315f98c378083eecbd29ed1 100755 (executable)
@@ -1,4 +1,25 @@
 
+Beta 7:
+
+- PCMCIA SRAM can work as a memory expansion now (it was not possible
+  to execute 68K code in emulated SRAM previously..)
+- configuration files in subdirectories didn't load if configuration
+  cache was enabled
+- "refresh rates in parenthesis" handling fixed
+- on-screen leds do not disappear when switching filters
+- enable ini-mode if <name of winuae.exe>.ini (without .exe) is found
+  (previously winuae.ini was always used)
+- logic analyzer copper timing updates (thanks to yaqube for test
+  program) Not 100% correct yet, there seems to be unknown 2 cycle
+  offset between bitplane dma and copper, and also seems to break
+  Leander's right border (as I expected, something always breaks as
+  long as it isn't 100% full fix)
+- background color changes on very right edge of screen are now
+  visible
+- stop sound while inactive or minimized paused emulation
+- directory filesystem statefile restore didn't work without
+  restarting emulation
+
 Beta 6:
 
 - RAM limit update in previous beta wasn't working..