25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: cpu_m68k_instr.c,v 1.2 2005/09/17 17:14:27 debug Exp $ |
* $Id: cpu_m68k_instr.c,v 1.3 2005/11/06 22:41:12 debug Exp $ |
29 |
* |
* |
30 |
* Motorola 68K instructions. |
* Motorola 68K instructions. |
31 |
* |
* |
32 |
* Individual functions should keep track of cpu->n_translated_instrs. Since |
* Individual functions should keep track of cpu->n_translated_instrs. |
|
* M68K uses variable length instructions, cpu->cd.m68k.next_ic must also be |
|
|
* increased by the number of "instruction slots" that were executed. (I.e. |
|
|
* if an instruction occupying 6 bytes was executed, then next_ic should be |
|
|
* increased by 3.) |
|
|
* |
|
33 |
* (n_translated_instrs is automatically increased by 1 for each function |
* (n_translated_instrs is automatically increased by 1 for each function |
34 |
* call. If no instruction was executed, then it should be decreased. If, say, |
* call. If no instruction was executed, then it should be decreased. If, say, |
35 |
* 4 instructions were combined into one function and executed, then it should |
* 4 instructions were combined into one function and executed, then it should |
42 |
*/ |
*/ |
43 |
X(nop) |
X(nop) |
44 |
{ |
{ |
|
cpu->cd.m68k.next_ic ++; |
|
45 |
} |
} |
46 |
|
|
47 |
|
|
66 |
|
|
67 |
|
|
68 |
/* |
/* |
|
* m68k_combine_instructions(): |
|
|
* |
|
|
* Combine two or more instructions, if possible, into a single function call. |
|
|
*/ |
|
|
void m68k_combine_instructions(struct cpu *cpu, struct m68k_instr_call *ic, |
|
|
uint32_t addr) |
|
|
{ |
|
|
int n_back; |
|
|
n_back = (addr >> 1) & (M68K_IC_ENTRIES_PER_PAGE-1); |
|
|
|
|
|
if (n_back >= 1) { |
|
|
/* TODO */ |
|
|
} |
|
|
|
|
|
/* TODO: Combine forward as well */ |
|
|
} |
|
|
|
|
|
|
|
|
/*****************************************************************************/ |
|
|
|
|
|
|
|
|
/* |
|
69 |
* m68k_instr_to_be_translated(): |
* m68k_instr_to_be_translated(): |
70 |
* |
* |
71 |
* Translate an instruction word into an m68k_instr_call. ic is filled in with |
* Translate an instruction word into an m68k_instr_call. ic is filled in with |
80 |
unsigned char *page; |
unsigned char *page; |
81 |
unsigned char ib[2]; |
unsigned char ib[2]; |
82 |
int main_opcode; |
int main_opcode; |
83 |
void (*samepage_function)(struct cpu *, struct m68k_instr_call *); |
/* void (*samepage_function)(struct cpu *, struct m68k_instr_call *);*/ |
84 |
|
|
85 |
/* Figure out the (virtual) address of the instruction: */ |
/* Figure out the (virtual) address of the instruction: */ |
86 |
low_pc = ((size_t)ic - (size_t)cpu->cd.m68k.cur_ic_page) |
low_pc = ((size_t)ic - (size_t)cpu->cd.m68k.cur_ic_page) |