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;
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;
}
}
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;
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;
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;
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)
static void BLTADAT (uae_u16 v)
{
- maybe_blit (current_hpos(), 0);
+ maybe_blit (current_hpos (), 0);
blt_info.bltadat = 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);
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;
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;
}
{
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)
{
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;
}
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++) {
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;
}
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;
/* Configurable options */
#define ENFORCESIZE 1024
#define STACKLINES 5
+#define BACKTRACELONGS 500
#define INSTRUCTIONLINES 17
#define ISILLEGAL(addr) (addr < 4 || (addr > 4 && addr < ENFORCESIZE))
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;
}
}
- 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);
static uaecptr check_boot_rom (void)
{
- int i;
uaecptr b = RTAREA_DEFAULT;
addrbank *ab;
printf ("\tuae_u32 carry = val & 1;\n");
printf ("\tval >>= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
- printf ("SET_CFLG (®s->ccrflags, carry);\n");
+ printf ("\tSET_CFLG (®s->ccrflags, carry);\n");
duplicate_carry (0);
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size));
printf ("\tval <<= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
- printf ("SET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
+ printf ("\tSET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
duplicate_carry (0);
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
printf ("\tval <<= 1;\n");
printf ("\tif (carry) val |= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
- printf ("SET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
+ printf ("\tSET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_RORW:
printf ("\tval >>= 1;\n");
printf ("\tif (carry) val |= %s;\n", cmask (curi->size));
genflags (flag_logical, curi->size, "val", "", "");
- printf ("SET_CFLG (®s->ccrflags, carry);\n");
+ printf ("\tSET_CFLG (®s->ccrflags, carry);\n");
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_ROXLW:
printf ("\tval <<= 1;\n");
printf ("\tif (GET_XFLG (®s->ccrflags)) val |= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
- printf ("SET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
+ printf ("\tSET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1);
duplicate_carry (0);
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
printf ("\tval >>= 1;\n");
printf ("\tif (GET_XFLG (®s->ccrflags)) val |= %s;\n", cmask (curi->size));
genflags (flag_logical, curi->size, "val", "", "");
- printf ("SET_CFLG (®s->ccrflags, carry);\n");
+ printf ("\tSET_CFLG (®s->ccrflags, carry);\n");
duplicate_carry (0);
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
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);
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;
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;
};
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);
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 {
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;
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;
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)
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];
}
}
}
-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)
uae_u16 v = 0;
if (inputdevice_logging & 2)
- write_log ("JOY%dDAT %x\n", joy, m68k_getpc (®s));
+ write_log ("JOY%dDAT %08x\n", joy, M68K_GETPC);
readinput ();
if (joydir[joy] & DIR_LEFT)
left = 1;
}
}
}
- 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--;
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;
}
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;
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);
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);
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;
}
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)
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;
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;
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);
put_mem_bank (bnr << 16, bank, realstart << 16);
real_left--;
}
+ debug_bankchange (old);
return;
}
#endif
real_left--;
}
}
+ debug_bankchange (old);
}
#ifdef SAVESTATE
/*
* UAE - The Un*x Amiga Emulator
*
- * OpenAL AHI 7.1 wrapper
+ * OpenAL AHI 7.1 "wrapper"
*
* Copyright 2008 Toni Wilen
*/
#define AHI_STRUCT_VERSION 1
-static int ahi_debug = 2;
+int ahi_debug = 1;
#define UAE_MAXCHANNELS 24
#define UAE_MAXSOUNDS 256
int buffertoggle;
int maxplaysamples;
int totalsamples;
+ int waitforack;
};
struct DSAHI {
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)
{
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);
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);
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;
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++;
/* 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 ();
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;
if (!dc->cs.ds)
return;
+ if (dc->cs.ds->num < 0) {
+ dc->cs.ds = NULL;
+ return;
+ }
restart = 0;
if (dc->dsplaying) {
alClear ();
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);
}
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) {
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);
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;
}
{
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++;
}
{
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)
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) {
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) {
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)
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:
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);
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;
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;
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 {
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;
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;
1152, 864, 6,
1280,1024, 7,
1600,1280, 8,
+ 320, 256, 9,
+ 640, 512,10,
/* new modes */
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);
}
}
-static void WIN32_InitLang(void)
+static void WIN32_InitLang (void)
{
int lid;
WORD langid = -1;
}
/* try to load COMDLG32 and DDRAW, initialize csDraw */
-static int WIN32_InitLibraries( void )
+static int WIN32_InitLibraries (void)
{
LARGE_INTEGER freq;
return 0;
}
- /* Make sure we do an InitCommonControls() to get some advanced controls */
- InitCommonControls ();
-
hRichEdit = LoadLibrary ("RICHED32.DLL");
-
return 1;
}
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];
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);
#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 ""
if (!DirectDraw_SurfaceLock ())
return 0;
gfxvidinfo.bufmem = DirectDraw_GetSurfacePointer ();
+ gfxvidinfo.rowbytes = DirectDraw_GetSurfacePitch ();
init_row_map ();
clear_inhibit_frame (IHF_WINDOWHIDDEN);
return gfxvidinfo.bufmem;
+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
- 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 :)