comparison m68k_core.h @ 569:9b7fcf748be0

Rename x86_68k_options and m68k_to_x86.h to m68k_options and m68k_core.h respectively
author Michael Pavone <pavone@retrodev.com>
date Sun, 02 Mar 2014 15:25:52 -0800
parents m68k_to_x86.h@8e395210f50f
children 76bba9ffe351
comparison
equal deleted inserted replaced
568:19e517735215 569:9b7fcf748be0
1 /*
2 Copyright 2013 Michael Pavone
3 This file is part of BlastEm.
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
5 */
6 #ifndef M68K_CORE_H_
7 #define M68K_CORE_H_
8 #include <stdint.h>
9 #include <stdio.h>
10 #include "backend.h"
11 //#include "68kinst.h"
12 struct m68kinst;
13
14 #define NUM_MEM_AREAS 4
15 #define NATIVE_MAP_CHUNKS (64*1024)
16 #define NATIVE_CHUNK_SIZE ((16 * 1024 * 1024 / NATIVE_MAP_CHUNKS)/2)
17 #define MAX_NATIVE_SIZE 255
18
19 typedef void (*start_fun)(uint8_t * addr, void * context);
20
21 typedef struct {
22 cpu_options gen;
23
24 int8_t dregs[8];
25 int8_t aregs[8];
26 int8_t flag_regs[5];
27 FILE *address_log;
28 code_ptr read_16;
29 code_ptr write_16;
30 code_ptr read_8;
31 code_ptr write_8;
32 code_ptr read_32;
33 code_ptr write_32_lowfirst;
34 code_ptr write_32_highfirst;
35 code_ptr do_sync;
36 code_ptr trap;
37 start_fun start_context;
38 code_ptr retrans_stub;
39 code_ptr native_addr;
40 code_ptr native_addr_and_sync;
41 code_ptr get_sr;
42 code_ptr set_sr;
43 code_ptr set_ccr;
44 } m68k_options;
45
46 typedef struct {
47 uint8_t flags[5];
48 uint8_t status;
49 uint16_t int_ack;
50 uint32_t dregs[8];
51 uint32_t aregs[9];
52 uint32_t target_cycle; //cycle at which the next synchronization or interrupt occurs
53 uint32_t current_cycle;
54 uint32_t sync_cycle;
55 uint32_t int_cycle;
56 uint32_t int_num;
57 uint16_t *mem_pointers[NUM_MEM_AREAS];
58 void *video_context;
59 uint16_t reserved;
60
61 native_map_slot *native_code_map;
62 void *options;
63 uint8_t ram_code_flags[32/8];
64 void *system;
65 } m68k_context;
66
67 void translate_m68k(m68k_options * opts, struct m68kinst * inst);
68 void translate_m68k_stream(uint32_t address, m68k_context * context);
69 void start_68k_context(m68k_context * context, uint32_t address);
70 void init_x86_68k_opts(m68k_options * opts, memmap_chunk * memmap, uint32_t num_chunks);
71 void init_68k_context(m68k_context * context, native_map_slot * native_code_map, void * opts);
72 void m68k_reset(m68k_context * context);
73 void insert_breakpoint(m68k_context * context, uint32_t address, uint8_t * bp_handler);
74 void remove_breakpoint(m68k_context * context, uint32_t address);
75 m68k_context * m68k_handle_code_write(uint32_t address, m68k_context * context);
76 uint32_t get_instruction_start(native_map_slot * native_code_map, uint32_t address);
77
78 #endif //M68K_CORE_H_
79