//#define INPREC_VSYNC 6
//#define INPREC_CIAVSYNC 7
#define INPREC_EVENT 8
+#define INPREC_DEBUG_START 0x60
+#define INPREC_DEBUG 0x60
#define INPREC_CIADEBUG 0x61
-#define INPREC_DEBUG 0x62
-#define INPREC_DEBUG2 0x63
+#define INPREC_CPUDEBUG 0x62
+#define INPREC_DEBUG_END 0x6f
#define INPREC_STOP 0x7d
#define INPREC_END 0x7e
#define INPREC_QUIT 0x7f
extern void inprec_recorddebug (uae_u32);
extern void inprec_playdebug (uae_u32);
-extern void inprec_recorddebug_cpu (int);
-extern void inprec_playdebug_cpu (int);
+extern void inprec_recorddebug_cpu (int, uae_u16);
+extern void inprec_playdebug_cpu (int, uae_u16);
extern void inprec_recorddebug_cia (uae_u32, uae_u32, uae_u32);
extern void inprec_playdebug_cia (uae_u32, uae_u32, uae_u32);
#include "newcpu.h"
#endif
-int inputrecord_debug = 3;
+int inputrecord_debug = 1 | 2;
extern int inputdevice_logging;
int hpos = current_hpos();
lastcycle = get_cycles ();
int mvp = current_maxvpos ();
- if ((type != INPREC_DEBUG && type != INPREC_DEBUG2 && type != INPREC_CIADEBUG) || (0 && vsync_counter >= 49 && vsync_counter <= 51))
+ if ((type < INPREC_DEBUG_START || type > INPREC_DEBUG_END) || (0 && vsync_counter >= 49 && vsync_counter <= 51))
write_log (_T("INPREC: %010d/%03d: %d (%d/%d) %08x\n"), hsync_counter, hpos, type, hsync_counter % mvp, mvp, lastcycle);
inprec_plast = inprec_p;
inprec_ru8 (type);
return 1;
}
if (cycles < cycles2) {
- if (type2 != INPREC_DEBUG && type2 != INPREC_DEBUG2 && type2 != INPREC_CIADEBUG) {
+ if (type2 < INPREC_DEBUG_START || type2 > INPREC_DEBUG_END) {
int diff = (uae_u32)((cycles2 - cycles) / CYCLE_UNIT);
if (diff < maxhpos) {
event2_newevent_x_replace(diff, 0, inprec_event);
break;
}
if (type2 == type) {
- if (type != INPREC_DEBUG && type != INPREC_DEBUG2 && type != INPREC_CIADEBUG && cycles != cycles2)
+ if ((type < INPREC_DEBUG_START || type > INPREC_DEBUG_END) && cycles != cycles2)
write_log (_T("INPREC: %010d/%03d: %d (%d/%d) (%d/%d) %08X/%08X\n"), hc, hpos, type, hc % mvp, mvp, hc_orig - hc2_orig, hpos - hpos2, cycles, cycles2);
if (cycles != cycles2 + cycleoffset) {
if (warned > 0) {
#endif
}
-void inprec_recorddebug_cpu (int mode)
+void inprec_recorddebug_cpu (int mode, uae_u16 data)
{
#if INPUTRECORD_DEBUG > 0
- if (inprec_rstart (INPREC_DEBUG2)) {
- inprec_ru32 (m68k_getpc ());
- inprec_ru64 (get_cycles () | mode);
+ if (inprec_rstart (INPREC_CPUDEBUG + mode)) {
+ inprec_ru32(m68k_getpc());
+ inprec_ru16(data);
inprec_rend ();
}
#endif
}
-void inprec_playdebug_cpu (int mode)
+void inprec_playdebug_cpu (int mode, uae_u16 data)
{
#if INPUTRECORD_DEBUG > 0
int err = 0;
- if (inprec_pstart (INPREC_DEBUG2)) {
- uae_u32 pc1 = m68k_getpc ();
- uae_u32 pc2 = inprec_pu32 ();
- uae_u64 v1 = get_cycles () | mode;
- uae_u64 v2 = inprec_pu64 ();
- if (pc1 != pc2) {
+ if (inprec_pstart (INPREC_CPUDEBUG + mode)) {
+ uae_u32 pc1 = m68k_getpc();
+ uae_u32 pc2 = inprec_pu32();
+ uae_u16 data2 = inprec_pu16();
+ if (pc1 != pc2 || data != data2) {
if (warned > 0) {
warned--;
- write_log (_T("SYNC ERROR2 PC %08x != %08x\n"), pc1, pc2);
+ write_log (_T("SYNC ERROR2 PC %08x - %08x, D %04x - %04x, M %d\n"), pc1, pc2, data, data2, mode);
for (int i = 0; i < 15; i++)
write_log (_T("%08x "), pcs[i]);
write_log (_T("\n"));
memmove(pcs2 + 1, pcs2, 15 * sizeof(uae_u64));
pcs2[0] = get_cycles();
}
- if (v1 != v2) {
- if (warned > 0) {
- warned--;
- write_log (_T("SYNC ERROR2 %08x != %08x\n"), v1, v2);
- for (int i = 0; i < 15; i++)
- write_log (_T("%08x "), pcs[i]);
- write_log (_T("\n"));
- }
- err = 1;
- }
inprec_pend ();
} else if (input_play > 0) {
if (warned > 0) {
#endif
if (inputrecord_debug & 2) {
if (input_record > 0)
- inprec_recorddebug_cpu (2);
+ inprec_recorddebug_cpu(2, 0);
else if (input_play > 0)
- inprec_playdebug_cpu (2);
+ inprec_playdebug_cpu(2, 0);
}
assert (nr < 8 && nr >= 0);
if (inputrecord_debug & 4) {
if (input_record > 0)
- inprec_recorddebug_cpu (1);
+ inprec_recorddebug_cpu(1, r->opcode);
else if (input_play > 0)
- inprec_playdebug_cpu (1);
+ inprec_playdebug_cpu(1, r->opcode);
}
#ifdef DEBUGGER
if (inputrecord_debug & 4) {
if (input_record > 0)
- inprec_recorddebug_cpu (1);
+ inprec_recorddebug_cpu(1, r->opcode);
else if (input_play > 0)
- inprec_playdebug_cpu (1);
+ inprec_playdebug_cpu(1, r->opcode);
}
#ifdef DEBUGGER
if (debug_opcode_watch) {
if (inputrecord_debug & 4) {
if (input_record > 0)
- inprec_recorddebug_cpu (1);
+ inprec_recorddebug_cpu(1, r->opcode);
else if (input_play > 0)
- inprec_playdebug_cpu (1);
+ inprec_playdebug_cpu(1, r->opcode);
}
#ifdef DEBUGGER
if (debug_opcode_watch) {
memory_clear ();
write_log (_T("hardreset, memory cleared\n"));
}
+#ifdef DEBUGGER
+ if (debug_dma) {
+ record_dma_reset(1);
+ record_dma_reset(1);
+ }
+#endif
#ifdef SAVESTATE
/* We may have been restoring state, but we're done now. */
if (isrestore ()) {
-#ifdef DEBUGGER
- if (debug_dma) {
- record_dma_reset(0);
- record_dma_reset(0);
- }
-#endif
restored = savestate_restore_finish ();
memory_map_dump ();
if (currprefs.mmu_model == 68030) {