map087.c
1 /* 2 ** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) 3 ** 4 ** 5 ** This program is free software; you can redistribute it and/or 6 ** modify it under the terms of version 2 of the GNU Library General 7 ** Public License as published by the Free Software Foundation. 8 ** 9 ** This program is distributed in the hope that it will be useful, 10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 ** Library General Public License for more details. To obtain a 13 ** copy of the GNU Library General Public License, write to the Free 14 ** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 15 ** 16 ** Any permitted reproduction of these routines, in whole or in part, 17 ** must bear this legend. 18 ** 19 ** 20 ** map087.c 21 ** 22 ** Mapper #87 (16K VROM switch) 23 ** Implementation by Firebug 24 ** $Id: map087.c,v 1.2 2001/04/27 14:37:11 neil Exp $ 25 ** 26 */ 27 28 #include "noftypes.h" 29 #include "nes_mmc.h" 30 #include "nes.h" 31 #include "libsnss.h" 32 #include "log.h" 33 34 /******************************************/ 35 /* Mapper #87 write handler ($6000-$7FFF) */ 36 /******************************************/ 37 static void map87_write (uint32 address, uint8 value) 38 { 39 /* Within range, address written to is irrelevant */ 40 UNUSED (address); 41 42 /* Very simple: 8K CHR page is selected by D1 */ 43 if (value & 0x02) mmc_bankvrom (8, 0x0000, 0x01); 44 else mmc_bankvrom (8, 0x0000, 0x00); 45 46 /* Done */ 47 return; 48 } 49 50 static const map_memwrite map87_memwrite [] = 51 { 52 { 0x6000, 0x7FFF, map87_write }, 53 { -1, -1, NULL } 54 }; 55 56 const mapintf_t map87_intf = 57 { 58 87, /* Mapper number */ 59 "16K VROM switch", /* Mapper name */ 60 NULL, /* Initialization routine */ 61 NULL, /* VBlank callback */ 62 NULL, /* HBlank callback */ 63 NULL, /* Get state (SNSS) */ 64 NULL, /* Set state (SNSS) */ 65 NULL, /* Memory read structure */ 66 map87_memwrite, /* Memory write structure */ 67 NULL /* External sound device */ 68 }; 69 70 /* 71 ** $Log: map087.c,v $ 72 ** Revision 1.2 2001/04/27 14:37:11 neil 73 ** wheeee 74 ** 75 ** Revision 1.1 2001/04/27 12:54:40 neil 76 ** blah 77 ** 78 ** Revision 1.1 2001/04/27 10:57:41 neil 79 ** wheee 80 ** 81 ** Revision 1.1 2000/12/30 06:34:44 firebug 82 ** Initial revision 83 ** 84 ** 85 */