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

« back to all changes in this revision

Viewing changes to src/mame/drivers/arcadia.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:
55
55
#include "machine/amigafdc.h"
56
56
 
57
57
 
58
 
 
59
 
class arcadia_state : public amiga_state
 
58
// arcadia_state was also defined in mess/includes/arcadia.h
 
59
class arcadia_amiga_state : public amiga_state
60
60
{
61
61
public:
62
 
        arcadia_state(const machine_config &mconfig, device_type type, const char *tag)
 
62
        arcadia_amiga_state(const machine_config &mconfig, device_type type, const char *tag)
63
63
                : amiga_state(mconfig, type, tag) { }
64
64
 
65
65
        UINT8 coin_counter[2];
 
66
        DECLARE_WRITE16_MEMBER(arcadia_multibios_change_game);
 
67
        DECLARE_CUSTOM_INPUT_MEMBER(coin_counter_r);
 
68
        DECLARE_INPUT_CHANGED_MEMBER(coin_changed_callback);
66
69
};
67
70
 
68
71
 
73
76
 *
74
77
 *************************************/
75
78
 
76
 
static WRITE16_HANDLER( arcadia_multibios_change_game )
 
79
WRITE16_MEMBER(arcadia_amiga_state::arcadia_multibios_change_game)
77
80
{
78
81
        if (data == 0)
79
 
                space->install_read_bank(0x800000, 0x97ffff, "bank2");
 
82
                space.install_read_bank(0x800000, 0x97ffff, "bank2");
80
83
        else
81
 
                space->nop_read(0x800000, 0x97ffff);
 
84
                space.nop_read(0x800000, 0x97ffff);
82
85
}
83
86
 
84
87
 
101
104
static WRITE8_DEVICE_HANDLER( arcadia_cia_0_porta_w )
102
105
{
103
106
        /* switch banks as appropriate */
104
 
        memory_set_bank(device->machine(), "bank1", data & 1);
 
107
        device->machine().root_device().membank("bank1")->set_entry(data & 1);
105
108
 
106
109
        /* swap the write handlers between ROM and bank 1 based on the bit */
107
110
        if ((data & 1) == 0)
138
141
        /* writing a 0 in the low bit clears one of the coins */
139
142
        if ((data & 1) == 0)
140
143
        {
141
 
                UINT8 *coin_counter = device->machine().driver_data<arcadia_state>()->coin_counter;
 
144
                UINT8 *coin_counter = device->machine().driver_data<arcadia_amiga_state>()->coin_counter;
142
145
 
143
146
                if (coin_counter[0] > 0)
144
147
                        coin_counter[0]--;
155
158
 *
156
159
 *************************************/
157
160
 
158
 
static CUSTOM_INPUT( coin_counter_r )
 
161
CUSTOM_INPUT_MEMBER(arcadia_amiga_state::coin_counter_r)
159
162
{
160
163
        int coin = (FPTR)param;
161
 
        UINT8 *coin_counter = field.machine().driver_data<arcadia_state>()->coin_counter;
162
164
 
163
165
        /* return coin counter values */
164
166
        return coin_counter[coin] & 3;
165
167
}
166
168
 
167
169
 
168
 
static INPUT_CHANGED( coin_changed_callback )
 
170
INPUT_CHANGED_MEMBER(arcadia_amiga_state::coin_changed_callback)
169
171
{
170
172
        int coin = (FPTR)param;
171
 
        UINT8 *coin_counter = field.machine().driver_data<arcadia_state>()->coin_counter;
172
173
 
173
174
        /* check for a 0 -> 1 transition */
174
175
        if (!oldval && newval && coin_counter[coin] < 3)
178
179
 
179
180
static void arcadia_reset_coins(running_machine &machine)
180
181
{
181
 
        UINT8 *coin_counter = machine.driver_data<arcadia_state>()->coin_counter;
 
182
        UINT8 *coin_counter = machine.driver_data<arcadia_amiga_state>()->coin_counter;
182
183
 
183
184
        /* reset coin counters */
184
185
        coin_counter[0] = coin_counter[1] = 0;
192
193
 *
193
194
 *************************************/
194
195
 
195
 
static ADDRESS_MAP_START( amiga_map, AS_PROGRAM, 16 )
 
196
static ADDRESS_MAP_START( amiga_map, AS_PROGRAM, 16, arcadia_amiga_state )
196
197
        ADDRESS_MAP_UNMAP_HIGH
197
 
        AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_BASE_SIZE_MEMBER(arcadia_state, m_chip_ram, m_chip_ram_size)
198
 
        AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w)
199
 
        AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_BASE_MEMBER(arcadia_state, m_custom_regs)
200
 
        AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w)
 
198
        AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram")
 
199
        AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE_LEGACY(amiga_cia_r, amiga_cia_w)
 
200
        AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE_LEGACY(amiga_custom_r, amiga_custom_w) AM_SHARE("custom_regs")
 
201
        AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE_LEGACY(amiga_autoconfig_r, amiga_autoconfig_w)
201
202
        AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("user1", 0)               /* Kickstart BIOS */
202
203
 
203
204
        AM_RANGE(0x800000, 0x97ffff) AM_ROMBANK("bank2") AM_REGION("user3", 0)
228
229
        PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
229
230
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
230
231
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
231
 
        PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_counter_r, 0)
232
 
        PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_counter_r, 1)
 
232
        PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,coin_counter_r, 0)
 
233
        PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,coin_counter_r, 1)
233
234
 
234
235
        PORT_START("JOY0DAT")
235
 
        PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P1JOY")
 
236
        PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,amiga_joystick_convert, "P1JOY")
236
237
        PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
237
238
 
238
239
        PORT_START("JOY1DAT")
239
 
        PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P2JOY")
 
240
        PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,amiga_joystick_convert, "P2JOY")
240
241
        PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
241
242
 
242
243
        PORT_START("POTGO")
259
260
        PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
260
261
 
261
262
        PORT_START("COINS")
262
 
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_changed_callback, 0)
263
 
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(coin_changed_callback, 1)
 
263
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, arcadia_amiga_state,coin_changed_callback, 0)
 
264
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, arcadia_amiga_state,coin_changed_callback, 1)
264
265
INPUT_PORTS_END
265
266
 
266
267
 
297
298
        DEVCB_NULL
298
299
};
299
300
 
300
 
static MACHINE_CONFIG_START( arcadia, arcadia_state )
 
301
static MACHINE_CONFIG_START( arcadia, arcadia_amiga_state )
301
302
 
302
303
        /* basic machine hardware */
303
304
        MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK)
756
757
 
757
758
INLINE void generic_decode(running_machine &machine, const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0)
758
759
{
759
 
        UINT16 *rom = (UINT16 *)machine.region(tag)->base();
 
760
        UINT16 *rom = (UINT16 *)machine.root_device().memregion(tag)->base();
760
761
        int i;
761
762
 
762
763
        /* only the low byte of ROMs are encrypted in these games */
765
766
 
766
767
        #if 0
767
768
        {
768
 
                UINT8 *ROM = machine.region(tag)->base();
769
 
                int size = machine.region(tag)->bytes();
 
769
                UINT8 *ROM = machine.root_device().memregion(tag)->base();
 
770
                int size = machine.root_device().memregion(tag)->bytes();
770
771
 
771
772
                FILE *fp;
772
773
                char filename[256];
791
792
 
792
793
static void arcadia_init(running_machine &machine)
793
794
{
794
 
        arcadia_state *state = machine.driver_data<arcadia_state>();
 
795
        arcadia_amiga_state *state = machine.driver_data<arcadia_amiga_state>();
795
796
        static const amiga_machine_interface arcadia_intf =
796
797
        {
797
798
                ANGUS_CHIP_RAM_MASK,
807
808
        amiga_machine_config(machine, &arcadia_intf);
808
809
 
809
810
        /* set up memory */
810
 
        memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
811
 
        memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
 
811
        state->membank("bank1")->configure_entry(0, state->m_chip_ram);
 
812
        state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
812
813
 
813
814
        /* OnePlay bios is encrypted, TenPlay is not */
814
 
        biosrom = (UINT16 *)machine.region("user2")->base();
 
815
        biosrom = (UINT16 *)machine.root_device().memregion("user2")->base();
815
816
        if (biosrom[0] != 0x4afc)
816
817
                generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7);
817
818
}
849
850
 
850
851
 
851
852
GAME( 1988, ar_airh,    ar_bios, arcadia, arcadia, airh,  ROT0, "Arcadia Systems", "SportTime Table Hockey (Arcadia, set 1, V 2.1)", 0 )
852
 
GAME( 1988, ar_airh2,   ar_bios, arcadia, arcadia, airh,  ROT0, "Arcadia Systems", "SportTime Table Hockey (Arcadia, set 2)", 0 )
 
853
GAME( 1988, ar_airh2,   ar_airh, arcadia, arcadia, airh,  ROT0, "Arcadia Systems", "SportTime Table Hockey (Arcadia, set 2)", 0 )
853
854
 
854
855
GAME( 1988, ar_bowl,    ar_bios, arcadia, arcadia, bowl,  ROT0, "Arcadia Systems", "SportTime Bowling (Arcadia, V 2.1)", 0 )
855
856