blob: 357a5f738c2ff4ec6c3610d5d9d48a029bfb4b9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "68kinst.h"
#include "m68k_to_x86.h"
#include "mem.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char ** argv)
{
long filesize;
unsigned short *filebuf;
char disbuf[1024];
unsigned short * cur;
x86_68k_options opts;
m68k_context context;
FILE * f = fopen(argv[1], "rb");
fseek(f, 0, SEEK_END);
filesize = ftell(f);
fseek(f, 0, SEEK_SET);
filebuf = malloc(filesize);
fread(filebuf, 2, filesize/2, f);
fclose(f);
for(cur = filebuf; cur - filebuf < (filesize/2); ++cur)
{
*cur = (*cur >> 8) | (*cur << 8);
}
init_x86_68k_opts(&opts);
init_68k_context(&context, opts.native_code_map, &opts);
//cartridge ROM
context.mem_pointers[0] = filebuf;
context.target_cycle = 0x7FFFFFFF;
//work RAM
context.mem_pointers[1] = malloc(64 * 1024);
uint32_t address;
address = filebuf[2] << 16 | filebuf[3];
translate_m68k_stream(address, &context);
m68k_reset(&context);
return 0;
}
|