map078.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 ** map78.c 21 ** 22 ** mapper 78 interface 23 ** $Id: map078.c,v 1.2 2001/04/27 14:37:11 neil Exp $ 24 */ 25 26 #include "noftypes.h" 27 #include "nes_mmc.h" 28 #include "nes_ppu.h" 29 30 /* mapper 78: Holy Diver, Cosmo Carrier */ 31 /* ($8000-$FFFF) D2-D0 = switch $8000-$BFFF */ 32 /* ($8000-$FFFF) D7-D4 = switch PPU $0000-$1FFF */ 33 /* ($8000-$FFFF) D3 = switch mirroring */ 34 static void map78_write(uint32 address, uint8 value) 35 { 36 UNUSED(address); 37 38 mmc_bankrom(16, 0x8000, value & 7); 39 mmc_bankvrom(8, 0x0000, (value >> 4) & 0x0F); 40 41 /* Ugh! Same abuse of the 4-screen bit as with Mapper #70 */ 42 if (mmc_getinfo()->flags & ROM_FLAG_FOURSCREEN) 43 { 44 if (value & 0x08) 45 ppu_mirror(0, 1, 0, 1); /* vert */ 46 else 47 ppu_mirror(0, 0, 1, 1); /* horiz */ 48 } 49 else 50 { 51 int mirror = (value >> 3) & 1; 52 ppu_mirror(mirror, mirror, mirror, mirror); 53 } 54 } 55 56 static const map_memwrite map78_memwrite[] = 57 { 58 { 0x8000, 0xFFFF, map78_write }, 59 { -1, -1, NULL } 60 }; 61 62 const mapintf_t map78_intf = 63 { 64 78, /* mapper number */ 65 "Mapper 78", /* mapper name */ 66 NULL, /* init routine */ 67 NULL, /* vblank callback */ 68 NULL, /* hblank callback */ 69 NULL, /* get state (snss) */ 70 NULL, /* set state (snss) */ 71 NULL, /* memory read structure */ 72 map78_memwrite, /* memory write structure */ 73 NULL /* external sound device */ 74 }; 75 76 /* 77 ** $Log: map078.c,v $ 78 ** Revision 1.2 2001/04/27 14:37:11 neil 79 ** wheeee 80 ** 81 ** Revision 1.1 2001/04/27 12:54:40 neil 82 ** blah 83 ** 84 ** Revision 1.1.1.1 2001/04/27 07:03:54 neil 85 ** initial 86 ** 87 ** Revision 1.1 2000/10/24 12:19:33 matt 88 ** changed directory structure 89 ** 90 ** Revision 1.7 2000/10/22 19:17:46 matt 91 ** mapper cleanups galore 92 ** 93 ** Revision 1.6 2000/10/22 15:03:14 matt 94 ** simplified mirroring 95 ** 96 ** Revision 1.5 2000/10/21 19:33:38 matt 97 ** many more cleanups 98 ** 99 ** Revision 1.4 2000/08/16 02:50:11 matt 100 ** random mapper cleanups 101 ** 102 ** Revision 1.3 2000/07/10 05:29:03 matt 103 ** cleaned up some mirroring issues 104 ** 105 ** Revision 1.2 2000/07/06 02:48:43 matt 106 ** clearly labelled structure members 107 ** 108 ** Revision 1.1 2000/07/06 01:01:56 matt 109 ** initial revision 110 ** 111 */