comparison m68k_to_x86.h @ 18:3e7bfde7606e

M68K to x86 translation works for a limited subset of instructions and addressing modes
author Mike Pavone <pavone@retrodev.com>
date Tue, 04 Dec 2012 19:13:12 -0800
parents 2bdad0f52f42
children 3b79cbcf6846
comparison
equal deleted inserted replaced
17:de0085d4ea40 18:3e7bfde7606e
1 #include <stdint.h> 1 #include <stdint.h>
2 #include "68kinst.h"
3
4 #define NUM_MEM_AREAS 4
5 #define NATIVE_MAP_CHUNKS (32*1024)
6 #define NATIVE_CHUNK_SIZE ((16 * 1024 * 1024 / NATIVE_MAP_CHUNKS)/2)
7 #define INVALID_OFFSET 0xFFFF
2 8
3 typedef struct { 9 typedef struct {
4 uint32_t flags; 10 uint8_t *base;
5 int8_t dregs[8]; 11 uint16_t *offsets;
6 int8_t aregs[8]; 12 } native_map_slot;
13
14 typedef struct deferred_addr {
15 struct deferred_addr *next;
16 uint8_t *dest;
17 uint32_t address;
18 } deferred_addr;
19
20 typedef struct {
21 uint32_t flags;
22 int8_t dregs[8];
23 int8_t aregs[8];
24 native_map_slot *native_code_map;
25 deferred_addr *deferred;
26
7 } x86_68k_options; 27 } x86_68k_options;
8 28
9 typedef struct { 29 typedef struct {
10 uint8_t flags[5]; 30 uint8_t flags[5];
11 uint8_t status; 31 uint8_t status;
12 uint16_t reserved; 32 uint16_t reserved;
13 uint32_t dregs[8]; 33 uint32_t dregs[8];
14 uint32_t aregs[8]; 34 uint32_t aregs[8];
35 uint32_t target_cycle;
36 uint32_t current_cycle;
37 uint16_t *mem_pointers[NUM_MEM_AREAS];
38 native_map_slot *native_code_map;
39 void *options;
15 } m68k_context; 40 } m68k_context;
16 41
42 uint8_t * translate_m68k(uint8_t * dst, m68kinst * inst, x86_68k_options * opts);
43 uint8_t * translate_m68k_stream(uint8_t * dst, uint8_t * dst_end, uint32_t address, m68k_context * context);
44 void start_68k_context(m68k_context * context, uint32_t address);
45 void init_x86_68k_opts(x86_68k_options * opts);
46 void init_68k_context(m68k_context * context, native_map_slot * native_code_map, void * opts);