~ubuntu-branches/ubuntu/utopic/fceux/utopic-proposed

« back to all changes in this revision

Viewing changes to src/boards/09-034a.cpp

  • Committer: Package Import Robot
  • Author(s): Joe Nahmias
  • Date: 2014-03-02 19:22:04 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140302192204-9f0aehi5stfnhn7d
Tags: 2.2.2+dfsg0-1
* Imported Upstream version 2.2.2
  + remove patches merged upstream; refresh remaining
  + remove windows compiled help files and non-free Visual C files
* Use C++11 standard static assertion functionality
* fix upstream installation of support files
* New patch 0004-ignore-missing-windows-help-CHM-file.patch
* update d/copyright for new, renamed, deleted files
* d/control: bump std-ver to 3.9.5, no changes needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 *
20
20
 * FDS Conversions
21
21
 *
22
 
 * Super Mario Bros 2 J alt version is a BAD incomplete dump, should be mapper 43
 
22
 * Super Mario Bros 2j (Alt Full) is a BAD incomplete dump, should be mapper 43
23
23
 *
24
24
 * Both Voleyball and Zanac by Whirlind Manu shares the same PCB, but with
25
25
 * some differences: Voleyball has 8K CHR ROM and 8K ROM at 6000K, Zanac
26
26
 * have 8K CHR RAM and banked 16K ROM mapper at 6000 as two 8K banks.
 
27
*
 
28
 * Super Mario Bros 2j (Alt Small) uses additionally IRQ timer to drive framerate
27
29
 *
28
30
 * PCB for this mapper is "09-034A"
29
31
 */
31
33
#include "mapinc.h"
32
34
 
33
35
static uint8 prg;
 
36
static uint32 IRQCount, IRQa;
34
37
 
35
38
static SFORMAT StateRegs[] =
36
39
{
 
40
        { &IRQCount, 4, "IRQC" },
 
41
        { &IRQa, 4, "IRQA" },
37
42
        { &prg, 1, "PRG" },
38
43
        { 0 }
39
44
};
44
49
        setchr8(0);
45
50
}
46
51
 
47
 
static DECLFW(UNLSMB2JWrite) {
 
52
static DECLFW(UNLSMB2JWrite1) {
48
53
        prg = V & 1;
49
54
        Sync();
50
55
}
51
56
 
 
57
static DECLFW(UNLSMB2JWrite2) {
 
58
        IRQa = V & 1;
 
59
        IRQCount = 0;
 
60
        X6502_IRQEnd(FCEU_IQEXT);
 
61
}
 
62
 
 
63
static DECLFR(UNLSMB2JRead) {
 
64
        return 0xFF;
 
65
}
 
66
 
52
67
static void UNLSMB2JPower(void) {
53
68
        prg = 0;
54
69
        Sync();
55
70
        SetReadHandler(0x6000, 0xFFFF, CartBR);
56
 
        SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite);
 
71
        SetReadHandler(0x4042, 0x4055, UNLSMB2JRead);
 
72
        SetWriteHandler(0x4068, 0x4068, UNLSMB2JWrite2);
 
73
        SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite1);
 
74
}
 
75
 
 
76
static void UNLSMB2JIRQHook(int a) {
 
77
        if (IRQa)
 
78
        {
 
79
                if (IRQCount < 5750)    // completely by guess
 
80
                        IRQCount += a;
 
81
                else {
 
82
                        IRQa = 0;
 
83
                        X6502_IRQBegin(FCEU_IQEXT);
 
84
                }
 
85
        }
57
86
}
58
87
 
59
88
static void StateRestore(int version) {
62
91
 
63
92
void UNLSMB2J_Init(CartInfo *info) {
64
93
        info->Power = UNLSMB2JPower;
 
94
        MapIRQHook = UNLSMB2JIRQHook;
65
95
        GameStateRestore = StateRestore;
66
96
        AddExState(&StateRegs, ~0, 0, 0);
67
97
}