]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1540b4.zip
authorToni Wilen <twilen@winuae.net>
Sat, 6 Dec 2008 10:26:28 +0000 (12:26 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:44:03 +0000 (21:44 +0200)
23 files changed:
blitter.c
cfgfile.c
custom.c
debug.c
disk.c
enforcer.c
expansion.c
gencpu.c
gfxutil.c
hardfile.c
include/blitter.h
include/debug.h
include/options.h
inputdevice.c
memory.c
od-win32/ahidsound_new.c
od-win32/dxwrap.c
od-win32/hardfile_win32.c
od-win32/picasso96_win.c
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/winuaechangelog.txt

index 80be495d1eb9793bb4b8c289961c0dedcca60833..0cf1d5cd6e5ceec4351a6a572a3b6a5349ba3968 100755 (executable)
--- a/blitter.c
+++ b/blitter.c
@@ -33,7 +33,6 @@ static int blitter_cycle_exact;
 uae_u16 bltcon0, bltcon1;
 uae_u32 bltapt, bltbpt, bltcpt, bltdpt;
 
-int blinea_shift;
 static uae_u16 blinea, blineb;
 static int blitline, blitfc, blitfill, blitife, blitsing, blitdesc;
 static int blitonedot, blitsign;
@@ -497,16 +496,16 @@ STATIC_INLINE void blitter_write (void)
 
 STATIC_INLINE void blitter_line_incx (void)
 {
-    if (++blinea_shift == 16) {
-       blinea_shift = 0;
+    if (++blt_info.blitashift == 16) {
+       blt_info.blitashift = 0;
        bltcpt += 2;
     }
 }
 
 STATIC_INLINE void blitter_line_decx (void)
 {
-    if (blinea_shift-- == 0) {
-       blinea_shift = 15;
+    if (blt_info.blitashift-- == 0) {
+       blt_info.blitashift = 15;
        bltcpt -= 2;
     }
 }
@@ -525,7 +524,7 @@ STATIC_INLINE void blitter_line_incy (void)
 
 static void blitter_line (void)
 {
-    uae_u16 blitahold = (blinea & blt_info.bltafwm) >> blinea_shift;
+    uae_u16 blitahold = (blinea & blt_info.bltafwm) >> blt_info.blitashift;
     uae_u16 blitbhold = blineb & 1 ? 0xFFFF : 0;
     uae_u16 blitchold = blt_info.bltcdat;
 
@@ -1089,6 +1088,17 @@ void do_blitter (int hpos)
        return;
     }
 
+#if 0
+    if (M68K_GETPC >= 0x00070554 && M68K_GETPC <= 0x000706B0) {
+       blitter_done ();
+       return;
+    }
+    if (M68K_GETPC >= 0x00070838) {
+       blitter_done ();
+       return;
+    }
+#endif
+
     if (dmaen (DMA_BLITTER))
        bltstate = BLT_work;
 
index 71e1805dc904b078d414bf6e75d631378018b8bf..3e2ba19e199c5ad7b1a5a4c8072cdd07266142d7 100755 (executable)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -2949,6 +2949,7 @@ void default_prefs (struct uae_prefs *p, int type)
     p->gfx_max_horizontal = RES_HIRES;
     p->gfx_max_vertical = 1;
     p->color_mode = 2;
+    p->gfx_blackerthanblack = 0;
 
     p->x11_use_low_bandwidth = 0;
     p->x11_use_mitshm = 0;
index b49574c94e74b5847a22480c95c3ceb55b920d38..be9cb41ed537a861b901931022dd07c1b97d4271 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -3130,9 +3130,9 @@ static int isehb (uae_u16 bplcon0, uae_u16 bplcon2)
     if (currprefs.chipset_mask & CSMASK_AGA)
        bplehb = (bplcon0 & 0x7010) == 0x6000 && !(bplcon2 & 0x200);
     else if (currprefs.chipset_mask & CSMASK_ECS_DENISE)
-       bplehb = (bplcon0 & 0xFC00) == 0x6000 && !(bplcon2 & 0x200);
+       bplehb = ((bplcon0 & 0xFC00) == 0x6000 || (bplcon0 & 0xFC00) == 0x7000) && !(bplcon2 & 0x200);
     else
-       bplehb = (bplcon0 & 0xFC00) == 0x6000 && !currprefs.cs_denisenoehb;
+       bplehb = ((bplcon0 & 0xFC00) == 0x6000 || (bplcon0 & 0xFC00) == 0x7000) && !currprefs.cs_denisenoehb;
     return bplehb;
 }
 static void BPLCON0 (int hpos, uae_u16 v)
@@ -3403,7 +3403,7 @@ static void FNULL (uae_u16 v)
 
 static void BLTADAT (uae_u16 v)
 {
-    maybe_blit (current_hpos(), 0);
+    maybe_blit (current_hpos (), 0);
 
     blt_info.bltadat = v;
 }
@@ -3414,7 +3414,7 @@ static void BLTADAT (uae_u16 v)
  */
 static void BLTBDAT (uae_u16 v)
 {
-    maybe_blit (current_hpos(), 0);
+    maybe_blit (current_hpos (), 0);
 
     if (bltcon1 & 2)
        blt_info.bltbhold = v << (bltcon1 >> 12);
@@ -3422,40 +3422,40 @@ static void BLTBDAT (uae_u16 v)
        blt_info.bltbhold = v >> (bltcon1 >> 12);
     blt_info.bltbdat = v;
 }
-static void BLTCDAT (uae_u16 v) { maybe_blit (current_hpos(), 0); blt_info.bltcdat = v; reset_blit (0); }
+static void BLTCDAT (uae_u16 v) { maybe_blit (current_hpos (), 0); blt_info.bltcdat = v; reset_blit (0); }
 
-static void BLTAMOD (uae_u16 v) { maybe_blit (current_hpos(), 1); blt_info.bltamod = (uae_s16)(v & 0xFFFE); reset_blit (0); }
-static void BLTBMOD (uae_u16 v) { maybe_blit (current_hpos(), 1); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); reset_blit (0); }
-static void BLTCMOD (uae_u16 v) { maybe_blit (current_hpos(), 1); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); reset_blit (0); }
-static void BLTDMOD (uae_u16 v) { maybe_blit (current_hpos(), 1); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); reset_blit (0); }
+static void BLTAMOD (uae_u16 v) { maybe_blit (current_hpos (), 1); blt_info.bltamod = (uae_s16)(v & 0xFFFE); reset_blit (0); }
+static void BLTBMOD (uae_u16 v) { maybe_blit (current_hpos (), 1); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); reset_blit (0); }
+static void BLTCMOD (uae_u16 v) { maybe_blit (current_hpos (), 1); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); reset_blit (0); }
+static void BLTDMOD (uae_u16 v) { maybe_blit (current_hpos (), 1); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); reset_blit (0); }
 
-static void BLTCON0 (uae_u16 v) { maybe_blit (current_hpos(), 2); bltcon0 = v; blinea_shift = v >> 12; reset_blit (1); }
+static void BLTCON0 (uae_u16 v) { maybe_blit (current_hpos(), 2); bltcon0 = v; reset_blit (1); }
 /* The next category is "Most useless hardware register".
  * And the winner is... */
 static void BLTCON0L (uae_u16 v)
 {
     if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS))
        return;
-    maybe_blit (current_hpos(), 2); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF);
+    maybe_blit (current_hpos (), 2); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF);
     reset_blit (1);
 }
-static void BLTCON1 (uae_u16 v) { maybe_blit (current_hpos(), 2); bltcon1 = v; reset_blit (2); }
+static void BLTCON1 (uae_u16 v) { maybe_blit (current_hpos (), 2); bltcon1 = v; reset_blit (2); }
 
-static void BLTAFWM (uae_u16 v) { maybe_blit (current_hpos(), 2); blt_info.bltafwm = v; reset_blit (0); }
-static void BLTALWM (uae_u16 v) { maybe_blit (current_hpos(), 2); blt_info.bltalwm = v; reset_blit (0); }
+static void BLTAFWM (uae_u16 v) { maybe_blit (current_hpos (), 2); blt_info.bltafwm = v; reset_blit (0); }
+static void BLTALWM (uae_u16 v) { maybe_blit (current_hpos (), 2); blt_info.bltalwm = v; reset_blit (0); }
 
-static void BLTAPTH (uae_u16 v) { maybe_blit (current_hpos(), 0); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); }
-static void BLTAPTL (uae_u16 v) { maybe_blit (current_hpos(), 0); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); }
-static void BLTBPTH (uae_u16 v) { maybe_blit (current_hpos(), 0); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); }
-static void BLTBPTL (uae_u16 v) { maybe_blit (current_hpos(), 0); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); }
-static void BLTCPTH (uae_u16 v) { maybe_blit (current_hpos(), 0); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); }
-static void BLTCPTL (uae_u16 v) { maybe_blit (current_hpos(), 0); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); }
-static void BLTDPTH (uae_u16 v) { maybe_blit (current_hpos(), 0); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); }
-static void BLTDPTL (uae_u16 v) { maybe_blit (current_hpos(), 0); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); }
+static void BLTAPTH (uae_u16 v) { maybe_blit (current_hpos (), 0); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); }
+static void BLTAPTL (uae_u16 v) { maybe_blit (current_hpos (), 0); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); }
+static void BLTBPTH (uae_u16 v) { maybe_blit (current_hpos (), 0); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); }
+static void BLTBPTL (uae_u16 v) { maybe_blit (current_hpos (), 0); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); }
+static void BLTCPTH (uae_u16 v) { maybe_blit (current_hpos (), 0); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); }
+static void BLTCPTL (uae_u16 v) { maybe_blit (current_hpos (), 0); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); }
+static void BLTDPTH (uae_u16 v) { maybe_blit (current_hpos (), 0); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); }
+static void BLTDPTL (uae_u16 v) { maybe_blit (current_hpos (), 0); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); }
 
 static void BLTSIZE (uae_u16 v)
 {
-    maybe_blit (current_hpos(), 0);
+    maybe_blit (current_hpos (), 0);
 
     blt_info.vblitsize = v >> 6;
     blt_info.hblitsize = v & 0x3F;
@@ -3463,14 +3463,14 @@ static void BLTSIZE (uae_u16 v)
        blt_info.vblitsize = 1024;
     if (!blt_info.hblitsize)
        blt_info.hblitsize = 64;
-    do_blitter (current_hpos());
+    do_blitter (current_hpos ());
 }
 
 static void BLTSIZV (uae_u16 v)
 {
     if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS))
        return;
-    maybe_blit (current_hpos(), 0);
+    maybe_blit (current_hpos (), 0);
     blt_info.vblitsize = v & 0x7FFF;
 }
 
@@ -3478,13 +3478,13 @@ static void BLTSIZH (uae_u16 v)
 {
     if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS))
        return;
-    maybe_blit (current_hpos(), 0);
+    maybe_blit (current_hpos (), 0);
     blt_info.hblitsize = v & 0x7FF;
     if (!blt_info.vblitsize)
        blt_info.vblitsize = 32768;
     if (!blt_info.hblitsize)
        blt_info.hblitsize = 0x800;
-    do_blitter (current_hpos());
+    do_blitter (current_hpos ());
 }
 
 STATIC_INLINE void spr_arm (int num, int state)
diff --git a/debug.c b/debug.c
index 2056a3d05c91d4ca30c2e7965690414017b7e052..04972c4f650c061df18ad21658c53d62226de588 100755 (executable)
--- a/debug.c
+++ b/debug.c
@@ -795,7 +795,7 @@ static uaecptr decode_copperlist (FILE* file, uaecptr address, int nolines)
 {
     uae_u32 insn;
     while (nolines-- > 0) {
-       insn = get_long (address);
+       insn = (chipmem_agnus_wget (address) << 16) | chipmem_agnus_wget (address + 2);
        decode_copper_insn (file, insn, address);
        address += 4;
     }
@@ -1626,41 +1626,61 @@ void debug_lgetpeek (uaecptr addr, uae_u32 v)
     memwatch_func (addr, 1, 4, &vv);
 }
 
-static void deinitialize_memwatch (void)
+struct membank_store
 {
-    int i, as;
-    addrbank *a1, *a2;
+    addrbank *addr;
+    addrbank store;
+};
+
+static struct membank_store *membank_stores;
+
+static int deinitialize_memwatch (void)
+{
+    int i, oldmode;
 
     if (!memwatch_enabled && !mmu_enabled)
-       return;
-    as = currprefs.address_space_24 ? 256 : 65536;
-    for (i = 0; i < as; i++) {
-       a1 = debug_mem_banks[i];
-       a2 = mem_banks[i];
-       memcpy (a2, a1, sizeof (addrbank));
+       return -1;
+    for (i = 0; membank_stores[i].addr; i++) {
+       memcpy (membank_stores[i].addr, &membank_stores[i].store, sizeof (addrbank));
     }
+    oldmode = mmu_enabled ? 1 : 0;
     xfree (debug_mem_banks);
-    debug_mem_banks = 0;
+    debug_mem_banks = NULL;
     xfree (debug_mem_area);
-    debug_mem_area = 0;
+    debug_mem_area = NULL;
+    xfree (membank_stores);
+    membank_stores = NULL;
     memwatch_enabled = 0;
     mmu_enabled = 0;
     xfree (illgdebug);
     illgdebug = 0;
+    return oldmode;
 }
 
 static void initialize_memwatch (int mode)
 {
-    int i, as;
-    addrbank *a1, *a2;
+    int i, j, as;
+    addrbank *a1, *a2, *oa;
 
     deinitialize_memwatch ();
     as = currprefs.address_space_24 ? 256 : 65536;
     debug_mem_banks = xmalloc (sizeof (addrbank*) * as);
     debug_mem_area = xmalloc (sizeof (addrbank) * as);
+    membank_stores = xcalloc (sizeof (struct membank_store), 32);
+    oa = NULL;
     for (i = 0; i < as; i++) {
        a1 = debug_mem_banks[i] = debug_mem_area + i;
        a2 = mem_banks[i];
+       if (a2 != oa) {
+           for (j = 0; membank_stores[j].addr; j++) {
+               if (membank_stores[j].addr == a2)
+                   break;
+           }
+           if (membank_stores[j].addr == NULL) {
+               membank_stores[j].addr = a2;
+               memcpy (&membank_stores[j].store, a2, sizeof (addrbank));
+           }
+       }
        memcpy (a1, a2, sizeof (addrbank));
     }
     for (i = 0; i < as; i++) {
@@ -1682,6 +1702,19 @@ static void initialize_memwatch (int mode)
        memwatch_enabled = 1;
 }
 
+int debug_bankchange (int mode)
+{
+    if (mode == -1) {
+       int v = deinitialize_memwatch ();
+       if (v < 0)
+           return -2;
+       return v;
+    }
+    if (mode >= 0)
+       initialize_memwatch (mode);
+    return -1;
+}
+
 void memwatch_dump2 (char *buf, int bufsize, int num)
 {
     int i;
diff --git a/disk.c b/disk.c
index cb1a2ca4e9732b4b431bd3d8e23ed3af6c1ff3d3..18b9adbc1a4d8d1f0c12201ef3911024767937fc 100755 (executable)
--- a/disk.c
+++ b/disk.c
@@ -983,26 +983,29 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char
        }
        drv->useturbo = 1;
 
-    } else if (size == 720 * 1024 || size == 1440 * 1024 || size == 800 * 1024 || size == 1600 * 1024) {
+    } else if (
+       size == 9 * 80 * 2 * 512 || size == 18 * 80 * 2 * 512 || size == 10 * 80 * 2 * 512 || size == 20 * 80 * 2 * 512 ||
+       size == 9 * 81 * 2 * 512 || size == 18 * 81 * 2 * 512 || size == 10 * 81 * 2 * 512 || size == 20 * 81 * 2 * 512 ||
+       size == 9 * 82 * 2 * 512 || size == 18 * 82 * 2 * 512 || size == 10 * 82 * 2 * 512 || size == 20 * 82 * 2 * 512) {
        /* PC formatted image */
        int i;
        
-       if (size == 720 * 1024) {
+       if (       size ==  9 * 80 * 2 * 512 || size ==  9 * 81 * 2 * 512 || size ==  9 * 82 * 2 * 512) {
            drv->num_secs = 9;
            drv->ddhd = 1;
-       } else if (size == 1440 * 1024) {
+       } else if (size == 18 * 80 * 2 * 512 || size == 18 * 81 * 2 * 512 || size == 18 * 82 * 2 * 512) {
            drv->num_secs = 18;
            drv->ddhd = 1;
-       } else if (size == 800 * 1024) {
+       } else if (size == 10 * 80 * 2 * 512 || size == 10 * 81 * 2 * 512 || size == 10 * 82 * 2 * 512) {
            drv->num_secs = 10;
            drv->ddhd = 2;
-       } else if (size == 1600 * 1024) {
+       } else if (size == 20 * 80 * 2 * 512 || size == 20 * 81 * 2 * 512 || size == 20 * 82 * 2 * 512) {
            drv->num_secs = 20;
            drv->ddhd = 2;
        }
+        drv->num_tracks = size / (drv->num_secs * 512);
 
        drv->filetype = ADF_PCDOS;
-       drv->num_tracks = 160;
        for (i = 0; i < drv->num_tracks; i++) {
            tid = &drv->trackdata[i];
            tid->type = TRACK_PCDOS;
index baf95f39ad7bb3d840bd64b3c23048ef5d820988..1c118a0a84458b16de4341cedf21affab2fa6db1 100755 (executable)
@@ -33,6 +33,7 @@
 /* Configurable options */
 #define ENFORCESIZE 1024
 #define STACKLINES 5
+#define BACKTRACELONGS 500
 #define INSTRUCTIONLINES 17
 
 #define ISILLEGAL(addr) (addr < 4 || (addr > 4 && addr < ENFORCESIZE))
@@ -151,7 +152,7 @@ static int enforcer_decode_hunk_and_offset (char *buf, uae_u32 pc)
            while ((address = get_long (seg_entry))) {
                size = get_long (seg_entry + 4);
 
-               if (pc >= address && pc < address + size) {
+               if (pc > address && pc < address + size) {
                    uae_u32 name, offset;
                    uae_u8 *native_name;
 
@@ -254,7 +255,7 @@ static void enforcer_display_hit (const char *addressmode, uae_u32 pc, uaecptr a
        }
     }
 
-    for (i = 0; i < 8 * STACKLINES; i++) {
+    for (i = 0; i < BACKTRACELONGS; i++) {
        a7 += 4;
        if (enforcer_decode_hunk_and_offset (buf, get_long (a7))) {
            int l = strlen (buf);
index ad720ab47bb866aebe398b294f0c90f77b295d79..9ab5e7834c4f0d6ffad0a9b6df508e2fa55ef55b 100755 (executable)
@@ -1192,7 +1192,6 @@ static void allocate_expamem (void)
 
 static uaecptr check_boot_rom (void)
 {
-    int i;
     uaecptr b = RTAREA_DEFAULT;
     addrbank *ab;
 
index 812cba63aa79475856dd31b99710bda3b76219a9..68bf72387a317a18d948b8a692611ddd358698e6 100755 (executable)
--- a/gencpu.c
+++ b/gencpu.c
@@ -2515,7 +2515,7 @@ static void gen_opcode (unsigned long int opcode)
        printf ("\tuae_u32 carry = val & 1;\n");
        printf ("\tval >>= 1;\n");
        genflags (flag_logical, curi->size, "val", "", "");
-       printf ("SET_CFLG (&regs->ccrflags, carry);\n");
+       printf ("\tSET_CFLG (&regs->ccrflags, carry);\n");
        duplicate_carry (0);
        genastore ("val", curi->smode, "srcreg", curi->size, "data");
        break;
@@ -2532,7 +2532,7 @@ static void gen_opcode (unsigned long int opcode)
        printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size));
        printf ("\tval <<= 1;\n");
        genflags (flag_logical, curi->size, "val", "", "");
-       printf ("SET_CFLG (&regs->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
+       printf ("\tSET_CFLG (&regs->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
        duplicate_carry (0);
        genastore ("val", curi->smode, "srcreg", curi->size, "data");
        break;
@@ -2550,7 +2550,7 @@ static void gen_opcode (unsigned long int opcode)
        printf ("\tval <<= 1;\n");
        printf ("\tif (carry)  val |= 1;\n");
        genflags (flag_logical, curi->size, "val", "", "");
-       printf ("SET_CFLG (&regs->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
+       printf ("\tSET_CFLG (&regs->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
        genastore ("val", curi->smode, "srcreg", curi->size, "data");
        break;
     case i_RORW:
@@ -2567,7 +2567,7 @@ static void gen_opcode (unsigned long int opcode)
        printf ("\tval >>= 1;\n");
        printf ("\tif (carry) val |= %s;\n", cmask (curi->size));
        genflags (flag_logical, curi->size, "val", "", "");
-       printf ("SET_CFLG (&regs->ccrflags, carry);\n");
+       printf ("\tSET_CFLG (&regs->ccrflags, carry);\n");
        genastore ("val", curi->smode, "srcreg", curi->size, "data");
        break;
     case i_ROXLW:
@@ -2584,7 +2584,7 @@ static void gen_opcode (unsigned long int opcode)
        printf ("\tval <<= 1;\n");
        printf ("\tif (GET_XFLG (&regs->ccrflags)) val |= 1;\n");
        genflags (flag_logical, curi->size, "val", "", "");
-       printf ("SET_CFLG (&regs->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
+       printf ("\tSET_CFLG (&regs->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
        duplicate_carry (0);
        genastore ("val", curi->smode, "srcreg", curi->size, "data");
        break;
@@ -2602,7 +2602,7 @@ static void gen_opcode (unsigned long int opcode)
        printf ("\tval >>= 1;\n");
        printf ("\tif (GET_XFLG (&regs->ccrflags)) val |= %s;\n", cmask (curi->size));
        genflags (flag_logical, curi->size, "val", "", "");
-       printf ("SET_CFLG (&regs->ccrflags, carry);\n");
+       printf ("\tSET_CFLG (&regs->ccrflags, carry);\n");
        duplicate_carry (0);
        genastore ("val", curi->smode, "srcreg", curi->size, "data");
        break;
index 3ff46c0719500f4e1b677db067b6645ffbfeb228..c8b344ff2ef1e7ba1db96b36cc9b7138f1598168 100755 (executable)
--- a/gfxutil.c
+++ b/gfxutil.c
@@ -289,7 +289,15 @@ void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, i
     int bpp = rw + gw + bw + aw;
     int i;
     for(i = 0; i < 256; i++) {
-       int j = i + 256;
+       int j;
+
+       if (currprefs.gfx_blackerthanblack) {
+           j = i * 15 / 16 + 15;
+       } else {  
+           j = i;
+       }
+       j += 256;
+
        rc[i] = doColor (gamma[j], rw, rs) | doAlpha (alpha, aw, as);
        gc[i] = doColor (gamma[j], gw, gs) | doAlpha (alpha, aw, as);
        bc[i] = doColor (gamma[j], bw, bs) | doAlpha (alpha, aw, as);
index 099f66be843ceefdff86e6c28165e975f82a22a8..9a7d12f42b4616e391ab6022e9532ccb1cdf671f 100755 (executable)
@@ -357,7 +357,7 @@ int hdf_open (struct hardfiledata *hfd, const char *pname)
     if (!hdf_open_target (hfd, pname))
        return 0;
     if (hdf_read_target (hfd, tmp, 0, 512) != 512)
-       goto end;
+       goto nonvhd;
     v = gl (tmp + 8); // features
     if ((v & 3) != 2)
        goto nonvhd;
index 36fd4c1b63423c9b8fa9c77eddec696d5cc34cc5..b8688578325e3fe7dbb66d14f685ce7bfe4da302 100755 (executable)
@@ -8,10 +8,11 @@
 
 struct bltinfo {
     int blitzero;
-    int blitashift,blitbshift,blitdownashift,blitdownbshift;
-    uae_u16 bltadat, bltbdat, bltcdat,bltddat,bltahold,bltbhold,bltafwm,bltalwm;
-    int vblitsize,hblitsize;
-    int bltamod,bltbmod,bltcmod,bltdmod;
+    int blitashift, blitbshift, blitdownashift, blitdownbshift;
+    uae_u16 bltadat, bltbdat, bltcdat, bltddat;
+    uae_u16 bltahold, bltbhold, bltafwm, bltalwm;
+    int vblitsize, hblitsize;
+    int bltamod, bltbmod, bltcmod, bltdmod;
     int got_cycle;
 };
 
@@ -22,9 +23,8 @@ extern enum blitter_states {
 extern struct bltinfo blt_info;
 
 extern uae_u16 bltsize;
-extern uae_u16 bltcon0,bltcon1;
-extern int blinea_shift;
-extern uae_u32 bltapt,bltbpt,bltcpt,bltdpt;
+extern uae_u16 bltcon0, bltcon1;
+extern uae_u32 bltapt, bltbpt, bltcpt, bltdpt;
 extern int blit_singlechannel;
 
 extern void maybe_blit (int, int);
index 623f8e9e594d18798875ed06c1e89798580f7208..99f8ac5e588aa70b294bfe363055a68f02f866e2 100755 (executable)
@@ -34,6 +34,7 @@ extern void debug_help (void);
 extern uaecptr dumpmem2 (uaecptr addr, char *out, int osize);
 extern void update_debug_info (void);
 extern int instruction_breakpoint (char **c);
+extern int debug_bankchange (int);
 
 #define BREAKPOINT_TOTAL 8
 struct breakpoint_node {
index a6a7722164947348616dcf6fc28beed94411f319..cee0059aa9584b00d4e5300d161a40d7d0691971 100755 (executable)
@@ -170,6 +170,7 @@ struct uae_prefs {
     int gfx_xcenter_size, gfx_ycenter_size;
     int gfx_max_horizontal, gfx_max_vertical;
     int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma;
+    int gfx_blackerthanblack;
     int color_mode;
 
     int gfx_filter;
index 07709a36affa40ec808b14641fba873e90eb4200..f2538af459cbe1a40d69607dee58ef8f6baf49d8 100755 (executable)
@@ -1038,11 +1038,37 @@ int getbuttonstate (int joy, int button)
     return v;
 }
 
-static void mouseupdate (int pct)
+static int getvelocity (int num, int subnum, int pct)
+{
+    int val;
+    int v;
+
+    val = mouse_delta[num][subnum];
+    v = val * pct / 1000;
+    if (!v) {
+       if (val < -maxvpos / 2)
+           v = -2;
+       else if (val < 0)
+           v = -1;
+       else if (val > maxvpos / 2)
+           v = 2;
+       else if (val > 0)
+           v = 1;
+    }
+    if (!mouse_deltanoreset[num][subnum])
+       mouse_delta[num][subnum] -= v;
+    return v;
+}
+
+static void mouseupdate (int pct, int vsync)
 {
     int v, i;
+    int max = 127;
+
+    if (pct > 1000)
+       pct = 1000;
 
-    if (pct == 100) {
+    if (vsync) {
        if (mouse_delta[0][0] < 0) {
            if (mouseedge_x > 0)
                mouseedge_x = 0;
@@ -1082,17 +1108,13 @@ static void mouseupdate (int pct)
 
     for (i = 0; i < 2; i++) {
 
-       v = mouse_delta[i][0] * pct / 100;
+       v = getvelocity (i, 0, pct);
        mouse_x[i] += v;
-       if (!mouse_deltanoreset[i][0])
-           mouse_delta[i][0] -= v;
 
-       v = mouse_delta[i][1] * pct / 100;
+       v = getvelocity (i, 1, pct);
        mouse_y[i] += v;
-       if (!mouse_deltanoreset[i][1])
-           mouse_delta[i][1] -= v;
 
-       v = mouse_delta[i][2] * pct / 100;
+       v = getvelocity (i, 2, pct);
        if (v > 0)
            record_key (0x7a << 1);
        else if (v < 0)
@@ -1100,23 +1122,17 @@ static void mouseupdate (int pct)
        if (!mouse_deltanoreset[i][2])
            mouse_delta[i][2] = 0;
 
-       if (mouse_frame_x[i] - mouse_x[i] > 127)
-           mouse_x[i] = mouse_frame_x[i] - 127;
-       if (mouse_frame_x[i] - mouse_x[i] < -127)
-           mouse_x[i] = mouse_frame_x[i] + 127;
-
-       if (mouse_frame_y[i] - mouse_y[i] > 127)
-           mouse_y[i] = mouse_frame_y[i] - 127;
-       if (mouse_frame_y[i] - mouse_y[i] < -127)
-           mouse_y[i] = mouse_frame_y[i] + 127;
-
-       if (pct == 100) {
-           if (!mouse_deltanoreset[i][0])
-               mouse_delta[i][0] = 0;
-           if (!mouse_deltanoreset[i][1])
-               mouse_delta[i][1] = 0;
-           if (!mouse_deltanoreset[i][2])
-               mouse_delta[i][2] = 0;
+       if (mouse_frame_x[i] - mouse_x[i] > max)
+           mouse_x[i] = mouse_frame_x[i] - max;
+       if (mouse_frame_x[i] - mouse_x[i] < -max)
+           mouse_x[i] = mouse_frame_x[i] + max;
+
+       if (mouse_frame_y[i] - mouse_y[i] > max)
+           mouse_y[i] = mouse_frame_y[i] - max;
+       if (mouse_frame_y[i] - mouse_y[i] < -max)
+           mouse_y[i] = mouse_frame_y[i] + max;
+
+       if (!vsync) {
            mouse_frame_x[i] = mouse_x[i];
            mouse_frame_y[i] = mouse_y[i];
        }
@@ -1124,20 +1140,16 @@ static void mouseupdate (int pct)
     }
 }
 
-static int input_read, input_vpos;
+static int input_vpos, input_frame;
 extern int vpos;
 static void readinput (void)
 {
-    if (!input_read && (vpos & ~31) != (input_vpos & ~31)) {
-       idev[IDTYPE_JOYSTICK].read ();
-       idev[IDTYPE_MOUSE].read ();
-       mouseupdate ((vpos - input_vpos) * 100 / maxvpos);
-       input_vpos = vpos;
-    }
-    if (input_read) {
-       input_vpos = vpos;
-       input_read = 0;
-    }
+    uae_u32 totalvpos;
+
+    totalvpos = input_frame * maxvpos + vpos;
+    mouseupdate ((totalvpos - input_vpos) * 1000 / maxvpos, 0);
+    input_vpos = totalvpos;
+
 }
 
 int getjoystate (int joy)
@@ -1146,7 +1158,7 @@ int getjoystate (int joy)
     uae_u16 v = 0;
 
     if (inputdevice_logging & 2)
-       write_log ("JOY%dDAT %x\n", joy, m68k_getpc (&regs));
+       write_log ("JOY%dDAT %08x\n", joy, M68K_GETPC);
     readinput ();
     if (joydir[joy] & DIR_LEFT)
        left = 1;
@@ -2029,11 +2041,13 @@ void inputdevice_vsync (void)
            }
        }
     }
-    mouseupdate (100);
-    inputdelay = uaerand () % (maxvpos <= 1 ? 1 : maxvpos - 1);
+
+    input_frame++;
+    mouseupdate (0, 1);
     idev[IDTYPE_MOUSE].read ();
-    input_read = 1;
-    input_vpos = 0;
+    idev[IDTYPE_JOYSTICK].read ();
+    inputdelay = uaerand () % (maxvpos <= 1 ? 1 : maxvpos - 1);
     inputdevice_handle_inputcode ();
     if (ievent_alive > 0)
        ievent_alive--;
index 23d46859ccd4135aba6e3a4bffca8954c32224f8..94c38010bf747a29fb4c583626d303bed00837ac 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -45,11 +45,8 @@ static int isdirectjit (void)
 
 static int canjit (void)
 {
-#if 0
-    if (currprefs.cpu_model >= 68020)
-       return 1;
-    return 0;
-#endif
+    if (currprefs.cpu_model < 68020 && currprefs.address_space_24)
+       return 0;
     return 1;
 }
 
@@ -1081,7 +1078,7 @@ int addr_valid (char *txt, uaecptr addr, uae_u32 len)
     return 1;
 }
 
-uae_u32        chipmem_mask, chipmem_full_mask;
+uae_u32        chipmem_mask, chipmem_full_mask, chipmem_full_size;
 uae_u32 kickmem_mask, extendedkickmem_mask, extendedkickmem2_mask, bogomem_mask;
 uae_u32 a3000lmem_mask, a3000hmem_mask, cardmem_mask;
 
@@ -1448,7 +1445,7 @@ static void REGPARAM2 chipmem_agnus_lput (uaecptr addr, uae_u32 l)
     uae_u32 *m;
 
     addr &= chipmem_full_mask;
-    if (addr >= allocated_chipmem)
+    if (addr >= chipmem_full_size)
        return;
     m = (uae_u32 *)(chipmemory + addr);
     do_put_mem_long (m, l);
@@ -1459,7 +1456,7 @@ void REGPARAM2 chipmem_agnus_wput (uaecptr addr, uae_u32 w)
     uae_u16 *m;
 
     addr &= chipmem_full_mask;
-    if (addr >= allocated_chipmem)
+    if (addr >= chipmem_full_size)
        return;
     m = (uae_u16 *)(chipmemory + addr);
     do_put_mem_word (m, w);
@@ -1468,7 +1465,7 @@ void REGPARAM2 chipmem_agnus_wput (uaecptr addr, uae_u32 w)
 static void REGPARAM2 chipmem_agnus_bput (uaecptr addr, uae_u32 b)
 {
     addr &= chipmem_full_mask;
-    if (addr >= allocated_chipmem)
+    if (addr >= chipmem_full_size)
        return;
     chipmemory[addr] = b;
 }
@@ -1476,7 +1473,7 @@ static void REGPARAM2 chipmem_agnus_bput (uaecptr addr, uae_u32 b)
 static int REGPARAM2 chipmem_check (uaecptr addr, uae_u32 size)
 {
     addr &= chipmem_mask;
-    return (addr + size) <= allocated_chipmem;
+    return (addr + size) <= chipmem_full_size;
 }
 
 static uae_u8 *REGPARAM2 chipmem_xlate (uaecptr addr)
@@ -3119,6 +3116,7 @@ static void allocate_memory (void)
        memsize2 = allocated_bogomem = currprefs.bogomem_size;
        chipmem_mask = allocated_chipmem - 1;
        chipmem_full_mask = allocated_chipmem * 2 - 1;
+       chipmem_full_size = 0x80000 * 2;
        chipmemory = mapped_malloc (memsize1 + memsize2, "chip");
        bogomemory = chipmemory + memsize1;
        bogomem_mask = allocated_bogomem - 1;
@@ -3138,7 +3136,7 @@ static void allocate_memory (void)
        if (currprefs.chipmem_size > 2 * 1024 * 1024)
            free_fastmemory ();
 
-       memsize = allocated_chipmem = currprefs.chipmem_size;
+       memsize = allocated_chipmem = chipmem_full_size = currprefs.chipmem_size;
        chipmem_full_mask = chipmem_mask = allocated_chipmem - 1;
        if (memsize < 0x100000)
            memsize = 0x100000;
@@ -3679,13 +3677,14 @@ void memory_hardreset (void)
 
 void map_banks (addrbank *bank, int start, int size, int realsize)
 {
-    int bnr;
+    int bnr, old;
     unsigned long int hioffs = 0, endhioffs = 0x100;
     addrbank *orgbank = bank;
     uae_u32 realstart = start;
 
     //write_log ("MAP_BANK %04X0000 %d %s\n", start, size, bank->name);
 
+    old = debug_bankchange (-1);
     flush_icache (1); /* Sure don't want to keep any old mappings around! */
 #ifdef NATMEM_OFFSET
     delete_shmmaps (start << 16, size << 16);
@@ -3713,6 +3712,7 @@ void map_banks (addrbank *bank, int start, int size, int realsize)
            put_mem_bank (bnr << 16, bank, realstart << 16);
            real_left--;
        }
+       debug_bankchange (old);
        return;
     }
 #endif
@@ -3735,6 +3735,7 @@ void map_banks (addrbank *bank, int start, int size, int realsize)
            real_left--;
        }
     }
+    debug_bankchange (old);
 }
 
 #ifdef SAVESTATE
index e3b6627919c45d05ea0424d522bdf36dabe4784a..3a0cc98f170a6b204374ee22a79709fa2b14f9b7 100755 (executable)
@@ -1,7 +1,7 @@
 /*
  * UAE - The Un*x Amiga Emulator
  *
- * OpenAL AHI 7.1 wrapper
+ * OpenAL AHI 7.1 "wrapper"
  *
  * Copyright 2008 Toni Wilen
  */
@@ -41,7 +41,7 @@
 
 #define AHI_STRUCT_VERSION 1
 
-static int ahi_debug = 2;
+int ahi_debug = 1;
 
 #define UAE_MAXCHANNELS 24
 #define UAE_MAXSOUNDS 256
@@ -358,6 +358,7 @@ struct dschannel {
     int buffertoggle;
     int maxplaysamples;
     int totalsamples;
+    int waitforack;
 };
 
 struct DSAHI {
@@ -482,21 +483,22 @@ static int sendsignal (struct DSAHI *dsahip)
     return 1;
 }
 
-static void setchannelevent (struct DSAHI *dsahip, struct dschannel *dc)
+static int setchannelevent (struct DSAHI *dsahip, struct dschannel *dc)
 {
     uae_u32 audioctrl = dsahip->audioctrl;
     uae_u32 puaebase = get_long (audioctrl + ahiac_DriverData);
     int ch = dc - &dsahip->channel[0];
     uae_u32 mask;
 
-    if (!dsahip->playing || ahi_paused || !dc->al_source)
-       return;
+    if (!dsahip->playing || ahi_paused || !dc->al_source || !get_long (audioctrl + ahiac_SoundFunc))
+       return 0;
     mask = get_long (puaebase + pub_ChannelSignal);
     if (mask & (1 << ch))
-       return;
+       return 0;
     dc->channelsignal = 1;
     put_long (puaebase + pub_ChannelSignal, mask | (1 << ch));
     sendsignal (dsahip);
+    return 1;
 }
 
 static void evtfunc (uae_u32 v)
@@ -714,7 +716,7 @@ static void ds_setvolume (struct DSAHI *dsahip, struct dschannel *dc)
 {
     if (dc->al_source != -1) {
        if (abs (dc->cs.volume) != abs (dc->csnext.volume)) {
-           float vol = (float)(abs (dc->csnext.volume) / 65536.0);
+           float vol = ((float)(abs (dc->csnext.volume))) / 65536.0;
            alClear ();
            alSourcef (dc->al_source, AL_GAIN, vol);
            alError ("AHI: SetVolume(%d,%d)", dc->num, vol);
@@ -752,7 +754,7 @@ static int ds_allocchannel (struct DSAHI *dsahip, struct dschannel *dc)
     ds_setfreq (dsahip, dc);
     if (ahi_debug)
        write_log ("AHI: allocated OpenAL source for channel %d. vol=%d pan=%d freq=%d\n",
-       dc->num, dc->cs.volume, dc->cs.panning, dc->cs.frequency);
+           dc->num, dc->cs.volume, dc->cs.panning, dc->cs.frequency);
     return 1;
 error:
     ds_freechannel (dsahip, dc);
@@ -993,7 +995,35 @@ static void al_startplay (struct dschannel *dc)
     alError ("AHI: ds_play() alSourcePlay");
 }
 
-static void preparesample (struct DSAHI *dsahip, struct dschannel *dc)
+static void preparesample_single (struct DSAHI *dsahip, struct dschannel *dc)
+{
+    uae_u8 *p, *ps, *pe;
+    struct dssample *ds;
+    int slen, dlen;
+
+    dc->samplecounter = -1;
+    dc->buffertoggle = 0;
+
+    ds = dc->cs.ds;
+    ps = p = get_real_address (ds->addr);
+    pe = ps + ds->len * ds->bytespersample * ds->ch;
+
+    slen = ds->len;
+    p += dc->cs.srcplayoffset * ds->bytespersample * ds->ch;
+    dlen = copysampledata (dsahip, dc, ds, &p, pe, ps, dsahip->tmpbuffer, slen);
+    alClear ();
+    alBufferData (ds->al_buffer[dc->buffertoggle], dsahip->al_bufferformat, dsahip->tmpbuffer, dlen, dc->cs.frequency);
+    alError ("AHI: preparesample_single:alBufferData(len=%d,freq=%d)", dlen, dc->cs.frequency);
+    alClear ();
+    alSourceQueueBuffers (dc->al_source, 1, &ds->al_buffer[dc->buffertoggle]);
+    alError ("AHI: al_initsample_single:alSourceQueueBuffers(freq=%d)", dc->cs.frequency);
+    if (ahi_debug > 2)
+       write_log ("AHI: sample queued %d: %d/%d\n",
+           dc->num, dc->samplecounter, dc->totalsamples);
+}
+
+
+static void preparesample_multi (struct DSAHI *dsahip, struct dschannel *dc)
 {
     uae_u8 *p, *ps, *pe;
     struct dssample *ds;
@@ -1015,7 +1045,7 @@ static void preparesample (struct DSAHI *dsahip, struct dschannel *dc)
     alClear ();
     alSourceQueueBuffers (dc->al_source, 1, &ds->al_buffer[dc->buffertoggle]);
     alError ("AHI: al_initsample:alSourceQueueBuffers(freq=%d)", dc->cs.frequency);
-    if (ahi_debug > 1)
+    if (ahi_debug > 2)
        write_log ("AHI: sample queued %d: %d/%d\n",
            dc->num, dc->samplecounter, dc->totalsamples);
     dc->samplecounter++;
@@ -1025,7 +1055,9 @@ static void preparesample (struct DSAHI *dsahip, struct dschannel *dc)
 /* called when sample is started for the first time */
 static void al_initsample (struct DSAHI *dsahip, struct dschannel *dc)
 {
+    uae_u32 audioctrl = dsahip->audioctrl;
     struct dssample *ds;
+    int single = 0;
 
     alSourceStop (dc->al_source);
     alClear ();
@@ -1034,24 +1066,35 @@ static void al_initsample (struct DSAHI *dsahip, struct dschannel *dc)
 
     memcpy (&dc->cs, &dc->csnext, sizeof (struct chsample));
     dc->csnext.ds = NULL;
+    dc->waitforack = 0;
     ds = dc->cs.ds;
     if (ds == NULL)
        return;
 
-    dc->samplecounter = 0;
-    if (ds->dynamic)
-       dc->maxplaysamples = dsahip->maxplaysamples / 2;
-    else
-       dc->maxplaysamples = ds->len / 2;
-    if (dc->maxplaysamples > dsahip->tmpbuffer_size)
-       dc->maxplaysamples = dsahip->tmpbuffer_size;
-
-    dc->totalsamples = ds->len / dc->maxplaysamples;
-
-    /* queue first half */
-    preparesample (dsahip, dc);
-    /* queue second half */
-    preparesample (dsahip, dc);
+    if (get_long (audioctrl + ahiac_SoundFunc)) {
+       dc->samplecounter = 0;
+       if (ds->dynamic) {
+           dc->maxplaysamples = dsahip->maxplaysamples / 2;
+           if (dc->maxplaysamples > ds->len / 2)
+               dc->maxplaysamples = ds->len / 2;
+       } else {
+           dc->maxplaysamples = ds->len / 2;
+       }
+       if (dc->maxplaysamples > dsahip->tmpbuffer_size)
+           dc->maxplaysamples = dsahip->tmpbuffer_size;
+
+       dc->totalsamples = ds->len / dc->maxplaysamples;
+       if (dc->totalsamples <= 1)
+           dc->totalsamples = 2;
+        /* queue first half */
+       preparesample_multi (dsahip, dc);
+       /* queue second half */
+       preparesample_multi (dsahip, dc);
+    } else {
+       single = 1;
+       preparesample_single (dsahip, dc);
+    }
+    al_setloop (dc, single);
 
     if (dc->dsplaying) {
        dc->dsplaying = 1;
@@ -1067,6 +1110,10 @@ static void al_queuesample (struct DSAHI *dsahip, struct dschannel *dc)
 
     if (!dc->cs.ds)
        return;
+    if (dc->cs.ds->num < 0) {
+       dc->cs.ds = NULL;
+       return;
+    }
     restart = 0;
     if (dc->dsplaying) {
        alClear ();
@@ -1077,17 +1124,17 @@ static void al_queuesample (struct DSAHI *dsahip, struct dschannel *dc)
            alSourceRewind (dc->al_source);
            alError ("AHI: queuesample:restart");
            restart = 1;
-           if (ahi_debug)
+           if (ahi_debug > 2)
                write_log ("AHI: queuesample, play restart\n");
-           preparesample (dsahip, dc);
+           preparesample_multi (dsahip, dc);
        }
     }
-    preparesample (dsahip, dc);
+    preparesample_multi (dsahip, dc);
     if (dc->dsplaying)
        dc->dsplaying = 1;
     if (restart)
        al_startplay (dc);
-    if (ahi_debug > 1)
+    if (ahi_debug > 2)
        write_log ("AHI: sample %d queued to channel %d\n", dc->cs.ds->num, dc->num);
 }
 
@@ -1131,27 +1178,33 @@ void ahi_hsync (void)
     for (i = 0; i < UAE_MAXCHANNELS; i++) {
        int v, removed;
        struct dschannel *dc = &dsahip->channel[i];
+       uae_u32 mask = 1 << (dc - &dsahip->channel[0]);
+
        if (dc->dsplaying != 1 || dc->al_source == -1)
            continue;
+
        removed = unqueuebuffers (dc);
        v = 0;
         alClear ();
        alGetSourcei (dc->al_source, AL_SOURCE_STATE, &v);
        alError ("AHI: hsync AL_SOURCE_STATE");
        if (v != AL_PLAYING) {
-           setchannelevent (dsahip, dc);
-           if (ahi_debug)
-               write_log ("AHI: ********* channel %d stopped state=%d!\n", dc->num, v);
-           removed = 1;
-           dc->dsplaying = 2;
+           if (dc->cs.ds) {
+               setchannelevent (dsahip, dc);
+               if (ahi_debug)
+                   write_log ("AHI: ********* channel %d stopped state=%d!\n", dc->num, v);
+               removed = 1;
+               dc->dsplaying = 2;
+               dc->waitforack = 0;
+           }
        }
-       if (removed) {
+       if (!dc->waitforack && dc->samplecounter >= 0 && removed) {
            int evt = 0;
-           if (ahi_debug > 1)
+           if (ahi_debug > 2)
                write_log ("sample end channel %d: %d/%d\n", dc->num, dc->samplecounter, dc->totalsamples);
            if (dc->samplecounter >= dc->totalsamples) {
                evt = 1;
-               if (ahi_debug > 1)
+               if (ahi_debug > 2)
                    write_log ("sample finished channel %d: %d\n", dc->num, dc->totalsamples);
                dc->samplecounter = 0;
                if (dc->csnext.ds) {
@@ -1159,9 +1212,18 @@ void ahi_hsync (void)
                    dc->csnext.ds = NULL;
                }
            }
+           if (evt) {
+               flags &= ~mask;
+               if (setchannelevent (dsahip, dc))
+                   dc->waitforack = 1;
+           }
+           if (!dc->waitforack)
+               al_queuesample (dsahip, dc);
+       }
+       if (dc->waitforack && (flags & mask)) {
            al_queuesample (dsahip, dc);
-           if (evt)
-               setchannelevent (dsahip, dc);
+           dc->waitforack = 0;
+           flags &= ~mask;
        }
     }
     put_long (pbase + pub_ChannelSignalAck, flags);
@@ -1274,7 +1336,7 @@ static uae_u32 AHIsub_AllocAudio (TrapContext *ctx)
        return AHISF_ERROR;
     }
     if (size < pub_End) {
-       gui_message ("AHI: Incompatible DEVS:AHI/uae2.audio.\nInternal structure size %d<%d.", size, pub_End);
+       gui_message ("AHI: Incompatible DEVS:AHI/uae2.audio.\nInternal structure size %d<>%d.", size, pub_End);
        return AHISF_ERROR;
     }
 
@@ -1337,7 +1399,7 @@ static void AHIsub_Disable (TrapContext *ctx)
 {
     uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
     struct DSAHI *dsahip = GETAHI;
-    if (ahi_debug)
+    if (ahi_debug > 1)
        write_log ("AHI: Disable(%08x)\n", audioctrl);
     dsahip->enabledisable++;
 }
@@ -1346,7 +1408,7 @@ static void AHIsub_Enable (TrapContext *ctx)
 {
     uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
     struct DSAHI *dsahip = GETAHI;
-    if (ahi_debug)
+    if (ahi_debug > 1)
        write_log ("AHI: Enable(%08x)\n", audioctrl);
     dsahip->enabledisable--;
     if (dsahip->enabledisable == 0 && dsahip->playing)
@@ -1571,17 +1633,25 @@ static uae_u32 AHIsub_Update (TrapContext *ctx)
 static uae_u32 AHIsub_SetVol (TrapContext *ctx)
 {
     uae_u16 channel = m68k_dreg (&ctx->regs, 0);
-    uae_u32 volume = m68k_dreg (&ctx->regs, 1);
-    uae_u32 pan = m68k_dreg (&ctx->regs, 2);
+    uae_s32 volume = m68k_dreg (&ctx->regs, 1);
+    uae_s32 pan = m68k_dreg (&ctx->regs, 2);
     uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
     uae_u32 flags = m68k_dreg (&ctx->regs, 3);
     struct DSAHI *dsahip = GETAHI;
     struct dschannel *dc = GETCHANNEL;
 
-    if (ahi_debug)
+    if (ahi_debug > 1)
        write_log ("AHI: SetVol(%d,%d,%d,%08x,%08x)\n",
            channel, volume, pan, audioctrl, flags);
     if (dc) {
+       if (volume < -65535)
+           volume = -65535;
+       if (volume > 65535)
+           volume = 65535;
+       if (pan < -65535)
+           pan = -65535;
+       if (pan > 65535)
+           pan = 65535;
        dc->csnext.volume = volume;
        dc->csnext.panning = pan;
        if (flags & AHISF_IMM) {
@@ -1600,7 +1670,7 @@ static uae_u32 AHIsub_SetFreq (TrapContext *ctx)
     struct DSAHI *dsahip = GETAHI;
     struct dschannel *dc = GETCHANNEL;
 
-    if (ahi_debug)
+    if (ahi_debug > 1)
        write_log ("AHI: SetFreq(%d,%d,%08x,%08x)\n",
            channel, frequency, audioctrl, flags);
     if (dc) {
@@ -1625,7 +1695,7 @@ static uae_u32 AHIsub_SetSound (TrapContext *ctx)
     struct dssample *ds = GETSAMPLE;
     struct dschannel *dc = GETCHANNEL;
 
-    if (ahi_debug)
+    if (ahi_debug > 1)
        write_log ("AHI: SetSound(%d,%d,%08x,%d,%08x,%08x)\n",
            channel, sound, offset, length, audioctrl, flags);
     if (dc == NULL)
@@ -1677,6 +1747,7 @@ static uae_u32 AHIsub_SetEffect (TrapContext *ctx)
        put_long (puaebase + pub_ChannelInfo, 0);
        break;
        case AHIET_MASTERVOLUME:
+           write_log ("AHI: SetEffect(MasterVolume=%08x)\n", get_long (effect + 4));
        case AHIET_MASTERVOLUME | AHIET_CANCEL:
        break;
        default:
@@ -1700,7 +1771,7 @@ static uae_u32 AHIsub_LoadSound (TrapContext *ctx)
     int ch;
     int bps;
 
-    if (ahi_debug)
+    if (ahi_debug > 1)
        write_log ("AHI: LoadSound(%d,%d,%08x,%08x,SMP=%d,ADDR=%08x,LEN=%d)\n",
            sound, type, info, audioctrl, sampletype, addr, len);
 
@@ -1760,7 +1831,7 @@ static uae_u32 AHIsub_LoadSound (TrapContext *ctx)
        alGenBuffers (2, ds->al_buffer);
        if (alError ("AHI: alGenBuffers"))
            return AHIE_NOMEM;
-       if (ahi_debug)
+       if (ahi_debug > 1)
            write_log ("AHI:LoadSound:allocated OpenAL buffer\n");
     }
     return AHIE_OK;
@@ -1773,7 +1844,7 @@ static uae_u32 AHIsub_UnloadSound (TrapContext *ctx)
     struct DSAHI *dsahip = GETAHI;
     struct dssample *ds = GETSAMPLE;
 
-    if (ahi_debug)
+    if (ahi_debug > 1)
        write_log ("AHI: UnloadSound(%d,%08x)\n",
            sound, audioctrl);
     ds->num = -1;
index c9077eb8f042f1f3daf831c818081bd8a510e5e0..47ab0dd362a4c3f5f46ed5f3b49363c2f10b4d12 100755 (executable)
@@ -421,9 +421,12 @@ HRESULT DirectDraw_CreateMainSurface (int width, int height)
        dxdata.secondary = surf;
        dxdata.swidth = width;
        dxdata.sheight = height;
+       dxdata.pitch = 0;
        if (locksurface (surf, &desc)) {
            dxdata.pitch = desc.lPitch;
            unlocksurface (surf);
+       } else {
+           write_log ("Couldn't get surface pitch!\n");
        }
        createcursorsurface ();
     } else {
@@ -625,7 +628,7 @@ int DirectDraw_SurfaceLock (void)
     surf = getlocksurface ();
     if (surf == NULL)
        return 0;
-    if (IDirectDrawSurface7_IsLost (surf) == DDERR_SURFACELOST)
+    if (FAILED (IDirectDrawSurface7_IsLost (surf)))
        return 0;
     if (dxdata.lockcnt > 0)
        return 1;
index 4795a17285a8f8555ba84377a6688f849f0b3837..aa5180145aabf7d900836d8325e13924437fdcbc 100755 (executable)
@@ -585,10 +585,12 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int
            hfd->cache_valid = 0;
            hdf_seek (hfd, offset);
            poscheck (hfd, len);
-           if (hfd->handle_valid == HDF_HANDLE_WIN32)
-               ReadFile (hfd->handle, buffer, len, &ret, NULL);
-           else if (hfd->handle_valid == HDF_HANDLE_ZFILE)
+           if (hfd->handle_valid == HDF_HANDLE_WIN32) {
+               ReadFile (hfd->handle, hfd->cache, len, &ret, NULL);
+               memcpy (buffer, hfd->cache, ret);
+           } else if (hfd->handle_valid == HDF_HANDLE_ZFILE) {
                ret = zfile_fread (buffer, 1, len, hfd->handle);
+           }
            maxlen = len;
        } else {
            maxlen = len > CACHE_SIZE ? CACHE_SIZE : len;
index 236acb5f80e36ea0b59636d12d242be33e06d591..afa4b4a8cc4456f7c06c77e4cd6180fc36c8fbce 100755 (executable)
@@ -1767,6 +1767,8 @@ static struct modeids mi[] =
    1152, 864, 6,
    1280,1024, 7,
    1600,1280, 8,
+    320, 256, 9,
+    640, 512,10,
 
 /* new modes */
 
@@ -1888,7 +1890,7 @@ static int p96depth (int depth)
     return ok;
 }
 
-static int missmodes[] = { 320, 200, 320, 240, 640, 400, 640, 480, -1 };
+static int missmodes[] = { 320, 200, 320, 240, 320, 256, 640, 400, 640, 480, 640, 512, 800, 600, 1024, 768, 1280, 1024, -1 };
 
 #ifdef UAEGFX_INTERNAL
 static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 size);
index 3faf169130de63df3f9e01ba6b509a5160cf3f16..c4b81544d5c8ed3202fdf3e9a3ae491a376388fa 100755 (executable)
@@ -1679,7 +1679,7 @@ static void pritransla (void)
     }
 }
 
-static void WIN32_InitLang(void)
+static void WIN32_InitLang (void)
 {
     int lid;
     WORD langid = -1;
@@ -1691,7 +1691,7 @@ static void WIN32_InitLang(void)
 }
 
  /* try to load COMDLG32 and DDRAW, initialize csDraw */
-static int WIN32_InitLibraries( void )
+static int WIN32_InitLibraries (void)
 {
     LARGE_INTEGER freq;
 
@@ -1712,11 +1712,7 @@ static int WIN32_InitLibraries( void )
        return 0;
     }
 
-    /* Make sure we do an InitCommonControls() to get some advanced controls */
-    InitCommonControls ();
-
     hRichEdit = LoadLibrary ("RICHED32.DLL");
-
     return 1;
 }
 
@@ -3336,6 +3332,16 @@ static int process_arg(char **xargv)
            always_flush_log = 1;
            continue;
        }
+       if (!strcmp (arg, "-ahidebug")) {
+           extern int ahi_debug;
+           ahi_debug = 2;
+           continue;
+       }
+       if (!strcmp (arg, "-ahidebug2")) {
+           extern int ahi_debug;
+           ahi_debug = 3;
+           continue;
+       }
 
        if (i + 1 < argc) {
            char *np = argv[i + 1];
@@ -3994,6 +4000,9 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
     DWORD_PTR sys_aff;
     HANDLE thread;
 
+    /* Make sure we do an InitCommonControls() to get some advanced controls */
+    InitCommonControls ();
+
     original_affinity = 1;
     GetProcessAffinityMask (GetCurrentProcess(), &original_affinity, &sys_aff);
 
index 620b353ef4e0fbd589c99aee83693933419037f9..a403ae0f048cf6677bd03c39c54f2c1cf46e3ddb 100755 (executable)
@@ -17,8 +17,8 @@
 
 #define WINUAEPUBLICBETA 1
 
-#define WINUAEBETA "3"
-#define WINUAEDATE MAKEBD(2008, 11, 29)
+#define WINUAEBETA "4"
+#define WINUAEDATE MAKEBD(2008, 12, 6)
 #define WINUAEEXTRA ""
 #define WINUAEREV ""
 
index a898dd76727a5d47d1c15d2deafb7d15de3da9f3..3bd5a963769cb75baa524761c5e9b2a08c52c5c7 100755 (executable)
@@ -663,6 +663,7 @@ static uae_u8 *ddraw_dolock (void)
     if (!DirectDraw_SurfaceLock ())
        return 0;
     gfxvidinfo.bufmem = DirectDraw_GetSurfacePointer ();
+    gfxvidinfo.rowbytes = DirectDraw_GetSurfacePitch ();
     init_row_map ();
     clear_inhibit_frame (IHF_WINDOWHIDDEN);
     return gfxvidinfo.bufmem;
index a4bd96d4bef49648a2245e1c74614e3b579818d3..cf93857d1e845e61d2f2808c6dcd1492c8cf7d17 100755 (executable)
@@ -1,4 +1,25 @@
 
+Beta 4:
+
+- removable real harddrives (or other memory devices) work again
+  (broke in b2)
+- OCS/ECS "7-planes" mode didn't enable EHB mode
+- 320x256, 640x512, 800x600, 1024x768 and 1280x1024 are always
+  available in Picasso96 resolution selection, even if host does not
+  support the mode (in fullscreen mode automatically selects next
+  higher available mode + black borders) 320x200 and 320x240 was
+  already "faked" previously
+- ECS Agnus 0.5M+0.5M "1M chip" mirror works again (Move Any Mountain)
+- copper disassembler uses Agnus bank instead of direct memory access,
+  works now with above configuration
+- blitter writes work to "chip mirror" (Move Any Mountain missing gfx)
+- mouse counter emulation rewrite, now works with programs that read
+  counters hundreds of times/frame. (Oil Imperium pipelining minigame,
+  some weird lag can be noticed but it is much better than previously)
+- added support for 81 and 82 cylinder PC/Atari ST image formats
+- memwatch breakpoints work after reset/memory bank changes
+
+
 Beta 3:
 
 - HAM errors if left border was not fully visible (it seems this bug
@@ -12,7 +33,7 @@ Beta 3:
 - vhd creator didn't create fully compatible images (larger images
   were incompatible with official vhd tools, did not cause data
   corruption)
-- 1st Anniversary by Lazy Bones OCS/ECS "7-plane" trick emulated
+- 1st Anniversary by Lazy Bones OCS/ECS "7-planes" trick emulated
   (missing black vertical lines)
 - Disposable Hero title screen is now perfect. Take screenshots
   before it gets broken again :)