| 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 2 | * Mupen64plus - interpreter.def * |
| 3 | * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * |
| 4 | * Copyright (C) 2002 Hacktarux * |
| 5 | * * |
| 6 | * This program is free software; you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, write to the * |
| 18 | * Free Software Foundation, Inc., * |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
| 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 21 | |
| 22 | /* Before #including this file, the following macros should be defined: |
| 23 | * |
| 24 | * PCADDR: Program counter (memory address of the current instruction). |
| 25 | * |
| 26 | * ADD_TO_PC(x): Increment the program counter in 'x' instructions. |
| 27 | * This is only used for small changes to PC, so the new program counter |
| 28 | * is guaranteed to fall in the current cached interpreter or dynarec block. |
| 29 | * |
| 30 | * DECLARE_INSTRUCTION(name) |
| 31 | * Declares an instruction function which is not a jump. |
| 32 | * Followed by a block of code. |
| 33 | * |
| 34 | * DECLARE_JUMP(name, destination, condition, link, likely, cop1) |
| 35 | * name is the name of the jump or branch instruction. |
| 36 | * destination is the destination memory address of the jump. |
| 37 | * If condition is nonzero, the jump is taken. |
| 38 | * link is a pointer to a variable where (PC+8) is written unconditionally. |
| 39 | * To avoid linking, pass ®[0] |
| 40 | * If likely is nonzero, the delay slot is only executed if the jump is taken. |
| 41 | * If cop1 is nonzero, a COP1 unusable check will be done. |
| 42 | * |
| 43 | * CHECK_MEMORY(): A snippet to be run after a store instruction, |
| 44 | * to check if the store affected executable blocks. |
| 45 | * The memory address of the store is in the 'address' global. |
| 46 | */ |
| 47 | |
| 48 | DECLARE_INSTRUCTION(NI) |
| 49 | { |
| 50 | DebugMessage(M64MSG_ERROR, "NI() @ 0x%x", PCADDR); |
| 51 | DebugMessage(M64MSG_ERROR, "opcode not implemented: %x:%x", PCADDR, *fast_mem_access(PCADDR)); |
| 52 | stop=1; |
| 53 | } |
| 54 | |
| 55 | DECLARE_INSTRUCTION(RESERVED) |
| 56 | { |
| 57 | DebugMessage(M64MSG_ERROR, "reserved opcode: %x:%x", PCADDR, *fast_mem_access(PCADDR)); |
| 58 | stop=1; |
| 59 | } |
| 60 | |
| 61 | // R4300 |
| 62 | #include "interpreter_r4300.def" |
| 63 | |
| 64 | // COP0 |
| 65 | #include "interpreter_cop0.def" |
| 66 | |
| 67 | // COP1 |
| 68 | #include "interpreter_cop1.def" |
| 69 | |
| 70 | // regimm |
| 71 | #include "interpreter_regimm.def" |
| 72 | |
| 73 | // special |
| 74 | #include "interpreter_special.def" |
| 75 | |
| 76 | // TLB |
| 77 | #include "interpreter_tlb.def" |
| 78 | |
| 79 | |