Mercurial > repos > blastem
comparison backend.h @ 653:a18e3923481e
Remove some of the hard coded assumptions about the memory map from the CPU cores
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 01 Jan 2015 14:36:55 -0800 |
parents | 9d6fed6501ba |
children | 30ccf56842d6 |
comparison
equal
deleted
inserted
replaced
652:f822d9216968 | 653:a18e3923481e |
---|---|
44 READ_8, | 44 READ_8, |
45 WRITE_16, | 45 WRITE_16, |
46 WRITE_8 | 46 WRITE_8 |
47 } ftype; | 47 } ftype; |
48 | 48 |
49 typedef struct { | |
50 uint32_t flags; | |
51 native_map_slot *native_code_map; | |
52 deferred_addr *deferred; | |
53 code_info code; | |
54 uint8_t **ram_inst_sizes; | |
55 code_ptr save_context; | |
56 code_ptr load_context; | |
57 code_ptr handle_cycle_limit; | |
58 code_ptr handle_cycle_limit_int; | |
59 code_ptr handle_code_write; | |
60 uint32_t address_mask; | |
61 uint32_t max_address; | |
62 uint32_t bus_cycles; | |
63 int32_t mem_ptr_off; | |
64 int32_t ram_flags_off; | |
65 uint8_t ram_flags_shift; | |
66 uint8_t address_size; | |
67 uint8_t byte_swap; | |
68 uint8_t context_reg; | |
69 uint8_t cycles; | |
70 uint8_t limit; | |
71 uint8_t scratch1; | |
72 uint8_t scratch2; | |
73 } cpu_options; | |
74 | |
75 | |
76 #define MMAP_READ 0x01 | 49 #define MMAP_READ 0x01 |
77 #define MMAP_WRITE 0x02 | 50 #define MMAP_WRITE 0x02 |
78 #define MMAP_CODE 0x04 | 51 #define MMAP_CODE 0x04 |
79 #define MMAP_PTR_IDX 0x08 | 52 #define MMAP_PTR_IDX 0x08 |
80 #define MMAP_ONLY_ODD 0x10 | 53 #define MMAP_ONLY_ODD 0x10 |
98 write_16_fun write_16; | 71 write_16_fun write_16; |
99 read_8_fun read_8; | 72 read_8_fun read_8; |
100 write_8_fun write_8; | 73 write_8_fun write_8; |
101 } memmap_chunk; | 74 } memmap_chunk; |
102 | 75 |
76 typedef struct { | |
77 uint32_t flags; | |
78 native_map_slot *native_code_map; | |
79 deferred_addr *deferred; | |
80 code_info code; | |
81 uint8_t **ram_inst_sizes; | |
82 memmap_chunk const *memmap; | |
83 code_ptr save_context; | |
84 code_ptr load_context; | |
85 code_ptr handle_cycle_limit; | |
86 code_ptr handle_cycle_limit_int; | |
87 code_ptr handle_code_write; | |
88 uint32_t memmap_chunks; | |
89 uint32_t address_mask; | |
90 uint32_t max_address; | |
91 uint32_t bus_cycles; | |
92 int32_t mem_ptr_off; | |
93 int32_t ram_flags_off; | |
94 uint8_t ram_flags_shift; | |
95 uint8_t address_size; | |
96 uint8_t byte_swap; | |
97 uint8_t context_reg; | |
98 uint8_t cycles; | |
99 uint8_t limit; | |
100 uint8_t scratch1; | |
101 uint8_t scratch2; | |
102 } cpu_options; | |
103 | |
103 typedef uint8_t * (*native_addr_func)(void * context, uint32_t address); | 104 typedef uint8_t * (*native_addr_func)(void * context, uint32_t address); |
104 | 105 |
105 deferred_addr * defer_address(deferred_addr * old_head, uint32_t address, uint8_t *dest); | 106 deferred_addr * defer_address(deferred_addr * old_head, uint32_t address, uint8_t *dest); |
106 void remove_deferred_until(deferred_addr **head_ptr, deferred_addr * remove_to); | 107 void remove_deferred_until(deferred_addr **head_ptr, deferred_addr * remove_to); |
107 void process_deferred(deferred_addr ** head_ptr, void * context, native_addr_func get_native); | 108 void process_deferred(deferred_addr ** head_ptr, void * context, native_addr_func get_native); |
110 void check_cycles_int(cpu_options *opts, uint32_t address); | 111 void check_cycles_int(cpu_options *opts, uint32_t address); |
111 void check_cycles(cpu_options * opts); | 112 void check_cycles(cpu_options * opts); |
112 void check_code_prologue(code_info *code); | 113 void check_code_prologue(code_info *code); |
113 | 114 |
114 code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t num_chunks, ftype fun_type, code_ptr *after_inc); | 115 code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t num_chunks, ftype fun_type, code_ptr *after_inc); |
116 void * get_native_pointer(uint32_t address, void ** mem_pointers, cpu_options * opts); | |
115 | 117 |
116 #endif //BACKEND_H_ | 118 #endif //BACKEND_H_ |
117 | 119 |