comparison z80_to_x86.h @ 2400:c97609fe8315

Implement watchpoints in Z80 debugger
author Michael Pavone <pavone@retrodev.com>
date Sat, 23 Dec 2023 23:03:31 -0800
parents f6d5bde4d07f
children
comparison
equal deleted inserted replaced
2399:68eba54b60f7 2400:c97609fe8315
24 ZF_Z, 24 ZF_Z,
25 ZF_S, 25 ZF_S,
26 ZF_XY, 26 ZF_XY,
27 ZF_NUM 27 ZF_NUM
28 }; 28 };
29
30 typedef struct {
31 uint16_t start;
32 uint16_t end;
33 uint8_t check_change;
34 } z80_watchpoint;
29 35
30 typedef struct z80_context z80_context; 36 typedef struct z80_context z80_context;
31 typedef void (*z80_ctx_fun)(z80_context * context); 37 typedef void (*z80_ctx_fun)(z80_context * context);
32 38
33 typedef struct { 39 typedef struct {
76 uint32_t int_enable_cycle; 82 uint32_t int_enable_cycle;
77 uint16_t pc; 83 uint16_t pc;
78 uint32_t int_pulse_start; 84 uint32_t int_pulse_start;
79 uint32_t int_pulse_end; 85 uint32_t int_pulse_end;
80 uint32_t nmi_start; 86 uint32_t nmi_start;
87 z80_watchpoint *watchpoints;
88 uint32_t num_watchpoints;
89 uint32_t wp_storage;
90 uint16_t watchpoint_min;
91 uint16_t watchpoint_max;
92 uint16_t wp_hit_address;
93 uint8_t wp_hit_value;
94 uint8_t wp_old_value;
95 uint8_t wp_hit;
81 uint8_t breakpoint_flags[(16 * 1024)/sizeof(uint8_t)]; 96 uint8_t breakpoint_flags[(16 * 1024)/sizeof(uint8_t)];
82 uint8_t * bp_handler; 97 uint8_t * bp_handler;
83 uint8_t * bp_stub; 98 uint8_t * bp_stub;
84 uint8_t * interp_code[256]; 99 uint8_t * interp_code[256];
85 z80_ctx_fun next_int_pulse; 100 z80_ctx_fun next_int_pulse;
100 z80_context * z80_handle_code_write(uint32_t address, z80_context * context); 115 z80_context * z80_handle_code_write(uint32_t address, z80_context * context);
101 void z80_invalidate_code_range(z80_context *context, uint32_t start, uint32_t end); 116 void z80_invalidate_code_range(z80_context *context, uint32_t start, uint32_t end);
102 void z80_reset(z80_context * context); 117 void z80_reset(z80_context * context);
103 void zinsert_breakpoint(z80_context * context, uint16_t address, uint8_t * bp_handler); 118 void zinsert_breakpoint(z80_context * context, uint16_t address, uint8_t * bp_handler);
104 void zremove_breakpoint(z80_context * context, uint16_t address); 119 void zremove_breakpoint(z80_context * context, uint16_t address);
120 void z80_add_watchpoint(z80_context *context, uint16_t address, uint16_t size);
121 void z80_remove_watchpoint(z80_context *context, uint32_t address, uint32_t size);
105 void z80_run(z80_context * context, uint32_t target_cycle); 122 void z80_run(z80_context * context, uint32_t target_cycle);
106 void z80_assert_reset(z80_context * context, uint32_t cycle); 123 void z80_assert_reset(z80_context * context, uint32_t cycle);
107 void z80_clear_reset(z80_context * context, uint32_t cycle); 124 void z80_clear_reset(z80_context * context, uint32_t cycle);
108 void z80_assert_busreq(z80_context * context, uint32_t cycle); 125 void z80_assert_busreq(z80_context * context, uint32_t cycle);
109 void z80_clear_busreq(z80_context * context, uint32_t cycle); 126 void z80_clear_busreq(z80_context * context, uint32_t cycle);