~ubuntu-branches/debian/wheezy/mame/wheezy

« back to all changes in this revision

Viewing changes to src/mame/drivers/toki.c

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
static WRITE16_HANDLER( tokib_soundcommand16_w )
47
47
{
48
48
        soundlatch_w(space, 0, data & 0xff);
49
 
        cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE);
 
49
        cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
50
50
}
51
51
 
52
52
static READ16_HANDLER( pip16_r )
55
55
}
56
56
 
57
57
 
58
 
static int msm5205next;
59
58
 
60
59
static void toki_adpcm_int (device_t *device)
61
60
{
62
 
        static int toggle = 0;
63
 
 
64
 
        msm5205_data_w (device, msm5205next);
65
 
        msm5205next >>= 4;
66
 
 
67
 
        toggle ^= 1;
68
 
        if (toggle)
69
 
                cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
 
61
        toki_state *state = device->machine().driver_data<toki_state>();
 
62
 
 
63
        msm5205_data_w (device, state->m_msm5205next);
 
64
        state->m_msm5205next >>= 4;
 
65
 
 
66
        state->m_toggle ^= 1;
 
67
        if (state->m_toggle)
 
68
                cputag_set_input_line(device->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
70
69
}
71
70
 
72
71
static WRITE8_DEVICE_HANDLER( toki_adpcm_control_w )
73
72
{
74
73
        int bankaddress;
75
 
        UINT8 *RAM = device->machine->region("audiocpu")->base();
 
74
        UINT8 *RAM = device->machine().region("audiocpu")->base();
76
75
 
77
76
 
78
77
        /* the code writes either 2 or 3 in the bottom two bits */
79
78
        bankaddress = 0x10000 + (data & 0x01) * 0x4000;
80
 
        memory_set_bankptr(device->machine, "bank1",&RAM[bankaddress]);
 
79
        memory_set_bankptr(device->machine(), "bank1",&RAM[bankaddress]);
81
80
 
82
81
        msm5205_reset_w(device,data & 0x08);
83
82
}
84
83
 
85
84
static WRITE8_HANDLER( toki_adpcm_data_w )
86
85
{
87
 
        msm5205next = data;
 
86
        toki_state *state = space->machine().driver_data<toki_state>();
 
87
        state->m_msm5205next = data;
88
88
}
89
89
 
90
90
 
91
91
/*****************************************************************************/
92
92
 
93
 
static ADDRESS_MAP_START( toki_map, ADDRESS_SPACE_PROGRAM, 16 )
 
93
static ADDRESS_MAP_START( toki_map, AS_PROGRAM, 16 )
94
94
        AM_RANGE(0x000000, 0x05ffff) AM_ROM
95
95
        AM_RANGE(0x060000, 0x06d7ff) AM_RAM
96
96
        AM_RANGE(0x06d800, 0x06dfff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
97
97
        AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
98
 
        AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE(&toki_background1_videoram16)
99
 
        AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE(&toki_background2_videoram16)
100
 
        AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE_MEMBER(toki_state, videoram)
 
98
        AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE_MEMBER(toki_state, m_background1_videoram16)
 
99
        AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE_MEMBER(toki_state, m_background2_videoram16)
 
100
        AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE_MEMBER(toki_state, m_videoram)
101
101
        AM_RANGE(0x080000, 0x08000d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
102
 
        AM_RANGE(0x0a0000, 0x0a005f) AM_WRITE(toki_control_w) AM_BASE(&toki_scrollram16)
 
102
        AM_RANGE(0x0a0000, 0x0a005f) AM_WRITE(toki_control_w) AM_BASE_MEMBER(toki_state, m_scrollram16)
103
103
        AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW")
104
104
        AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS")
105
105
        AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM")
106
106
ADDRESS_MAP_END
107
107
 
108
108
/* In the bootleg, sound and sprites are remapped to 0x70000 */
109
 
static ADDRESS_MAP_START( tokib_map, ADDRESS_SPACE_PROGRAM, 16 )
 
109
static ADDRESS_MAP_START( tokib_map, AS_PROGRAM, 16 )
110
110
        AM_RANGE(0x000000, 0x05ffff) AM_ROM
111
111
        AM_RANGE(0x060000, 0x06dfff) AM_RAM
112
112
        AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
113
 
        AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE(&toki_background1_videoram16)
114
 
        AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE(&toki_background2_videoram16)
115
 
        AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE_MEMBER(toki_state, videoram)
 
113
        AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE_MEMBER(toki_state, m_background1_videoram16)
 
114
        AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE_MEMBER(toki_state, m_background2_videoram16)
 
115
        AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE_MEMBER(toki_state, m_videoram)
116
116
        AM_RANGE(0x071000, 0x071001) AM_WRITENOP        /* sprite related? seems another scroll register */
117
117
                                /* gets written the same value as 75000a (bg2 scrollx) */
118
118
        AM_RANGE(0x071804, 0x071807) AM_WRITENOP        /* sprite related, always 01be0100 */
119
119
        AM_RANGE(0x07180e, 0x071e45) AM_WRITEONLY AM_BASE_SIZE_GENERIC(spriteram)
120
120
        AM_RANGE(0x072000, 0x072001) AM_READ(watchdog_reset16_r)   /* probably */
121
121
        AM_RANGE(0x075000, 0x075001) AM_WRITE(tokib_soundcommand16_w)
122
 
        AM_RANGE(0x075004, 0x07500b) AM_WRITEONLY AM_BASE(&toki_scrollram16)
 
122
        AM_RANGE(0x075004, 0x07500b) AM_WRITEONLY AM_BASE_MEMBER(toki_state, m_scrollram16)
123
123
        AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW")
124
124
        AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS")
125
125
        AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM")
130
130
 
131
131
/*****************************************************************************/
132
132
 
133
 
static ADDRESS_MAP_START( tokib_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
 
133
static ADDRESS_MAP_START( tokib_audio_map, AS_PROGRAM, 8 )
134
134
        AM_RANGE(0x0000, 0x7fff) AM_ROM
135
135
        AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
136
136
        AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("msm", toki_adpcm_control_w)       /* MSM5205 + ROM bank */
432
432
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
433
433
        MCFG_SCREEN_SIZE(32*8, 32*8)
434
434
        MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)      /* verified */
 
435
        MCFG_SCREEN_UPDATE(toki)
 
436
        MCFG_SCREEN_EOF(toki)
435
437
 
436
438
        MCFG_GFXDECODE(toki)
437
439
        MCFG_PALETTE_LENGTH(1024)
438
440
 
439
441
        MCFG_VIDEO_START(toki)
440
 
        MCFG_VIDEO_EOF(toki)
441
 
        MCFG_VIDEO_UPDATE(toki)
442
442
 
443
443
        /* sound hardware */
444
444
        SEIBU_SOUND_SYSTEM_YM3812_RAIDEN_INTERFACE(XTAL_14_31818MHz/4,XTAL_12MHz/12) /* verifed on pcb */
463
463
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
464
464
        MCFG_SCREEN_SIZE(32*8, 32*8)
465
465
        MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)      /* verified */
 
466
        MCFG_SCREEN_UPDATE(tokib)
 
467
        MCFG_SCREEN_EOF(tokib)
466
468
 
467
469
        MCFG_GFXDECODE(tokib)
468
470
        MCFG_PALETTE_LENGTH(1024)
469
471
 
470
472
        MCFG_VIDEO_START(toki)
471
 
        MCFG_VIDEO_EOF(tokib)
472
 
        MCFG_VIDEO_UPDATE(tokib)
473
473
 
474
474
        /* sound hardware */
475
475
        MCFG_SPEAKER_STANDARD_MONO("mono")
741
741
 
742
742
static DRIVER_INIT( toki )
743
743
{
744
 
        UINT8 *ROM = machine->region("oki")->base();
 
744
        UINT8 *ROM = machine.region("oki")->base();
745
745
        UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000);
746
746
        int i;
747
747
 
764
764
        UINT8 *rom;
765
765
 
766
766
        /* invert the sprite data in the ROMs */
767
 
        len = machine->region("gfx2")->bytes();
768
 
        rom = machine->region("gfx2")->base();
 
767
        len = machine.region("gfx2")->bytes();
 
768
        rom = machine.region("gfx2")->base();
769
769
        for (i = 0; i < len; i++)
770
770
                rom[i] ^= 0xff;
771
771
 
772
772
        /* merge background tile graphics together */
773
 
        len = machine->region("gfx3")->bytes();
774
 
        rom = machine->region("gfx3")->base();
 
773
        len = machine.region("gfx3")->bytes();
 
774
        rom = machine.region("gfx3")->base();
775
775
        for (offs = 0; offs < len; offs += 0x20000)
776
776
        {
777
777
                UINT8 *base = &rom[offs];
784
784
                        memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800);
785
785
                }
786
786
        }
787
 
        len = machine->region("gfx4")->bytes();
788
 
        rom = machine->region("gfx4")->base();
 
787
        len = machine.region("gfx4")->bytes();
 
788
        rom = machine.region("gfx4")->base();
789
789
        for (offs = 0; offs < len; offs += 0x20000)
790
790
        {
791
791
                UINT8 *base = &rom[offs];
807
807
        /* Program ROMs are bitswapped */
808
808
        {
809
809
                int i;
810
 
                UINT16 *prgrom = (UINT16*)machine->region("maincpu")->base();
 
810
                UINT16 *prgrom = (UINT16*)machine.region("maincpu")->base();
811
811
 
812
812
                for (i = 0; i < 0x60000/2; i++)
813
813
                {
820
820
 
821
821
        /* Decrypt data for z80 program */
822
822
        {
823
 
                address_space *space = cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM);
 
823
                address_space *space = machine.device("audiocpu")->memory().space(AS_PROGRAM);
824
824
                UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x20000);
825
 
                UINT8 *rom = machine->region("audiocpu")->base();
 
825
                UINT8 *rom = machine.region("audiocpu")->base();
826
826
                int i;
827
827
 
828
828
                memcpy(decrypt,rom,0x20000);
837
837
        }
838
838
 
839
839
        {
840
 
                UINT8 *ROM = machine->region("oki")->base();
 
840
                UINT8 *ROM = machine.region("oki")->base();
841
841
                UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000);
842
842
                int i;
843
843