From: Toni Wilen Date: Sat, 4 Jan 2014 17:15:09 +0000 (+0200) Subject: 2710b1 X-Git-Tag: 2800~40 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=2e57c1b9a10071fcc3b547197b3410d13cf2a370;p=francis%2Fwinuae.git 2710b1 --- diff --git a/a2065.cpp b/a2065.cpp index 0d270693..9632cf93 100644 --- a/a2065.cpp +++ b/a2065.cpp @@ -612,7 +612,7 @@ static uae_u16 chip_wget (uaecptr addr) { if (addr == RAP) { return rap; - } else if (addr = RDP) { + } else if (addr == RDP) { uae_u16 v = csr[rap]; if (rap == 0) { if (v & (CSR0_BABL | CSR0_CERR | CSR0_MISS | CSR0_MERR)) diff --git a/arcadia.cpp b/arcadia.cpp index a8f47fd6..70b91441 100644 --- a/arcadia.cpp +++ b/arcadia.cpp @@ -21,7 +21,9 @@ #include "arcadia.h" #include "zfile.h" -/* supported roms (mame 0.90) +/* supported roms +* +* (mame 0.90) * * - ar_airh * - ar_bowl @@ -36,6 +38,12 @@ * - ar_sprg * - ar_xeon * +* mame 0.152 +* +* - ar_blast +* - ar_dlta +* - ar_pm +* */ static void multigame (int); @@ -43,28 +51,43 @@ static void multigame (int); int arcadia_flag, arcadia_coin[2]; struct arcadiarom *arcadia_bios, *arcadia_game; -#define BIOS_VERSION_211 2 -#define BIOS_VERSION_300 3 - static struct arcadiarom roms[] = { - { 49, _T("ar_bios.zip"), _T("scpa21"), ARCADIA_BIOS, 0, 6, 1, 0, 2, 3, 4, 5, 7 }, - { 50, _T("ar_bios.zip"), _T("gcp-"), ARCADIA_BIOS, 3, 7, 6, 5, 4, 3, 2, 1, 0 }, - { 51, _T("ar_bios.zip"), _T("scpav3_0."), ARCADIA_BIOS, 0, 6, 1, 0, 2, 3, 4, 5, 7 }, - - { 33, _T("ar_airh.zip"), _T("airh_"), ARCADIA_GAME, 1, 5, 0, 2, 4, 7, 6, 1, 3 }, - { 34, _T("ar_bowl.zip"), _T("bowl_"), ARCADIA_GAME, 1, 7, 6, 0, 1, 2, 3, 4, 5 }, - { 35, _T("ar_dart.zip"), _T("dart_"), ARCADIA_GAME, 1, 4, 0, 7, 6, 3, 1, 2, 5 }, - { 36, _T("ar_fast.zip"), _T("fastv28."), ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 }, - { 37, _T("ar_ldrb.zip"), _T("lbg240"), ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 }, - { 38, _T("ar_ldrba.zip"),_T("ldrb_"), ARCADIA_GAME, 1, 2, 3, 4, 1, 0, 7, 5, 6 }, - { 39, _T("ar_ninj.zip"), _T("ninj_"), ARCADIA_GAME, 1, 1, 6, 5, 7, 4, 2, 0, 3 }, - { 40, _T("ar_rdwr.zip"), _T("rdwr_"), ARCADIA_GAME, 1, 3, 1, 6, 4, 0, 5, 2, 7 }, - { 41, _T("ar_sdwr.zip"), _T("sdwr_"), ARCADIA_GAME, 1, 6, 3, 4, 5, 2, 1, 0, 7 }, - { 42, _T("ar_spot.zip"), _T("spotv2."), ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 }, - { 43, _T("ar_sprg.zip"), _T("sprg_"), ARCADIA_GAME, 1, 4, 7, 3, 0, 6, 5, 2, 1 }, - { 44, _T("ar_xeon.zip"), _T("xeon_"), ARCADIA_GAME, 1, 3, 1, 2, 4, 0, 5, 6, 7 }, - { 45, _T("ar_socc.zip"), _T("socc30."), ARCADIA_GAME, 2, 0, 7, 1, 6, 5, 4, 3, 2 }, + // oneplay 2.11 + { 49, _T("ar_bios.zip"), _T("scpa_01_v2.11"), _T("scpa_01"),ARCADIA_BIOS, 3, 6, 1, 0, 2, 3, 4, 5, 7, { _T("_v2.11.u12"), _T("_v2.11.u16") } }, + // tenplay 2.11 + { 50, _T("ar_bios.zip"), _T("gcp"), _T("gcp-"), ARCADIA_BIOS, 7, 7, 6, 5, 4, 3, 2, 1, 0 }, + // oneplay 2.20 + { 75, _T("ar_bios.zip"), _T("scpa_01_v2.20"), _T("scpa_01"),ARCADIA_BIOS, 3, 6, 1, 0, 2, 3, 4, 5, 7, { _T("_v2.20.u12"), _T("_v2.20.u16") } }, + // oneplay 3.00 + { 51, _T("ar_bios.zip"), _T("scpa_01_v3.00"), _T("scpa_01"),ARCADIA_BIOS, 3, 6, 1, 0, 2, 3, 4, 5, 7, { _T("_v3.0.u12"), _T("_v3.0.u16") } }, + // tenplay 3.11 + { 76, _T("ar_bios.zip"), _T("gcp_v11"), _T("gcp_v311_"), ARCADIA_BIOS, 7, 7, 6, 5, 4, 3, 2, 1, 0, { _T(".u16"), _T(".u11"), _T(".u17"), _T(".u12") } }, + // tenplay 4.00 + { 77, _T("ar_bios.zip"), _T("gcp_v400"), _T("gcp_v400_"), ARCADIA_BIOS, 7, 7, 6, 5, 4, 3, 2, 1, 0, { _T(".u16"), _T(".u11"), _T(".u17"), _T(".u12") } }, + + { 33, _T("ar_airh.zip"), _T("airh"), _T("airh_"), ARCADIA_GAME, 5|16, 5, 0, 2, 4, 7, 6, 1, 3 }, + { 81, _T("ar_airh2.zip"), _T("airh2"), _T("arcadia4"), ARCADIA_GAME, 0, 5, 0, 2, 4, 7, 6, 1, 3, { _T(".u10"), _T(".u6") } }, + { 34, _T("ar_bowl.zip"), _T("bowl"), _T("bowl_"), ARCADIA_GAME, 5|16, 7, 6, 0, 1, 2, 3, 4, 5 }, + { 35, _T("ar_dart.zip"), _T("dart"), _T("dart_"), ARCADIA_GAME, 5|16, 4, 0, 7, 6, 3, 1, 2, 5 }, + { 82, _T("ar_dart2.zip"), _T("dart2"), _T("arcadia3"), ARCADIA_GAME, 0, 4, 0, 7, 6, 3, 1, 2, 5, { _T(".u10"), _T(".u6"), _T(".u11"), _T(".u7"), _T(".u12"), _T(".u8"), _T(".u13"), _T(".u9"), _T(".u19"), _T(".u15"), _T(".u20"), _T(".u16") } }, + { 36, _T("ar_fast.zip"), _T("fast-v28"), _T("fast-v28_"), ARCADIA_GAME, 7, 7, 6, 5, 4, 3, 2, 1, 0, { _T(".u11"), _T(".u15"), _T(".u10"), _T(".u14"), _T(".u9"), _T(".u13"), _T(".u20"), _T(".u24"), _T(".u19"), _T(".u23"), _T(".u18"), _T(".u22"), _T(".u17"), _T(".u21"), _T(".u28"), _T(".u32") } }, + { 83, _T("ar_fasta.zip"), _T("fast-v27"), _T("fast-v27_"), ARCADIA_GAME, 7, 7, 6, 5, 4, 3, 2, 1, 0, { _T(".u11"), _T(".u15"), _T(".u10"), _T(".u14"), _T(".u9"), _T(".u13"), _T(".u20"), _T(".u24"), _T(".u19"), _T(".u23"), _T(".u18"), _T(".u22"), _T(".u17"), _T(".u21"), _T(".u28"), _T(".u32") } }, + { 37, _T("ar_ldrba.zip"), _T("ldra"), _T("leader_board_0"), ARCADIA_GAME, 7, 7, 6, 5, 4, 3, 2, 1, 0, { _T("_v2.4.u11"), _T("_v2.4.u15"), _T("_v2.4.u10"), _T("_v2.4.u14"), _T("_v2.4.u9"), _T("_v2.4.u13"), _T("_v2.4.u20"), _T("_v2.4.u24"), _T("_v2.4.u19"), _T("_v2.4.u23"), _T("_v2.4.u18"), _T("_v2.4.u22"), _T("_v2.4.u17"), _T("_v2.4.u21"), _T("_v2.4.u28"), _T("_v2.4.u32") } }, + { 38, _T("ar_ldrbb.zip"),_T("ldrbb"), _T("ldrb_"), ARCADIA_GAME, 5, 7, 6, 5, 4, 3, 2, 1, 0, { _T(".u11"), _T("_gcp_22.u15"), _T(".u10"), _T(".u14"), _T(".u9"), _T(".u13"), _T(".u20"), _T(".u24"), _T(".u19"), _T(".u23"), _T(".u18"), _T(".u22"), _T(".u17"), _T(".u21"), _T(".u28"), _T(".u32") } }, + { 86, _T("ar_ldrb.zip"),_T("ldrb"), _T("leader_board_0"), ARCADIA_GAME, 7, 2, 3, 4, 1, 0, 7, 5, 6, { _T("_v2.5.u11"), _T("_v2.5.u15"), _T("_v2.5.u10"), _T("_v2.5.u14"), _T("_v2.5.u9"), _T("_v2.5.u13"), _T("_v2.5.u20"), _T("_v2.5.u24"), _T("_v2.5.u19"), _T("_v2.5.u23"), _T("_v2.5.u18"), _T("_v2.5.u22"), _T("_v2.5.u17"), _T("_v2.5.u21"), _T("_v2.5.u28"), _T("_v2.5.u32") } }, + { 39, _T("ar_ninj.zip"), _T("ninj"), _T("ninj_"), ARCADIA_GAME, 5|16, 1, 6, 5, 7, 4, 2, 0, 3 }, + { 84, _T("ar_ninj2.zip"), _T("ninj2"), _T("arcadia5"), ARCADIA_GAME, 0, 1, 6, 5, 7, 4, 2, 0, 3, { _T(".u10"), _T(".u6"), _T(".u11"), _T(".u7"), _T(".u12"), _T(".u8"), _T(".u13"), _T(".u9"), _T(".u19"), _T(".u15"), _T(".u20"), _T(".u16") } }, + { 40, _T("ar_rdwr.zip"), _T("rdwr"), _T("rdwr_"), ARCADIA_GAME, 5|16, 3, 1, 6, 4, 0, 5, 2, 7 }, + { 41, _T("ar_sdwr.zip"), _T("sdwr"), _T("sdwr_"), ARCADIA_GAME, 5|16, 6, 3, 4, 5, 2, 1, 0, 7 }, + { 85, _T("ar_sdwr2.zip"), _T("sdwr2"), _T("arcadia1"), ARCADIA_GAME, 0, 6, 3, 4, 5, 2, 1, 0, 7, { _T(".u10"), _T(".u6"), _T(".u11"), _T(".u7"), _T(".u12"), _T(".u8"), _T(".u13"), _T(".u9"), _T(".u19"), _T(".u15"), _T(".u20"), _T(".u16") } }, + { 42, _T("ar_spot.zip"), _T("spotv2"), _T("spotv2."), ARCADIA_GAME, 5, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 43, _T("ar_sprg.zip"), _T("sprg"), _T("sprg_"), ARCADIA_GAME, 5|16, 4, 7, 3, 0, 6, 5, 2, 1 }, + { 44, _T("ar_xeon.zip"), _T("xeon"), _T("xeon_"), ARCADIA_GAME, 5|16, 3, 1, 2, 4, 0, 5, 6, 7 }, + { 45, _T("ar_socc.zip"), _T("socc30"), _T("socc30."), ARCADIA_GAME, 6, 0, 7, 1, 6, 5, 4, 3, 2 }, + { 78, _T("ar_blast.zip"), _T("blsb-v2-1"),_T("blsb-v2-1_"), ARCADIA_GAME, 7|16, 4, 1, 7, 6, 2, 0, 3, 5 }, + { 79, _T("ar_dlta.zip"), _T("dlta_v3"), _T("dlta_v3_"), ARCADIA_GAME, 7|16, 4, 1, 7, 6, 2, 0, 3, 5 }, + { 80, _T("ar_pm.zip"), _T("pm"), _T("pm-"), ARCADIA_GAME, 2|4|16, 7, 6, 5, 4, 3, 2, 1, 0 }, { -1 } }; @@ -86,23 +109,33 @@ static int boot_read; static int nvwrite; -static int load_rom8 (TCHAR *xpath, uae_u8 *mem, int extra) +static int load_rom8 (const TCHAR *xpath, uae_u8 *mem, int extra, const TCHAR **ext) { struct zfile *zf; TCHAR path[MAX_DPATH]; int i; uae_u8 *tmp = xmalloc (uae_u8, 131072); - const TCHAR *bin = extra == 1 ? _T(".bin") : _T(""); - - memset (tmp, 0, 131072); - _stprintf (path, _T("%s%s%s"), xpath, extra == 3 ? _T("-hi") : (extra == 2 ? _T("hi") : _T("h")), bin); + const TCHAR *bin = (extra & 16) ? _T(".bin") : _T(""); + + extra &= 3; + memset (tmp, 0xff, 131072); + _stprintf (path, _T("%s%s%s"), xpath, extra == 3 ? _T("-hi") : (extra == 2 ? _T("hi") : (extra == 1 ? _T("h") : _T(""))), bin); + if (ext) { + if (ext[0] == NULL) + goto end; + _tcscat (path, ext[0]); + } + //write_log (_T("%s\n"), path); zf = zfile_fopen (path, _T("rb"), ZFD_NORMAL); if (!zf) goto end; if (zfile_fread (tmp, 65536, 1, zf) == 0) goto end; zfile_fclose (zf); - _stprintf (path, _T("%s%s%s"), xpath, extra == 3 ? _T("-lo") : (extra == 2 ? _T("lo") : _T("l")), bin); + _stprintf (path, _T("%s%s%s"), xpath, extra == 3 ? _T("-lo") : (extra == 2 ? _T("lo") : (extra == 1 ? _T("l") : _T(""))), bin); + if (ext) + _tcscat (path, ext[1]); + //write_log (_T("%s\n"), path); zf = zfile_fopen (path, _T("rb"), ZFD_NORMAL); if (!zf) goto end; @@ -136,7 +169,7 @@ static struct arcadiarom *is_arcadia (const TCHAR *xpath, int cnt) } } for (i = 0; roms[i].romid > 0; i++) { - if (!_tcsicmp (p, roms[i].name) || !_tcsicmp (p, roms[i].rom)) { + if (!_tcsicmp (p, roms[i].name) || !_tcsicmp (p, roms[i].romid1)) { if (cnt > 0) { cnt--; continue; @@ -152,7 +185,7 @@ static struct arcadiarom *is_arcadia (const TCHAR *xpath, int cnt) static int load_roms (struct arcadiarom *rom) { - TCHAR path[MAX_DPATH], path2[MAX_DPATH], path3[MAX_DPATH], *p; + TCHAR path[MAX_DPATH], path3[MAX_DPATH], *p; int i, offset; TCHAR *xpath; @@ -172,15 +205,21 @@ static int load_roms (struct arcadiarom *rom) } if (p == path3) *p = 0; - _tcscpy (path2, xpath); + + xpath = path3; + _tcscat (path3, FSDB_DIR_SEPARATOR_S); + _tcscat (path3, rom->romid2); offset = 0; if (rom->type == ARCADIA_BIOS) offset = bios_offset; i = 0; for (;;) { - _stprintf (path, _T("%s%d"), xpath, i + 1); - if (!load_rom8 (path, arbmemory + 2 * 65536 * i + offset, rom->extra)) { + if (rom->extra & 4) + _stprintf (path, _T("%s%d"), xpath, i + 1); + else + _tcscpy (path, xpath); + if (!load_rom8 (path, arbmemory + 2 * 65536 * i + offset, rom->extra, rom->exts && rom->exts[0] ? &rom->exts[i * 2] : NULL)) { if (i == 0) write_log (_T("Arcadia: %s rom load failed ('%s')\n"), rom->type == ARCADIA_BIOS ? _T("bios") : _T("game"), path); break; @@ -261,11 +300,24 @@ static void REGPARAM2 arbb_bput (uaecptr addr, uae_u32 b) { } +static int REGPARAM2 arbb_check (uaecptr addr, uae_u32 size) +{ + addr &= arbb_mask; + return (addr + size) <= allocated_arbbmemory; +} + +static uae_u8 *REGPARAM2 arbb_xlate (uaecptr addr) +{ + addr &= arbb_mask; + return arbbmemory + addr; +} + static addrbank arcadia_boot_bank = { arbb_lget, arbb_wget, arbb_bget, arbb_lput, arbb_wput, arbb_bput, - default_xlate, default_check, NULL, _T("Arcadia BIOS"), - arbb_lget, arbb_wget, ABFLAG_ROM + arbb_xlate, arbb_check, NULL, _T("Arcadia BIOS"), + arbb_lget, arbb_wget, ABFLAG_ROM | ABFLAG_SAFE, + arbb_mask }; static uae_u32 REGPARAM2 arb_lget (uaecptr addr) @@ -328,22 +380,33 @@ static void REGPARAM2 arb_bput (uaecptr addr, uae_u32 b) } } +static int REGPARAM2 arb_check (uaecptr addr, uae_u32 size) +{ + addr &= arb_mask; + return (addr + size) <= allocated_arbmemory; +} + +static uae_u8 *REGPARAM2 arb_xlate (uaecptr addr) +{ + addr &= arb_mask; + return arbmemory + addr; +} + static addrbank arcadia_rom_bank = { arb_lget, arb_wget, arb_bget, arb_lput, arb_wput, arb_bput, - default_xlate, default_check, NULL, _T("Arcadia Game ROM"), - arb_lget, arb_wget, ABFLAG_ROM + arb_xlate, arb_check, NULL, _T("Arcadia Game ROM"), + arb_lget, arb_wget, ABFLAG_ROM | ABFLAG_SAFE, + arb_mask }; -static void multigame(int v) +static void multigame (int v) { if (v != 0) - map_banks (&kickmem_bank, arb_start >> 16, - 8, 0); + map_banks (&kickmem_bank, arb_start >> 16, 8, 0); else - map_banks (&arcadia_rom_bank, arb_start >> 16, - allocated_arbmemory >> 16, 0); + map_banks (&arcadia_rom_bank, arb_start >> 16, allocated_arbmemory >> 16, 0); } int is_arcadia_rom (const TCHAR *path) @@ -410,9 +473,8 @@ int arcadia_map_banks (void) if (arcadia_game) decrypt_roms (arcadia_game); nvram_read (); - multigame(0); - map_banks (&arcadia_boot_bank, 0xf0, - 8, 0); + multigame (0); + map_banks (&arcadia_boot_bank, 0xf0, 8, 0); return 1; } @@ -462,8 +524,8 @@ struct romdata *scan_arcadia_rom (TCHAR *path, int cnt) for (i = 0; arc_rl[i]; i++) { if (arc_rl[i]->rd->id == arcadia_rom->romid) { rd = arc_rl[i]->rd; - _tcscat (path, _T("/")); - _tcscat (path, arcadia_rom->rom); + _tcscat (path, FSDB_DIR_SEPARATOR_S); + _tcscat (path, arcadia_rom->romid1); break; } } diff --git a/blitter.cpp b/blitter.cpp index 4b488700..5de16b62 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -28,9 +28,10 @@ // 2 = no wait detection // 4 = no D // 8 = instant +// 16 = activate debugger if weird things #if BLITTER_DEBUG -int log_blitter = 1; +int log_blitter = 1 | 16; #else int log_blitter = 0; #endif @@ -41,7 +42,11 @@ static int blt_statefile_type; uae_u16 bltcon0, bltcon1; uae_u32 bltapt, bltbpt, bltcpt, bltdpt; +uae_u32 bltptx; +int bltptxpos, bltptxc; int blitter_nasty; +// blitter is active and D may write to visible bitplane addresses +int blitter_dangerous_bpl; static int original_ch, original_fill, original_line; @@ -262,6 +267,8 @@ STATIC_INLINE void record_dma_blit (uae_u16 reg, uae_u16 dat, uae_u32 addr, int if (blitline) type = DMARECORD_BLITTER_LINE; + else if (blitfill) + type = DMARECORD_BLITTER_FILL; else type = DMARECORD_BLITTER; if (debug_dma) @@ -290,7 +297,7 @@ STATIC_INLINE const int *get_ch (void) if (blit_faulty) return &blit_diag[0]; if (blit_final) - return blitline ? blit_cycle_diagram_finalld : blit_cycle_diagram_finald; + return blitline || blit_nod ? blit_cycle_diagram_finalld : blit_cycle_diagram_finald; return blit_diag; } @@ -331,15 +338,63 @@ STATIC_INLINE int canblit (int hpos) return -1; if (is_bitplane_dma (hpos)) return 0; - if (cycle_line[hpos] & CYCLE_MASK) + if (cycle_line[hpos] & CYCLE_MASK) { +#if 0 + if ((dmacon & DMA_BLITPRI) && (cycle_line[hpos] & CYCLE_MASK) == CYCLE_CPU) + write_log (_T("BLITTER: CPU stole cycle from blitter without nasty!?\n")); +#endif return 0; + } return 1; } +static void markidlecycle (int hpos) +{ + if (debug_dma) + record_dma_event (DMA_EVENT_BLITSTARTFINISH, hpos, vpos); +} + +static void reset_channel_mods (void) +{ + if (bltptxpos < 0) + return; + bltptxpos = -1; + switch (bltptxc) + { + case 1: + bltapt = bltptx; + break; + case 2: + bltbpt = bltptx; + break; + case 3: + bltcpt = bltptx; + break; + case 4: + bltdpt = bltptx; + break; + } +} + +static void check_channel_mods (int hpos, int ch) +{ + if (bltptxpos != hpos) + return; + if (ch == bltptxc) { + bltptxpos = -1; + write_log (_T("BLITTER: %08X write to %cPT ignored! %08x\n"), bltptx, ch + 'A' - 1, m68k_getpc ()); + } +} + // blitter interrupt is set (and busy bit cleared) when // last "main" cycle has been finished, any non-linedraw // D-channel blit still needs 2 more cycles before final -// D is written +// D is written (idle cycle, final D write) +// +// line draw interrupt triggers when last D is written +// (or cycle where last D write would have been if +// ONEDOT was active) + static void blitter_interrupt (int hpos, int done) { if (blit_interrupt) @@ -347,7 +402,7 @@ static void blitter_interrupt (int hpos, int done) if (!done && (!currprefs.blitter_cycle_exact || currprefs.cpu_model >= 68030)) return; blit_interrupt = 1; - send_interrupt (6, 3 * CYCLE_UNIT); + send_interrupt (6, 4 * CYCLE_UNIT); if (debug_dma) record_dma_event (DMA_EVENT_BLITIRQ, hpos, vpos); } @@ -358,13 +413,13 @@ static void blitter_done (int hpos) bltstate = blit_startcycles == 0 || !currprefs.blitter_cycle_exact ? BLT_done : BLT_init; blitter_interrupt (hpos, 1); blitter_done_notify (hpos); - if (debug_dma) - record_dma_event (DMA_EVENT_BLITFINISHED, hpos, vpos); + markidlecycle (hpos); event2_remevent (ev2_blitter); unset_special (SPCFLAG_BLTNASTY); if (log_blitter & 1) write_log (_T("cycles %d, missed %d, total %d\n"), blit_totalcyclecounter, blit_misscyclecounter, blit_totalcyclecounter + blit_misscyclecounter); + blitter_dangerous_bpl = 0; } STATIC_INLINE void chipmem_agnus_wput2 (uaecptr addr, uae_u32 w) @@ -372,7 +427,7 @@ STATIC_INLINE void chipmem_agnus_wput2 (uaecptr addr, uae_u32 w) last_custom_value1 = w; if (!(log_blitter & 4)) { chipmem_wput_indirect (addr, w); - debug_wputpeekdma_chipram (addr, w); + debug_wputpeekdma_chipram (addr, w, 0x000); } } @@ -596,7 +651,7 @@ STATIC_INLINE void blitter_write (void) return; last_custom_value1 = blt_info.bltddat; chipmem_wput_indirect (bltdpt, blt_info.bltddat); - debug_wputpeekdma_chipram (bltdpt, blt_info.bltddat); + debug_wputpeekdma_chipram (bltdpt, blt_info.bltddat, 0x000); } bltstate = BLT_next; } @@ -706,6 +761,18 @@ static void decide_blitter_line (int hsync, int hpos) break; } + // final 2 idle cycles? does not need free bus + // in line mode idle cycles also use line mode cycle sequence (every other cycle) + if (blit_final) { + blit_cyclecounter++; + blit_totalcyclecounter++; + if (blit_cyclecounter >= 4) { + blitter_done (last_blitter_hpos); + return; + } + break; + } + if (v <= 0) { blit_misscyclecounter++; blitter_nasty++; @@ -715,20 +782,14 @@ static void decide_blitter_line (int hsync, int hpos) blit_cyclecounter++; blit_totalcyclecounter++; - // final 2 idle cycles? - if (blit_final) { - if (blit_cyclecounter > get_ch ()[0]) { - blitter_done (last_blitter_hpos); - return; - } - break; - } + check_channel_mods (last_blitter_hpos, c); if (c == 3) { blitter_read (); alloc_cycle_blitter (last_blitter_hpos, &bltcpt, 3); record_dma_blit (0x70, blt_info.bltcdat, bltcpt, last_blitter_hpos); + blitter_nasty++; } else if (c == 5) { @@ -748,12 +809,16 @@ static void decide_blitter_line (int hsync, int hpos) alloc_cycle_blitter (last_blitter_hpos, &bltdpt, 4); record_dma_blit (0x00, blt_info.bltddat, bltdpt, last_blitter_hpos); blitlinepixel = 0; + blitter_nasty++; } if (blt_info.vblitsize == 0) { bltdpt = bltcpt; blit_final = 1; blit_cyclecounter = 0; blit_waitcyclecounter = 0; + // blit finished bit is set and interrupt triggered + // immediately after last D write + blitter_interrupt (last_blitter_hpos, 0); break; } @@ -765,6 +830,7 @@ static void decide_blitter_line (int hsync, int hpos) } if (hsync) last_blitter_hpos = 0; + reset_channel_mods (); } #endif @@ -855,7 +921,7 @@ STATIC_INLINE uae_u16 blitter_doblit (void) ddat = blit_func (blitahold, blt_info.bltbhold, blt_info.bltcdat, mt) & 0xFFFF; - if (bltcon1 & 0x18) { + if ((bltcon1 & 0x18)) { uae_u16 d = ddat; int ifemode = blitife ? 2 : 0; int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; @@ -878,7 +944,7 @@ STATIC_INLINE void blitter_doddma (int hpos) wd = 0; if (blit_dmacount2 == 0) { - d = blitter_doblit (); + d = blitter_doblit (); wd = -1; } else if (ddat2use) { d = ddat2; @@ -894,7 +960,6 @@ STATIC_INLINE void blitter_doddma (int hpos) warn--; write_log (_T("BLITTER: D-channel without nothing to do?\n")); } - blitter_vcounter2 = blitter_vcounter1 = blt_info.vblitsize; return; } record_dma_blit (0x00, d, bltdpt, hpos); @@ -907,6 +972,8 @@ STATIC_INLINE void blitter_doddma (int hpos) blitter_hcounter2 = 0; bltdpt += blit_modaddd; blitter_vcounter2++; + if (blit_dmacount2 == 0) // d-only + blitter_vcounter1++; if (blitter_vcounter2 > blitter_vcounter1) blitter_vcounter1 = blitter_vcounter2; } @@ -1011,6 +1078,8 @@ static void do_startcycles (int hpos) blit_faulty = 1; return; } + } else { + markidlecycle (hpos); } } } @@ -1061,13 +1130,15 @@ void decide_blitter (int hpos) // copper bltsize write needs one cycle (any cycle) delay if (blit_waitcyclecounter) { blit_waitcyclecounter = 0; + markidlecycle (last_blitter_hpos); break; } - // idle cycles require free bus.. + // idle cycles require free bus. + // Final empty cycle does not, unless it is fill mode that requires extra idle cycle // (CPU can still use this cycle) - if ((c == 0 && v == 0) || v < 0) { - blitter_nasty++; + if ((blit_cyclecounter < 0 || !blit_final || (blitfill && blit_cycle_diagram_fill[blit_ch][0])) && ((c == 0 && v == 0) || v < 0)) { blit_misscyclecounter++; + blitter_nasty++; break; } @@ -1087,6 +1158,7 @@ void decide_blitter (int hpos) blitter_done (last_blitter_hpos); return; } + markidlecycle (last_blitter_hpos); break; } @@ -1097,6 +1169,7 @@ void decide_blitter (int hpos) break; } + check_channel_mods (last_blitter_hpos, c); blt_info.got_cycle = 1; if (c == 4) { blitter_doddma (last_blitter_hpos); @@ -1119,13 +1192,16 @@ void decide_blitter (int hpos) break; } - if (!blit_final && blitter_vcounter1 == blt_info.vblitsize && channel_pos (blit_cyclecounter - 1) == blit_diag[0] - 1) { - blitter_interrupt (last_blitter_hpos, 0); - blit_cyclecounter = 0; - blit_final = 1; + if (dmaen (DMA_BLITTER) && !blit_final && (blitter_vcounter1 == blt_info.vblitsize || (blitter_vcounter1 == blt_info.vblitsize - 1 && blitter_hcounter1 == blt_info.hblitsize - 1 && blit_dmacount2 == 0))) { + if (channel_pos (blit_cyclecounter - 1) == blit_diag[0] - 1) { + blitter_interrupt (last_blitter_hpos, 0); + blit_cyclecounter = 0; + blit_final = 1; + } } last_blitter_hpos++; } + reset_channel_mods (); if (hsync) last_blitter_hpos = 0; } @@ -1198,12 +1274,17 @@ static void blit_bltset (int con) bltstate = BLT_done; blit_interrupt = 1; write_log (_T("BLITTER: register modification during linedraw! %08x\n"), M68K_GETPC); + if (log_blitter & 16) + activate_debugger (); } if (blitline) { - if (blt_info.hblitsize != 2) + if (blt_info.hblitsize != 2) { debugtest (DEBUGTEST_BLITTER, _T("weird blt_info.hblitsize in linemode: %d vsize=%d\n"), blt_info.hblitsize, blt_info.vblitsize); + if (log_blitter & 16) + activate_debugger (); + } blit_diag = blit_cycle_diagram_line; } else { if (con & 2) { @@ -1214,12 +1295,18 @@ static void blit_bltset (int con) blitife = 0; } } - if (blitfill && !blitdesc) + if (blitfill && !blitdesc) { debugtest (DEBUGTEST_BLITTER, _T("fill without desc\n")); + if (log_blitter & 16) + activate_debugger (); + } blit_diag = blitfill && blit_cycle_diagram_fill[blit_ch][0] ? blit_cycle_diagram_fill[blit_ch] : blit_cycle_diagram[blit_ch]; } - if ((bltcon1 & 0x80) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + if ((bltcon1 & 0x80) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) { debugtest (DEBUGTEST_BLITTER, _T("ECS BLTCON1 DOFF-bit set\n")); + if (log_blitter & 16) + activate_debugger (); + } // on the fly switching fillmode from extra cycle to non-extra: blitter freezes // non-extra cycle to extra cycle: does not freeze but cycle diagram goes weird, @@ -1240,10 +1327,12 @@ static void blit_bltset (int con) } else if (iseo && !isen) { blit_frozen = 1; write_log (_T("BLITTER: frozen! %d (%d) -> %d (%d) %08X\n"), original_ch, iseo, blit_ch, isen, M68K_GETPC); + if (log_blitter & 16) + activate_debugger (); } else if (!iseo && isen) { if (!dmaen (DMA_BLITTER)) // subtle shades / nuance bootblock bug blit_frozen = 1; - if (log_blitter) + if (log_blitter) write_log (_T("BLITTER: on the fly %d (%d) -> %d (%d) switch\n"), original_ch, iseo, blit_ch, isen); } } @@ -1258,6 +1347,8 @@ static void blit_bltset (int con) if (changetable[o * 32 + n] < 10) { changetable[o * 32 + n]++; write_log (_T("BLITTER: channel mode changed while active (%02X->%02X) PC=%08x\n"), o, n, M68K_GETPC); + if (log_blitter & 16) + activate_debugger (); } } if (blit_ch == 13 && original_ch == 1) { @@ -1281,7 +1372,10 @@ static void blit_bltset (int con) if (v == 4) blit_nod = 0; } - + if (blit_dmacount2 == 0) { + ddat2use = 0; + ddat1use = 0; + } } static void blit_modset (void) @@ -1514,8 +1608,11 @@ void maybe_blit (int hpos, int hack) { static int warned = 10; + reset_channel_mods (); + if (bltstate == BLT_done) return; + if (savestate_state) return; @@ -1540,8 +1637,7 @@ void maybe_blit (int hpos, int hack) if (warned && dmaen (DMA_BLITTER) && blt_info.got_cycle) { warned--; - debugtest (DEBUGTEST_BLITTER, _T("program does not wait for blitter tc=%d\n"), - blit_cyclecounter); + debugtest (DEBUGTEST_BLITTER, _T("program does not wait for blitter tc=%d\n"), blit_cyclecounter); if (log_blitter) warned = 0; if (log_blitter & 2) { @@ -1566,6 +1662,22 @@ end:; blitter_delayed_debug = 1; } +void check_is_blit_dangerous (uaecptr *bplpt, int planes, int words) +{ + blitter_dangerous_bpl = 0; + if (bltstate == BLT_done || !currprefs.blitter_cycle_exact) + return; + // too simple but better than nothing + for (int i = 0; i < planes; i++) { + uaecptr bpl = bplpt[i]; + uaecptr dpt = bltdpt & chipmem_bank.mask; + if (dpt >= bpl - 2 * words && dpt < bpl + 2 * words) { + blitter_dangerous_bpl = 1; + return; + } + } +} + int blitnasty (void) { int cycles, ccnt; @@ -1615,6 +1727,11 @@ void blitter_slowdown (int ddfstrt, int ddfstop, int totalcycles, int freecycles blit_misscyclecounter += slow; } +void blitter_reset (void) +{ + bltptxpos = -1; +} + #ifdef SAVESTATE void restore_blitter_finish (void) diff --git a/blkdev.cpp b/blkdev.cpp index 15909661..0e196b03 100644 --- a/blkdev.cpp +++ b/blkdev.cpp @@ -229,7 +229,7 @@ void blkdev_fix_prefs (struct uae_prefs *p) } for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { - if (cdscsidevicetype[i] != SCSI_UNIT_DEFAULT) + if (cdscsidevicetype[i] != SCSI_UNIT_DEFAULT && (currprefs.scsi == 0 || currprefs.win32_uaescsimode < UAESCSI_SPTI)) continue; if (p->cdslots[i].inuse || p->cdslots[i].name[0]) { TCHAR *name = p->cdslots[i].name; diff --git a/cfgfile.cpp b/cfgfile.cpp index d39e52bd..bb5575b7 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -1035,6 +1035,10 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) _stprintf (tmp1, _T("joyportname%d"), i); cfgfile_write (f, tmp1, jp->configname); } + if (jp->nokeyboardoverride) { + _stprintf (tmp1, _T("joyport%dkeyboardoverride"), i); + cfgfile_write_bool (f, tmp1, !jp->nokeyboardoverride); + } } } if (p->dongle) { @@ -1078,7 +1082,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) write_resolution (f, _T("gfx_width_fullscreen"), _T("gfx_height_fullscreen"), &p->gfx_size_fs); cfgfile_write (f, _T("gfx_refreshrate"), _T("%d"), p->gfx_apmode[0].gfx_refreshrate); cfgfile_dwrite (f, _T("gfx_refreshrate_rtg"), _T("%d"), p->gfx_apmode[1].gfx_refreshrate); - cfgfile_write_bool (f, _T("gfx_autoresolution"), p->gfx_autoresolution); + cfgfile_write (f, _T("gfx_autoresolution"), _T("%d"), p->gfx_autoresolution); cfgfile_dwrite (f, _T("gfx_autoresolution_delay"), _T("%d"), p->gfx_autoresolution_delay); cfgfile_dwrite (f, _T("gfx_autoresolution_min_vertical"), vertmode[p->gfx_autoresolution_minv + 1]); cfgfile_dwrite (f, _T("gfx_autoresolution_min_horizontal"), horizmode[p->gfx_autoresolution_minh + 1]); @@ -1665,7 +1669,7 @@ static void set_chipset_mask (struct uae_prefs *p, int val) static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) { - int i; + int i, v; bool vb; TCHAR *section = 0; TCHAR *tmpp; @@ -1798,6 +1802,17 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) return 1; } + v = cfgfile_yesno (option, value, _T("gfx_autoresolution"), &vb); + if (v) { + if (v < 0) { + p->gfx_autoresolution = 0; + cfgfile_intval (option, value, _T("gfx_autoresolution"), &p->gfx_autoresolution, 1); + } else { + p->gfx_autoresolution = vb ? 10 : 0; + } + return 1; + } + if (cfgfile_intval (option, value, _T("sound_frequency"), &p->sound_freq, 1) || cfgfile_intval (option, value, _T("sound_max_buff"), &p->sound_maxbsiz, 1) || cfgfile_intval (option, value, _T("state_replay_rate"), &p->statecapturerate, 1) @@ -1816,7 +1831,6 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval (option, value, _T("gfx_left_windowed"), &p->gfx_size_win.y, 1) || cfgfile_intval (option, value, _T("gfx_refreshrate"), &p->gfx_apmode[APMODE_NATIVE].gfx_refreshrate, 1) || cfgfile_intval (option, value, _T("gfx_refreshrate_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_refreshrate, 1) - || cfgfile_yesno (option, value, _T("gfx_autoresolution"), &p->gfx_autoresolution) || cfgfile_intval (option, value, _T("gfx_autoresolution_delay"), &p->gfx_autoresolution_delay, 1) || cfgfile_intval (option, value, _T("gfx_backbuffers"), &p->gfx_apmode[APMODE_NATIVE].gfx_backbuffers, 1) || cfgfile_intval (option, value, _T("gfx_backbuffers_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_backbuffers, 1) @@ -2321,6 +2335,22 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) return 1; if (cfgfile_strval (option, value, _T("joyport3autofire"), &p->jports[3].autofire, joyaf, 0)) return 1; + if (cfgfile_yesno (option, value, _T("joyport0keyboardoverride"), &vb)) { + p->jports[0].nokeyboardoverride = !vb; + return 1; + } + if (cfgfile_yesno (option, value, _T("joyport1keyboardoverride"), &vb)) { + p->jports[1].nokeyboardoverride = !vb; + return 1; + } + if (cfgfile_yesno (option, value, _T("joyport2keyboardoverride"), &vb)) { + p->jports[2].nokeyboardoverride = !vb; + return 1; + } + if (cfgfile_yesno (option, value, _T("joyport3keyboardoverride"), &vb)) { + p->jports[3].nokeyboardoverride = !vb; + return 1; + } if (cfgfile_path (option, value, _T("statefile_quit"), p->quitstatefile, sizeof p->quitstatefile / sizeof (TCHAR))) return 1; @@ -5662,10 +5692,9 @@ static int bip_arcadia (struct uae_prefs *p, int config, int compa, int romcheck roms[2] = -1; if (!configure_rom (p, roms, romcheck)) return 0; - roms[0] = 49; - roms[1] = 50; - roms[2] = 51; - roms[3] = -1; + roms[0] = 51; + roms[1] = 49; + roms[2] = -1; if (!configure_rom (p, roms, romcheck)) return 0; rl = getarcadiaroms (); diff --git a/cia.cpp b/cia.cpp index 6b6fcc89..3be2da65 100644 --- a/cia.cpp +++ b/cia.cpp @@ -479,7 +479,7 @@ STATIC_INLINE bool ciab_checkalarm (bool inc, bool irq) // at least 1 or larger due to bus cycle delays when reading // old value. #if 1 - if ((munge24 (m68k_getpc ()) & 0xFFF80000) == 0xF80000) { + if ((munge24 (m68k_getpc ()) & 0xFFF80000) != 0xF80000) { if (ciabtod == 0 && ciabalarm == 0) return false; } @@ -888,7 +888,8 @@ static uae_u8 ReadCIAA (unsigned int addr) compute_passed_time (); #if CIAA_DEBUG_R > 0 - write_log (_T("R_CIAA: bfe%x01 %08X\n"), reg, M68K_GETPC); + if (CIAA_DEBUG_R > 1 || (munge24 (M68K_GETPC) & 0xFFF80000) != 0xF80000) + write_log (_T("R_CIAA: bfe%x01 %08X\n"), reg, M68K_GETPC); #endif switch (reg) { @@ -1017,8 +1018,10 @@ static uae_u8 ReadCIAB (unsigned int addr) int reg = addr & 15; #if CIAB_DEBUG_R > 0 - if ((addr >= 8 && addr <= 10) || CIAB_DEBUG_R > 1) - write_log (_T("R_CIAB: bfd%x00 %08X\n"), reg, M68K_GETPC); + if (CIAB_DEBUG_R > 1 || (munge24 (M68K_GETPC) & 0xFFF80000) != 0xF80000) { + if ((addr >= 8 && addr <= 10) || CIAB_DEBUG_R > 1) + write_log (_T("R_CIAB: bfd%x00 %08X\n"), reg, M68K_GETPC); + } #endif compute_passed_time (); @@ -1026,9 +1029,14 @@ static uae_u8 ReadCIAB (unsigned int addr) switch (reg) { case 0: tmp = 0; +#ifdef ARCADIA + // CD inactive, Arcadia bios 4.00 does not detect printer + if (arcadia_bios && !currprefs.use_serial) + tmp = 0x20; +#endif #ifdef SERIAL_PORT if (currprefs.use_serial) - tmp = serial_readstatus(ciabdra); + tmp = serial_readstatus (ciabdra); #endif #ifdef PARALLEL_PORT if (isprinter () > 0) { @@ -1631,10 +1639,16 @@ static uae_u32 REGPARAM2 cia_bget (uaecptr addr) v = (addr & 1) ? ReadCIAA (r) : ReadCIAB (r); break; case 1: - v = (addr & 1) ? 0xff : ReadCIAB (r); + if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) + v = (addr & 1) ? regs.irc : ReadCIAB (r); + else + v = (addr & 1) ? 0xff : ReadCIAB (r); break; case 2: - v = (addr & 1) ? ReadCIAA (r) : 0xff; + if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) + v = (addr & 1) ? ReadCIAA (r) : regs.irc >> 8; + else + v = (addr & 1) ? ReadCIAA (r) : 0xff; break; case 3: if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) diff --git a/custom.cpp b/custom.cpp index 438b17ff..b7793885 100644 --- a/custom.cpp +++ b/custom.cpp @@ -918,6 +918,7 @@ static uae_u32 fetched_aga1[MAX_PLANES]; /* Expansions from bplcon0/bplcon1. */ static int toscr_res, toscr_nr_planes, toscr_nr_planes2, toscr_nr_planes_agnus, fetchwidth; static int toscr_delay1, toscr_delay2; +static int toscr_delay_wait; /* The number of bits left from the last fetched words. This is an optimization - conceptually, we have to make sure the result is @@ -1038,6 +1039,7 @@ static void compute_toscr_delay_1 (int bplcon1) toscr_delay1 |= shdelay1 >> (RES_MAX - toscr_res); toscr_delay2 = (delay2 & delaymask) << toscr_res; toscr_delay2 |= shdelay2 >> (RES_MAX - toscr_res); + toscr_delay_wait = -1; } static void compute_toscr_delay (int hpos, int bplcon1) @@ -1046,7 +1048,7 @@ static void compute_toscr_delay (int hpos, int bplcon1) compute_toscr_delay_1 (bplcon1); } -static int bpldmasetuphpos; +static int bpldmasetuphpos, bpldmasetuphpos_diff; static int bpldmasetupphase; static void update_toscr_planes (int fm); /* set currently active Agnus bitplane DMA sequence */ @@ -1088,8 +1090,10 @@ static void setup_fmodes (int hpos) cycle_line[hpos - 1] = 1; curr_diagram = cycle_diagram_table[fetchmode][bplcon0_res][bplcon0_planes_limit]; estimate_last_fetch_cycle (hpos); +#ifdef DEBUGGER if (bpldmasetuphpos >= 0 && debug_dma) record_dma_event (DMA_EVENT_BPLFETCHUPDATE, hpos, vpos); +#endif bpldmasetuphpos = -1; bpldmasetupphase = 0; toscr_nr_planes_agnus = bplcon0_planes; @@ -1105,8 +1109,8 @@ static void BPLCON0_Denise (int hpos, uae_u16 v, bool); // (Note that Denise sees the change after 1 cycle) // AGA needs extra cycle in some specific situations (Brian The Lion "dialog") but not // in all situations (Superstardust weapon panel) -#define BPLCON_AGNUS_DELAY (4 + (bplcon0_planes == 8 ? 1 : 0)) -#define BPLCON_DENISE_DELAY 1 +#define BPLCON_AGNUS_DELAY (3 + (copper_access ? 1 : 0) + (bplcon0_planes == 8 ? 1 : 0)) +#define BPLCON_DENISE_DELAY (copper_access ? 1 : 0) static void maybe_setup_fmodes (int hpos) { @@ -1115,7 +1119,7 @@ static void maybe_setup_fmodes (int hpos) case 0: BPLCON0_Denise (hpos, bplcon0, false); bpldmasetupphase++; - bpldmasetuphpos += BPLCON_AGNUS_DELAY - BPLCON_DENISE_DELAY; + bpldmasetuphpos += bpldmasetuphpos_diff; break; case 1: setup_fmodes (hpos); @@ -1131,18 +1135,19 @@ STATIC_INLINE void maybe_check (int hpos) static void bpldmainitdelay (int hpos) { - int hposa; - - hposa = hpos + BPLCON_AGNUS_DELAY; ddf_change = vpos; - if (hposa < 0x14) { + if (hpos + BPLCON_AGNUS_DELAY < 0x14) { BPLCON0_Denise (hpos, bplcon0, false); setup_fmodes (hpos); return; } if (bpldmasetuphpos < 0) { - bpldmasetupphase = 0; bpldmasetuphpos = hpos + BPLCON_DENISE_DELAY; + bpldmasetuphpos_diff = BPLCON_AGNUS_DELAY - BPLCON_DENISE_DELAY; + bpldmasetupphase = 0; + if (BPLCON_DENISE_DELAY == 0) { + maybe_setup_fmodes (hpos); + } } } @@ -1287,25 +1292,22 @@ STATIC_INLINE void toscr_3_ecs (int nbits) int delay1 = toscr_delay1; int delay2 = toscr_delay2; int i; - uae_u32 mask = 0xFFFF >> (16 - nbits); - -#if 0 - int pos = thisline_decision.plfleft + out_offs * 16; - int checkpos = 220; + int shift = 16 - nbits; + uae_u32 mask = 0xFFFF >> shift; - if (pos < checkpos && pos + nbits >= checkpos) { + // if number of planes decrease (or go to zero), we still need to + // shift all possible remaining pixels out of Denise's shift register + for (i = 0; i < thisline_decision.nr_planes; i ++) { + outword[i] <<= nbits; } -#endif for (i = 0; i < toscr_nr_planes2; i += 2) { - outword[i] <<= nbits; - outword[i] |= (todisplay[i][0] >> (16 - nbits + delay1)) & mask; + outword[i] |= (todisplay[i][0] >> (shift + delay1)) & mask; todisplay[i][0] <<= nbits; //todisplay[i][0] &= ~(0xFFFF0000 << delay1); } for (i = 1; i < toscr_nr_planes2; i += 2) { - outword[i] <<= nbits; - outword[i] |= (todisplay[i][0] >> (16 - nbits + delay2)) & mask; + outword[i] |= (todisplay[i][0] >> (shift + delay2)) & mask; todisplay[i][0] <<= nbits; //todisplay[i][0] &= ~(0xFFFF0000 << delay2); } @@ -1377,7 +1379,7 @@ static void toscr_2_1 (int nbits) { toscr_3_aga (nbits, 1); } static void toscr_2_2 (int nbits) { toscr_3_aga (nbits, 2); } #endif -STATIC_INLINE void toscr_1 (int nbits, int fm) +STATIC_INLINE void do_tosrc (int nbits, int fm) { switch (fm) { case 0: @@ -1392,6 +1394,22 @@ STATIC_INLINE void toscr_1 (int nbits, int fm) break; #endif } +} + +STATIC_INLINE void toscr_1 (int nbits, int fm) +{ + // bplcon1 has small delay before bitplane delays change + if (toscr_delay_wait >= 0) { + if (toscr_delay_wait >= nbits) { + toscr_delay_wait -= nbits; + } else { + nbits -= toscr_delay_wait; + do_tosrc (toscr_delay_wait, fm); + compute_toscr_delay_1 (bplcon1); + } + } + do_tosrc (nbits, fm); + out_nbits += nbits; if (out_nbits == 32) { int i; @@ -1493,17 +1511,9 @@ STATIC_INLINE void fetch_start (int hpos) } -/* Called when all planes have been fetched, i.e. when a new block -of data is available to be displayed. The data in fetched[] is -moved into todisplay[]. */ -STATIC_INLINE void beginning_of_plane_block (int hpos, int fm) +STATIC_INLINE void beginning_of_plane_block_copy (int fm) { int i; - int oleft = thisline_decision.plfleft; - static uae_u16 bplcon1t, bplcon1t2; - - flush_display (fm); - if (fm == 0) for (i = 0; i < MAX_PLANES; i++) { todisplay[i][0] |= fetched[i]; @@ -1516,20 +1526,22 @@ STATIC_INLINE void beginning_of_plane_block (int hpos, int fm) todisplay[i][0] = fetched_aga0[i]; } #endif +} + +/* Called when all planes have been fetched, i.e. when a new block +of data is available to be displayed. The data in fetched[] is +moved into todisplay[]. */ +STATIC_INLINE void beginning_of_plane_block (int hpos, int fm) +{ + flush_display (fm); + beginning_of_plane_block_copy (fm); update_denise (hpos); if (toscr_nr_planes_agnus > thisline_decision.nr_planes) update_toscr_planes (fm); maybe_first_bpl1dat (hpos); - - bplcon1t2 = bplcon1t; - bplcon1t = bplcon1; - // writing to BPLCON1 1 cycle after BPL1DAT access will - // not (except first BPL1DAT write) affect the display - // until next display block - if (bplcon1_hpos != hpos || oleft < 0) - bplcon1t2 = bplcon1t; - compute_toscr_delay (hpos, bplcon1t2); + // BPL1DAT write seems to reset bitplane delay position immediately + compute_toscr_delay (hpos, bplcon1); } #ifdef SPEEDUP @@ -1587,7 +1599,7 @@ STATIC_INLINE void long_fetch_ecs (int plane, int nwords, int weird_number_of_bi real_pt++; } } - fetched[plane] = fetchval; + bplxdat[plane] = fetched[plane] = fetchval; todisplay[plane][0] = shiftbuffer; outword[plane] = outval; } @@ -2023,13 +2035,10 @@ STATIC_INLINE void update_fetch (int until, int fm) if (plf_state < plf_wait_stop && ddf_change != vpos && ddf_change + 1 != vpos && dma && (fetch_cycle & fetchstart_mask) == (fm_maxplane & fetchstart_mask) - && !badmode && !debug_dma -# if 0 - /* @@@ We handle this case, but the code would be simpler if we - * disallowed it - it may even be possible to guarantee that - * this condition never is false. Later. */ - && (out_nbits & 15) == 0 -# endif + && !badmode +#ifdef DEBUGGER + && !debug_dma +#endif && toscr_nr_planes == thisline_decision.nr_planes) { int offs = (pos - fetch_cycle) & fetchunit_mask; @@ -2108,6 +2117,19 @@ STATIC_INLINE void decide_fetch (int hpos) } } +STATIC_INLINE void decide_fetch_safe (int hpos) +{ + if (!blitter_dangerous_bpl) { + decide_fetch (hpos); + decide_blitter (hpos); + } else { + while (hpos > last_fetch_hpos) { + decide_fetch (last_fetch_hpos + 1); + decide_blitter (last_fetch_hpos + 1); + } + } +} + static void reset_bpl_vars (void) { out_nbits = 0; @@ -2210,7 +2232,8 @@ STATIC_INLINE void decide_line (int hpos) ddf_change = vpos; } } - if (vpos == plflastline) { + // last line of field can never have bitplane dma active + if (vpos == plflastline || vpos >= maxvpos + lof_store - 1) { diwstate = DIW_waiting_start; ddf_change = vpos; } @@ -2759,9 +2782,7 @@ static void decide_sprites (int hpos) { int nrs[MAX_SPRITES * 2], posns[MAX_SPRITES * 2]; int count, i; - /* apparantly writes to custom registers happen in the 3/4th of cycle - * and sprite xpos comparator sees it immediately */ - int point = hpos * 2 - 4; + int point = hpos * 2 + 1; int width = sprite_width; int sscanmask = 0x100 << sprite_buffer_res; int gotdata = 0; @@ -2898,7 +2919,7 @@ static void finish_decisions (void) decide_diw (hpos); decide_line (hpos); - decide_fetch (hpos); + decide_fetch_safe (hpos); finish_final_fetch (); record_color_change2 (hsyncstartpos, 0xffff, 0); @@ -3046,6 +3067,14 @@ static void reset_decisions (void) if (plf_state == plf_active && !(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) plf_state = plf_idle; + /* ECS/AGA and ddfstop > maxhpos == always-on display */ + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { + if (plfstop > maxhpos) + plfstrt = 0; + if (plfstrt < HARD_DDF_START) + plfstrt = HARD_DDF_START; + } + memset (todisplay, 0, sizeof todisplay); memset (fetched, 0, sizeof fetched); #ifdef AGA @@ -3124,7 +3153,7 @@ void compute_vsynctime (void) svpos += 1.0; } double clk = svpos * shpos * fake_vblank_hz; - write_log (_T("SNDRATE %.1f*%.1f*%.6f=%.6f\n"), svpos, shpos, fake_vblank_hz, clk); + //write_log (_T("SNDRATE %.1f*%.1f*%.6f=%.6f\n"), svpos, shpos, fake_vblank_hz, clk); update_sound (clk); } } @@ -3578,14 +3607,7 @@ static void calcdiw (void) plfstrt = ddfstrt; plfstop = ddfstop; - /* probably not the correct place.. should use plf_state instead */ - if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { - /* ECS/AGA and ddfstop > maxhpos == always-on display */ - if (plfstop > maxhpos) - plfstrt = 0; - if (plfstrt < HARD_DDF_START) - plfstrt = HARD_DDF_START; - } else { + if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) { /* OCS and ddfstrt >= ddfstop == ddfstop = max */ if (plfstrt >= plfstop && plfstrt >= HARD_DDF_START) plfstop = 0xff; @@ -3647,8 +3669,7 @@ STATIC_INLINE uae_u16 DENISEID (int *missing) STATIC_INLINE uae_u16 DMACONR (int hpos) { decide_line (hpos); - decide_fetch (hpos); - decide_blitter (hpos); + decide_fetch_safe (hpos); dmacon &= ~(0x4000 | 0x2000); dmacon |= ((blit_interrupt || (!blit_interrupt && currprefs.cs_agnusbltbusybug && !blt_info.got_cycle)) ? 0 : 0x4000) | (blt_info.blitzero ? 0x2000 : 0); @@ -3907,6 +3928,7 @@ static void compute_spcflag_copper (int hpos); static void COPJMP (int num, int vblank) { int oldstrobe = cop_state.strobe; + bool wasstopped = cop_state.state == COP_stop; #if CUSTOM_DEBUG > 0 if (dmaen (DMA_COPPER) && (cop_state.saved_i1 != 0xffff || cop_state.saved_i2 != 0xfffe)) @@ -3915,6 +3937,7 @@ static void COPJMP (int num, int vblank) unset_special (SPCFLAG_COPPER); cop_state.ignore_next = 0; + if (!oldstrobe) cop_state.state_prev = cop_state.state; if ((cop_state.state == COP_wait || cop_state.state == COP_waitforever) && !vblank) { @@ -3934,7 +3957,7 @@ static void COPJMP (int num, int vblank) if (dmaen (DMA_COPPER)) { compute_spcflag_copper (current_hpos ()); - } else if (oldstrobe > 0 && oldstrobe != num && cop_state.state_prev == COP_wait) { + } else if (wasstopped || (oldstrobe > 0 && oldstrobe != num && cop_state.state_prev == COP_wait)) { /* dma disabled, copper idle and accessed both COPxJMPs -> copper stops! */ cop_state.state = COP_stop; } @@ -3953,8 +3976,7 @@ static void DMACON (int hpos, uae_u16 v) uae_u16 oldcon = dmacon; decide_line (hpos); - decide_fetch (hpos); - decide_blitter (hpos); + decide_fetch_safe (hpos); setclr (&dmacon, v); dmacon &= 0x1FFF; @@ -3979,8 +4001,10 @@ static void DMACON (int hpos, uae_u16 v) #if 0 int oldb = (oldcon & DMA_BLITTER) && (oldcon & DMA_MASTER); int newb = (dmacon & DMA_BLITTER) && (dmacon & DMA_MASTER); - int oldbn = (oldcon & DMA_BLITPRI); - int newbn = (dmacon & DMA_BLITPRI); + int oldbn = (oldcon & DMA_BLITPRI) != 0; + int newbn = (dmacon & DMA_BLITPRI) != 0; + if (oldbn != newbn) + write_log (_T("BLITTER NASTY: %d -> %d %08x\n"), oldbn, newbn, m68k_getpc ()); #endif #if SPRITE_DEBUG > 0 @@ -4056,6 +4080,8 @@ STATIC_INLINE int use_eventmode (uae_u16 v) return 1; if (v & 0x8000) return 1; + if (event2_count) + return 1; return 0; } @@ -4067,7 +4093,10 @@ static void send_interrupt_do (uae_u32 v) void send_interrupt (int num, int delay) { if (use_eventmode (0x8000) && delay > 0) { - if (!(intreq & (1 << num))) + // always queue interrupt if it is active because + // next instruction in bad code can switch it off.. + // Absolute Inebriation / Virtual Dreams "big glenz" part + if (!(intreq & (1 << num)) || (intena & (1 << num))) event2_newevent_xx (-1, delay, num, send_interrupt_do); } else { send_interrupt_do (num); @@ -4135,7 +4164,8 @@ void INTREQ_0 (uae_u16 v) if (use_eventmode (v)) { // don't bother to waste time for interrupt queuing if nothing changes - if (old == intreq && intreq_internal == intreq) + // but only if we are sure there is no queued changes + if (event2_count == 0 && old == intreq && intreq_internal == intreq) return; event2_newevent_xx (-1, INT_PROCESSING_DELAY, intreq, send_intreq_do); } else { @@ -4227,10 +4257,15 @@ void set_picasso_hack_rate (int hz) #endif +static void dcheck_is_blit_dangerous (void) +{ + check_is_blit_dangerous (bplpt, bplcon0_planes, 50 << bplcon0_res); +} + static void BPLxPTH (int hpos, uae_u16 v, int num) { decide_line (hpos); - decide_fetch (hpos); + decide_fetch_safe (hpos); if (copper_access && is_bitplane_dma (hpos + 1) == num + 1) { dbplpth[num] = (v << 16) & 0xffff0000; dbplpth_on[num] = hpos; @@ -4241,12 +4276,13 @@ static void BPLxPTH (int hpos, uae_u16 v, int num) bplpt[num] = (bplpt[num] & 0x0000ffff) | ((uae_u32)v << 16); bplptx[num] = (bplptx[num] & 0x0000ffff) | ((uae_u32)v << 16); + dcheck_is_blit_dangerous (); //write_log (_T("%d:%d:BPL%dPTH %08X COP=%08x\n"), hpos, vpos, num, bplpt[num], cop_state.ip); } static void BPLxPTL (int hpos, uae_u16 v, int num) { decide_line (hpos); - decide_fetch (hpos); + decide_fetch_safe (hpos); reset_dbplh (hpos, num); //reset_dbpl (hpos, num); /* chipset feature: BPLxPTL write and next cycle doing DMA fetch using same pointer register -> @@ -4269,6 +4305,7 @@ static void BPLxPTL (int hpos, uae_u16 v, int num) } bplpt[num] = (bplpt[num] & 0xffff0000) | (v & 0x0000fffe); bplptx[num] = (bplptx[num] & 0xffff0000) | (v & 0x0000fffe); + dcheck_is_blit_dangerous (); //write_log (_T("%d:%d:BPL%dPTL %08X COP=%08x\n"), hpos, vpos, num, bplpt[num], cop_state.ip); } @@ -4290,7 +4327,14 @@ static void BPLCON0_Denise (int hpos, uae_u16 v, bool immediate) // fake unused 0x0080 bit as an EHB bit (see below) if (isehb (bplcon0d, bplcon2)) v |= 0x80; - +#if 0 + if (hpos >= 0x18 && is_bitplane_dma (hpos - 2) == 1) { + for (int i = 0; i < MAX_PLANES; i++) { + if (i >= GET_PLANES (bplcon0)) + todisplay[i][0] = 0; + } + } +#endif if (immediate) { record_register_change (hpos, 0x100, v); } else { @@ -4324,6 +4368,9 @@ static void BPLCON0 (int hpos, uae_u16 v) return; ddf_change = vpos; + decide_diw (hpos); + decide_line (hpos); + decide_fetch_safe (hpos); if (!issyncstopped ()) { vpos_previous = vpos; @@ -4332,6 +4379,15 @@ static void BPLCON0 (int hpos, uae_u16 v) if (bplcon0 & 4) bplcon0_interlace_seen = true; + +#if 0 + if (is_bitplane_dma (hpos - 1) == 1) { + //write_log (_T("%d %d\n"), GET_PLANES (bplcon0), GET_PLANES (v)); + for (int i = GET_PLANES (v); i < GET_PLANES (bplcon0); i++) { + fetched[i] &= ~0xffff0ff0; + } + } +#endif bplcon0 = v; @@ -4349,9 +4405,13 @@ STATIC_INLINE void BPLCON1 (int hpos, uae_u16 v) return; ddf_change = vpos; decide_line (hpos); - decide_fetch (hpos); + decide_fetch_safe (hpos); bplcon1_hpos = hpos; bplcon1 = v; + if (thisline_decision.plfleft < 0) + compute_toscr_delay (hpos, bplcon1); + else + toscr_delay_wait = 4; } STATIC_INLINE void BPLCON2 (int hpos, uae_u16 v) @@ -4404,7 +4464,7 @@ static void BPL1MOD (int hpos, uae_u16 v) v &= ~1; if ((uae_s16)bpl1mod != (uae_s16)v) { decide_line (hpos); - decide_fetch (hpos); + decide_fetch_safe (hpos); } // write to BPLxMOD one cycle before // BPL fetch that also adds modulo: @@ -4423,7 +4483,7 @@ static void BPL2MOD (int hpos, uae_u16 v) v &= ~1; if ((uae_s16)bpl2mod != (uae_s16)v) { decide_line (hpos); - decide_fetch (hpos); + decide_fetch_safe (hpos); } if (1 && (is_bitplane_dma (hpos + 1) & 2)) { dbpl2mod = v; @@ -4442,7 +4502,7 @@ static void BPLxDAT (int hpos, int num, uae_u16 v) // only BPL0DAT access can do anything visible if (num == 0 && hpos >= 7) { decide_line (hpos); - decide_fetch (hpos); + decide_fetch_safe (hpos); } bplxdat[num] = v; if (num == 0 && hpos >= 7) { @@ -4523,8 +4583,7 @@ static void DDFSTOP (int hpos, uae_u16 v) return; ddf_change = vpos; decide_line (hpos); - decide_fetch (hpos); - decide_blitter (hpos); + decide_fetch_safe (hpos); ddfstop = v; calcdiw (); if (fetch_state != fetch_not_started) @@ -4598,14 +4657,94 @@ static void BLTCON1 (int hpos, uae_u16 v) { maybe_blit (hpos, 2); bltcon1 = v; r static void BLTAFWM (int hpos, uae_u16 v) { maybe_blit (hpos, 2); blt_info.bltafwm = v; reset_blit (0); } static void BLTALWM (int hpos, uae_u16 v) { maybe_blit (hpos, 2); blt_info.bltalwm = v; reset_blit (0); } -static void BLTAPTH (int hpos, uae_u16 v) { maybe_blit (hpos, 0); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); } -static void BLTAPTL (int hpos, uae_u16 v) { maybe_blit (hpos, 0); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); } -static void BLTBPTH (int hpos, uae_u16 v) { maybe_blit (hpos, 0); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTBPTL (int hpos, uae_u16 v) { maybe_blit (hpos, 0); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); } -static void BLTCPTH (int hpos, uae_u16 v) { maybe_blit (hpos, 0); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTCPTL (int hpos, uae_u16 v) { maybe_blit (hpos, 0); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); } -static void BLTDPTH (int hpos, uae_u16 v) { maybe_blit (hpos, 0); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTDPTL (int hpos, uae_u16 v) { maybe_blit (hpos, 0); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); } +static void BLTAPTH (int hpos, uae_u16 v) +{ + maybe_blit (hpos, 0); + if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_cycle_exact) { + bltptx = (bltapt & 0xffff) | ((uae_u32)v << 16); + bltptxpos = hpos; + bltptxc = 1; + } else { + bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); + } +} +static void BLTAPTL (int hpos, uae_u16 v) +{ + maybe_blit (hpos, 0); + if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_cycle_exact) { + bltptx = (bltapt & ~0xffff) | (v & 0xFFFE); + bltptxpos = hpos; + bltptxc = 1; + } else { + bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); + } +} +static void BLTBPTH (int hpos, uae_u16 v) +{ + maybe_blit (hpos, 0); + if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_cycle_exact) { + bltptx = (bltapt & 0xffff) | ((uae_u32)v << 16); + bltptxpos = hpos; + bltptxc = 2; + } else { + bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); + } +} +static void BLTBPTL (int hpos, uae_u16 v) +{ + maybe_blit (hpos, 0); + if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_cycle_exact) { + bltptx = (bltbpt & ~0xffff) | (v & 0xFFFE); + bltptxpos = hpos; + bltptxc = 2; + } else { + bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); + } +} +static void BLTCPTH (int hpos, uae_u16 v) +{ + maybe_blit (hpos, 0); + if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_cycle_exact) { + bltptx = (bltcpt & 0xffff) | ((uae_u32)v << 16); + bltptxpos = hpos; + bltptxc = 3; + } else { + bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); + } +} +static void BLTCPTL (int hpos, uae_u16 v) +{ + maybe_blit (hpos, 0); + if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_cycle_exact) { + bltptx = (bltcpt & ~0xffff) | (v & 0xFFFE); + bltptxpos = hpos; + bltptxc = 3; + } else { + bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); + } +} +static void BLTDPTH (int hpos, uae_u16 v) +{ + maybe_blit (hpos, 0); + if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_cycle_exact) { + bltptx = (bltdpt & 0xffff) | ((uae_u32)v << 16); + bltptxpos = hpos; + bltptxc = 4; + } else { + bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); + } +} +static void BLTDPTL (int hpos, uae_u16 v) +{ + maybe_blit (hpos, 0); + if (bltstate != BLT_done && currprefs.blitter_cycle_exact && currprefs.cpu_cycle_exact) { + bltptx = (bltdpt & ~0xffff) | (v & 0xFFFE); + bltptxpos = hpos; + bltptxc = 4; + } else { + bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); + } +} static void BLTSIZE (int hpos, uae_u16 v) { @@ -4618,6 +4757,7 @@ static void BLTSIZE (int hpos, uae_u16 v) if (!blt_info.hblitsize) blt_info.hblitsize = 64; do_blitter (hpos, copper_access); + dcheck_is_blit_dangerous (); } static void BLTSIZV (int hpos, uae_u16 v) @@ -4661,7 +4801,7 @@ STATIC_INLINE void spr_arm (int num, int state) STATIC_INLINE void sprstartstop (struct sprite *s) { - if (vpos < sprite_vblank_endline) + if (vpos < sprite_vblank_endline || vpos >= maxvpos + lof_store - 1) return; if (vpos == s->vstart) s->dmastate = 1; @@ -4760,8 +4900,24 @@ STATIC_INLINE void SPRxDATB_1 (uae_u16 v, int num, int hpos) } #endif } -static void SPRxDATA (int hpos, uae_u16 v, int num) { decide_sprites (hpos); SPRxDATA_1 (v, num, hpos); } -static void SPRxDATB (int hpos, uae_u16 v, int num) { decide_sprites (hpos); SPRxDATB_1 (v, num, hpos); } + +// hpos - 1 is a hack! There is 1 cycle delay before SPRxPOS matches and DATx are copied to +// shift register, it is easier and much faster to emulate this way, than to separate +// decide_sprites() in two parts. +// Shed Tears / Ozone scroller +static void SPRxDATA (int hpos, uae_u16 v, int num) +{ + int hp = hpos == 0 ? 0 : hpos - 1; + decide_sprites (hp); + SPRxDATA_1 (v, num, hp); +} +static void SPRxDATB (int hpos, uae_u16 v, int num) +{ + int hp = hpos == 0 ? 0 : hpos - 1; + decide_sprites (hp); + SPRxDATB_1 (v, num, hp); +} + static void SPRxCTL (int hpos, uae_u16 v, int num) { decide_sprites (hpos); SPRxCTL_1 (v, num, hpos); } static void SPRxPOS (int hpos, uae_u16 v, int num) { decide_sprites (hpos); SPRxPOS_1 (v, num, hpos); } static void SPRxPTH (int hpos, uae_u16 v, int num) @@ -4992,8 +5148,13 @@ STATIC_INLINE int copper_cant_read2 (int hpos, int alloc) if (hpos + 1 >= maxhpos) // first refresh slot return 1; if ((hpos == maxhpos - 3) && (maxhpos & 1) && alloc >= 0) { - if (alloc) + if (alloc) { alloc_cycle (hpos, CYCLE_COPPER); +#ifdef DEBUGGER + if (debug_dma) + record_dma_event (DMA_EVENT_COPPERWANTED, hpos, vpos); +#endif + } return -1; } return is_bitplane_dma_inline (hpos); @@ -5002,8 +5163,10 @@ STATIC_INLINE int copper_cant_read2 (int hpos, int alloc) static int copper_cant_read (int hpos, int alloc) { int cant = copper_cant_read2 (hpos, alloc); +#ifdef DEBUGGER if (cant && debug_dma && alloc) record_dma_event (DMA_EVENT_COPPERWANTED, hpos, vpos); +#endif return cant; } @@ -5011,7 +5174,7 @@ static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget) { int v; - value = debug_wputpeekdma_chipset (0xdff000 + addr, value); + value = debug_wputpeekdma_chipset (0xdff000 + addr, value, 0x08c); copper_access = 1; v = custom_wput_1 (hpos, addr, value, noget); copper_access = 0; @@ -5046,7 +5209,7 @@ static int customdelay[]= { /* SPRxPTH/SPRxPTL */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */ /* SPRxPOS/SPRxCTL/SPRxDATA/SPRxDATB */ - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* COLORxx */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* RESERVED */ @@ -5090,7 +5253,7 @@ static void update_copper (int until_hpos) /* So we know about the fetch state. */ decide_line (c_hpos); - decide_fetch (c_hpos); + decide_fetch_safe (c_hpos); if (cop_state.movedelay > 0) { cop_state.movedelay--; @@ -5126,13 +5289,24 @@ static void update_copper (int until_hpos) // Cycle is used and needs to be free. if (copper_cant_read (old_hpos, 1)) continue; - cop_state.state = COP_strobe_delay2; alloc_cycle (old_hpos, CYCLE_COPPER); #ifdef DEBUGGER if (debug_dma) record_dma (0x8c, chipmem_wget_indirect (cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER); #endif - cop_state.ip += 2; + if (old_hpos == maxhpos - 2) { + // if COP_strobe_delay2 would cross scanlines (positioned immediately + // after first strobe/refresh slot) it will disappear! + cop_state.state = COP_read1; + if (cop_state.strobe == 1) + cop_state.ip = cop1lc; + else + cop_state.ip = cop2lc; + cop_state.strobe = 0; + } else { + cop_state.state = COP_strobe_delay2; + cop_state.ip += 2; + } break; case COP_strobe_delay2: // Second cycle after COPJMP. This is the strange one. @@ -5140,8 +5314,10 @@ static void update_copper (int until_hpos) // But it still gets allocated by copper if it is free = CPU and blitter can't use it. if (!copper_cant_read (old_hpos, 0)) { alloc_cycle (old_hpos, CYCLE_COPPER); +#ifdef DEBUGGER if (debug_dma) record_dma (0x1fe, chipmem_wget_indirect (cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER); +#endif } cop_state.state = COP_read1; // Next cycle finally reads from new pointer @@ -5164,8 +5340,10 @@ static void update_copper (int until_hpos) if (copper_cant_read (old_hpos, 1)) continue; cycle_line[old_hpos] |= CYCLE_COPPER_SPECIAL; +#ifdef DEBUGGER if (debug_dma) record_dma (0x1fe, chipmem_wget_indirect (cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER); +#endif cop_state.state = COP_read1; // Next cycle finally reads from new pointer if (cop_state.strobe == 1) @@ -5181,8 +5359,10 @@ static void update_copper (int until_hpos) continue; cop_state.state = COP_read1; alloc_cycle (old_hpos, CYCLE_COPPER); +#ifdef DEBUGGER if (debug_dma) record_dma (0x1fe, 0, 0xffffffff, old_hpos, vpos, DMARECORD_COPPER); +#endif cop_state.ip = cop1lc; break; @@ -5340,10 +5520,9 @@ static void update_copper (int until_hpos) goto out; } } +#ifdef DEBUGGER if (debug_dma) record_dma_event (DMA_EVENT_COPPERWAKE, old_hpos, vp); - -#ifdef DEBUGGER if (debug_copper) record_copper (cop_state.ip - 4, cop_state.saved_i1, cop_state.saved_i2, old_hpos, vpos); #endif @@ -5673,6 +5852,26 @@ static void do_sprites (int hpos) if (vpos < sprite_vblank_endline) return; + if (vpos >= maxvpos + lof_store - 1) { + // It is also possible armed status is cleared + // I am not sure so lets start with clearing + // data only + if (dmaen (DMA_SPRITE)) { + for (i = 0; i < MAX_SPRITES; i++) { + sprdata[i][0] = 0; + sprdatb[i][0] = 0; +#ifdef AGA + sprdata[i][1] = 0; + sprdatb[i][1] = 0; + sprdata[i][2] = 0; + sprdatb[i][2] = 0; + sprdata[i][3] = 0; + sprdatb[i][3] = 0; +#endif + } + } + return; + } if (doflickerfix () && interlace_seen && (next_lineno & 1)) return; @@ -6387,10 +6586,12 @@ static void vsync_handler_post (void) lof_lace = false; } +#ifdef DEBUGGER if (debug_copper) record_copper_reset (); if (debug_dma) record_dma_reset (); +#endif #ifdef PICASSO96 if (p96refresh_active) { @@ -6458,7 +6659,9 @@ static void hsync_scandoubler (void) next_lineno++; scandoubled_line = 1; +#ifdef DEBUGGER debug_dma = 0; +#endif for (i = 0; i < 8; i++) { int diff; @@ -6920,7 +7123,7 @@ static void hsync_handler_post (bool onvsync) nextline_how = nln_normal; if (doflickerfix () && interlace_seen > 0) { lineno *= 2; - } else if (currprefs.gfx_scanlines >= 2) { + } else if (currprefs.gfx_vresolution && currprefs.gfx_scanlines >= 2) { lineno *= 2; nextline_how = currprefs.gfx_vresolution > VRES_NONDOUBLE && (currprefs.gfx_scanlines & 1) == 0 ? nln_doubled : nln_nblack; if (interlace_seen) { @@ -7125,18 +7328,24 @@ void custom_reset (bool hardreset, bool keyboardreset) vsync_counter = 0; currprefs.chipset_mask = changed_prefs.chipset_mask; update_mirrors (); - if (!aga_mode) { - for (i = 0; i < 32; i++) { - current_colors.color_regs_ecs[i] = 0; - current_colors.acolors[i] = getxcolor (0); - } -#ifdef AGA - } else { - for (i = 0; i < 256; i++) { - current_colors.color_regs_aga[i] = 0; - current_colors.acolors[i] = getxcolor (0); + blitter_reset (); + + if (hardreset) { + if (!aga_mode) { + uae_u16 c = (currprefs.chipset_mask & CSMASK_ECS_DENISE) ? 0xfff : 0x000; + for (i = 0; i < 32; i++) { + current_colors.color_regs_ecs[i] = c; + current_colors.acolors[i] = getxcolor (c); + } + #ifdef AGA + } else { + uae_u32 c = 0; + for (i = 0; i < 256; i++) { + current_colors.color_regs_aga[i] = c; + current_colors.acolors[i] = getxcolor (c); + } + #endif } -#endif } clxdat = 0; @@ -7491,8 +7700,7 @@ writeonly: uae_u16 old = last_custom_value1; uae_u16 l = currprefs.cpu_compatible && currprefs.cpu_model == 68000 ? regs.irc : ((currprefs.chipset_mask & CSMASK_AGA) ? old : 0xffff); decide_line (hpos); - decide_fetch (hpos); - decide_blitter (hpos); + decide_fetch_safe (hpos); debug_wputpeek (0xdff000 + addr, l); r = custom_wput_1 (hpos, addr, l, 1); if (r) { // register don't exist @@ -8122,13 +8330,15 @@ uae_u8 *save_custom (int *len, uae_u8 *dstptr, int full) if (full) { for (i = 0; i < 8; i++) { SL (spr[i].pt); /* 120-13E SPRxPT */ + } + for (i = 0; i < 8; i++) { SW (sprpos[i]); /* 1x0 SPRxPOS */ SW (sprctl[i]); /* 1x2 SPRxPOS */ SW (sprdata[i][0]); /* 1x4 SPRxDATA */ SW (sprdatb[i][0]); /* 1x6 SPRxDATB */ } } - for ( i = 0; i < 32; i++) { + for (i = 0; i < 32; i++) { if (currprefs.chipset_mask & CSMASK_AGA) { uae_u32 v = current_colors.color_regs_aga[i]; uae_u16 v2; @@ -8504,7 +8714,7 @@ STATIC_INLINE void sync_copper (int hpos) STATIC_INLINE void decide_fetch_ce (int hpos) { - if ((ddf_change == vpos || ddf_change + 1 == vpos) && vpos < current_maxvpos ()) + if ((ddf_change == vpos || ddf_change + 1 == vpos || blitter_dangerous_bpl) && vpos < current_maxvpos ()) decide_fetch (hpos); } @@ -8575,12 +8785,12 @@ uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode) { uae_u32 v = 0; int hpos; - struct dma_rec *dr; hpos = dma_cycle (); x_do_cycles_pre (CYCLE_UNIT); #ifdef DEBUGGER + struct dma_rec *dr = NULL; if (debug_dma) { int reg = 0x1000; if (mode < 0) @@ -8615,13 +8825,13 @@ uae_u32 wait_cpu_cycle_read_ce020 (uaecptr addr, int mode) { uae_u32 v = 0; int hpos; - struct dma_rec *dr; sync_ce020 (); hpos = dma_cycle (); x_do_cycles_pre (CYCLE_UNIT); #ifdef DEBUGGER + struct dma_rec *dr = NULL; if (debug_dma) { int reg = 0x1000; if (mode < 0) diff --git a/debug.cpp b/debug.cpp index f896c939..7dda4138 100644 --- a/debug.cpp +++ b/debug.cpp @@ -1067,8 +1067,9 @@ void debug_draw_cycles (uae_u8 *buf, int bpp, int line, int width, int height, u cc[DMARECORD_CPU] = lc(0x888888); cc[DMARECORD_COPPER] = lc(0xeeee00); cc[DMARECORD_AUDIO] = lc(0xff0000); - cc[DMARECORD_BLITTER] = lc(0x00ff00); - cc[DMARECORD_BLITTER_LINE] = lc(0x008800); + cc[DMARECORD_BLITTER] = lc(0x008888); + cc[DMARECORD_BLITTER_FILL] = lc(0x0088ff); + cc[DMARECORD_BLITTER_LINE] = lc(0x00ff00); cc[DMARECORD_BITPLANE] = lc(0x0000ff); cc[DMARECORD_SPRITE] = lc(0xff00ff); cc[DMARECORD_DISK] = lc(0xffffff); @@ -1079,7 +1080,7 @@ void debug_draw_cycles (uae_u8 *buf, int bpp, int line, int width, int height, u xx = x * xplus + dx; dr = &dma_record[t][y * NR_DMA_REC_HPOS + x]; if (dr->reg != 0xffff) { - c = cc[dr->type]; + c = cc[dr->type]; } if (dr->intlev > intlev) intlev = dr->intlev; @@ -1093,8 +1094,26 @@ void debug_draw_cycles (uae_u8 *buf, int bpp, int line, int width, int height, u putpixel (buf, bpp, dx + 3, 0); } +static struct memory_heatmap *heatmap; +struct memory_heatmap +{ + uae_u16 cnt; + uae_u16 type; +}; +static void memwatch_heatmap (uaecptr addr, int rwi, int size) +{ +} +static void record_dma_heatmap (uaecptr addr, int type) +{ + if (currprefs.address_space_24 || !heatmap) + return; + struct memory_heatmap *hp = &heatmap[addr / 2]; + if (hp->type != type) + hp->cnt = 0; + hp->type = type; +} void record_dma_event (int evt, int hpos, int vpos) { @@ -1112,6 +1131,8 @@ struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, in { struct dma_rec *dr; + if (!heatmap) + heatmap = xcalloc (struct memory_heatmap, 16 * 1024 * 1024 / 2); if (!dma_record[0]) { dma_record[0] = xmalloc (struct dma_rec, NR_DMA_REC_HPOS * NR_DMA_REC_VPOS); dma_record[1] = xmalloc (struct dma_rec, NR_DMA_REC_HPOS * NR_DMA_REC_VPOS); @@ -1120,6 +1141,9 @@ struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, in } if (hpos >= NR_DMA_REC_HPOS || vpos >= NR_DMA_REC_VPOS) return NULL; + + record_dma_heatmap (addr, type); + dr = &dma_record[dma_record_toggle][vpos * NR_DMA_REC_HPOS + hpos]; if (dr->reg != 0xffff) { write_log (_T("DMA conflict: v=%d h=%d OREG=%04X NREG=%04X\n"), vpos, hpos, dr->reg, reg); @@ -1210,7 +1234,7 @@ static void decode_dma_record (int hpos, int vpos, int toggle, bool logfile) cl2 = cl; if (dr->evt & DMA_EVENT_BLITNASTY) l3[cl2++] = 'N'; - if (dr->evt & DMA_EVENT_BLITFINISHED) + if (dr->evt & DMA_EVENT_BLITSTARTFINISH) l3[cl2++] = 'B'; if (dr->evt & DMA_EVENT_BLITIRQ) l3[cl2++] = 'b'; @@ -1370,7 +1394,6 @@ static void decode_copper_insn (FILE* file, uae_u16 mword1, uae_u16 mword2, unsi static uaecptr decode_copperlist (FILE* file, uaecptr address, int nolines) { - uae_u32 insn; while (nolines-- > 0) { decode_copper_insn (file, chipmem_wget_indirect (address), chipmem_wget_indirect (address + 2), address); address += 4; @@ -1722,6 +1745,7 @@ static addrbank **debug_mem_banks; static addrbank *debug_mem_area; struct memwatch_node mwnodes[MEMWATCH_TOTAL]; static struct memwatch_node mwhit; +static int addressspaceheatmap; static uae_u8 *illgdebug, *illghdebug; static int illgdebug_break; @@ -2031,6 +2055,10 @@ static int memwatch_func (uaecptr addr, int rwi, int size, uae_u32 *valp) if (illgdebug) illg_debug_do (addr, rwi, size, val); + + if (addressspaceheatmap) + memwatch_heatmap (addr, rwi, size); + addr = munge24 (addr); if (smc_table && (rwi >= 2)) smc_detector (addr, rwi, size, valp); @@ -2284,7 +2312,7 @@ static uae_u8 *REGPARAM2 debug_xlate (uaecptr addr) return debug_mem_banks[munge24 (addr) >> 16]->xlateaddr (addr); } -uae_u16 debug_wputpeekdma_chipset (uaecptr addr, uae_u32 v) +uae_u16 debug_wputpeekdma_chipset (uaecptr addr, uae_u32 v, int reg) { if (!memwatch_enabled) return v; @@ -2293,7 +2321,7 @@ uae_u16 debug_wputpeekdma_chipset (uaecptr addr, uae_u32 v) memwatch_func (addr, 2, 2, &v); return v; } -uae_u16 debug_wputpeekdma_chipram (uaecptr addr, uae_u32 v) +uae_u16 debug_wputpeekdma_chipram (uaecptr addr, uae_u32 v, int reg) { if (!memwatch_enabled) return v; @@ -2304,7 +2332,7 @@ uae_u16 debug_wputpeekdma_chipram (uaecptr addr, uae_u32 v) memwatch_func (addr & chipmem_bank.mask, 2, 2, &v); return v; } -uae_u16 debug_wgetpeekdma_chipram (uaecptr addr, uae_u32 v) +uae_u16 debug_wgetpeekdma_chipram (uaecptr addr, uae_u32 v, int reg) { uae_u32 vv = v; if (!memwatch_enabled) @@ -4015,7 +4043,7 @@ static BOOL debug_line (TCHAR *input) if (badly) { m68k_dumpstate (NULL); } else { - console_out_f(_T("%d "), history[temp].s); + console_out_f(_T("%2d "), history[temp].intmask ? history[temp].intmask : (history[temp].s ? -1 : 0)); m68k_disasm (history[temp].pc, NULL, 1); } if (addr && history[temp].pc == addr) @@ -4211,6 +4239,7 @@ static void addhistory (void) void debug (void) { int i; + int wasactive; if (savestate_state) return; @@ -4331,9 +4360,11 @@ void debug (void) } } + wasactive = ismouseactive (); inputdevice_unacquire (); pause_sound (); setmouseactive (0); + activate_console (); do_skip = 0; skipaddr_start = 0xffffffff; skipaddr_end = 0xffffffff; @@ -4369,6 +4400,7 @@ void debug (void) } resume_sound (); inputdevice_acquire (TRUE); + setmouseactive (wasactive ? 2 : 0); } const TCHAR *debuginfo (int mode) diff --git a/disk.cpp b/disk.cpp index c3a0039c..b4165375 100644 --- a/disk.cpp +++ b/disk.cpp @@ -148,7 +148,7 @@ typedef struct { #define DRIVE_ID_35HD 0xAAAAAAAA #define DRIVE_ID_525SD 0x55555555 /* 40 track 5.25 drive , kickstart does not recognize this */ -typedef enum { ADF_NONE = -1, ADF_NORMAL, ADF_EXT1, ADF_EXT2, ADF_FDI, ADF_IPF, ADF_CATWEASEL, ADF_PCDOS } drive_filetype; +typedef enum { ADF_NONE = -1, ADF_NORMAL, ADF_EXT1, ADF_EXT2, ADF_FDI, ADF_IPF, ADF_CATWEASEL, ADF_PCDOS, ADF_KICK, ADF_SKICK } drive_filetype; typedef struct { struct zfile *diskfile; struct zfile *writediskfile; @@ -1127,7 +1127,23 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR if (side == 1) drv->num_tracks *= 2; + } else if ((size == 262144 || size == 524288) && buffer[0] == 0x11 && (buffer[1] == 0x11 || buffer[1] == 0x14)) { + + // 256k -> KICK disk, 512k -> SuperKickstart disk + drv->filetype = size == 262144 ? ADF_KICK : ADF_SKICK; + drv->num_tracks = 1760 / (drv->num_secs = 11); + for (int i = 0; i < drv->num_tracks; i++) { + tid = &drv->trackdata[i]; + tid->type = TRACK_AMIGADOS; + tid->len = 512 * drv->num_secs; + tid->bitlen = 0; + tid->offs = i * 512 * drv->num_secs - (drv->filetype == ADF_KICK ? 512 : 262144 + 1024); + tid->track = i; + tid->revolutions = 1; + } + } else { + int i, ds; ds = 0; @@ -1349,12 +1365,32 @@ static void drive_motor (drive * drv, bool off) #endif } -static void read_floppy_data (struct zfile *diskfile, trackid *tid, int offset, uae_u8 *dst, int len) +static void read_floppy_data (struct zfile *diskfile, int type, trackid *tid, int offset, uae_u8 *dst, int len) { if (len == 0) return; - zfile_fseek (diskfile, tid->offs + offset, SEEK_SET); - zfile_fread (dst, 1, len, diskfile); + if (tid->track == 0) { + if (type == ADF_KICK) { + memset (dst, 0, len > 512 ? 512 : len); + if (offset == 0) { + memcpy (dst, "KICK", 4); + len -= 512; + } + } else if (type == ADF_SKICK) { + memset (dst, 0, len > 512 ? 512 : len); + if (offset == 0) { + memcpy (dst, "KICKSUP0", 8); + len -= 1024; + } else if (offset == 512) { + len -= 512; + } + } + } + int off = tid->offs + offset; + if (off >= 0 && len > 0) { + zfile_fseek (diskfile, off, SEEK_SET); + zfile_fread (dst, 1, len, diskfile); + } } /* Megalomania does not like zero MFM words... */ @@ -1444,7 +1480,7 @@ static void decode_pcdos (drive *drv) secbuf[57] = 0xa1; secbuf[58] = 0xa1; secbuf[59] = 0xfb; - read_floppy_data (drv->diskfile, ti, i * 512, &secbuf[60], 512); + read_floppy_data (drv->diskfile, drv->filetype, ti, i * 512, &secbuf[60], 512); crc16 = get_crc16 (secbuf + 56, 3 + 1 + 512); secbuf[60 + 512] = crc16 >> 8; secbuf[61 + 512] = crc16 & 0xff; @@ -1501,7 +1537,7 @@ static void decode_amigados (drive *drv) for (i = 8; i < 24; i++) secbuf[i] = 0; - read_floppy_data (drv->diskfile, ti, sec * 512, &secbuf[32], 512); + read_floppy_data (drv->diskfile, drv->filetype, ti, sec * 512, &secbuf[32], 512); mfmbuf[0] = prevbit ? 0x2aaa : 0xaaaa; mfmbuf[1] = 0xaaaa; @@ -1607,7 +1643,7 @@ static void decode_diskspare (drive *drv) secbuf[2] = 0; secbuf[3] = 0; - read_floppy_data (drv->diskfile, ti, sec * 512, &secbuf[4], 512); + read_floppy_data (drv->diskfile, drv->filetype, ti, sec * 512, &secbuf[4], 512); mfmbuf[0] = 0xaaaa; mfmbuf[1] = 0x4489; @@ -1684,7 +1720,7 @@ static void drive_fill_bigbuf (drive * drv, int force) trackid *wti = &drv->writetrackdata[tr]; drv->tracklen = wti->bitlen; drv->revolutions = wti->revolutions; - read_floppy_data (drv->writediskfile, wti, 0, (uae_u8*)drv->bigmfmbuf, (wti->bitlen + 7) / 8); + read_floppy_data (drv->writediskfile, drv->filetype, wti, 0, (uae_u8*)drv->bigmfmbuf, (wti->bitlen + 7) / 8); for (i = 0; i < (drv->tracklen + 15) / 16; i++) { uae_u16 *mfm = drv->bigmfmbuf + i; uae_u8 *data = (uae_u8 *) mfm; @@ -1737,7 +1773,7 @@ static void drive_fill_bigbuf (drive * drv, int force) int base_offset = ti->type == TRACK_RAW ? 0 : 1; drv->tracklen = ti->bitlen + 16 * base_offset; drv->bigmfmbuf[0] = ti->sync; - read_floppy_data (drv->diskfile, ti, 0, (uae_u8*)(drv->bigmfmbuf + base_offset), (ti->bitlen + 7) / 8); + read_floppy_data (drv->diskfile, drv->filetype, ti, 0, (uae_u8*)(drv->bigmfmbuf + base_offset), (ti->bitlen + 7) / 8); for (i = base_offset; i < (drv->tracklen + 15) / 16; i++) { uae_u16 *mfm = drv->bigmfmbuf + i; uae_u8 *data = (uae_u8 *) mfm; @@ -1823,7 +1859,9 @@ static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int file uae_u8 *secdata; uae_u8 secbuf[544]; uae_u16 *mend = mbuf + length, *mstart; + uae_u32 sechead[4]; int shift = 0; + bool issechead; memset (sectable, 0, MAX_SECTORS * sizeof (int)); mstart = mbuf; @@ -1862,6 +1900,7 @@ static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int file #if MFM_VALIDATOR check_valid_mfm (mbuf - 4, 544 - 4 + 1, trackoffs); #endif + issechead = false; chksum = odd ^ even; for (i = 0; i < 4; i++) { odd = getmfmlong (mbuf, shift); @@ -1870,12 +1909,17 @@ static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int file dlong = (odd << 1) | even; if (dlong && !checkmode) { - if (filetype == ADF_EXT2) - return 6; - secwritten = -200; + issechead = true; } + sechead[i] = dlong; chksum ^= odd ^ even; - } /* could check here if the label is nonstandard */ + } + if (issechead) { + write_log (_T("Disk decode: sector %d header: %08X %08X %08X %08X\n"), + trackoffs, sechead[0], sechead[1], sechead[2], sechead[3]); + if (filetype == ADF_EXT2) + return 6; + } mbuf += 8; odd = getmfmlong (mbuf, shift); even = getmfmlong (mbuf + 2, shift); @@ -3437,7 +3481,7 @@ void DSKLEN (uae_u16 v, int hpos) drive *drv = &floppy[dr]; if (selected & (1 << dr)) continue; - if (drv->filetype != ADF_NORMAL) + if (drv->filetype != ADF_NORMAL && drv->filetype != ADF_KICK && drv->filetype != ADF_SKICK) break; } if (dr < MAX_FLOPPY_DRIVES) /* no turbo mode if any selected drive has non-standard ADF */ diff --git a/drawing.cpp b/drawing.cpp index 85ae748c..9c7f654b 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -85,6 +85,7 @@ static int linedbl, linedbld; int interlace_seen = 0; #define AUTO_LORES_FRAMES 10 static int can_use_lores = 0, frame_res, frame_res_lace, last_max_ypos; +static int resolution_count[RES_MAX + 1]; static bool center_reset; /* Lookup tables for dual playfields. The dblpf_*1 versions are for the case @@ -923,9 +924,11 @@ static void pfield_erase_hborder_sprites (void) // erase whole viewable area if upper or lower border static void pfield_erase_vborder_sprites (void) { - uae_u8 c = colors_for_drawing.borderblank ? 0 : colors_for_drawing.acolors[0]; - int size = res_shift_from_window (linetoscr_diw_end - linetoscr_diw_start); - memset (pixdata.apixels + MAX_PIXELS_PER_LINE - size, c, size); + if (linetoscr_diw_end > linetoscr_diw_start) { + uae_u8 c = colors_for_drawing.borderblank ? 0 : colors_for_drawing.acolors[0]; + int size = res_shift_from_window (linetoscr_diw_end - linetoscr_diw_start); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE - size, c, size); + } } @@ -1817,13 +1820,13 @@ static void clear_bitplane_border_aga (void) #endif /* emulate OCS/ECS only undocumented "SWIV" hardware feature */ -static void weird_bitplane_fix (void) +static void weird_bitplane_fix (int start, int end) { int i; int sh = lores_shift; uae_u8 *p = pixdata.apixels + pixels_offset; - for (i = playfield_start >> sh; i < playfield_end >> sh; i++) { + for (i = start >> sh; i < end >> sh; i++) { if (p[i] > 16) p[i] = 16; } @@ -2244,6 +2247,8 @@ static void do_color_changes (line_draw_func worker_border, line_draw_func worke // playfield if (nextpos_in_range > lastpos && lastpos >= playfield_start && lastpos < playfield_end) { int t = nextpos_in_range <= playfield_end ? nextpos_in_range : playfield_end; + if (plf2pri > 5 && bplplanecnt == 5 && !(currprefs.chipset_mask & CSMASK_AGA)) + weird_bitplane_fix (lastpos, t); (*worker_pfield) (lastpos, t, false); lastpos = t; } @@ -2299,6 +2304,8 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in dp_for_drawing = line_decisions + lineno; dip_for_drawing = curr_drawinfo + lineno; + resolution_count[dp_for_drawing->bplres]++; + switch (linestate[lineno]) { case LINE_REMEMBERED_AS_PREVIOUS: @@ -2377,9 +2384,6 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in bplham = dp_for_drawing->ham_at_start; } - if (plf2pri > 5 && bplplanecnt == 5 && !(currprefs.chipset_mask & CSMASK_AGA)) - weird_bitplane_fix (); - if (dip_for_drawing->nr_sprites) { int i; #ifdef AGA @@ -2591,69 +2595,96 @@ static int frame_res_cnt; static void init_drawing_frame (void) { int i, maxline; -#if 1 static int frame_res_old; - if (currprefs.gfx_autoresolution && frame_res >= 0 && frame_res_lace >= 0) { - if (frame_res_cnt > 0 && frame_res_old == frame_res * 2 + frame_res_lace) { - frame_res_cnt--; - if (frame_res_cnt == 0) { - int m = frame_res * 2 + frame_res_lace; - struct wh *dst = currprefs.gfx_apmode[0].gfx_fullscreen ? &changed_prefs.gfx_size_fs : &changed_prefs.gfx_size_win; - while (m < 3 * 2) { - struct wh *src = currprefs.gfx_apmode[0].gfx_fullscreen ? &currprefs.gfx_size_fs_xtra[m] : &currprefs.gfx_size_win_xtra[m]; - if ((src->width > 0 && src->height > 0) || (currprefs.gfx_api || currprefs.gfx_filter > 0)) { - int nr = m >> 1; - int nl = (m & 1) == 0 ? 0 : 1; - int nr_o = nr; - int nl_o = nl; - - if (currprefs.gfx_autoresolution_minh < 0) { - if (nr < nl) - nr = nl; - } else if (nr < currprefs.gfx_autoresolution_minh) { - nr = currprefs.gfx_autoresolution_minh; - } - if (currprefs.gfx_autoresolution_minv < 0) { - if (nl < nr) - nl = nr; - } else if (nl < currprefs.gfx_autoresolution_minv) { - nl = currprefs.gfx_autoresolution_minv; - } + if (currprefs.gfx_autoresolution && !specialmonitoron) { + int frame_res_detected; + int frame_res_lace_detected = frame_res_lace; + + int largest_count = 0; + int largest_count_res = 0; + int largest_res = 0; + for (int i = 0; i <= RES_MAX; i++) { + if (resolution_count[i]) + largest_res = i; + if (resolution_count[i] >= largest_count) { + largest_count = resolution_count[i]; + largest_count_res = i; + } + } - if (nr > gfxvidinfo.gfx_resolution_reserved) - nr = gfxvidinfo.gfx_resolution_reserved; - if (nl > gfxvidinfo.gfx_vresolution_reserved) - nl = gfxvidinfo.gfx_vresolution_reserved; - - if (changed_prefs.gfx_resolution != nr || changed_prefs.gfx_vresolution != nl) { - changed_prefs.gfx_resolution = nr; - changed_prefs.gfx_vresolution = nl; - write_log (_T("RES -> %d (%d) LINE -> %d (%d) (%d - %d, %d - %d)\n"), nr, nr_o, nl, nl_o, - currprefs.gfx_autoresolution_minh, currprefs.gfx_autoresolution_minv, - gfxvidinfo.gfx_resolution_reserved, gfxvidinfo.gfx_vresolution_reserved); - set_config_changed (); - //activate_debugger (); - } - if (src->width > 0 && src->height > 0) { - if (memcmp (dst, src, sizeof *dst)) { - *dst = *src; + if (currprefs.gfx_autoresolution == 1) + frame_res_detected = largest_res; + else if (largest_count * 100 / maxvpos >= currprefs.gfx_autoresolution) + frame_res_detected = largest_count_res; + else + frame_res_detected = largest_count_res - 1; + if (frame_res_detected < 0) + frame_res_detected = 0; + + if (frame_res_detected >= 0 && frame_res_lace_detected >= 0) { + if (frame_res_cnt > 0 && frame_res_old == frame_res_detected * 2 + frame_res_lace_detected) { + frame_res_cnt--; + if (frame_res_cnt == 0) { + int m = frame_res_detected * 2 + frame_res_lace_detected; + struct wh *dst = currprefs.gfx_apmode[0].gfx_fullscreen ? &changed_prefs.gfx_size_fs : &changed_prefs.gfx_size_win; + while (m < 3 * 2) { + struct wh *src = currprefs.gfx_apmode[0].gfx_fullscreen ? &currprefs.gfx_size_fs_xtra[m] : &currprefs.gfx_size_win_xtra[m]; + if ((src->width > 0 && src->height > 0) || (currprefs.gfx_api || currprefs.gfx_filter > 0)) { + int nr = m >> 1; + int nl = (m & 1) == 0 ? 0 : 1; + int nr_o = nr; + int nl_o = nl; + + if (currprefs.gfx_autoresolution_minh < 0) { + if (nr < nl) + nr = nl; + } else if (nr < currprefs.gfx_autoresolution_minh) { + nr = currprefs.gfx_autoresolution_minh; + } + if (currprefs.gfx_autoresolution_minv < 0) { + if (nl < nr) + nl = nr; + } else if (nl < currprefs.gfx_autoresolution_minv) { + nl = currprefs.gfx_autoresolution_minv; + } + + if (nr > gfxvidinfo.gfx_resolution_reserved) + nr = gfxvidinfo.gfx_resolution_reserved; + if (nl > gfxvidinfo.gfx_vresolution_reserved) + nl = gfxvidinfo.gfx_vresolution_reserved; + + if (changed_prefs.gfx_resolution != nr || changed_prefs.gfx_vresolution != nl) { + changed_prefs.gfx_resolution = nr; + changed_prefs.gfx_vresolution = nl; + write_log (_T("RES -> %d (%d) LINE -> %d (%d) (%d - %d, %d - %d)\n"), nr, nr_o, nl, nl_o, + currprefs.gfx_autoresolution_minh, currprefs.gfx_autoresolution_minv, + gfxvidinfo.gfx_resolution_reserved, gfxvidinfo.gfx_vresolution_reserved); set_config_changed (); + //activate_debugger (); } + if (src->width > 0 && src->height > 0) { + if (memcmp (dst, src, sizeof *dst)) { + *dst = *src; + set_config_changed (); + } + } + break; } - break; + m++; } - m++; + frame_res_cnt = currprefs.gfx_autoresolution_delay; } + } else { + frame_res_old = frame_res_detected * 2 + frame_res_lace_detected; frame_res_cnt = currprefs.gfx_autoresolution_delay; + if (frame_res_cnt <= 0) + frame_res_cnt = 1; } - } else { - frame_res_old = frame_res * 2 + frame_res_lace; - frame_res_cnt = currprefs.gfx_autoresolution_delay; - if (frame_res_cnt <= 0) - frame_res_cnt = 1; } } + for (int i = 0; i <= RES_MAX; i++) + resolution_count[i] = 0; frame_res = -1; frame_res_lace = 0; @@ -2664,7 +2695,6 @@ static void init_drawing_frame (void) can_use_lores++; lores_reset (); } -#endif init_hardware_for_drawing_frame (); diff --git a/events.cpp b/events.cpp index 5637349b..23e9a2e1 100644 --- a/events.cpp +++ b/events.cpp @@ -23,6 +23,7 @@ unsigned long start_cycles; frame_time_t vsyncmintime, vsyncmaxtime, vsyncwaittime; int vsynctimebase; +int event2_count; void events_schedule (void) { @@ -120,6 +121,7 @@ void MISC_handler (void) if (eventtab2[i].active) { if (eventtab2[i].evtime == ct) { eventtab2[i].active = false; + event2_count--; eventtab2[i].handler (eventtab2[i].data); if (dorecheck || eventtab2[i].active) { recheck = true; @@ -152,8 +154,10 @@ void event2_newevent_xx (int no, evt t, uae_u32 data, evfunc2 func) if (no < 0) { no = next; for (;;) { - if (!eventtab2[no].active) + if (!eventtab2[no].active) { + event2_count++; break; + } if (eventtab2[no].evtime == et && eventtab2[no].handler == func && eventtab2[no].data == data) break; no++; diff --git a/filesys.cpp b/filesys.cpp index 6d5a529d..9af52a1b 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -180,6 +180,7 @@ typedef struct { TCHAR *filesysdir; /* filesystem seglist */ uaecptr filesysseg; + uae_u32 rdb_dostype; /* CDFS */ bool cd_open; @@ -6297,6 +6298,7 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context) #ifdef UAESERIAL resaddr = uaeserialdev_startup (resaddr); #endif + /* scan for Residents and return pointer to array of them */ residents = resaddr; while (tmp < residents && tmp > start) { @@ -6608,7 +6610,7 @@ static void dump_partinfo (struct hardfiledata *hfd, uae_u8 *pp) highcyl = rl (pp + 40); size = ((uae_u64)blocksize) * surfaces * spt * (highcyl - lowcyl + 1); - write_log (_T("Partition '%s' Dostype=%08X (%s) Flags: %08X\n"), s, dostype, dostypes (dostype), flags); + write_log (_T("Partition '%s' Dostype=%08X (%s) Flags: %08X\n"), s[0] ? s : _T("_NULL_"), dostype, dostypes (dostype), flags); write_log (_T("BlockSize: %d, Surfaces: %d, SectorsPerBlock %d\n"), blocksize, surfaces, spb); write_log (_T("SectorsPerTrack: %d, Reserved: %d, LowCyl %d, HighCyl %d, Size %dM\n"), @@ -6724,6 +6726,8 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke hdf_read_rdb (hfd, bufrdb, rdblock * hfd->ci.blocksize, hfd->ci.blocksize); if (rdb_checksum ("RDSK", bufrdb, rdblock)) break; + if (rdb_checksum ("CDSK", bufrdb, rdblock)) + break; hdf_read_rdb (hfd, bufrdb, rdblock * hfd->ci.blocksize, hfd->ci.blocksize); if (!memcmp ("RDSK", bufrdb, 4)) { bufrdb[0xdc] = 0; @@ -6824,6 +6828,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke for (i = 0; i < PP_MAXSIZE; i++) put_byte (parmpacket + 16 + i, buf[128 + i]); dostype = get_long (parmpacket + 80); + uip->rdb_dostype = dostype; if (dostype == 0) { write_log (_T("RDB: mount failed, dostype=0\n")); @@ -7264,7 +7269,9 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context) if (ci->dostype) { // forced dostype? put_long (parmpacket + 80, ci->dostype); /* dostype */ } else if (hdf_read (&uip[unit_no].hf, buf, 0, sizeof buf)) { - put_long (parmpacket + 80, rl (buf)); + uae_u32 dt = get_long (rl (buf)); + if (dt != 0x00000000 && dt != 0xffffffff) + put_long (parmpacket + 80, dt); } for (int i = 0; i < 80; i++) buf[i + 128] = get_byte (parmpacket + 16 + i); diff --git a/fpp.cpp b/fpp.cpp index 911d41bd..d0edc73f 100644 --- a/fpp.cpp +++ b/fpp.cpp @@ -188,6 +188,7 @@ static void fpu_format_error (void) #ifdef JIT set_special (SPCFLAG_END_COMPILE); #endif + regs.fp_exception = true; } #define FPU_EXP_UNIMP_INS 0 @@ -259,6 +260,7 @@ static void fpu_op_unimp (uae_u16 opcode, uae_u32 ea, uaecptr oldpc, int type) warned--; #endif } + regs.fp_exception = true; m68k_setpc (newpc); #ifdef JIT set_special (SPCFLAG_END_COMPILE); @@ -272,6 +274,7 @@ static void fpu_op_illg2 (uae_u16 opcode, uae_u32 ea, uaecptr oldpc) fpu_op_unimp (opcode, ea, oldpc, FPU_EXP_DISABLED); return; } + regs.fp_exception = true; m68k_setpc (oldpc); op_illg (opcode); } @@ -287,6 +290,7 @@ static void fpu_noinst (uae_u16 opcode, uaecptr pc) #if EXCEPTION_FPP write_log (_T("Unknown FPU instruction %04X %08X\n"), opcode, pc); #endif + regs.fp_exception = true; m68k_setpc (pc); op_illg (opcode); } @@ -416,6 +420,7 @@ static bool fault_if_no_6888x (uae_u16 opcode, uae_u32 extra, uaecptr oldpc) write_log (_T("6888x no FPU: %04x %08x PC=%08x\n"), opcode, extra, oldpc); #endif m68k_setpc (oldpc); + regs.fp_exception = true; op_illg (opcode); return true; } @@ -1085,6 +1090,7 @@ void fpuop_dbcc (uae_u32 opcode, uae_u16 extra) uae_s32 disp; int cc; + regs.fp_exception = false; #if DEBUG_FPP if (!isinrom ()) write_log (_T("fdbcc_opp at %08lx\n"), m68k_getpc ()); @@ -1116,6 +1122,7 @@ void fpuop_scc (uae_u32 opcode, uae_u16 extra) int cc; uaecptr pc = m68k_getpc () - 4; + regs.fp_exception = false; #if DEBUG_FPP if (!isinrom ()) write_log (_T("fscc_opp at %08lx\n"), m68k_getpc ()); @@ -1145,6 +1152,7 @@ void fpuop_trapcc (uae_u32 opcode, uaecptr oldpc, uae_u16 extra) { int cc; + regs.fp_exception = false; #if DEBUG_FPP if (!isinrom ()) write_log (_T("ftrapcc_opp at %08lx\n"), m68k_getpc ()); @@ -1166,6 +1174,7 @@ void fpuop_bcc (uae_u32 opcode, uaecptr oldpc, uae_u32 extra) { int cc; + regs.fp_exception = false; #if DEBUG_FPP if (!isinrom ()) write_log (_T("fbcc_opp at %08lx\n"), m68k_getpc ()); @@ -1193,6 +1202,7 @@ void fpuop_save (uae_u32 opcode) uaecptr pc = m68k_getpc () - 2; int i; + regs.fp_exception = false; #if DEBUG_FPP if (!isinrom ()) write_log (_T("fsave_opp at %08lx\n"), m68k_getpc ()); @@ -1303,6 +1313,7 @@ void fpuop_restore (uae_u32 opcode) uae_u32 d; int incr = (opcode & 0x38) == 0x20 ? -1 : 1; + regs.fp_exception = false; #if DEBUG_FPP if (!isinrom ()) write_log (_T("frestore_opp at %08lx\n"), m68k_getpc ()); @@ -2108,6 +2119,7 @@ void fpuop_arithmetic (uae_u32 opcode, uae_u16 extra) { regs.fpsr_highbyte = 0; regs.fpu_state = 1; + regs.fp_exception = false; fpuop_arithmetic2 (opcode, extra); if (regs.fpsr_highbyte) { regs.fpsr &= 0xffff00ff; diff --git a/gencpu.cpp b/gencpu.cpp index 7bedc5dd..785d1e12 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -508,6 +508,12 @@ static const char *gen_nextibyte (int flags) return buffer; } +static void check_ipl (void) +{ + if (using_ce) + printf ("\tipl_fetch ();\n"); +} + static void irc2ir (bool dozero) { if (!using_prefetch) @@ -518,8 +524,7 @@ static void irc2ir (bool dozero) printf ("\tregs.ir = regs.irc;\n"); if (dozero) printf ("\tregs.irc = 0;\n"); - if (using_ce) - printf ("\tipl_fetch ();\n"); + check_ipl (); } static void irc2ir (void) { @@ -1307,12 +1312,16 @@ static void genamode2x (amodes mode, char *reg, wordsizes size, char *name, int insn_n_cycles += 4; printf ("\t%sa = %s (m68k_areg (regs, %s), %d);\n", name, disp020, reg, mmudisp020cnt++); } else { - printf ("\t%sa = %s (m68k_areg (regs, %s), %s);\n", name, disp000, reg, gen_nextiword (flags)); if (!(flags & GF_AD8R)) { addcycles000 (2); insn_n_cycles += 2; count_cycles_ea += 2; } + if ((flags & GF_NOREFILL) && using_prefetch) { + printf ("\t%sa = %s (m68k_areg (regs, %s), regs.irc);\n", name, disp000, reg); + } else { + printf ("\t%sa = %s (m68k_areg (regs, %s), %s);\n", name, disp000, reg, gen_nextiword (flags)); + } count_read_ea++; } break; @@ -1345,7 +1354,11 @@ static void genamode2x (amodes mode, char *reg, wordsizes size, char *name, int insn_n_cycles += 2; count_cycles_ea += 2; } - printf ("\t%sa = %s (tmppc, %s);\n", name, disp000, gen_nextiword (flags)); + if ((flags & GF_NOREFILL) && using_prefetch) { + printf ("\t%sa = %s (tmppc, regs.irc);\n", name, disp000); + } else { + printf ("\t%sa = %s (tmppc, %s);\n", name, disp000, gen_nextiword (flags)); + } } break; @@ -2007,9 +2020,9 @@ static void genmovemel_ce (uae_u16 opcode) printf ("\tuae_u16 mask = %s;\n", gen_nextiword (0)); printf ("\tuae_u32 dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n"); printf ("\tuae_u32 v;\n"); - genamode (NULL, table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, GF_AA); if (table68k[opcode].dmode == Ad8r || table68k[opcode].dmode == PC8r) addcycles000 (2); + genamode (NULL, table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, GF_AA); start_brace (); if (table68k[opcode].size == sz_long) { printf ("\twhile (dmask) { v = %s (srca) << 16; v |= %s (srca + 2); m68k_dreg (regs, movem_index1[dmask]) = v; srca += %d; dmask = movem_next[dmask]; }\n", @@ -2091,12 +2104,11 @@ static void genmovemle (uae_u16 opcode) static void genmovemle_ce (uae_u16 opcode) { int size = table68k[opcode].size == sz_long ? 4 : 2; - printf ("\tuae_u16 mask = %s;\n", gen_nextiword (0)); - genamode (NULL, table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, GF_AA); - if (table68k[opcode].dmode == Ad8r || table68k[opcode].dmode == PC8r) { + printf ("\tuae_u16 mask = %s;\n", gen_nextiword (0)); + if (table68k[opcode].dmode == Ad8r || table68k[opcode].dmode == PC8r) addcycles000 (2); - } + genamode (NULL, table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, GF_AA); start_brace (); if (table68k[opcode].size == sz_long) { if (table68k[opcode].dmode == Apdi) { @@ -2746,6 +2758,7 @@ static void gen_opcode (unsigned long int opcode) case i_AND: case i_EOR: { + // documentaion error: and.l #imm,dn = 2 idle, not 1 idle (same as OR and EOR) int c = 0; genamodedual (curi, curi->smode, "srcreg", curi->size, "src", 1, 0, @@ -2765,29 +2778,37 @@ static void gen_opcode (unsigned long int opcode) genastore_rev ("src", curi->dmode, "dstreg", curi->size, "dst"); break; } - // all SR/CCR modifications have dummy read access + // all SR/CCR modifications does full prefetch case i_ORSR: case i_EORSR: printf ("\tMakeSR ();\n"); genamode (curi, curi->smode, "srcreg", curi->size, "src", 1, 0, 0); - dummy_prefetch (); if (curi->size == sz_byte) { printf ("\tsrc &= 0xFF;\n"); } addcycles000 (8); - fill_prefetch_next (); + if (cpu_level <= 1) { + sync_m68k_pc (); + fill_prefetch_full (); + } else { + fill_prefetch_next (); + } printf ("\tregs.sr %c= src;\n", curi->mnemo == i_EORSR ? '^' : '|'); printf ("\tMakeFromSR ();\n"); break; case i_ANDSR: printf ("\tMakeSR ();\n"); genamode (curi, curi->smode, "srcreg", curi->size, "src", 1, 0, 0); - dummy_prefetch (); if (curi->size == sz_byte) { printf ("\tsrc |= 0xFF00;\n"); } addcycles000 (8); - fill_prefetch_next (); + if (cpu_level <= 1) { + sync_m68k_pc (); + fill_prefetch_full (); + } else { + fill_prefetch_next (); + } printf ("\tregs.sr &= src;\n"); printf ("\tMakeFromSR ();\n"); break; @@ -3099,8 +3120,8 @@ static void gen_opcode (unsigned long int opcode) break; case i_CMP: genamodedual (curi, - curi->smode, "srcreg", curi->size, "src", 1, GF_AA, - curi->dmode, "dstreg", curi->size, "dst", 1, GF_AA); + curi->smode, "srcreg", curi->size, "src", 1, 0, + curi->dmode, "dstreg", curi->size, "dst", 1, 0); //genamode (curi, curi->smode, "srcreg", curi->size, "src", 1, 0, 0); //genamode (curi, curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0); fill_prefetch_next (); @@ -3155,6 +3176,7 @@ static void gen_opcode (unsigned long int opcode) /* 2 MOVE instruction variants have special prefetch sequence: * - MOVE ,-(An) = prefetch is before writes (Apdi) * - MOVE memory,(xxx).L = 2 prefetches after write + * - move.x #imm = prefetch is done before write * - all others = prefetch is done after writes * * - move.x xxx,[at least 1 extension word here] = fetch 1 extension word before (xxx) @@ -3266,10 +3288,17 @@ static void gen_opcode (unsigned long int opcode) break; case i_MVSR2: // MOVE FROM SR genamode (curi, curi->smode, "srcreg", sz_word, "src", 2, 0, 0); - fill_prefetch_next (); - if (isreg (curi->smode)) + if (isreg (curi->smode)) { + fill_prefetch_next (); addcycles000 (2); + } else { + // write to memory, dummy write to same address, X-flag seems to be always set + if (cpu_level <= 1 && curi->size == sz_word) + printf ("\t%s (srca, regs.sr | 0x0010);\n", dstw); + fill_prefetch_next (); + } printf ("\tMakeSR ();\n"); + // real write if (curi->size == sz_byte) genastore ("regs.sr & 0xff", curi->smode, "srcreg", sz_word, "src"); else @@ -3279,17 +3308,21 @@ static void gen_opcode (unsigned long int opcode) genamode (curi, curi->smode, "srcreg", sz_word, "src", 1, 0, 0); if (curi->size == sz_byte) { // MOVE TO CCR - dummy_prefetch (); - addcycles000 (4); + addcycles000 (6); printf ("\tMakeSR ();\n\tregs.sr &= 0xFF00;\n\tregs.sr |= src & 0xFF;\n"); } else { // MOVE TO SR - dummy_prefetch (); - addcycles000 (4); + addcycles000 (6); printf ("\tregs.sr = src;\n"); } printf ("\tMakeFromSR ();\n"); - fill_prefetch_next (); + if (cpu_level <= 1) { + // 68000 does 2xprefetch + sync_m68k_pc (); + fill_prefetch_full (); + } else { + fill_prefetch_next (); + } break; case i_SWAP: genamode (curi, curi->smode, "srcreg", sz_long, "src", 1, 0, 0); @@ -3402,6 +3435,7 @@ static void gen_opcode (unsigned long int opcode) fill_prefetch_full (); break; case i_RTE: + next_level_000 (); if (cpu_level == 0) { genamode (NULL, Aipi, "7", sz_word, "sr", 1, 0, GF_NOREFILL); genamode (NULL, Aipi, "7", sz_long, "pc", 1, 0, GF_NOREFILL); @@ -3410,13 +3444,11 @@ static void gen_opcode (unsigned long int opcode) printf ("\tMakeFromSR ();\n"); } else if (cpu_level == 1 && using_prefetch) { int old_brace_level = n_braces; - if (next_cpu_level < 0) - next_cpu_level = 0; - printf ("\tuae_u16 newsr; uae_u32 newpc;\n"); + printf ("\tuae_u16 newsr; uae_u32 newpc;\n"); printf ("\tfor (;;) {\n"); printf ("\t\tuaecptr a = m68k_areg (regs, 7);\n"); printf ("\t\tuae_u16 sr = %s (a);\n", srcw); - printf ("\t\tuae_u32 pc = %s (a + 2);\n", srcl); + printf ("\t\tuae_u32 pc = %s (a + 2) << 16; pc |= %s (a + 4);\n", srcw, srcw); printf ("\t\tuae_u16 format = %s (a + 2 + 4);\n", srcw); printf ("\t\tint frame = format >> 12;\n"); printf ("\t\tint offset = 8;\n"); @@ -3432,12 +3464,10 @@ static void gen_opcode (unsigned long int opcode) printf ("\t\tgoto %s;\n", endlabelstr); printf ("\t}\n"); setpc ("newpc"); - printf ("\tipl_fetch ();\n"); + check_ipl (); need_endlabel = 1; } else { int old_brace_level = n_braces; - if (next_cpu_level < 0) - next_cpu_level = 0; printf ("\tuae_u16 newsr; uae_u32 newpc;\n"); printf ("\tfor (;;) {\n"); printf ("\t\tuaecptr a = m68k_areg (regs, 7);\n"); @@ -3478,7 +3508,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\t\tgoto %s;\n", endlabelstr); printf ("\t}\n"); setpc ("newpc"); - printf ("\tipl_fetch ();\n"); + check_ipl (); need_endlabel = 1; } /* PC is set and prefetch filled. */ @@ -3602,7 +3632,8 @@ static void gen_opcode (unsigned long int opcode) need_endlabel = 1; tail_ce020_done = true; break; - case i_JSR: // TODO: check stack write order + case i_JSR: + // possible idle cycle, prefetch from new address, stack high return addr, stack low, prefetch no_prefetch_ce020 = true; genamode (curi, curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA|GF_NOREFILL); start_brace (); @@ -3622,11 +3653,14 @@ static void gen_opcode (unsigned long int opcode) } else { if (curi->smode == Ad16 || curi->smode == absw || curi->smode == PC16) addcycles000 (2); + if (curi->smode == Ad8r || curi->smode == PC8r) { + addcycles000 (6); + if (cpu_level <= 1 && using_prefetch) + printf ("\toldpc += 2;\n"); + } setpc ("srca"); m68k_pc_offset = 0; fill_prefetch_1 (0); - if (curi->smode == Ad8r || curi->smode == PC8r) - addcycles000 (6); printf ("\tm68k_areg (regs, 7) -= 4;\n"); if (using_ce) { printf ("\tx_put_word (m68k_areg (regs, 7), oldpc >> 16);\n"); @@ -3641,7 +3675,7 @@ static void gen_opcode (unsigned long int opcode) break; case i_JMP: no_prefetch_ce020 = true; - genamode (curi, curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA | ((curi->smode == Ad8r || curi->smode == PC8r) ? 0 : GF_NOREFILL)); + genamode (curi, curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA|GF_NOREFILL); if (using_exception_3) { printf ("\tif (srca & 1) {\n"); printf ("\t\texception3i (opcode, srca);\n"); @@ -3656,9 +3690,9 @@ static void gen_opcode (unsigned long int opcode) fill_prefetch_full (); break; case i_BSR: - // .b and .w confirmed - if (using_ce020) - no_prefetch_ce020 = true; + // .b/.w = idle cycle, store high, store low, 2xprefetch + if (using_ce020) + no_prefetch_ce020 = true; printf ("\tuae_s32 s;\n"); if (curi->size == sz_long) { if (next_cpu_level < 1) @@ -3694,8 +3728,6 @@ static void gen_opcode (unsigned long int opcode) fill_prefetch_full (); break; case i_Bcc: - // bcc.b branch: idle cycle, prefetch, prefetch - // bcc.b not branch: 2 idle cycles, prefetch tail_ce020_done = true; if (curi->size == sz_long) { if (cpu_level < 2) { @@ -3740,14 +3772,13 @@ static void gen_opcode (unsigned long int opcode) printf ("didnt_jump:;\n"); need_endlabel = 1; sync_m68k_pc (); + addcycles000 (2); get_prefetch_020_0 (); if (curi->size == sz_byte) { - addcycles000 (2); irc2ir (); add_head_cycs (4); fill_prefetch_2 (); } else if (curi->size == sz_word) { - addcycles000 (2); add_head_cycs (6); fill_prefetch_full_000 (); } else { @@ -3757,23 +3788,23 @@ static void gen_opcode (unsigned long int opcode) insn_n_cycles = curi->size == sz_byte ? 8 : 12; break; case i_LEA: + if (curi->smode == Ad8r || curi->smode == PC8r) + addcycles000 (2); genamodedual (curi, curi->smode, "srcreg", curi->size, "src", 0, GF_AA, curi->dmode, "dstreg", curi->size, "dst", 2, GF_AA); //genamode (curi, curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA); //genamode (curi, curi->dmode, "dstreg", curi->size, "dst", 2, 0, GF_AA); - if (curi->smode == Ad8r || curi->smode == PC8r) - addcycles000 (2); fill_prefetch_next (); if (curi->smode == Ad8r || curi->smode == PC8r) addcycles000 (2); genastore ("srca", curi->dmode, "dstreg", curi->size, "dst"); break; case i_PEA: - genamode (curi, curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA); - genamode (NULL, Apdi, "7", sz_long, "dst", 2, 0, GF_AA); if (curi->smode == Ad8r || curi->smode == PC8r) addcycles000 (2); + genamode (curi, curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA); + genamode (NULL, Apdi, "7", sz_long, "dst", 2, 0, GF_AA); if (!(curi->smode == absw || curi->smode == absl)) fill_prefetch_next (); if (curi->smode == Ad8r || curi->smode == PC8r) @@ -3783,6 +3814,9 @@ static void gen_opcode (unsigned long int opcode) fill_prefetch_next (); break; case i_DBcc: + // cc true: idle cycle, prefetch + // cc false, counter expired: idle cycle, prefetch (from branch address), 2xprefetch (from next address) + // cc false, counter not expired: idle cycle, prefetch tail_ce020_done = true; genamodedual (curi, curi->smode, "srcreg", curi->size, "src", 1, GF_AA | GF_NOREFILL, @@ -3811,14 +3845,10 @@ static void gen_opcode (unsigned long int opcode) fill_prefetch_1 (2); fill_prefetch_full_020 (); returncycles ("\t\t\t", 12); - if (using_ce) - printf ("\t\t\treturn;\n"); printf ("\t\t}\n"); add_head_cycs (10); printf ("\t} else {\n"); - // cc == true - addcycles000_2 ("\t\t", 2); - add_head_cycs (6); + addcycles000 (2); printf ("\t}\n"); setpc ("oldpc + %d", m68k_pc_offset); m68k_pc_offset = 0; @@ -3835,10 +3865,8 @@ static void gen_opcode (unsigned long int opcode) fill_prefetch_next(); start_brace (); printf ("\tint val = cctrue (%d) ? 0xff : 0;\n", curi->cc); - if (using_ce) { - printf ("\tint cycles = 0;\n"); - if (isreg (curi->smode)) - printf ("\tif (val) cycles += 2;\n"); + if (using_ce && isreg (curi->smode)) { + printf ("\tint cycles = val ? 2 : 0;\n"); addcycles000_3 ("\t"); } genastore ("val", curi->smode, "srcreg", curi->size, "src"); @@ -3860,7 +3888,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\t\tuae_u32 rem = (uae_u32)dst %% (uae_u32)(uae_u16)src;\n"); if (using_ce) { start_brace (); - printf ("\t\tint cycles = (getDivu68kCycles((uae_u32)dst, (uae_u16)src));\n"); + printf ("\t\tint cycles = (getDivu68kCycles((uae_u32)dst, (uae_u16)src)) - 4;\n"); addcycles000_3 ("\t\t"); } fill_prefetch_next (); @@ -3902,7 +3930,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tCLEAR_CZNV ();\n"); if (using_ce) { start_brace (); - printf ("\t\tint cycles = (getDivs68kCycles((uae_s32)dst, (uae_s16)src));\n"); + printf ("\t\tint cycles = (getDivs68kCycles((uae_s32)dst, (uae_s16)src)) - 4;\n"); addcycles000_3 ("\t\t"); } fill_prefetch_next (); @@ -4784,18 +4812,30 @@ static void gen_opcode (unsigned long int opcode) genamode (curi, curi->smode, "srcreg", curi->size, "extra", 1, 0, 0); sync_m68k_pc (); printf ("\tfpuop_arithmetic(opcode, extra);\n"); + if (using_prefetch || using_prefetch_020) { + printf ("\tif (regs.fp_exception) goto %s;\n", endlabelstr); + need_endlabel = 1; + } break; case i_FDBcc: fpulimit(); genamode (curi, curi->smode, "srcreg", curi->size, "extra", 1, 0, 0); sync_m68k_pc (); printf ("\tfpuop_dbcc (opcode, extra);\n"); + if (using_prefetch || using_prefetch_020) { + printf ("\tif (regs.fp_exception) goto %s;\n", endlabelstr); + need_endlabel = 1; + } break; case i_FScc: fpulimit(); genamode (curi, curi->smode, "srcreg", curi->size, "extra", 1, 0, 0); sync_m68k_pc (); printf ("\tfpuop_scc (opcode, extra);\n"); + if (using_prefetch || using_prefetch_020) { + printf ("\tif (regs.fp_exception) goto %s;\n", endlabelstr); + need_endlabel = 1; + } break; case i_FTRAPcc: fpulimit(); @@ -4805,6 +4845,10 @@ static void gen_opcode (unsigned long int opcode) genamode (curi, curi->smode, "srcreg", curi->size, "dummy", 1, 0, 0); sync_m68k_pc (); printf ("\tfpuop_trapcc (opcode, oldpc, extra);\n"); + if (using_prefetch || using_prefetch_020) { + printf ("\tif (regs.fp_exception) goto %s;\n", endlabelstr); + need_endlabel = 1; + } break; case i_FBcc: fpulimit(); @@ -4814,16 +4858,28 @@ static void gen_opcode (unsigned long int opcode) genamode (curi, curi->dmode, "srcreg", curi->size, "extra", 1, 0, 0); sync_m68k_pc (); printf ("\tfpuop_bcc (opcode, pc,extra);\n"); + if (using_prefetch || using_prefetch_020) { + printf ("\tif (regs.fp_exception) goto %s;\n", endlabelstr); + need_endlabel = 1; + } break; case i_FSAVE: fpulimit(); sync_m68k_pc (); printf ("\tfpuop_save (opcode);\n"); + if (using_prefetch || using_prefetch_020) { + printf ("\tif (regs.fp_exception) goto %s;\n", endlabelstr); + need_endlabel = 1; + } break; case i_FRESTORE: fpulimit(); sync_m68k_pc (); printf ("\tfpuop_restore (opcode);\n"); + if (using_prefetch || using_prefetch_020) { + printf ("\tif (regs.fp_exception) goto %s;\n", endlabelstr); + need_endlabel = 1; + } break; case i_CINVL: diff --git a/hardfile.cpp b/hardfile.cpp index 7e161428..ce60ce2a 100644 --- a/hardfile.cpp +++ b/hardfile.cpp @@ -205,8 +205,9 @@ void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int { uae_u8 block[512]; int i; + uae_u64 minsize = 512 * 1024 * 1024; - if (size <= 512 * 1024 * 1024) { + if (size <= minsize) { *phead = 1; *psectorspertrack = 32; } @@ -233,7 +234,7 @@ void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int } } } - getchsgeometry2 (size, pcyl, phead, psectorspertrack, 2); + getchsgeometry2 (size, pcyl, phead, psectorspertrack, size <= minsize ? 1 : 2); } void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry) diff --git a/include/arcadia.h b/include/arcadia.h index 732a7348..a246ff1c 100644 --- a/include/arcadia.h +++ b/include/arcadia.h @@ -12,9 +12,10 @@ extern struct romdata *scan_arcadia_rom (TCHAR*, int); struct arcadiarom { int romid; - TCHAR *name, *rom; + const TCHAR *name, *romid1, *romid2; int type, extra; int b7, b6, b5, b4, b3, b2, b1, b0; + const TCHAR *exts[16 + 1]; }; extern struct arcadiarom *arcadia_bios, *arcadia_game; diff --git a/include/blitter.h b/include/blitter.h index 1f59d79a..c9c80b47 100644 --- a/include/blitter.h +++ b/include/blitter.h @@ -22,11 +22,15 @@ extern enum blitter_states { extern struct bltinfo blt_info; -extern int blitter_nasty, blit_interrupt; +extern int blitter_nasty, blit_interrupt, blitter_dangerous_bpl; + +extern void check_is_blit_dangerous (uaecptr *bplpt, int planes, int words); extern uae_u16 bltsize; extern uae_u16 bltcon0, bltcon1; extern uae_u32 bltapt, bltbpt, bltcpt, bltdpt; +extern uae_u32 bltptx; +extern int bltptxpos, bltptxc; extern int blit_singlechannel; extern void maybe_blit (int, int); @@ -42,6 +46,7 @@ extern void blitter_done_notify (int hpos); extern void blitter_slowdown (int, int, int, int); extern int blitter_channel_state (void); extern void blitter_check_start (void); +extern void blitter_reset (void); typedef void blitter_func(uaecptr, uaecptr, uaecptr, uaecptr, struct bltinfo *); diff --git a/include/debug.h b/include/debug.h index 6447ec76..268cbdb8 100644 --- a/include/debug.h +++ b/include/debug.h @@ -74,9 +74,9 @@ extern struct memwatch_node mwnodes[MEMWATCH_TOTAL]; extern void memwatch_dump2 (TCHAR *buf, int bufsize, int num); -uae_u16 debug_wgetpeekdma_chipram (uaecptr addr, uae_u32 v); -uae_u16 debug_wputpeekdma_chipram (uaecptr addr, uae_u32 v); -uae_u16 debug_wputpeekdma_chipset (uaecptr addr, uae_u32 v); +uae_u16 debug_wgetpeekdma_chipram (uaecptr addr, uae_u32 v, int reg); +uae_u16 debug_wputpeekdma_chipram (uaecptr addr, uae_u32 v, int reg); +uae_u16 debug_wputpeekdma_chipset (uaecptr addr, uae_u32 v, int reg); void debug_lgetpeek (uaecptr addr, uae_u32 v); void debug_wgetpeek (uaecptr addr, uae_u32 v); void debug_bgetpeek (uaecptr addr, uae_u32 v); @@ -106,7 +106,7 @@ struct dma_rec #define DMA_EVENT_BLITIRQ 1 #define DMA_EVENT_BLITNASTY 2 -#define DMA_EVENT_BLITFINISHED 4 +#define DMA_EVENT_BLITSTARTFINISH 4 #define DMA_EVENT_BPLFETCHUPDATE 8 #define DMA_EVENT_COPPERWAKE 16 #define DMA_EVENT_CPUIRQ 32 @@ -118,11 +118,12 @@ struct dma_rec #define DMARECORD_COPPER 3 #define DMARECORD_AUDIO 4 #define DMARECORD_BLITTER 5 -#define DMARECORD_BLITTER_LINE 6 -#define DMARECORD_BITPLANE 7 -#define DMARECORD_SPRITE 8 -#define DMARECORD_DISK 9 -#define DMARECORD_MAX 10 +#define DMARECORD_BLITTER_FILL 6 +#define DMARECORD_BLITTER_LINE 7 +#define DMARECORD_BITPLANE 8 +#define DMARECORD_SPRITE 9 +#define DMARECORD_DISK 10 +#define DMARECORD_MAX 11 extern struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, int vpos, int type); extern void record_dma_reset (void); diff --git a/include/events.h b/include/events.h index 73df5264..733f2150 100644 --- a/include/events.h +++ b/include/events.h @@ -21,6 +21,7 @@ extern int vsynctimebase, syncbase; extern void reset_frame_rate_hack (void); extern unsigned long int vsync_cycles; extern unsigned long start_cycles; +extern int event2_count; extern void compute_vsynctime (void); extern void init_eventtab (void); diff --git a/include/inputdevice.h b/include/inputdevice.h index 85c73067..e25c78b7 100644 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -81,6 +81,7 @@ struct inputevent { #define ID_FLAG_GAMEPORTSCUSTOM2 8 #define ID_FLAG_INVERTTOGGLE 16 #define ID_FLAG_INVERT 32 +#define ID_FLAG_RESERVEDGAMEPORTSCUSTOM 64 #define ID_FLAG_GAMEPORTSCUSTOM_MASK (ID_FLAG_GAMEPORTSCUSTOM1 | ID_FLAG_GAMEPORTSCUSTOM2) #define ID_FLAG_AUTOFIRE_MASK (ID_FLAG_TOGGLE | ID_FLAG_INVERTTOGGLE | ID_FLAG_AUTOFIRE) @@ -139,7 +140,7 @@ struct inputevent { #define MAX_COMPA_INPUTLIST 30 extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af); -extern bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, uae_u64 flags, int port); +extern bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, uae_u64 flags, int port, int input_selected_setting); extern int inputdevice_set_mapping (int devnum, int num, const TCHAR *name, TCHAR *custom, uae_u64 flags, int port, int sub); extern int inputdevice_get_mapping (int devnum, int num, uae_u64 *pflags, int *port, TCHAR *name, TCHAR *custom, int sub); extern void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst); @@ -187,6 +188,7 @@ extern int input_mousehack_status (int mode, uaecptr diminfo, uaecptr dispinfo, extern void input_mousehack_mouseoffset (uaecptr pointerprefs); extern int mousehack_alive (void); extern void setmouseactive (int); +extern bool ismouseactive (void); extern void setmousebuttonstateall (int mouse, uae_u32 buttonbits, uae_u32 buttonmask); extern void setjoybuttonstateall (int joy, uae_u32 buttonbits, uae_u32 buttonmask); diff --git a/include/newcpu.h b/include/newcpu.h index b0ff1136..f836bbb8 100644 --- a/include/newcpu.h +++ b/include/newcpu.h @@ -164,6 +164,7 @@ struct regstruct uae_u32 fpcr, fpsr, fpiar; uae_u32 fpsr_highbyte; uae_u32 fpu_state; + bool fp_exception; #endif #ifndef CPUEMU_68000_ONLY uae_u32 cacr, caar; diff --git a/include/options.h b/include/options.h index d9a68138..7d03b364 100644 --- a/include/options.h +++ b/include/options.h @@ -9,7 +9,7 @@ #define UAEMAJOR 2 #define UAEMINOR 7 -#define UAESUBREV 0 +#define UAESUBREV 1 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang; @@ -63,6 +63,7 @@ struct jport { int autofire; TCHAR name[MAX_JPORTNAME]; TCHAR configname[MAX_JPORTNAME]; + bool nokeyboardoverride; }; #define JPORT_NONE -1 #define JPORT_CUSTOM -2 @@ -305,7 +306,7 @@ struct uae_prefs { struct wh gfx_size; struct wh gfx_size_win_xtra[6]; struct wh gfx_size_fs_xtra[6]; - bool gfx_autoresolution; + int gfx_autoresolution; int gfx_autoresolution_delay; int gfx_autoresolution_minv, gfx_autoresolution_minh; bool gfx_scandoubler; diff --git a/include/sysdeps.h b/include/sysdeps.h index 189959c3..394c59c0 100644 --- a/include/sysdeps.h +++ b/include/sysdeps.h @@ -455,6 +455,7 @@ extern void flush_log (void); extern TCHAR *setconsolemode (TCHAR *buffer, int maxlen); extern void close_console (void); extern void reopen_console (void); +extern void activate_console (void); extern void console_out (const TCHAR *); extern void console_out_f (const TCHAR *, ...); extern void console_flush (void); diff --git a/inputdevice.cpp b/inputdevice.cpp index 2bcab149..058c10cf 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -272,8 +272,10 @@ uae_u8 *save_input (int *len, uae_u8 *dstptr) static void freejport (struct uae_prefs *dst, int num) { + bool override = dst->jports[num].nokeyboardoverride; memset (&dst->jports[num], 0, sizeof (struct jport)); dst->jports[num].id = -1; + dst->jports[num].nokeyboardoverride = override; } static void copyjport (const struct uae_prefs *src, struct uae_prefs *dst, int num) { @@ -285,6 +287,7 @@ static void copyjport (const struct uae_prefs *src, struct uae_prefs *dst, int n dst->jports[num].id = src->jports[num].id; dst->jports[num].mode = src->jports[num].mode; dst->jports[num].autofire = src->jports[num].autofire; + dst->jports[num].nokeyboardoverride = src->jports[num].nokeyboardoverride; } static void out_config (struct zfile *f, int id, int num, const TCHAR *s1, const TCHAR *s2) @@ -749,10 +752,9 @@ static void set_kbr_default (struct uae_prefs *p, int index, int devnum, struct if (devnum >= 0 && devnum != j) continue; kbr = &p->keyboard_settings[index][j]; - for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { - clear_id (kbr); + clear_id (kbr); + for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) kbr->extra[i] = -1; - } if (j < id->get_num ()) { if (input_get_default_keyboard (j)) kbr->enabled = 1; @@ -1581,6 +1583,8 @@ static void mousehack_helper (uae_u32 buttonmask) int x, y; float fdy, fdx, fmx, fmy; + //write_log (_T("mousehack_helper %08X\n"), buttonmask); + if (currprefs.input_magic_mouse == 0 && currprefs.input_tablet < TABLET_MOUSEHACK) return; #if 0 @@ -2377,6 +2381,14 @@ static void inject_events (const TCHAR *str) } } +struct delayed_event +{ + TCHAR *event_string; + int delay; + struct delayed_event *next; +}; +static struct delayed_event *delayed_events; + static int handle_custom_event (const TCHAR *custom) { TCHAR *p, *buf, *nextp; @@ -2406,7 +2418,28 @@ static int handle_custom_event (const TCHAR *custom) } } //write_log (L"-> '%s'\n", p); - if (!_tcsicmp (p, _T("no_config_check"))) { + if (!_tcsnicmp (p, _T("delay "), 6)) { + int delay = _tstol (p + 6); + if (delay >= 0) { + struct delayed_event *de = delayed_events; + while (de) { + if (de->delay < 0) { + de->delay = delay; + de->event_string = my_strdup (p2); + break; + } + de = de->next; + } + if (!de) { + de = xcalloc (delayed_event, 1); + de->next = delayed_events; + delayed_events = de; + de->delay = delay; + de->event_string = my_strdup (p2); + } + } + break; + } else if (!_tcsicmp (p, _T("no_config_check"))) { config_changed = 0; } else if (!_tcsicmp (p, _T("do_config_check"))) { set_config_changed (); @@ -3373,6 +3406,22 @@ void inputdevice_vsync (void) input_frame++; mouseupdate (0, true); + struct delayed_event *de = delayed_events; + while (de) { + if (de->delay > 0) + de->delay--; + if (de->delay == 0) { + de->delay = -1; + if (de->event_string) { + TCHAR *s = de->event_string; + de->event_string = NULL; + handle_custom_event (s); + xfree (s); + } + } + de = de->next; + } + if (!input_record) { inputdevice_read (); if (!input_play) @@ -3411,6 +3460,13 @@ void inputdevice_reset (void) if (inputdevice_is_tablet ()) mousehack_enable (); bouncy = 0; + while (delayed_events) { + struct delayed_event *de = delayed_events; + delayed_events = de->next; + xfree (de->event_string); + xfree (de); + } + } static int getoldport (struct uae_input_device *id) @@ -4375,6 +4431,12 @@ static void inputdevice_sparerestore (struct uae_input_device *uid, int num, int uid->flags[num][SPARE_SUB_EVENT] = 0; uid->port[num][SPARE_SUB_EVENT] = 0; uid->custom[num][SPARE_SUB_EVENT] = 0; + if (uid->flags[num][MAX_INPUT_SUB_EVENT - 1] & ID_FLAG_RESERVEDGAMEPORTSCUSTOM) { + uid->eventid[num][MAX_INPUT_SUB_EVENT - 1] = 0; + uid->flags[num][MAX_INPUT_SUB_EVENT - 1] = 0; + uid->port[num][MAX_INPUT_SUB_EVENT - 1] = 0; + uid->custom[num][MAX_INPUT_SUB_EVENT - 1] = 0; + } } void inputdevice_sparecopy (struct uae_input_device *uid, int num, int sub) @@ -4397,7 +4459,7 @@ void inputdevice_sparecopy (struct uae_input_device *uid, int num, int sub) } } -static void setcompakb (int *kb, int *srcmap, int index, int af) +static void setcompakb (struct uae_prefs *p, int *kb, int *srcmap, int index, int af) { int j, k; k = j = 0; @@ -4409,6 +4471,14 @@ static void setcompakb (int *kb, int *srcmap, int index, int af) for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) { if (uid->extra[l] == id) { inputdevice_sparecopy (uid, l, 0); + + if (p->jports[index].nokeyboardoverride && uid->port[l][0] == 0) { + uid->eventid[l][MAX_INPUT_SUB_EVENT - 1] = uid->eventid[l][0]; + uid->flags[l][MAX_INPUT_SUB_EVENT - 1] = uid->flags[l][0] | ID_FLAG_RESERVEDGAMEPORTSCUSTOM; + uid->custom[l][MAX_INPUT_SUB_EVENT - 1] = my_strdup (uid->custom[l][0]); + uid->eventid[l][MAX_INPUT_SUB_EVENT - 1] = uid->eventid[l][0]; + } + uid->eventid[l][0] = srcmap[k]; uid->flags[l][0] &= COMPA_RESERVED_FLAGS; uid->port[l][0] = index + 1; @@ -5015,19 +5085,19 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports) case JSEM_MODE_JOYSTICK_CD32: case JSEM_MODE_DEFAULT: if (cd32) { - setcompakb (kb, i ? ip_joycd322 : ip_joycd321, i, af); + setcompakb (prefs, kb, i ? ip_joycd322 : ip_joycd321, i, af); joymodes[i] = JSEM_MODE_JOYSTICK_CD32; } else if (mode == JSEM_MODE_GAMEPAD) { - setcompakb (kb, i ? ip_joypad2 : ip_joypad1, i, af); + setcompakb (prefs, kb, i ? ip_joypad2 : ip_joypad1, i, af); joymodes[i] = JSEM_MODE_GAMEPAD; } else { - setcompakb (kb, i ? ip_joy2 : ip_joy1, i, af); + setcompakb (prefs, kb, i ? ip_joy2 : ip_joy1, i, af); joymodes[i] = JSEM_MODE_JOYSTICK; } break; case JSEM_MODE_MOUSE: case JSEM_MODE_WHEELMOUSE: - setcompakb (kb, i ? ip_mouse2 : ip_mouse1, i, af); + setcompakb (prefs, kb, i ? ip_mouse2 : ip_mouse1, i, af); joymodes[i] = JSEM_MODE_WHEELMOUSE; break; } @@ -5037,12 +5107,12 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports) } } if (arcadia_bios) { - setcompakb (keyboard_default_kbmaps[KBR_DEFAULT_MAP_ARCADIA], ip_arcadia, 0, 0); + setcompakb (prefs, keyboard_default_kbmaps[KBR_DEFAULT_MAP_ARCADIA], ip_arcadia, 0, 0); if (JSEM_ISXARCADE1 (i, prefs) || JSEM_ISXARCADE2 (i, prefs)) - setcompakb (keyboard_default_kbmaps[KBR_DEFAULT_MAP_ARCADIA_XA], ip_arcadiaxa, JSEM_ISXARCADE2 (i, prefs) ? 1 : 0, prefs->jports[i].autofire); + setcompakb (prefs, keyboard_default_kbmaps[KBR_DEFAULT_MAP_ARCADIA_XA], ip_arcadiaxa, JSEM_ISXARCADE2 (i, prefs) ? 1 : 0, prefs->jports[i].autofire); } if (0 && currprefs.cs_cdtvcd) { - setcompakb (keyboard_default_kbmaps[KBR_DEFAULT_MAP_CDTV], ip_mediacdtv, 0, 0); + setcompakb (prefs, keyboard_default_kbmaps[KBR_DEFAULT_MAP_CDTV], ip_mediacdtv, 0, 0); } // parport @@ -5078,7 +5148,7 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports) else if (JSEM_ISXARCADE2 (i, prefs)) kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_XA2]; if (kb) { - setcompakb (kb, i == 3 ? ip_parjoy2default : ip_parjoy1default, i, prefs->jports[i].autofire); + setcompakb (prefs, kb, i == 3 ? ip_parjoy2default : ip_parjoy1default, i, prefs->jports[i].autofire); used[joy] = 1; joymodes[i] = JSEM_MODE_JOYSTICK; } @@ -5208,16 +5278,16 @@ static void matchdevices_all (struct uae_prefs *prefs) } } -bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, uae_u64 flags, int port) +bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, uae_u64 flags, int port, int input_selected_setting) { TCHAR name[256]; struct inputevent *ie; int sub; if (evtnum < 0) { - joysticks = prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS]; - mice = prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS]; - keyboards = prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS]; + joysticks = prefs->joystick_settings[input_selected_setting]; + mice = prefs->mouse_settings[input_selected_setting]; + keyboards = prefs->keyboard_settings[input_selected_setting]; for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { int port2 = 0; inputdevice_get_mapping (devnum, num, NULL, &port2, NULL, NULL, sub); @@ -5230,9 +5300,9 @@ bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int ie = inputdevice_get_eventinfo (evtnum); if (!inputdevice_get_eventname (ie, name)) return false; - joysticks = prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS]; - mice = prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS]; - keyboards = prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS]; + joysticks = prefs->joystick_settings[input_selected_setting]; + mice = prefs->mouse_settings[input_selected_setting]; + keyboards = prefs->keyboard_settings[input_selected_setting]; sub = 0; if (inputdevice_get_widget_type (devnum, num, NULL) != IDEV_WIDGET_KEY) { @@ -5607,8 +5677,9 @@ static int inputdevice_translatekeycode_2 (int keyboard, int scancode, int keyst *flagsp ^= ID_FLAG_TOGGLED; toggled = (*flagsp & ID_FLAG_TOGGLED) ? 1 : 0; handled |= handle_input_event (evt, toggled, 1, autofire, true, false); - if (k == 0) + if (k == 0) { didcustom |= process_custom_event (na, j, state, qualmask, autofire, k); + } } else { rqualifiers (flags, state ? true : false); if (!checkqualifiers (evt, flags, qualmask, na->eventid[j])) { diff --git a/memory.cpp b/memory.cpp index a9f5ad5a..28bf9b4a 100644 --- a/memory.cpp +++ b/memory.cpp @@ -450,11 +450,14 @@ void REGPARAM2 chipmem_wput (uaecptr addr, uae_u32 w) m = (uae_u16 *)(chipmem_bank.baseaddr + addr); do_put_mem_word (m, w); #if 0 - if (addr == 0x120) { + if (addr == 4) { + write_log (_T("*")); +#if 0 if (told) tables[toldv] += hsync_counter - told; told = hsync_counter; toldv = w; +#endif } #endif } @@ -1830,7 +1833,11 @@ static void fill_ce_banks (void) { int i; - memset (ce_banktype, CE_MEMBANK_FAST32, sizeof ce_banktype); + if (currprefs.cpu_model <= 68010) { + memset (ce_banktype, CE_MEMBANK_FAST16, sizeof ce_banktype); + } else { + memset (ce_banktype, CE_MEMBANK_FAST32, sizeof ce_banktype); + } // data cachable regions (2 = burst supported) memset (ce_cachable, 0, sizeof ce_cachable); memset (ce_cachable + (0x00200000 >> 16), 1 | 2, currprefs.fastmem_size >> 16); @@ -1867,6 +1874,7 @@ static void fill_ce_banks (void) for (i = (0xf80000 >> 16); i <= (0xff0000 >> 16); i++) ce_banktype[i] = CE_MEMBANK_FAST16; } + if (currprefs.address_space_24) { for (i = 1; i < 256; i++) memcpy (&ce_banktype[i * 256], &ce_banktype[0], 256); diff --git a/newcpu.cpp b/newcpu.cpp index f941fb28..074379dc 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -2226,7 +2226,7 @@ static void exception_debug (int nr) Address/Bus Error: -- 6 idle cycles +- 8 idle cycles - write PC low word - write SR - write PC high word @@ -2243,7 +2243,7 @@ Address/Bus Error: Division by Zero: -- 6 idle cycles +- 8 idle cycles - write PC low word - write SR - write PC high word @@ -2255,7 +2255,7 @@ Division by Zero: Traps: -- 2 idle cycles +- 4 idle cycles - write PC low word - write SR - write PC high word @@ -2267,6 +2267,7 @@ Traps: TrapV: +(- normal prefetch done by TRAPV) - write PC low word - write SR - write PC high word @@ -2278,7 +2279,7 @@ TrapV: CHK: -- 6 idle cycles +- 8 idle cycles - write PC low word - write SR - write PC high word @@ -2289,8 +2290,11 @@ CHK: - prefetch Illegal Instruction: +Privilege violation: +Line A: +Line F: -- 2 idle cycles +- 4 idle cycles - write PC low word - write SR - write PC high word @@ -2323,13 +2327,16 @@ static void Exception_ce000 (int nr) int start, interrupt; start = 6; - if (nr == 7) // TRAPV - start = 0; - else if (nr >= 32 && nr < 32 + 16) // TRAP #x - start = 2; - else if (nr == 4 || nr == 8) // ILLG & PRIVIL VIOL - start = 2; interrupt = nr >= 24 && nr < 24 + 8; + if (!interrupt) { + start = 8; + if (nr == 7) // TRAPV + start = 0; + else if (nr >= 32 && nr < 32 + 16) // TRAP #x + start = 4; + else if (nr == 4 || nr == 8 || nr == 10 || nr == 11) // ILLG, PRIV, LINEA, LINEF + start = 4; + } if (start) x_do_cycles (start * cpucycleunit); @@ -3490,9 +3497,11 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcode) return 4; } - if (opcode == 0x4E7B && inrom && get_long (0x10) == 0) { - notify_user (NUMSG_KS68020); - uae_restart (-1, NULL); + if (opcode == 0x4E7B && inrom) { + if (get_long (0x10) == 0) { + notify_user (NUMSG_KS68020); + uae_restart (-1, NULL); + } } #ifdef AUTOCONFIG @@ -6950,7 +6959,10 @@ void fill_prefetch_020 (void) if (currprefs.cpu_cycle_exact) do_cycles_ce020 (2); regs.prefetch020[1] = regs.cacheholdingdata020; - regs.irc = get_word_020_prefetch (0); + if (currprefs.cpu_cycle_exact) + regs.irc = get_word_ce020_prefetch (0); + else + regs.irc = get_word_020_prefetch (0); } void fill_prefetch (void) diff --git a/od-win32/blkdev_win32_spti.cpp b/od-win32/blkdev_win32_spti.cpp index 074819d2..c81fc04b 100644 --- a/od-win32/blkdev_win32_spti.cpp +++ b/od-win32/blkdev_win32_spti.cpp @@ -440,7 +440,7 @@ static void checkcapabilities (struct dev_info_spti *di) status = DeviceIoControl (di->handle, IOCTL_STORAGE_QUERY_PROPERTY, &query, sizeof query, &desc, sizeof desc, &ret, NULL); if (status) { - if (desc.Version > offsetof (STORAGE_ADAPTER_DESCRIPTOR, BusType)) + if (desc.Size > offsetof (STORAGE_ADAPTER_DESCRIPTOR, BusType)) write_log (_T("SCSI CAPS: BusType=%d, MaxTransfer=0x%08X, Mask=0x%08X\n"), desc.BusType, desc.MaximumTransferLength, desc.AlignmentMask); } @@ -820,7 +820,7 @@ static void scanscsi (void) InquiryData = (PSCSI_INQUIRY_DATA) ((PUCHAR)AdapterInfo + InquiryData->NextInquiryDataOffset); } // for Luns } // for Bus - CloseHandle(h); + CloseHandle (h); } } diff --git a/od-win32/cloanto/RetroPlatformIPC.h b/od-win32/cloanto/RetroPlatformIPC.h index d143bf21..3b3b8f17 100644 --- a/od-win32/cloanto/RetroPlatformIPC.h +++ b/od-win32/cloanto/RetroPlatformIPC.h @@ -9,7 +9,7 @@ : Software Foundation. Authors : os, mcb Created : 2007-08-27 13:55:49 - Updated : 2013-12-02 10:26:00 + Updated : 2013-12-06 11:14:00 Comment : RetroPlatform Player interprocess communication include file *****************************************************************************/ @@ -120,10 +120,10 @@ typedef struct RPScreenMode { DWORD dwScreenMode; // RP_SCREENMODE_* values and flags - LONG lClipLeft; // in guest pixel units (Amiga: Super Hires or RTG); -1 = ignore (0 is a valid value); see http://www.retroplatform.com/kb/19-115 - LONG lClipTop; // in guest pixel units (Amiga: interlaced or RTG); -1 = ignore (0 is a valid value) - LONG lClipWidth; // in guest pixel units (Amiga: Super Hires or RTG); -1 = ignore - LONG lClipHeight; // in guest pixel units (Amiga: interlaced or RTG); -1 = ignore + LONG lClipLeft; // in guest pixel units (Amiga: Super Hires or RTG); -1 = ignore (0 is a valid value); guest should also ignore this if RP_CLIPFLAGS_AUTOCLIP or RP_CLIPFLAGS_NOCLIP; see http://www.retroplatform.com/kb/19-115 + LONG lClipTop; // in guest pixel units (Amiga: interlaced or RTG); -1 = ignore (0 is a valid value); guest should also ignore this if RP_CLIPFLAGS_AUTOCLIP or RP_CLIPFLAGS_NOCLIP + LONG lClipWidth; // in guest pixel units (Amiga: Super Hires or RTG); -1 = ignore; guest should also ignore this if RP_CLIPFLAGS_AUTOCLIP or RP_CLIPFLAGS_NOCLIP + LONG lClipHeight; // in guest pixel units (Amiga: interlaced or RTG); -1 = ignore; guest should also ignore this if RP_CLIPFLAGS_AUTOCLIP or RP_CLIPFLAGS_NOCLIP HWND hGuestWindow; // only valid for RP_IPC_TO_HOST_SCREENMODE DWORD dwClipFlags; // clip flags (or 0) LONG lTargetWidth; // in exact host pixels; if set, must also set lTargetHeight; ignored unless RP_SCREENMODE_SCALE_TARGET is set (resulting size is result of clipping and scaling); RP_SCREENMODE_SCALING_SUBPIXEL and RP_SCREENMODE_SCALING_STRETCH are taken into account @@ -401,6 +401,7 @@ typedef struct RPDeviceContent // RPScreenCapture (used by RP_IPC_TO_GUEST_SCREENCAPTURE to request one bitmap or two simultaneous bitmaps) +// See RP_GUESTSCREENFLAGS_ for return code and flags typedef struct RPScreenCapture { @@ -411,8 +412,8 @@ typedef struct RPScreenCapture // // The return value of RP_IPC_TO_GUEST_SCREENCAPTURE serves to both indicate an error (if 0) -// and for the guest to process the raw image (i.e. to scale and present appropriate PAL/NTSC -// options to the user). +// and (if set to other RP_GUESTSCREENFLAGS_ values) to allow the guest to interpret and +// process the raw image (i.e. to scale and present appropriate PAL/NTSC options to the user). // // If the raw image is not the same as the Amiga bitmap, then out of necessity the flags // describe the properties of the image that is sent to the host, not the Amiga mode. Otherwise @@ -449,6 +450,8 @@ typedef struct RPScreenCapture // // Return codes for RP_IPC_TO_GUEST_SCREENCAPTURE +// Note: the flags describe the "raw" image with 1:1 pixels, not the "filtered" one which is scaled + #define RP_SCREENCAPTURE_ERROR 0x00000000 // non-error is always >= 1 (because of "MODE" flags) #define RP_GUESTSCREENFLAGS_MODE_DIGITAL 0x00000001 // "RTG" on Amiga, might be referred to as VGA or other digital (non-TV) mode on other systems diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 05b33b2c..c262e483 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -102,6 +102,7 @@ struct didata { int wininput; int catweasel; int coop; + int xinput; HANDLE parjoy; PAR_QUERY_INFORMATION oldparjoystatus; @@ -1576,6 +1577,8 @@ static bool initialize_rawinput (void) num_joystick++; rhid++; v = rhid; + if (_tcsstr (buf1, _T("IG_"))) + did->xinput = 1; } prodname[0] = 0; @@ -1596,10 +1599,11 @@ static bool initialize_rawinput (void) _tcscpy (tmp, prodname); did->fullname = true; } else { + TCHAR *st = type == RIM_TYPEHID ? (did->xinput ? _T("RAW HID+XINPUT") : _T("RAW HID")) : (type == RIM_TYPEMOUSE ? _T("RAW Mouse") : _T("RAW Keyboard")); if (did->vid > 0 && did->pid > 0) - _stprintf (tmp, _T("%s (%04X/%04X)"), type == RIM_TYPEHID ? _T("RAW HID") : (type == RIM_TYPEMOUSE ? _T("RAW Mouse") : _T("RAW Keyboard")), did->vid, did->pid); + _stprintf (tmp, _T("%s (%04X/%04X)"), st, did->vid, did->pid); else - _stprintf (tmp, _T("%s"), type == RIM_TYPEHID ? _T("RAW HID") : (type == RIM_TYPEMOUSE ? _T("RAW Mouse") : _T("RAW Keyboard"))); + _stprintf (tmp, _T("%s"), st); } did->name = my_strdup (tmp); did->rawinput = h; @@ -1887,7 +1891,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) } } if (rawinput_log & 2) - write_log (_T("%08x %04x %04x %04x %08x %3d %3d %08x M=%d\n"), + write_log (_T("%08x %04x %04x %04x %08x %3d %3d %08x M=%d F=%d\n"), raw->header.hDevice, rm->usFlags, rm->usButtonFlags, @@ -1895,7 +1899,8 @@ static void handle_rawinput_2 (RAWINPUT *raw) rm->ulRawButtons, rm->lLastX, rm->lLastY, - rm->ulExtraInformation, num < num_mouse ? num + 1 : -1); + rm->ulExtraInformation, num < num_mouse ? num + 1 : -1, + isfocus ()); if (num == num_mouse) return; diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index 3b208f51..c47bc86c 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -584,10 +584,12 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname) h = INVALID_HANDLE_VALUE; } if (udi == NULL) { + write_log (_T("Enumerating drives..\n")); hdf_init_target (); drvnum = isharddrive (name); if (drvnum >= 0) udi = &uae_drives[drvnum]; + write_log (_T("Enumeration end..\n")); } if (udi != NULL) { DWORD r; diff --git a/od-win32/lib/prowizard.lib b/od-win32/lib/prowizard.lib index 814ab717..d2c44a93 100644 Binary files a/od-win32/lib/prowizard.lib and b/od-win32/lib/prowizard.lib differ diff --git a/od-win32/lib/prowizard_x64.lib b/od-win32/lib/prowizard_x64.lib index 6b286d3a..0eff7af0 100644 Binary files a/od-win32/lib/prowizard_x64.lib and b/od-win32/lib/prowizard_x64.lib differ diff --git a/od-win32/prowizard/prowizard.vcxproj b/od-win32/prowizard/prowizard.vcxproj index 15276016..c38622b0 100644 --- a/od-win32/prowizard/prowizard.vcxproj +++ b/od-win32/prowizard/prowizard.vcxproj @@ -53,7 +53,7 @@ StaticLibrary Unicode true - v110 + v120 StaticLibrary @@ -138,7 +138,7 @@ Level3 ProgramDatabase - StdCall + FastCall Default 4996;%(DisableSpecificWarnings) @@ -211,7 +211,7 @@ Level3 ProgramDatabase - StdCall + FastCall Default 4996;%(DisableSpecificWarnings) diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 3d36f395..7fc656a3 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -462,9 +462,9 @@ #define IDC_BLITWAIT 1175 #define IDC_LORES 1176 #define IDC_RATE2BOX 1177 +#define IDC_AUTORESOLUTIONSELECT 1178 #define IDC_LORES_SMOOTHED 1179 #define IDC_FLICKERFIXER 1180 -#define IDC_AUTORESOLUTION 1181 #define IDC_RATE2ENABLE 1182 #define IDC_FRAMERATE 1185 #define IDC_XSIZE 1187 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 8708091b..055b25a9 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -104,7 +104,7 @@ BEGIN PUSHBUTTON "...",IDC_RTCCHOOSER,376,189,10,15 END -IDD_DISPLAY DIALOGEX 0, 0, 396, 279 +IDD_DISPLAY DIALOGEX 0, 0, 396, 298 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN @@ -118,7 +118,7 @@ BEGIN EDITTEXT IDC_XSIZE,59,56,56,12,ES_NUMBER EDITTEXT IDC_YSIZE,122,56,56,12,ES_NUMBER COMBOBOX IDC_DISPLAY_BUFFERCNT,266,56,119,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Settings",IDC_SETTINGSTEXT,1,86,283,144 + GROUPBOX "Settings",IDC_SETTINGSTEXT,1,86,283,163 RTEXT "Native:",IDC_STATIC,9,98,48,15,SS_CENTERIMAGE COMBOBOX IDC_SCREENMODE_NATIVE,61,98,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_SCREENMODE_NATIVE2,142,98,127,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP @@ -128,16 +128,15 @@ BEGIN CONTROL "Blacker than black",IDC_BLACKER_THAN_BLACK,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,140,142,10 CONTROL "Filtered low resolution",IDC_LORES_SMOOTHED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,140,116,10 CONTROL "Remove interlace artifacts",IDC_FLICKERFIXER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,154,142,10 - CONTROL "Resolution autoswitch",IDC_AUTORESOLUTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,154,116,10 - RTEXT "Resolution:",IDC_STATIC,27,170,110,8,SS_CENTERIMAGE + RTEXT "Resolution:",IDC_STATIC,24,170,110,8,SS_CENTERIMAGE COMBOBOX IDC_LORES,142,169,127,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - RTEXT "Refresh:",IDC_REFRESHTEXT,11,190,57,8 - CONTROL "Slider1",IDC_FRAMERATE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,185,99,20 - COMBOBOX IDC_RATE2BOX,181,190,60,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - RTEXT "FPS adj.:",IDC_REFRESH2TEXT,9,211,61,8 - CONTROL "",IDC_FRAMERATE2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,206,99,20 - EDITTEXT IDC_RATE2TEXT,181,210,46,12,ES_AUTOHSCROLL - CONTROL "",IDC_RATE2ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,232,211,8,10 + RTEXT "Refresh:",IDC_REFRESHTEXT,11,209,57,8 + CONTROL "Slider1",IDC_FRAMERATE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,204,99,20 + COMBOBOX IDC_RATE2BOX,210,209,60,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + RTEXT "FPS adj.:",IDC_REFRESH2TEXT,9,230,61,8 + CONTROL "",IDC_FRAMERATE2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,71,225,99,20 + EDITTEXT IDC_RATE2TEXT,210,229,46,12,ES_AUTOHSCROLL + CONTROL "",IDC_RATE2ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,261,230,8,10 GROUPBOX "Centering",IDC_STATIC,289,86,105,46 CONTROL "Horizontal",IDC_XCENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,100,90,10 CONTROL "Vertical",IDC_YCENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,116,90,10 @@ -150,10 +149,12 @@ BEGIN CONTROL "Double, frames",IDC_LM_IDOUBLED,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,228,90,10 CONTROL "Double, fields",IDC_LM_IDOUBLED2,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,241,90,10 CONTROL "Double, fields+",IDC_LM_IDOUBLED3,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,254,90,10 - COMBOBOX IDC_DA_MODE,15,245,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_DA_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,96,241,96,20 - EDITTEXT IDC_DA_TEXT,205,245,56,12,ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "Reset to defaults",IDC_DA_RESET,156,263,106,14 + COMBOBOX IDC_DA_MODE,15,260,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_DA_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,96,256,96,20 + EDITTEXT IDC_DA_TEXT,205,260,56,12,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "Reset to defaults",IDC_DA_RESET,156,278,106,14 + COMBOBOX IDC_AUTORESOLUTIONSELECT,210,189,59,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + RTEXT "Resolution autoswitch:",IDC_STATIC,92,190,110,8,SS_CENTERIMAGE END IDD_MEMORY DIALOGEX 0, 0, 396, 206 @@ -1179,8 +1180,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,7,0,0 - PRODUCTVERSION 2,7,0,0 + FILEVERSION 2,7,1,0 + PRODUCTVERSION 2,7,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -1196,12 +1197,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "WinUAE" - VALUE "FileVersion", "2.7.0.0" + VALUE "FileVersion", "2.7.1.0" VALUE "InternalName", "WinUAE" VALUE "LegalCopyright", "© 1996-2013 under the GNU Public License (GPL)" VALUE "OriginalFilename", "WinUAE.exe" VALUE "ProductName", "WinUAE" - VALUE "ProductVersion", "2.7.0.0" + VALUE "ProductVersion", "2.7.1.0" END END BLOCK "VarFileInfo" diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index 9b5541be..38a9a958 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -355,7 +355,7 @@ int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TC } if (wdnum >= 0) { write_log (_T("kb=%d (%s) wdnum=%d\n"), j, inputdevicefunc_keyboard.get_friendlyname (j), wdnum); - inputdevice_set_gameports_mapping (&changed_prefs, kb + j, wdnum, evtnum, flags, inputmap_port); + inputdevice_set_gameports_mapping (&changed_prefs, kb + j, wdnum, evtnum, flags, inputmap_port, GAMEPORT_INPUT_SETTINGS); } else { write_log (_T("kb=%d (%): keycode %02x not found!\n"), j, inputdevicefunc_keyboard.get_friendlyname (j), kc); } @@ -593,14 +593,16 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p, bool g int xp, yp; get_custom_raw_limits (&rw, &rh, &rx, &ry); - get_custom_topedge (&xp, &yp, false); - rx += xp; - ry += yp; - rw <<= RES_MAX - currprefs.gfx_resolution; - rx <<= RES_MAX - currprefs.gfx_resolution; - rh <<= VRES_MAX - currprefs.gfx_vresolution; - ry <<= VRES_MAX - currprefs.gfx_vresolution; - //write_log (_T("* %d %d %d %d\n"), rx, ry, rw, rh); + if (rx >= 0 && ry >= 0) { + get_custom_topedge (&xp, &yp, false); + rx += xp; + ry += yp; + rw <<= RES_MAX - currprefs.gfx_resolution; + rx <<= RES_MAX - currprefs.gfx_resolution; + rh <<= VRES_MAX - currprefs.gfx_vresolution; + ry <<= VRES_MAX - currprefs.gfx_vresolution; + } + write_log (_T("GET_RPSM: %d %d %d %d\n"), rx, ry, rw, rh); hmult = p->gfx_filter_horiz_zoom_mult; vmult = p->gfx_filter_vert_zoom_mult; @@ -625,17 +627,14 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p, bool g m = RP_SCREENMODE_SCALE_1X; } - if (getclip && p->gfx_xcenter_pos < 0 && p->gfx_ycenter_pos < 0) { + if (rx > 0 && ry > 0) { sm->lClipLeft = rx; sm->lClipTop = ry; - } else { - sm->lClipLeft = p->gfx_xcenter_pos < 0 ? -1 : p->gfx_xcenter_pos; - sm->lClipTop = p->gfx_ycenter_pos < 0 ? -1 : p->gfx_ycenter_pos; - } - if (getclip && p->gfx_xcenter_size <= 0 && p->gfx_ycenter_size <= 0) { sm->lClipWidth = rw; sm->lClipHeight = rh; } else { + sm->lClipLeft = p->gfx_xcenter_pos < 0 ? -1 : p->gfx_xcenter_pos; + sm->lClipTop = p->gfx_ycenter_pos < 0 ? -1 : p->gfx_ycenter_pos; sm->lClipWidth = p->gfx_xcenter_size <= 0 ? -1 : p->gfx_xcenter_size; sm->lClipHeight = p->gfx_ycenter_size <= 0 ? -1 : p->gfx_ycenter_size; } diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index bf52d773..28fd1063 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -139,6 +139,7 @@ static void *tablet; HCURSOR normalcursor; static HWND hwndNextViewer; HANDLE AVTask; +static int all_events_disabled; TCHAR VersionStr[256]; TCHAR BetaStr[64]; @@ -662,21 +663,33 @@ static bool iswindowfocus (void) return donotfocus == false; } +bool ismouseactive (void) +{ + return mouseactive > 0; +} + static void setmouseactive2 (int active, bool allowpause) { +#ifdef RETROPLATFORM + bool isrp = rp_isactive () != 0; +#else + bool isrp = false; +#endif + //write_log (_T("setmouseactive %d->%d showcursor=%d focus=%d recap=%d\n"), mouseactive, active, showcursor, focus, recapture); + if (active == 0) releasecapture (); if (mouseactive == active && active >= 0) return; - if (active == 1 && !currprefs.input_magic_mouse) { + if (!isrp && active == 1 && !currprefs.input_magic_mouse) { HANDLE c = GetCursor (); if (c != normalcursor) return; } if (active) { - if (IsWindowVisible (hAmigaWnd) == FALSE) + if (!isrp && !IsWindowVisible (hAmigaWnd)) return; } @@ -696,15 +709,16 @@ static void setmouseactive2 (int active, bool allowpause) SetCursor (normalcursor); } - if (mouseactive > 0) - focus = 1; - if (!iswindowfocus ()) { + write_log (_T("Tried to capture mouse but window didn't have focus! F=%d A=%d\n"), focus, mouseactive); focus = 0; mouseactive = 0; active = 0; } + if (mouseactive > 0) + focus = 1; + if (mouseactive) { if (focus) { if (!showcursor) { @@ -745,6 +759,8 @@ static void setmouseactive2 (int active, bool allowpause) void setmouseactive (int active) { monitor_off = 0; + if (active > 1) + SetForegroundWindow (hAmigaWnd); setmouseactive2 (active, true); } @@ -754,7 +770,7 @@ static void winuae_active (HWND hWnd, int minimized) { struct threadpriorities *pri; - write_log (_T("winuae_active(%d)\n"), minimized); + //write_log (_T("winuae_active(%d)\n"), minimized); monitor_off = 0; /* without this returning from hibernate-mode causes wrong timing */ @@ -811,7 +827,7 @@ static void winuae_inactive (HWND hWnd, int minimized) struct threadpriorities *pri; int wasfocus = focus; - write_log (_T("winuae_inactive(%d)\n"), minimized); + //write_log (_T("winuae_inactive(%d)\n"), minimized); #if USETHREADCHARACTERICS if (AVTask) AvRevertMmThreadCharacteristics (AVTask); @@ -1000,6 +1016,8 @@ static int isfocus2 (void) return 1; if (focus && mouseactive > 0) return 1; + if (currprefs.input_tablet >= TABLET_MOUSEHACK && currprefs.input_magic_mouse) + return 1; if (focus) return -1; return 0; @@ -1032,6 +1050,9 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, write_log (_T("AWP: %x %x\n"), hWnd, message); #endif + if (all_events_disabled) + return 0; + switch (message) { case WM_INPUT: @@ -1619,6 +1640,9 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, write_log (_T("MWP: %x %d\n"), hWnd, message); #endif + if (all_events_disabled) + return 0; + switch (message) { case WM_SETCURSOR: @@ -2475,7 +2499,7 @@ void logging_init (void) } } - write_log (_T("%s (%d.%d %s%s[%d])"), VersionStr, + write_log (_T("\n%s (%d.%d %s%s[%d])"), VersionStr, osVersion.dwMajorVersion, osVersion.dwMinorVersion, osVersion.szCSDVersion, _tcslen (osVersion.szCSDVersion) > 0 ? _T(" ") : _T(""), os_winnt_admin); write_log (_T(" %d-bit %X.%X.%X %d %s"), @@ -5611,33 +5635,11 @@ int driveclick_loadresource (struct drvsample *sp, int drivetype) return ok; } -#if defined(_WIN64) - -LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS * pExceptionPointers, DWORD ec) -{ - write_log (_T("EVALEXCEPTION!\n")); - return EXCEPTION_EXECUTE_HANDLER; -} -#else - -#if 0 -#include -#endif typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam); -/* Gah, don't look at this crap, please.. */ -static void efix (DWORD *regp, void *p, void *ps, int *got) -{ - DWORD reg = *regp; - if (p >= (void*)reg && p < (void*)(reg + 32)) { - *regp = (DWORD)ps; - *got = 1; - } -} - static void savedump (MINIDUMPWRITEDUMP dump, HANDLE f, struct _EXCEPTION_POINTERS *pExceptionPointers) { MINIDUMP_EXCEPTION_INFORMATION exinfo; @@ -5673,6 +5675,105 @@ static void savedump (MINIDUMPWRITEDUMP dump, HANDLE f, struct _EXCEPTION_POINTE dump (GetCurrentProcess (), GetCurrentProcessId (), f, minidumpmode, &exinfo, musip, NULL); } +static void create_dump (struct _EXCEPTION_POINTERS *pExceptionPointers) +{ + TCHAR path[MAX_DPATH]; + TCHAR path2[MAX_DPATH]; + TCHAR msg[1024]; + TCHAR *p; + HMODULE dll = NULL; + struct tm when; + __time64_t now; + + if (os_winnt && GetModuleFileName (NULL, path, MAX_DPATH)) { + TCHAR dumpfilename[100]; + TCHAR beta[100]; + TCHAR path3[MAX_DPATH]; + TCHAR *slash = _tcsrchr (path, '\\'); + _time64 (&now); + when = *_localtime64 (&now); + _tcscpy (path2, path); + if (slash) { + _tcscpy (slash + 1, _T("DBGHELP.DLL")); + dll = WIN32_LoadLibrary (path); + } + slash = _tcsrchr (path2, '\\'); + if (slash) + p = slash + 1; + else + p = path2; + p[0] = 0; + beta[0] = 0; + if (WINUAEPUBLICBETA > 0) + _stprintf (beta, _T("b%s"), WINUAEBETA); + _stprintf (dumpfilename, _T("winuae%s_%d.%d.%d_%s_%d.%02d.%02d_%02d.%02d.%02d.dmp"), +#ifdef _WIN64 + _T("_x64"), +#else + _T(""), +#endif + UAEMAJOR, UAEMINOR, UAESUBREV, beta[0] ? beta : _T("R"), + when.tm_year + 1900, when.tm_mon + 1, when.tm_mday, when.tm_hour, when.tm_min, when.tm_sec); + if (dll == NULL) + dll = WIN32_LoadLibrary (_T("DBGHELP.DLL")); + if (dll) { + all_events_disabled = 1; + MINIDUMPWRITEDUMP dump = (MINIDUMPWRITEDUMP)GetProcAddress (dll, "MiniDumpWriteDump"); + if (dump) { + _tcscpy (path3, path2); + _tcscat (path3, dumpfilename); + HANDLE f = CreateFile (path3, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (f == INVALID_HANDLE_VALUE) { + _tcscpy (path3, start_path_data); + _tcscat (path3, dumpfilename); + f = CreateFile (path3, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + } + if (f == INVALID_HANDLE_VALUE) { + if (GetTempPath (MAX_DPATH, path3) > 0) { + _tcscat (path3, dumpfilename); + f = CreateFile (path3, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + } + } + if (f != INVALID_HANDLE_VALUE) { + flush_log (); + savedump (dump, f, pExceptionPointers); + CloseHandle (f); + if (isfullscreen () <= 0) { + _stprintf (msg, _T("Crash detected. MiniDump saved as:\n%s\n"), path3); + MessageBox (NULL, msg, _T("Crash"), MB_OK | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND); + } + } + } + all_events_disabled = 0; + } + } +} + +#if defined(_WIN64) + +LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS * pExceptionPointers, DWORD ec) +{ + write_log (_T("EVALEXCEPTION!\n")); + create_dump (pExceptionPointers); + return EXCEPTION_CONTINUE_SEARCH; +} +#else + +#if 0 +#include +#endif + +/* Gah, don't look at this crap, please.. */ +static void efix (DWORD *regp, void *p, void *ps, int *got) +{ + DWORD reg = *regp; + if (p >= (void*)reg && p < (void*)(reg + 32)) { + *regp = (DWORD)ps; + *got = 1; + } +} + + LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS *pExceptionPointers, DWORD ec) { static uae_u8 *prevpc; @@ -5729,71 +5830,8 @@ LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS *pExceptionPointer } #endif #ifndef _DEBUG - if (lRet == EXCEPTION_CONTINUE_SEARCH) { - TCHAR path[MAX_DPATH]; - TCHAR path2[MAX_DPATH]; - TCHAR msg[1024]; - TCHAR *p; - HMODULE dll = NULL; - struct tm when; - __time64_t now; - - if (os_winnt && GetModuleFileName (NULL, path, MAX_DPATH)) { - TCHAR dumpfilename[100]; - TCHAR beta[100]; - TCHAR path3[MAX_DPATH]; - TCHAR *slash = _tcsrchr (path, '\\'); - _time64 (&now); - when = *_localtime64 (&now); - _tcscpy (path2, path); - if (slash) { - _tcscpy (slash + 1, _T("DBGHELP.DLL")); - dll = WIN32_LoadLibrary (path); - } - slash = _tcsrchr (path2, '\\'); - if (slash) - p = slash + 1; - else - p = path2; - p[0] = 0; - beta[0] = 0; - if (WINUAEPUBLICBETA > 0) - _stprintf (beta, _T("b%s"), WINUAEBETA); - _stprintf (dumpfilename, _T("winuae_%d%d%d%s_%d%02d%02d_%02d%02d%02d.dmp"), - UAEMAJOR, UAEMINOR, UAESUBREV, beta, - when.tm_year + 1900, when.tm_mon + 1, when.tm_mday, when.tm_hour, when.tm_min, when.tm_sec); - if (dll == NULL) - dll = WIN32_LoadLibrary (_T("DBGHELP.DLL")); - if (dll) { - MINIDUMPWRITEDUMP dump = (MINIDUMPWRITEDUMP)GetProcAddress (dll, "MiniDumpWriteDump"); - if (dump) { - _tcscpy (path3, path2); - _tcscat (path3, dumpfilename); - HANDLE f = CreateFile (path3, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (f == INVALID_HANDLE_VALUE) { - _tcscpy (path3, start_path_data); - _tcscat (path3, dumpfilename); - f = CreateFile (path3, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - } - if (f == INVALID_HANDLE_VALUE) { - if (GetTempPath (MAX_DPATH, path3) > 0) { - _tcscat (path3, dumpfilename); - f = CreateFile (path3, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - } - } - if (f != INVALID_HANDLE_VALUE) { - flush_log (); - savedump (dump, f, pExceptionPointers); - CloseHandle (f); - if (isfullscreen () <= 0) { - _stprintf (msg, _T("Crash detected. MiniDump saved as:\n%s\n"), path3); - MessageBox (NULL, msg, _T("Crash"), MB_OK | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND); - } - } - } - } - } - } + if (lRet == EXCEPTION_CONTINUE_SEARCH) + create_dump (pExceptionPointers); #endif #if 0 HMODULE hFaultRepDll = LoadLibrary (_T("FaultRep.dll")) ; diff --git a/od-win32/win32.h b/od-win32/win32.h index 2044e841..d00a28d9 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,15 +15,15 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEPUBLICBETA 0 +#define WINUAEPUBLICBETA 1 #define LANG_DLL 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("16") +#define WINUAEBETA _T("1") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2013, 12, 5) +#define WINUAEDATE MAKEBD(2014, 1, 4) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 4eeb369c..40eed475 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1272,7 +1272,7 @@ void getrtgfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_hei srcratio = dstratio = 0; } else { // manual - dstratio = currprefs.win32_rtgscaleaspectratio; + dstratio = (currprefs.win32_rtgscaleaspectratio / ASPECTMULT) * ASPECTMULT / (currprefs.win32_rtgscaleaspectratio & (ASPECTMULT - 1)); srcratio = srcwidth * ASPECTMULT / srcheight; } diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 68387ac9..2f72d1fc 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -148,7 +148,7 @@ static const int defaultaspectratios[] = { static int getaspectratioindex (int ar) { for (int i = 0; defaultaspectratios[i] >= 0; i += 2) { - if (ar == defaultaspectratios[i + 0] * 1024 + defaultaspectratios[i + 1]) + if (ar == defaultaspectratios[i + 0] * ASPECTMULT + defaultaspectratios[i + 1]) return i / 2; } return 0; @@ -157,7 +157,7 @@ static int getaspectratio (int index) { for (int i = 0; defaultaspectratios[i] >= 0; i += 2) { if (i == index * 2) { - return defaultaspectratios[i + 0] * 1024 + defaultaspectratios[i + 1]; + return defaultaspectratios[i + 0] * ASPECTMULT + defaultaspectratios[i + 1]; } } return 0; @@ -6400,6 +6400,23 @@ static void values_to_displaydlg (HWND hDlg) SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)buffer); SendDlgItemMessage (hDlg, IDC_LORES, CB_SETCURSEL, workprefs.gfx_resolution, 0); + SendDlgItemMessage(hDlg, IDC_AUTORESOLUTIONSELECT, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hDlg, IDC_AUTORESOLUTIONSELECT, CB_ADDSTRING, 0, (LPARAM)_T("Disabled")); + SendDlgItemMessage(hDlg, IDC_AUTORESOLUTIONSELECT, CB_ADDSTRING, 0, (LPARAM)_T("Always on")); + SendDlgItemMessage(hDlg, IDC_AUTORESOLUTIONSELECT, CB_ADDSTRING, 0, (LPARAM)_T("10%")); + SendDlgItemMessage(hDlg, IDC_AUTORESOLUTIONSELECT, CB_ADDSTRING, 0, (LPARAM)_T("33%")); + SendDlgItemMessage(hDlg, IDC_AUTORESOLUTIONSELECT, CB_ADDSTRING, 0, (LPARAM)_T("66%")); + if (workprefs.gfx_autoresolution == 0) + SendDlgItemMessage (hDlg, IDC_AUTORESOLUTIONSELECT, CB_SETCURSEL, 0, 0); + else if (workprefs.gfx_autoresolution == 1) + SendDlgItemMessage (hDlg, IDC_AUTORESOLUTIONSELECT, CB_SETCURSEL, 1, 0); + else if (workprefs.gfx_autoresolution <= 10) + SendDlgItemMessage (hDlg, IDC_AUTORESOLUTIONSELECT, CB_SETCURSEL, 2, 0); + else if (workprefs.gfx_autoresolution <= 33) + SendDlgItemMessage (hDlg, IDC_AUTORESOLUTIONSELECT, CB_SETCURSEL, 3, 0); + else + SendDlgItemMessage (hDlg, IDC_AUTORESOLUTIONSELECT, CB_SETCURSEL, 4, 0); + CheckDlgButton (hDlg, IDC_BLACKER_THAN_BLACK, workprefs.gfx_blackerthanblack); CheckDlgButton (hDlg, IDC_LORES_SMOOTHED, workprefs.gfx_lores_mode); CheckDlgButton (hDlg, IDC_FLICKERFIXER, workprefs.gfx_scandoubler); @@ -6407,8 +6424,6 @@ static void values_to_displaydlg (HWND hDlg) CheckDlgButton (hDlg, IDC_XCENTER, workprefs.gfx_xcenter); CheckDlgButton (hDlg, IDC_YCENTER, workprefs.gfx_ycenter); - CheckDlgButton (hDlg, IDC_AUTORESOLUTION, workprefs.gfx_autoresolution); - SendDlgItemMessage(hDlg, IDC_DISPLAY_BUFFERCNT, CB_RESETCONTENT, 0, 0); WIN32GUI_LoadUIString(IDS_BUFFER_SINGLE, buffer, sizeof buffer / sizeof (TCHAR)); SendDlgItemMessage(hDlg, IDC_DISPLAY_BUFFERCNT, CB_ADDSTRING, 0, (LPARAM)buffer); @@ -6633,12 +6648,24 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l workprefs.gfx_xcenter = ischecked (hDlg, IDC_XCENTER) ? 2 : 0; /* Smart centering */ workprefs.gfx_ycenter = ischecked (hDlg, IDC_YCENTER) ? 2 : 0; /* Smart centering */ - workprefs.gfx_autoresolution = ischecked (hDlg, IDC_AUTORESOLUTION); + LRESULT posn1 = SendDlgItemMessage (hDlg, IDC_AUTORESOLUTIONSELECT, CB_GETCURSEL, 0, 0); + if (posn1 != CB_ERR) { + if (posn1 == 0) + workprefs.gfx_autoresolution = 0; + else if (posn1 == 1) + workprefs.gfx_autoresolution = 1; + else if (posn1 == 2) + workprefs.gfx_autoresolution = 10; + else if (posn1 == 3) + workprefs.gfx_autoresolution = 33; + else if (posn1 == 4) + workprefs.gfx_autoresolution = 66; + } int dmode = -1; bool native = false; struct MultiDisplay *md = getdisplay (&workprefs); - LRESULT posn1 = SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0); + posn1 = SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0); LRESULT posn2 = SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_GETCURSEL, 0, 0); if (posn1 != CB_ERR) { if (posn2 == CB_ERR) @@ -9569,7 +9596,7 @@ static void hardfile_testrdb (struct hfdlg_vals *hdf) hdf->ci.controller = HD_CONTROLLER_PCMCIA_SRAM; break; } - if (!memcmp (id, "RDSK\0\0\0", 7) || !memcmp (id, "DRKS\0\0", 6) || (id[0] == 0x53 && id[1] == 0x10 && id[2] == 0x9b && id[3] == 0x13 && id[4] == 0 && id[5] == 0)) { + if (!memcmp (id, "RDSK\0\0\0", 7) || !memcmp (id, "CDSK\0\0\0", 7) || !memcmp (id, "DRKS\0\0", 6) || (id[0] == 0x53 && id[1] == 0x10 && id[2] == 0x9b && id[3] == 0x13 && id[4] == 0 && id[5] == 0)) { // RDSK or ADIDE "encoded" RDSK int blocksize = (id[16] << 24) | (id[17] << 16) | (id[18] << 8) | (id[19] << 0); hdf->ci.cyls = hdf->ci.highcyl = hdf->forcedcylinders = 0; @@ -9869,7 +9896,7 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults) hdf_read (&hfd, id, i * 512, 512); bsize = hfd.virtsize; current_hfdlg.size = hfd.virtsize; - if (!memcmp (id, "RDSK", 4)) { + if (!memcmp (id, "RDSK", 4) || !memcmp (id, "CDSK", 4)) { int blocksize = (id[16] << 24) | (id[17] << 16) | (id[18] << 8) | (id[19] << 0); break; } @@ -13014,8 +13041,9 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw int max = inputdevice_get_compatibility_input (&workprefs, inputmap_port, &mode, events, &axistable); if (max < MAX_COMPA_INPUTLIST - 1) { - if (inputmap_remap_event > 0) - inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, inputmap_remap_event, 0, inputmap_port); + if (inputmap_remap_event > 0) { + inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, inputmap_remap_event, 0, inputmap_port, workprefs.input_selected_setting); + } } inputmap_remap_event = 0; InitializeListView (myDlg); @@ -13124,8 +13152,8 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw for (int i = 0; i < wcnt; i++) { wtype = widgets[i]; if (inputdevice_get_widget_type (input_selected_device, wtype, NULL) == IDEV_WIDGET_AXIS) { - inputdevice_set_gameports_mapping (&workprefs, input_selected_device, prevwidget, -1, 0, inputmap_port); - inputdevice_set_gameports_mapping (&workprefs, input_selected_device, wtype, axistable2[0], 0, inputmap_port); + inputdevice_set_gameports_mapping (&workprefs, input_selected_device, prevwidget, -1, 0, inputmap_port, workprefs.input_selected_setting); + inputdevice_set_gameports_mapping (&workprefs, input_selected_device, wtype, axistable2[0], 0, inputmap_port, workprefs.input_selected_setting); evtnum = -1; break; } @@ -13137,7 +13165,7 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw // write_log (_T("%d %d %d\n"), input_selected_device, input_selected_widget, evtnum); if (evtnum >= 0) - inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, evtnum, 0, inputmap_port); + inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, evtnum, 0, inputmap_port, workprefs.input_selected_setting); InitializeListView (hDlg); inputmap_remap_counter++; if (inputmap_remap_counter >= max || inputmap_oneshot) { diff --git a/od-win32/winuae_msvc11/winuae_msvc.vcxproj b/od-win32/winuae_msvc11/winuae_msvc.vcxproj index 1c5c6fa4..4d83fd8b 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc11/winuae_msvc.vcxproj @@ -88,7 +88,7 @@ Application false Unicode - v110 + v120 @@ -255,7 +255,7 @@ %(AdditionalOptions) Disabled - ..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;..\..\prowizard\include;..\tun;%(AdditionalIncludeDirectories) + ..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;..\..\slirp;%(AdditionalIncludeDirectories) WINVER=0x0500;_DEBUG;WIN32_IE=0x0700;WIN32;WIN64;_CRT_SECURE_NO_WARNINGS;D3D_DEBUG_INFO;%(PreprocessorDefinitions) Sync EnableFastChecks @@ -269,7 +269,7 @@ Level3 true ProgramDatabase - StdCall + FastCall Default 4996;%(DisableSpecificWarnings) false @@ -280,7 +280,7 @@ 0x0409 - ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng15.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;hid.lib;%(AdditionalDependencies) + ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng15.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;hid.lib;Iphlpapi.lib;luastatic.lib;%(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) true LIBCMT;%(IgnoreSpecificDefaultLibraries) @@ -327,7 +327,7 @@ MultiThreaded false true - NotSet + StreamingSIMDExtensions2 Precise false false @@ -339,7 +339,7 @@ .\Release/ Level3 true - StdCall + FastCall Default 4996;%(DisableSpecificWarnings) %(ForcedIncludeFiles) @@ -417,7 +417,7 @@ .\Test/ Level3 true - StdCall + FastCall Default 4996;%(DisableSpecificWarnings) %(ForcedIncludeFiles) @@ -494,7 +494,7 @@ $(Platform)\$(Configuration)\ Level3 true - StdCall + FastCall Default 4996;%(DisableSpecificWarnings) %(ForcedIncludeFiles) @@ -576,7 +576,7 @@ 0x0409 - ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng15.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;hid.lib;%(AdditionalDependencies) + ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng15.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;hid.lib;Iphlpapi.lib;luastatic.lib;%(AdditionalDependencies) NotSet $(OutDir)$(TargetName)$(TargetExt) true @@ -625,7 +625,7 @@ MultiThreaded false true - NotSet + StreamingSIMDExtensions2 Precise false false @@ -637,7 +637,7 @@ .\FullRelease/ Level3 true - StdCall + FastCall Default 4996;%(DisableSpecificWarnings) %(ForcedIncludeFiles) diff --git a/od-win32/writelog.cpp b/od-win32/writelog.cpp index 41a87d24..10991a55 100644 --- a/od-win32/writelog.cpp +++ b/od-win32/writelog.cpp @@ -96,6 +96,13 @@ static void getconsole (void) } } +void activate_console (void) +{ + if (!consoleopen) + return; + SetForegroundWindow (GetConsoleWindow ()); +} + static void open_console_window (void) { AllocConsole (); diff --git a/prowizard/include/extern.h b/prowizard/include/extern.h index d2f7ec30..0e60b8ce 100644 --- a/prowizard/include/extern.h +++ b/prowizard/include/extern.h @@ -331,6 +331,7 @@ extern short test_smps ( long, long, long, Uchar, Uchar ); extern long PWGetFileSize ( char * ); extern FILE * PW_fopen ( char *, char * ); extern void fillPTKtable ( Uchar[37][2] ); +extern int htonl(int); /* globals */ /* Some say it's badly coding when using Globals ... sure it is, now what's the solution ? */ @@ -355,3 +356,4 @@ extern Uchar Amiga_EXE_Header; extern void pw_write_log (const char *, ...); extern FILE *moduleripper2_fopen (const char *name, const char *mode, const char *aid, int addr, int size); extern FILE *moduleripper_fopen (const char *aname, const char *amode); + diff --git a/prowizard/misc/misc.c b/prowizard/misc/misc.c index 46f1233c..e0bba0d4 100644 --- a/prowizard/misc/misc.c +++ b/prowizard/misc/misc.c @@ -507,3 +507,10 @@ void fillPTKtable (Uchar poss[37][2]) poss[36][0]=0x00, poss[36][1]=0x71; return; } + +#ifndef _WIN64 +int htonl(int v) +{ + return v; +} +#endif diff --git a/rommgr.cpp b/rommgr.cpp index ab93b590..0599da48 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -89,7 +89,7 @@ struct romdata *getromdatabypath (const TCHAR *path) return NULL; } -#define NEXT_ROM_ID 75 +#define NEXT_ROM_ID 87 static struct romheader romheaders[] = { { _T("Freezer Cartridges"), 1 }, @@ -193,7 +193,7 @@ static struct romdata roms[] = { { _T("CD32 MPEG Cartridge ROM"), 3, 1, 40, 30, _T("CD32FMV\0"), 262144, 23, 1, 0, ROMTYPE_CD32CART, 0, 0, NULL, 0xc35c37bf, 0x03ca81c7,0xa7b259cf,0x64bc9582,0x863eca0f,0x6529f435 }, { _T("CD32 MPEG Cartridge ROM"), 3, 1, 40, 22, _T("CD32FMV\0"), 262144, 74, 1, 0, ROMTYPE_CD32CART, 0, 0, _T("391777-01"), - 0xe57d05fe, 0x56077abd,0x82b652f0,0x54f76002,0xdde2bcd5,0x33198cc2 }, + 0xc2002d08, 0xa1ca2d71,0x7efb6c60,0xb9bfabeb,0x0280ae97,0xe82b0cb9 }, { _T("CDTV extended ROM v1.00"), 1, 0, 1, 0, _T("CDTV\0"), 262144, 20, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL, 0x42baa124, 0x7BA40FFA,0x17E500ED,0x9FED041F,0x3424BD81,0xD9C907BE }, @@ -288,21 +288,33 @@ static struct romdata roms[] = { { _T("Arcadia OnePlay 2.11"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 49, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 }, { _T("Arcadia TenPlay 2.11"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 50, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 }, + { _T("Arcadia TenPlay 2.20"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 75, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 }, { _T("Arcadia OnePlay 3.00"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 51, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 }, - - { _T("Arcadia SportTime Table Hockey"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 33, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia SportTime Bowling"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 34, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia World Darts"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 35, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Magic Johnson's Fast Break"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 36, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Leader Board Golf"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 37, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Leader Board Golf (alt)"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 38, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Ninja Mission"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 39, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Road Wars"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 40, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Sidewinder"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 41, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Spot"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 42, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Space Ranger"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 43, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia Xenon"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 44, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, - { _T("Arcadia World Trophy Soccer"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 45, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia TenPlay 3.11"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 76, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 }, + { _T("Arcadia TenPlay 4.00"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 77, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 }, + + { _T("Arcadia SportTime Table Hockey v2.1"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 33, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia SportTime Bowling v2.1"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 34, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia World Darts v2.1"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 35, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Magic Johnson's Fast Break v2.8"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 36, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Leader Board Golf v2.4"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 37, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Leader Board Golf"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 38, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Ninja Mission v2.5"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 39, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Road Wars v2.3"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 40, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Sidewinder v2.1"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 41, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Spot v2.0"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 42, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Space Ranger v2.0"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 43, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Xenon v2.3"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 44, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia World Trophy Soccer v3.0"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 45, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Blastaball v2.1"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 78, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Delta Command"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 79, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Pharaohs Match"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 80, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia SportTime Table Hockey"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 81, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia World Darts (bad)"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 82, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Magic Johnson's Fast Break v2.7"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 83, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Ninja Mission"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 84, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Sidewinder"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 85, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, + { _T("Arcadia Leader Board Golf v2.5"), 0, 0, 0, 0, _T("ARCADIA\0"), 0, 86, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 }, { NULL } diff --git a/scsiemul.cpp b/scsiemul.cpp index 0f094dfb..66e35408 100644 --- a/scsiemul.cpp +++ b/scsiemul.cpp @@ -512,6 +512,55 @@ static int command_cd_read (struct devstruct *dev, uaecptr data, uae_u64 offset, return 0; } +static int dev_do_io_other (struct devstruct *dev, uaecptr request) +{ + uae_u32 command; + uae_u32 io_data = get_long (request + 40); // 0x28 + uae_u32 io_length = get_long (request + 36); // 0x24 + uae_u32 io_actual = get_long (request + 32); // 0x20 + uae_u32 io_offset = get_long (request + 44); // 0x2c + uae_u32 io_error = 0; + struct priv_devstruct *pdev = getpdevstruct (request); + + if (!pdev) + return 0; + command = get_word (request + 28); + + if (log_scsi) + write_log (_T("SCSI OTHER %d: DATA=%08X LEN=%08X OFFSET=%08X ACTUAL=%08X\n"), + command, io_data, io_length, io_offset, io_actual); + switch (command) + { + case CMD_UPDATE: + case CMD_CLEAR: + case CMD_FLUSH: + case CMD_MOTOR: + case CMD_SEEK: + io_actual = 0; + break; + case CMD_GETDRIVETYPE: + io_actual = dev->drivetype; + break; + case HD_SCSICMD: + { + uae_u32 sdd = get_long (request + 40); + io_error = sys_command_scsi_direct (dev->unitnum, dev->drivetype, sdd); + if (log_scsi) + write_log (_T("scsidev other: did io: sdd %08x request %08x error %d\n"), sdd, request, get_byte (request + 31)); + } + break; + default: + io_error = IOERR_NOCMD; + break; + } + + put_long (request + 32, io_actual); + put_byte (request + 31, io_error); + io_log (_T("dev_io_other"), request); + return 0; +} + + static int dev_do_io_tape (struct devstruct *dev, uaecptr request) { uae_u32 command; @@ -531,6 +580,16 @@ static int dev_do_io_tape (struct devstruct *dev, uaecptr request) command, io_data, io_length, io_offset, io_actual); switch (command) { + case CMD_UPDATE: + case CMD_CLEAR: + case CMD_FLUSH: + case CMD_MOTOR: + case CMD_SEEK: + io_actual = 0; + break; + case CMD_GETDRIVETYPE: + io_actual = dev->drivetype; + break; case HD_SCSICMD: { uae_u32 sdd = get_long (request + 40); @@ -546,7 +605,7 @@ static int dev_do_io_tape (struct devstruct *dev, uaecptr request) put_long (request + 32, io_actual); put_byte (request + 31, io_error); - io_log (_T("dev_io_tape"),request); + io_log (_T("dev_io_tape"), request); return 0; } @@ -931,7 +990,7 @@ no_media: } put_long (request + 32, io_actual); put_byte (request + 31, io_error); - io_log (_T("dev_io_tape"),request); + io_log (_T("dev_io_cd"), request); return async; } @@ -939,8 +998,10 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) { if (dev->drivetype == INQ_SEQD) { return dev_do_io_tape (dev, request); - } else { + } else if (dev->drivetype == INQ_ROMD) { return dev_do_io_cd (dev, request); + } else { + return dev_do_io_other (dev, request); } } @@ -1035,7 +1096,7 @@ static void *dev_thread (void *devs) static uae_u32 REGPARAM2 dev_init_2 (TrapContext *context, int type) { - uae_u32 base = m68k_dreg (regs,0); + uae_u32 base = m68k_dreg (regs, 0); if (log_scsi) write_log (_T("%s init\n"), getdevname (type)); return base;