OSDN Git Service

- ppu debug dump func updated
authorastoria-d <astoria-d@mail.goo.ne.jp>
Fri, 4 Oct 2013 05:27:02 +0000 (14:27 +0900)
committerastoria-d <astoria-d@mail.goo.ne.jp>
Fri, 4 Oct 2013 05:27:02 +0000 (14:27 +0900)
- debugger reset command added.

emulator/bus.c
emulator/bus.h
emulator/cpu.c
emulator/debug.c
emulator/ppucore/ppucore.c

index a42aa66..c4abcd8 100644 (file)
@@ -194,6 +194,14 @@ int get_nmi_pin(void) {
     return pin_status.nmi;
 }
 
+void set_reset_pin(int val) {
+    pin_status.reset = val;
+}
+
+int get_reset_pin(void) {
+    return pin_status.reset;
+}
+
 int init_bus(void) {
     addr_bus = 0;
     data_bus = 0;
index 77d3134..a913a97 100644 (file)
@@ -15,5 +15,8 @@ void take_bus(void);
 void set_nmi_pin(int val);
 int get_nmi_pin(void);
 
+void set_reset_pin(int val);
+int get_reset_pin(void);
+
 #endif /*__bus_h__*/
 
index a66c8ac..4d951f9 100644 (file)
@@ -10,6 +10,7 @@
 static int fetch_and_decode_inst(void);
 static int decode_inst(void);
 static int execute_inst(void);
+static int reset_handler1(void);
 
 int reset6502(void);
 int reset_exec6502(void);
@@ -71,6 +72,12 @@ int clock_cpu(void) {
     //dprint("%d\n", clock_cnt);
     clock_cnt++;
 
+    if (get_reset_pin()) {
+        execute_func = reset_handler1;
+        set_reset_pin(0);
+        return execute_func();
+    }
+
     ret = execute_func();
 
     return ret;
@@ -154,7 +161,7 @@ static int reset_handler1(void) {
 }
 
 void reset_cpu(void) {
-    execute_func = reset_handler1;
+    set_reset_pin(1);
 }
 
 static int nmi_handler(void) {
index 7ca66c1..2f024b8 100644 (file)
@@ -19,6 +19,7 @@ void d1_set(int on_off);
 void d2_set(int on_off);
 void d3_set(int on_off);
 void d4_set(int on_off);
+void reset_cpu(void);
 
 #define MAX_HISTORY     10
 
@@ -35,6 +36,7 @@ static void print_debug(void) {
     printf("   command:\n");
     printf("            s: step\n");
     printf("            c: continue\n");
+    printf("            r: reset\n");
     printf("       b addr: set break point\n");
     printf("               (break point can be set only 1 address.)\n");
     printf("          del: delete break point\n");
@@ -103,6 +105,9 @@ int emu_debug(void) {
             debug_mode = FALSE;
             break;
         }
+        else if (!strcmp(buf, "r")){
+            reset_cpu();
+        }
         else if (!strcmp(buf, "show")){
             dump_6502(TRUE);
         }
index 0d62d03..5310e78 100644 (file)
@@ -402,5 +402,16 @@ void dump_ppu_reg(void) {
     printf(" left 8 pix bg:%d\n", ctrl_reg2.show_left_8bg);
     printf(" col mode:%d\n", ctrl_reg2.color_mode);
 
+    printf("\nstatus reg\n");
+    printf(" vram_ignore:%d\n", status_reg.vram_ignore);
+    printf(" sprite_overflow:%d\n", status_reg.sprite_overflow);
+    printf(" sprite0_hit:%d\n", status_reg.sprite0_hit);
+    printf(" vblank:%d\n", status_reg.vblank);
+
+    printf("\nvram_addr_reg:%04x\n", vram_addr_reg.addr.s);
+    printf("vram_data_reg:%02x\n", vram_data_reg);
+    printf("\nscroll_reg:\n");
+    printf(" x:%d\n", scroll_reg.x);
+    printf(" y:%d\n", scroll_reg.y);
 }