comparison z80_to_x86.h @ 1117:928a65750345

Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
author Michael Pavone <pavone@retrodev.com>
date Thu, 22 Dec 2016 19:51:25 -0800
parents fe8c79f82c22
children 8f14767661fa
comparison
equal deleted inserted replaced
1116:fe8c79f82c22 1117:928a65750345
24 ZF_S, 24 ZF_S,
25 ZF_XY, 25 ZF_XY,
26 ZF_NUM 26 ZF_NUM
27 }; 27 };
28 28
29 typedef void (*z80_run_fun)(void * context); 29 typedef struct z80_context z80_context;
30 typedef void (*z80_ctx_fun)(z80_context * context);
30 31
31 typedef struct { 32 typedef struct {
32 cpu_options gen; 33 cpu_options gen;
33 code_ptr save_context_scratch; 34 code_ptr save_context_scratch;
34 code_ptr load_context_scratch; 35 code_ptr load_context_scratch;
45 code_ptr read_io; 46 code_ptr read_io;
46 code_ptr write_io; 47 code_ptr write_io;
47 48
48 uint32_t flags; 49 uint32_t flags;
49 int8_t regs[Z80_UNUSED]; 50 int8_t regs[Z80_UNUSED];
50 z80_run_fun run; 51 z80_ctx_fun run;
51 } z80_options; 52 } z80_options;
52 53
53 typedef struct { 54 struct z80_context {
54 void * native_pc; 55 void * native_pc;
55 uint16_t sp; 56 uint16_t sp;
56 uint8_t flags[ZF_NUM]; 57 uint8_t flags[ZF_NUM];
57 uint16_t bank_reg; 58 uint16_t bank_reg;
58 uint8_t regs[Z80_A+1]; 59 uint8_t regs[Z80_A+1];
80 uint32_t int_pulse_end; 81 uint32_t int_pulse_end;
81 uint8_t breakpoint_flags[(16 * 1024)/sizeof(uint8_t)]; 82 uint8_t breakpoint_flags[(16 * 1024)/sizeof(uint8_t)];
82 uint8_t * bp_handler; 83 uint8_t * bp_handler;
83 uint8_t * bp_stub; 84 uint8_t * bp_stub;
84 uint8_t * interp_code[256]; 85 uint8_t * interp_code[256];
86 z80_ctx_fun next_int_pulse;
85 uint8_t reset; 87 uint8_t reset;
86 uint8_t busreq; 88 uint8_t busreq;
87 uint8_t busack; 89 uint8_t busack;
88 } z80_context; 90 };
89 91
90 void translate_z80_stream(z80_context * context, uint32_t address); 92 void translate_z80_stream(z80_context * context, uint32_t address);
91 void init_z80_opts(z80_options * options, memmap_chunk const * chunks, uint32_t num_chunks, memmap_chunk const * io_chunks, uint32_t num_io_chunks, uint32_t clock_divider, uint32_t io_address_mask); 93 void init_z80_opts(z80_options * options, memmap_chunk const * chunks, uint32_t num_chunks, memmap_chunk const * io_chunks, uint32_t num_io_chunks, uint32_t clock_divider, uint32_t io_address_mask);
92 void z80_options_free(z80_options *opts); 94 void z80_options_free(z80_options *opts);
93 void init_z80_context(z80_context * context, z80_options * options); 95 void init_z80_context(z80_context * context, z80_options * options);
102 void z80_clear_reset(z80_context * context, uint32_t cycle); 104 void z80_clear_reset(z80_context * context, uint32_t cycle);
103 void z80_assert_busreq(z80_context * context, uint32_t cycle); 105 void z80_assert_busreq(z80_context * context, uint32_t cycle);
104 void z80_clear_busreq(z80_context * context, uint32_t cycle); 106 void z80_clear_busreq(z80_context * context, uint32_t cycle);
105 uint8_t z80_get_busack(z80_context * context, uint32_t cycle); 107 uint8_t z80_get_busack(z80_context * context, uint32_t cycle);
106 void z80_adjust_cycles(z80_context * context, uint32_t deduction); 108 void z80_adjust_cycles(z80_context * context, uint32_t deduction);
107 //to be provided by system code
108 void z80_next_int_pulse(z80_context * z_context);
109 109
110 #endif //Z80_TO_X86_H_ 110 #endif //Z80_TO_X86_H_
111 111