~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include "includes/aquarium.h"
43
43
 
44
44
 
45
 
static READ16_HANDLER( aquarium_coins_r )
 
45
READ16_MEMBER(aquarium_state::aquarium_coins_r)
46
46
{
47
 
        aquarium_state *state = space->machine().driver_data<aquarium_state>();
48
47
 
49
48
        int data;
50
 
        data = (input_port_read(space->machine(), "SYSTEM") & 0x7fff);
51
 
        data |= state->m_aquarium_snd_ack;
52
 
        state->m_aquarium_snd_ack = 0;
 
49
        data = (ioport("SYSTEM")->read() & 0x7fff);
 
50
        data |= m_aquarium_snd_ack;
 
51
        m_aquarium_snd_ack = 0;
53
52
 
54
53
        return data;
55
54
}
56
55
 
57
 
static WRITE8_HANDLER( aquarium_snd_ack_w )
 
56
WRITE8_MEMBER(aquarium_state::aquarium_snd_ack_w)
58
57
{
59
 
        aquarium_state *state = space->machine().driver_data<aquarium_state>();
60
 
        state->m_aquarium_snd_ack = 0x8000;
 
58
        m_aquarium_snd_ack = 0x8000;
61
59
}
62
60
 
63
 
static WRITE16_HANDLER( aquarium_sound_w )
 
61
WRITE16_MEMBER(aquarium_state::aquarium_sound_w)
64
62
{
65
63
//  popmessage("sound write %04x",data);
66
 
        aquarium_state *state = space->machine().driver_data<aquarium_state>();
67
64
 
68
 
        soundlatch_w(space, 1, data & 0xff);
69
 
        device_set_input_line(state->m_audiocpu, INPUT_LINE_NMI, PULSE_LINE );
 
65
        soundlatch_byte_w(space, 1, data & 0xff);
 
66
        device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE );
70
67
}
71
68
 
72
 
static WRITE8_HANDLER( aquarium_z80_bank_w )
 
69
WRITE8_MEMBER(aquarium_state::aquarium_z80_bank_w)
73
70
{
74
 
        memory_set_bank(space->machine(), "bank1", data & 0x07);
 
71
        membank("bank1")->set_entry(data & 0x07);
75
72
}
76
73
 
77
74
static UINT8 aquarium_snd_bitswap( UINT8 scrambled_data )
90
87
        return data;
91
88
}
92
89
 
93
 
static READ8_HANDLER( aquarium_oki_r )
94
 
{
95
 
        okim6295_device *oki = space->machine().device<okim6295_device>("oki");
96
 
        return aquarium_snd_bitswap(oki->read(*space, offset));
97
 
}
98
 
 
99
 
static WRITE8_HANDLER( aquarium_oki_w )
100
 
{
101
 
        logerror("%s:Writing %04x to the OKI M6295\n", space->machine().describe_context(), aquarium_snd_bitswap(data));
102
 
        okim6295_device *oki = space->machine().device<okim6295_device>("oki");
103
 
        oki->write(*space, offset, (aquarium_snd_bitswap(data)));
104
 
}
105
 
 
106
 
 
107
 
 
108
 
 
109
 
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16 )
 
90
READ8_MEMBER(aquarium_state::aquarium_oki_r)
 
91
{
 
92
        okim6295_device *oki = machine().device<okim6295_device>("oki");
 
93
        return aquarium_snd_bitswap(oki->read(space, offset));
 
94
}
 
95
 
 
96
WRITE8_MEMBER(aquarium_state::aquarium_oki_w)
 
97
{
 
98
        logerror("%s:Writing %04x to the OKI M6295\n", machine().describe_context(), aquarium_snd_bitswap(data));
 
99
        okim6295_device *oki = machine().device<okim6295_device>("oki");
 
100
        oki->write(space, offset, (aquarium_snd_bitswap(data)));
 
101
}
 
102
 
 
103
 
 
104
 
 
105
 
 
106
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, aquarium_state )
110
107
        AM_RANGE(0x000000, 0x07ffff) AM_ROM
111
 
        AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(aquarium_mid_videoram_w) AM_BASE_MEMBER(aquarium_state, m_mid_videoram)
112
 
        AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(aquarium_bak_videoram_w) AM_BASE_MEMBER(aquarium_state, m_bak_videoram)
113
 
        AM_RANGE(0xc02000, 0xc03fff) AM_RAM_WRITE(aquarium_txt_videoram_w) AM_BASE_MEMBER(aquarium_state, m_txt_videoram)
114
 
        AM_RANGE(0xc80000, 0xc81fff) AM_RAM AM_BASE_SIZE_MEMBER(aquarium_state, m_spriteram, m_spriteram_size)
115
 
        AM_RANGE(0xd00000, 0xd00fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE_GENERIC(paletteram)
116
 
        AM_RANGE(0xd80014, 0xd8001f) AM_WRITEONLY AM_BASE_MEMBER(aquarium_state, m_scroll)
 
108
        AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(aquarium_mid_videoram_w) AM_SHARE("mid_videoram")
 
109
        AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(aquarium_bak_videoram_w) AM_SHARE("bak_videoram")
 
110
        AM_RANGE(0xc02000, 0xc03fff) AM_RAM_WRITE(aquarium_txt_videoram_w) AM_SHARE("txt_videoram")
 
111
        AM_RANGE(0xc80000, 0xc81fff) AM_RAM AM_SHARE("spriteram")
 
112
        AM_RANGE(0xd00000, 0xd00fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
 
113
        AM_RANGE(0xd80014, 0xd8001f) AM_WRITEONLY AM_SHARE("scroll")
117
114
        AM_RANGE(0xd80068, 0xd80069) AM_WRITENOP                /* probably not used */
118
115
        AM_RANGE(0xd80080, 0xd80081) AM_READ_PORT("DSW")
119
116
        AM_RANGE(0xd80082, 0xd80083) AM_READNOP /* stored but not read back ? check code at 0x01f440 */
124
121
        AM_RANGE(0xff0000, 0xffffff) AM_RAM
125
122
ADDRESS_MAP_END
126
123
 
127
 
static ADDRESS_MAP_START( snd_map, AS_PROGRAM, 8 )
 
124
static ADDRESS_MAP_START( snd_map, AS_PROGRAM, 8, aquarium_state )
128
125
        AM_RANGE(0x0000, 0x3fff) AM_ROM
129
126
        AM_RANGE(0x7800, 0x7fff) AM_RAM
130
127
        AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")
131
128
ADDRESS_MAP_END
132
129
 
133
 
static ADDRESS_MAP_START( snd_portmap, AS_IO, 8 )
 
130
static ADDRESS_MAP_START( snd_portmap, AS_IO, 8, aquarium_state )
134
131
        ADDRESS_MAP_GLOBAL_MASK(0xff)
135
 
        AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w)
 
132
        AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
136
133
        AM_RANGE(0x02, 0x02) AM_READWRITE(aquarium_oki_r, aquarium_oki_w)
137
 
        AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
 
134
        AM_RANGE(0x04, 0x04) AM_READ(soundlatch_byte_r)
138
135
        AM_RANGE(0x06, 0x06) AM_WRITE(aquarium_snd_ack_w)
139
136
        AM_RANGE(0x08, 0x08) AM_WRITE(aquarium_z80_bank_w)
140
137
ADDRESS_MAP_END
242
239
 
243
240
static DRIVER_INIT( aquarium )
244
241
{
245
 
        UINT8 *Z80 = machine.region("audiocpu")->base();
 
242
        UINT8 *Z80 = machine.root_device().memregion("audiocpu")->base();
246
243
 
247
244
        /* The BG tiles are 5bpp, this rearranges the data from
248
245
       the roms containing the 1bpp data so we can decode it
249
246
       correctly */
250
 
        UINT8 *DAT2 = machine.region("gfx1")->base() + 0x080000;
251
 
        UINT8 *DAT = machine.region("user1")->base();
 
247
        UINT8 *DAT2 = machine.root_device().memregion("gfx1")->base() + 0x080000;
 
248
        UINT8 *DAT = machine.root_device().memregion("user1")->base();
252
249
        int len = 0x0200000;
253
250
 
254
251
        for (len = 0; len < 0x020000; len++)
263
260
                DAT2[len * 4 + 2] |= (DAT[len] & 0x01) << 3;
264
261
        }
265
262
 
266
 
        DAT2 = machine.region("gfx4")->base() + 0x080000;
267
 
        DAT = machine.region("user2")->base();
 
263
        DAT2 = machine.root_device().memregion("gfx4")->base() + 0x080000;
 
264
        DAT = machine.root_device().memregion("user2")->base();
268
265
 
269
266
        for (len = 0; len < 0x020000; len++)
270
267
        {
279
276
        }
280
277
 
281
278
        /* configure and set up the sound bank */
282
 
        memory_configure_bank(machine, "bank1", 0, 7, &Z80[0x18000], 0x8000);
283
 
        memory_set_bank(machine, "bank1", 1);
 
279
        machine.root_device().membank("bank1")->configure_entries(0, 7, &Z80[0x18000], 0x8000);
 
280
        machine.root_device().membank("bank1")->set_entry(1);
284
281
}
285
282
 
286
283
 
299
296
 
300
297
static const ym2151_interface ym2151_config =
301
298
{
302
 
        irq_handler
 
299
        DEVCB_LINE(irq_handler)
303
300
};
304
301
 
305
302