unsigned short pc_get(void);
void pc_move(int offset);
void report_exec_err(void);
+void d1_set(int on_off);
void d2_set(int on_off);
void d3_set(int on_off);
void dump_6502(int full);
extern int debug_mode;
extern unsigned short break_point;
-extern int dbg_log_msg;
extern int critical_error;
static void (*dump_6502_level2)(int);
static void (*dump_6502_level3_load)(unsigned short, unsigned char);
static void (*dump_6502_level3_store)(unsigned short, unsigned char);
+static int (*d1_disas)(unsigned short);
/*
* clock execution function array.
break_hit();
}
- if (dbg_log_msg) {
- disas_inst(pc);
- }
+ d1_disas(pc);
if (debug_mode) {
- if (!dbg_log_msg)
- disas_inst(pc);
ret = emu_debug();
if (!ret)
return FALSE;
/*null func*/
static void null_dump_6502 (int param) {}
static void null_load_store (unsigned short addr, unsigned char data) {}
+static int null_disas(unsigned short addr) {return 0;}
static void dump_load (unsigned short addr, unsigned char data) {
dprint(" ");
cpu_data_buffer = 0;
cpu_addr_buffer = 0;
+ d1_set(debug_mode);
d2_set(debug_mode);
d3_set(debug_mode);
}
/*------for debug.c-----*/
+void d1_set(int on_off) {
+ if (on_off) {
+ d1_disas = disas_inst;
+ }
+ else {
+ d1_disas = null_disas;
+ }
+}
+
void d2_set(int on_off) {
if (on_off) {
dump_6502_level2 = dump_6502;
unsigned char dbg_get_byte(unsigned short addr);
unsigned short dbg_get_short(unsigned short addr);
void dump_ppu_reg(void);
+void d1_set(int on_off);
void d2_set(int on_off);
void d3_set(int on_off);
void d4_set(int on_off);
static struct cmd_list* debug_history;
//global variable.
-int dbg_log_msg;
unsigned short break_point;
static void print_debug(void) {
printf(" pshow: show ppu registers\n");
printf(" v addr size: vram dump\n");
printf(" da addr size: disassemble\n");
- printf(" log on/off: set log msg on/off\n");
+ printf(" d1 on/off: debug log level 1 (dump instruction on execution)\n");
printf(" d2 on/off: debug log level 2 (dump reg status for each instruction)\n");
printf(" d3 on/off: debug log level 3 (dump load/store data value)\n");
printf(" d4 on/off: debug log level 4 (dump vram data write)\n");
else if (!strcmp(buf, "show")){
dump_6502(TRUE);
}
- else if (!strcmp(buf, "log")){
+ else if (!strcmp(buf, "d1")){
scanf("%s", buf);
if (!strcmp(buf, "on")){
- dbg_log_msg = TRUE;
+ d1_set(TRUE);
}
else if (!strcmp(buf, "off")){
- dbg_log_msg = FALSE;
+ d1_set(FALSE);
}
else {
printf("log parameter must be either [on] or [off].\n");
int init_debug(void) {
dprint("init debug..\n");
debug_history = NULL;
- dbg_log_msg = debug_mode;
break_point = 0;
//initscr(); /* Start curses mode */
unsigned short dbg_get_short(unsigned short addr) { return 0; }
int disas_inst(unsigned short addr) { return 0; }
void set_nmi_pin(int val) { }
+void d1_set(int on_off) {}
void d2_set(int on_off) {}
void d3_set(int on_off) {}