| 1 | /* FCE Ultra - NES/Famicom Emulator\r |
| 2 | *\r |
| 3 | * Copyright notice for this file:\r |
| 4 | * Copyright (C) 2008 CaH4e3\r |
| 5 | *\r |
| 6 | * This program is free software; you can redistribute it and/or modify\r |
| 7 | * it under the terms of the GNU General Public License as published by\r |
| 8 | * the Free Software Foundation; either version 2 of the License, or\r |
| 9 | * (at your option) any later version.\r |
| 10 | *\r |
| 11 | * This program is distributed in the hope that it will be useful,\r |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of\r |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r |
| 14 | * GNU General Public License for more details.\r |
| 15 | *\r |
| 16 | * You should have received a copy of the GNU General Public License\r |
| 17 | * along with this program; if not, write to the Free Software\r |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r |
| 19 | */\r |
| 20 | \r |
| 21 | // actually cart ID is 811120-C, sorry ;) K-3094 - another ID\r |
| 22 | \r |
| 23 | #include "mapinc.h"\r |
| 24 | #include "mmc3.h"\r |
| 25 | \r |
| 26 | static uint8 reset_flag = 0;\r |
| 27 | \r |
| 28 | static void BMC411120CCW(uint32 A, uint8 V)\r |
| 29 | {\r |
| 30 | setchr1(A,V|((EXPREGS[0]&3)<<7));\r |
| 31 | }\r |
| 32 | \r |
| 33 | static void BMC411120CPW(uint32 A, uint8 V)\r |
| 34 | {\r |
| 35 | if(EXPREGS[0]&(8|reset_flag))\r |
| 36 | setprg32(0x8000,((EXPREGS[0]>>4)&3)|(0x0C));\r |
| 37 | else\r |
| 38 | setprg8(A,(V&0x0F)|((EXPREGS[0]&3)<<4));\r |
| 39 | }\r |
| 40 | \r |
| 41 | static DECLFW(BMC411120CLoWrite)\r |
| 42 | {\r |
| 43 | EXPREGS[0] = A;\r |
| 44 | FixMMC3PRG(MMC3_cmd);\r |
| 45 | FixMMC3CHR(MMC3_cmd);\r |
| 46 | }\r |
| 47 | \r |
| 48 | static void BMC411120CReset(void)\r |
| 49 | {\r |
| 50 | EXPREGS[0]=0;\r |
| 51 | reset_flag ^=4;\r |
| 52 | MMC3RegReset();\r |
| 53 | }\r |
| 54 | \r |
| 55 | static void BMC411120CPower(void)\r |
| 56 | {\r |
| 57 | EXPREGS[0] = 0;\r |
| 58 | GenMMC3Power();\r |
| 59 | SetWriteHandler(0x6000,0x7FFF,BMC411120CLoWrite);\r |
| 60 | }\r |
| 61 | \r |
| 62 | void BMC411120C_Init(CartInfo *info)\r |
| 63 | {\r |
| 64 | GenMMC3_Init(info, 128, 128, 8, 0);\r |
| 65 | pwrap=BMC411120CPW;\r |
| 66 | cwrap=BMC411120CCW;\r |
| 67 | info->Power=BMC411120CPower;\r |
| 68 | info->Reset=BMC411120CReset;\r |
| 69 | AddExState(EXPREGS, 1, 0, "EXPR");\r |
| 70 | }\r |