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

« back to all changes in this revision

Viewing changes to src/mame/drivers/jack.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:
63
63
}
64
64
 
65
65
 
66
 
static WRITE8_HANDLER( jack_sh_command_w )
 
66
WRITE8_MEMBER(jack_state::jack_sh_command_w)
67
67
{
68
 
        jack_state *state = space->machine().driver_data<jack_state>();
69
 
        soundlatch_w(space, 0, data);
70
 
        device_set_input_line(state->m_audiocpu, 0, HOLD_LINE);
 
68
        soundlatch_byte_w(space, 0, data);
 
69
        device_set_input_line(m_audiocpu, 0, HOLD_LINE);
71
70
}
72
71
 
73
72
 
74
73
/* these handlers are guessed, because otherwise you can't enter test mode */
75
74
 
76
 
static WRITE8_HANDLER( joinem_misc_w )
 
75
WRITE8_MEMBER(jack_state::joinem_misc_w)
77
76
{
78
 
        jack_state *state = space->machine().driver_data<jack_state>();
79
 
        flip_screen_set(space->machine(), data & 0x80);
80
 
        state->m_joinem_snd_bit = data & 1;
 
77
        flip_screen_set(data & 0x80);
 
78
        m_joinem_snd_bit = data & 1;
81
79
}
82
80
 
83
 
static CUSTOM_INPUT( sound_check_r )
 
81
CUSTOM_INPUT_MEMBER(jack_state::sound_check_r)
84
82
{
85
 
        jack_state *state = field.machine().driver_data<jack_state>();
86
83
        UINT8 ret = 0;
87
84
 
88
 
        if ((input_port_read(field.machine(), "IN2") & 0x80) && !state->m_joinem_snd_bit)
 
85
        if ((ioport("IN2")->read() & 0x80) && !m_joinem_snd_bit)
89
86
                ret = 1;
90
87
 
91
88
        return ret;
95
92
    Super Triv questions read handler
96
93
*/
97
94
 
98
 
static READ8_HANDLER( striv_question_r )
 
95
READ8_MEMBER(jack_state::striv_question_r)
99
96
{
100
 
        jack_state *state = space->machine().driver_data<jack_state>();
101
97
 
102
98
        // Set-up the remap table for every 16 bytes
103
99
        if ((offset & 0xc00) == 0x800)
104
100
        {
105
 
                state->m_remap_address[offset & 0x0f] = (offset & 0xf0) >> 4;
 
101
                m_remap_address[offset & 0x0f] = (offset & 0xf0) >> 4;
106
102
        }
107
103
        // Select which rom to read and the high 5 bits of address
108
104
        else if ((offset & 0xc00) == 0xc00)
109
105
        {
110
 
                state->m_question_rom = offset & 7;
111
 
                state->m_question_address = (offset & 0xf8) << 7;
 
106
                m_question_rom = offset & 7;
 
107
                m_question_address = (offset & 0xf8) << 7;
112
108
        }
113
109
        // Read the actual byte from question roms
114
110
        else
115
111
        {
116
 
                UINT8 *ROM = space->machine().region("user1")->base();
 
112
                UINT8 *ROM = memregion("user1")->base();
117
113
                int real_address;
118
114
 
119
 
                real_address = state->m_question_address | (offset & 0x3f0) | state->m_remap_address[offset & 0x0f];
 
115
                real_address = m_question_address | (offset & 0x3f0) | m_remap_address[offset & 0x0f];
120
116
 
121
117
                // Check if it wants to read from the upper 8 roms or not
122
118
                if (offset & 0x400)
123
 
                        real_address |= 0x8000 * (state->m_question_rom + 8);
 
119
                        real_address |= 0x8000 * (m_question_rom + 8);
124
120
                else
125
 
                        real_address |= 0x8000 * state->m_question_rom;
 
121
                        real_address |= 0x8000 * m_question_rom;
126
122
 
127
123
                return ROM[real_address];
128
124
        }
136
132
 *
137
133
 *************************************/
138
134
 
139
 
static ADDRESS_MAP_START( jack_map, AS_PROGRAM, 8 )
 
135
static ADDRESS_MAP_START( jack_map, AS_PROGRAM, 8, jack_state )
140
136
        AM_RANGE(0x0000, 0x3fff) AM_ROM
141
137
        AM_RANGE(0x4000, 0x5fff) AM_RAM
142
 
        AM_RANGE(0xb000, 0xb07f) AM_RAM AM_BASE_SIZE_MEMBER(jack_state, m_spriteram, m_spriteram_size)
 
138
        AM_RANGE(0xb000, 0xb07f) AM_RAM AM_SHARE("spriteram")
143
139
        AM_RANGE(0xb400, 0xb400) AM_WRITE(jack_sh_command_w)
144
140
        AM_RANGE(0xb500, 0xb500) AM_READ_PORT("DSW1")
145
141
        AM_RANGE(0xb501, 0xb501) AM_READ_PORT("DSW2")
148
144
        AM_RANGE(0xb504, 0xb504) AM_READ_PORT("IN2")
149
145
        AM_RANGE(0xb505, 0xb505) AM_READ_PORT("IN3")
150
146
        AM_RANGE(0xb506, 0xb507) AM_READWRITE(jack_flipscreen_r, jack_flipscreen_w)
151
 
        AM_RANGE(0xb600, 0xb61f) AM_WRITE(jack_paletteram_w) AM_BASE_GENERIC(paletteram)
152
 
        AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_BASE_MEMBER(jack_state, m_videoram)
153
 
        AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_BASE_MEMBER(jack_state, m_colorram)
 
147
        AM_RANGE(0xb600, 0xb61f) AM_WRITE(jack_paletteram_w) AM_SHARE("paletteram")
 
148
        AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_SHARE("videoram")
 
149
        AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_SHARE("colorram")
154
150
        AM_RANGE(0xc000, 0xffff) AM_ROM
155
151
ADDRESS_MAP_END
156
152
 
157
 
static ADDRESS_MAP_START( joinem_map, AS_PROGRAM, 8 )
 
153
static ADDRESS_MAP_START( joinem_map, AS_PROGRAM, 8, jack_state )
158
154
        AM_RANGE(0x0000, 0x7fff) AM_ROM
159
155
        AM_RANGE(0x8000, 0x8fff) AM_RAM
160
 
        AM_RANGE(0xb000, 0xb0ff) AM_RAM AM_BASE_SIZE_MEMBER(jack_state, m_spriteram, m_spriteram_size)
 
156
        AM_RANGE(0xb000, 0xb0ff) AM_RAM AM_SHARE("spriteram")
161
157
        AM_RANGE(0xb400, 0xb400) AM_WRITE(jack_sh_command_w)
162
158
        AM_RANGE(0xb500, 0xb500) AM_READ_PORT("DSW1")
163
159
        AM_RANGE(0xb501, 0xb501) AM_READ_PORT("DSW2")
166
162
        AM_RANGE(0xb504, 0xb504) AM_READ_PORT("IN2")
167
163
        AM_RANGE(0xb506, 0xb507) AM_READWRITE(jack_flipscreen_r, jack_flipscreen_w)
168
164
        AM_RANGE(0xb700, 0xb700) AM_WRITE(joinem_misc_w)
169
 
        AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_BASE_MEMBER(jack_state, m_videoram)
170
 
        AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_BASE_MEMBER(jack_state, m_colorram)
 
165
        AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_SHARE("videoram")
 
166
        AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_SHARE("colorram")
171
167
ADDRESS_MAP_END
172
168
 
173
169
 
174
 
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8 )
 
170
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, jack_state )
175
171
        AM_RANGE(0x0000, 0x1fff) AM_ROM
176
172
        AM_RANGE(0x4000, 0x43ff) AM_RAM
177
173
        AM_RANGE(0x6000, 0x6fff) AM_WRITENOP  /* R/C filter ??? */
178
174
ADDRESS_MAP_END
179
175
 
180
 
static ADDRESS_MAP_START( sound_io_map, AS_IO, 8 )
 
176
static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, jack_state )
181
177
        ADDRESS_MAP_GLOBAL_MASK(0xff)
182
 
        AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("aysnd", ay8910_r, ay8910_data_w)
183
 
        AM_RANGE(0x80, 0x80) AM_DEVWRITE("aysnd", ay8910_address_w)
 
178
        AM_RANGE(0x40, 0x40) AM_DEVREADWRITE_LEGACY("aysnd", ay8910_r, ay8910_data_w)
 
179
        AM_RANGE(0x80, 0x80) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
184
180
ADDRESS_MAP_END
185
181
 
186
182
 
577
573
        PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW2:!3" )
578
574
        PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW2:!4" )
579
575
        PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW2:!5" )
580
 
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(sound_check_r, NULL) // sound check
 
576
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, jack_state,sound_check_r, NULL) // sound check
581
577
        PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW2:!7" )
582
578
        PORT_DIPNAME( 0x80, 0x00, "Infinite Lives" )            PORT_DIPLOCATION("SW2:!8")
583
579
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
686
682
        PORT_DIPSETTING(    0x02, "Horizontal" )
687
683
        PORT_DIPSETTING(    0x00, "Vertical" )
688
684
        PORT_DIPNAME( 0x05, 0x05, "Gaming Option Number" )      PORT_DIPLOCATION("SW1:!1,!3")
689
 
        PORT_DIPSETTING(    0x01, "2" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_EQUALS, 0x20)
690
 
        PORT_DIPSETTING(    0x05, "3" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_EQUALS, 0x20)
691
 
        PORT_DIPSETTING(    0x00, "4" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_EQUALS, 0x20)
692
 
        PORT_DIPSETTING(    0x04, "5" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_EQUALS, 0x20)
693
 
        PORT_DIPSETTING(    0x01, "4" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_NOTEQUALS, 0x20)
694
 
        PORT_DIPSETTING(    0x05, "5" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_NOTEQUALS, 0x20)
695
 
        PORT_DIPSETTING(    0x00, "6" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_NOTEQUALS, 0x20)
696
 
        PORT_DIPSETTING(    0x04, "7" ) PORT_CONDITION("DSW1", 0x20, PORTCOND_NOTEQUALS, 0x20)
 
685
        PORT_DIPSETTING(    0x01, "2" ) PORT_CONDITION("DSW1", 0x20, EQUALS, 0x20)
 
686
        PORT_DIPSETTING(    0x05, "3" ) PORT_CONDITION("DSW1", 0x20, EQUALS, 0x20)
 
687
        PORT_DIPSETTING(    0x00, "4" ) PORT_CONDITION("DSW1", 0x20, EQUALS, 0x20)
 
688
        PORT_DIPSETTING(    0x04, "5" ) PORT_CONDITION("DSW1", 0x20, EQUALS, 0x20)
 
689
        PORT_DIPSETTING(    0x01, "4" ) PORT_CONDITION("DSW1", 0x20, NOTEQUALS, 0x20)
 
690
        PORT_DIPSETTING(    0x05, "5" ) PORT_CONDITION("DSW1", 0x20, NOTEQUALS, 0x20)
 
691
        PORT_DIPSETTING(    0x00, "6" ) PORT_CONDITION("DSW1", 0x20, NOTEQUALS, 0x20)
 
692
        PORT_DIPSETTING(    0x04, "7" ) PORT_CONDITION("DSW1", 0x20, NOTEQUALS, 0x20)
697
693
        PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )          PORT_DIPLOCATION("SW1:!4")
698
694
        PORT_DIPSETTING(    0x08, DEF_STR( Upright ) )
699
695
        PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
780
776
{
781
777
        AY8910_LEGACY_OUTPUT,
782
778
        AY8910_DEFAULT_LOADS,
783
 
        DEVCB_MEMORY_HANDLER("audiocpu", PROGRAM, soundlatch_r),
 
779
        DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
784
780
        DEVCB_DEVICE_HANDLER("audiocpu", timer_r)
785
781
};
786
782
 
861
857
static INTERRUPT_GEN( joinem_vblank_irq )
862
858
{
863
859
         /* TODO: looks hackish to me ... */
864
 
        if (!(input_port_read(device->machine(), "IN2") & 0x80))
 
860
        if (!(device->machine().root_device().ioport("IN2")->read() & 0x80))
865
861
                device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
866
862
}
867
863
 
1302
1298
{
1303
1299
        int A;
1304
1300
        address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1305
 
        UINT8 *rom = machine.region("maincpu")->base();
 
1301
        UINT8 *rom = machine.root_device().memregion("maincpu")->base();
1306
1302
        UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x4000);
1307
1303
        int data;
1308
1304
 
1377
1373
       code, the protection device is disabled or changes behaviour via
1378
1374
       writes at 0xf000 and 0xf008. -AS
1379
1375
       */
1380
 
        UINT8 *ROM = machine.region("maincpu")->base();
 
1376
        UINT8 *ROM = state->memregion("maincpu")->base();
1381
1377
        ROM[0x13] = 0x01;
1382
1378
        ROM[0x12] = 0x9d;
1383
1379
 
1388
1384
static DRIVER_INIT( striv )
1389
1385
{
1390
1386
        jack_state *state = machine.driver_data<jack_state>();
1391
 
        UINT8 *ROM = machine.region("maincpu")->base();
 
1387
        UINT8 *ROM = state->memregion("maincpu")->base();
1392
1388
        UINT8 data;
1393
1389
        int A;
1394
1390
 
1415
1411
        }
1416
1412
 
1417
1413
        // Set-up the weirdest questions read ever done
1418
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc000, 0xcfff, FUNC(striv_question_r));
 
1414
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(jack_state::striv_question_r),state));
1419
1415
 
1420
1416
        // Nop out unused sprites writes
1421
1417
        machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xb000, 0xb0ff);