-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.h
127 lines (98 loc) · 3.63 KB
/
debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
* debug.h - Various debugging options.
*
* Written by
* Andreas Boose <viceteam@t-online.de>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*/
#ifndef VICE_DEBUG_H
#define VICE_DEBUG_H
#include "types.h"
/* This enables debugging. Attention: It makes things a bit slower. */
/*#define DEBUG*/
#define DEBUG_NORMAL 0
#define DEBUG_SMALL 1
#define DEBUG_HISTORY 2
#define DEBUG_AUTOPLAY 3
#define DEBUG_HISTORY_MAXFILESIZE 4000000
#define DEBUG_MAXLINELEN 128
typedef struct debug_s {
#ifdef DEBUG
int maincpu_traceflg;
int drivecpu_traceflg[4];
int trace_mode;
/*
* if this is set, the CPU will break into the monitor before executing the
* next statement. This is often handy for debugging.
*/
int perform_break_into_monitor;
/*! If this is set, inputs and outputs to the IEC bus are output. */
int iec;
#endif
int do_core_dumps;
} debug_t;
extern debug_t debug;
struct interrupt_cpu_status_s;
extern int debug_resources_init(void);
extern int debug_cmdline_options_init(void);
extern void debug_set_machine_parameter(unsigned int cycles,
unsigned int lines);
extern void debug_maincpu(DWORD reg_pc, CLOCK mclk, const char *dis,
BYTE reg_a, BYTE reg_x, BYTE reg_y, BYTE reg_sp);
extern void debug_drive(DWORD reg_pc, CLOCK mclk, const char *dis,
BYTE reg_a, BYTE reg_x, BYTE reg_y, BYTE reg_sp,
unsigned int driveno);
extern void debug_irq(struct interrupt_cpu_status_s *cs, CLOCK iclk);
extern void debug_nmi(struct interrupt_cpu_status_s *cs, CLOCK iclk);
extern void debug_dma(const char *txt, CLOCK dclk, int num);
extern void debug_text(const char *text);
extern void debug_start_recording(void);
extern void debug_stop_recording(void);
extern void debug_start_playback(void);
extern void debug_stop_playback(void);
extern void debug_set_milestone(void);
extern void debug_reset_milestone(void);
extern void debug_check_autoplay_mode(void);
#ifdef DEBUG
extern void debug_iec_drv_write(unsigned int data);
extern void debug_iec_drv_read(unsigned int data);
extern void debug_iec_bus_write(unsigned int data);
extern void debug_iec_bus_read(unsigned int data);
# define DEBUG_IEC_DRV_WRITE(_data) debug_iec_drv_write(_data)
# define DEBUG_IEC_DRV_READ(_data) debug_iec_drv_read(_data)
# define DEBUG_IEC_BUS_WRITE(_data) debug_iec_bus_write(_data)
# define DEBUG_IEC_BUS_READ(_data) debug_iec_bus_read(_data)
#else
# define DEBUG_IEC_DRV_WRITE(_data)
# define DEBUG_IEC_DRV_READ(_data)
# define DEBUG_IEC_BUS_WRITE(_data)
# define DEBUG_IEC_BUS_READ(_data)
#endif
#ifdef NDEBUG
# define STATIC_ASSERT(_x)
#else
# define STATIC_ASSERT(_x) \
{ \
BYTE dummy[1 - 2 * ((_x) == 0)]; \
dummy[0] = dummy[0] - dummy[0]; /* prevent "unused variable" warning */ \
}
#endif
#endif