Commit b5a5f21fe1fa73860955d229457399dc133bbb11

Authored by Imanol-Mikel Barba Sabariego
1 parent ac031467

Tweaked debug.c (cycle count)

Showing 1 changed file with 3 additions and 6 deletions
... ... @@ -7,7 +7,7 @@
7 7 #include "debug.h"
8 8 #include <signal.h>
9 9  
10   -//uint32_t cycle_count = 0;
  10 +uint32_t cycle_count = 0;
11 11 uint8_t breakpoint = 1;
12 12 uint16_t breakpoints[0xFF];
13 13 uint16_t nbpoints = 0;
... ... @@ -162,11 +162,6 @@ uint8_t in_breakpoint(uint16_t pc)
162 162 uint16_t fetch_debug()
163 163 {
164 164 uint16_t value = mem[pc++];
165   - /*if(breakpoint)
166   - {
167   - fprintf(stderr,"0x%2x (0x%2x): %d", pc, pc * sizeof(uint16_t),value);
168   - fprintf(stderr," cycle: %d\n", cycle_count++);
169   - }*/
170 165 return value;
171 166 }
172 167  
... ... @@ -298,6 +293,7 @@ void debug_program()
298 293 uint16_t arg3;
299 294 for(;;)
300 295 {
  296 + cycle_count++;
301 297 if(in_breakpoint(pc))
302 298 {
303 299 breakpoint = 1;
... ... @@ -305,6 +301,7 @@ void debug_program()
305 301 }
306 302 if(breakpoint)
307 303 {
  304 + fprintf(stderr, "cycle: %d\n", cycle_count);
308 305 fprintf(stderr, "%02X: ", pc);
309 306 print_instruction(mem[pc], mem[pc+1], mem[pc+2], mem[pc+3]);
310 307 if(stdin_length())
... ...