From: Toni Wilen Date: Sun, 13 Apr 2014 15:24:37 +0000 (+0300) Subject: 2800b15 X-Git-Tag: 2800~4 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=accf3e365198eaaf841cb6a802ded704c79464d2;p=francis%2Fwinuae.git 2800b15 --- diff --git a/custom.cpp b/custom.cpp index 4c577e35..f2c3a388 100644 --- a/custom.cpp +++ b/custom.cpp @@ -3883,6 +3883,9 @@ void init_hz (bool fullinit) maxvpos_display = maxvpos; equ_vblank_endline = -1; doublescan = htotal <= 164 && vtotal >= 350 ? 1 : 0; + // if superhires and wide enough: not doublescan + if (doublescan && htotal >= 140 && (bplcon0 & 0x0040)) + doublescan = 0; programmedmode = true; varsync_changed = true; vpos_count = maxvpos_nom; @@ -5359,7 +5362,7 @@ static void SPRxDATA (int hpos, uae_u16 v, int num) } static void SPRxDATB (int hpos, uae_u16 v, int num) { - int hp = hpos == 0 ? 0 : hpos - 1; + int hp = hpos; decide_sprites (hp); SPRxDATB_1 (v, num, hp); } diff --git a/drawing.cpp b/drawing.cpp index 43c3633f..7dca4e7f 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2679,7 +2679,7 @@ static void init_drawing_frame (void) graphics_reset(); } int newres = largest_res; - if (htotal < 200) + if (htotal < 190) newres = largest_res + 1; if (newres < RES_HIRES) newres = RES_HIRES; @@ -2687,8 +2687,8 @@ static void init_drawing_frame (void) newres = RES_MAX; if (changed_prefs.gfx_resolution != newres) { autoswitch_old_resolution = RES_HIRES; + write_log(_T("Programmed mode autores = %d -> %d (%d)\n"), changed_prefs.gfx_resolution, newres, largest_res); changed_prefs.gfx_resolution = newres; - write_log(_T("NEWRES = %d\n"), newres); } } else if (autoswitch_old_resolution == 1) { changed_prefs.gfx_resolution = RES_HIRES; diff --git a/fpp.cpp b/fpp.cpp index c0798629..078de3e9 100644 --- a/fpp.cpp +++ b/fpp.cpp @@ -164,6 +164,33 @@ static void fpset (fpdata *fpd, fptype f) #endif } +#if 0 +static void normalize(uae_u32 *pwrd1, uae_u32 *pwrd2, uae_u32 *pwrd3) +{ + uae_u32 wrd1 = *pwrd1; + uae_u32 wrd2 = *pwrd2; + uae_u32 wrd3 = *pwrd3; + int exp = (wrd1 >> 16) & 0x7fff; + // Normalize if unnormal. + if (exp != 0 && exp != 0x7fff && !(wrd2 & 0x80000000)) { + while (!(wrd2 & 0x80000000) && (wrd2 || wrd3)) { + wrd2 <<= 1; + if (wrd3 & 0x80000000) + wrd2 |= 1; + wrd3 <<= 1; + exp--; + } + if (exp < 0) + exp = 0; + if (!wrd2 && !wrd3) + exp = 0; + *pwrd1 = (wrd1 & 0x80000000) | (exp << 16); + *pwrd2 = wrd2; + *pwrd3 = wrd3; + } +} +#endif + bool fpu_get_constant(fpdata *fp, int cr) { fptype f; @@ -2595,7 +2622,7 @@ uae_u8 *save_fpu (int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc (uae_u8, 4+4+8*10+4+4+4+4+4); + dstbak = dst = xmalloc (uae_u8, 4+4+8*10+4+4+4+4+4+2*10+3*(4+2)); save_u32 (currprefs.fpu_model); save_u32 (0x80000000 | 0x40000000 | (regs.fpu_state == 0 ? 1 : 0) | (regs.fpu_exp_state ? 2 : 0) | (regs.fpu_exp_state > 1 ? 4 : 0)); for (i = 0; i < 8; i++) { diff --git a/gencpu.cpp b/gencpu.cpp index 84c261bf..2496efb8 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -2730,13 +2730,13 @@ static void resetvars (void) getpc = "m68k_getpci ()"; } else { // generic - prefetch_long = "get_ilong"; - prefetch_word = "get_iword"; - nextw = "next_iword"; - nextl = "next_ilong"; - srcli = "get_ilong"; - srcwi = "get_iword"; - srcbi = "get_ibyte"; + prefetch_long = "get_dilong"; + prefetch_word = "get_diword"; + nextw = "next_diword"; + nextl = "next_dilong"; + srcli = "get_dilong"; + srcwi = "get_diword"; + srcbi = "get_dibyte"; srcl = "get_long"; dstl = "put_long"; srcw = "get_word"; diff --git a/hardfile.cpp b/hardfile.cpp index 572ec0e7..943efc25 100644 --- a/hardfile.cpp +++ b/hardfile.cpp @@ -1533,8 +1533,9 @@ static int handle_scsi (uaecptr request, struct hardfiledata *hfd) scsi_log (_T("RD:")); i = 0; while (i < reply_len) { - if (i < 24) + if (i < 24) { scsi_log (_T("%02X%c"), reply[i], i < reply_len - 1 ? '.' : ' '); + } put_byte (scsi_data + i, reply[i]); i++; } @@ -1662,8 +1663,9 @@ static void abort_async (struct hardfileprivdata *hfpd, uaecptr request, int err i++; } i = release_async_request (hfpd, request); - if (i >= 0) + if (i >= 0) { hf_log (_T("asyncronous request=%08X aborted, error=%d\n"), request, errcode); + } } static void *hardfile_thread (void *devs); @@ -2059,8 +2061,9 @@ static uae_u32 REGPARAM2 hardfile_beginio (TrapContext *context) canquick = hardfile_canquick (hfd, request); if (((flags & 1) && canquick) || (canquick < 0)) { hf_log (_T("hf quickio unit=%d request=%p cmd=%d\n"), unit, request, cmd); - if (hardfile_do_io (hfd, hfpd, request)) + if (hardfile_do_io(hfd, hfpd, request)) { hf_log2 (_T("uaehf.device cmd %d bug with IO_QUICK\n"), cmd); + } if (!(flags & 1)) uae_ReplyMsg (request); return get_byte (request + 31); diff --git a/include/newcpu.h b/include/newcpu.h index 2b4bd805..3c3605e9 100644 --- a/include/newcpu.h +++ b/include/newcpu.h @@ -262,136 +262,159 @@ STATIC_INLINE void unset_special (uae_u32 x) #define m68k_dreg(r,num) ((r).regs[(num)]) #define m68k_areg(r,num) (((r).regs + 8)[(num)]) -STATIC_INLINE void m68k_setpc (uaecptr newpc) + +/* direct (regs.pc_p) access */ + +STATIC_INLINE void m68k_setpc(uaecptr newpc) { - regs.pc_p = regs.pc_oldp = get_real_address (newpc); + regs.pc_p = regs.pc_oldp = get_real_address(newpc); regs.instruction_pc = regs.pc = newpc; } - -STATIC_INLINE uaecptr m68k_getpc (void) +STATIC_INLINE uaecptr m68k_getpc(void) { return (uaecptr)(regs.pc + ((uae_u8*)regs.pc_p - (uae_u8*)regs.pc_oldp)); } #define M68K_GETPC m68k_getpc() - -STATIC_INLINE uaecptr m68k_getpc_p (uae_u8 *p) +STATIC_INLINE uaecptr m68k_getpc_p(uae_u8 *p) { return (uaecptr)(regs.pc + ((uae_u8*)p - (uae_u8*)regs.pc_oldp)); } - -STATIC_INLINE void m68k_incpc (int o) +STATIC_INLINE void m68k_incpc(int o) { regs.pc_p += o; } -STATIC_INLINE void m68k_setpci (uaecptr newpc) +STATIC_INLINE uae_u32 get_dibyte(int o) { - regs.instruction_pc = regs.pc = newpc; + return do_get_mem_byte((uae_u8 *)((regs).pc_p + (o) + 1)); } -STATIC_INLINE uaecptr m68k_getpci (void) +STATIC_INLINE uae_u32 get_diword(int o) { - return regs.pc; + return do_get_mem_word((uae_u16 *)((regs).pc_p + (o))); } -STATIC_INLINE void m68k_incpci (int o) +STATIC_INLINE uae_u32 get_dilong(int o) { - regs.pc += o; + return do_get_mem_long((uae_u32 *)((regs).pc_p + (o))); } - -STATIC_INLINE void m68k_incpc_normal (int o) +STATIC_INLINE uae_u32 next_diword(void) { - if (m68k_pc_indirect) - m68k_incpci(o); - else - m68k_incpc (o); + uae_u32 r = do_get_mem_word((uae_u16 *)((regs).pc_p)); + m68k_incpc(2); + return r; } - -STATIC_INLINE void m68k_setpc_normal (uaecptr pc) +STATIC_INLINE uae_u32 next_dilong(void) { - if (m68k_pc_indirect) { - regs.pc_p = regs.pc_oldp = 0; - m68k_setpci(pc); - } else { - m68k_setpc(pc); - } + uae_u32 r = do_get_mem_long((uae_u32 *)((regs).pc_p)); + m68k_incpc(4); + return r; } -STATIC_INLINE void m68k_do_rts (void) +STATIC_INLINE void m68k_do_bsr(uaecptr oldpc, uae_s32 offset) { - uae_u32 newpc = get_long (m68k_areg (regs, 7)); - m68k_setpc (newpc); - m68k_areg (regs, 7) += 4; + m68k_areg(regs, 7) -= 4; + put_long(m68k_areg(regs, 7), oldpc); + m68k_incpc(offset); } - -STATIC_INLINE void m68k_do_rtsi (void) +STATIC_INLINE void m68k_do_rts(void) { - uae_u32 newpc = get_long (m68k_areg (regs, 7)); - m68k_setpci (newpc); - m68k_areg (regs, 7) += 4; + uae_u32 newpc = get_long(m68k_areg(regs, 7)); + m68k_setpc(newpc); + m68k_areg(regs, 7) += 4; } -STATIC_INLINE void m68k_do_bsr (uaecptr oldpc, uae_s32 offset) +/* indirect (regs.pc) access */ + +STATIC_INLINE void m68k_setpci(uaecptr newpc) { - m68k_areg (regs, 7) -= 4; - put_long (m68k_areg (regs, 7), oldpc); - m68k_incpc (offset); + regs.instruction_pc = regs.pc = newpc; } - -STATIC_INLINE void m68k_do_bsri (uaecptr oldpc, uae_s32 offset) +STATIC_INLINE uaecptr m68k_getpci(void) +{ + return regs.pc; +} +STATIC_INLINE void m68k_incpci(int o) { - m68k_areg (regs, 7) -= 4; - put_long (m68k_areg (regs, 7), oldpc); - m68k_incpci (offset); + regs.pc += o; } -STATIC_INLINE uae_u32 get_ibyte (int o) +STATIC_INLINE uae_u32 get_iibyte(int o) { - return do_get_mem_byte((uae_u8 *)((regs).pc_p + (o) + 1)); + return get_wordi(m68k_getpci() + (o) + 1); } -STATIC_INLINE uae_u32 get_iword (int o) +STATIC_INLINE uae_u32 get_iiword(int o) { - return do_get_mem_word((uae_u16 *)((regs).pc_p + (o))); + return get_wordi(m68k_getpci() + (o)); } -STATIC_INLINE uae_u32 get_ilong (int o) +STATIC_INLINE uae_u32 get_iilong(int o) { - return do_get_mem_long((uae_u32 *)((regs).pc_p + (o))); + return get_longi(m68k_getpci () + (o)); } -#define get_iwordi(o) get_wordi(o) -#define get_ilongi(o) get_longi(o) - -/* These are only used by the 68020/68881 code, and therefore don't -* need to handle prefetch. */ -STATIC_INLINE uae_u32 next_ibyte (void) +STATIC_INLINE uae_u32 next_iibyte (void) { - uae_u32 r = get_ibyte (0); - m68k_incpc (2); + uae_u32 r = get_iibyte (0); + m68k_incpci (2); return r; } -STATIC_INLINE uae_u32 next_iword (void) +STATIC_INLINE uae_u32 next_iiword (void) { - uae_u32 r = get_iword (0); - m68k_incpc (2); + uae_u32 r = get_iiword (0); + m68k_incpci (2); return r; } -STATIC_INLINE uae_u32 next_iwordi (void) +STATIC_INLINE uae_u32 next_iiwordi (void) { - uae_u32 r = get_iwordi (m68k_getpci ()); - m68k_incpc (2); + uae_u32 r = get_wordi(m68k_getpci()); + m68k_incpci (2); return r; } -STATIC_INLINE uae_u32 next_ilong (void) +STATIC_INLINE uae_u32 next_iilong (void) { - uae_u32 r = get_ilong (0); - m68k_incpc (4); + uae_u32 r = get_iilong(0); + m68k_incpci (4); return r; } -STATIC_INLINE uae_u32 next_ilongi (void) +STATIC_INLINE uae_u32 next_iilongi (void) { - uae_u32 r = get_ilongi (m68k_getpci ()); - m68k_incpc (4); + uae_u32 r = get_longi (m68k_getpci ()); + m68k_incpci (4); return r; } +STATIC_INLINE void m68k_do_bsri(uaecptr oldpc, uae_s32 offset) +{ + m68k_areg(regs, 7) -= 4; + put_long(m68k_areg(regs, 7), oldpc); + m68k_incpci(offset); +} +STATIC_INLINE void m68k_do_rtsi(void) +{ + uae_u32 newpc = get_long(m68k_areg(regs, 7)); + m68k_setpci(newpc); + m68k_areg(regs, 7) += 4; +} + +/* common access */ + +STATIC_INLINE void m68k_incpc_normal(int o) +{ + if (m68k_pc_indirect) + m68k_incpci(o); + else + m68k_incpc(o); +} + +STATIC_INLINE void m68k_setpc_normal(uaecptr pc) +{ + if (m68k_pc_indirect) { + regs.pc_p = regs.pc_oldp = 0; + m68k_setpci(pc); + } + else { + m68k_setpc(pc); + } +} + extern uae_u32 (*x_prefetch)(int); extern uae_u32 (*x_get_byte)(uaecptr addr); extern uae_u32 (*x_get_word)(uaecptr addr); diff --git a/include/options.h b/include/options.h index 28e7d3f7..47107464 100644 --- a/include/options.h +++ b/include/options.h @@ -11,8 +11,8 @@ #define OPTIONS_H #define UAEMAJOR 2 -#define UAEMINOR 7 -#define UAESUBREV 1 +#define UAEMINOR 8 +#define UAESUBREV 0 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang; diff --git a/newcpu.cpp b/newcpu.cpp index b3c76d8b..eb01629a 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -737,8 +737,8 @@ static void set_x_funcs (void) } else if (currprefs.cpu_compatible) { x_prefetch = get_word_prefetch; x_get_ilong = NULL; - x_get_iword = get_iword; - x_get_ibyte = get_ibyte; + x_get_iword = get_iiword; + x_get_ibyte = get_iibyte; x_next_iword = NULL; x_next_ilong = NULL; x_put_long = put_long; @@ -752,11 +752,11 @@ static void set_x_funcs (void) x_do_cycles_post = do_cycles_post; } else { x_prefetch = NULL; - x_get_ilong = get_ilong; - x_get_iword = get_iword; - x_get_ibyte = get_ibyte; - x_next_iword = next_iword; - x_next_ilong = next_ilong; + x_get_ilong = get_iilong; + x_get_iword = get_iiword; + x_get_ibyte = get_iibyte; + x_next_iword = next_iiword; + x_next_ilong = next_iilong; x_put_long = put_long; x_put_word = put_word; x_put_byte = put_byte; @@ -789,11 +789,11 @@ static void set_x_funcs (void) } else { // JIT or 68030+ does not have real prefetch only emulation x_prefetch = NULL; - x_get_ilong = get_ilong; - x_get_iword = get_iword; - x_get_ibyte = get_ibyte; - x_next_iword = next_iword; - x_next_ilong = next_ilong; + x_get_ilong = get_dilong; + x_get_iword = get_diword; + x_get_ibyte = get_dibyte; + x_next_iword = next_diword; + x_next_ilong = next_dilong; x_put_long = put_long; x_put_word = put_word; x_put_byte = put_byte; @@ -806,11 +806,11 @@ static void set_x_funcs (void) } } else { x_prefetch = NULL; - x_get_ilong = get_ilong; - x_get_iword = get_iword; - x_get_ibyte = get_ibyte; - x_next_iword = next_iword; - x_next_ilong = next_ilong; + x_get_ilong = get_dilong; + x_get_iword = get_diword; + x_get_ibyte = get_dibyte; + x_next_iword = next_diword; + x_next_ilong = next_dilong; x_put_long = put_long; x_put_word = put_word; x_put_byte = put_byte; @@ -1192,14 +1192,45 @@ static void build_cpufunctbl (void) write_log (_T("Building CPU, %d opcodes (%d %d %d)\n"), opcnt, lvl, currprefs.cpu_cycle_exact ? -1 : currprefs.cpu_compatible ? 1 : 0, currprefs.address_space_24); - write_log (_T("CPU=%d, FPU=%d, MMU=%d, JIT%s=%d.\n"), - currprefs.cpu_model, currprefs.fpu_model, - currprefs.mmu_model, - currprefs.cachesize ? (currprefs.compfpu ? _T("=CPU/FPU") : _T("=CPU")) : _T(""), - currprefs.cachesize); #ifdef JIT build_comp (); #endif + + write_log(_T("CPU=%d, FPU=%d, MMU=%d, JIT%s=%d."), + currprefs.cpu_model, currprefs.fpu_model, + currprefs.mmu_model, + currprefs.cachesize ? (currprefs.compfpu ? _T("=CPU/FPU") : _T("=CPU")) : _T(""), + currprefs.cachesize); + + regs.address_space_mask = 0xffffffff; + if (currprefs.cpu_compatible) { + if (currprefs.address_space_24 && currprefs.cpu_model >= 68030) + currprefs.address_space_24 = false; + } + if (currprefs.cpu_cycle_exact) { + if (currprefs.cpu_model == 68000) + write_log(_T(" prefetch and cycle-exact")); + else + write_log(_T(" ~cycle-exact")); + } else if (currprefs.cpu_compatible) { + if (currprefs.cpu_model <= 68020) { + write_log(_T(" prefetch")); + } else { + write_log(_T(" fake prefetch")); + } + } + if (currprefs.int_no_unimplemented && currprefs.cpu_model == 68060) { + write_log(_T(" no unimplemented integer instructions")); + } + if (currprefs.fpu_no_unimplemented && currprefs.fpu_model) { + write_log(_T(" no unimplemented floating point instructions")); + } + if (currprefs.address_space_24) { + regs.address_space_mask = 0x00ffffff; + write_log(_T(" 24-bit")); + } + write_log(_T("\n")); + m68k_pc_indirect = (currprefs.mmu_model || currprefs.cpu_compatible) && !currprefs.cachesize; if (tbl == op_smalltbl_0_ff || tbl == op_smalltbl_1_ff || tbl == op_smalltbl_2_ff || tbl == op_smalltbl_3_ff || tbl == op_smalltbl_4_ff || tbl == op_smalltbl_5_ff) m68k_pc_indirect = false; @@ -1268,12 +1299,11 @@ static void prefs_changed_cpu (void) currprefs.blitter_cycle_exact = changed_prefs.blitter_cycle_exact; } -void check_prefs_changed_cpu (void) + +static int check_prefs_changed_cpu2(void) { - bool changed = false; + int changed = 0; - if (!config_changed) - return; #ifdef JIT changed = check_prefs_changed_comp (); #endif @@ -1285,13 +1315,7 @@ void check_prefs_changed_cpu (void) || currprefs.fpu_no_unimplemented != changed_prefs.fpu_no_unimplemented || currprefs.cpu_compatible != changed_prefs.cpu_compatible || currprefs.cpu_cycle_exact != changed_prefs.cpu_cycle_exact) { - - uaecptr pc = m68k_getpc(); - prefs_changed_cpu (); - build_cpufunctbl (); - m68k_setpc_normal(pc); - fill_prefetch(); - changed = true; + changed |= 1; } if (changed || currprefs.m68k_speed != changed_prefs.m68k_speed @@ -1300,20 +1324,27 @@ void check_prefs_changed_cpu (void) || currprefs.cpu_frequency != changed_prefs.cpu_frequency) { currprefs.m68k_speed = changed_prefs.m68k_speed; currprefs.m68k_speed_throttle = changed_prefs.m68k_speed_throttle; - update_68k_cycles (); - changed = true; + changed |= 2; } + return changed; +} + + +void check_prefs_changed_cpu(void) +{ + if (!config_changed) + return; if (currprefs.cpu_idle != changed_prefs.cpu_idle) { currprefs.cpu_idle = changed_prefs.cpu_idle; } - if (changed) { - set_special (SPCFLAG_MODE_CHANGE); - reset_frame_rate_hack (); + if (check_prefs_changed_cpu2()) { + set_special(SPCFLAG_MODE_CHANGE); + reset_frame_rate_hack(); } - } + void init_m68k (void) { int i; @@ -1347,37 +1378,6 @@ void init_m68k (void) } } #endif - write_log (_T("Building CPU table for configuration: %d"), currprefs.cpu_model); - regs.address_space_mask = 0xffffffff; - if (currprefs.cpu_compatible) { - if (currprefs.address_space_24 && currprefs.cpu_model >= 68030) - currprefs.address_space_24 = false; - } - if (currprefs.fpu_model > 0) - write_log (_T("/%d"), currprefs.fpu_model); - if (currprefs.cpu_cycle_exact) { - if (currprefs.cpu_model == 68000) - write_log (_T(" prefetch and cycle-exact")); - else - write_log (_T(" ~cycle-exact")); - } else if (currprefs.cpu_compatible) { - if (currprefs.cpu_model <= 68020) { - write_log (_T(" prefetch")); - } else { - write_log (_T(" fake prefetch")); - } - } - if (currprefs.int_no_unimplemented && currprefs.cpu_model == 68060) { - write_log (_T(" no unimplemented integer instructions")); - } - if (currprefs.fpu_no_unimplemented && currprefs.fpu_model) { - write_log (_T(" no unimplemented floating point instructions")); - } - if (currprefs.address_space_24) { - regs.address_space_mask = 0x00ffffff; - write_log (_T(" 24-bit")); - } - write_log (_T("\n")); read_table68k (); do_merges (); @@ -1398,9 +1398,11 @@ struct regstruct regs, mmu_backup_regs; struct flag_struct regflags; static long int m68kpc_offset; +#if 0 #define get_ibyte_1(o) get_byte (regs.pc + (regs.pc_p - regs.pc_oldp) + (o) + 1) #define get_iword_1(o) get_word (regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) #define get_ilong_1(o) get_long (regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) +#endif static uaecptr ShowEA (void *f, uaecptr pc, uae_u16 opcode, int reg, amodes mode, wordsizes size, TCHAR *buf, uae_u32 *eaddr, int safemode) { @@ -2655,8 +2657,7 @@ static void m68k_reset (bool hardreset) #endif v = get_long (4); m68k_areg (regs, 7) = get_long (0); - m68k_setpc (v); - m68k_setpci (v); + m68k_setpc_normal(v); regs.s = 1; regs.m = 0; regs.stopped = 0; @@ -3207,7 +3208,7 @@ static int do_specialties (int cycles) } if (regs.spcflags & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE)) { - unset_special (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); + unset_special (SPCFLAG_BRK); // SPCFLAG_BRK breaks STOP condition, need to prefetch m68k_resumestopped (); return 1; @@ -3561,7 +3562,7 @@ void exec_nostats (void) for (;;) { - uae_u16 opcode = get_iword (0); + uae_u16 opcode = get_diword (0); cpu_cycles = (*cpufunctbl[opcode])(opcode); cpu_cycles = adjust_cycles (cpu_cycles); do_cycles (cpu_cycles); @@ -3595,7 +3596,7 @@ void execute_normal (void) if (currprefs.cpu_compatible) { opcode = get_word_020_prefetchf (regs.instruction_pc); } else { - opcode = get_iword (0); + opcode = get_diword (0); } special_mem = DISTRUST_CONSISTENT_MEM; @@ -4120,7 +4121,7 @@ static void m68k_run_2 (void) for (;;) { r->instruction_pc = m68k_getpc (); - uae_u16 opcode = get_iword (0); + uae_u16 opcode = get_diword (0); count_instr (opcode); // if (regs.s == 0 && regs.regs[15] < 0x10040000 && regs.regs[15] > 0x10000000) @@ -4150,7 +4151,7 @@ static void m68k_run_2 (void) static void m68k_run_mmu (void) { for (;;) { - uae_u16 opcode = get_iword (0); + uae_u16 opcode = get_iiword (0); do_cycles (cpu_cycles); mmu_backup_regs = regs; cpu_cycles = (*cpufunctbl[opcode])(opcode); @@ -4296,15 +4297,23 @@ void m68k_go (int may_quit) } } -#if 0 /* what was the meaning of this? this breaks trace emulation if debugger is used */ - if (regs.spcflags) { - uae_u32 of = regs.spcflags; - regs.spcflags &= ~(SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); - do_specialties (0); - regs.spcflags |= of & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); + if (regs.spcflags & SPCFLAG_MODE_CHANGE) { + int v = check_prefs_changed_cpu2(); + if (v & 1) { + uaecptr pc = m68k_getpc(); + prefs_changed_cpu(); + build_cpufunctbl(); + m68k_setpc_normal(pc); + fill_prefetch(); + } + if (v & 2) { + currprefs.m68k_speed = changed_prefs.m68k_speed; + currprefs.m68k_speed_throttle = changed_prefs.m68k_speed_throttle; + update_68k_cycles(); + } } -#endif - set_x_funcs (); + + set_x_funcs(); if (startup) { custom_prepare (); protect_roms (true); @@ -4336,9 +4345,9 @@ void m68k_go (int may_quit) #if 0 } #endif + unset_special(SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); //activate_debugger(); - run_func (); - unset_special (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); + run_func(); } protect_roms (false); in_m68k_go--; diff --git a/newcpu_common.cpp b/newcpu_common.cpp index fe434652..6196d0aa 100644 --- a/newcpu_common.cpp +++ b/newcpu_common.cpp @@ -390,7 +390,7 @@ void REGPARAM2 x_put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, int idx) { - uae_u16 dp = next_iword (); + uae_u16 dp = next_diword (); int reg = (dp >> 12) & 15; uae_s32 regd = regs.regs[reg]; if ((dp & 0x800) == 0) @@ -402,14 +402,14 @@ uae_u32 REGPARAM2 get_disp_ea_020 (uae_u32 base, int idx) if (dp & 0x40) regd = 0; if ((dp & 0x30) == 0x20) - base += (uae_s32)(uae_s16) next_iword (); + base += (uae_s32)(uae_s16) next_diword (); if ((dp & 0x30) == 0x30) - base += next_ilong (); + base += next_dilong (); if ((dp & 0x3) == 0x2) - outer = (uae_s32)(uae_s16) next_iword (); + outer = (uae_s32)(uae_s16) next_diword (); if ((dp & 0x3) == 0x3) - outer = next_ilong (); + outer = next_dilong (); if ((dp & 0x4) == 0) base += regd; diff --git a/od-win32/md-fpp.h b/od-win32/md-fpp.h index abbb944a..8b93ed93 100644 --- a/od-win32/md-fpp.h +++ b/od-win32/md-fpp.h @@ -20,6 +20,20 @@ #define FPCR_PRECISION_DOUBLE 0x00000080 #define FPCR_PRECISION_EXTENDED 0x00000000 +STATIC_INLINE void exten_zeronormalize(uae_u32 *pwrd1, uae_u32 *pwrd2, uae_u32 *pwrd3) +{ + uae_u32 wrd1 = *pwrd1; + uae_u32 wrd2 = *pwrd2; + uae_u32 wrd3 = *pwrd3; + int exp = (wrd1 >> 16) & 0x7fff; + // Force zero if mantissa is zero but exponent is non-zero + // M68k FPU automatically convert them to plain zeros. + // x86 FPU considers them invalid values + if (exp != 0 && exp != 0x7fff && !wrd2 && !wrd3) { + *pwrd1 = (wrd1 & 0x80000000); + } +} + #if USE_LONG_DOUBLE STATIC_INLINE void to_exten(fpdata *dst, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3) { @@ -29,6 +43,7 @@ STATIC_INLINE void to_exten(fpdata *dst, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd long double lf; uae_u32 longarray[3]; } uld; + exten_zeronormalize(&wrd1, &wrd2, &wrd3); // little endian order uld.longarray[0] = wrd3; uld.longarray[1] = wrd2; @@ -83,9 +98,14 @@ STATIC_INLINE uae_u32 from_single (double floatfake) #define HAVE_to_exten STATIC_INLINE void to_exten(fpdata *fpd, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3) { - uae_u32 longarray[] = { wrd3, wrd2, ((wrd1 >> 16) & 0xffff) }; // little endian + uae_u32 longarray[3]; double extenfake; + exten_normalize(&wrd1, &wrd2, &wrd3); + longarray[0] = wrd3; // littlen endian + longarray[1] = wrd2; + longarray[2] = wrd2 >> 16; + __asm { fld tbyte ptr longarray; fstp qword ptr extenfake; @@ -193,6 +213,7 @@ STATIC_INLINE void to_exten(fpdata *fpd, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd fpd->fpm = wrd1; fpd->fpx = true; #endif + exten_zeronormalize(&wrd1, &wrd2, &wrd3); if ((wrd1 & 0x7fff0000) == 0 && wrd2 == 0 && wrd3 == 0) { fpd->fp = (wrd1 & 0x80000000) ? -0.0 : +0.0; return; @@ -222,7 +243,7 @@ STATIC_INLINE void from_exten(fpdata *fpd, uae_u32 * wrd1, uae_u32 * wrd2, uae_u { v = fpd->fp; if (v == 0.0) { - *wrd1 = 0; + *wrd1 = signbit(v) ? 0x80000000 : 0; *wrd2 = 0; *wrd3 = 0; return; diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 714f6462..271e8a14 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -1,7 +1,7 @@ // Microsoft Visual C++ generated resource script. // -#include "winres.h" #include "resource.h" +#include "winres.h" ///////////////////////////////////////////////////////////////////////////// // English resources @@ -1191,8 +1191,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,7,1,0 - PRODUCTVERSION 2,7,1,0 + FILEVERSION 2,8,0,0 + PRODUCTVERSION 2,8,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -1208,12 +1208,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "WinUAE" - VALUE "FileVersion", "2.7.1.0" + VALUE "FileVersion", "2.8.0.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.1.0" + VALUE "ProductVersion", "2.8.0.0" END END BLOCK "VarFileInfo" diff --git a/od-win32/win32.h b/od-win32/win32.h index bc10228b..628e7061 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,11 +19,11 @@ #define LANG_DLL 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("14") +#define WINUAEBETA _T("15") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2014, 4, 8) +#define WINUAEDATE MAKEBD(2014, 4, 13) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 77221670..ea4b8108 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -11,6 +11,19 @@ - restore only single input target to default. +Beta 15: + +- Finally bumped version to 2.8.0. This isn't small 2.7.0 update (Should have been done since b6 or so..) +- FPU register negative zero transformed to positive zero when it was written to or read from memory + in extended FP format (FMOVE.X FPx, or FMOVE.X ,FPx or FMOVEM). No one should care as usual. +- When loading FPU register from memory in extended format, normalize any "unnormal" zero. + (non-zero exponent but zero mantissa part). Motorola FPUs do this automatically, x86 FPU + does not seem to like them. (Another mostly Next specific update) +- Programmed mode autoresolution should now work with strange modes like highgfx. +- Only allow CPU mode changes between instructions, previously change sometimes happened mid-instruction + (during instruction internal memory read/write) which wasn't safe. +- Small tweak to recent sprite update (Hybris) + Beta 14: - FSINCOS second register supported in disassembler. diff --git a/od-win32/wix/Product.wxs b/od-win32/wix/Product.wxs index 04c9a2c1..d4fcd4d8 100644 --- a/od-win32/wix/Product.wxs +++ b/od-win32/wix/Product.wxs @@ -1,6 +1,6 @@ - +