42
42
cputag_set_input_line(device->machine(), "maincpu", drvstate->m_irq_line, state ? CLEAR_LINE : ASSERT_LINE);
45
WRITE8_HANDLER( galaxold_nmi_enable_w )
45
WRITE8_MEMBER(galaxold_state::galaxold_nmi_enable_w)
47
ttl7474_device *target = space->machine().device<ttl7474_device>("7474_9m_1");
47
ttl7474_device *target = machine().device<ttl7474_device>("7474_9m_1");
48
48
target->preset_w(data ? 1 : 0);
101
101
device_set_irq_callback(machine.device("maincpu"), hunchbkg_irq_callback);
104
WRITE8_HANDLER( galaxold_coin_lockout_w )
106
coin_lockout_global_w(space->machine(), ~data & 1);
110
WRITE8_HANDLER( galaxold_coin_counter_w )
112
coin_counter_w(space->machine(), offset, data & 0x01);
115
WRITE8_HANDLER( galaxold_coin_counter_1_w )
117
coin_counter_w(space->machine(), 1, data & 0x01);
120
WRITE8_HANDLER( galaxold_coin_counter_2_w )
122
coin_counter_w(space->machine(), 2, data & 0x01);
126
WRITE8_HANDLER( galaxold_leds_w )
128
set_led_status(space->machine(), offset,data & 1);
104
WRITE8_MEMBER(galaxold_state::galaxold_coin_lockout_w)
106
coin_lockout_global_w(machine(), ~data & 1);
110
WRITE8_MEMBER(galaxold_state::galaxold_coin_counter_w)
112
coin_counter_w(machine(), offset, data & 0x01);
115
WRITE8_MEMBER(galaxold_state::galaxold_coin_counter_1_w)
117
coin_counter_w(machine(), 1, data & 0x01);
120
WRITE8_MEMBER(galaxold_state::galaxold_coin_counter_2_w)
122
coin_counter_w(machine(), 2, data & 0x01);
126
WRITE8_MEMBER(galaxold_state::galaxold_leds_w)
128
set_led_status(machine(), offset,data & 1);
132
132
#ifdef UNUSED_FUNCTION
133
static READ8_HANDLER( checkmaj_protection_r )
133
READ8_MEMBER(galaxold_state::checkmaj_protection_r)
135
switch (cpu_get_pc(&space->device()))
135
switch (cpu_get_pc(&space.device()))
137
137
case 0x0f15: return 0xf5;
138
138
case 0x0f8f: return 0x7c;
141
141
case 0x10f1: return 0xaa;
142
142
case 0x1402: return 0xaa;
144
logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space->device()));
144
logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space.device()));
151
151
/* Zig Zag can swap ROMs 2 and 3 as a form of copy protection */
152
WRITE8_HANDLER( zigzag_sillyprotection_w )
152
WRITE8_MEMBER(galaxold_state::zigzag_sillyprotection_w)
156
156
/* swap ROM 2 and 3! */
157
memory_set_bank(space->machine(), "bank1", 1);
158
memory_set_bank(space->machine(), "bank2", 0);
157
membank("bank1")->set_entry(1);
158
membank("bank2")->set_entry(0);
162
memory_set_bank(space->machine(), "bank1", 0);
163
memory_set_bank(space->machine(), "bank2", 1);
162
membank("bank1")->set_entry(0);
163
membank("bank2")->set_entry(1);
167
167
DRIVER_INIT( zigzag )
169
UINT8 *RAM = machine.region("maincpu")->base();
170
memory_configure_bank(machine, "bank1", 0, 2, &RAM[0x2000], 0x1000);
171
memory_configure_bank(machine, "bank2", 0, 2, &RAM[0x2000], 0x1000);
172
memory_set_bank(machine, "bank1", 0);
173
memory_set_bank(machine, "bank2", 1);
169
UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
170
machine.root_device().membank("bank1")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
171
machine.root_device().membank("bank2")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
172
machine.root_device().membank("bank1")->set_entry(0);
173
machine.root_device().membank("bank2")->set_entry(1);
178
static READ8_HANDLER( dingo_3000_r )
178
READ8_MEMBER(galaxold_state::dingo_3000_r)
183
static READ8_HANDLER( dingo_3035_r )
183
READ8_MEMBER(galaxold_state::dingo_3035_r)
188
static READ8_HANDLER( dingoe_3001_r )
188
READ8_MEMBER(galaxold_state::dingoe_3001_r)
226
READ8_HANDLER( scramblb_protection_1_r )
226
READ8_MEMBER(galaxold_state::scramblb_protection_1_r)
228
switch (cpu_get_pc(&space->device()))
228
switch (cpu_get_pc(&space.device()))
230
230
case 0x01da: return 0x80;
231
231
case 0x01e4: return 0x00;
233
logerror("%04x: read protection 1\n",cpu_get_pc(&space->device()));
233
logerror("%04x: read protection 1\n",cpu_get_pc(&space.device()));
238
READ8_HANDLER( scramblb_protection_2_r )
238
READ8_MEMBER(galaxold_state::scramblb_protection_2_r)
240
switch (cpu_get_pc(&space->device()))
240
switch (cpu_get_pc(&space.device()))
242
242
case 0x01ca: return 0x90;
244
logerror("%04x: read protection 2\n",cpu_get_pc(&space->device()));
244
logerror("%04x: read protection 2\n",cpu_get_pc(&space.device()));
250
WRITE8_HANDLER( _4in1_bank_w )
250
WRITE8_MEMBER(galaxold_state::_4in1_bank_w)
252
galaxold_state *state = space->machine().driver_data<galaxold_state>();
253
state->m__4in1_bank = data & 0x03;
254
galaxold_gfxbank_w(space, 0, state->m__4in1_bank);
255
memory_set_bank(space->machine(), "bank1", state->m__4in1_bank);
252
m__4in1_bank = data & 0x03;
253
galaxold_gfxbank_w(space, 0, m__4in1_bank);
254
membank("bank1")->set_entry(m__4in1_bank);
258
CUSTOM_INPUT( _4in1_fake_port_r )
257
CUSTOM_INPUT_MEMBER(galaxold_state::_4in1_fake_port_r)
260
galaxold_state *state = field.machine().driver_data<galaxold_state>();
261
259
static const char *const portnames[] = { "FAKE1", "FAKE2", "FAKE3", "FAKE4" };
262
260
int bit_mask = (FPTR)param;
264
return (input_port_read(field.machine(), portnames[state->m__4in1_bank]) & bit_mask) ? 0x01 : 0x00;
262
return (ioport(portnames[m__4in1_bank])->read() & bit_mask) ? 0x01 : 0x00;
267
265
#ifdef UNUSED_FUNCTION
304
302
DRIVER_INIT( mooncrst )
306
offs_t i, len = machine.region("maincpu")->bytes();
307
UINT8 *rom = machine.region("maincpu")->base();
304
offs_t i, len = machine.root_device().memregion("maincpu")->bytes();
305
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
310
308
for (i = 0;i < len;i++)
324
322
address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
325
UINT8 *rom = machine.region("maincpu")->base();
323
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
326
324
UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000);
328
326
space->set_decrypted_region(0x0000, 0x7fff, decrypt);
383
offs_t i, len = machine.region("maincpu")->bytes();
384
UINT8 *rom = machine.region("maincpu")->base();
381
offs_t i, len = machine.root_device().memregion("maincpu")->bytes();
382
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
387
385
for (i = 0; i < len; i++)
402
400
galaxold_state *state = machine.driver_data<galaxold_state>();
403
401
address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
404
offs_t i, len = machine.region("maincpu")->bytes();
405
UINT8 *RAM = machine.region("maincpu")->base();
402
offs_t i, len = state->memregion("maincpu")->bytes();
403
UINT8 *RAM = state->memregion("maincpu")->base();
407
405
/* Decrypt Program Roms */
408
406
for (i = 0; i < len; i++)
409
407
RAM[i] = RAM[i] ^ (i & 0xff);
411
409
/* games are banked at 0x0000 - 0x3fff */
412
memory_configure_bank(machine, "bank1", 0, 4, &RAM[0x10000], 0x4000);
410
state->membank("bank1")->configure_entries(0, 4, &RAM[0x10000], 0x4000);
414
_4in1_bank_w(space, 0, 0); /* set the initial CPU bank */
412
state->_4in1_bank_w(*space, 0, 0); /* set the initial CPU bank */
416
414
state_save_register_global(machine, state->m__4in1_bank);
419
417
INTERRUPT_GEN( hunchbks_vh_interrupt )
421
generic_pulse_irq_line_and_vector(device,0,0x03);
419
generic_pulse_irq_line_and_vector(device,0,0x03,1);
424
422
DRIVER_INIT( ladybugg )
426
/* Doesn't actually use the bank, but it mustn't have a coin lock! */
427
machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6002, 0x6002, FUNC(galaxold_gfxbank_w));
424
galaxold_state *state = machine.driver_data<galaxold_state>();
425
/* Doesn't actually use the bank, but it mustn't have a coin lock! */
426
machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x6002, 0x6002, write8_delegate(FUNC(galaxold_state::galaxold_gfxbank_w),state));