| Previous | 15994 Revisions | Next |
| r11509 Wednesday 11th May, 2011 at 08:19:49 UTC by Miodrag Milanović |
|---|
| Sync with MAME (r12501) (no whatsnew) |
| [src/emu] | crsshair.c devcpu.h devintrf.c devintrf.h devlegcy.h driver.h emu.h emutempl.h info.c inptport.c inptport.h machine.c machine.h memory.c |
| [src/emu/machine] | generic.c |
| [src/mame] | mame.lst |
| [src/mame/audio] | cchasm.c gorf.c gottlieb.c jedi.c wow.c |
| [src/mame/drivers] | 8080bw.c acefruit.c alg.c arcadia.c arkanoid.c artmagic.c asteroid.c astinvad.c astrocde.c astrocdh.c astrof.c battlex.c bfm_sc2.c brkthru.c btime.c btoads.c bwidow.c bwing.c bzone.c calomega.c cave.c ccastles.c cd32.c cdi.c champbas.c cheekyms.c cidelsa.c cinemat.c cloud9.c cntsteer.c cop01.c copsnrob.c cosmic.c crbaloon.c crshrace.c dacholer.c dcheese.c ddayjlc.c ddenlovr.c ddragon.c dlair.c dorachan.c dreamwld.c dynax.c enigma2.c equites.c esripsys.c exerion.c exidy.c exidy440.c exprraid.c fantland.c fcombat.c fgoal.c firefox.c firetrk.c flstory.c fromanc2.c gaelco3d.c galaga.c galastrm.c galaxi.c galaxian.c galaxold.c galdrvr.c galpanic.c gottlieb.c gradius3.c groundfx.c gstream.c guab.c gunbustr.c gundealr.c halleys.c hexion.c homerun.c igs009.c igs011.c igspoker.c inufuku.c itech32.c itech8.c jack.c jackie.c jpmsys5.c kopunch.c ksys573.c ladybug.c lasso.c lethalj.c limenko.c m10.c m14.c m92.c madalien.c mainsnk.c maxaflex.c meadows.c merit.c metro.c mhavoc.c midyunit.c midzeus.c missile.c model2.c mpu4.c ms32.c msx.c multfish.c multigam.c mw8080bw.c mystston.c namcos22.c naughtyb.c neogeo.c ng_aes.c niyanpai.c nova2001.c pastelg.c peplus.c pirates.c polepos.c policetr.c progolf.c psikyo.c psikyo4.c punchout.c pzletime.c qdrmfgp.c r2dtank.c redclash.c renegade.c rgum.c rpunch.c scobra.c scramble.c segag80r.c segag80v.c seibuspi.c sfbonus.c sg1000.c shootout.c skyfox.c snes.c snk.c snk6502.c spoker.c sprint4.c ssingles.c ssozumo.c stactics.c starshp1.c statriv2.c superwng.c suprnova.c suprridr.c system1.c taito_f3.c taitosj.c tankbatt.c tempest.c tetrisp2.c thayers.c toaplan1.c toaplan2.c tryout.c ultratnk.c ultrsprt.c undrfire.c vicdual.c welltris.c wolfpack.c wwfsstar.c wwfwfest.c xain.c xmen.c xxmissio.c yiear.c zaccaria.c zaxxon.c zn.c |
| [src/mame/machine] | amiga.c amigakbd.c arkanoid.c balsente.c cdislave.c gaelco2.c galaxold.c jvs13551.c jvs13551.h mhavoc.c micro3d.c playch10.c scramble.c segasms.c starwars.c williams.c |
| [src/mame/video] | konicdev.c phoenix.c stactics.c |
| [src/mess/drivers] | abc80.c amstrad.c apple2.c aquarius.c atom.c beta.c c80.c cosmicos.c crvision.c elf.c ex800.c exp85.c fidelz80.c geneve.c gizmondo.c hp49gp.c junior.c kim1.c lc80.c mpf1.c nakajies.c ngp.c palm.c pc.c pc8001.c pc8801.c pc9801.c pecom.c pockstat.c poly880.c psion.c px4.c qx10.c rex6000.c ssem.c studio2.c ti89.c ti99_4x.c tmc1800.c trs80m2.c v1050.c vidbrain.c vip.c x07.c x1.c |
| [src/mess/includes] | genpc.h |
| [src/mess/machine] | abc77.c abc77.h abc99.c abc99.h cbmipt.c coco.c comx35.c comxpl80.c comxpl80.h genpc.c lux10828.c lux10828.h lux21046.c lux21046.h z80ne.c |
| r11508 | r11509 | |
|---|---|---|
| 1924 | 1924 | arkatour // ??? (c) 1987 Taito America Corporation + Romstar license (US) |
| 1925 | 1925 | tetrsark // ??? (c) D.R.Korea |
| 1926 | 1926 | hexa // D. R. Korea |
| 1927 | brixian // (c) 1993 Cheil Computer System | |
| 1927 | 1928 | sqix // B03 1987 |
| 1928 | 1929 | sqixr1 // B03 1987 |
| 1929 | 1930 | sqixu // B03 1987 |
| r11508 | r11509 | |
| 8628 | 8629 | spk116it // (c) 199? IGS |
| 8629 | 8630 | jackie // (c) 1993 IGS |
| 8630 | 8631 | pktet346 // (c) 199? IGS |
| 8632 | cpokerx // (c) 1993 IGS | |
| 8631 | 8633 | chleague // (c) 199? IGS |
| 8632 | 8634 | chleagul // (c) 199? IGS |
| 8633 | 8635 | number10 // (c) IGS (Board labeled Playmark Srl) |
| r11508 | r11509 | |
| 9504 | 9506 | pipeline // (c) 1990 Daehyun Electronics |
| 9505 | 9507 | ttchamp |
| 9506 | 9508 | ttchampa |
| 9509 | baryon // (c) 1997 SemiCom | |
| 9507 | 9510 | dreamwld // (c) 2000 SemiCom |
| 9508 | 9511 | cybertnk // (c) 1990 Coreland |
| 9509 | 9512 | cubeqst // (c) 1983 Simutrek Inc. |
| r11508 | r11509 | |
| 10720 | 10723 | m_gmball |
| 10721 | 10724 | m_grtecp // 199? |
| 10722 | 10725 | m_blsbys // BwB |
| 10723 | ||
| 10726 | ||
| 10724 | 10727 | |
| 10725 | 10728 | // MPU5 |
| 10726 | 10729 | m_honmon |
| r11508 | r11509 | |
|---|---|---|
| 177 | 177 | |
| 178 | 178 | CUSTOM_INPUT( gorf_speech_status_r ) |
| 179 | 179 | { |
| 180 | device_t *samples = field-> | |
| 180 | device_t *samples = field-> | |
| 181 | 181 | return !sample_playing(samples, 0); |
| 182 | 182 | } |
| r11508 | r11509 | |
|---|---|---|
| 466 | 466 | |
| 467 | 467 | static CUSTOM_INPUT( speech_drq_custom_r ) |
| 468 | 468 | { |
| 469 | return sp0250_drq_r(field-> | |
| 469 | return sp0250_drq_r(field-> | |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 |
| r11508 | r11509 | |
|---|---|---|
| 103 | 103 | |
| 104 | 104 | CUSTOM_INPUT( jedi_audio_comm_stat_r ) |
| 105 | 105 | { |
| 106 | jedi_state *state = field-> | |
| 106 | jedi_state *state = field-> | |
| 107 | 107 | return *state->m_audio_comm_stat >> 6; |
| 108 | 108 | } |
| 109 | 109 |
| r11508 | r11509 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | INPUT_CHANGED( cchasm_set_coin_flag ) |
| 26 | 26 | { |
| 27 | cchasm_state *state = field-> | |
| 27 | cchasm_state *state = field-> | |
| 28 | 28 | if (!newval && !state->m_coin_flag) |
| 29 | 29 | { |
| 30 | 30 | state->m_coin_flag = 1; |
| r11508 | r11509 | |
|---|---|---|
| 171 | 171 | |
| 172 | 172 | CUSTOM_INPUT( wow_speech_status_r ) |
| 173 | 173 | { |
| 174 | device_t *samples = field-> | |
| 174 | device_t *samples = field-> | |
| 175 | 175 | return !sample_playing(samples, 0); |
| 176 | 176 | } |
| r11508 | r11509 | |
|---|---|---|
| 213 | 213 | |
| 214 | 214 | CUSTOM_INPUT( tms5220_r ) |
| 215 | 215 | { |
| 216 | return tms5220_readyq_r(field-> | |
| 216 | return tms5220_readyq_r(field-> | |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | CUSTOM_INPUT( mhavoc_bit67_r ) |
| 220 | 220 | { |
| 221 | mhavoc_state *state = field-> | |
| 221 | mhavoc_state *state = field-> | |
| 222 | 222 | const char *tag1 = (const char *)param; |
| 223 | 223 | const char *tag2 = tag1 + strlen(tag1) + 1; |
| 224 | return input_port_read(field-> | |
| 224 | return input_port_read(field-> | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | CUSTOM_INPUT( gamma_rcvd_r ) |
| 228 | 228 | { |
| 229 | mhavoc_state *state = field-> | |
| 229 | mhavoc_state *state = field-> | |
| 230 | 230 | /* Gamma rcvd flag */ |
| 231 | 231 | return state->m_gamma_rcvd; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | CUSTOM_INPUT( gamma_xmtd_r ) |
| 235 | 235 | { |
| 236 | mhavoc_state *state = field-> | |
| 236 | mhavoc_state *state = field-> | |
| 237 | 237 | /* Gamma xmtd flag */ |
| 238 | 238 | return state->m_gamma_xmtd; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | CUSTOM_INPUT( alpha_rcvd_r ) |
| 242 | 242 | { |
| 243 | mhavoc_state *state = field-> | |
| 243 | mhavoc_state *state = field-> | |
| 244 | 244 | /* Alpha rcvd flag */ |
| 245 | 245 | return (state->m_has_gamma_cpu && state->m_alpha_rcvd); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | CUSTOM_INPUT( alpha_xmtd_r ) |
| 249 | 249 | { |
| 250 | mhavoc_state *state = field-> | |
| 250 | mhavoc_state *state = field-> | |
| 251 | 251 | /* Alpha xmtd flag */ |
| 252 | 252 | return (state->m_has_gamma_cpu && state->m_alpha_xmtd); |
| 253 | 253 | } |
| r11508 | r11509 | |
|---|---|---|
| 1110 | 1110 | |
| 1111 | 1111 | CUSTOM_INPUT( nstocker_bits_r ) |
| 1112 | 1112 | { |
| 1113 | balsente_state *state = field-> | |
| 1113 | balsente_state *state = field-> | |
| 1114 | 1114 | return state->m_nstocker_bits; |
| 1115 | 1115 | } |
| 1116 | 1116 |
| r11508 | r11509 | |
|---|---|---|
| 413 | 413 | |
| 414 | 414 | CUSTOM_INPUT( amiga_joystick_convert ) |
| 415 | 415 | { |
| 416 | UINT8 bits = input_port_read(field-> | |
| 416 | UINT8 bits = input_port_read(field-> | |
| 417 | 417 | int up = (bits >> 0) & 1; |
| 418 | 418 | int down = (bits >> 1) & 1; |
| 419 | 419 | int left = (bits >> 2) & 1; |
| r11508 | r11509 | |
|---|---|---|
| 119 | 119 | |
| 120 | 120 | INPUT_CHANGED( cdislave_device::mouse_update ) |
| 121 | 121 | { |
| 122 | cdislave_device *slave = static_cast<cdislave_device *>(field-> | |
| 122 | cdislave_device *slave = static_cast<cdislave_device *>(field-> | |
| 123 | 123 | slave->perform_mouse_update(); |
| 124 | 124 | } |
| 125 | 125 |
| r11508 | r11509 | |
|---|---|---|
| 68 | 68 | /* Special case Page UP, which we will use as Action Replay button */ |
| 69 | 69 | if ( (index == 3) && ( delta & 0x80000000 ) && ( newvalue & 0x80000000 ) ) |
| 70 | 70 | { |
| 71 | const amiga_machine_interface *amiga_intf = amiga_get_interface(field-> | |
| 71 | const amiga_machine_interface *amiga_intf = amiga_get_interface(field-> | |
| 72 | 72 | |
| 73 | 73 | if ( amiga_intf != NULL && amiga_intf->nmi_callback ) |
| 74 | 74 | { |
| 75 | (*amiga_intf->nmi_callback)(field-> | |
| 75 | (*amiga_intf->nmi_callback)(field-> | |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | else |
| r11508 | r11509 | |
| 96 | 96 | /* if the buffer was empty and we have new data, start a timer to send the keystrokes */ |
| 97 | 97 | if ( key_buf_was_empty && ( kbd.buf_pos != kbd.cur_pos ) ) |
| 98 | 98 | { |
| 99 | kbd.timer->adjust(field-> | |
| 99 | kbd.timer->adjust(field-> | |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
| r11508 | r11509 | |
|---|---|---|
| 545 | 545 | |
| 546 | 546 | CUSTOM_INPUT( botssa_hwchk_r ) |
| 547 | 547 | { |
| 548 | micro3d_state *state = field-> | |
| 548 | micro3d_state *state = field-> | |
| 549 | 549 | |
| 550 | 550 | return state->m_botssa_latch; |
| 551 | 551 | } |
| r11508 | r11509 | |
|---|---|---|
| 93 | 93 | |
| 94 | 94 | CUSTOM_INPUT( pc10_int_detect_r ) |
| 95 | 95 | { |
| 96 | playch10_state *state = field-> | |
| 96 | playch10_state *state = field-> | |
| 97 | 97 | return ~state->m_pc10_int_detect & 1; |
| 98 | 98 | } |
| 99 | 99 |
| r11508 | r11509 | |
|---|---|---|
| 43 | 43 | 0x2b, 0x2a, 0x28, 0x29, 0x09, 0x08, 0x0a, 0x0b, |
| 44 | 44 | 0x0f, 0x0e, 0x0c, 0x0d, 0x2d, 0x2c, 0x2e, 0x2f, |
| 45 | 45 | 0x27, 0x26, 0x24, 0x25, 0x05, 0x04, 0x06, 0x07 }; |
| 46 | UINT8 val = input_port_read(field-> | |
| 46 | UINT8 val = input_port_read(field-> | |
| 47 | 47 | |
| 48 | 48 | return remap[val >> 2]; |
| 49 | 49 | } |
| r11508 | r11509 | |
|---|---|---|
| 319 | 319 | |
| 320 | 320 | INPUT_CHANGED( lgun1_changed ) |
| 321 | 321 | { |
| 322 | sms_state *state = field-> | |
| 322 | sms_state *state = field-> | |
| 323 | 323 | if (!state->m_lphaser_1_timer || |
| 324 | (input_port_read_safe(field-> | |
| 324 | (input_port_read_safe(field-> | |
| 325 | 325 | return; |
| 326 | 326 | |
| 327 | 327 | if (newval != oldval) |
| 328 | lphaser1_sensor_check(field-> | |
| 328 | lphaser1_sensor_check(field-> | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | INPUT_CHANGED( lgun2_changed ) |
| 332 | 332 | { |
| 333 | sms_state *state = field-> | |
| 333 | sms_state *state = field-> | |
| 334 | 334 | if (!state->m_lphaser_2_timer || |
| 335 | (input_port_read_safe(field-> | |
| 335 | (input_port_read_safe(field-> | |
| 336 | 336 | return; |
| 337 | 337 | |
| 338 | 338 | if (newval != oldval) |
| 339 | lphaser2_sensor_check(field-> | |
| 339 | lphaser2_sensor_check(field-> | |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 |
| r11508 | r11509 | |
|---|---|---|
| 223 | 223 | |
| 224 | 224 | CUSTOM_INPUT( wrally2_analog_bit_r ) |
| 225 | 225 | { |
| 226 | gaelco2_state *state = field-> | |
| 226 | gaelco2_state *state = field-> | |
| 227 | 227 | int which = (FPTR)param; |
| 228 | 228 | return (state->m_analog_ports[which] >> 7) & 0x01; |
| 229 | 229 | } |
| r11508 | r11509 | |
|---|---|---|
| 106 | 106 | |
| 107 | 107 | CUSTOM_INPUT( arkanoid_68705_input_r ) |
| 108 | 108 | { |
| 109 | arkanoid_state *state = field-> | |
| 109 | arkanoid_state *state = field-> | |
| 110 | 110 | int res = 0; |
| 111 | 111 | |
| 112 | 112 | /* bit 0x40 of comes from the sticky bit */ |
| r11508 | r11509 | |
| 122 | 122 | |
| 123 | 123 | CUSTOM_INPUT( arkanoid_input_mux ) |
| 124 | 124 | { |
| 125 | arkanoid_state *state = field-> | |
| 125 | arkanoid_state *state = field-> | |
| 126 | 126 | const char *tag1 = (const char *)param; |
| 127 | 127 | const char *tag2 = tag1 + strlen(tag1) + 1; |
| 128 | return input_port_read(field-> | |
| 128 | return input_port_read(field-> | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /* |
| r11508 | r11509 | |
|---|---|---|
| 257 | 257 | |
| 258 | 258 | CUSTOM_INPUT( _4in1_fake_port_r ) |
| 259 | 259 | { |
| 260 | galaxold_state *state = field-> | |
| 260 | galaxold_state *state = field-> | |
| 261 | 261 | static const char *const portnames[] = { "FAKE1", "FAKE2", "FAKE3", "FAKE4" }; |
| 262 | 262 | int bit_mask = (FPTR)param; |
| 263 | 263 | |
| 264 | return (input_port_read(field-> | |
| 264 | return (input_port_read(field-> | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | #ifdef UNUSED_FUNCTION |
| r11508 | r11509 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | const device_type SEGA_837_13551 = &device_creator<sega_837_13551>; |
| 4 | 4 | |
| 5 | ||
| 5 | ||
| 6 | 6 | { |
| 7 | 7 | if(state) |
| 8 | 8 | downcast<sega_837_13551 *>(device)->inc_coin(0); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | ||
| 11 | ||
| 12 | 12 | { |
| 13 | 13 | if(state) |
| 14 | 14 | downcast<sega_837_13551 *>(device)->inc_coin(1); |
| r11508 | r11509 | |
| 16 | 16 | |
| 17 | 17 | static INPUT_PORTS_START(sega_837_13551_coins) |
| 18 | 18 | PORT_START("COINS") |
| 19 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_WRITE_LINE_DEVICE(DEVICE_SELF, coin_1_w) | |
| 20 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_WRITE_LINE_DEVICE(DEVICE_SELF, coin_2_w) | |
| 19 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_WRITE_LINE_DEVICE(DEVICE_SELF, jvs13551_coin_1_w) | |
| 20 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_WRITE_LINE_DEVICE(DEVICE_SELF, jvs13551_coin_2_w) | |
| 21 | 21 | INPUT_PORTS_END |
| 22 | 22 | |
| 23 | 23 | void sega_837_13551::static_set_port_tag(device_t &device, int port, const char *tag) |
| r11508 | r11509 | |
| 26 | 26 | ctrl.port_tag[port] = tag; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | const | |
| 29 | ioport_constr | |
| 30 | 30 | { |
| 31 | 31 | return INPUT_PORTS_NAME(sega_837_13551_coins); |
| 32 | 32 | } |
| r11508 | r11509 | |
|---|---|---|
| 26 | 26 | public: |
| 27 | 27 | sega_837_13551(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 28 | 28 | static void static_set_port_tag(device_t &device, int port, const char *tag); |
| 29 | const | |
| 29 | ioport_constr | |
| 30 | 30 | |
| 31 | 31 | void inc_coin(int coin); |
| 32 | 32 |
| r11508 | r11509 | |
|---|---|---|
| 577 | 577 | |
| 578 | 578 | CUSTOM_INPUT( williams_mux_r ) |
| 579 | 579 | { |
| 580 | williams_state *state = field-> | |
| 580 | williams_state *state = field-> | |
| 581 | 581 | const char *tag = (const char *)param; |
| 582 | 582 | |
| 583 | 583 | if (state->m_port_select != 0) |
| 584 | 584 | tag += strlen(tag) + 1; |
| 585 | 585 | |
| 586 | return input_port_read(field-> | |
| 586 | return input_port_read(field-> | |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /* |
| r11508 | r11509 | |
|---|---|---|
| 110 | 110 | |
| 111 | 111 | CUSTOM_INPUT( matrix_flag_r ) |
| 112 | 112 | { |
| 113 | starwars_state *state = field-> | |
| 113 | starwars_state *state = field-> | |
| 114 | 114 | /* set the matrix processor flag */ |
| 115 | 115 | return state->m_math_run ? 1 : 0; |
| 116 | 116 | } |
| r11508 | r11509 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | CUSTOM_INPUT( stactics_get_frame_count_d3 ) |
| 116 | 116 | { |
| 117 | stactics_state *state = field-> | |
| 117 | stactics_state *state = field-> | |
| 118 | 118 | |
| 119 | 119 | return (state->m_frame_count >> 3) & 0x01; |
| 120 | 120 | } |
| r11508 | r11509 | |
| 172 | 172 | |
| 173 | 173 | CUSTOM_INPUT( stactics_get_shot_standby ) |
| 174 | 174 | { |
| 175 | stactics_state *state = field-> | |
| 175 | stactics_state *state = field-> | |
| 176 | 176 | |
| 177 | 177 | return state->m_shot_standby; |
| 178 | 178 | } |
| r11508 | r11509 | |
| 180 | 180 | |
| 181 | 181 | CUSTOM_INPUT( stactics_get_not_shot_arrive ) |
| 182 | 182 | { |
| 183 | stactics_state *state = field-> | |
| 183 | stactics_state *state = field-> | |
| 184 | 184 | |
| 185 | 185 | return !state->m_shot_arrive; |
| 186 | 186 | } |
| r11508 | r11509 | |
|---|---|---|
| 310 | 310 | |
| 311 | 311 | CUSTOM_INPUT( player_input_r ) |
| 312 | 312 | { |
| 313 | phoenix_state *state = field-> | |
| 313 | phoenix_state *state = field-> | |
| 314 | 314 | if (state->m_cocktail_mode) |
| 315 | return (input_port_read(field-> | |
| 315 | return (input_port_read(field-> | |
| 316 | 316 | else |
| 317 | return (input_port_read(field-> | |
| 317 | return (input_port_read(field-> | |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | CUSTOM_INPUT( pleiads_protection_r ) |
| 321 | 321 | { |
| 322 | phoenix_state *state = field-> | |
| 322 | phoenix_state *state = field-> | |
| 323 | 323 | /* handle Pleiads protection */ |
| 324 | 324 | switch (state->m_pleiads_protection_question) |
| 325 | 325 | { |
| r11508 | r11509 | |
| 332 | 332 | /* Bit 3 is 1 */ |
| 333 | 333 | return 1; |
| 334 | 334 | default: |
| 335 | logerror("%s:Unknown protection question %02X\n", field-> | |
| 335 | logerror("%s:Unknown protection question %02X\n", field-> | |
| 336 | 336 | return 0; |
| 337 | 337 | } |
| 338 | 338 | } |
| r11508 | r11509 | |
|---|---|---|
| 8987 | 8987 | /* */ |
| 8988 | 8988 | /***************************************************************************/ |
| 8989 | 8989 | |
| 8990 | /* | |
| 8991 | ||
| 8992 | left res = current in game, right res = computed | |
| 8993 | ||
| 8994 | hexion: 02 FF 00 4D 00 73 00 00 01 1F 05 0E B7 7C 00 00 512x256 ~ 512x256 <- writes to e and f regs, in an irq ack fashion | |
| 8995 | overdriv: 01 7F 00 22 00 0D 00 03 01 07 10 0F 73 00 00 00 304x256 ~ 305x224 | |
| 8996 | esckids: 01 7F 00 12 00 0D 00 01 01 07 08 07 73 00 00 00 304x224 ~ 321x240 | |
| 8997 | rollerg: 01 7F 00 23 00 1D 02 00 01 07 10 0F 73 00 02 00 288x224 ~ 288x224 <- writes to 6 and e regs, in an irq ack fashion | |
| 8998 | gaiapols: 01 FB 00 19 00 37 00 00 01 06 10 0E 75 00 D1 00 376x224 ~ 380x224 | |
| 8999 | mmaulers: 01 7F 00 19 00 27 00 00 01 07 10 0F 73 00 00 00 288x224 ~ 288x224 | |
| 9000 | mystwarr: 01 7F 00 12 00 2E 00 00 01 07 11 0E 73 00 00 00 288x224 ~ 288x224 | |
| 9001 | metamrph: 01 7F 00 11 00 27 01 00 01 07 10 0F 74 00 00 00 288x224 ~ 288x224 | |
| 9002 | viostorm: 01 FF 00 16 00 39 00 00 01 07 11 0E 75 00 00 00 384x224 ~ 385x224 | |
| 9003 | mtlchamp: 01 FF 00 21 00 37 00 00 01 07 11 0E 74 00 00 00 384x224 ~ 384x224 | |
| 9004 | dbz: 01 FF 00 21 00 37 00 00 01 20 0C 0E 54 00 00 00 384x256 ~ 384x256 | |
| 9005 | dbz2: 01 FF 00 21 00 37 00 00 01 20 0C 0E 54 00 00 00 384x256 ~ 384x256 | |
| 9006 | xexex: 01 FF 00 21 00 37 01 00 01 20 0C 0E 54 00 00 00 384x256 ~ 384x256 (*) | |
| 9007 | (all konamigx, cowboys of moo mesa, run & gun, dj main) | |
| 9008 | ||
| 9009 | (*) hblank duration 512 (0x200), hdisp 384 (0x180), vblank duration 288 (0x120), vdisp 256 (0x100) | |
| 9010 | ||
| 9011 | Definitions from GX, look similar, all values big-endian, write-only: | |
| 9012 | ||
| 9013 | 0-1: bits 9-0: HC - Total hblank duration (-1) Hres ~ (HC+1) - HFP - HBP - 8*(HSW+1) | |
| 9014 | 2-3: bits 8-0: HFP - HBlank front porch | |
| 9015 | 4-5: bits 8-0: HBP - HBlank back porch | |
| 9016 | 8-9: bits 8-0: VC - Total vblank duration | |
| 9017 | a : bits 7-0: VFP - VBlank front porch Vres ~ VC - VFP - VBP - (VSW+1) | |
| 9018 | b : bits 7-0: VBP - VBlank back porch | |
| 9019 | c : bits 7-4: VSW | |
| 9020 | c : bits 3-0: HSW | |
| 9021 | d : bits 7-0: INT-TIME | |
| 9022 | e : bits 7-0: INT1ACK | |
| 9023 | f : bits 7-0: INT2ACK | |
| 9024 | ||
| 9025 | Read-only: | |
| 9026 | e-f: vits 8-0: VCT | |
| 9027 | */ | |
| 9028 | ||
| 8990 | 9029 | typedef struct _k053252_state k053252_state; |
| 8991 | 9030 | struct _k053252_state |
| 8992 | 9031 | { |
| r11508 | r11509 | |
|---|---|---|
| 84 | 84 | |
| 85 | 85 | static INPUT_CHANGED( coin_inserted ) |
| 86 | 86 | { |
| 87 | skyfox_state *state = field-> | |
| 87 | skyfox_state *state = field-> | |
| 88 | 88 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| 89 | 89 | } |
| 90 | 90 |
| r11508 | r11509 | |
|---|---|---|
| 106 | 106 | |
| 107 | 107 | static CUSTOM_INPUT( fgoal_80_r ) |
| 108 | 108 | { |
| 109 | UINT8 ret = (field-> | |
| 109 | UINT8 ret = (field-> | |
| 110 | 110 | |
| 111 | 111 | return ret; |
| 112 | 112 | } |
| r11508 | r11509 | |
|---|---|---|
| 59 | 59 | static INPUT_CHANGED( coin_inserted ) |
| 60 | 60 | { |
| 61 | 61 | /* coin insertion causes an NMI */ |
| 62 | cputag_set_input_line(field-> | |
| 62 | cputag_set_input_line(field-> | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 |
| r11508 | r11509 | |
|---|---|---|
| 136 | 136 | |
| 137 | 137 | static CUSTOM_INPUT( mainsnk_sound_r ) |
| 138 | 138 | { |
| 139 | mainsnk_state *state = field-> | |
| 139 | mainsnk_state *state = field-> | |
| 140 | 140 | |
| 141 | 141 | return (state->m_sound_cpu_busy) ? 0x01 : 0x00; |
| 142 | 142 | } |
| r11508 | r11509 | |
|---|---|---|
| 159 | 159 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 160 | 160 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 161 | 161 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 162 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CODE("NONE") | |
| 162 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /*WTF? PORT_CODE("NONE")*/ | |
| 163 | 163 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 164 | 164 | |
| 165 | 165 | PORT_START("P2") |
| r11508 | r11509 | |
| 169 | 169 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL |
| 170 | 170 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 171 | 171 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 172 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL PORT_CODE("NONE") | |
| 172 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL /*WTF? PORT_CODE("NONE")*/ | |
| 173 | 173 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 174 | 174 | |
| 175 | 175 | PORT_START("DSW1") |
| r11508 | r11509 | |
|---|---|---|
| 134 | 134 | * |
| 135 | 135 | *************************************/ |
| 136 | 136 | |
| 137 | static const int gun_table[] = {0x3f, 0x5f, 0x6f, 0x77, 0x7b, 0x7d, 0x7e}; | |
| 137 | static const input_port_value gun_table[] = {0x3f, 0x5f, 0x6f, 0x77, 0x7b, 0x7d, 0x7e}; | |
| 138 | 138 | |
| 139 | 139 | static INPUT_PORTS_START( copsnrob ) |
| 140 | 140 | PORT_START("IN0") |
| r11508 | r11509 | |
|---|---|---|
| 672 | 672 | |
| 673 | 673 | static INPUT_CHANGED( coin_inserted ) |
| 674 | 674 | { |
| 675 | cntsteer_state *state = field-> | |
| 675 | cntsteer_state *state = field-> | |
| 676 | 676 | device_set_input_line(state->m_subcpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| 677 | 677 | } |
| 678 | 678 |
| r11508 | r11509 | |
|---|---|---|
| 173 | 173 | |
| 174 | 174 | static CUSTOM_INPUT( get_vblank ) |
| 175 | 175 | { |
| 176 | ccastles_state *state = field->port->machine().driver_data<ccastles_state>(); | |
| 177 | int scanline = field->port->machine().primary_screen->vpos(); | |
| 176 | ccastles_state *state = field->machine().driver_data<ccastles_state>(); | |
| 177 | int scanline = field->machine().primary_screen->vpos(); | |
| 178 | 178 | return state->m_syncprom[scanline & 0xff] & 1; |
| 179 | 179 | } |
| 180 | 180 |
| r11508 | r11509 | |
|---|---|---|
| 183 | 183 | |
| 184 | 184 | static CUSTOM_INPUT( bsmt_status_r ) |
| 185 | 185 | { |
| 186 | return field-> | |
| 186 | return field-> | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 |
| r11508 | r11509 | |
|---|---|---|
| 2066 | 2066 | |
| 2067 | 2067 | static CUSTOM_INPUT( jdredd_gun_mux_read ) |
| 2068 | 2068 | { |
| 2069 | zn_state *state = field-> | |
| 2069 | zn_state *state = field-> | |
| 2070 | 2070 | |
| 2071 | 2071 | return state->m_jdredd_gun_mux; |
| 2072 | 2072 | } |
| r11508 | r11509 | |
|---|---|---|
| 432 | 432 | static const UINT8 translate49[7] = { 0x8, 0xc, 0xe, 0xf, 0x3, 0x1, 0x0 }; |
| 433 | 433 | const char *namex = (const char *)param; |
| 434 | 434 | const char *namey = namex + strlen(namex) + 1; |
| 435 | return (translate49[input_port_read(field-> | |
| 435 | return (translate49[input_port_read(field-> | |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | |
| r11508 | r11509 | |
| 445 | 445 | |
| 446 | 446 | static CUSTOM_INPUT( keypad_r ) |
| 447 | 447 | { |
| 448 | UINT32 bits = input_port_read(field-> | |
| 448 | UINT32 bits = input_port_read(field-> | |
| 449 | 449 | UINT8 select = keypad_select; |
| 450 | 450 | while ((select & 1) != 0) |
| 451 | 451 | { |
| r11508 | r11509 | |
|---|---|---|
| 293 | 293 | { |
| 294 | 294 | /* pressing the service switch sends an NMI */ |
| 295 | 295 | if (newval) |
| 296 | cputag_set_input_line(field-> | |
| 296 | cputag_set_input_line(field-> | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
| r11508 | r11509 | |
| 355 | 355 | |
| 356 | 356 | static CUSTOM_INPUT( razmataz_dial_r ) |
| 357 | 357 | { |
| 358 | zaxxon_state *state = field-> | |
| 358 | zaxxon_state *state = field-> | |
| 359 | 359 | static const char *const dialname[2] = { "DIAL0", "DIAL1" }; |
| 360 | 360 | int num = (FPTR)param; |
| 361 | 361 | int delta, res; |
| 362 | 362 | |
| 363 | delta = input_port_read(field-> | |
| 363 | delta = input_port_read(field-> | |
| 364 | 364 | |
| 365 | 365 | if (delta < 0x80) |
| 366 | 366 | { |
| r11508 | r11509 | |
| 408 | 408 | { |
| 409 | 409 | if (newval) |
| 410 | 410 | { |
| 411 | zaxxon_state *state = field-> | |
| 411 | zaxxon_state *state = field-> | |
| 412 | 412 | |
| 413 | 413 | state->m_coin_status[(int)(FPTR)param] = state->m_coin_enable[(int)(FPTR)param]; |
| 414 | 414 | } |
| r11508 | r11509 | |
| 417 | 417 | |
| 418 | 418 | static CUSTOM_INPUT( zaxxon_coin_r ) |
| 419 | 419 | { |
| 420 | zaxxon_state *state = field-> | |
| 420 | zaxxon_state *state = field-> | |
| 421 | 421 | |
| 422 | 422 | return state->m_coin_status[(int)(FPTR)param]; |
| 423 | 423 | } |
| r11508 | r11509 | |
|---|---|---|
| 122 | 122 | static CUSTOM_INPUT( punchout_vlm5030_busy_r ) |
| 123 | 123 | { |
| 124 | 124 | /* bit 4 of DSW1 is busy pin level */ |
| 125 | return (vlm5030_bsy(field-> | |
| 125 | return (vlm5030_bsy(field-> | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | static WRITE8_DEVICE_HANDLER( punchout_speech_reset_w ) |
| r11508 | r11509 | |
|---|---|---|
| 256 | 256 | static INPUT_CHANGED( coin_inserted ) |
| 257 | 257 | { |
| 258 | 258 | if (!newval) |
| 259 | cputag_set_input_line(field-> | |
| 259 | cputag_set_input_line(field-> | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | int atari_input_disabled(running_machine &machine) |
| r11508 | r11509 | |
|---|---|---|
| 70 | 70 | |
| 71 | 71 | static INPUT_CHANGED( left_coin_inserted ) |
| 72 | 72 | { |
| 73 | kopunch_state *state = field-> | |
| 73 | kopunch_state *state = field-> | |
| 74 | 74 | |
| 75 | 75 | /* left coin insertion causes a rst6.5 (vector 0x34) */ |
| 76 | 76 | if (newval) |
| r11508 | r11509 | |
| 79 | 79 | |
| 80 | 80 | static INPUT_CHANGED( right_coin_inserted ) |
| 81 | 81 | { |
| 82 | kopunch_state *state = field-> | |
| 82 | kopunch_state *state = field-> | |
| 83 | 83 | |
| 84 | 84 | /* right coin insertion causes a rst5.5 (vector 0x2c) */ |
| 85 | 85 | if (newval) |
| r11508 | r11509 | |
|---|---|---|
| 315 | 315 | { "IN0-0", "IN0-1" }, { "IN1-0", "IN1-1" } |
| 316 | 316 | }; |
| 317 | 317 | |
| 318 | return input_port_read_safe(field-> | |
| 318 | return input_port_read_safe(field-> | |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | |
| r11508 | r11509 | |
| 334 | 334 | { |
| 335 | 335 | default: |
| 336 | 336 | case 0x00: ret = 0x0000; break; /* nothing? */ |
| 337 | case 0x09: ret = input_port_read(field->port->machine(), "MAHJONG1"); break; | |
| 338 | case 0x12: ret = input_port_read(field->port->machine(), "MAHJONG2"); break; | |
| 339 | case 0x1b: ret = input_port_read(field->port->machine(), "MAHJONG3"); break; /* player 1 normal inputs? */ | |
| 340 | case 0x24: ret = input_port_read(field->port->machine(), "MAHJONG4"); break; | |
| 337 | case 0x09: ret = input_port_read(field->machine(), "MAHJONG1"); break; | |
| 338 | case 0x12: ret = input_port_read(field->machine(), "MAHJONG2"); break; | |
| 339 | case 0x1b: ret = input_port_read(field->machine(), "MAHJONG3"); break; /* player 1 normal inputs? */ | |
| 340 | case 0x24: ret = input_port_read(field->machine(), "MAHJONG4"); break; | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | return ret; |
| r11508 | r11509 | |
| 430 | 430 | |
| 431 | 431 | static CUSTOM_INPUT( get_calendar_status ) |
| 432 | 432 | { |
| 433 | neogeo_state *state = field-> | |
| 433 | neogeo_state *state = field-> | |
| 434 | 434 | return (upd4990a_databit_r(state->m_upd4990a, 0) << 1) | upd4990a_testbit_r(state->m_upd4990a, 0); |
| 435 | 435 | } |
| 436 | 436 | |
| r11508 | r11509 | |
| 487 | 487 | { |
| 488 | 488 | /* D0 and D1 are memcard presence indicators, D2 indicates memcard |
| 489 | 489 | write protect status (we are always write enabled) */ |
| 490 | if(strcmp((char*)field-> | |
| 490 | if(strcmp((char*)field-> | |
| 491 | 491 | return 0x00; // On the Neo Geo CD, the memory card is internal and therefore always present. |
| 492 | 492 | else |
| 493 | return (memcard_present(field-> | |
| 493 | return (memcard_present(field-> | |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | static READ16_HANDLER( memcard_r ) |
| r11508 | r11509 | |
| 604 | 604 | |
| 605 | 605 | static CUSTOM_INPUT( get_audio_result ) |
| 606 | 606 | { |
| 607 | neogeo_state *state = field-> | |
| 607 | neogeo_state *state = field-> | |
| 608 | 608 | UINT32 ret = state->m_audio_result; |
| 609 | 609 | |
| 610 | // if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(field-> | |
| 610 | // if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(field-> | |
| 611 | 611 | |
| 612 | 612 | return ret; |
| 613 | 613 | } |
| r11508 | r11509 | |
|---|---|---|
| 1409 | 1409 | |
| 1410 | 1410 | static CUSTOM_INPUT( ddenlovr_special_r ) |
| 1411 | 1411 | { |
| 1412 | dynax_state *state = field-> | |
| 1412 | dynax_state *state = field-> | |
| 1413 | 1413 | return state->m_ddenlovr_blitter_irq_flag; |
| 1414 | 1414 | } |
| 1415 | 1415 | |
| r11508 | r11509 | |
| 1781 | 1781 | |
| 1782 | 1782 | static CUSTOM_INPUT( ddenlovj_blitter_r ) |
| 1783 | 1783 | { |
| 1784 | dynax_state *state = field-> | |
| 1784 | dynax_state *state = field-> | |
| 1785 | 1785 | return state->m_ddenlovr_blitter_irq_flag ? 0x03 : 0x00; // bit 4 = 1 -> blitter busy |
| 1786 | 1786 | } |
| 1787 | 1787 | |
| r11508 | r11509 | |
| 1921 | 1921 | |
| 1922 | 1922 | static CUSTOM_INPUT( nettoqc_special_r ) |
| 1923 | 1923 | { |
| 1924 | dynax_state *state = field-> | |
| 1924 | dynax_state *state = field-> | |
| 1925 | 1925 | return state->m_ddenlovr_blitter_irq_flag ? 0x03 : 0x00; |
| 1926 | 1926 | } |
| 1927 | 1927 | |
| r11508 | r11509 | |
| 3446 | 3446 | |
| 3447 | 3447 | static CUSTOM_INPUT( mjflove_blitter_r ) |
| 3448 | 3448 | { |
| 3449 | dynax_state *state = field-> | |
| 3449 | dynax_state *state = field-> | |
| 3450 | 3450 | |
| 3451 | 3451 | // bit 7 = 1 -> blitter busy |
| 3452 | 3452 | // bit 6 = 0 -> VBLANK? |
| r11508 | r11509 | |
|---|---|---|
| 176 | 176 | |
| 177 | 177 | static CUSTOM_INPUT( mahjong_ctrl_r ) |
| 178 | 178 | { |
| 179 | ms32_state *state = field-> | |
| 179 | ms32_state *state = field-> | |
| 180 | 180 | UINT32 mj_input; |
| 181 | 181 | |
| 182 | 182 | switch (state->m_mahjong_input_select[0]) |
| 183 | 183 | { |
| 184 | 184 | case 0x01: |
| 185 | mj_input = input_port_read(field-> | |
| 185 | mj_input = input_port_read(field-> | |
| 186 | 186 | break; |
| 187 | 187 | case 0x02: |
| 188 | mj_input = input_port_read(field-> | |
| 188 | mj_input = input_port_read(field-> | |
| 189 | 189 | break; |
| 190 | 190 | case 0x04: |
| 191 | mj_input = input_port_read(field-> | |
| 191 | mj_input = input_port_read(field-> | |
| 192 | 192 | break; |
| 193 | 193 | case 0x08: |
| 194 | mj_input = input_port_read(field-> | |
| 194 | mj_input = input_port_read(field-> | |
| 195 | 195 | break; |
| 196 | 196 | case 0x10: |
| 197 | mj_input = input_port_read(field-> | |
| 197 | mj_input = input_port_read(field-> | |
| 198 | 198 | break; |
| 199 | 199 | default: |
| 200 | 200 | mj_input = 0; |
| r11508 | r11509 | |
|---|---|---|
| 2659 | 2659 | state->m_led_lamp=1; |
| 2660 | 2660 | } |
| 2661 | 2661 | |
| 2662 | //static DRIVER_INIT (m_frkstn) | |
| 2663 | //{ | |
| 2664 | // mpu4_state *state = machine.driver_data<mpu4_state>(); | |
| 2665 | // state->m_reel_mux=STANDARD_REEL; | |
| 2666 | // state->m_reels = 4; | |
| 2667 | // | |
| 2668 | // // setup 4 default 96 half step reels with the mux board | |
| 2669 | // mpu4_config_common_reels(machine,4); | |
| 2670 | // | |
| 2671 | // //This is a Crystal ROM, needs UPD chip and Project Amber's ROM swizzle. | |
| 2672 | //} | |
| 2662 | static DRIVER_INIT (m_frkstn) | |
| 2663 | { | |
| 2664 | mpu4_state *state = machine.driver_data<mpu4_state>(); | |
| 2665 | state->m_reel_mux=STANDARD_REEL; | |
| 2666 | state->m_reels = 4; | |
| 2673 | 2667 | |
| 2668 | // setup 4 default 96 half step reels with the mux board | |
| 2669 | mpu4_config_common_reels(machine,4); | |
| 2670 | ||
| 2671 | //This is a Crystal ROM, needs UPD chip and Project Amber's ROM swizzle. | |
| 2672 | } | |
| 2673 | ||
| 2674 | 2674 | /* generate a 50 Hz signal (based on an RC time) */ |
| 2675 | 2675 | static TIMER_DEVICE_CALLBACK( gen_50hz ) |
| 2676 | 2676 | { |
| r11508 | r11509 | |
| 2779 | 2779 | AM_RANGE(0x1000, 0xffff) AM_ROMBANK("bank1") // 64k paged ROM (4 pages) |
| 2780 | 2780 | ADDRESS_MAP_END |
| 2781 | 2781 | |
| 2782 | //static ADDRESS_MAP_START( mpu4_crystal_map, AS_PROGRAM, 8 ) | |
| 2783 | // AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") | |
| 2784 | // | |
| 2785 | // AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w) // write bank (rom page select) | |
| 2786 | // | |
| 2787 | // AM_RANGE(0x0858, 0x0858) AM_WRITE(bankswitch_w) // write bank (rom page select) | |
| 2788 | // AM_RANGE(0x0878, 0x0878) AM_WRITE(bankset_w) // write bank (rom page select) | |
| 2789 | // | |
| 2790 | //// AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers | |
| 2791 | // | |
| 2792 | // AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */ | |
| 2793 | // | |
| 2794 | // AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE_MODERN("pia_ic3", pia6821_device, read, write) /* PIA6821 IC3 */ | |
| 2795 | // AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE_MODERN("pia_ic4", pia6821_device, read, write) /* PIA6821 IC4 */ | |
| 2796 | // AM_RANGE(0x0c00, 0x0c03) AM_DEVREADWRITE_MODERN("pia_ic5", pia6821_device, read, write) /* PIA6821 IC5 */ | |
| 2797 | // AM_RANGE(0x0d00, 0x0d03) AM_DEVREADWRITE_MODERN("pia_ic6", pia6821_device, read, write) /* PIA6821 IC6 */ | |
| 2798 | // AM_RANGE(0x0e00, 0x0e03) AM_DEVREADWRITE_MODERN("pia_ic7", pia6821_device, read, write) /* PIA6821 IC7 */ | |
| 2799 | // AM_RANGE(0x0f00, 0x0f03) AM_DEVREADWRITE_MODERN("pia_ic8", pia6821_device, read, write) /* PIA6821 IC8 */ | |
| 2800 | // | |
| 2801 | // AM_RANGE(0x1000, 0xffff) AM_ROMBANK("bank1") // 64k paged ROM (4 pages) | |
| 2802 | //ADDRESS_MAP_END */ | |
| 2782 | static ADDRESS_MAP_START( mpu4_crystal_map, AS_PROGRAM, 8 ) | |
| 2783 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram") | |
| 2784 | AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w) // write bank (rom page select) | |
| 2785 | AM_RANGE(0x0858, 0x0858) AM_WRITE(bankswitch_w) // write bank (rom page select) | |
| 2786 | AM_RANGE(0x0878, 0x0878) AM_WRITE(bankset_w) // write bank (rom page select) | |
| 2787 | // AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) //Runs hoppers | |
| 2788 | AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */ | |
| 2789 | AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE_MODERN("pia_ic3", pia6821_device, read, write) /* PIA6821 IC3 */ | |
| 2790 | AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE_MODERN("pia_ic4", pia6821_device, read, write) /* PIA6821 IC4 */ | |
| 2791 | AM_RANGE(0x0c00, 0x0c03) AM_DEVREADWRITE_MODERN("pia_ic5", pia6821_device, read, write) /* PIA6821 IC5 */ | |
| 2792 | AM_RANGE(0x0d00, 0x0d03) AM_DEVREADWRITE_MODERN("pia_ic6", pia6821_device, read, write) /* PIA6821 IC6 */ | |
| 2793 | AM_RANGE(0x0e00, 0x0e03) AM_DEVREADWRITE_MODERN("pia_ic7", pia6821_device, read, write) /* PIA6821 IC7 */ | |
| 2794 | AM_RANGE(0x0f00, 0x0f03) AM_DEVREADWRITE_MODERN("pia_ic8", pia6821_device, read, write) /* PIA6821 IC8 */ | |
| 2795 | AM_RANGE(0x1000, 0xffff) AM_ROMBANK("bank1") // 64k paged ROM (4 pages) | |
| 2796 | ADDRESS_MAP_END | |
| 2803 | 2797 | |
| 2804 | 2798 | |
| 2805 | 2799 | static ADDRESS_MAP_START( dutch_memmap, AS_PROGRAM, 8 ) |
| r11508 | r11509 | |
| 2904 | 2898 | MCFG_CPU_PROGRAM_MAP(mpu4_bwb_map) // setup read and write memorymap |
| 2905 | 2899 | MACHINE_CONFIG_END |
| 2906 | 2900 | |
| 2907 | //static MACHINE_CONFIG_DERIVED(mpu4crys, mpu4mod2 ) | |
| 2908 | // MCFG_CPU_MODIFY("maincpu") | |
| 2909 | // MCFG_CPU_PROGRAM_MAP(mpu4_crystal_map) // setup read and write memorymap | |
| 2910 | // | |
| 2911 | // MCFG_SOUND_ADD("upd", UPD7759, UPD7759_STANDARD_CLOCK) | |
| 2912 | // MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 2913 | //MACHINE_CONFIG_END | |
| 2901 | static MACHINE_CONFIG_DERIVED(mpu4crys, mpu4mod2 ) | |
| 2902 | MCFG_CPU_MODIFY("maincpu") | |
| 2903 | MCFG_CPU_PROGRAM_MAP(mpu4_crystal_map) // setup read and write memorymap | |
| 2914 | 2904 | |
| 2905 | MCFG_SOUND_ADD("upd", UPD7759, UPD7759_STANDARD_CLOCK) | |
| 2906 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 2907 | MACHINE_CONFIG_END | |
| 2915 | 2908 | |
| 2916 | 2909 | |
| 2910 | ||
| 2917 | 2911 | ROM_START( m_oldtmr ) |
| 2918 | 2912 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 2919 | 2913 | ROM_LOAD( "dot11.bin", 0x00000, 0x10000, CRC(da095666) SHA1(bc7654dc9da1f830a43f925db8079f27e18bb61e)) |
| r11508 | r11509 | |
| 2987 | 2981 | GAMEL(198?, m_gmball,0, mod4yam, gamball, m_gmball, ROT0, "Barcrest", "Gamball", GAME_REQUIRES_ARTWORK|GAME_MECHANICAL,layout_gamball )//Mechanical ball launcher |
| 2988 | 2982 | GAMEL(198?, m_grtecp,0, mod4oki, mpu4, m_grtecp, ROT0, "Barcrest", "Andy's Great Escape", GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK,layout_mpu4ext )//5 reel meter mux |
| 2989 | 2983 | GAME(199?, m_blsbys,0, bwboki, mpu4, m_blsbys, ROT0, "Barcrest", "Blues Boys (Version 6)", GAME_NOT_WORKING|GAME_REQUIRES_ARTWORK ) |
| 2990 | ||
| 2984 | ||
| 2991 | 2985 | |
| 2992 | 2986 | //SWP |
| 2993 | 2987 | GAMEL(1989?,connect4, 0, mpu4mod2, connect4, connect4, ROT0, "Dolbeck Systems","Connect 4",GAME_IMPERFECT_GRAPHICS|GAME_REQUIRES_ARTWORK,layout_connect4 ) |
| r11508 | r11509 | |
|---|---|---|
| 274 | 274 | |
| 275 | 275 | static CUSTOM_INPUT( wwfsstar_vblank_r ) |
| 276 | 276 | { |
| 277 | wwfsstar_state *state = field-> | |
| 277 | wwfsstar_state *state = field-> | |
| 278 | 278 | |
| 279 | 279 | return state->m_vblank; |
| 280 | 280 | } |
| r11508 | r11509 | |
|---|---|---|
| 319 | 319 | |
| 320 | 320 | static CUSTOM_INPUT( seawolf_erase_input_r ) |
| 321 | 321 | { |
| 322 | return input_port_read(field->port->machine(), SEAWOLF_ERASE_SW_PORT_TAG) & | |
| 323 | input_port_read(field->port->machine(), SEAWOLF_ERASE_DIP_PORT_TAG); | |
| 322 | return input_port_read(field->machine(), SEAWOLF_ERASE_SW_PORT_TAG) & | |
| 323 | input_port_read(field->machine(), SEAWOLF_ERASE_DIP_PORT_TAG); | |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
| r11508 | r11509 | |
| 559 | 559 | |
| 560 | 560 | static CUSTOM_INPUT( tornbase_hit_left_input_r ) |
| 561 | 561 | { |
| 562 | return input_port_read(field-> | |
| 562 | return input_port_read(field-> | |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | |
| r11508 | r11509 | |
| 567 | 567 | { |
| 568 | 568 | UINT32 ret; |
| 569 | 569 | |
| 570 | switch (tornbase_get_cabinet_type(field-> | |
| 570 | switch (tornbase_get_cabinet_type(field-> | |
| 571 | 571 | { |
| 572 | 572 | case TORNBASE_CAB_TYPE_UPRIGHT_OLD: |
| 573 | ret = input_port_read(field-> | |
| 573 | ret = input_port_read(field-> | |
| 574 | 574 | break; |
| 575 | 575 | |
| 576 | 576 | case TORNBASE_CAB_TYPE_UPRIGHT_NEW: |
| 577 | 577 | case TORNBASE_CAB_TYPE_COCKTAIL: |
| 578 | 578 | default: |
| 579 | ret = input_port_read(field-> | |
| 579 | ret = input_port_read(field-> | |
| 580 | 580 | break; |
| 581 | 581 | } |
| 582 | 582 | |
| r11508 | r11509 | |
| 588 | 588 | { |
| 589 | 589 | UINT32 ret; |
| 590 | 590 | |
| 591 | switch (tornbase_get_cabinet_type(field-> | |
| 591 | switch (tornbase_get_cabinet_type(field-> | |
| 592 | 592 | { |
| 593 | 593 | case TORNBASE_CAB_TYPE_UPRIGHT_OLD: |
| 594 | 594 | case TORNBASE_CAB_TYPE_UPRIGHT_NEW: |
| 595 | ret = input_port_read(field-> | |
| 595 | ret = input_port_read(field-> | |
| 596 | 596 | break; |
| 597 | 597 | |
| 598 | 598 | case TORNBASE_CAB_TYPE_COCKTAIL: |
| 599 | 599 | default: |
| 600 | ret = input_port_read(field-> | |
| 600 | ret = input_port_read(field-> | |
| 601 | 601 | break; |
| 602 | 602 | } |
| 603 | 603 | |
| r11508 | r11509 | |
| 607 | 607 | |
| 608 | 608 | static CUSTOM_INPUT( tornbase_pitch_right_input_r ) |
| 609 | 609 | { |
| 610 | return input_port_read(field-> | |
| 610 | return input_port_read(field-> | |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | |
| 614 | 614 | static CUSTOM_INPUT( tornbase_score_input_r ) |
| 615 | 615 | { |
| 616 | return input_port_read(field->port->machine(), TORNBASE_SCORE_SW_PORT_TAG) & | |
| 617 | input_port_read(field->port->machine(), TORNBASE_SCORE_DIP_PORT_TAG); | |
| 616 | return input_port_read(field->machine(), TORNBASE_SCORE_SW_PORT_TAG) & | |
| 617 | input_port_read(field->machine(), TORNBASE_SCORE_DIP_PORT_TAG); | |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | |
| r11508 | r11509 | |
| 1194 | 1194 | |
| 1195 | 1195 | static CUSTOM_INPUT( desertgu_gun_input_r ) |
| 1196 | 1196 | { |
| 1197 | mw8080bw_state *state = field-> | |
| 1197 | mw8080bw_state *state = field-> | |
| 1198 | 1198 | UINT32 ret; |
| 1199 | 1199 | |
| 1200 | 1200 | if (state->m_desertgun_controller_select) |
| 1201 | ret = input_port_read(field-> | |
| 1201 | ret = input_port_read(field-> | |
| 1202 | 1202 | else |
| 1203 | ret = input_port_read(field-> | |
| 1203 | ret = input_port_read(field-> | |
| 1204 | 1204 | |
| 1205 | 1205 | return ret; |
| 1206 | 1206 | } |
| r11508 | r11509 | |
| 1208 | 1208 | |
| 1209 | 1209 | static CUSTOM_INPUT( desertgu_dip_sw_0_1_r ) |
| 1210 | 1210 | { |
| 1211 | mw8080bw_state *state = field-> | |
| 1211 | mw8080bw_state *state = field-> | |
| 1212 | 1212 | UINT32 ret; |
| 1213 | 1213 | |
| 1214 | 1214 | if (state->m_desertgun_controller_select) |
| 1215 | ret = input_port_read(field-> | |
| 1215 | ret = input_port_read(field-> | |
| 1216 | 1216 | else |
| 1217 | ret = input_port_read(field-> | |
| 1217 | ret = input_port_read(field-> | |
| 1218 | 1218 | |
| 1219 | 1219 | return ret; |
| 1220 | 1220 | } |
| r11508 | r11509 | |
| 1327 | 1327 | { |
| 1328 | 1328 | UINT32 ret; |
| 1329 | 1329 | |
| 1330 | if (input_port_read(field->port->machine(), DPLAY_CAB_TYPE_PORT_TAG) == DPLAY_CAB_TYPE_UPRIGHT) | |
| 1331 | ret = input_port_read(field->port->machine(), DPLAY_L_PITCH_PORT_TAG); | |
| 1330 | if (input_port_read(field->machine(), DPLAY_CAB_TYPE_PORT_TAG) == DPLAY_CAB_TYPE_UPRIGHT) | |
| 1331 | ret = input_port_read(field->machine(), DPLAY_L_PITCH_PORT_TAG); | |
| 1332 | 1332 | else |
| 1333 | ret = input_port_read(field-> | |
| 1333 | ret = input_port_read(field-> | |
| 1334 | 1334 | |
| 1335 | 1335 | return ret; |
| 1336 | 1336 | } |
| r11508 | r11509 | |
| 1338 | 1338 | |
| 1339 | 1339 | static CUSTOM_INPUT( dplay_pitch_right_input_r ) |
| 1340 | 1340 | { |
| 1341 | return input_port_read(field-> | |
| 1341 | return input_port_read(field-> | |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | |
| r11508 | r11509 | |
| 1716 | 1716 | |
| 1717 | 1717 | static CUSTOM_INPUT( clowns_controller_r ) |
| 1718 | 1718 | { |
| 1719 | mw8080bw_state *state = field-> | |
| 1719 | mw8080bw_state *state = field-> | |
| 1720 | 1720 | UINT32 ret; |
| 1721 | 1721 | |
| 1722 | 1722 | if (state->m_clowns_controller_select) |
| 1723 | 1723 | { |
| 1724 | ret = input_port_read(field-> | |
| 1724 | ret = input_port_read(field-> | |
| 1725 | 1725 | } |
| 1726 | 1726 | else |
| 1727 | 1727 | { |
| 1728 | ret = input_port_read(field-> | |
| 1728 | ret = input_port_read(field-> | |
| 1729 | 1729 | } |
| 1730 | 1730 | |
| 1731 | 1731 | return ret; |
| r11508 | r11509 | |
| 2548 | 2548 | |
| 2549 | 2549 | static CUSTOM_INPUT( invaders_coin_input_r ) |
| 2550 | 2550 | { |
| 2551 | UINT32 ret = input_port_read(field-> | |
| 2551 | UINT32 ret = input_port_read(field-> | |
| 2552 | 2552 | |
| 2553 | coin_counter_w(field-> | |
| 2553 | coin_counter_w(field-> | |
| 2554 | 2554 | |
| 2555 | 2555 | return ret; |
| 2556 | 2556 | } |
| r11508 | r11509 | |
| 2563 | 2563 | /* upright PCB : switches visible |
| 2564 | 2564 | cocktail PCB: HI */ |
| 2565 | 2565 | |
| 2566 | if (invaders_is_cabinet_cocktail(field-> | |
| 2566 | if (invaders_is_cabinet_cocktail(field-> | |
| 2567 | 2567 | ret = 0x03; |
| 2568 | 2568 | else |
| 2569 | ret = input_port_read(field-> | |
| 2569 | ret = input_port_read(field-> | |
| 2570 | 2570 | |
| 2571 | 2571 | return ret; |
| 2572 | 2572 | } |
| r11508 | r11509 | |
| 2579 | 2579 | /* upright PCB : switch visible |
| 2580 | 2580 | cocktail PCB: HI */ |
| 2581 | 2581 | |
| 2582 | if (invaders_is_cabinet_cocktail(field-> | |
| 2582 | if (invaders_is_cabinet_cocktail(field-> | |
| 2583 | 2583 | ret = 0x01; |
| 2584 | 2584 | else |
| 2585 | ret = input_port_read(field-> | |
| 2585 | ret = input_port_read(field-> | |
| 2586 | 2586 | |
| 2587 | 2587 | return ret; |
| 2588 | 2588 | } |
| r11508 | r11509 | |
| 2595 | 2595 | /* upright PCB : P1 controls |
| 2596 | 2596 | cocktail PCB: HI */ |
| 2597 | 2597 | |
| 2598 | if (invaders_is_cabinet_cocktail(field-> | |
| 2598 | if (invaders_is_cabinet_cocktail(field-> | |
| 2599 | 2599 | ret = 0x07; |
| 2600 | 2600 | else |
| 2601 | ret = input_port_read(field-> | |
| 2601 | ret = input_port_read(field-> | |
| 2602 | 2602 | |
| 2603 | 2603 | return ret; |
| 2604 | 2604 | } |
| r11508 | r11509 | |
| 2606 | 2606 | |
| 2607 | 2607 | CUSTOM_INPUT( invaders_in1_control_r ) |
| 2608 | 2608 | { |
| 2609 | return input_port_read(field-> | |
| 2609 | return input_port_read(field-> | |
| 2610 | 2610 | } |
| 2611 | 2611 | |
| 2612 | 2612 | |
| r11508 | r11509 | |
| 2617 | 2617 | /* upright PCB : P1 controls |
| 2618 | 2618 | cocktail PCB: P2 controls */ |
| 2619 | 2619 | |
| 2620 | if (invaders_is_cabinet_cocktail(field->port->machine())) | |
| 2621 | ret = input_port_read(field->port->machine(), INVADERS_P2_CONTROL_PORT_TAG); | |
| 2620 | if (invaders_is_cabinet_cocktail(field->machine())) | |
| 2621 | ret = input_port_read(field->machine(), INVADERS_P2_CONTROL_PORT_TAG); | |
| 2622 | 2622 | else |
| 2623 | ret = input_port_read(field-> | |
| 2623 | ret = input_port_read(field-> | |
| 2624 | 2624 | |
| 2625 | 2625 | return ret; |
| 2626 | 2626 | } |
| r11508 | r11509 | |
| 2755 | 2755 | |
| 2756 | 2756 | static CUSTOM_INPUT( blueshrk_coin_input_r ) |
| 2757 | 2757 | { |
| 2758 | UINT32 ret = input_port_read(field-> | |
| 2758 | UINT32 ret = input_port_read(field-> | |
| 2759 | 2759 | |
| 2760 | coin_counter_w(field-> | |
| 2760 | coin_counter_w(field-> | |
| 2761 | 2761 | |
| 2762 | 2762 | return ret; |
| 2763 | 2763 | } |
| r11508 | r11509 | |
|---|---|---|
| 525 | 525 | |
| 526 | 526 | static INPUT_CHANGED( coin_inserted_irq_hi ) |
| 527 | 527 | { |
| 528 | btime_state *state = field-> | |
| 528 | btime_state *state = field-> | |
| 529 | 529 | |
| 530 | 530 | if (newval) |
| 531 | 531 | device_set_input_line(state->m_maincpu, 0, HOLD_LINE); |
| r11508 | r11509 | |
| 533 | 533 | |
| 534 | 534 | static INPUT_CHANGED( coin_inserted_irq_lo ) |
| 535 | 535 | { |
| 536 | btime_state *state = field-> | |
| 536 | btime_state *state = field-> | |
| 537 | 537 | |
| 538 | 538 | if (!newval) |
| 539 | 539 | device_set_input_line(state->m_maincpu, 0, HOLD_LINE); |
| r11508 | r11509 | |
| 541 | 541 | |
| 542 | 542 | static INPUT_CHANGED( coin_inserted_nmi_lo ) |
| 543 | 543 | { |
| 544 | btime_state *state = field-> | |
| 544 | btime_state *state = field-> | |
| 545 | 545 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| 546 | 546 | } |
| 547 | 547 |
| r11508 | r11509 | |
|---|---|---|
| 222 | 222 | |
| 223 | 223 | static INPUT_CHANGED( left_coin_inserted ) |
| 224 | 224 | { |
| 225 | m14_state *state = field-> | |
| 225 | m14_state *state = field-> | |
| 226 | 226 | /* left coin insertion causes a rst6.5 (vector 0x34) */ |
| 227 | 227 | if (newval) |
| 228 | 228 | device_set_input_line(state->m_maincpu, I8085_RST65_LINE, HOLD_LINE); |
| r11508 | r11509 | |
| 230 | 230 | |
| 231 | 231 | static INPUT_CHANGED( right_coin_inserted ) |
| 232 | 232 | { |
| 233 | m14_state *state = field-> | |
| 233 | m14_state *state = field-> | |
| 234 | 234 | /* right coin insertion causes a rst5.5 (vector 0x2c) */ |
| 235 | 235 | if (newval) |
| 236 | 236 | device_set_input_line(state->m_maincpu, I8085_RST55_LINE, HOLD_LINE); |
| r11508 | r11509 | |
|---|---|---|
| 134 | 134 | |
| 135 | 135 | static CUSTOM_INPUT( ninjakun_io_A002_ctrl_r ) |
| 136 | 136 | { |
| 137 | nova2001_state *state = field-> | |
| 137 | nova2001_state *state = field-> | |
| 138 | 138 | return state->m_ninjakun_io_a002_ctrl; |
| 139 | 139 | } |
| 140 | 140 |
| r11508 | r11509 | |
|---|---|---|
| 409 | 409 | |
| 410 | 410 | static CUSTOM_INPUT( analog_bit_r ) |
| 411 | 411 | { |
| 412 | gaelco3d_state *state = field-> | |
| 412 | gaelco3d_state *state = field-> | |
| 413 | 413 | int which = (FPTR)param; |
| 414 | 414 | return (state->m_analog_ports[which] >> 7) & 0x01; |
| 415 | 415 | } |
| r11508 | r11509 | |
|---|---|---|
| 333 | 333 | |
| 334 | 334 | static CUSTOM_INPUT( marvins_sound_busy ) |
| 335 | 335 | { |
| 336 | snk_state *state = field-> | |
| 336 | snk_state *state = field-> | |
| 337 | 337 | |
| 338 | 338 | return state->m_marvins_sound_busy_flag; |
| 339 | 339 | } |
| r11508 | r11509 | |
| 500 | 500 | |
| 501 | 501 | static CUSTOM_INPUT( snk_sound_busy ) |
| 502 | 502 | { |
| 503 | snk_state *state = field-> | |
| 503 | snk_state *state = field-> | |
| 504 | 504 | |
| 505 | 505 | return (state->m_sound_status & 4) ? 1 : 0; |
| 506 | 506 | } |
| r11508 | r11509 | |
| 752 | 752 | |
| 753 | 753 | static CUSTOM_INPUT( gwar_rotary ) |
| 754 | 754 | { |
| 755 | snk_state *state = field-> | |
| 755 | snk_state *state = field-> | |
| 756 | 756 | static const char *const ports[] = { "P1ROT", "P2ROT" }; |
| 757 | 757 | int which = (int)(FPTR)param; |
| 758 | int value = input_port_read(field-> | |
| 758 | int value = input_port_read(field-> | |
| 759 | 759 | |
| 760 | 760 | if ((state->m_last_value[which] == 0x5 && value == 0x6) || (state->m_last_value[which] == 0x6 && value == 0x5)) |
| 761 | 761 | { |
| r11508 | r11509 | |
| 770 | 770 | |
| 771 | 771 | static CUSTOM_INPUT( gwarb_rotary ) |
| 772 | 772 | { |
| 773 | if (input_port_read(field-> | |
| 773 | if (input_port_read(field-> | |
| 774 | 774 | { |
| 775 | return gwar_rotary(field, param); | |
| 775 | return gwar_rotary(device, field, param); | |
| 776 | 776 | } |
| 777 | 777 | else |
| 778 | 778 | { |
| r11508 | r11509 | |
| 819 | 819 | |
| 820 | 820 | static CUSTOM_INPUT( countryc_trackball_x ) |
| 821 | 821 | { |
| 822 | snk_state *state = field-> | |
| 822 | snk_state *state = field-> | |
| 823 | 823 | |
| 824 | return input_port_read(field-> | |
| 824 | return input_port_read(field-> | |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | static CUSTOM_INPUT( countryc_trackball_y ) |
| 828 | 828 | { |
| 829 | snk_state *state = field-> | |
| 829 | snk_state *state = field-> | |
| 830 | 830 | |
| 831 | return input_port_read(field-> | |
| 831 | return input_port_read(field-> | |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | |
| r11508 | r11509 | |
| 841 | 841 | switch (bit_mask) |
| 842 | 842 | { |
| 843 | 843 | case 0x01: /* older games : "Occurence" Dip Switch (DSW2:1) */ |
| 844 | return ((input_port_read(field-> | |
| 844 | return ((input_port_read(field-> | |
| 845 | 845 | case 0xc0: /* older games : "Bonus Life" Dip Switches (DSW1:7,8) */ |
| 846 | return ((input_port_read(field-> | |
| 846 | return ((input_port_read(field-> | |
| 847 | 847 | |
| 848 | 848 | case 0x04: /* later games : "Occurence" Dip Switch (DSW1:3) */ |
| 849 | return ((input_port_read(field-> | |
| 849 | return ((input_port_read(field-> | |
| 850 | 850 | case 0x30: /* later games : "Bonus Life" Dip Switches (DSW2:5,6) */ |
| 851 | return ((input_port_read(field-> | |
| 851 | return ((input_port_read(field-> | |
| 852 | 852 | |
| 853 | 853 | default: |
| 854 | 854 | logerror("snk_bonus_r : invalid %02X bit_mask\n",bit_mask); |
| r11508 | r11509 | |
|---|---|---|
| 414 | 414 | |
| 415 | 415 | static INPUT_CHANGED( panic_coin_inserted ) |
| 416 | 416 | { |
| 417 | panic_sound_output_w(field-> | |
| 417 | panic_sound_output_w(field-> | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | static INPUT_PORTS_START( panic ) |
| r11508 | r11509 | |
| 475 | 475 | |
| 476 | 476 | static INPUT_CHANGED( cosmica_coin_inserted ) |
| 477 | 477 | { |
| 478 | cputag_set_input_line(field-> | |
| 478 | cputag_set_input_line(field-> | |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | static INPUT_PORTS_START( cosmica ) |
| r11508 | r11509 | |
| 530 | 530 | |
| 531 | 531 | static INPUT_CHANGED( cosmicg_coin_inserted ) |
| 532 | 532 | { |
| 533 | cputag_set_input_line_and_vector(field-> | |
| 533 | cputag_set_input_line_and_vector(field-> | |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | static INPUT_PORTS_START( cosmicg ) |
| r11508 | r11509 | |
| 577 | 577 | |
| 578 | 578 | static INPUT_CHANGED( coin_inserted_irq0 ) |
| 579 | 579 | { |
| 580 | cputag_set_input_line(field-> | |
| 580 | cputag_set_input_line(field-> | |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | static INPUT_CHANGED( coin_inserted_nmi ) |
| 584 | 584 | { |
| 585 | cputag_set_input_line(field-> | |
| 585 | cputag_set_input_line(field-> | |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | static INPUT_PORTS_START( magspot ) |
| r11508 | r11509 | |
|---|---|---|
| 460 | 460 | |
| 461 | 461 | static CUSTOM_INPUT( _1c00000_r ) |
| 462 | 462 | { |
| 463 | model2_state *state = field->port->machine().driver_data<model2_state>(); | |
| 464 | UINT32 ret = input_port_read(field->port->machine(), "IN0"); | |
| 463 | model2_state *state = field->machine().driver_data<model2_state>(); | |
| 464 | UINT32 ret = input_port_read(field->machine(), "IN0"); | |
| 465 | 465 | |
| 466 | 466 | if(state->m_ctrlmode == 0) |
| 467 | 467 | { |
| r11508 | r11509 | |
| 470 | 470 | else |
| 471 | 471 | { |
| 472 | 472 | ret &= ~0x0030; |
| 473 | return ret | 0x00d0 | (eeprom_read_bit(field-> | |
| 473 | return ret | 0x00d0 | (eeprom_read_bit(field-> | |
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | static CUSTOM_INPUT( _1c0001c_r ) |
| 478 | 478 | { |
| 479 | model2_state *state = field-> | |
| 479 | model2_state *state = field-> | |
| 480 | 480 | UINT32 iptval = 0x00ff; |
| 481 | 481 | if(state->m_analog_channel < 4) |
| 482 | 482 | { |
| 483 | 483 | static const char *const ports[] = { "ANA0", "ANA1", "ANA2", "ANA3" }; |
| 484 | iptval = input_port_read_safe(field-> | |
| 484 | iptval = input_port_read_safe(field-> | |
| 485 | 485 | ++state->m_analog_channel; |
| 486 | 486 | } |
| 487 | 487 | return iptval; |
| r11508 | r11509 | |
|---|---|---|
| 168 | 168 | int result; |
| 169 | 169 | |
| 170 | 170 | /* PORT_SERVICE_NO_TOGGLE */ |
| 171 | result = (input_port_read(field-> | |
| 171 | result = (input_port_read(field-> | |
| 172 | 172 | |
| 173 | 173 | return ~result; |
| 174 | 174 | } |
| r11508 | r11509 | |
| 178 | 178 | int result; |
| 179 | 179 | |
| 180 | 180 | /* IPT_COIN1 */ |
| 181 | result = ((input_port_read(field-> | |
| 181 | result = ((input_port_read(field-> | |
| 182 | 182 | /* IPT_COIN2 */ |
| 183 | result |= ((input_port_read(field-> | |
| 183 | result |= ((input_port_read(field-> | |
| 184 | 184 | /* IPT_START1 */ |
| 185 | result |= ((input_port_read(field-> | |
| 185 | result |= ((input_port_read(field-> | |
| 186 | 186 | /* IPT_START2 */ |
| 187 | result |= ((input_port_read(field-> | |
| 187 | result |= ((input_port_read(field-> | |
| 188 | 188 | /* PORT_SERVICE_NO_TOGGLE */ |
| 189 | result |= ((input_port_read(field-> | |
| 189 | result |= ((input_port_read(field-> | |
| 190 | 190 | |
| 191 | 191 | return ~result; |
| 192 | 192 | } |
| r11508 | r11509 | |
|---|---|---|
| 475 | 475 | static CUSTOM_INPUT( ckongs_coinage_r ) |
| 476 | 476 | { |
| 477 | 477 | int bit_mask = (FPTR)param; |
| 478 | return (input_port_read(field-> | |
| 478 | return (input_port_read(field-> | |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 |
| r11508 | r11509 | |
|---|---|---|
| 288 | 288 | static CUSTOM_INPUT(controls_r) |
| 289 | 289 | { |
| 290 | 290 | int data = 7; |
| 291 | switch(input_port_read(field-> | |
| 291 | switch(input_port_read(field-> | |
| 292 | 292 | { |
| 293 | 293 | case 0x01: data = 1; break; |
| 294 | 294 | case 0x02: data = 2; break; |
| r11508 | r11509 | |
|---|---|---|
| 57 | 57 | |
| 58 | 58 | static CUSTOM_INPUT( battlex_in0_b4_r ) |
| 59 | 59 | { |
| 60 | battlex_state *state = field-> | |
| 60 | battlex_state *state = field-> | |
| 61 | 61 | UINT32 ret = state->m_in0_b4; |
| 62 | 62 | if (state->m_in0_b4) |
| 63 | 63 | { |
| 64 | cputag_set_input_line(field-> | |
| 64 | cputag_set_input_line(field-> | |
| 65 | 65 | state->m_in0_b4 = 0; |
| 66 | 66 | } |
| 67 | 67 |
| r11508 | r11509 | |
|---|---|---|
| 113 | 113 | |
| 114 | 114 | static CUSTOM_INPUT( snes_mouse_speed_input ) |
| 115 | 115 | { |
| 116 | snes_state *state = field-> | |
| 116 | snes_state *state = field-> | |
| 117 | 117 | int port = (FPTR)param; |
| 118 | 118 | |
| 119 | 119 | if (snes_ram[OLDJOY1] & 0x1) |
| r11508 | r11509 | |
| 128 | 128 | |
| 129 | 129 | static CUSTOM_INPUT( snes_superscope_offscreen_input ) |
| 130 | 130 | { |
| 131 | snes_state *state = field-> | |
| 131 | snes_state *state = field-> | |
| 132 | 132 | int port = (FPTR)param; |
| 133 | 133 | static const char *const portnames[2][3] = |
| 134 | 134 | { |
| r11508 | r11509 | |
| 136 | 136 | { "SUPERSCOPE2", "SUPERSCOPE2_X", "SUPERSCOPE2_Y" }, |
| 137 | 137 | }; |
| 138 | 138 | |
| 139 | INT16 x = input_port_read(field->port->machine(), portnames[port][1]); | |
| 140 | INT16 y = input_port_read(field->port->machine(), portnames[port][2]); | |
| 139 | INT16 x = input_port_read(field->machine(), portnames[port][1]); | |
| 140 | INT16 y = input_port_read(field->machine(), portnames[port][2]); | |
| 141 | 141 | |
| 142 | 142 | /* these are the theoretical boundaries, but we currently are always onscreen... */ |
| 143 | 143 | if (x < 0 || x >= SNES_SCR_WIDTH || y < 0 || y >= snes_ppu.beam.last_visible_line) |
| r11508 | r11509 | |
|---|---|---|
| 713 | 713 | |
| 714 | 714 | static CUSTOM_INPUT( c2map_r ) |
| 715 | 715 | { |
| 716 | toaplan2_state *state = field-> | |
| 716 | toaplan2_state *state = field-> | |
| 717 | 717 | |
| 718 | 718 | // For Teki Paki hardware |
| 719 | 719 | // bit 4 high signifies secondary CPU is ready |
| r11508 | r11509 | |
|---|---|---|
| 99 | 99 | |
| 100 | 100 | static INPUT_CHANGED( coin_inserted ) |
| 101 | 101 | { |
| 102 | cinemat_state *state = field-> | |
| 102 | cinemat_state *state = field-> | |
| 103 | 103 | /* on the falling edge of a new coin, set the coin_detected flag */ |
| 104 | 104 | if (newval == 0) |
| 105 | 105 | state->m_coin_detected = 1; |
| r11508 | r11509 | |
|---|---|---|
| 70 | 70 | |
| 71 | 71 | static CUSTOM_INPUT( pc3092_r ) |
| 72 | 72 | { |
| 73 | crbaloon_state *state = field-> | |
| 73 | crbaloon_state *state = field-> | |
| 74 | 74 | UINT32 ret; |
| 75 | 75 | |
| 76 | 76 | /* enable coin & start input? Wild guess!!! */ |
| 77 | 77 | if (state->m_pc3092_data[1] & 0x02) |
| 78 | ret = input_port_read(field-> | |
| 78 | ret = input_port_read(field-> | |
| 79 | 79 | else |
| 80 | 80 | ret = 0x00; |
| 81 | 81 | |
| 82 | if (LOG_PC3092) logerror("%s: read PC3092 = 0x%02x\n", field-> | |
| 82 | if (LOG_PC3092) logerror("%s: read PC3092 = 0x%02x\n", field-> | |
| 83 | 83 | |
| 84 | 84 | return ret; |
| 85 | 85 | } |
| r11508 | r11509 | |
|---|---|---|
| 72 | 72 | |
| 73 | 73 | CUSTOM_INPUT( btoads_state::static_main_to_sound_r ) |
| 74 | 74 | { |
| 75 | return field-> | |
| 75 | return field-> | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | CUSTOM_INPUT( btoads_state::static_sound_to_main_r ) |
| 80 | 80 | { |
| 81 | return field-> | |
| 81 | return field-> | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 |
| r11508 | r11509 | |
|---|---|---|
| 78 | 78 | */ |
| 79 | 79 | static INPUT_CHANGED( left_coin_inserted ) |
| 80 | 80 | { |
| 81 | ladybug_state *state = field-> | |
| 81 | ladybug_state *state = field-> | |
| 82 | 82 | |
| 83 | 83 | if(newval) |
| 84 | 84 | device_set_input_line(state->m_maincpu, 0, ASSERT_LINE); |
| r11508 | r11509 | |
| 86 | 86 | |
| 87 | 87 | static INPUT_CHANGED( right_coin_inserted ) |
| 88 | 88 | { |
| 89 | ladybug_state *state = field-> | |
| 89 | ladybug_state *state = field-> | |
| 90 | 90 | |
| 91 | 91 | if(newval) |
| 92 | 92 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, PULSE_LINE); |
| r11508 | r11509 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | static CUSTOM_INPUT( vicdual_read_coin_status ) |
| 85 | 85 | { |
| 86 | vicdual_state *state = field-> | |
| 86 | vicdual_state *state = field-> | |
| 87 | 87 | return state->m_coin_status; |
| 88 | 88 | } |
| 89 | 89 | |
| r11508 | r11509 | |
| 93 | 93 | if (newval && !oldval) |
| 94 | 94 | { |
| 95 | 95 | /* increment the coin counter */ |
| 96 | coin_counter_w(field->port->machine(), 0, 1); | |
| 97 | coin_counter_w(field->port->machine(), 0, 0); | |
| 96 | coin_counter_w(field->machine(), 0, 1); | |
| 97 | coin_counter_w(field->machine(), 0, 0); | |
| 98 | 98 | |
| 99 | cputag_set_input_line(field-> | |
| 99 | cputag_set_input_line(field-> | |
| 100 | 100 | |
| 101 | 101 | /* simulate the coin switch being closed for a while */ |
| 102 | field-> | |
| 102 | field-> | |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| r11508 | r11509 | |
| 137 | 137 | |
| 138 | 138 | static CUSTOM_INPUT( vicdual_get_64v ) |
| 139 | 139 | { |
| 140 | return (get_vcounter(field-> | |
| 140 | return (get_vcounter(field-> | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | static CUSTOM_INPUT( vicdual_get_vblank_comp ) |
| 145 | 145 | { |
| 146 | return (get_vcounter(field-> | |
| 146 | return (get_vcounter(field-> | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
| 150 | 150 | static CUSTOM_INPUT( vicdual_get_composite_blank_comp ) |
| 151 | 151 | { |
| 152 | return (vicdual_get_vblank_comp(field, 0) && !field | |
| 152 | return (vicdual_get_vblank_comp(device, field, 0) && !field | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | static CUSTOM_INPUT( vicdual_get_timer_value ) |
| 157 | 157 | { |
| 158 | 158 | /* return the state of the timer (old code claims "4MHz square wave", but it was toggled once every 2msec, or 500Hz) */ |
| 159 | return field-> | |
| 159 | return field-> | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| r11508 | r11509 | |
| 1632 | 1632 | static CUSTOM_INPUT( brdrline_lives ) |
| 1633 | 1633 | { |
| 1634 | 1634 | int bit_mask = (FPTR)param; |
| 1635 | return (input_port_read(field-> | |
| 1635 | return (input_port_read(field-> | |
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | static INPUT_PORTS_START( brdrline ) |
| r11508 | r11509 | |
| 2053 | 2053 | |
| 2054 | 2054 | static CUSTOM_INPUT( samurai_protection_r ) |
| 2055 | 2055 | { |
| 2056 | vicdual_state *state = field-> | |
| 2056 | vicdual_state *state = field-> | |
| 2057 | 2057 | int offset = (FPTR)param; |
| 2058 | 2058 | UINT32 answer = 0; |
| 2059 | 2059 |
| r11508 | r11509 | |
|---|---|---|
| 342 | 342 | |
| 343 | 343 | static CUSTOM_INPUT( pending_sound_r ) |
| 344 | 344 | { |
| 345 | welltris_state *state = field-> | |
| 345 | welltris_state *state = field-> | |
| 346 | 346 | return state->m_pending_command ? 1 : 0; |
| 347 | 347 | } |
| 348 | 348 |
| r11508 | r11509 | |
|---|---|---|
| 379 | 379 | |
| 380 | 380 | static CUSTOM_INPUT( custom_soundstatus_r ) |
| 381 | 381 | { |
| 382 | metro_state *state = field-> | |
| 382 | metro_state *state = field-> | |
| 383 | 383 | return (state->m_busy_sndcpu ? 0x01 : 0x00); |
| 384 | 384 | } |
| 385 | 385 |
| r11508 | r11509 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | static CUSTOM_INPUT( rgum_heartbeat_r ) |
| 83 | 83 | { |
| 84 | rgum_state *state = field-> | |
| 84 | rgum_state *state = field-> | |
| 85 | 85 | |
| 86 | 86 | state->m_hbeat ^= 1; |
| 87 | 87 |
| r11508 | r11509 | |
|---|---|---|
| 342 | 342 | |
| 343 | 343 | static CUSTOM_INPUT( acs_r ) |
| 344 | 344 | { |
| 345 | zaccaria_state *state = field-> | |
| 345 | zaccaria_state *state = field-> | |
| 346 | 346 | return (state->m_acs & 0x08) ? 1 : 0; |
| 347 | 347 | } |
| 348 | 348 |
| r11508 | r11509 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | static INPUT_CHANGED( coin_inserted ) |
| 16 | 16 | { |
| 17 | cheekyms_state *state = field-> | |
| 17 | cheekyms_state *state = field-> | |
| 18 | 18 | |
| 19 | 19 | /* this starts a 556 one-shot timer (and triggers a sound effect) */ |
| 20 | 20 | if (newval) |
| r11508 | r11509 | |
|---|---|---|
| 308 | 308 | |
| 309 | 309 | static CUSTOM_INPUT( clock_r ) |
| 310 | 310 | { |
| 311 | return (field-> | |
| 311 | return (field-> | |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | static INPUT_PORTS_START( asteroid ) |
| r11508 | r11509 | |
|---|---|---|
| 75 | 75 | |
| 76 | 76 | static CUSTOM_INPUT( subcpu_int_r ) |
| 77 | 77 | { |
| 78 | fromanc2_state *state = field-> | |
| 78 | fromanc2_state *state = field-> | |
| 79 | 79 | return state->m_subcpu_int_flag & 0x01; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | static CUSTOM_INPUT( sndcpu_nmi_r ) |
| 83 | 83 | { |
| 84 | fromanc2_state *state = field-> | |
| 84 | fromanc2_state *state = field-> | |
| 85 | 85 | return state->m_sndcpu_nmi_flag & 0x01; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | static CUSTOM_INPUT( subcpu_nmi_r ) |
| 89 | 89 | { |
| 90 | fromanc2_state *state = field-> | |
| 90 | fromanc2_state *state = field-> | |
| 91 | 91 | return state->m_subcpu_nmi_flag & 0x01; |
| 92 | 92 | } |
| 93 | 93 | |
| r11508 | r11509 | |
| 416 | 416 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eeprom_set_cs_line) |
| 417 | 417 | INPUT_PORTS_END |
| 418 | 418 | |
| 419 | #ifdef UNREFERENCED_CODE | |
| 419 | 420 | static INPUT_PORTS_START( fromancr ) |
| 420 | 421 | PORT_INCLUDE( fromanc2 ) |
| 421 | 422 | |
| r11508 | r11509 | |
| 424 | 425 | PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eeprom_set_clock_line) |
| 425 | 426 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eeprom_set_cs_line) |
| 426 | 427 | INPUT_PORTS_END |
| 428 | #endif | |
| 427 | 429 | |
| 428 | 430 | static INPUT_PORTS_START( fromanc4 ) |
| 429 | 431 | PORT_INCLUDE( fromanc2 ) |
| r11508 | r11509 | |
|---|---|---|
| 157 | 157 | static CUSTOM_INPUT( coin_counter_r ) |
| 158 | 158 | { |
| 159 | 159 | int coin = (FPTR)param; |
| 160 | UINT8 *coin_counter = field-> | |
| 160 | UINT8 *coin_counter = field-> | |
| 161 | 161 | |
| 162 | 162 | /* return coin counter values */ |
| 163 | 163 | return coin_counter[coin] & 3; |
| r11508 | r11509 | |
| 167 | 167 | static INPUT_CHANGED( coin_changed_callback ) |
| 168 | 168 | { |
| 169 | 169 | int coin = (FPTR)param; |
| 170 | UINT8 *coin_counter = field-> | |
| 170 | UINT8 *coin_counter = field-> | |
| 171 | 171 | |
| 172 | 172 | /* check for a 0 -> 1 transition */ |
| 173 | 173 | if (!oldval && newval && coin_counter[coin] < 3) |
| r11508 | r11509 | |
|---|---|---|
| 276 | 276 | |
| 277 | 277 | static CUSTOM_INPUT( xain_vblank_r ) |
| 278 | 278 | { |
| 279 | xain_state *state = field-> | |
| 279 | xain_state *state = field-> | |
| 280 | 280 | return state->m_vblank; |
| 281 | 281 | } |
| 282 | 282 | |
| r11508 | r11509 | |
| 368 | 368 | |
| 369 | 369 | static CUSTOM_INPUT( mcu_status_r ) |
| 370 | 370 | { |
| 371 | xain_state *state = field-> | |
| 371 | xain_state *state = field-> | |
| 372 | 372 | UINT8 res = 0; |
| 373 | 373 | |
| 374 | if (field-> | |
| 374 | if (field-> | |
| 375 | 375 | { |
| 376 | 376 | if (state->m_mcu_ready == 1) |
| 377 | 377 | res |= 0x01; |
| r11508 | r11509 | |
|---|---|---|
| 2354 | 2354 | |
| 2355 | 2355 | static CUSTOM_INPUT( moonwar_dial_r ) |
| 2356 | 2356 | { |
| 2357 | galaxian_state *state = field-> | |
| 2357 | galaxian_state *state = field-> | |
| 2358 | 2358 | static const char *const dialname[2] = { "P1_DIAL", "P2_DIAL" }; |
| 2359 | 2359 | int p = (~state->m_moonwar_port_select >> 4) & 1; |
| 2360 | 2360 | |
| 2361 | 2361 | // see http://www.cityofberwyn.com/schematics/stern/MoonWar_opto.tiff for schematic |
| 2362 | 2362 | // I.e. a 74ls161 counts from 0 to 15 which is the absolute number of bars passed on the quadrature |
| 2363 | 2363 | |
| 2364 | signed char dialread = input_port_read(field-> | |
| 2364 | signed char dialread = input_port_read(field-> | |
| 2365 | 2365 | |
| 2366 | 2366 | UINT8 ret; |
| 2367 | 2367 |
| r11508 | r11509 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | #include "emu.h" |
| 50 | 50 | #include "cpu/z80/z80.h" |
| 51 | #include "deprecat.h" | |
| 52 | 51 | #include "sound/2203intf.h" |
| 53 | 52 | #include "includes/gundealr.h" |
| 54 | 53 | |
| 55 | ||
| 56 | static INTERRUPT_GEN( yamyam_interrupt ) | |
| 57 | { | |
| 58 | gundealr_state *state = device->machine().driver_data<gundealr_state>(); | |
| 59 | ||
| 60 | if (cpu_getiloops(device) == 0) | |
| 61 | { | |
| 62 | if (state->m_input_ports_hack) | |
| 63 | { | |
| 64 | state->m_rambase[0x004] = input_port_read(device->machine(), "IN2"); | |
| 65 | state->m_rambase[0x005] = input_port_read(device->machine(), "IN1"); | |
| 66 | state->m_rambase[0x006] = input_port_read(device->machine(), "IN0"); | |
| 67 | } | |
| 68 | device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xd7); /* RST 10h vblank */ | |
| 69 | } | |
| 70 | else if ((cpu_getiloops(device) & 1) == 1) | |
| 71 | device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xcf); /* RST 08h sound (hand tuned) */ | |
| 72 | } | |
| 73 | ||
| 74 | 54 | static WRITE8_HANDLER( yamyam_bankswitch_w ) |
| 75 | 55 | { |
| 76 | 56 | memory_set_bank(space->machine(), "bank1", data & 0x07); |
| 77 | 57 | } |
| 78 | 58 | |
| 79 | static WRITE8_HANDLER( yamyam_protection_w ) | |
| 80 | { | |
| 81 | gundealr_state *state = space->machine().driver_data<gundealr_state>(); | |
| 82 | logerror("e000 = %02x\n", state->m_rambase[0x000]); | |
| 83 | state->m_rambase[0x000] = data; | |
| 84 | if (data == 0x03) state->m_rambase[0x001] = 0x03; | |
| 85 | if (data == 0x04) state->m_rambase[0x001] = 0x04; | |
| 86 | if (data == 0x05) state->m_rambase[0x001] = 0x05; | |
| 87 | if (data == 0x0a) state->m_rambase[0x001] = 0x08; | |
| 88 | if (data == 0x0d) state->m_rambase[0x001] = 0x07; | |
| 89 | 59 | |
| 90 | if (data == 0x03) | |
| 91 | { | |
| 92 | /* | |
| 93 | read dip switches | |
| 94 | 3a 00 c0 ld a,($c000) | |
| 95 | 47 ld b,a | |
| 96 | 3a 01 c0 ld a,($c001) | |
| 97 | c9 ret | |
| 98 | */ | |
| 99 | state->m_rambase[0x010] = 0x3a; | |
| 100 | state->m_rambase[0x011] = 0x00; | |
| 101 | state->m_rambase[0x012] = 0xc0; | |
| 102 | state->m_rambase[0x013] = 0x47; | |
| 103 | state->m_rambase[0x014] = 0x3a; | |
| 104 | state->m_rambase[0x015] = 0x01; | |
| 105 | state->m_rambase[0x016] = 0xc0; | |
| 106 | state->m_rambase[0x017] = 0xc9; | |
| 107 | } | |
| 108 | 60 | |
| 109 | if (data == 0x05) | |
| 110 | { | |
| 111 | /* | |
| 112 | add a to hl | |
| 113 | c5 push bc | |
| 114 | 010000 ld bc,#0000 | |
| 115 | 4f ld c,a | |
| 116 | 09 add hl,bc | |
| 117 | c1 pop bc | |
| 118 | c9 ret | |
| 119 | */ | |
| 120 | state->m_rambase[0x020] = 0xc5; | |
| 121 | state->m_rambase[0x021] = 0x01; | |
| 122 | state->m_rambase[0x022] = 0x00; | |
| 123 | state->m_rambase[0x023] = 0x00; | |
| 124 | state->m_rambase[0x024] = 0x4f; | |
| 125 | state->m_rambase[0x025] = 0x09; | |
| 126 | state->m_rambase[0x026] = 0xc1; | |
| 127 | state->m_rambase[0x027] = 0xc9; | |
| 128 | /* | |
| 129 | lookup data in table | |
| 130 | cd20e0 call #e020 | |
| 131 | 7e ld a,(hl) | |
| 132 | c9 ret | |
| 133 | */ | |
| 134 | state->m_rambase[0x010] = 0xcd; | |
| 135 | state->m_rambase[0x011] = 0x20; | |
| 136 | state->m_rambase[0x012] = 0xe0; | |
| 137 | state->m_rambase[0x013] = 0x7e; | |
| 138 | state->m_rambase[0x014] = 0xc9; | |
| 139 | } | |
| 140 | } | |
| 141 | ||
| 142 | ||
| 143 | ||
| 144 | 61 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 ) |
| 145 | 62 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 146 | 63 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| r11508 | r11509 | |
| 466 | 383 | state->m_scroll[3] = 0; |
| 467 | 384 | } |
| 468 | 385 | |
| 386 | static TIMER_DEVICE_CALLBACK( gundealr_scanline ) | |
| 387 | { | |
| 388 | int scanline = param; | |
| 389 | ||
| 390 | if(scanline == 240) // vblank-out irq | |
| 391 | cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE,0xd7); /* RST 10h */ | |
| 392 | else if((scanline == 0) || (scanline == 120) ) //timer irq | |
| 393 | cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE,0xcf); /* RST 10h */ | |
| 394 | } | |
| 395 | ||
| 396 | static const ym2203_interface ym2203_config = | |
| 397 | { | |
| 398 | { | |
| 399 | AY8910_LEGACY_OUTPUT, | |
| 400 | AY8910_DEFAULT_LOADS, | |
| 401 | DEVCB_NULL, | |
| 402 | DEVCB_NULL, | |
| 403 | DEVCB_NULL, | |
| 404 | DEVCB_NULL | |
| 405 | }, | |
| 406 | NULL | |
| 407 | }; | |
| 408 | ||
| 469 | 409 | static MACHINE_CONFIG_START( gundealr, gundealr_state ) |
| 470 | 410 | |
| 471 | 411 | /* basic machine hardware */ |
| 472 | 412 | MCFG_CPU_ADD("maincpu", Z80, 8000000) /* 8 MHz ??? */ |
| 473 | 413 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 474 | 414 | MCFG_CPU_IO_MAP(main_portmap) |
| 475 | MCFG_ | |
| 415 | MCFG_TIMER_ | |
| 476 | 416 | |
| 477 | 417 | MCFG_MACHINE_START(gundealr) |
| 478 | 418 | MCFG_MACHINE_RESET(gundealr) |
| r11508 | r11509 | |
| 495 | 435 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 496 | 436 | |
| 497 | 437 | MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) |
| 438 | MCFG_SOUND_CONFIG(ym2203_config) | |
| 498 | 439 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 499 | 440 | MACHINE_CONFIG_END |
| 500 | 441 | |
| 442 | static TIMER_DEVICE_CALLBACK( yamyam_mcu_sim ) | |
| 443 | { | |
| 444 | gundealr_state *state = timer.machine().driver_data<gundealr_state>(); | |
| 445 | static const UINT8 snipped_cmd03[8] = { 0x3a, 0x00, 0xc0, 0x47, 0x3a, 0x01, 0xc0, 0xc9 }; | |
| 446 | static const UINT8 snipped_cmd05_1[5] = { 0xcd, 0x20, 0xe0, 0x7e, 0xc9 }; | |
| 447 | static const UINT8 snipped_cmd05_2[8] = { 0xc5, 0x01, 0x00, 0x00, 0x4f, 0x09, 0xc1, 0xc9 }; | |
| 501 | 448 | |
| 449 | int i; | |
| 502 | 450 | |
| 451 | //logerror("e000 = %02x\n", state->m_rambase[0x000]); | |
| 452 | switch(state->m_rambase[0x000]) | |
| 453 | { | |
| 454 | case 0x03: | |
| 455 | state->m_rambase[0x001] = 0x03; | |
| 456 | /* | |
| 457 | read dip switches | |
| 458 | 3a 00 c0 ld a,($c000) | |
| 459 | 47 ld b,a | |
| 460 | 3a 01 c0 ld a,($c001) | |
| 461 | c9 ret | |
| 462 | */ | |
| 463 | for(i=0;i<8;i++) | |
| 464 | state->m_rambase[0x010+i] = snipped_cmd03[i]; | |
| 465 | ||
| 466 | break; | |
| 467 | case 0x04: | |
| 468 | state->m_rambase[0x001] = 0x04; | |
| 469 | break; | |
| 470 | case 0x05: | |
| 471 | state->m_rambase[0x001] = 0x05; | |
| 472 | /* | |
| 473 | add a to hl | |
| 474 | c5 push bc | |
| 475 | 01 00 00 ld bc,#0000 | |
| 476 | 4f ld c,a | |
| 477 | 09 add hl,bc | |
| 478 | c1 pop bc | |
| 479 | c9 ret | |
| 480 | */ | |
| 481 | for(i=0;i<8;i++) | |
| 482 | state->m_rambase[0x020+i] = snipped_cmd05_2[i]; | |
| 483 | ||
| 484 | /* | |
| 485 | lookup data in table | |
| 486 | cd 20 e0 call #e020 | |
| 487 | 7e ld a,(hl) | |
| 488 | c9 ret | |
| 489 | */ | |
| 490 | for(i=0;i<5;i++) | |
| 491 | state->m_rambase[0x010+i] = snipped_cmd05_1[i]; | |
| 492 | ||
| 493 | break; | |
| 494 | case 0x0a: | |
| 495 | state->m_rambase[0x001] = 0x08; | |
| 496 | break; | |
| 497 | case 0x0d: | |
| 498 | state->m_rambase[0x001] = 0x07; | |
| 499 | break; | |
| 500 | } | |
| 501 | ||
| 502 | state->m_rambase[0x004] = input_port_read(timer.machine(), "IN2"); | |
| 503 | state->m_rambase[0x005] = input_port_read(timer.machine(), "IN1"); | |
| 504 | state->m_rambase[0x006] = input_port_read(timer.machine(), "IN0"); | |
| 505 | } | |
| 506 | ||
| 507 | static MACHINE_CONFIG_DERIVED( yamyam, gundealr ) | |
| 508 | ||
| 509 | MCFG_TIMER_ADD_PERIODIC("mcusim", yamyam_mcu_sim, attotime::from_hz(8000000/60)) // not real, but for simulating the MCU | |
| 510 | MACHINE_CONFIG_END | |
| 511 | ||
| 512 | ||
| 503 | 513 | /*************************************************************************** |
| 504 | 514 | |
| 505 | 515 | Game driver(s) |
| r11508 | r11509 | |
| 547 | 557 | ROM_LOAD( "b3.f10", 0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) ) |
| 548 | 558 | ROM_RELOAD( 0x10000, 0x20000 ) /* banked at 0x8000-0xbfff */ |
| 549 | 559 | |
| 560 | ROM_REGION( 0x10000, "mcu", 0 ) //unknown type, there must be one | |
| 561 | ROM_LOAD( "mcu", 0x0000, 0x10000, NO_DUMP) | |
| 562 | ||
| 550 | 563 | ROM_REGION( 0x10000, "gfx1", 0 ) |
| 551 | 564 | ROM_LOAD( "b2.d16", 0x00000, 0x10000, CRC(cb4f84ee) SHA1(54319ecbd74b763757eb6d17c8f7be0705ab0714) ) |
| 552 | 565 | |
| r11508 | r11509 | |
| 560 | 573 | ROM_LOAD( "b3.f10", 0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) ) |
| 561 | 574 | ROM_RELOAD( 0x10000, 0x20000 ) /* banked at 0x8000-0xbfff */ |
| 562 | 575 | |
| 576 | ROM_REGION( 0x10000, "mcu", 0 ) //unknown type, there must be one | |
| 577 | ROM_LOAD( "mcu", 0x0000, 0x10000, NO_DUMP) | |
| 578 | ||
| 563 | 579 | ROM_REGION( 0x10000, "gfx1", 0 ) |
| 564 | 580 | ROM_LOAD( "wguyb2.bin", 0x00000, 0x10000, CRC(1c684c46) SHA1(041bc500e31b02a8bf3ce4683a67de998f938ccc) ) |
| 565 | 581 | |
| r11508 | r11509 | |
| 569 | 585 | |
| 570 | 586 | |
| 571 | 587 | |
| 572 | static DRIVER_INIT( gundealr ) | |
| 573 | { | |
| 574 | gundealr_state *state = machine.driver_data<gundealr_state>(); | |
| 575 | state->m_input_ports_hack = 0; | |
| 576 | } | |
| 577 | 588 | |
| 578 | static DRIVER_INIT( yamyam ) | |
| 579 | { | |
| 580 | gundealr_state *state = machine.driver_data<gundealr_state>(); | |
| 581 | state->m_input_ports_hack = 1; | |
| 582 | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xe000, 0xe000, FUNC(yamyam_protection_w)); | |
| 583 | } | |
| 584 | 589 | |
| 585 | 590 | |
| 586 | ||
| 587 | GAME( 1990, gundealr, 0, gundealr, gundealr, gundealr, ROT270, "Dooyong", "Gun Dealer", GAME_SUPPORTS_SAVE ) | |
| 588 | GAME( 19??, gundealra, gundealr, gundealr, gundealr, gundealr, ROT270, "Dooyong", "Gun Dealer (alt card set)", GAME_SUPPORTS_SAVE ) | |
| 589 | GAME( 1990, gundealrt, gundealr, gundealr, gundealt, gundealr, ROT270, "Dooyong (Tecmo license)", "Gun Dealer (Korea)", GAME_SUPPORTS_SAVE ) | |
| 590 | GAME( 1990, yamyam, 0, gundealr, yamyam, yamyam, ROT0, "Dooyong", "Yam! Yam!?", GAME_SUPPORTS_SAVE ) | |
| 591 | GAME( 1990, wiseguy, yamyam, gundealr, yamyam, yamyam, ROT0, "Dooyong", "Wise Guy", GAME_SUPPORTS_SAVE ) | |
| 591 | GAME( 1990, gundealr, 0, gundealr, gundealr, 0, ROT270, "Dooyong", "Gun Dealer", GAME_SUPPORTS_SAVE ) | |
| 592 | GAME( 19??, gundealra, gundealr, gundealr, gundealr, 0, ROT270, "Dooyong", "Gun Dealer (alt card set)", GAME_SUPPORTS_SAVE ) | |
| 593 | GAME( 1990, gundealrt, gundealr, gundealr, gundealt, 0, ROT270, "Dooyong (Tecmo license)", "Gun Dealer (Korea)", GAME_SUPPORTS_SAVE ) | |
| 594 | GAME( 1990, yamyam, 0, yamyam, yamyam, 0, ROT0, "Dooyong", "Yam! Yam!?", GAME_SUPPORTS_SAVE ) | |
| 595 | GAME( 1990, wiseguy, yamyam, yamyam, yamyam, 0, ROT0, "Dooyong", "Wise Guy", GAME_SUPPORTS_SAVE ) |
| r11508 | r11509 | |
|---|---|---|
| 265 | 265 | |
| 266 | 266 | static CUSTOM_INPUT( mainflag_r ) |
| 267 | 267 | { |
| 268 | firefox_state *state = field-> | |
| 268 | firefox_state *state = field-> | |
| 269 | 269 | return state->m_main_to_sound_flag; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | static CUSTOM_INPUT( soundflag_r ) |
| 273 | 273 | { |
| 274 | firefox_state *state = field-> | |
| 274 | firefox_state *state = field-> | |
| 275 | 275 | return state->m_sound_to_main_flag; |
| 276 | 276 | } |
| 277 | 277 |
| r11508 | r11509 | |
|---|---|---|
| 608 | 608 | |
| 609 | 609 | static CUSTOM_INPUT( mcu_status_r ) |
| 610 | 610 | { |
| 611 | renegade_state *state = field-> | |
| 611 | renegade_state *state = field-> | |
| 612 | 612 | UINT8 res = 0; |
| 613 | 613 | |
| 614 | 614 | if (state->m_mcu_sim == TRUE) |
| r11508 | r11509 | |
|---|---|---|
| 450 | 450 | |
| 451 | 451 | static CUSTOM_INPUT( get_vblank ) |
| 452 | 452 | { |
| 453 | missile_state *state = field->port->machine().driver_data<missile_state>(); | |
| 454 | int v = scanline_to_v(state, field->port->machine().primary_screen->vpos()); | |
| 453 | missile_state *state = field->machine().driver_data<missile_state>(); | |
| 454 | int v = scanline_to_v(state, field->machine().primary_screen->vpos()); | |
| 455 | 455 | return v < 24; |
| 456 | 456 | } |
| 457 | 457 |
| r11508 | r11509 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | static CUSTOM_INPUT( sound_check_r ) |
| 85 | 85 | { |
| 86 | jack_state *state = field-> | |
| 86 | jack_state *state = field-> | |
| 87 | 87 | UINT8 ret = 0; |
| 88 | 88 | |
| 89 | if ((input_port_read(field-> | |
| 89 | if ((input_port_read(field-> | |
| 90 | 90 | ret = 1; |
| 91 | 91 | |
| 92 | 92 | return ret; |
| r11508 | r11509 | |
|---|---|---|
| 193 | 193 | |
| 194 | 194 | static CUSTOM_INPUT( input_port_4_f0_r ) |
| 195 | 195 | { |
| 196 | taitosj_state *state = field-> | |
| 196 | taitosj_state *state = field-> | |
| 197 | 197 | return state->m_input_port_4_f0; |
| 198 | 198 | } |
| 199 | 199 | |
| r11508 | r11509 | |
| 282 | 282 | |
| 283 | 283 | static CUSTOM_INPUT( kikstart_gear_r ) |
| 284 | 284 | { |
| 285 | taitosj_state *state = field-> | |
| 285 | taitosj_state *state = field-> | |
| 286 | 286 | const char *port_tag; |
| 287 | 287 | |
| 288 | 288 | int player = (int)(FPTR)param; |
| r11508 | r11509 | |
| 293 | 293 | port_tag = "GEARP2"; |
| 294 | 294 | |
| 295 | 295 | /* gear MUST be 1, 2 or 3 */ |
| 296 | if (input_port_read(field->port->machine(), port_tag) & 0x01) state->m_kikstart_gears[player] = 0x02; | |
| 297 | if (input_port_read(field->port->machine(), port_tag) & 0x02) state->m_kikstart_gears[player] = 0x03; | |
| 298 | if (input_port_read(field->port->machine(), port_tag) & 0x04) state->m_kikstart_gears[player] = 0x01; | |
| 296 | if (input_port_read(field->machine(), port_tag) & 0x01) state->m_kikstart_gears[player] = 0x02; | |
| 297 | if (input_port_read(field->machine(), port_tag) & 0x02) state->m_kikstart_gears[player] = 0x03; | |
| 298 | if (input_port_read(field->machine(), port_tag) & 0x04) state->m_kikstart_gears[player] = 0x01; | |
| 299 | 299 | |
| 300 | 300 | return state->m_kikstart_gears[player]; |
| 301 | 301 | } |
| r11508 | r11509 | |
|---|---|---|
| 306 | 306 | |
| 307 | 307 | static CUSTOM_INPUT( snk6502_music0_r ) |
| 308 | 308 | { |
| 309 | return (snk6502_music0_playing(field-> | |
| 309 | return (snk6502_music0_playing(field-> | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | static CUSTOM_INPUT( sasuke_count_r ) |
| 313 | 313 | { |
| 314 | snk6502_state *state = field-> | |
| 314 | snk6502_state *state = field-> | |
| 315 | 315 | |
| 316 | 316 | return (state->m_sasuke_counter >> 4); |
| 317 | 317 | } |
| r11508 | r11509 | |
|---|---|---|
| 256 | 256 | { |
| 257 | 257 | /* if we got a coin, set the IRQ on the main CPU */ |
| 258 | 258 | if (newval == 0) |
| 259 | cputag_set_input_line(field-> | |
| 259 | cputag_set_input_line(field-> | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
| r11508 | r11509 | |
| 269 | 269 | |
| 270 | 270 | static CUSTOM_INPUT( firq_beam_r ) |
| 271 | 271 | { |
| 272 | exidy440_state *state = field-> | |
| 272 | exidy440_state *state = field-> | |
| 273 | 273 | return state->m_firq_beam; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
| 277 | 277 | static CUSTOM_INPUT( firq_vblank_r ) |
| 278 | 278 | { |
| 279 | exidy440_state *state = field-> | |
| 279 | exidy440_state *state = field-> | |
| 280 | 280 | return state->m_firq_vblank; |
| 281 | 281 | } |
| 282 | 282 | |
| r11508 | r11509 | |
| 284 | 284 | static CUSTOM_INPUT( hitnmiss_button1_r ) |
| 285 | 285 | { |
| 286 | 286 | /* button 1 shows up in two bits */ |
| 287 | UINT32 button1 = input_port_read(field-> | |
| 287 | UINT32 button1 = input_port_read(field-> | |
| 288 | 288 | return (button1 << 1) | button1; |
| 289 | 289 | } |
| 290 | 290 |
| r11508 | r11509 | |
|---|---|---|
| 228 | 228 | |
| 229 | 229 | static CUSTOM_INPUT( get_ttl74123_output ) |
| 230 | 230 | { |
| 231 | r2dtank_state *state = field-> | |
| 231 | r2dtank_state *state = field-> | |
| 232 | 232 | return state->m_ttl74123_output; |
| 233 | 233 | } |
| 234 | 234 |
| r11508 | r11509 | |
|---|---|---|
| 730 | 730 | static CUSTOM_INPUT( wheelrun_wheel_r ) |
| 731 | 731 | { |
| 732 | 732 | int player = (FPTR)param; |
| 733 | int delta = input_port_read(field-> | |
| 733 | int delta = input_port_read(field-> | |
| 734 | 734 | delta = (delta & 0x7f) - (delta & 0x80) + 4; |
| 735 | 735 | |
| 736 | 736 | if (delta > 7) delta = 7; |
| r11508 | r11509 | |
|---|---|---|
| 261 | 261 | |
| 262 | 262 | static CUSTOM_INPUT( ticket_r ) |
| 263 | 263 | { |
| 264 | galaxi_state *state = field->port->machine().driver_data<galaxi_state>(); | |
| 265 | return state->m_ticket && !(field->port->machine().primary_screen->frame_number() % 10); | |
| 264 | galaxi_state *state = field->machine().driver_data<galaxi_state>(); | |
| 265 | return state->m_ticket && !(field->machine().primary_screen->frame_number() % 10); | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | static CUSTOM_INPUT( hopper_r ) |
| 269 | 269 | { |
| 270 | galaxi_state *state = field->port->machine().driver_data<galaxi_state>(); | |
| 271 | return state->m_hopper && !(field->port->machine().primary_screen->frame_number() % 10); | |
| 270 | galaxi_state *state = field->machine().driver_data<galaxi_state>(); | |
| 271 | return state->m_hopper && !(field->machine().primary_screen->frame_number() % 10); | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 |
| r11508 | r11509 | |
|---|---|---|
| 230 | 230 | |
| 231 | 231 | static CUSTOM_INPUT(cubo_input) |
| 232 | 232 | { |
| 233 | cd32_state *state = field->port->machine().driver_data<cd32_state>(); | |
| 234 | return handle_joystick_potgor(field->port->machine(), state->m_potgo_value) >> 10; | |
| 233 | cd32_state *state = field->machine().driver_data<cd32_state>(); | |
| 234 | return handle_joystick_potgor(field->machine(), state->m_potgo_value) >> 10; | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | static INPUT_PORTS_START( cd32 ) |
| r11508 | r11509 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | static CUSTOM_INPUT( get_collision ) |
| 22 | 22 | { |
| 23 | ultratnk_state *state = field-> | |
| 23 | ultratnk_state *state = field-> | |
| 24 | 24 | return state->m_collision[(FPTR) param]; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | static CUSTOM_INPUT( get_joystick ) |
| 29 | 29 | { |
| 30 | ultratnk_state *state = field->port->machine().driver_data<ultratnk_state>(); | |
| 31 | UINT8 joy = input_port_read(field->port->machine(), (const char *)param) & 3; | |
| 30 | ultratnk_state *state = field->machine().driver_data<ultratnk_state>(); | |
| 31 | UINT8 joy = input_port_read(field->machine(), (const char *)param) & 3; | |
| 32 | 32 | |
| 33 | 33 | if (joy == 1) |
| 34 | 34 | { |
| r11508 | r11509 | |
|---|---|---|
| 90 | 90 | static INPUT_CHANGED( set_write_protect ) // run when RAM expansion write protect switch is changed |
| 91 | 91 | { |
| 92 | 92 | int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0; |
| 93 | address_space *space = field->port->machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 94 | UINT8 *expram = ram_get_ptr(field->port->machine().device("ram_tag")); | |
| 93 | address_space *space = field->machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 94 | UINT8 *expram = ram_get_ptr(field->machine().device("ram_tag")); | |
| 95 | 95 | |
| 96 | 96 | get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end); // passing by reference |
| 97 | 97 |
| r11508 | r11509 | |
|---|---|---|
| 275 | 275 | |
| 276 | 276 | static INPUT_CHANGED( spaceint_coin_inserted ) |
| 277 | 277 | { |
| 278 | astinvad_state *state = field-> | |
| 278 | astinvad_state *state = field-> | |
| 279 | 279 | /* coin insertion causes an NMI */ |
| 280 | 280 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); |
| 281 | 281 | } |
| r11508 | r11509 | |
|---|---|---|
| 19 | 19 | instead of costly bitmaps. |
| 20 | 20 | - Ben Bero Beh has collision problems with the falling fireballs and a minor |
| 21 | 21 | priority glitch with the "Elevator Action" baddies. |
| 22 | - IRQ system needs a complete rewrite | |
| 23 | - De-achoize the blitter code | |
| 22 | 24 | |
| 23 | 25 | * Halley's Comet's undocumented DIP switches only work if the player1 start button |
| 24 | 26 | is depressed during boot-up. |
| r11508 | r11509 | |
| 160 | 162 | #include "emu.h" |
| 161 | 163 | #include "cpu/z80/z80.h" |
| 162 | 164 | #include "includes/taitoipt.h" |
| 163 | #include "deprecat.h" | |
| 164 | 165 | #include "cpu/m6809/m6809.h" |
| 165 | 166 | #include "sound/ay8910.h" |
| 166 | 167 | |
| r11508 | r11509 | |
| 1526 | 1527 | //************************************************************************** |
| 1527 | 1528 | // Interrupt and Hardware Handlers |
| 1528 | 1529 | |
| 1529 | static INTERRUPT_GEN( halleys_interrupt ) | |
| 1530 | ||
| 1531 | static TIMER_DEVICE_CALLBACK( halleys_scanline ) | |
| 1530 | 1532 | { |
| 1531 | halleys_state *state = device->machine().driver_data<halleys_state>(); | |
| 1532 | UINT8 latch_data; | |
| 1533 | halleys_state *state = timer.machine().driver_data<halleys_state>(); | |
| 1534 | int scanline = param; | |
| 1533 | 1535 | |
| 1534 | switch (cpu_getiloops(device)) | |
| 1536 | /* TODO: fix this */ | |
| 1537 | switch (scanline) | |
| 1535 | 1538 | { |
| 1536 | case 0: | |
| 1537 | /* | |
| 1538 | How the custom chips handle sound latching is largely unknown. | |
| 1539 | Halley's Comet dumps sound commands to register ff8a so | |
| 1540 | rapidly the AY8910 core sometimes fails to reset itself and | |
| 1541 | the music stops. Masking sound NMI is not enough to ensure | |
| 1542 | successive writes are processed properly so it is advisable to | |
| 1543 | queue sound commands or make the main CPU yield for a minimum | |
| 1544 | of 600 Z80 cycles. Furthermore, soundlatch NMI interval should | |
| 1545 | not be too much shorter than music IRQ's period(27306667ns), | |
| 1546 | and must be longer in case of a reset(00). | |
| 1547 | ||
| 1548 | Current implementation is quite safe although not 100% foul-proof. | |
| 1549 | */ | |
| 1550 | if (state->m_latch_delay) state->m_latch_delay--; else | |
| 1551 | if (state->m_ffcount) | |
| 1552 | { | |
| 1553 | state->m_ffcount--; | |
| 1554 | latch_data = state->m_sound_fifo[state->m_fftail]; | |
| 1555 | state->m_fftail = (state->m_fftail + 1) & (MAX_SOUNDS - 1); | |
| 1556 | state->m_latch_delay = (latch_data) ? 0 : 4; | |
| 1557 | soundlatch_w( device->memory().space(AS_PROGRAM), 0, latch_data); | |
| 1558 | cputag_set_input_line(device->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE); | |
| 1559 | } | |
| 1560 | ||
| 1539 | case 248: | |
| 1561 | 1540 | // clear collision list of this frame unconditionally |
| 1562 | 1541 | state->m_collision_count = 0; |
| 1563 | break; | |
| 1542 | break; | |
| 1564 | 1543 | |
| 1565 | 1544 | // In Halley's Comet, NMI is used exclusively to handle coin input |
| 1566 | case 1: | |
| 1567 | device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); | |
| 1568 | break; | |
| 1545 | case 56*3: | |
| 1546 | cputag_set_input_line(timer.machine(),"maincpu", INPUT_LINE_NMI, PULSE_LINE); | |
| 1547 | break; | |
| 1569 | 1548 | |
| 1570 | 1549 | // FIRQ drives gameplay; we need both types of NMI each frame. |
| 1571 | case 2: | |
| 1572 | state->m_mVectorType = 1; device_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE); | |
| 1573 | break; | |
| 1550 | case 56*2: | |
| 1551 | state->m_mVectorType = 1; cputag_set_input_line(timer.machine(),"maincpu", M6809_FIRQ_LINE, ASSERT_LINE); | |
| 1552 | break; | |
| 1574 | 1553 | |
| 1575 | case 3: | |
| 1576 | state->m_mVectorType = 0; device_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE); | |
| 1577 | break; | |
| 1554 | case 56: | |
| 1555 | state->m_mVectorType = 0; cputag_set_input_line(timer.machine(),"maincpu", M6809_FIRQ_LINE, ASSERT_LINE); | |
| 1556 | break; | |
| 1578 | 1557 | } |
| 1579 | 1558 | } |
| 1580 | 1559 | |
| 1581 | 1560 | |
| 1582 | static | |
| 1561 | static | |
| 1583 | 1562 | { |
| 1584 | halleys_state *state = device->machine().driver_data<halleys_state>(); | |
| 1585 | UINT8 latch_data; | |
| 1563 | halleys_state *state = timer.machine().driver_data<halleys_state>(); | |
| 1564 | int scanline = param; | |
| 1586 | 1565 | |
| 1587 | switch (cpu_getiloops(device)) | |
| 1566 | /* TODO: fix this */ | |
| 1567 | switch (scanline) | |
| 1588 | 1568 | { |
| 1589 | case 0: | |
| 1590 | if (state->m_latch_delay) state->m_latch_delay--; else | |
| 1591 | if (state->m_ffcount) | |
| 1592 | { | |
| 1593 | state->m_ffcount--; | |
| 1594 | latch_data = state->m_sound_fifo[state->m_fftail]; | |
| 1595 | state->m_fftail = (state->m_fftail + 1) & (MAX_SOUNDS - 1); | |
| 1596 | state->m_latch_delay = (latch_data) ? 0 : 4; | |
| 1597 | soundlatch_w(device->memory().space(AS_PROGRAM), 0, latch_data); | |
| 1598 | cputag_set_input_line(device->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE); | |
| 1599 | } | |
| 1600 | break; | |
| 1569 | case 248: | |
| 1570 | break; | |
| 1601 | 1571 | |
| 1602 | case 1: | |
| 1603 | device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); | |
| 1604 | break; | |
| 1572 | case 56*3: | |
| 1573 | cputag_set_input_line(timer.machine(),"maincpu", INPUT_LINE_NMI, PULSE_LINE); | |
| 1574 | break; | |
| 1605 | 1575 | |
| 1606 | case 2: | |
| 1607 | case 3: | |
| 1576 | case 56*2: | |
| 1577 | case 56*1: | |
| 1608 | 1578 | // FIRQ must not happen when the blitter is being updated or it'll cause serious screen artifacts |
| 1609 | if (!state->m_blitter_busy) device_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE); else state->m_firq_level++; | |
| 1610 | break; | |
| 1579 | if (!state->m_blitter_busy) cputag_set_input_line(timer.machine(),"maincpu", M6809_FIRQ_LINE, ASSERT_LINE); else state->m_firq_level++; | |
| 1580 | break; | |
| 1611 | 1581 | } |
| 1612 | 1582 | } |
| 1613 | 1583 | |
| r11508 | r11509 | |
| 1639 | 1609 | static WRITE8_HANDLER( soundcommand_w ) |
| 1640 | 1610 | { |
| 1641 | 1611 | halleys_state *state = space->machine().driver_data<halleys_state>(); |
| 1642 | if (state->m_ffcount < MAX_SOUNDS) | |
| 1643 | { | |
| 1644 | state->m_ffcount++; | |
| 1645 | state->m_sound_fifo[state->m_ffhead] = state->m_io_ram[0x8a] = data; | |
| 1646 | state->m_ffhead = (state->m_ffhead + 1) & (MAX_SOUNDS - 1); | |
| 1647 | } | |
| 1612 | ||
| 1613 | state->m_io_ram[0x8a] = data; | |
| 1614 | soundlatch_w(space,offset,data); | |
| 1615 | cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE); | |
| 1648 | 1616 | } |
| 1649 | 1617 | |
| 1650 | 1618 | |
| r11508 | r11509 | |
| 1733 | 1701 | PORT_DIPSETTING( 0x08, "3" ) |
| 1734 | 1702 | PORT_DIPSETTING( 0x10, "4" ) |
| 1735 | 1703 | PORT_DIPSETTING( 0x18, "5" ) |
| 1736 | PORT_DIPSETTING( 0x00, | |
| 1704 | PORT_DIPSETTING( 0x00, DEF_STR( Infinite | |
| 1737 | 1705 | PORT_DIPUNKNOWN( 0x20, IP_ACTIVE_LOW ) |
| 1738 | 1706 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) /* TO DO : confirm OFF/ON when screen flipping emulated */ |
| 1739 | 1707 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| r11508 | r11509 | |
| 1796 | 1764 | PORT_DIPNAME( 0x20, 0x20, "Show Year" ) |
| 1797 | 1765 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1798 | 1766 | PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) |
| 1799 | PORT_DIPNAME( 0x40, 0x40, "No Hit | |
| 1767 | PORT_DIPNAME( 0x40, 0x40, "No Hit | |
| 1800 | 1768 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1801 | 1769 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1802 | 1770 | PORT_DIPNAME( 0x80, 0x80, "Maximum Credits" ) |
| r11508 | r11509 | |
| 1875 | 1843 | However, they enable debug features if you press START1 during the boot sequence. */ |
| 1876 | 1844 | PORT_START("DSW3") /* 0xff97 */ |
| 1877 | 1845 | PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW2:1" ) |
| 1878 | PORT_DIPNAME( 0x02, 0x02, | |
| 1846 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Free_Play | |
| 1879 | 1847 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 1880 | 1848 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1881 | PORT_DIPNAME( 0x1c, 0x1c, "Start Area | |
| 1849 | PORT_DIPNAME( 0x1c, 0x1c, "Start Area | |
| 1882 | 1850 | PORT_DIPSETTING( 0x1c, "1 (Earth)" ) |
| 1883 | 1851 | PORT_DIPSETTING( 0x18, "4 (Venus)" ) |
| 1884 | 1852 | PORT_DIPSETTING( 0x14, "7 (Mercury)" ) |
| r11508 | r11509 | |
| 1888 | 1856 | PORT_DIPSETTING( 0x04, "19 (Uranus)" ) |
| 1889 | 1857 | PORT_DIPSETTING( 0x00, "22 (Saturn)" ) |
| 1890 | 1858 | PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" ) |
| 1891 | PORT_DIPNAME( 0x40, 0x40, "Invincibility | |
| 1859 | PORT_DIPNAME( 0x40, 0x40, "Invincibility | |
| 1892 | 1860 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1893 | 1861 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1894 | PORT_DIPNAME( 0x80, 0x80, "Infinite Lives | |
| 1862 | PORT_DIPNAME( 0x80, 0x80, "Infinite Lives | |
| 1895 | 1863 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1896 | 1864 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1897 | 1865 | |
| r11508 | r11509 | |
| 1983 | 1951 | static MACHINE_CONFIG_START( halleys, halleys_state ) |
| 1984 | 1952 | MCFG_CPU_ADD("maincpu", M6809, XTAL_19_968MHz/12) /* verified on pcb */ |
| 1985 | 1953 | MCFG_CPU_PROGRAM_MAP(halleys_map) |
| 1986 | MCFG_ | |
| 1954 | MCFG_TIMER_ | |
| 1987 | 1955 | |
| 1988 | 1956 | MCFG_CPU_ADD("audiocpu", Z80, XTAL_6MHz/2) /* verified on pcb */ |
| 1989 | 1957 | MCFG_CPU_PROGRAM_MAP(sound_map) |
| r11508 | r11509 | |
| 2027 | 1995 | static MACHINE_CONFIG_DERIVED( benberob, halleys ) |
| 2028 | 1996 | MCFG_CPU_MODIFY("maincpu") |
| 2029 | 1997 | MCFG_CPU_CLOCK(XTAL_19_968MHz/12) /* not verified but pcb identical to halley's comet */ |
| 2030 | MCFG_CPU_VBLANK_INT_HACK(benberob_interrupt, 4) | |
| 1998 | MCFG_TIMER_MODIFY("scantimer") | |
| 1999 | MCFG_TIMER_CALLBACK(benberob_scanline) | |
| 2031 | 2000 | |
| 2032 | 2001 | MCFG_SCREEN_MODIFY("screen") |
| 2033 | 2002 | MCFG_SCREEN_UPDATE(benberob) |
| r11508 | r11509 | |
|---|---|---|
| 659 | 659 | PORT_INCLUDE( msx_dips ) |
| 660 | 660 | INPUT_PORTS_END |
| 661 | 661 | |
| 662 | #ifdef UNREFERENCED_CODE | |
| 662 | 663 | static INPUT_PORTS_START( msxuk ) |
| 663 | 664 | PORT_START("KEY0") |
| 664 | 665 | KEYB_ROW0 |
| r11508 | r11509 | |
| 692 | 693 | |
| 693 | 694 | PORT_INCLUDE( msx_dips ) |
| 694 | 695 | INPUT_PORTS_END |
| 696 | #endif | |
| 695 | 697 | |
| 696 | 698 | #define KEYB_JAP_ROW0 \ |
| 697 | 699 | PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') \ |
| r11508 | r11509 | |
|---|---|---|
| 428 | 428 | |
| 429 | 429 | static CUSTOM_INPUT( multiplexed_controller_r ) |
| 430 | 430 | { |
| 431 | neogeo_state *state = field-> | |
| 431 | neogeo_state *state = field-> | |
| 432 | 432 | int port = (FPTR)param; |
| 433 | 433 | |
| 434 | 434 | static const char *const cntrl[2][2] = |
| r11508 | r11509 | |
| 436 | 436 | { "IN0-0", "IN0-1" }, { "IN1-0", "IN1-1" } |
| 437 | 437 | }; |
| 438 | 438 | |
| 439 | return input_port_read_safe(field-> | |
| 439 | return input_port_read_safe(field-> | |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | |
| 443 | 443 | static CUSTOM_INPUT( mahjong_controller_r ) |
| 444 | 444 | { |
| 445 | neogeo_state *state = field-> | |
| 445 | neogeo_state *state = field-> | |
| 446 | 446 | UINT32 ret; |
| 447 | 447 | |
| 448 | 448 | /* |
| r11508 | r11509 | |
| 456 | 456 | { |
| 457 | 457 | default: |
| 458 | 458 | case 0x00: ret = 0x0000; break; /* nothing? */ |
| 459 | case 0x09: ret = input_port_read(field->port->machine(), "MAHJONG1"); break; | |
| 460 | case 0x12: ret = input_port_read(field->port->machine(), "MAHJONG2"); break; | |
| 461 | case 0x1b: ret = input_port_read(field->port->machine(), "MAHJONG3"); break; /* player 1 normal inputs? */ | |
| 462 | case 0x24: ret = input_port_read(field->port->machine(), "MAHJONG4"); break; | |
| 459 | case 0x09: ret = input_port_read(field->machine(), "MAHJONG1"); break; | |
| 460 | case 0x12: ret = input_port_read(field->machine(), "MAHJONG2"); break; | |
| 461 | case 0x1b: ret = input_port_read(field->machine(), "MAHJONG3"); break; /* player 1 normal inputs? */ | |
| 462 | case 0x24: ret = input_port_read(field->machine(), "MAHJONG4"); break; | |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | return ret; |
| r11508 | r11509 | |
| 525 | 525 | |
| 526 | 526 | static CUSTOM_INPUT( get_calendar_status ) |
| 527 | 527 | { |
| 528 | neogeo_state *state = field-> | |
| 528 | neogeo_state *state = field-> | |
| 529 | 529 | return (upd4990a_databit_r(state->m_upd4990a, 0) << 1) | upd4990a_testbit_r(state->m_upd4990a, 0); |
| 530 | 530 | } |
| 531 | 531 | |
| r11508 | r11509 | |
| 567 | 567 | { |
| 568 | 568 | /* D0 and D1 are memcard presence indicators, D2 indicates memcard |
| 569 | 569 | write protect status (we are always write enabled) */ |
| 570 | return (memcard_present(field-> | |
| 570 | return (memcard_present(field-> | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | |
| r11508 | r11509 | |
| 663 | 663 | |
| 664 | 664 | static CUSTOM_INPUT( get_audio_result ) |
| 665 | 665 | { |
| 666 | neogeo_state *state = field-> | |
| 666 | neogeo_state *state = field-> | |
| 667 | 667 | UINT32 ret = state->m_audio_result; |
| 668 | 668 | |
| 669 | // if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(field-> | |
| 669 | // if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(field-> | |
| 670 | 670 | |
| 671 | 671 | return ret; |
| 672 | 672 | } |
| r11508 | r11509 | |
|---|---|---|
| 244 | 244 | |
| 245 | 245 | static CUSTOM_INPUT( latched_coin_r ) |
| 246 | 246 | { |
| 247 | statriv2_state *state = field-> | |
| 247 | statriv2_state *state = field-> | |
| 248 | 248 | return state->m_latched_coin; |
| 249 | 249 | } |
| 250 | 250 |
| r11508 | r11509 | |
|---|---|---|
| 189 | 189 | |
| 190 | 190 | static INPUT_CHANGED( coin1_inserted ) |
| 191 | 191 | { |
| 192 | ladybug_state *state = field-> | |
| 192 | ladybug_state *state = field-> | |
| 193 | 193 | |
| 194 | 194 | /* left coin insertion causes an NMI */ |
| 195 | 195 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); |
| r11508 | r11509 | |
| 197 | 197 | |
| 198 | 198 | static INPUT_CHANGED( coin2_inserted ) |
| 199 | 199 | { |
| 200 | ladybug_state *state = field-> | |
| 200 | ladybug_state *state = field-> | |
| 201 | 201 | |
| 202 | 202 | /* right coin insertion causes an IRQ */ |
| 203 | 203 | if (newval) |
| r11508 | r11509 | |
| 210 | 210 | |
| 211 | 211 | static CUSTOM_INPUT( ladybug_p1_control_r ) |
| 212 | 212 | { |
| 213 | return input_port_read(field-> | |
| 213 | return input_port_read(field-> | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | static CUSTOM_INPUT( ladybug_p2_control_r ) |
| r11508 | r11509 | |
| 218 | 218 | UINT32 ret; |
| 219 | 219 | |
| 220 | 220 | /* upright cabinet only uses a single set of controls */ |
| 221 | if (input_port_read(field->port->machine(), "DSW0") & 0x20) | |
| 222 | ret = input_port_read(field->port->machine(), LADYBUG_P2_CONTROL_PORT_TAG); | |
| 221 | if (input_port_read(field->machine(), "DSW0") & 0x20) | |
| 222 | ret = input_port_read(field->machine(), LADYBUG_P2_CONTROL_PORT_TAG); | |
| 223 | 223 | else |
| 224 | ret = input_port_read(field-> | |
| 224 | ret = input_port_read(field-> | |
| 225 | 225 | |
| 226 | 226 | return ret; |
| 227 | 227 | } |
| r11508 | r11509 | |
|---|---|---|
| 67 | 67 | |
| 68 | 68 | static CUSTOM_INPUT( starshp1_analog_r ) |
| 69 | 69 | { |
| 70 | starshp1_state *state = field-> | |
| 70 | starshp1_state *state = field-> | |
| 71 | 71 | int val = 0; |
| 72 | 72 | |
| 73 | 73 | switch (state->m_analog_in_select) |
| 74 | 74 | { |
| 75 | 75 | case 0: |
| 76 | val = input_port_read(field-> | |
| 76 | val = input_port_read(field-> | |
| 77 | 77 | break; |
| 78 | 78 | case 1: |
| 79 | val = input_port_read(field-> | |
| 79 | val = input_port_read(field-> | |
| 80 | 80 | break; |
| 81 | 81 | case 2: |
| 82 | 82 | val = 0x20; /* DAC feedback, not used */ |
| 83 | 83 | break; |
| 84 | 84 | case 3: |
| 85 | val = input_port_read(field-> | |
| 85 | val = input_port_read(field-> | |
| 86 | 86 | break; |
| 87 | 87 | } |
| 88 | 88 | |
| r11508 | r11509 | |
| 92 | 92 | |
| 93 | 93 | static CUSTOM_INPUT( collision_latch_r ) |
| 94 | 94 | { |
| 95 | starshp1_state *state = field-> | |
| 95 | starshp1_state *state = field-> | |
| 96 | 96 | return state->m_collision_latch & 0x0f; |
| 97 | 97 | } |
| 98 | 98 |
| r11508 | r11509 | |
|---|---|---|
| 295 | 295 | |
| 296 | 296 | static CUSTOM_INPUT( analog_delta_r ) |
| 297 | 297 | { |
| 298 | gottlieb_state *state = field-> | |
| 298 | gottlieb_state *state = field-> | |
| 299 | 299 | const char *string = (const char *)param; |
| 300 | 300 | int which = string[0] - '0'; |
| 301 | 301 | |
| 302 | return input_port_read(field-> | |
| 302 | return input_port_read(field-> | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
| r11508 | r11509 | |
| 314 | 314 | |
| 315 | 315 | static CUSTOM_INPUT( stooges_joystick_r ) |
| 316 | 316 | { |
| 317 | gottlieb_state *state = field-> | |
| 317 | gottlieb_state *state = field-> | |
| 318 | 318 | static const char *const joyport[] = { "P2JOY", "P3JOY", "P1JOY", NULL }; |
| 319 | return (joyport[state->m_joystick_select & 3] != NULL) ? input_port_read(field-> | |
| 319 | return (joyport[state->m_joystick_select & 3] != NULL) ? input_port_read(field-> | |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 |
| r11508 | r11509 | |
|---|---|---|
| 357 | 357 | |
| 358 | 358 | static CUSTOM_INPUT( sub_cpu_busy ) |
| 359 | 359 | { |
| 360 | ddragon_state *state = field-> | |
| 360 | ddragon_state *state = field-> | |
| 361 | 361 | return state->m_dd_sub_cpu_busy; |
| 362 | 362 | } |
| 363 | 363 |
| r11508 | r11509 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | static CUSTOM_INPUT( xxmissio_status_r ) |
| 23 | 23 | { |
| 24 | xxmissio_state *state = field-> | |
| 24 | xxmissio_state *state = field-> | |
| 25 | 25 | int bit_mask = (FPTR)param; |
| 26 | 26 | return (state->m_status & bit_mask) ? 1 : 0; |
| 27 | 27 | } |
| r11508 | r11509 | |
|---|---|---|
| 126 | 126 | |
| 127 | 127 | static CUSTOM_INPUT( frame_counter_r ) |
| 128 | 128 | { |
| 129 | groundfx_state *state = field-> | |
| 129 | groundfx_state *state = field-> | |
| 130 | 130 | return state->m_frame_counter; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | static CUSTOM_INPUT( coin_word_r ) |
| 134 | 134 | { |
| 135 | groundfx_state *state = field-> | |
| 135 | groundfx_state *state = field-> | |
| 136 | 136 | return state->m_coin_word; |
| 137 | 137 | } |
| 138 | 138 |
| r11508 | r11509 | |
|---|---|---|
| 289 | 289 | |
| 290 | 290 | static CUSTOM_INPUT( m92_sprite_busy_r ) |
| 291 | 291 | { |
| 292 | m92_state *state = field-> | |
| 292 | m92_state *state = field-> | |
| 293 | 293 | return state->m_sprite_buffer_busy; |
| 294 | 294 | } |
| 295 | 295 |
| r11508 | r11509 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | static INPUT_CHANGED( coin_inserted ) |
| 38 | 38 | { |
| 39 | fcombat_state *state = field-> | |
| 39 | fcombat_state *state = field-> | |
| 40 | 40 | |
| 41 | 41 | /* coin insertion causes an NMI */ |
| 42 | 42 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| r11508 | r11509 | |
|---|---|---|
| 181 | 181 | static CUSTOM_INPUT( dsw_3f_r ) |
| 182 | 182 | { |
| 183 | 183 | const char *tag = (const char *)param; |
| 184 | return input_port_read(field-> | |
| 184 | return input_port_read(field-> | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | static CUSTOM_INPUT( dsw_c0_r ) |
| 188 | 188 | { |
| 189 | 189 | const char *tag = (const char *)param; |
| 190 | return (input_port_read(field-> | |
| 190 | return (input_port_read(field-> | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 |
| r11508 | r11509 | |
|---|---|---|
| 262 | 262 | |
| 263 | 263 | static CUSTOM_INPUT( multigam_inputs_r ) |
| 264 | 264 | { |
| 265 | multigam_state *state = field-> | |
| 265 | multigam_state *state = field-> | |
| 266 | 266 | /* bit 0: serial input (dsw) |
| 267 | 267 | bit 1: coin */ |
| 268 | 268 | return (state->m_in_dsw >> state->m_in_dsw_shift++) & 0x01; |
| r11508 | r11509 | |
|---|---|---|
| 326 | 326 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 327 | 327 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) |
| 328 | 328 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| 329 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_ | |
| 329 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUS | |
| 330 | 330 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 331 | 331 | |
| 332 | 332 | PORT_START("P2") |
| r11508 | r11509 | |
|---|---|---|
| 594 | 594 | if (newval == 0) |
| 595 | 595 | { |
| 596 | 596 | UINT32 credit; |
| 597 | address_space *space = field-> | |
| 597 | address_space *space = field-> | |
| 598 | 598 | |
| 599 | 599 | /* Get the current credit value and add the new coin value */ |
| 600 | 600 | credit = space->read_dword(0x8002c) + (UINT32)(FPTR)param; |
| r11508 | r11509 | |
|---|---|---|
| 119 | 119 | |
| 120 | 120 | static CUSTOM_INPUT( sound_latch_state_r ) |
| 121 | 121 | { |
| 122 | dcheese_state *state = field-> | |
| 122 | dcheese_state *state = field-> | |
| 123 | 123 | return state->m_soundlatch_full; |
| 124 | 124 | } |
| 125 | 125 |
| r11508 | r11509 | |
|---|---|---|
| 92 | 92 | |
| 93 | 93 | static INPUT_CHANGED( coin_inserted ) |
| 94 | 94 | { |
| 95 | brkthru_state *state = field-> | |
| 95 | brkthru_state *state = field-> | |
| 96 | 96 | /* coin insertion causes an IRQ */ |
| 97 | 97 | device_set_input_line(state->m_maincpu, 0, newval ? CLEAR_LINE : ASSERT_LINE); |
| 98 | 98 | } |
| r11508 | r11509 | |
|---|---|---|
| 142 | 142 | |
| 143 | 143 | static CUSTOM_INPUT( get_vblank ) |
| 144 | 144 | { |
| 145 | cloud9_state *state = field->port->machine().driver_data<cloud9_state>(); | |
| 146 | int scanline = field->port->machine().primary_screen->vpos(); | |
| 145 | cloud9_state *state = field->machine().driver_data<cloud9_state>(); | |
| 146 | int scanline = field->machine().primary_screen->vpos(); | |
| 147 | 147 | return (~state->m_syncprom[scanline & 0xff] >> 1) & 1; |
| 148 | 148 | } |
| 149 | 149 |
| r11508 | r11509 | |
|---|---|---|
| 146 | 146 | |
| 147 | 147 | static CUSTOM_INPUT( hi_bits_r ) |
| 148 | 148 | { |
| 149 | return input_port_read(field-> | |
| 149 | return input_port_read(field-> | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 |
| r11508 | r11509 | |
|---|---|---|
| 133 | 133 | static CUSTOM_INPUT( exerion_controls_r ) |
| 134 | 134 | { |
| 135 | 135 | static const char *const inname[2] = { "P1", "P2" }; |
| 136 | exerion_state *state = field->port->machine().driver_data<exerion_state>(); | |
| 137 | return input_port_read(field->port->machine(), inname[state->m_cocktail_flip]) & 0x3f; | |
| 136 | exerion_state *state = field->machine().driver_data<exerion_state>(); | |
| 137 | return input_port_read(field->machine(), inname[state->m_cocktail_flip]) & 0x3f; | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | static INPUT_CHANGED( coin_inserted ) |
| 142 | 142 | { |
| 143 | exerion_state *state = field-> | |
| 143 | exerion_state *state = field-> | |
| 144 | 144 | /* coin insertion causes an NMI */ |
| 145 | 145 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| 146 | 146 | } |
| r11508 | r11509 | |
|---|---|---|
| 84 | 84 | static INPUT_CHANGED( coin_inserted ) |
| 85 | 85 | { |
| 86 | 86 | if(newval != oldval) |
| 87 | cputag_set_input_line(field-> | |
| 87 | cputag_set_input_line(field-> | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | static INPUT_PORTS_START( tryout ) |
| r11508 | r11509 | |
|---|---|---|
| 927 | 927 | int globalyscroll = (state->m_vregs[2] | state->m_vregs[3]<<8); |
| 928 | 928 | int globalxscroll = (state->m_vregs[0] | state->m_vregs[1]<<8); |
| 929 | 929 | UINT8* front_rowscroll = &state->m_videoram[0x200]; |
| 930 | const | |
| 930 | ioport_constr | |
| 931 | 931 | int i; |
| 932 | 932 | |
| 933 | 933 | // align to 0 |
| r11508 | r11509 | |
|---|---|---|
| 332 | 332 | |
| 333 | 333 | static CUSTOM_INPUT( tempest_knob_r ) |
| 334 | 334 | { |
| 335 | tempest_state *state = field->port->machine().driver_data<tempest_state>(); | |
| 336 | return input_port_read(field->port->machine(), (state->m_player_select == 0) ? | |
| 335 | tempest_state *state = field->machine().driver_data<tempest_state>(); | |
| 336 | return input_port_read(field->machine(), (state->m_player_select == 0) ? | |
| 337 | 337 | TEMPEST_KNOB_P1_TAG : TEMPEST_KNOB_P2_TAG); |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | static CUSTOM_INPUT( tempest_buttons_r ) |
| 341 | 341 | { |
| 342 | tempest_state *state = field->port->machine().driver_data<tempest_state>(); | |
| 343 | return input_port_read(field->port->machine(), (state->m_player_select == 0) ? | |
| 342 | tempest_state *state = field->machine().driver_data<tempest_state>(); | |
| 343 | return input_port_read(field->machine(), (state->m_player_select == 0) ? | |
| 344 | 344 | TEMPEST_BUTTONS_P1_TAG : TEMPEST_BUTTONS_P2_TAG); |
| 345 | 345 | } |
| 346 | 346 | |
| r11508 | r11509 | |
| 348 | 348 | static CUSTOM_INPUT( clock_r ) |
| 349 | 349 | { |
| 350 | 350 | /* Emulate the 3kHz source on bit 7 (divide 1.5MHz by 512) */ |
| 351 | return (field-> | |
| 351 | return (field-> | |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 |
| r11508 | r11509 | |
|---|---|---|
| 83 | 83 | static CUSTOM_INPUT( analog_ctrl_r ) |
| 84 | 84 | { |
| 85 | 85 | const char *tag = (const char *)param; |
| 86 | return input_port_read(field-> | |
| 86 | return input_port_read(field-> | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | static WRITE32_HANDLER( int_ack_w ) |
| r11508 | r11509 | |
|---|---|---|
| 152 | 152 | |
| 153 | 153 | static CUSTOM_INPUT( narc_talkback_strobe_r ) |
| 154 | 154 | { |
| 155 | return (williams_narc_talkback_r(field-> | |
| 155 | return (williams_narc_talkback_r(field-> | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | static CUSTOM_INPUT( narc_talkback_data_r ) |
| 160 | 160 | { |
| 161 | return williams_narc_talkback_r(field-> | |
| 161 | return williams_narc_talkback_r(field-> | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | static CUSTOM_INPUT( adpcm_irq_state_r ) |
| 166 | 166 | { |
| 167 | return williams_adpcm_sound_irq_r(field-> | |
| 167 | return williams_adpcm_sound_irq_r(field-> | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 |
| r11508 | r11509 | |
|---|---|---|
| 258 | 258 | |
| 259 | 259 | static CUSTOM_INPUT( clock_r ) |
| 260 | 260 | { |
| 261 | return (field-> | |
| 261 | return (field-> | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 |
| r11508 | r11509 | |
|---|---|---|
| 320 | 320 | static CUSTOM_INPUT( clock_r ) |
| 321 | 321 | { |
| 322 | 322 | /* 2.4kHz (divide 2.5MHz by 1024) */ |
| 323 | return (field-> | |
| 323 | return (field-> | |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 |
| r11508 | r11509 | |
|---|---|---|
| 387 | 387 | |
| 388 | 388 | static CUSTOM_INPUT( prot_r ) |
| 389 | 389 | { |
| 390 | artmagic_state *state = field-> | |
| 390 | artmagic_state *state = field-> | |
| 391 | 391 | return state->m_prot_output_bit; |
| 392 | 392 | } |
| 393 | 393 |
| r11508 | r11509 | |
|---|---|---|
| 80 | 80 | |
| 81 | 81 | #include "emu.h" |
| 82 | 82 | #include "cpu/z80/z80.h" |
| 83 | #include "deprecat.h" | |
| 84 | 83 | #include "sound/okim6295.h" |
| 85 | 84 | #include "sound/k051649.h" |
| 86 | 85 | #include "includes/konamipt.h" |
| r11508 | r11509 | |
| 102 | 101 | if ((data & 0xdc) != 0x10) popmessage("coincntr %02x",data); |
| 103 | 102 | } |
| 104 | 103 | |
| 104 | /* probably not? */ | |
| 105 | static WRITE8_HANDLER( hexion_irq_ack_w ) | |
| 106 | { | |
| 107 | cputag_set_input_line(space->machine(), "maincpu", 0, CLEAR_LINE); | |
| 108 | } | |
| 105 | 109 | |
| 110 | static WRITE8_HANDLER( hexion_nmi_ack_w ) | |
| 111 | { | |
| 112 | cputag_set_input_line(space->machine(), "maincpu", INPUT_LINE_NMI, CLEAR_LINE); | |
| 113 | } | |
| 106 | 114 | |
| 107 | 115 | static ADDRESS_MAP_START( hexion_map, AS_PROGRAM, 8 ) |
| 108 | 116 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| r11508 | r11509 | |
| 114 | 122 | AM_RANGE(0xe880, 0xe889) AM_DEVWRITE("konami", k051649_frequency_w) |
| 115 | 123 | AM_RANGE(0xe88a, 0xe88e) AM_DEVWRITE("konami", k051649_volume_w) |
| 116 | 124 | AM_RANGE(0xe88f, 0xe88f) AM_DEVWRITE("konami", k051649_keyonoff_w) |
| 117 | AM_RANGE(0xf000, 0xf00f) AM_WRITENOP /* 053252? f00e = IRQ ack, f00f = NMI ack */ | |
| 125 | AM_RANGE(0xf000, 0xf00d) AM_RAM /* 053252? f00e = IRQ ack, f00f = NMI ack */ | |
| 126 | AM_RANGE(0xf00e, 0xf00e) AM_WRITE(hexion_irq_ack_w) | |
| 127 | AM_RANGE(0xf00f, 0xf00f) AM_WRITE(hexion_nmi_ack_w) | |
| 118 | 128 | AM_RANGE(0xf200, 0xf200) AM_DEVWRITE_MODERN("oki", okim6295_device, write) |
| 119 | 129 | AM_RANGE(0xf400, 0xf400) AM_READ_PORT("DSW1") |
| 120 | 130 | AM_RANGE(0xf401, 0xf401) AM_READ_PORT("DSW2") |
| r11508 | r11509 | |
| 207 | 217 | GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 ) |
| 208 | 218 | GFXDECODE_END |
| 209 | 219 | |
| 220 | static TIMER_DEVICE_CALLBACK( hexion_scanline ) | |
| 221 | { | |
| 222 | //hexion_state *state = timer.machine().driver_data<hexion_state>(); | |
| 223 | int scanline = param; | |
| 210 | 224 | |
| 211 | ||
| 212 | static INTERRUPT_GEN( hexion_interrupt ) | |
| 213 | { | |
| 214 | /* NMI handles start and coin inputs, origin unknown */ | |
| 215 | if (cpu_getiloops(device)) | |
| 216 | device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); | |
| 217 | else | |
| 218 | device_set_input_line(device, 0, HOLD_LINE); | |
| 225 | if(scanline == 256) | |
| 226 | cputag_set_input_line(timer.machine(), "maincpu", 0, ASSERT_LINE); | |
| 227 | else if ((scanline == 85) || (scanline == 170)) | |
| 228 | cputag_set_input_line(timer.machine(), "maincpu", INPUT_LINE_NMI, ASSERT_LINE); | |
| 219 | 229 | } |
| 220 | 230 | |
| 221 | 231 | static MACHINE_CONFIG_START( hexion, hexion_state ) |
| r11508 | r11509 | |
| 223 | 233 | /* basic machine hardware */ |
| 224 | 234 | MCFG_CPU_ADD("maincpu", Z80,24000000/4) /* Z80B 6 MHz */ |
| 225 | 235 | MCFG_CPU_PROGRAM_MAP(hexion_map) |
| 226 | MCFG_ | |
| 236 | MCFG_TIMER_ | |
| 227 | 237 | |
| 228 | 238 | /* video hardware */ |
| 229 | 239 | MCFG_SCREEN_ADD("screen", RASTER) |
| 230 | 240 | MCFG_SCREEN_REFRESH_RATE(60) |
| 231 | 241 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 232 | 242 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 233 | MCFG_SCREEN_SIZE(64*8, 3 | |
| 243 | MCFG_SCREEN_SIZE(64*8, 36*8) | |
| 234 | 244 | MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1) |
| 235 | 245 | MCFG_SCREEN_UPDATE(hexion) |
| 236 | 246 | |
| r11508 | r11509 | |
| 244 | 254 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 245 | 255 | |
| 246 | 256 | MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified |
| 247 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", | |
| 257 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", | |
| 248 | 258 | |
| 249 | 259 | MCFG_SOUND_ADD("konami", K051649, 24000000/16) |
| 250 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", | |
| 260 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", | |
| 251 | 261 | MACHINE_CONFIG_END |
| 252 | 262 | |
| 253 | 263 | |
| r11508 | r11509 | |
| 277 | 287 | ROM_END |
| 278 | 288 | |
| 279 | 289 | |
| 280 | GAME( 1992, hexion, 0, hexion, hexion, 0, ROT0, "Konami", "Hexion (Japan)", 0 ) | |
| 290 | GAME( 1992, hexion, 0, hexion, hexion, 0, ROT0, "Konami", "Hexion (Japan ver JAB)", 0 ) |
| r11508 | r11509 | |
|---|---|---|
| 378 | 378 | |
| 379 | 379 | static CUSTOM_INPUT( multfish_hopper_r ) |
| 380 | 380 | { |
| 381 | multfish_state *state = field-> | |
| 381 | multfish_state *state = field-> | |
| 382 | 382 | |
| 383 | 383 | if ( state->m_hopper_motor != 0 ) |
| 384 | 384 | { |
| r11508 | r11509 | |
|---|---|---|
| 936 | 936 | |
| 937 | 937 | static CUSTOM_INPUT( ejsakura_keyboard_r ) |
| 938 | 938 | { |
| 939 | seibuspi_state *state = field-> | |
| 939 | seibuspi_state *state = field-> | |
| 940 | 940 | switch(state->m_ejsakura_input_port) |
| 941 | 941 | { |
| 942 | 942 | case 0x01: |
| 943 | return input_port_read(field-> | |
| 943 | return input_port_read(field-> | |
| 944 | 944 | case 0x02: |
| 945 | return input_port_read(field-> | |
| 945 | return input_port_read(field-> | |
| 946 | 946 | case 0x04: |
| 947 | return input_port_read(field-> | |
| 947 | return input_port_read(field-> | |
| 948 | 948 | case 0x08: |
| 949 | return input_port_read(field-> | |
| 949 | return input_port_read(field-> | |
| 950 | 950 | case 0x10: |
| 951 | return input_port_read(field-> | |
| 951 | return input_port_read(field-> | |
| 952 | 952 | default: |
| 953 | return input_port_read(field-> | |
| 953 | return input_port_read(field-> | |
| 954 | 954 | } |
| 955 | 955 | return 0xffffffff; |
| 956 | 956 | } |
| r11508 | r11509 | |
| 1295 | 1295 | static CUSTOM_INPUT( ejanhs_encode ) |
| 1296 | 1296 | { |
| 1297 | 1297 | static const UINT8 encoding[] = { 0x02, 0x10, 0x03, 0x18, 0x04, 0x20, 0x05, 0x28, 0x06, 0x30, 0x07 }; |
| 1298 | input_port_value state = input_port_read(field-> | |
| 1298 | input_port_value state = input_port_read(field-> | |
| 1299 | 1299 | int bit; |
| 1300 | 1300 | |
| 1301 | 1301 | for (bit = 0; bit < ARRAY_LENGTH(encoding); bit++) |
| r11508 | r11509 | |
|---|---|---|
| 428 | 428 | |
| 429 | 429 | static CUSTOM_INPUT( dakkochn_mux_data_r ) |
| 430 | 430 | { |
| 431 | system1_state *state = field-> | |
| 431 | system1_state *state = field-> | |
| 432 | 432 | static const char *const ports[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6" }; |
| 433 | return input_port_read(field-> | |
| 433 | return input_port_read(field-> | |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | |
| 437 | 437 | static CUSTOM_INPUT( dakkochn_mux_status_r ) |
| 438 | 438 | { |
| 439 | system1_state *state = field-> | |
| 439 | system1_state *state = field-> | |
| 440 | 440 | /* reads from here indicate which mux port is selected */ |
| 441 | 441 | return 1 << (state->m_dakkochn_mux_data); |
| 442 | 442 | } |
| r11508 | r11509 | |
|---|---|---|
| 337 | 337 | |
| 338 | 338 | static CUSTOM_INPUT( musobana_outcoin_flag_r ) |
| 339 | 339 | { |
| 340 | niyanpai_state *state = field->port->machine().driver_data<niyanpai_state>(); | |
| 341 | address_space *space = field->port->machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 340 | niyanpai_state *state = field->machine().driver_data<niyanpai_state>(); | |
| 341 | address_space *space = field->machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 342 | 342 | // tmp68301_parallel_interface[0x05] |
| 343 | 343 | // bit 0 coin counter |
| 344 | 344 | // bit 2 motor on |
| r11508 | r11509 | |
|---|---|---|
| 2864 | 2864 | AM_RANGE(0x8000, 0xFFFF) AM_ROM |
| 2865 | 2865 | ADDRESS_MAP_END |
| 2866 | 2866 | |
| 2867 | ||
| 2867 | #ifdef UNREFERENCED_CODE | |
| 2868 | 2868 | static INPUT_PORTS_START( scorpion2 ) |
| 2869 | 2869 | PORT_START("COINS") |
| 2870 | 2870 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(3) |
| r11508 | r11509 | |
| 3008 | 3008 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 3009 | 3009 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 3010 | 3010 | INPUT_PORTS_END |
| 3011 | #endif | |
| 3011 | 3012 | |
| 3012 | 3013 | static INPUT_PORTS_START( bbrkfst ) |
| 3013 | 3014 | PORT_START("COINS") |
| r11508 | r11509 | |
|---|---|---|
| 438 | 438 | static CUSTOM_INPUT( paddle_r ) |
| 439 | 439 | { |
| 440 | 440 | const char *tag = (const char *)param; |
| 441 | return input_port_read(field-> | |
| 441 | return input_port_read(field-> | |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | static INPUT_PORTS_START( skns ) /* 3 buttons, 2 players */ |
| r11508 | r11509 | |
|---|---|---|
| 2047 | 2047 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_PLAYER(2) // "s" |
| 2048 | 2048 | INPUT_PORTS_END |
| 2049 | 2049 | |
| 2050 | #ifdef UNREFERENCED_CODE | |
| 2050 | 2051 | static INPUT_PORTS_START( HANAFUDA_KEYS_BET_ALT ) |
| 2051 | 2052 | PORT_START("KEY0") |
| 2052 | 2053 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_HANAFUDA_A ) PORT_PLAYER(1) |
| r11508 | r11509 | |
| 2132 | 2133 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2133 | 2134 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2134 | 2135 | INPUT_PORTS_END |
| 2136 | #endif | |
| 2135 | 2137 | |
| 2136 | ||
| 2137 | 2138 | static INPUT_PORTS_START( hanamai ) |
| 2138 | 2139 | PORT_START("DSW0") |
| 2139 | 2140 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| r11508 | r11509 | |
|---|---|---|
| 107 | 107 | |
| 108 | 108 | static INPUT_CHANGED( coin_inserted ) |
| 109 | 109 | { |
| 110 | cputag_set_input_line(field-> | |
| 110 | cputag_set_input_line(field-> | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | static INPUT_PORTS_START( shootout ) |
| r11508 | r11509 | |
|---|---|---|
| 466 | 466 | |
| 467 | 467 | static CUSTOM_INPUT( special_port_r ) |
| 468 | 468 | { |
| 469 | itech32_state *state = field-> | |
| 469 | itech32_state *state = field-> | |
| 470 | 470 | if (state->m_sound_int_state) |
| 471 | 471 | state->m_special_result ^= 1; |
| 472 | 472 |
| r11508 | r11509 | |
|---|---|---|
| 253 | 253 | |
| 254 | 254 | static CUSTOM_INPUT(frame_counter_r) |
| 255 | 255 | { |
| 256 | undrfire_state *state = field-> | |
| 256 | undrfire_state *state = field-> | |
| 257 | 257 | return state->m_frame_counter; |
| 258 | 258 | } |
| 259 | 259 |
| r11508 | r11509 | |
|---|---|---|
| 104 | 104 | |
| 105 | 105 | static INPUT_CHANGED( coin_inserted ) |
| 106 | 106 | { |
| 107 | astrof_state *state = field-> | |
| 107 | astrof_state *state = field-> | |
| 108 | 108 | |
| 109 | 109 | /* coin insertion causes an NMI */ |
| 110 | 110 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); |
| 111 | coin_counter_w(field-> | |
| 111 | coin_counter_w(field-> | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | static INPUT_CHANGED( service_coin_inserted ) |
| 116 | 116 | { |
| 117 | astrof_state *state = field-> | |
| 117 | astrof_state *state = field-> | |
| 118 | 118 | |
| 119 | 119 | /* service coin insertion causes an NMI */ |
| 120 | 120 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); |
| r11508 | r11509 | |
| 123 | 123 | |
| 124 | 124 | static CUSTOM_INPUT( astrof_p1_controls_r ) |
| 125 | 125 | { |
| 126 | return input_port_read(field-> | |
| 126 | return input_port_read(field-> | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
| r11508 | r11509 | |
| 134 | 134 | /* on an upright cabinet, a single set of controls |
| 135 | 135 | is connected to both sets of pins on the edge |
| 136 | 136 | connector */ |
| 137 | if (input_port_read(field->port->machine(), "CAB")) | |
| 138 | ret = input_port_read(field->port->machine(), "P2"); | |
| 137 | if (input_port_read(field->machine(), "CAB")) | |
| 138 | ret = input_port_read(field->machine(), "P2"); | |
| 139 | 139 | else |
| 140 | ret = input_port_read(field-> | |
| 140 | ret = input_port_read(field-> | |
| 141 | 141 | |
| 142 | 142 | return ret; |
| 143 | 143 | } |
| r11508 | r11509 | |
| 146 | 146 | static CUSTOM_INPUT( tomahawk_controls_r ) |
| 147 | 147 | { |
| 148 | 148 | UINT32 ret; |
| 149 | astrof_state *state = field-> | |
| 149 | astrof_state *state = field-> | |
| 150 | 150 | |
| 151 | 151 | /* on a cocktail cabinet, two sets of controls are |
| 152 | 152 | multiplexed on a single set of inputs |
| 153 | 153 | (not verified on pcb) */ |
| 154 | 154 | |
| 155 | 155 | if (state->m_flipscreen) |
| 156 | ret = input_port_read(field-> | |
| 156 | ret = input_port_read(field-> | |
| 157 | 157 | else |
| 158 | ret = input_port_read(field-> | |
| 158 | ret = input_port_read(field-> | |
| 159 | 159 | |
| 160 | 160 | return ret; |
| 161 | 161 | } |
| r11508 | r11509 | |
|---|---|---|
| 119 | 119 | |
| 120 | 120 | #include "emu.h" |
| 121 | 121 | #include "cpu/m68000/m68000.h" |
| 122 | #include "deprecat.h" | |
| 123 | 122 | #include "includes/kaneko16.h" |
| 124 | 123 | #include "sound/okim6295.h" |
| 125 | 124 | #include "video/kan_pand.h" |
| r11508 | r11509 | |
| 131 | 130 | pandora_eof(pandora); |
| 132 | 131 | } |
| 133 | 132 | |
| 134 | static | |
| 133 | static | |
| 135 | 134 | { |
| 136 | /* IRQ 3 drives the game, IRQ 5 updates the palette */ | |
| 137 | if (cpu_getiloops(device) != 0) | |
| 138 | device_set_input_line(device, 5, HOLD_LINE); | |
| 139 | else | |
| 140 | device_set_input_line(device, 3, HOLD_LINE); | |
| 135 | int scanline = param; | |
| 136 | ||
| 137 | if(scanline == 224) // vblank-out irq | |
| 138 | cputag_set_input_line(timer.machine(), "maincpu", 3, HOLD_LINE); | |
| 139 | ||
| 140 | /* Pandora "sprite end dma" irq? */ | |
| 141 | if(scanline == 32) | |
| 142 | cputag_set_input_line(timer.machine(), "maincpu", 5, HOLD_LINE); | |
| 141 | 143 | } |
| 142 | 144 | |
| 143 | static INTERRUPT_GEN( galhustl_interrupt ) | |
| 145 | ||
| 146 | static TIMER_DEVICE_CALLBACK( galhustl_scanline ) | |
| 144 | 147 | { |
| 145 | switch ( cpu_getiloops(device) ) | |
| 146 | { | |
| 147 | case 2: device_set_input_line(device, 5, HOLD_LINE); break; | |
| 148 | case 1: device_set_input_line(device, 4, HOLD_LINE); break; | |
| 149 | case 0: device_set_input_line(device, 3, HOLD_LINE); break; | |
| 150 | } | |
| 148 | int scanline = param; | |
| 149 | ||
| 150 | if(scanline == 224) // vblank-out irq | |
| 151 | cputag_set_input_line(timer.machine(), "maincpu", 3, HOLD_LINE); | |
| 152 | ||
| 153 | /* Pandora "sprite end dma" irq? */ | |
| 154 | if(scanline == 32) | |
| 155 | cputag_set_input_line(timer.machine(), "maincpu", 4, HOLD_LINE); | |
| 156 | ||
| 157 | if(scanline == 0) // timer irq? | |
| 158 | cputag_set_input_line(timer.machine(), "maincpu", 5, HOLD_LINE); | |
| 151 | 159 | } |
| 152 | 160 | |
| 153 | 161 | |
| r11508 | r11509 | |
| 231 | 239 | AM_RANGE(0xe00000, 0xe00015) AM_READWRITE(galpanib_calc_r,galpanib_calc_w) /* CALC1 MCU interaction (simulated) */ |
| 232 | 240 | ADDRESS_MAP_END |
| 233 | 241 | |
| 234 | static READ16_HANDLER( | |
| 242 | static READ16_HANDLER( comad_timer_r ) | |
| 235 | 243 | { |
| 236 | return space->machine().ran | |
| 244 | return (space->machine().primary_screen->vpos() & 0x07) << 8; | |
| 237 | 245 | } |
| 238 | 246 | |
| 239 | 247 | /* a kludge! */ |
| 240 | 248 | static READ8_DEVICE_HANDLER( comad_okim6295_r ) |
| 241 | 249 | { |
| 242 | 250 | UINT16 retvalue; |
| 251 | // okim6295_device *oki = downcast<okim6295_device *>(device); | |
| 243 | 252 | |
| 244 | // retvalue = oki | |
| 253 | // retvalue = oki-> | |
| 245 | 254 | retvalue = device->machine().rand(); |
| 246 | 255 | |
| 247 | 256 | return retvalue; |
| r11508 | r11509 | |
| 257 | 266 | AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2_P2") |
| 258 | 267 | AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM") |
| 259 | 268 | // AM_RANGE(0x800006, 0x800007) ?? |
| 260 | AM_RANGE(0x80000a, 0x80000b) AM_READ(kludge) /* bits 8-a = timer? palette update code waits for them to be 111 */ | |
| 261 | AM_RANGE(0x80000c, 0x80000d) AM_READ(kludge) /* missw96 bits 8-a = timer? palette update code waits for them to be 111 */ | |
| 269 | AM_RANGE(0x80000a, 0x80000b) AM_READ(comad_timer_r) /* bits 8-a = timer? palette update code waits for them to be 111 */ | |
| 270 | AM_RANGE(0x80000c, 0x80000d) AM_READ(comad_timer_r) /* missw96 bits 8-a = timer? palette update code waits for them to be 111 */ | |
| 262 | 271 | AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanica_6295_bankswitch_w) /* not sure */ |
| 263 | 272 | AM_RANGE(0xc00000, 0xc0ffff) AM_RAM /* missw96 */ |
| 264 | 273 | AM_RANGE(0xc80000, 0xc8ffff) AM_RAM /* fantasia, newfant */ |
| r11508 | r11509 | |
| 276 | 285 | AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2_P2") |
| 277 | 286 | AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM") |
| 278 | 287 | // AM_RANGE(0x800006, 0x800007) ?? |
| 279 | AM_RANGE(0x800008, 0x800009) AM_READ( | |
| 288 | AM_RANGE(0x800008, 0x800009) AM_READ(comad_timer_r) /* bits 8-a = timer? palette update code waits for them to be 111 */ | |
| 280 | 289 | AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanica_6295_bankswitch_w) /* not sure */ |
| 281 | 290 | AM_RANGE(0xa00000, 0xa00001) AM_WRITENOP /* coin counters, + ? */ |
| 282 | 291 | AM_RANGE(0xc80000, 0xc80001) AM_DEVREAD8("oki", comad_okim6295_r, 0xff00) AM_DEVWRITE8_MODERN("oki", okim6295_device, write, 0xff00) |
| r11508 | r11509 | |
| 343 | 352 | AM_RANGE(0x800000, 0x800001) AM_READ_PORT("DSW1_P1") |
| 344 | 353 | AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2_P2") |
| 345 | 354 | AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM") |
| 346 | AM_RANGE(0x800006, 0x800007) AM_READ(kludge) | |
| 347 | AM_RANGE(0x800008, 0x800009) AM_READ(kludge) | |
| 355 | AM_RANGE(0x800006, 0x800007) AM_READ(comad_timer_r) | |
| 356 | AM_RANGE(0x800008, 0x800009) AM_READ(comad_timer_r) | |
| 348 | 357 | AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanica_6295_bankswitch_w) /* not sure */ |
| 349 | 358 | AM_RANGE(0xa00000, 0xa00001) AM_WRITENOP |
| 350 | 359 | AM_RANGE(0xc80000, 0xc8ffff) AM_RAM |
| r11508 | r11509 | |
| 876 | 885 | /* basic machine hardware */ |
| 877 | 886 | MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) /* verified on pcb */ |
| 878 | 887 | MCFG_CPU_PROGRAM_MAP(galpanic_map) |
| 879 | MCFG_ | |
| 888 | MCFG_TIMER_ | |
| 880 | 889 | |
| 881 | 890 | /* video hardware */ |
| 882 | 891 | MCFG_SCREEN_ADD("screen", RASTER) |
| r11508 | r11509 | |
| 933 | 942 | MCFG_CPU_MODIFY("maincpu") |
| 934 | 943 | MCFG_CPU_CLOCK(12000000) /* ? */ |
| 935 | 944 | MCFG_CPU_PROGRAM_MAP(supmodel_map) |
| 936 | MCFG_ | |
| 945 | // MCFG_TIMER_ | |
| 937 | 946 | |
| 938 | 947 | /* video hardware */ |
| 939 | 948 | MCFG_SCREEN_MODIFY("screen") |
| r11508 | r11509 | |
| 965 | 974 | MCFG_CPU_MODIFY("maincpu") |
| 966 | 975 | MCFG_CPU_CLOCK(12000000) /* ? */ |
| 967 | 976 | MCFG_CPU_PROGRAM_MAP(galhustl_map) |
| 968 | MCFG_CPU_VBLANK_INT_HACK(galhustl_interrupt,3) | |
| 977 | MCFG_TIMER_MODIFY("scantimer") | |
| 978 | MCFG_TIMER_CALLBACK(galhustl_scanline) | |
| 969 | 979 | |
| 970 | 980 | /* video hardware */ |
| 971 | 981 | MCFG_SCREEN_MODIFY("screen") |
| r11508 | r11509 | |
| 983 | 993 | MCFG_CPU_MODIFY("maincpu") |
| 984 | 994 | MCFG_CPU_CLOCK(12000000) /* ? */ |
| 985 | 995 | MCFG_CPU_PROGRAM_MAP(zipzap_map) |
| 986 | MCFG_CPU_VBLANK_INT_HACK(galhustl_interrupt,3) | |
| 996 | MCFG_TIMER_MODIFY("scantimer") | |
| 997 | MCFG_TIMER_CALLBACK(galhustl_scanline) | |
| 987 | 998 | |
| 988 | 999 | /* video hardware */ |
| 989 | 1000 | MCFG_SCREEN_MODIFY("screen") |
| r11508 | r11509 | |
|---|---|---|
| 416 | 416 | |
| 417 | 417 | static CUSTOM_INPUT( p1_controls_r ) |
| 418 | 418 | { |
| 419 | return input_port_read(field-> | |
| 419 | return input_port_read(field-> | |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | |
| 423 | 423 | static CUSTOM_INPUT( p2_controls_r ) |
| 424 | 424 | { |
| 425 | enigma2_state *state = field-> | |
| 425 | enigma2_state *state = field-> | |
| 426 | 426 | if (state->m_flip_screen) |
| 427 | return input_port_read(field-> | |
| 427 | return input_port_read(field-> | |
| 428 | 428 | else |
| 429 | return input_port_read(field-> | |
| 429 | return input_port_read(field-> | |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 |
| r11508 | r11509 | |
|---|---|---|
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | 93 | |
| 94 | ||
| 95 | ||
| 96 | ||
| 97 | ||
| 98 | ||
| 99 | 94 | static MACHINE_RESET( igs ) |
| 100 | 95 | { |
| 101 | 96 | igspoker_state *state = machine.driver_data<igspoker_state>(); |
| r11508 | r11509 | |
| 126 | 121 | } |
| 127 | 122 | |
| 128 | 123 | |
| 129 | ||
| 130 | ||
| 131 | 124 | static TILE_GET_INFO( get_bg_tile_info ) |
| 132 | 125 | { |
| 133 | 126 | igspoker_state *state = machine.driver_data<igspoker_state>(); |
| r11508 | r11509 | |
| 240 | 233 | ---- x--- Hold4 lamp. |
| 241 | 234 | ---- -x-- Hold5 lamp. |
| 242 | 235 | ---- ---x Start lamp. |
| 236 | ||
| 237 | cpokerx set has different layout: | |
| 238 | ||
| 239 | - Lbits - | |
| 240 | 7654 3210 | |
| 241 | ========= | |
| 242 | ---- ---x Start lamp. | |
| 243 | ||
| 244 | ---- ---x Hold1 lamp. | |
| 245 | ---- --x- Hold2 lamp. | |
| 246 | ---- -x-- Hold3 lamp. | |
| 247 | ---- x--- Hold4 lamp. | |
| 248 | ---x ---- Hold5 lamp. | |
| 249 | xx-- ---- one pulse once bet amount allows start. | |
| 243 | 250 | */ |
| 244 | 251 | output_set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 - HOLD 1 */ |
| 245 | 252 | output_set_lamp_value(2, (data >> 5) & 1); /* Lamp 2 - HOLD 2 */ |
| r11508 | r11509 | |
| 313 | 320 | |
| 314 | 321 | static CUSTOM_INPUT( hopper_r ) |
| 315 | 322 | { |
| 316 | igspoker_state *state = field->port->machine().driver_data<igspoker_state>(); | |
| 317 | if (state->m_hopper) return !(field->port->machine().primary_screen->frame_number()%10); | |
| 318 | return input_code_pressed(field->port->machine(), KEYCODE_H); | |
| 323 | igspoker_state *state = field->machine().driver_data<igspoker_state>(); | |
| 324 | if (state->m_hopper) return !(field->machine().primary_screen->frame_number()%10); | |
| 325 | return input_code_pressed(field->machine(), KEYCODE_H); | |
| 319 | 326 | } |
| 320 | 327 | |
| 321 | 328 | static READ8_HANDLER( exp_rom_r ) |
| r11508 | r11509 | |
| 486 | 493 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 487 | 494 | INPUT_PORTS_END |
| 488 | 495 | |
| 496 | static INPUT_PORTS_START( cpokerx ) | |
| 497 | PORT_START("DSW1") | |
| 498 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8") | |
| 499 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 500 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 501 | PORT_DIPNAME( 0x06, 0x06, "Min Bet to Start" ) PORT_DIPLOCATION("SWA:7,6") | |
| 502 | PORT_DIPSETTING( 0x06, "1" ) | |
| 503 | PORT_DIPSETTING( 0x04, "3" ) | |
| 504 | PORT_DIPSETTING( 0x02, "5" ) | |
| 505 | PORT_DIPSETTING( 0x00, "10" ) | |
| 506 | PORT_DIPNAME( 0x18, 0x10, "Max Bet" ) PORT_DIPLOCATION("SWA:5,4") | |
| 507 | PORT_DIPSETTING( 0x18, "3" ) | |
| 508 | PORT_DIPSETTING( 0x10, "5" ) | |
| 509 | PORT_DIPSETTING( 0x08, "20" ) | |
| 510 | PORT_DIPSETTING( 0x00, "40" ) | |
| 511 | PORT_DIPNAME( 0x60, 0x60, "Min Bet to play Fever" ) PORT_DIPLOCATION("SWA:3,2") | |
| 512 | PORT_DIPSETTING( 0x60, "1" ) | |
| 513 | PORT_DIPSETTING( 0x40, "5" ) | |
| 514 | PORT_DIPSETTING( 0x20, "10" ) | |
| 515 | PORT_DIPSETTING( 0x00, "20" ) | |
| 516 | PORT_DIPNAME( 0x80, 0x00, "Credit Limit" ) PORT_DIPLOCATION("SWA:1") | |
| 517 | PORT_DIPSETTING( 0x80, "5000" ) | |
| 518 | PORT_DIPSETTING( 0x00, "10000" ) | |
| 519 | ||
| 520 | PORT_START("DSW2") | |
| 521 | PORT_DIPNAME( 0x07, 0x07, "Coin In Rate" ) PORT_DIPLOCATION("SWB:8,7,6") | |
| 522 | PORT_DIPSETTING( 0x07, "1" ) | |
| 523 | PORT_DIPSETTING( 0x06, "2" ) | |
| 524 | PORT_DIPSETTING( 0x05, "5" ) | |
| 525 | PORT_DIPSETTING( 0x04, "10" ) | |
| 526 | PORT_DIPSETTING( 0x03, "20" ) | |
| 527 | PORT_DIPSETTING( 0x02, "40" ) | |
| 528 | PORT_DIPSETTING( 0x01, "50" ) | |
| 529 | PORT_DIPSETTING( 0x00, "100" ) | |
| 530 | PORT_DIPNAME( 0x18, 0x18, "Key In Rate" ) PORT_DIPLOCATION("SWB:5,4") | |
| 531 | PORT_DIPSETTING( 0x18, "10" ) | |
| 532 | PORT_DIPSETTING( 0x10, "20" ) | |
| 533 | PORT_DIPSETTING( 0x08, "50" ) | |
| 534 | PORT_DIPSETTING( 0x00, "100" ) | |
| 535 | PORT_DIPNAME( 0x60, 0x60, "Key Out Rate" ) PORT_DIPLOCATION("SWB:3,2") | |
| 536 | PORT_DIPSETTING( 0x60, "1:1" ) | |
| 537 | PORT_DIPSETTING( 0x40, "10:1" ) | |
| 538 | PORT_DIPSETTING( 0x20, "100:1" ) | |
| 539 | PORT_DIPSETTING( 0x00, "100:1" ) | |
| 540 | PORT_DIPNAME( 0x80, 0x80, "Payout" ) PORT_DIPLOCATION("SWB:1") | |
| 541 | PORT_DIPSETTING( 0x80, "Manual" ) | |
| 542 | PORT_DIPSETTING( 0x00, "Auto" ) | |
| 543 | ||
| 544 | PORT_START("DSW3") | |
| 545 | PORT_DIPNAME( 0x01, 0x01, "W-UP Bonus Target" ) PORT_DIPLOCATION("SWC:8") | |
| 546 | PORT_DIPSETTING( 0x01, "3000" ) | |
| 547 | PORT_DIPSETTING( 0x00, "5000" ) | |
| 548 | PORT_DIPNAME( 0x02, 0x02, "W-UP Bonus Rate" ) PORT_DIPLOCATION("SWC:7") | |
| 549 | PORT_DIPSETTING( 0x02, "300" ) | |
| 550 | PORT_DIPSETTING( 0x00, "500" ) | |
| 551 | PORT_DIPNAME( 0x0c, 0x0c, "W-UP Chance" ) PORT_DIPLOCATION("SWC:6,5") | |
| 552 | PORT_DIPSETTING( 0x0c, "94%" ) | |
| 553 | PORT_DIPSETTING( 0x08, "96%" ) | |
| 554 | PORT_DIPSETTING( 0x04, "98%" ) | |
| 555 | PORT_DIPSETTING( 0x00, "100%" ) | |
| 556 | PORT_DIPNAME( 0x30, 0x20, "W-UP Type" ) PORT_DIPLOCATION("SWC:4,3") | |
| 557 | PORT_DIPSETTING( 0x30, DEF_STR( None ) ) | |
| 558 | PORT_DIPSETTING( 0x20, "High-Low" ) | |
| 559 | PORT_DIPSETTING( 0x10, "Red-Black" ) /* Bit 4 is equal for ON/OFF */ | |
| 560 | PORT_DIPNAME( 0x40, 0x00, "Strip Girl" ) PORT_DIPLOCATION("SWC:2") | |
| 561 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) | |
| 562 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 563 | PORT_DIPNAME( 0x80, 0x00, "Anytime Key-in" ) PORT_DIPLOCATION("SWC:1") | |
| 564 | PORT_DIPSETTING( 0x80, DEF_STR( No ) ) | |
| 565 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 566 | ||
| 567 | PORT_START("DSW4") | |
| 568 | PORT_DIPNAME( 0x0f, 0x07, "Main Game Chance" ) PORT_DIPLOCATION("SWD:8,7,6,5") | |
| 569 | PORT_DIPSETTING( 0x0f, "69%" ) | |
| 570 | PORT_DIPSETTING( 0x0e, "72%" ) | |
| 571 | PORT_DIPSETTING( 0x0d, "75%" ) | |
| 572 | PORT_DIPSETTING( 0x0c, "78%" ) | |
| 573 | PORT_DIPSETTING( 0x0b, "81%" ) | |
| 574 | PORT_DIPSETTING( 0x0a, "83%" ) | |
| 575 | PORT_DIPSETTING( 0x09, "85%" ) | |
| 576 | PORT_DIPSETTING( 0x08, "87%" ) | |
| 577 | PORT_DIPSETTING( 0x07, "89%" ) | |
| 578 | PORT_DIPSETTING( 0x06, "91%" ) | |
| 579 | PORT_DIPSETTING( 0x05, "93%" ) | |
| 580 | PORT_DIPSETTING( 0x04, "95%" ) | |
| 581 | PORT_DIPSETTING( 0x03, "97%" ) | |
| 582 | PORT_DIPSETTING( 0x02, "99%" ) | |
| 583 | PORT_DIPSETTING( 0x01, "101%" ) | |
| 584 | PORT_DIPSETTING( 0x00, "103%" ) | |
| 585 | PORT_DIPNAME( 0x10, 0x00, "Five Jokers" ) PORT_DIPLOCATION("SWD:4") | |
| 586 | PORT_DIPSETTING( 0x10, DEF_STR( No ) ) | |
| 587 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 588 | PORT_DIPNAME( 0x20, 0x00, "Royal Flush" ) PORT_DIPLOCATION("SWD:3") | |
| 589 | PORT_DIPSETTING( 0x20, DEF_STR( No ) ) | |
| 590 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 591 | PORT_DIPNAME( 0x40, 0x00, "Auto Hold" ) PORT_DIPLOCATION("SWD:2") | |
| 592 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) | |
| 593 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 594 | PORT_DIPNAME( 0x80, 0x00, "Hopper" ) PORT_DIPLOCATION("SWD:1") | |
| 595 | PORT_DIPSETTING( 0x80, DEF_STR( No ) ) | |
| 596 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) | |
| 597 | ||
| 598 | PORT_START("DSW5") | |
| 599 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 600 | ||
| 601 | PORT_START("SERVICE") | |
| 602 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 603 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Attendent") | |
| 604 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW") // hopper sensor | |
| 605 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 606 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 607 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 608 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Operator") | |
| 609 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 610 | ||
| 611 | PORT_START("COINS") | |
| 612 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 613 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 614 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 615 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) | |
| 616 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) | |
| 617 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 618 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 619 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 620 | ||
| 621 | PORT_START("BUTTONS1") | |
| 622 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Hold 1") | |
| 623 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Hold 2 / Low / Black") | |
| 624 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Hold 3") | |
| 625 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 / High / Red") | |
| 626 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5 / Bet") | |
| 627 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 628 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 629 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 630 | ||
| 631 | PORT_START("BUTTONS2") | |
| 632 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) | |
| 633 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 634 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 635 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE ) | |
| 636 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 637 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 638 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 639 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 640 | INPUT_PORTS_END | |
| 641 | ||
| 489 | 642 | static INPUT_PORTS_START( csk227 ) |
| 490 | 643 | PORT_START("DSW1") |
| 491 | 644 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8") |
| r11508 | r11509 | |
| 1880 | 2033 | ROM_END |
| 1881 | 2034 | |
| 1882 | 2035 | |
| 2036 | /* | |
| 2037 | Champion Poker (IGS) V100. | |
| 2038 | ||
| 2039 | 1x ZILOG Z0840006PSC-Z80CPU (main) | |
| 2040 | ||
| 2041 | 1x oscillator 12.000MHz (main) | |
| 2042 | ||
| 2043 | 1x custom QFP80 label IGS001A | |
| 2044 | 1x custom QFP80 label IGS002 | |
| 2045 | ||
| 2046 | Note | |
| 2047 | ||
| 2048 | 1x 10x2 edge connector (con1) (looks like a coin payout) | |
| 2049 | 1x 36x2 edge connector (con2) | |
| 2050 | 1x switch (sw6) | |
| 2051 | 5x 8 DIP switches (sw1-5) | |
| 2052 | 1x trimmer (volume) | |
| 2053 | ---------------------- | |
| 2054 | IGS PCB NO-0139-3 | |
| 2055 | ||
| 2056 | */ | |
| 2057 | ||
| 2058 | ROM_START( cpokerx ) | |
| 2059 | ROM_REGION( 0x20000, "maincpu", 0 ) | |
| 2060 | ROM_LOAD( "champion_v-100.bin", 0x00000, 0x10000, CRC(00fc9fc3) SHA1(ee6d4e156f0bf866a4b93272b92bb460dd7e73e1) ) | |
| 2061 | ROM_LOAD( "champion7.u22", 0x18000, 0x8000, CRC(123ff157) SHA1(aa1d1dc589a2d1ca38b667ab88706280347088b4) ) | |
| 2062 | ROM_IGNORE( 0x8000) | |
| 2063 | ||
| 2064 | ROM_REGION( 0x60000, "gfx1", 0 ) | |
| 2065 | ROM_LOAD( "champion3.u6", 0x00000, 0x20000, CRC(f3e61b24) SHA1(b18998defb6e51daef4ac5a5865674565ffb9029) ) | |
| 2066 | ROM_LOAD( "champion2.u5", 0x20000, 0x20000, CRC(a68b305f) SHA1(f872d2bf7ab194145dffe6b254ae0ad66aa6a497) ) | |
| 2067 | ROM_LOAD( "champion1.u4", 0x40000, 0x20000, CRC(860be7c9) SHA1(41bc58713076276aeefc44c7ea903549692b0224) ) | |
| 2068 | ||
| 2069 | //copy? | |
| 2070 | ROM_REGION( 0x60000, "gfx2", 0 ) | |
| 2071 | ROM_COPY( "gfx1", 0, 0, 0x60000 ) | |
| 2072 | ||
| 2073 | ROM_REGION( 0x4000, "plds", 0 ) | |
| 2074 | ROM_LOAD( "16v8b.u31", 0x00000, 0x000892, BAD_DUMP CRC(33dec5f5) SHA1(f5c2e45513fa3657160ff38111a745f76cf679e1) ) // all 0's, seems protected | |
| 2075 | ROM_LOAD( "16v8h.u14", 0x01000, 0x000892, CRC(123d539a) SHA1(cccf0cbae3175b091a998eedf4aa44a55b679400) ) | |
| 2076 | ROM_LOAD( "22v10b.u22", 0x02000, 0x001704, CRC(609a1aaa) SHA1(b123c93929f932e4ee343a7109f8b16717845d8b) ) | |
| 2077 | ROM_END | |
| 2078 | ||
| 2079 | ||
| 1883 | 2080 | ROM_START( igs_ncs ) |
| 1884 | 2081 | ROM_REGION( 0x20000, "maincpu", 0 ) |
| 1885 | 2082 | ROM_LOAD( "v.bin", 0x00000, 0x10000, CRC(8077724b) SHA1(1f6e01d5838e6ec4f91b07637c281a3f59631a51) ) |
| r11508 | r11509 | |
| 2237 | 2434 | |
| 2238 | 2435 | GAMEL( 1993?, cpoker, 0, igspoker, cpoker, cpoker, ROT0, "IGS", "Champion Poker (v220I)", 0, layout_igspoker ) |
| 2239 | 2436 | GAMEL( 1993?, cpokert, cpoker, igspoker, cpoker, cpokert, ROT0, "IGS (Tuning license)", "Champion Poker (v200G)", 0, layout_igspoker ) |
| 2437 | GAMEL( 1993, cpokerx, cpoker, igspoker, cpokerx, cpokert, ROT0, "IGS", "Champion Poker (v100)", 0, layout_igspoker ) | |
| 2240 | 2438 | GAMEL( 2000, chleague, 0, igspoker, chleague, chleague, ROT0, "IGS", "Champion League (Poker)", 0, layout_igspoker ) |
| 2241 | 2439 | GAMEL( 2000, chleagul, chleague, igspoker, chleague, chleague, ROT0, "IGS", "Champion League (Lattine)", 0, layout_igspoker ) |
| 2242 | GAMEL( 198?, csk227it, 0, csk227it, csk227, cska, ROT0, "IGS", "Champion Skill (with Ability)", 0, layout_igspoker ) /* SU 062 */ | |
| 2243 | GAMEL( 198?, csk234it, csk227it, csk234it, csk234, cska, ROT0, "IGS", "Champion Skill (Ability, Poker & Symbols)", 0, layout_igspoker ) /* SU 062 */ | |
| 2440 | GAMEL( 198?, csk227it, 0, csk227it, csk227, cska, ROT0, "IGS", "Champion Skill (with Ability)", 0, layout_igspoker ) /* SU 062 */ | |
| 2441 | GAMEL( 198?, csk234it, csk227it, csk234it, csk234, cska, ROT0, "IGS", "Champion Skill (Ability, Poker & Symbols)", 0, layout_igspoker ) /* SU 062 */ | |
| 2244 | 2442 | GAMEL( 2000, number10, 0, number10, number10, number10, ROT0, "PlayMark SRL", "Number Dieci (Poker)", 0, layout_igspoker ) |
| 2245 | 2443 | GAMEL( 2000, numbr10l, number10, number10, number10, number10, ROT0, "PlayMark SRL", "Number Dieci (Lattine)", 0, layout_igspoker ) |
| 2246 | GAMEL( 198?, | |
| 2444 | GAMEL( 198?, | |
| 2247 | 2445 | GAMEL( 199?, cpokerpk, 0, cpokerpk, cpokerpk, cpokerpk, ROT0, "bootleg (SGS)", "Champion Italian PK (bootleg, blue board)", 0, layout_igspoker ) |
| 2248 | 2446 | GAMEL( 199?, cpokerpkg, cpokerpk, cpokerpk, cpokerpk, cpokerpk, ROT0, "bootleg (SGS)", "Champion Italian PK (bootleg, green board)", 0, layout_igspoker ) |
| 2249 | 2447 | GAMEL( 199?, citalcup, cpokerpk, cpokerpk, cpokerpk, cpokerpk, ROT0, "bootleg (SGS)", "Champion Italian Cup (bootleg V220IT)", 0, layout_igspoker ) |
| r11508 | r11509 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | static INPUT_CHANGED( mcu_input ) |
| 83 | 83 | { |
| 84 | cdi_state *state = field-> | |
| 84 | cdi_state *state = field-> | |
| 85 | 85 | scc68070_regs_t *scc68070 = &state->m_scc68070_regs; |
| 86 | 86 | bool send = false; |
| 87 | 87 | |
| 88 | 88 | switch((FPTR)param) |
| 89 | 89 | { |
| 90 | 90 | case 0x39: |
| 91 | if(input_port_read(field-> | |
| 91 | if(input_port_read(field-> | |
| 92 | 92 | break; |
| 93 | 93 | case 0x37: |
| 94 | if(input_port_read(field-> | |
| 94 | if(input_port_read(field-> | |
| 95 | 95 | break; |
| 96 | 96 | case 0x31: |
| 97 | if(input_port_read(field-> | |
| 97 | if(input_port_read(field-> | |
| 98 | 98 | break; |
| 99 | 99 | case 0x32: |
| 100 | if(input_port_read(field-> | |
| 100 | if(input_port_read(field-> | |
| 101 | 101 | break; |
| 102 | 102 | case 0x33: |
| 103 | if(input_port_read(field-> | |
| 103 | if(input_port_read(field-> | |
| 104 | 104 | break; |
| 105 | 105 | |
| 106 | 106 | case 0x30: |
| 107 | if(input_port_read(field-> | |
| 107 | if(input_port_read(field-> | |
| 108 | 108 | break; |
| 109 | 109 | case 0x38: |
| 110 | if(input_port_read(field-> | |
| 110 | if(input_port_read(field-> | |
| 111 | 111 | break; |
| 112 | 112 | case 0x34: |
| 113 | if(input_port_read(field-> | |
| 113 | if(input_port_read(field-> | |
| 114 | 114 | break; |
| 115 | 115 | case 0x35: |
| 116 | if(input_port_read(field-> | |
| 116 | if(input_port_read(field-> | |
| 117 | 117 | break; |
| 118 | 118 | case 0x36: |
| 119 | if(input_port_read(field-> | |
| 119 | if(input_port_read(field-> | |
| 120 | 120 | break; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if(send) |
| 124 | 124 | { |
| 125 | 125 | UINT8 data = (UINT8)((FPTR)param & 0x000000ff); |
| 126 | scc68070_quizard_rx(field-> | |
| 126 | scc68070_quizard_rx(field-> | |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 |
| r11508 | r11509 | |
|---|---|---|
| 168 | 168 | switch (bit_mask) |
| 169 | 169 | { |
| 170 | 170 | case 0x01: |
| 171 | return ((input_port_read(field-> | |
| 171 | return ((input_port_read(field-> | |
| 172 | 172 | case 0x02: |
| 173 | return ((input_port_read(field-> | |
| 173 | return ((input_port_read(field-> | |
| 174 | 174 | default: |
| 175 | 175 | logerror("sidewndr_payout_r : invalid %02X bit_mask\n",bit_mask); |
| 176 | 176 | return 0; |
| r11508 | r11509 | |
| 184 | 184 | switch (bit_mask) |
| 185 | 185 | { |
| 186 | 186 | case 0x01: |
| 187 | return ((input_port_read(field-> | |
| 187 | return ((input_port_read(field-> | |
| 188 | 188 | case 0x02: |
| 189 | return ((input_port_read(field-> | |
| 189 | return ((input_port_read(field-> | |
| 190 | 190 | case 0x04: |
| 191 | return ((input_port_read(field-> | |
| 191 | return ((input_port_read(field-> | |
| 192 | 192 | case 0x08: |
| 193 | return ((input_port_read(field-> | |
| 193 | return ((input_port_read(field-> | |
| 194 | 194 | default: |
| 195 | 195 | logerror("starspnr_coinage_r : invalid %02X bit_mask\n",bit_mask); |
| 196 | 196 | return 0; |
| r11508 | r11509 | |
| 204 | 204 | switch (bit_mask) |
| 205 | 205 | { |
| 206 | 206 | case 0x01: |
| 207 | return ((input_port_read(field-> | |
| 207 | return ((input_port_read(field-> | |
| 208 | 208 | case 0x02: |
| 209 | return ((input_port_read(field-> | |
| 209 | return ((input_port_read(field-> | |
| 210 | 210 | case 0x04: |
| 211 | return ((input_port_read(field-> | |
| 211 | return ((input_port_read(field-> | |
| 212 | 212 | default: |
| 213 | 213 | logerror("starspnr_payout_r : invalid %02X bit_mask\n",bit_mask); |
| 214 | 214 | return 0; |
| r11508 | r11509 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | static CUSTOM_INPUT( get_lever ) |
| 21 | 21 | { |
| 22 | sprint4_state *state = field-> | |
| 22 | sprint4_state *state = field-> | |
| 23 | 23 | int n = (FPTR) param; |
| 24 | 24 | |
| 25 | 25 | return 4 * state->m_gear[n] > state->m_da_latch; |
| r11508 | r11509 | |
| 28 | 28 | |
| 29 | 29 | static CUSTOM_INPUT( get_wheel ) |
| 30 | 30 | { |
| 31 | sprint4_state *state = field-> | |
| 31 | sprint4_state *state = field-> | |
| 32 | 32 | int n = (FPTR) param; |
| 33 | 33 | |
| 34 | 34 | return 8 * state->m_steer_FF1[n] + 8 * state->m_steer_FF2[n] > state->m_da_latch; |
| r11508 | r11509 | |
| 37 | 37 | |
| 38 | 38 | static CUSTOM_INPUT( get_collision ) |
| 39 | 39 | { |
| 40 | sprint4_state *state = field-> | |
| 40 | sprint4_state *state = field-> | |
| 41 | 41 | int n = (FPTR) param; |
| 42 | 42 | |
| 43 | 43 | return state->m_collision[n]; |
| r11508 | r11509 | |
|---|---|---|
| 112 | 112 | |
| 113 | 113 | static CUSTOM_INPUT( spriteram_bit_r ) |
| 114 | 114 | { |
| 115 | limenko_state *state = field-> | |
| 115 | limenko_state *state = field-> | |
| 116 | 116 | return state->m_spriteram_bit; |
| 117 | 117 | } |
| 118 | 118 |
| r11508 | r11509 | |
|---|---|---|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
| 351 | static CUSTOM_INPUT( high_port_r ) { return input_port_read(field->port->machine(), (const char *)param) >> 4; } | |
| 352 | static CUSTOM_INPUT( low_port_r ) { return input_port_read(field->port->machine(), (const char *)param) & 0x0f; } | |
| 351 | static CUSTOM_INPUT( high_port_r ) { return input_port_read(field->machine(), (const char *)param) >> 4; } | |
| 352 | static CUSTOM_INPUT( low_port_r ) { return input_port_read(field->machine(), (const char *)param) & 0x0f; } | |
| 353 | 353 | static CUSTOM_INPUT( auto_start_r ) |
| 354 | 354 | { |
| 355 | polepos_state *state = field-> | |
| 355 | polepos_state *state = field-> | |
| 356 | 356 | return state->m_auto_start_mask; |
| 357 | 357 | } |
| 358 | 358 |
| r11508 | r11509 | |
|---|---|---|
| 37 | 37 | |
| 38 | 38 | static CUSTOM_INPUT( inputs_r ) |
| 39 | 39 | { |
| 40 | qdrmfgp_state *state = field-> | |
| 40 | qdrmfgp_state *state = field-> | |
| 41 | 41 | const char *tag1 = (const char *)param; |
| 42 | 42 | const char *tag2 = tag1 + strlen(tag1) + 1; |
| 43 | return input_port_read(field-> | |
| 43 | return input_port_read(field-> | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | static CUSTOM_INPUT( battery_sensor_r ) |
| r11508 | r11509 | |
|---|---|---|
| 264 | 264 | static CUSTOM_INPUT( stratgyx_coinage_r ) |
| 265 | 265 | { |
| 266 | 266 | int bit_mask = (FPTR)param; |
| 267 | return (input_port_read(field-> | |
| 267 | return (input_port_read(field-> | |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 |
| r11508 | r11509 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | static CUSTOM_INPUT( get_motor_not_ready ) |
| 57 | 57 | { |
| 58 | stactics_state *state = field-> | |
| 58 | stactics_state *state = field-> | |
| 59 | 59 | |
| 60 | 60 | /* if the motor is self-centering, but not centered yet */ |
| 61 | 61 | return ((*state->m_motor_on & 0x01) == 0) && |
| r11508 | r11509 | |
| 130 | 130 | static CUSTOM_INPUT( get_rng ) |
| 131 | 131 | { |
| 132 | 132 | /* this is a 555 timer, but cannot read one of the resistor values */ |
| 133 | return field-> | |
| 133 | return field-> | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 |
| r11508 | r11509 | |
|---|---|---|
| 161 | 161 | |
| 162 | 162 | static CUSTOM_INPUT( cclownz_paddle ) |
| 163 | 163 | { |
| 164 | int value = input_port_read(field-> | |
| 164 | int value = input_port_read(field-> | |
| 165 | 165 | return ((value << 4) & 0xf00) | (value & 0x00f); |
| 166 | 166 | } |
| 167 | 167 |
| r11508 | r11509 | |
|---|---|---|
| 728 | 728 | |
| 729 | 729 | static CUSTOM_INPUT( special_r ) |
| 730 | 730 | { |
| 731 | itech8_state *state = field-> | |
| 731 | itech8_state *state = field-> | |
| 732 | 732 | return state->m_pia_portb_data & 0x01; |
| 733 | 733 | } |
| 734 | 734 | |
| r11508 | r11509 | |
| 1102 | 1102 | { |
| 1103 | 1103 | const char *tag1 = (const char *)param; |
| 1104 | 1104 | const char *tag2 = tag1 + strlen(tag1) + 1; |
| 1105 | return input_port_read(field-> | |
| 1105 | return input_port_read(field-> | |
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | static INPUT_PORTS_START( gtg ) |
| r11508 | r11509 | |
|---|---|---|
| 728 | 728 | |
| 729 | 729 | static CUSTOM_INPUT( scramble_protection_alt_r ) |
| 730 | 730 | { |
| 731 | galaxian_state *state = field-> | |
| 731 | galaxian_state *state = field-> | |
| 732 | 732 | /* |
| 733 | 733 | There are two additional bits that are derived from bit 7 of |
| 734 | 734 | the protection result. This is just a guess but works well enough |
| r11508 | r11509 | |
| 1008 | 1008 | |
| 1009 | 1009 | static INPUT_CHANGED( gmgalax_game_changed ) |
| 1010 | 1010 | { |
| 1011 | galaxian_state *state = field->port->machine().driver_data<galaxian_state>(); | |
| 1012 | address_space *space = field->port->machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 1011 | galaxian_state *state = field->machine().driver_data<galaxian_state>(); | |
| 1012 | address_space *space = field->machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 1013 | 1013 | |
| 1014 | 1014 | /* new value is the selected game */ |
| 1015 | 1015 | state->m_gmgalax_selected_game = newval; |
| 1016 | 1016 | |
| 1017 | 1017 | /* select the bank and graphics bank based on it */ |
| 1018 | memory_set_bank(field-> | |
| 1018 | memory_set_bank(field-> | |
| 1019 | 1019 | galaxian_gfxbank_w(space, 0, state->m_gmgalax_selected_game); |
| 1020 | 1020 | |
| 1021 | 1021 | /* reset the stars */ |
| 1022 | 1022 | galaxian_stars_enable_w(space, 0, 0); |
| 1023 | 1023 | |
| 1024 | 1024 | /* reset the CPU */ |
| 1025 | cputag_set_input_line(field-> | |
| 1025 | cputag_set_input_line(field-> | |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | |
| 1029 | 1029 | static CUSTOM_INPUT( gmgalax_port_r ) |
| 1030 | 1030 | { |
| 1031 | galaxian_state *state = field-> | |
| 1031 | galaxian_state *state = field-> | |
| 1032 | 1032 | const char *portname = (const char *)param; |
| 1033 | 1033 | if (state->m_gmgalax_selected_game != 0) |
| 1034 | 1034 | portname += strlen(portname) + 1; |
| 1035 | return input_port_read(field-> | |
| 1035 | return input_port_read(field-> | |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | |
| r11508 | r11509 | |
| 1084 | 1084 | |
| 1085 | 1085 | static CUSTOM_INPUT( azurian_port_r ) |
| 1086 | 1086 | { |
| 1087 | return (input_port_read(field-> | |
| 1087 | return (input_port_read(field-> | |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | |
| r11508 | r11509 | |
| 1097 | 1097 | |
| 1098 | 1098 | static CUSTOM_INPUT( kingball_muxbit_r ) |
| 1099 | 1099 | { |
| 1100 | galaxian_state *state = field-> | |
| 1100 | galaxian_state *state = field-> | |
| 1101 | 1101 | /* multiplex the service mode switch with a speech DIP switch */ |
| 1102 | return (input_port_read(field-> | |
| 1102 | return (input_port_read(field-> | |
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | |
| r11508 | r11509 | |
| 1108 | 1108 | /* bit 5 is the NOISE line from the sound circuit. The code just verifies |
| 1109 | 1109 | that it's working, doesn't actually use return value, so we can just use |
| 1110 | 1110 | rand() */ |
| 1111 | return field-> | |
| 1111 | return field-> | |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | |
| r11508 | r11509 | |
| 2689 | 2689 | memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x4000); |
| 2690 | 2690 | |
| 2691 | 2691 | /* callback when the game select is toggled */ |
| 2692 | gmgalax_game_changed(machine.m_portlist.first()->fieldlist, NULL, 0, 0); | |
| 2692 | gmgalax_game_changed(*state, machine.m_portlist.first()->fieldlist().first(), NULL, 0, 0); | |
| 2693 | 2693 | state_save_register_global(machine, state->m_gmgalax_selected_game); |
| 2694 | 2694 | } |
| 2695 | 2695 |
| r11508 | r11509 | |
|---|---|---|
| 124 | 124 | |
| 125 | 125 | static CUSTOM_INPUT( victnine_mcu_status_bit01_r ) |
| 126 | 126 | { |
| 127 | flstory_state *state = field-> | |
| 127 | flstory_state *state = field-> | |
| 128 | 128 | address_space *space = state->m_maincpu->memory().space(AS_PROGRAM); |
| 129 | 129 | |
| 130 | 130 | return (victnine_mcu_status_r(space, 0) & 3); |
| r11508 | r11509 | |
|---|---|---|
| 1024 | 1024 | PORT_DIPSETTING( 0x00, "50Hz." ) |
| 1025 | 1025 | INPUT_PORTS_END |
| 1026 | 1026 | |
| 1027 | #ifdef UNREFERENCED_CODE | |
| 1027 | 1028 | static INPUT_PORTS_START( stand904 ) |
| 1028 | 1029 | PORT_START("IN0-0") |
| 1029 | 1030 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("0-1") PORT_CODE(KEYCODE_1) |
| r11508 | r11509 | |
| 1128 | 1129 | PORT_DIPSETTING( 0x80, "60Hz." ) |
| 1129 | 1130 | PORT_DIPSETTING( 0x00, "50Hz." ) |
| 1130 | 1131 | INPUT_PORTS_END |
| 1132 | #endif | |
| 1131 | 1133 | |
| 1132 | 1134 | static INPUT_PORTS_START( stand905 ) |
| 1133 | 1135 | PORT_START("IN0-0") |
| r11508 | r11509 | |
|---|---|---|
| 674 | 674 | PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 675 | 675 | INPUT_PORTS_END |
| 676 | 676 | |
| 677 | #ifdef UNREFERENCED_CODE | |
| 677 | 678 | static INPUT_PORTS_START( toaplan1_3b ) |
| 678 | 679 | PORT_INCLUDE( toaplan1_2b ) |
| 679 | 680 | |
| r11508 | r11509 | |
| 683 | 684 | PORT_MODIFY("P2") |
| 684 | 685 | TOAPLAN_JOY_UDLR_3_BUTTONS( 2 ) |
| 685 | 686 | INPUT_PORTS_END |
| 687 | #endif | |
| 686 | 688 | |
| 687 | ||
| 688 | 689 | #define TOAPLAN1_PLAYER_INPUT( player, button3, options ) \ |
| 689 | 690 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(player) options PORT_8WAY \ |
| 690 | 691 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(player) options PORT_8WAY \ |
| r11508 | r11509 | |
|---|---|---|
| 149 | 149 | { |
| 150 | 150 | /* pressing the service switch sends an NMI */ |
| 151 | 151 | if (newval) |
| 152 | cputag_set_input_line(field-> | |
| 152 | cputag_set_input_line(field-> | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 |
| r11508 | r11509 | |
|---|---|---|
| 228 | 228 | UINT32 ret; |
| 229 | 229 | |
| 230 | 230 | /* screen flip multiplexes controls */ |
| 231 | if (suprridr_is_screen_flipped(field->port->machine())) | |
| 232 | ret = input_port_read(field->port->machine(), SUPRRIDR_P2_CONTROL_PORT_TAG); | |
| 231 | if (suprridr_is_screen_flipped(field->machine())) | |
| 232 | ret = input_port_read(field->machine(), SUPRRIDR_P2_CONTROL_PORT_TAG); | |
| 233 | 233 | else |
| 234 | ret = input_port_read(field-> | |
| 234 | ret = input_port_read(field-> | |
| 235 | 235 | |
| 236 | 236 | return ret; |
| 237 | 237 | } |
| r11508 | r11509 | |
|---|---|---|
| 342 | 342 | |
| 343 | 343 | static CUSTOM_INPUT( hopper_r ) |
| 344 | 344 | { |
| 345 | igs009_state *state = field->port->machine().driver_data<igs009_state>(); | |
| 346 | return state->m_hopper && !(field->port->machine().primary_screen->frame_number()%10); | |
| 345 | igs009_state *state = field->machine().driver_data<igs009_state>(); | |
| 346 | return state->m_hopper && !(field->machine().primary_screen->frame_number()%10); | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 |
| r11508 | r11509 | |
|---|---|---|
| 79 | 79 | |
| 80 | 80 | static CUSTOM_INPUT( z80_nmi_r ) |
| 81 | 81 | { |
| 82 | psikyo_state *state = field-> | |
| 82 | psikyo_state *state = field-> | |
| 83 | 83 | int ret = 0x00; |
| 84 | 84 | |
| 85 | 85 | if (state->m_z80_nmi) |
| r11508 | r11509 | |
| 88 | 88 | |
| 89 | 89 | /* main CPU might be waiting for sound CPU to finish NMI, |
| 90 | 90 | so set a timer to give sound CPU a chance to run */ |
| 91 | field-> | |
| 91 | field-> | |
| 92 | 92 | // logerror("%s - Read coin port during Z80 NMI\n", machine.describe_context()); |
| 93 | 93 | } |
| 94 | 94 | |
| r11508 | r11509 | |
| 97 | 97 | |
| 98 | 98 | static CUSTOM_INPUT( mcu_status_r ) |
| 99 | 99 | { |
| 100 | psikyo_state *state = field-> | |
| 100 | psikyo_state *state = field-> | |
| 101 | 101 | int ret = 0x00; |
| 102 | 102 | |
| 103 | 103 | /* Don't know exactly what this bit is, but s1945 and tengai |
| r11508 | r11509 | |
|---|---|---|
| 142 | 142 | |
| 143 | 143 | static CUSTOM_INPUT( snd_ack_r ) |
| 144 | 144 | { |
| 145 | dacholer_state *state = field-> | |
| 145 | dacholer_state *state = field-> | |
| 146 | 146 | return state->m_snd_ack; //guess ... |
| 147 | 147 | } |
| 148 | 148 |
| r11508 | r11509 | |
|---|---|---|
| 217 | 217 | // stops the game hanging.. |
| 218 | 218 | static CUSTOM_INPUT( nb1413m3_hackbusyflag_r ) |
| 219 | 219 | { |
| 220 | return field-> | |
| 220 | return field-> | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | static INPUT_PORTS_START( threeds ) |
| r11508 | r11509 | |
|---|---|---|
| 92 | 92 | |
| 93 | 93 | static CUSTOM_INPUT( frame_counter_r ) |
| 94 | 94 | { |
| 95 | galastrm_state *state = field-> | |
| 95 | galastrm_state *state = field-> | |
| 96 | 96 | return state->m_frame_counter; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | static CUSTOM_INPUT( coin_word_r ) |
| 100 | 100 | { |
| 101 | galastrm_state *state = field-> | |
| 101 | galastrm_state *state = field-> | |
| 102 | 102 | return state->m_coin_word; |
| 103 | 103 | } |
| 104 | 104 |
| r11508 | r11509 | |
|---|---|---|
| 267 | 267 | |
| 268 | 268 | static CUSTOM_INPUT( rocknms_main2sub_status_r ) |
| 269 | 269 | { |
| 270 | tetrisp2_state *state = field-> | |
| 270 | tetrisp2_state *state = field-> | |
| 271 | 271 | return state->m_rocknms_sub2main & 0x0003; |
| 272 | 272 | } |
| 273 | 273 |
| r11508 | r11509 | |
|---|---|---|
| 5290 | 5290 | |
| 5291 | 5291 | static CUSTOM_INPUT( acedrvr_shift_read ) |
| 5292 | 5292 | { |
| 5293 | namcos22_state *state = field->port->machine().driver_data<namcos22_state>(); | |
| 5294 | int shift = input_port_read(field->port->machine(), "SHIFT"); | |
| 5293 | namcos22_state *state = field->machine().driver_data<namcos22_state>(); | |
| 5294 | int shift = input_port_read(field->machine(), "SHIFT"); | |
| 5295 | 5295 | |
| 5296 | 5296 | if (shift > 0 && shift != state->m_prev_stick_state) |
| 5297 | 5297 | { |
| r11508 | r11509 | |
| 5471 | 5471 | |
| 5472 | 5472 | static CUSTOM_INPUT( ridger_gear_read ) |
| 5473 | 5473 | { |
| 5474 | namcos22_state *state = field->port->machine().driver_data<namcos22_state>(); | |
| 5475 | int gear = input_port_read(field->port->machine(), "GEARS"); | |
| 5474 | namcos22_state *state = field->machine().driver_data<namcos22_state>(); | |
| 5475 | int gear = input_port_read(field->machine(), "GEARS"); | |
| 5476 | 5476 | |
| 5477 | 5477 | if (gear > 0 && gear != state->m_prev_stick_state) |
| 5478 | 5478 | { |
| r11508 | r11509 | |
|---|---|---|
| 917 | 917 | switch (bit_mask) |
| 918 | 918 | { |
| 919 | 919 | case 0x40: /* vpool : IN1 (0xa800) bit 6 */ |
| 920 | return ((input_port_read(field-> | |
| 920 | return ((input_port_read(field-> | |
| 921 | 921 | case 0x01: /* vpool : DSW (0xb000) bit 0 */ |
| 922 | return ((input_port_read(field-> | |
| 922 | return ((input_port_read(field-> | |
| 923 | 923 | |
| 924 | 924 | default: |
| 925 | 925 | logerror("vpool_lives_r : invalid %02X bit_mask\n",bit_mask); |
| r11508 | r11509 | |
| 1064 | 1064 | switch (bit_mask) |
| 1065 | 1065 | { |
| 1066 | 1066 | case 0x0c: /* ckongg : DSW (0xc800) bits 2 and 3 */ |
| 1067 | return ((input_port_read(field-> | |
| 1067 | return ((input_port_read(field-> | |
| 1068 | 1068 | case 0x40: /* ckongg : IN1 (0xc400) bit 6 */ |
| 1069 | return ((input_port_read(field-> | |
| 1069 | return ((input_port_read(field-> | |
| 1070 | 1070 | |
| 1071 | 1071 | case 0xc0: /* ckongmc : IN1 (0xa800) bits 6 and 7 */ |
| 1072 | return ((input_port_read(field-> | |
| 1072 | return ((input_port_read(field-> | |
| 1073 | 1073 | case 0x01: /* ckongmc : DSW (0xb000) bit 0 */ |
| 1074 | return ((input_port_read(field-> | |
| 1074 | return ((input_port_read(field-> | |
| 1075 | 1075 | |
| 1076 | 1076 | default: |
| 1077 | 1077 | logerror("ckongg_coinage_r : invalid %02X bit_mask\n",bit_mask); |
| r11508 | r11509 | |
| 1432 | 1432 | switch (bit_mask) |
| 1433 | 1433 | { |
| 1434 | 1434 | case 0xc0: /* dkongjrm : IN1 (0xa8??) bits 6 and 7 */ |
| 1435 | return ((input_port_read(field-> | |
| 1435 | return ((input_port_read(field-> | |
| 1436 | 1436 | case 0x01: /* dkongjrm : DSW (0xb0??) bit 0 */ |
| 1437 | return ((input_port_read(field-> | |
| 1437 | return ((input_port_read(field-> | |
| 1438 | 1438 | |
| 1439 | 1439 | default: |
| 1440 | 1440 | logerror("dkongjrm_coinage_r : invalid %02X bit_mask\n",bit_mask); |
| r11508 | r11509 | |
|---|---|---|
| 100 | 100 | static CUSTOM_INPUT( mightguy_area_r ) |
| 101 | 101 | { |
| 102 | 102 | int bit_mask = (FPTR)param; |
| 103 | return (input_port_read(field-> | |
| 103 | return (input_port_read(field-> | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | static WRITE8_HANDLER( cop01_irq_ack_w ) |
| r11508 | r11509 | |
|---|---|---|
| 115 | 115 | |
| 116 | 116 | static CUSTOM_INPUT( soundflag_r ) |
| 117 | 117 | { |
| 118 | inufuku_state *state = field-> | |
| 118 | inufuku_state *state = field-> | |
| 119 | 119 | UINT16 soundflag = state->m_pending_command ? 0 : 1; |
| 120 | 120 | |
| 121 | 121 | return soundflag; |
| r11508 | r11509 | |
|---|---|---|
| 268 | 268 | |
| 269 | 269 | static INPUT_CHANGED( coin_inserted ) |
| 270 | 270 | { |
| 271 | cputag_set_input_line(field-> | |
| 271 | cputag_set_input_line(field-> | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | static INPUT_PORTS_START( progolf ) |
| r11508 | r11509 | |
|---|---|---|
| 391 | 391 | |
| 392 | 392 | static CUSTOM_INPUT( hopper_r ) |
| 393 | 393 | { |
| 394 | jackie_state *state = field->port->machine().driver_data<jackie_state>(); | |
| 395 | if (state->m_hopper) return !(field->port->machine().primary_screen->frame_number()%10); | |
| 396 | return input_code_pressed(field->port->machine(), KEYCODE_H); | |
| 394 | jackie_state *state = field->machine().driver_data<jackie_state>(); | |
| 395 | if (state->m_hopper) return !(field->machine().primary_screen->frame_number()%10); | |
| 396 | return input_code_pressed(field->machine(), KEYCODE_H); | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | static INPUT_PORTS_START( jackie ) |
| r11508 | r11509 | |
|---|---|---|
| 185 | 185 | |
| 186 | 186 | static CUSTOM_INPUT( lightgun_pos_r ) |
| 187 | 187 | { |
| 188 | alg_state *state = field-> | |
| 188 | alg_state *state = field-> | |
| 189 | 189 | int x = 0, y = 0; |
| 190 | 190 | |
| 191 | 191 | /* get the position based on the input select */ |
| 192 | get_lightgun_pos(*field-> | |
| 192 | get_lightgun_pos(*field-> | |
| 193 | 193 | return (y << 8) | (x >> 2); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
| 197 | 197 | static CUSTOM_INPUT( lightgun_trigger_r ) |
| 198 | 198 | { |
| 199 | alg_state *state = field-> | |
| 199 | alg_state *state = field-> | |
| 200 | 200 | |
| 201 | 201 | /* read the trigger control based on the input select */ |
| 202 | return (input_port_read(field-> | |
| 202 | return (input_port_read(field-> | |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | static CUSTOM_INPUT( lightgun_holster_r ) |
| 207 | 207 | { |
| 208 | alg_state *state = field-> | |
| 208 | alg_state *state = field-> | |
| 209 | 209 | |
| 210 | 210 | /* read the holster control based on the input select */ |
| 211 | return (input_port_read(field-> | |
| 211 | return (input_port_read(field-> | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 |
| r11508 | r11509 | |
|---|---|---|
| 162 | 162 | { |
| 163 | 163 | /* pressing the service switch sends an NMI */ |
| 164 | 164 | if (newval) |
| 165 | cputag_set_input_line(field-> | |
| 165 | cputag_set_input_line(field-> | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| r11508 | r11509 | |
| 293 | 293 | |
| 294 | 294 | static CUSTOM_INPUT( elim4_joint_coin_r ) |
| 295 | 295 | { |
| 296 | return (input_port_read(field-> | |
| 296 | return (input_port_read(field-> | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 |
| r11508 | r11509 | |
|---|---|---|
| 102 | 102 | UINT32 * m_bg_scroll; |
| 103 | 103 | UINT32 * m_paletteram; |
| 104 | 104 | UINT32 * m_spriteram; |
| 105 | UINT32 * m_workram; | |
| 105 | 106 | |
| 106 | 107 | /* video-related */ |
| 107 | 108 | tilemap_t *m_bg_tilemap; |
| r11508 | r11509 | |
| 252 | 253 | |
| 253 | 254 | static READ32_HANDLER( dreamwld_protdata_r ) |
| 254 | 255 | { |
| 256 | //static int count = 0; | |
| 255 | 257 | dreamwld_state *state = space->machine().driver_data<dreamwld_state>(); |
| 256 | 258 | |
| 259 | //printf("protection read %04x\n", count); | |
| 260 | //count++; | |
| 261 | ||
| 257 | 262 | UINT8 *protdata = space->machine().region("user1")->base(); |
| 258 | 263 | size_t protsize = space->machine().region("user1")->bytes(); |
| 259 | 264 | UINT8 dat = protdata[(state->m_protindex++) % protsize]; |
| r11508 | r11509 | |
| 323 | 328 | |
| 324 | 329 | AM_RANGE(0xc00030, 0xc00033) AM_READ(dreamwld_protdata_r) // it reads protection data (irq code) from here and puts it at ffd000 |
| 325 | 330 | |
| 326 | AM_RANGE(0xfe0000, 0xffffff) AM_RAM // work ram | |
| 331 | AM_RANGE(0xfe0000, 0xffffff) AM_RAM AM_BASE_MEMBER(dreamwld_state, m_workram) // work ram | |
| 327 | 332 | ADDRESS_MAP_END |
| 328 | 333 | |
| 329 | 334 | |
| 335 | static ADDRESS_MAP_START( baryon_map, AS_PROGRAM, 32 ) | |
| 336 | AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_WRITENOP | |
| 337 | ||
| 338 | AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE_MEMBER(dreamwld_state, m_spriteram) | |
| 339 | AM_RANGE(0x600000, 0x601fff) AM_RAM//_WRITE(dreamwld_palette_w) AM_BASE_MEMBER(dreamwld_state, m_paletteram) // real palette? | |
| 340 | AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(dreamwld_bg_videoram_w ) AM_BASE_MEMBER(dreamwld_state, m_bg_videoram) | |
| 341 | AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(dreamwld_bg2_videoram_w ) AM_BASE_MEMBER(dreamwld_state, m_bg2_videoram) | |
| 342 | AM_RANGE(0x804000, 0x805fff) AM_RAM AM_BASE_MEMBER(dreamwld_state, m_bg_scroll) // scroll regs etc. | |
| 343 | ||
| 344 | AM_RANGE(0xc00000, 0xc00003) AM_READ_PORT("INPUTS") | |
| 345 | AM_RANGE(0xc00004, 0xc00007) AM_READ_PORT("c00004") | |
| 346 | ||
| 347 | AM_RANGE(0xc0000c, 0xc0000f) AM_WRITE(dreamwld_6295_0_bank_w) // sfx | |
| 348 | AM_RANGE(0xc00018, 0xc0001b) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0xff000000) // sfx | |
| 349 | ||
| 350 | AM_RANGE(0xc00030, 0xc00033) AM_READ(dreamwld_protdata_r) // it reads protection data (irq code) from here and puts it at ffd000 | |
| 351 | ||
| 352 | AM_RANGE(0xfe0000, 0xffffff) AM_RAM AM_BASE_MEMBER(dreamwld_state, m_workram) // work ram | |
| 353 | ADDRESS_MAP_END | |
| 354 | ||
| 330 | 355 | static INPUT_PORTS_START( dreamwld ) |
| 331 | 356 | PORT_START("INPUTS") |
| 332 | 357 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_COIN1 ) |
| r11508 | r11509 | |
| 455 | 480 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) |
| 456 | 481 | MACHINE_CONFIG_END |
| 457 | 482 | |
| 483 | static INTERRUPT_GEN( baryon_irq_hack ) | |
| 484 | { | |
| 485 | dreamwld_state *state = device->machine().driver_data<dreamwld_state>(); | |
| 486 | state->m_workram[0x3600/4] = 0x00000000; | |
| 487 | state->m_workram[0x35d8/4] = 0x00000000; | |
| 488 | // to run attract mode (without palette, scrolling or sprites) | |
| 489 | // bp a644 | |
| 490 | // do pc = a646 | |
| 491 | // bp a67a | |
| 492 | // do pc = a67c | |
| 458 | 493 | |
| 494 | } | |
| 459 | 495 | |
| 496 | ||
| 497 | static MACHINE_CONFIG_START( baryon, dreamwld_state ) | |
| 498 | ||
| 499 | /* basic machine hardware */ | |
| 500 | MCFG_CPU_ADD("maincpu", M68EC020, MASTER_CLOCK/2) | |
| 501 | MCFG_CPU_PROGRAM_MAP(baryon_map) | |
| 502 | MCFG_CPU_VBLANK_INT("screen", baryon_irq_hack /* irq4_line_hold */ ) // 4, 5, or 6, all point to the same place | |
| 503 | ||
| 504 | MCFG_MACHINE_START(dreamwld) | |
| 505 | MCFG_MACHINE_RESET(dreamwld) | |
| 506 | ||
| 507 | /* video hardware */ | |
| 508 | MCFG_SCREEN_ADD("screen", RASTER) | |
| 509 | MCFG_SCREEN_REFRESH_RATE(58) | |
| 510 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) | |
| 511 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 512 | MCFG_SCREEN_SIZE(512,256) | |
| 513 | MCFG_SCREEN_VISIBLE_AREA(0, 304-1, 0, 224-1) | |
| 514 | MCFG_SCREEN_UPDATE(dreamwld) | |
| 515 | ||
| 516 | MCFG_PALETTE_LENGTH(0x1000) | |
| 517 | MCFG_GFXDECODE(dreamwld) | |
| 518 | ||
| 519 | MCFG_VIDEO_START(dreamwld) | |
| 520 | ||
| 521 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") | |
| 522 | ||
| 523 | MCFG_OKIM6295_ADD("oki1", MASTER_CLOCK/32, OKIM6295_PIN7_LOW) | |
| 524 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) | |
| 525 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) | |
| 526 | MACHINE_CONFIG_END | |
| 527 | ||
| 528 | ||
| 460 | 529 | ROM_START( dreamwld ) |
| 461 | 530 | ROM_REGION( 0x200000, "maincpu", 0 ) |
| 462 | 531 | ROM_LOAD32_BYTE( "1.bin", 0x000002, 0x040000, CRC(35c94ee5) SHA1(3440a65a807622b619c97bc2a88fd7d875c26f66) ) |
| r11508 | r11509 | |
| 471 | 540 | /* The MCU supplies this data. |
| 472 | 541 | The 68k reads it through a port, taking the size and destination write address from the level 1 |
| 473 | 542 | and level 2 irq positions in the 68k vector table (there is code to check that they haven't been |
| 474 | mod | |
| 543 | modified!) It then decodes the data using the rom checksum previously calculated and puts it in | |
| 475 | 544 | ram. The interrupt vectors point at the code placed in RAM. */ |
| 476 | 545 | ROM_LOAD( "protdata.bin", 0x000, 0x6c9 , CRC(f284b2fd) SHA1(9e8096c8aa8a288683f002311b38787b120748d1) ) /* extracted */ |
| 477 | 546 | |
| 478 | 547 | ROM_REGION( 0x100000, "oki1", 0 ) /* OKI Samples - 1st chip*/ |
| 479 | 548 | ROM_LOAD( "5.bin", 0x000000, 0x80000, CRC(9689570a) SHA1(4414233da8f46214ca7e9022df70953922a63aa4) ) |
| 480 | ROM_RELOAD(0x80000,0x80000) // fo | |
| 549 | ROM_RELOAD(0x80000,0x80000) // for the banks | |
| 481 | 550 | |
| 482 | 551 | ROM_REGION( 0x100000, "oki2", 0 ) /* OKI Samples - 2nd chip*/ |
| 483 | 552 | ROM_LOAD( "6.bin", 0x000000, 0x80000, CRC(c8b91f30) SHA1(706004ca56d0a74bc7a3dfd73a21cdc09eb90f05) ) |
| 484 | ROM_RELOAD(0x80000,0x80000) // fo | |
| 553 | ROM_RELOAD(0x80000,0x80000) // for the banks | |
| 485 | 554 | |
| 486 | 555 | ROM_REGION( 0x400000, "gfx1", 0 ) /* Sprite Tiles - decoded */ |
| 487 | 556 | ROM_LOAD( "9.bin", 0x000000, 0x200000, CRC(fa84e3af) SHA1(5978737d348fd382f4ec004d29870656c864d137) ) |
| r11508 | r11509 | |
| 498 | 567 | ROM_END |
| 499 | 568 | |
| 500 | 569 | |
| 570 | ROM_START( baryon ) | |
| 571 | ROM_REGION( 0x200000, "maincpu", 0 ) | |
| 572 | ROM_LOAD32_BYTE( "3.bin", 0x000002, 0x040000, CRC(046d4231) SHA1(05056efe5fec7f43c400f05278de516b01be0fdf) ) | |
| 573 | ROM_LOAD32_BYTE( "4.bin", 0x000000, 0x040000, CRC(59e0df20) SHA1(ff12f4adcf731f6984db7d0fbdd7fcc71ce66aa4) ) | |
| 574 | ROM_LOAD32_BYTE( "5.bin", 0x000003, 0x040000, CRC(63d5e7cb) SHA1(269bf5ffe10f2464f823c4d377921e19cfb8bc46) ) | |
| 575 | ROM_LOAD32_BYTE( "6.bin", 0x000001, 0x040000, CRC(abccbb3d) SHA1(01524f094543d872d775306024f51258a11e9240) ) | |
| 576 | ||
| 577 | ROM_REGION( 0x10000, "cpu1", 0 ) /* 87C52 MCU Code */ | |
| 578 | ROM_LOAD( "87c52.mcu", 0x00000, 0x10000 , NO_DUMP ) /* can't be dumped. */ | |
| 579 | ||
| 580 | ROM_REGION( 0x6c9, "user1", 0 ) /* Protection data */ | |
| 581 | ROM_FILL( 0x0, 0x6c9, 0x00 ) | |
| 582 | //ROM_LOAD( "protdata.bin", 0x000, 0x6bc , CRC(1) SHA1(1) ) /* extracted */ | |
| 583 | ||
| 584 | ROM_REGION( 0x100000, "oki1", 0 ) /* OKI Samples */ | |
| 585 | ROM_LOAD( "1.bin", 0x000000, 0x80000, CRC(e0349074) SHA1(f3d53d96dff586a0ad1632f52e5559cdce5ed0d8) ) | |
| 586 | ROM_RELOAD(0x80000,0x80000) // for the banks | |
| 587 | ||
| 588 | ROM_REGION( 0x400000, "gfx1", 0 ) /* Sprite Tiles - decoded */ | |
| 589 | ROM_LOAD( "9.bin", 0x000000, 0x200000, CRC(28bf828f) SHA1(271390cc4f4015a3b69976f0d0527947f13c971b) ) | |
| 590 | ROM_LOAD( "11.bin", 0x200000, 0x200000, CRC(d0ff1bc6) SHA1(4aeb795222eedeeba770cf725122e989f97119b2) ) | |
| 591 | ||
| 592 | ROM_REGION( 0x200000, "gfx2", 0 ) /* BG Tiles - decoded */ | |
| 593 | ROM_LOAD( "2.bin",0x000000, 0x200000, CRC(684012e6) SHA1(4cb60907184b67be130b8385e4336320c0f6e4a7) ) | |
| 594 | ||
| 595 | ROM_REGION( 0x040000, "gfx3", 0 ) /* Sprite Code Lookup ... */ | |
| 596 | ROM_LOAD16_BYTE( "8.bin", 0x000000, 0x020000, CRC(fdbb08b0) SHA1(4b3ac56c4c8370b1434fb6a481fce0d9c52313e0) ) | |
| 597 | ROM_LOAD16_BYTE( "10.bin",0x000001, 0x020000, CRC(c9d20480) SHA1(3f6170e8e08fb7508bd13c23f243ec6888a91f5e) ) | |
| 598 | ||
| 599 | ROM_REGION( 0x10000, "gfx4", 0 ) /* ???? - not decoded seems to be in blocks of 0x41 bytes.. */ | |
| 600 | ROM_LOAD( "7.bin", 0x000000, 0x10000, CRC(0da8db45) SHA1(7d5bd71c5b0b28ff74c732edd7c662f46f2ab25b) ) | |
| 601 | ROM_END | |
| 602 | ||
| 603 | ||
| 604 | GAME( 1997, baryon, 0, baryon, dreamwld, 0, ROT270, "SemiCom", "Baryon - Future Assault", GAME_SUPPORTS_SAVE|GAME_NOT_WORKING ) | |
| 501 | 605 | GAME( 2000, dreamwld, 0, dreamwld, dreamwld, 0, ROT0, "SemiCom", "Dream World", GAME_SUPPORTS_SAVE ) |
| r11508 | r11509 | |
|---|---|---|
| 259 | 259 | |
| 260 | 260 | static CUSTOM_INPUT( ebases_trackball_r ) |
| 261 | 261 | { |
| 262 | astrocde_state *state = field-> | |
| 262 | astrocde_state *state = field-> | |
| 263 | 263 | static const char *const names[] = { "TRACKX2", "TRACKY2", "TRACKX1", "TRACKY1" }; |
| 264 | return input_port_read(field-> | |
| 264 | return input_port_read(field-> | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | |
| r11508 | r11509 | |
| 487 | 487 | |
| 488 | 488 | static CUSTOM_INPUT( demndragn_joystick_r ) |
| 489 | 489 | { |
| 490 | astrocde_state *state = field-> | |
| 490 | astrocde_state *state = field-> | |
| 491 | 491 | static const char *const names[] = { "MOVEX", "MOVEY" }; |
| 492 | return input_port_read(field-> | |
| 492 | return input_port_read(field-> | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | |
| r11508 | r11509 | |
| 841 | 841 | |
| 842 | 842 | static INPUT_CHANGED( spacezap_monitor ) |
| 843 | 843 | { |
| 844 | astrocde_state *state = field-> | |
| 844 | astrocde_state *state = field-> | |
| 845 | 845 | if (newval) |
| 846 | 846 | state->m_video_config &= ~AC_MONITOR_BW; |
| 847 | 847 | else |
| r11508 | r11509 | |
|---|---|---|
| 242 | 242 | |
| 243 | 243 | static INPUT_CHANGED( trigger_nmi ) |
| 244 | 244 | { |
| 245 | cputag_set_input_line(field-> | |
| 245 | cputag_set_input_line(field-> | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /*------------------------------------------------- |
| r11508 | r11509 | |
|---|---|---|
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | static CUSTOM_INPUT( shifted_port_r ) { return input_port_read(field-> | |
| 782 | static CUSTOM_INPUT( shifted_port_r ) { return input_port_read(field-> | |
| 783 | 783 | |
| 784 | 784 | static WRITE8_DEVICE_HANDLER( out_0 ) |
| 785 | 785 | { |
| r11508 | r11509 | |
|---|---|---|
| 38 | 38 | |
| 39 | 39 | static INPUT_CHANGED( coin_inserted ) |
| 40 | 40 | { |
| 41 | lasso_state *state = field-> | |
| 41 | lasso_state *state = field-> | |
| 42 | 42 | |
| 43 | 43 | /* coin insertion causes an NMI */ |
| 44 | 44 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| r11508 | r11509 | |
|---|---|---|
| 1155 | 1155 | |
| 1156 | 1156 | static CUSTOM_INPUT( sflush_80_r ) |
| 1157 | 1157 | { |
| 1158 | return (field-> | |
| 1158 | return (field-> | |
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | static ADDRESS_MAP_START( sflush_map, AS_PROGRAM, 8 ) |
| r11508 | r11509 | |
|---|---|---|
| 198 | 198 | |
| 199 | 199 | static CUSTOM_INPUT( system_port_r ) |
| 200 | 200 | { |
| 201 | return input_port_read(field-> | |
| 201 | return input_port_read(field-> | |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | static CUSTOM_INPUT( mahjong_ctrl_r ) /* used by hotgmck/hgkairak */ |
| 205 | 205 | { |
| 206 | psikyo4_state *state = field-> | |
| 206 | psikyo4_state *state = field-> | |
| 207 | 207 | int player = (FPTR)param; |
| 208 | 208 | int sel = (state->m_io_select[0] & 0x0000ff00) >> 8; |
| 209 | 209 | int ret = 0xff; |
| 210 | 210 | |
| 211 | if (sel & 1) ret &= input_port_read(field->port->machine(), player ? "KEY4" : "KEY0" ); | |
| 212 | if (sel & 2) ret &= input_port_read(field->port->machine(), player ? "KEY5" : "KEY1" ); | |
| 213 | if (sel & 4) ret &= input_port_read(field->port->machine(), player ? "KEY6" : "KEY2" ); | |
| 214 | if (sel & 8) ret &= input_port_read(field->port->machine(), player ? "KEY7" : "KEY3" ); | |
| 211 | if (sel & 1) ret &= input_port_read(field->machine(), player ? "KEY4" : "KEY0" ); | |
| 212 | if (sel & 2) ret &= input_port_read(field->machine(), player ? "KEY5" : "KEY1" ); | |
| 213 | if (sel & 4) ret &= input_port_read(field->machine(), player ? "KEY6" : "KEY2" ); | |
| 214 | if (sel & 8) ret &= input_port_read(field->machine(), player ? "KEY7" : "KEY3" ); | |
| 215 | 215 | |
| 216 | 216 | return ret; |
| 217 | 217 | } |
| r11508 | r11509 | |
|---|---|---|
| 414 | 414 | |
| 415 | 415 | static INPUT_CHANGED( keypad_interrupt ) |
| 416 | 416 | { |
| 417 | esripsys_state *state = field-> | |
| 417 | esripsys_state *state = field-> | |
| 418 | 418 | if (newval == 0) |
| 419 | 419 | { |
| 420 | 420 | state->m_io_firq_status |= 2; |
| 421 | 421 | state->m_keypad_status |= 0x20; |
| 422 | cputag_set_input_line(field-> | |
| 422 | cputag_set_input_line(field-> | |
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | static INPUT_CHANGED( coin_interrupt ) |
| 427 | 427 | { |
| 428 | esripsys_state *state = field-> | |
| 428 | esripsys_state *state = field-> | |
| 429 | 429 | if (newval == 1) |
| 430 | 430 | { |
| 431 | 431 | state->m_io_firq_status |= 2; |
| 432 | state->m_coin_latch = input_port_read(field->port->machine(), "COINS") << 2; | |
| 433 | cputag_set_input_line(field->port->machine(), "game_cpu", M6809_FIRQ_LINE, HOLD_LINE); | |
| 432 | state->m_coin_latch = input_port_read(field->machine(), "COINS") << 2; | |
| 433 | cputag_set_input_line(field->machine(), "game_cpu", M6809_FIRQ_LINE, HOLD_LINE); | |
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 |
| r11508 | r11509 | |
|---|---|---|
| 614 | 614 | |
| 615 | 615 | static CUSTOM_INPUT( laserdisc_enter_r ) |
| 616 | 616 | { |
| 617 | thayers_state *state = field-> | |
| 617 | thayers_state *state = field-> | |
| 618 | 618 | switch (laserdisc_get_type(state->m_laserdisc)) |
| 619 | 619 | { |
| 620 | 620 | case LASERDISC_TYPE_PIONEER_PR7820: |
| r11508 | r11509 | |
| 629 | 629 | |
| 630 | 630 | static CUSTOM_INPUT( laserdisc_ready_r ) |
| 631 | 631 | { |
| 632 | thayers_state *state = field-> | |
| 632 | thayers_state *state = field-> | |
| 633 | 633 | switch (laserdisc_get_type(state->m_laserdisc)) |
| 634 | 634 | { |
| 635 | 635 | case LASERDISC_TYPE_PIONEER_PR7820: |
| r11508 | r11509 | |
|---|---|---|
| 346 | 346 | |
| 347 | 347 | static CUSTOM_INPUT(rndbit_r) |
| 348 | 348 | { |
| 349 | return field-> | |
| 349 | return field-> | |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | static ADDRESS_MAP_START( pitboss_map, AS_PROGRAM, 8 ) |
| r11508 | r11509 | |
|---|---|---|
| 199 | 199 | |
| 200 | 200 | static INPUT_CHANGED( coin_inserted ) |
| 201 | 201 | { |
| 202 | cputag_set_input_line_and_vector(field-> | |
| 202 | cputag_set_input_line_and_vector(field-> | |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 |
| r11508 | r11509 | |
|---|---|---|
| 105 | 105 | |
| 106 | 106 | static CUSTOM_INPUT( hopper_r ) |
| 107 | 107 | { |
| 108 | running_machine &machine = field-> | |
| 108 | running_machine &machine = field-> | |
| 109 | 109 | spoker_state *state = machine.driver_data<spoker_state>(); |
| 110 | 110 | |
| 111 | 111 | if (state->m_hopper) return !(machine.primary_screen->frame_number()%10); |
| r11508 | r11509 | |
|---|---|---|
| 19 | 19 | static INPUT_CHANGED( coin_inserted ) |
| 20 | 20 | { |
| 21 | 21 | /* coin insertion causes an NMI */ |
| 22 | cputag_set_input_line(field-> | |
| 22 | cputag_set_input_line(field-> | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 |
| r11508 | r11509 | |
|---|---|---|
| 1653 | 1653 | |
| 1654 | 1654 | static CUSTOM_INPUT( gn845pwbb_read ) |
| 1655 | 1655 | { |
| 1656 | ksys573_state *state = field-> | |
| 1656 | ksys573_state *state = field-> | |
| 1657 | 1657 | |
| 1658 | return input_port_read(field-> | |
| 1658 | return input_port_read(field-> | |
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | 1661 | static void gn845pwbb_output_callback( running_machine &machine, int offset, int data ) |
| r11508 | r11509 | |
| 2881 | 2881 | |
| 2882 | 2882 | static CUSTOM_INPUT( gunmania_tank_shutter_sensor ) |
| 2883 | 2883 | { |
| 2884 | ksys573_state *state = field-> | |
| 2884 | ksys573_state *state = field-> | |
| 2885 | 2885 | |
| 2886 | 2886 | if( state->m_tank_shutter_position == 0 ) |
| 2887 | 2887 | { |
| r11508 | r11509 | |
| 2893 | 2893 | |
| 2894 | 2894 | static CUSTOM_INPUT( gunmania_cable_holder_sensor ) |
| 2895 | 2895 | { |
| 2896 | ksys573_state *state = field-> | |
| 2896 | ksys573_state *state = field-> | |
| 2897 | 2897 | |
| 2898 | 2898 | return state->m_cable_holder_release; |
| 2899 | 2899 | } |
| r11508 | r11509 | |
|---|---|---|
| 316 | 316 | |
| 317 | 317 | static CUSTOM_INPUT( clock_r ) |
| 318 | 318 | { |
| 319 | return (field-> | |
| 319 | return (field-> | |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 |
| r11508 | r11509 | |
|---|---|---|
| 258 | 258 | |
| 259 | 259 | static CUSTOM_INPUT( xmen_frame_r ) |
| 260 | 260 | { |
| 261 | xmen_state *state = field-> | |
| 261 | xmen_state *state = field-> | |
| 262 | 262 | return state->m_current_frame; |
| 263 | 263 | } |
| 264 | 264 |
| r11508 | r11509 | |
|---|---|---|
| 280 | 280 | |
| 281 | 281 | static INPUT_CHANGED( coin_inserted_deco16 ) |
| 282 | 282 | { |
| 283 | exprraid_state *state = field-> | |
| 283 | exprraid_state *state = field-> | |
| 284 | 284 | device_set_input_line(state->m_maincpu, DECO16_IRQ_LINE, newval ? CLEAR_LINE : ASSERT_LINE); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | static INPUT_CHANGED( coin_inserted_nmi ) |
| 288 | 288 | { |
| 289 | exprraid_state *state = field-> | |
| 289 | exprraid_state *state = field-> | |
| 290 | 290 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| 291 | 291 | } |
| 292 | 292 |
| r11508 | r11509 | |
|---|---|---|
| 284 | 284 | |
| 285 | 285 | static INPUT_CHANGED( coin_inserted ) |
| 286 | 286 | { |
| 287 | cputag_set_input_line(field-> | |
| 287 | cputag_set_input_line(field-> | |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | static INPUT_PORTS_START( naughtyb ) |
| r11508 | r11509 | |
|---|---|---|
| 80 | 80 | |
| 81 | 81 | static CUSTOM_INPUT( coin_word_r ) |
| 82 | 82 | { |
| 83 | gunbustr_state *state = field-> | |
| 83 | gunbustr_state *state = field-> | |
| 84 | 84 | return state->m_coin_word; |
| 85 | 85 | } |
| 86 | 86 |
| r11508 | r11509 | |
|---|---|---|
| 202 | 202 | |
| 203 | 203 | static CUSTOM_INPUT( ticket_status_r ) |
| 204 | 204 | { |
| 205 | pzletime_state *state = field->port->machine().driver_data<pzletime_state>(); | |
| 206 | return (state->m_ticket && !(field->port->machine().primary_screen->frame_number() % 128)); | |
| 205 | pzletime_state *state = field->machine().driver_data<pzletime_state>(); | |
| 206 | return (state->m_ticket && !(field->machine().primary_screen->frame_number() % 128)); | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | static ADDRESS_MAP_START( pzletime_map, AS_PROGRAM, 16 ) |
| r11508 | r11509 | |
|---|---|---|
| 657 | 657 | |
| 658 | 658 | static CUSTOM_INPUT( gekisou_unknown_status ) |
| 659 | 659 | { |
| 660 | equites_state *state = field-> | |
| 660 | equites_state *state = field-> | |
| 661 | 661 | return state->m_unknown_bit; |
| 662 | 662 | } |
| 663 | 663 |
| r11508 | r11509 | |
|---|---|---|
| 19 | 19 | ***************************************************************************/ |
| 20 | 20 | |
| 21 | 21 | #include "emu.h" |
| 22 | #include "deprecat.h" | |
| 23 | 22 | #include "video/konicdev.h" |
| 24 | 23 | #include "cpu/m68000/m68000.h" |
| 25 | 24 | #include "cpu/z80/z80.h" |
| r11508 | r11509 | |
| 115 | 114 | device_set_input_line(device, 2, HOLD_LINE); |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | static INTERRUPT_GEN( cpuB_interrupt ) | |
| 117 | ||
| 118 | static TIMER_DEVICE_CALLBACK( gradius3_sub_scanline ) | |
| 119 | 119 | { |
| 120 | gradius3_state *state = device->machine().driver_data<gradius3_state>(); | |
| 120 | gradius3_state *state = timer.machine().driver_data<gradius3_state>(); | |
| 121 | int scanline = param; | |
| 121 | 122 | |
| 122 | if (cpu_getiloops(device) & 1) /* ??? */ | |
| 123 | { | |
| 124 | if (state->m_irqBmask & 2) | |
| 125 | device_set_input_line(device, 2, HOLD_LINE); | |
| 126 | } | |
| 127 | else | |
| 128 | { | |
| 129 | if (state->m_irqBmask & 1) | |
| 130 | device_set_input_line(device, 1, HOLD_LINE); | |
| 131 | } | |
| 123 | if(scanline == 240 && state->m_irqBmask & 1) // vblank-out irq | |
| 124 | cputag_set_input_line(timer.machine(), "sub", 1, HOLD_LINE); | |
| 125 | ||
| 126 | if(scanline == 16 && state->m_irqBmask & 2) // sprite end DMA irq | |
| 127 | cputag_set_input_line(timer.machine(), "sub", 2, HOLD_LINE); | |
| 132 | 128 | } |
| 133 | 129 | |
| 134 | 130 | static WRITE16_HANDLER( cpuB_irqtrigger_w ) |
| r11508 | r11509 | |
| 336 | 332 | |
| 337 | 333 | MCFG_CPU_ADD("sub", M68000, 10000000) /* 10 MHz */ |
| 338 | 334 | MCFG_CPU_PROGRAM_MAP(gradius3_map2) |
| 339 | MCFG_CPU_VBLANK_INT_HACK(cpuB_interrupt,2) /* has three interrupt vectors, 1 2 and 4 */ | |
| 340 | /* 4 is triggered by cpu A, the others are unknown but */ | |
| 341 | /* required for the game to run. */ | |
| 335 | MCFG_TIMER_ADD_SCANLINE("scantimer", gradius3_sub_scanline, "screen", 0, 1) /* has three interrupt vectors, 1 2 and 4 */ | |
| 336 | /* 4 is triggered by cpu A, the others are unknown but */ | |
| 337 | /* required for the game to run. */ | |
| 338 | ||
| 342 | 339 | MCFG_CPU_ADD("audiocpu", Z80, 3579545) |
| 343 | 340 | MCFG_CPU_PROGRAM_MAP(gradius3_s_map) |
| 344 | 341 |
| r11508 | r11509 | |
|---|---|---|
| 316 | 316 | |
| 317 | 317 | static CUSTOM_INPUT( laserdisc_status_r ) |
| 318 | 318 | { |
| 319 | dlair_state *state = field-> | |
| 319 | dlair_state *state = field-> | |
| 320 | 320 | switch (laserdisc_get_type(state->m_laserdisc)) |
| 321 | 321 | { |
| 322 | 322 | case LASERDISC_TYPE_PIONEER_PR7820: |
| r11508 | r11509 | |
| 334 | 334 | |
| 335 | 335 | static CUSTOM_INPUT( laserdisc_command_r ) |
| 336 | 336 | { |
| 337 | dlair_state *state = field-> | |
| 337 | dlair_state *state = field-> | |
| 338 | 338 | switch (laserdisc_get_type(state->m_laserdisc)) |
| 339 | 339 | { |
| 340 | 340 | case LASERDISC_TYPE_PIONEER_PR7820: |
| r11508 | r11509 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | static INPUT_CHANGED( service_mode_switch_changed ) |
| 31 | 31 | { |
| 32 | set_service_mode(field-> | |
| 32 | set_service_mode(field-> | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | static INPUT_CHANGED( firetrk_horn_changed ) |
| 37 | 37 | { |
| 38 | device_t *discrete = field-> | |
| 38 | device_t *discrete = field-> | |
| 39 | 39 | discrete_sound_w(discrete, FIRETRUCK_HORN_EN, newval); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | static INPUT_CHANGED( gear_changed ) |
| 44 | 44 | { |
| 45 | firetrk_state *state = field-> | |
| 45 | firetrk_state *state = field-> | |
| 46 | 46 | if (newval) |
| 47 | 47 | state->m_gear = (FPTR)param; |
| 48 | 48 | } |
| r11508 | r11509 | |
| 200 | 200 | |
| 201 | 201 | static CUSTOM_INPUT( steer_dir_r ) |
| 202 | 202 | { |
| 203 | firetrk_state *state = field-> | |
| 203 | firetrk_state *state = field-> | |
| 204 | 204 | return state->m_steer_dir[(FPTR)param]; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | static CUSTOM_INPUT( steer_flag_r ) |
| 209 | 209 | { |
| 210 | firetrk_state *state = field-> | |
| 210 | firetrk_state *state = field-> | |
| 211 | 211 | return state->m_steer_flag[(FPTR)param]; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | static CUSTOM_INPUT( skid_r ) |
| 216 | 216 | { |
| 217 | firetrk_state *state = field-> | |
| 217 | firetrk_state *state = field-> | |
| 218 | 218 | UINT32 ret; |
| 219 | 219 | int which = (FPTR)param; |
| 220 | 220 | |
| r11508 | r11509 | |
| 229 | 229 | |
| 230 | 230 | static CUSTOM_INPUT( crash_r ) |
| 231 | 231 | { |
| 232 | firetrk_state *state = field-> | |
| 232 | firetrk_state *state = field-> | |
| 233 | 233 | UINT32 ret; |
| 234 | 234 | int which = (FPTR)param; |
| 235 | 235 | |
| r11508 | r11509 | |
| 244 | 244 | |
| 245 | 245 | static CUSTOM_INPUT( gear_r ) |
| 246 | 246 | { |
| 247 | firetrk_state *state = field-> | |
| 247 | firetrk_state *state = field-> | |
| 248 | 248 | return (state->m_gear == (FPTR)param) ? 1 : 0; |
| 249 | 249 | } |
| 250 | 250 |
| r11508 | r11509 | |
|---|---|---|
| 799 | 799 | static CUSTOM_INPUT( peplus_input_r ) |
| 800 | 800 | { |
| 801 | 801 | UINT8 inp_ret = 0x00; |
| 802 | UINT8 inp_read = input_port_read(field-> | |
| 802 | UINT8 inp_read = input_port_read(field-> | |
| 803 | 803 | |
| 804 | 804 | if (inp_read & 0x01) inp_ret = 0x01; |
| 805 | 805 | if (inp_read & 0x02) inp_ret = 0x02; |
| r11508 | r11509 | |
|---|---|---|
| 130 | 130 | |
| 131 | 131 | static CUSTOM_INPUT( prot_r ) |
| 132 | 132 | { |
| 133 | ddayjlc_state *state = field-> | |
| 133 | ddayjlc_state *state = field-> | |
| 134 | 134 | return prot_data[state->m_prot_addr]; |
| 135 | 135 | } |
| 136 | 136 |
| r11508 | r11509 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | static CUSTOM_INPUT( dorachan_protection_r ) |
| 43 | 43 | { |
| 44 | dorachan_state *state = field-> | |
| 44 | dorachan_state *state = field-> | |
| 45 | 45 | UINT8 ret = 0; |
| 46 | 46 | |
| 47 | 47 | switch (cpu_get_previouspc(state->m_main_cpu)) |
| r11508 | r11509 | |
| 129 | 129 | |
| 130 | 130 | static CUSTOM_INPUT( dorachan_v128_r ) |
| 131 | 131 | { |
| 132 | dorachan_state *state = field-> | |
| 132 | dorachan_state *state = field-> | |
| 133 | 133 | |
| 134 | 134 | /* to avoid resetting (when player 2 starts) bit 0 need to be inverted when screen is flipped */ |
| 135 | return ((field-> | |
| 135 | return ((field-> | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 |
| r11508 | r11509 | |
|---|---|---|
| 157 | 157 | |
| 158 | 158 | static CUSTOM_INPUT( teetert_input_r ) |
| 159 | 159 | { |
| 160 | exidy_state *state = field->port->machine().driver_data<exidy_state>(); | |
| 161 | UINT8 dial = input_port_read(field->port->machine(), "DIAL"); | |
| 160 | exidy_state *state = field->machine().driver_data<exidy_state>(); | |
| 161 | UINT8 dial = input_port_read(field->machine(), "DIAL"); | |
| 162 | 162 | int result = 0; |
| 163 | 163 | |
| 164 | 164 | result = (dial != state->m_last_dial) << 4; |
| r11508 | r11509 | |
|---|---|---|
| 272 | 272 | |
| 273 | 273 | static CUSTOM_INPUT( cdp1869_pcb_r ) |
| 274 | 274 | { |
| 275 | cidelsa_state *state = field-> | |
| 275 | cidelsa_state *state = field-> | |
| 276 | 276 | |
| 277 | 277 | return state->m_cdp1869_pcb; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | static INPUT_CHANGED( ef_w ) |
| 281 | 281 | { |
| 282 | cputag_set_input_line(field-> | |
| 282 | cputag_set_input_line(field-> | |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | static INPUT_PORTS_START( destryer ) |
| r11508 | r11509 | |
|---|---|---|
| 51 | 51 | const char *tag = (const char *)param; |
| 52 | 52 | UINT32 ipt = 0; |
| 53 | 53 | |
| 54 | ipt = ((input_port_read(field-> | |
| 54 | ipt = ((input_port_read(field-> | |
| 55 | 55 | |
| 56 | 56 | return ipt; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | static CUSTOM_INPUT( f3_coin_r ) |
| 60 | 60 | { |
| 61 | taito_f3_state *state = field-> | |
| 61 | taito_f3_state *state = field-> | |
| 62 | 62 | int num = (FPTR)param; |
| 63 | 63 | return state->m_coin_word[num]; |
| 64 | 64 | } |
| r11508 | r11509 | |
|---|---|---|
| 368 | 368 | |
| 369 | 369 | static INPUT_CHANGED( touchscreen_press ) |
| 370 | 370 | { |
| 371 | jpmsys5_state *state = field-> | |
| 371 | jpmsys5_state *state = field-> | |
| 372 | 372 | if (newval == 0) |
| 373 | 373 | { |
| 374 | 374 | attotime rx_period = attotime::from_hz(10000) * 16; |
| 375 | 375 | |
| 376 | 376 | /* Each touch screen packet is 3 bytes */ |
| 377 | 377 | state->m_touch_data[0] = 0x2a; |
| 378 | state->m_touch_data[1] = 0x7 - (input_port_read(field->port->machine(), "TOUCH_Y") >> 5) + 0x30; | |
| 379 | state->m_touch_data[2] = (input_port_read(field->port->machine(), "TOUCH_X") >> 5) + 0x30; | |
| 378 | state->m_touch_data[1] = 0x7 - (input_port_read(field->machine(), "TOUCH_Y") >> 5) + 0x30; | |
| 379 | state->m_touch_data[2] = (input_port_read(field->machine(), "TOUCH_X") >> 5) + 0x30; | |
| 380 | 380 | |
| 381 | 381 | /* Start sending the data to the 68000 serially */ |
| 382 | 382 | state->m_touch_data_count = 0; |
| r11508 | r11509 | |
|---|---|---|
| 64 | 64 | |
| 65 | 65 | static CUSTOM_INPUT( homerun_40_r ) |
| 66 | 66 | { |
| 67 | UINT8 ret = (field-> | |
| 67 | UINT8 ret = (field-> | |
| 68 | 68 | |
| 69 | 69 | return ret; |
| 70 | 70 | } |
| r11508 | r11509 | |
|---|---|---|
| 119 | 119 | |
| 120 | 120 | static CUSTOM_INPUT( champbas_watchdog_bit2 ) |
| 121 | 121 | { |
| 122 | champbas_state *state = field-> | |
| 122 | champbas_state *state = field-> | |
| 123 | 123 | return BIT(state->m_watchdog_count, 2); |
| 124 | 124 | } |
| 125 | 125 |
| r11508 | r11509 | |
|---|---|---|
| 51 | 51 | |
| 52 | 52 | static INPUT_CHANGED( coin_inserted ) |
| 53 | 53 | { |
| 54 | cputag_set_input_line(field-> | |
| 54 | cputag_set_input_line(field-> | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | static INPUT_PORTS_START( ssozumo ) |
| r11508 | r11509 | |
|---|---|---|
| 858 | 858 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 859 | 859 | INPUT_PORTS_END |
| 860 | 860 | |
| 861 | static INPUT_PORTS_START( brixian ) | |
| 862 | PORT_START("SYSTEM") | |
| 863 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 864 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 865 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 866 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 867 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 868 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) | |
| 869 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) | |
| 870 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) | |
| 871 | ||
| 872 | PORT_START("BUTTONS") | |
| 873 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) | |
| 874 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY | |
| 875 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY | |
| 876 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY | |
| 877 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY | |
| 878 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) | |
| 879 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) | |
| 880 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) | |
| 881 | ||
| 882 | PORT_START("MUX") | |
| 883 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) | |
| 884 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) | |
| 885 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) | |
| 886 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) | |
| 887 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) | |
| 888 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) | |
| 889 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) | |
| 890 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) | |
| 891 | ||
| 892 | PORT_START("DSW") | |
| 893 | PORT_DIPNAME( 0x0f, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2,3,4") | |
| 894 | PORT_DIPSETTING( 0x00, "2" ) | |
| 895 | PORT_DIPSETTING( 0x01, "3" ) | |
| 896 | PORT_DIPSETTING( 0x03, "4" ) | |
| 897 | PORT_DIPSETTING( 0x07, "5" ) | |
| 898 | PORT_DIPSETTING( 0x0f, "6" ) | |
| 899 | PORT_DIPNAME( 0x30, 0x00, "Speed of Elevator" ) PORT_DIPLOCATION("SW1:5,6") | |
| 900 | PORT_DIPSETTING( 0x00, "Slow" ) | |
| 901 | PORT_DIPSETTING( 0x30, "Fast" ) | |
| 902 | PORT_DIPNAME( 0xc0, 0x40, "Time Left" ) PORT_DIPLOCATION("SW1:7,8") | |
| 903 | PORT_DIPSETTING( 0x00, "Half" ) | |
| 904 | PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) | |
| 905 | PORT_DIPSETTING( 0xc0, "Double" ) | |
| 906 | ||
| 907 | PORT_START("UNUSED") | |
| 908 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 909 | INPUT_PORTS_END | |
| 910 | ||
| 861 | 911 | /***************************************************************************/ |
| 862 | 912 | |
| 863 | 913 | /* Graphics Layouts */ |
| r11508 | r11509 | |
| 1038 | 1088 | MCFG_DEVICE_REMOVE("mcu") |
| 1039 | 1089 | MACHINE_CONFIG_END |
| 1040 | 1090 | |
| 1091 | // todo | |
| 1092 | static MACHINE_CONFIG_DERIVED( brixian, arkanoid ) | |
| 1041 | 1093 | |
| 1094 | /* basic machine hardware */ | |
| 1095 | MCFG_CPU_MODIFY("maincpu") | |
| 1096 | MCFG_CPU_PROGRAM_MAP(bootleg_map) | |
| 1097 | MCFG_CPU_VBLANK_INT("screen", irq0_line_hold) | |
| 1098 | ||
| 1099 | MCFG_DEVICE_REMOVE("mcu") | |
| 1100 | MACHINE_CONFIG_END | |
| 1101 | ||
| 1042 | 1102 | /***************************************************************************/ |
| 1043 | 1103 | |
| 1044 | 1104 | /* ROMs */ |
| r11508 | r11509 | |
| 1441 | 1501 | ROM_LOAD( "hexa.002", 0x0200, 0x0100, CRC(ff15366c) SHA1(7feaf1c768bfe76432fb80991585e13d95960b34) ) |
| 1442 | 1502 | ROM_END |
| 1443 | 1503 | |
| 1504 | ROM_START( brixian ) | |
| 1505 | ROM_REGION( 0x18000, "maincpu", 0 ) | |
| 1506 | ROM_LOAD( "b1.bin", 0x00000, 0x8000, CRC(3d167d09) SHA1(1d5bd098b655b8d2f956cfcb718213915bee3e41) ) | |
| 1507 | ROM_LOAD( "e7.bin", 0x08000, 0x2000, CRC(9e3707ab) SHA1(a04fb4824239f8ed1ef1de2f3c0f9d749320b2ba) ) // what is this? where does it map? | |
| 1444 | 1508 | |
| 1509 | ROM_REGION( 0x18000, "gfx1", 0 ) | |
| 1510 | ROM_LOAD( "b4.bin", 0x00000, 0x8000, CRC(34a7a693) SHA1(793fa6dd065a158bedcd0fdc494cc8fc793ae8be) ) | |
| 1511 | ROM_LOAD( "c4.bin", 0x08000, 0x8000, CRC(d422eda5) SHA1(4874b57ec8a8aa29937f5ccc2a734ffeb7834d8a) ) | |
| 1512 | ROM_LOAD( "e4.bin", 0x10000, 0x8000, CRC(9b2e79d6) SHA1(8a40e0ef2a792efc37ea50eec01cf3fb5a3e3215) ) | |
| 1513 | ||
| 1514 | ROM_REGION( 0x0600, "proms", 0 ) | |
| 1515 | ROM_LOAD( "r", 0x0000, 0x0200, NO_DUMP ) | |
| 1516 | ROM_LOAD( "g", 0x0200, 0x0200, NO_DUMP ) | |
| 1517 | ROM_LOAD( "b", 0x0400, 0x0200, NO_DUMP ) | |
| 1518 | ||
| 1519 | ROM_REGION( 0x0800, "mcu", 0 ) | |
| 1520 | ROM_LOAD( "68705p5", 0x0000, 0x0800, NO_DUMP ) // this appears to be providing ~0x200 bytes of code at c600, like most semicom games. | |
| 1521 | ROM_END | |
| 1522 | ||
| 1523 | ||
| 1524 | ||
| 1445 | 1525 | /* Driver Initialization */ |
| 1446 | 1526 | |
| 1447 | 1527 | static void arkanoid_bootleg_init( running_machine &machine ) |
| r11508 | r11509 | |
| 1587 | 1667 | GAME( 1987, arkatour, arkanoid, arkanoid, arkanoid, 0, ROT90, "Taito America Corporation (Romstar license)", "Tournament Arkanoid (US)", GAME_SUPPORTS_SAVE ) |
| 1588 | 1668 | GAME( 19??, tetrsark, 0, bootleg, tetrsark, tetrsark, ROT0, "D.R. Korea", "Tetris (D.R. Korea)", GAME_SUPPORTS_SAVE ) |
| 1589 | 1669 | GAME( 199?, hexa, 0, hexa, hexa, hexa, ROT0, "D.R. Korea", "Hexa", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 1670 | GAME( 1993, brixian, 0, brixian, brixian, 0, ROT0, "Cheil Computer System", "Brixian", GAME_SUPPORTS_SAVE|GAME_NOT_WORKING ) |
| r11508 | r11509 | |
|---|---|---|
| 174 | 174 | |
| 175 | 175 | static CUSTOM_INPUT( country_sndpending_r ) |
| 176 | 176 | { |
| 177 | crshrace_state *state = field-> | |
| 177 | crshrace_state *state = field-> | |
| 178 | 178 | return state->m_pending_command; |
| 179 | 179 | } |
| 180 | 180 |
| r11508 | r11509 | |
|---|---|---|
| 466 | 466 | |
| 467 | 467 | static CUSTOM_INPUT( igs_hopper_r ) |
| 468 | 468 | { |
| 469 | igs011_state *state = field->port->machine().driver_data<igs011_state>(); | |
| 470 | return (state->m_igs_hopper && ((field->port->machine().primary_screen->frame_number()/5)&1)) ? 0x0000 : 0x0001; | |
| 469 | igs011_state *state = field->machine().driver_data<igs011_state>(); | |
| 470 | return (state->m_igs_hopper && ((field->machine().primary_screen->frame_number()/5)&1)) ? 0x0000 : 0x0001; | |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | static WRITE16_HANDLER( igs_dips_w ) |
| r11508 | r11509 | |
|---|---|---|
| 200 | 200 | |
| 201 | 201 | static INPUT_CHANGED( coin_inserted ) |
| 202 | 202 | { |
| 203 | cputag_set_input_line(field-> | |
| 203 | cputag_set_input_line(field-> | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | static INPUT_CHANGED( tilt_pressed ) |
| 207 | 207 | { |
| 208 | cputag_set_input_line(field-> | |
| 208 | cputag_set_input_line(field-> | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | static INPUT_PORTS_START( bwing ) |
| r11508 | r11509 | |
|---|---|---|
| 692 | 692 | |
| 693 | 693 | static CUSTOM_INPUT( korokoro_hopper_r ) |
| 694 | 694 | { |
| 695 | cave_state *state = field-> | |
| 695 | cave_state *state = field-> | |
| 696 | 696 | return state->m_hopper ? 1 : 0; |
| 697 | 697 | } |
| 698 | 698 | |
| r11508 | r11509 | |
| 928 | 928 | |
| 929 | 929 | static CUSTOM_INPUT( tjumpman_hopper_r ) |
| 930 | 930 | { |
| 931 | cave_state *state = field->port->machine().driver_data<cave_state>(); | |
| 932 | return (state->m_hopper && !(field->port->machine().primary_screen->frame_number() % 10)) ? 0 : 1; | |
| 931 | cave_state *state = field->machine().driver_data<cave_state>(); | |
| 932 | return (state->m_hopper && !(field->machine().primary_screen->frame_number() % 10)) ? 0 : 1; | |
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | static ADDRESS_MAP_START( tjumpman_map, AS_PROGRAM, 16 ) |
| r11508 | r11509 | |
|---|---|---|
| 33 | 33 | static CUSTOM_INPUT( wolfpack_dial_r ) |
| 34 | 34 | { |
| 35 | 35 | int bit = (FPTR)param; |
| 36 | return ((input_port_read(field-> | |
| 36 | return ((input_port_read(field-> | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 |
| r11508 | r11509 | |
|---|---|---|
| 132 | 132 | // offs_t pc; |
| 133 | 133 | int bit; |
| 134 | 134 | |
| 135 | // logerror("%s: IN1_r\n",field-> | |
| 135 | // logerror("%s: IN1_r\n",field-> | |
| 136 | 136 | |
| 137 | 137 | #if 0 |
| 138 | 138 | /* Pirates protection workaround. It more complicated than this... see code at |
| 139 | 139 | 602e and 62a6 */ |
| 140 | 140 | /* For Genix, see 6576 for setting values and 67c2,d3b4 and dbc2 for tests. */ |
| 141 | 141 | |
| 142 | pc = cpu_get_pc(field-> | |
| 142 | pc = cpu_get_pc(field-> | |
| 143 | 143 | if (pc == 0x6134) |
| 144 | 144 | { |
| 145 | 145 | bit = prot & 1; |
| r11508 | r11509 | |
|---|---|---|
| 194 | 194 | |
| 195 | 195 | static INPUT_CHANGED( coin_inserted ) |
| 196 | 196 | { |
| 197 | cputag_set_input_line(field-> | |
| 197 | cputag_set_input_line(field-> | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | static INPUT_PORTS_START( tankbatt ) |
| r11508 | r11509 | |
|---|---|---|
| 508 | 508 | |
| 509 | 509 | static INPUT_CHANGED( coin_inserted ) |
| 510 | 510 | { |
| 511 | m10_state *state = field-> | |
| 511 | m10_state *state = field-> | |
| 512 | 512 | /* coin insertion causes an NMI */ |
| 513 | 513 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); |
| 514 | 514 | } |
| r11508 | r11509 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | ||
| 3 | tokenize.h | |
| 4 | ||
| 5 | Common definitions and macros for tokenizing definitions. | |
| 6 | ||
| 7 | Copyright Nicola Salmoria and the MAME Team. | |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | ||
| 10 | ***************************************************************************/ | |
| 11 | ||
| 12 | #pragma once | |
| 13 | ||
| 14 | #ifndef __TOKENIZE_H__ | |
| 15 | #define __TOKENIZE_H__ | |
| 16 | ||
| 17 | ||
| 18 | /*************************************************************************** | |
| 19 | CONSTANTS | |
| 20 | ***************************************************************************/ | |
| 21 | ||
| 22 | /* tokens per item */ | |
| 23 | #define TOKENS_PER_PTR (1) | |
| 24 | #define TOKENS_PER_UINT32 (1) | |
| 25 | #define TOKENS_PER_UINT64 (8 / sizeof(FPTR)) | |
| 26 | #define TOKENS_PER_ATTOTIME (TOKENS_PER_UINT32 + TOKENS_PER_UINT64) | |
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | /*************************************************************************** | |
| 31 | TYPE DEFINITIONS | |
| 32 | ***************************************************************************/ | |
| 33 | ||
| 34 | /* include this at the top of your union to get the standard fields */ | |
| 35 | #define TOKEN_COMMON_FIELDS \ | |
| 36 | FPTR i; \ | |
| 37 | const char * stringptr; \ | |
| 38 | const void * voidptr; \ | |
| 39 | const UINT8 * ui8ptr; \ | |
| 40 | const INT8 * i8ptr; \ | |
| 41 | const UINT16 * ui16ptr; \ | |
| 42 | const INT16 * i16ptr; \ | |
| 43 | const UINT32 * ui32ptr; \ | |
| 44 | const INT32 * i32ptr; \ | |
| 45 | const UINT64 * ui64ptr; \ | |
| 46 | const INT64 * i64ptr; \ | |
| 47 | ||
| 48 | ||
| 49 | /* generic_token can be used when there are no particularly special types */ | |
| 50 | typedef struct _generic_token generic_token; | |
| 51 | struct _generic_token | |
| 52 | { | |
| 53 | TOKEN_COMMON_FIELDS | |
| 54 | }; | |
| 55 | ||
| 56 | ||
| 57 | ||
| 58 | /*************************************************************************** | |
| 59 | MACROS | |
| 60 | ***************************************************************************/ | |
| 61 | ||
| 62 | /* ----- compile-time token generation macros ----- */ | |
| 63 | ||
| 64 | /* GCC and C99 compilers can use designated initializers for type safety */ | |
| 65 | #if (defined(__GNUC__) && (__GNUC__ >= 3) && !defined(__cplusplus)) || (defined(_STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) | |
| 66 | #define TOKEN_VALUE(field,a) { .field = (a) } | |
| 67 | #else | |
| 68 | #define TOKEN_VALUE(field,a) { (FPTR)(a) } | |
| 69 | #endif | |
| 70 | ||
| 71 | /* token output primitives */ | |
| 72 | /* note that regardless of the endianness, UINT64s are packed LSW first */ | |
| 73 | #define TOKEN_PTR(field,p) TOKEN_VALUE(field, p) | |
| 74 | #define TOKEN_STRING(p) TOKEN_VALUE(stringptr, p) | |
| 75 | #define TOKEN_UINT32(a) TOKEN_VALUE(i, a) | |
| 76 | #ifdef PTR64 | |
| 77 | #define TOKEN_UINT64(a) TOKEN_VALUE(i, a) | |
| 78 | #else | |
| 79 | #define TOKEN_UINT64(a) TOKEN_VALUE(i, (UINT32)(a)), TOKEN_VALUE(i, (UINT32)((a) >> 32)) | |
| 80 | #endif | |
| 81 | ||
| 82 | /* mask a value to a fixed number of bits and then shift it */ | |
| 83 | #define SHIFT_AND_MASK32(val, bits, shift) (((UINT32)(val) & ((1 << (bits)) - 1)) << (shift)) | |
| 84 | #define SHIFT_AND_MASK64(val, bits, shift) (((UINT64)(val) & (((UINT64)1 << (bits)) - 1)) << (shift)) | |
| 85 | ||
| 86 | /* 32-bit integer packing */ | |
| 87 | #define TOKEN_UINT32_PACK1(val1, bits1) \ | |
| 88 | TOKEN_UINT32(SHIFT_AND_MASK32((val1), (bits1), 0)) | |
| 89 | ||
| 90 | #define TOKEN_UINT32_PACK2(val1, bits1, val2, bits2) \ | |
| 91 | TOKEN_UINT32(SHIFT_AND_MASK32((val1), (bits1), 0) | \ | |
| 92 | SHIFT_AND_MASK32((val2), (bits2), (bits1))) | |
| 93 | ||
| 94 | #define TOKEN_UINT32_PACK3(val1, bits1, val2, bits2, val3, bits3) \ | |
| 95 | TOKEN_UINT32(SHIFT_AND_MASK32((val1), (bits1), 0) | \ | |
| 96 | SHIFT_AND_MASK32((val2), (bits2), (bits1)) | \ | |
| 97 | SHIFT_AND_MASK32((val3), (bits3), (bits1)+(bits2))) | |
| 98 | ||
| 99 | #define TOKEN_UINT32_PACK4(val1, bits1, val2, bits2, val3, bits3, val4, bits4) \ | |
| 100 | TOKEN_UINT32(SHIFT_AND_MASK32((val1), (bits1), 0) | \ | |
| 101 | SHIFT_AND_MASK32((val2), (bits2), (bits1)) | \ | |
| 102 | SHIFT_AND_MASK32((val3), (bits3), (bits1)+(bits2)) | \ | |
| 103 | SHIFT_AND_MASK32((val4), (bits4), (bits1)+(bits2)+(bits3))) | |
| 104 | ||
| 105 | /* 64-bit integer packing */ | |
| 106 | #define TOKEN_UINT64_PACK1(val1, bits1) \ | |
| 107 | TOKEN_UINT64(SHIFT_AND_MASK64((val1), (bits1), 0)) | |
| 108 | ||
| 109 | #define TOKEN_UINT64_PACK2(val1, bits1, val2, bits2) \ | |
| 110 | TOKEN_UINT64(SHIFT_AND_MASK64((val1), (bits1), 0) | \ | |
| 111 | SHIFT_AND_MASK64((val2), (bits2), (bits1))) | |
| 112 | ||
| 113 | #define TOKEN_UINT64_PACK3(val1, bits1, val2, bits2, val3, bits3) \ | |
| 114 | TOKEN_UINT64(SHIFT_AND_MASK64((val1), (bits1), 0) | \ | |
| 115 | SHIFT_AND_MASK64((val2), (bits2), (bits1)) | \ | |
| 116 | SHIFT_AND_MASK64((val3), (bits3), (bits1)+(bits2))) | |
| 117 | ||
| 118 | #define TOKEN_UINT64_PACK4(val1, bits1, val2, bits2, val3, bits3, val4, bits4) \ | |
| 119 | TOKEN_UINT64(SHIFT_AND_MASK64((val1), (bits1), 0) | \ | |
| 120 | SHIFT_AND_MASK64((val2), (bits2), (bits1)) | \ | |
| 121 | SHIFT_AND_MASK64((val3), (bits3), (bits1)+(bits2)) | \ | |
| 122 | SHIFT_AND_MASK64((val4), (bits4), (bits1)+(bits2)+(bits3))) | |
| 123 | ||
| 124 | ||
| 125 | ||
| 126 | /* ----- run-time token extraction macros ----- */ | |
| 127 | ||
| 128 | /* token fetch and advance primitives */ | |
| 129 | #define TOKEN_GET_PTR(tp,field) (((tp)++)->field) | |
| 130 | #define TOKEN_GET_STRING(tp) (((tp)++)->stringptr) | |
| 131 | #define TOKEN_GET_UINT32(tp) (((tp)++)->i) | |
| 132 | #ifdef PTR64 | |
| 133 | #define TOKEN_EXTRACT_UINT64(tp,a) do { (a) = (tp)->i; (tp)++; } while (0) | |
| 134 | #else | |
| 135 | #define TOKEN_EXTRACT_UINT64(tp,a) do { (a) = (tp)[0].i | ((UINT64)(tp)[1].i << 32); (tp) += 2; } while (0) | |
| 136 | #endif | |
| 137 | ||
| 138 | /* token unfetch primitives */ | |
| 139 | #define TOKEN_UNGET_PTR(tp) ((tp)--) | |
| 140 | #define TOKEN_UNGET_STRING(tp) ((tp)--) | |
| 141 | #define TOKEN_UNGET_UINT32(tp) ((tp)--) | |
| 142 | #define TOKEN_UNGET_UINT64(tp) ((tp) -= 8 / sizeof(FPTR)) | |
| 143 | ||
| 144 | /* token skip primitives */ | |
| 145 | #define TOKEN_SKIP_PTR(tp) ((tp)++) | |
| 146 | #define TOKEN_SKIP_STRING(tp) ((tp)++) | |
| 147 | #define TOKEN_SKIP_UINT32(tp) ((tp)++) | |
| 148 | #define TOKEN_SKIP_UINT64(tp) ((tp) += 8 / sizeof(FPTR)) | |
| 149 | ||
| 150 | /* extract a value from a fixed number of bits; if bits is negative, treat it as a signed value */ | |
| 151 | #define UNSHIFT_AND_MASK32(src, val, bits, shift) do { \ | |
| 152 | if ((bits) < 0) \ | |
| 153 | (val) = token_sign_extend32((src) >> (shift), (UINT8)-(bits)); \ | |
| 154 | else \ | |
| 155 | (val) = token_zero_extend32((src) >> (shift), (UINT8)(bits)); \ | |
| 156 | } while (0) | |
| 157 | ||
| 158 | #define UNSHIFT_AND_MASK64(src, val, bits, shift) do { \ | |
| 159 | if ((bits) < 0) \ | |
| 160 | (val) = token_sign_extend64((src) >> (shift), (UINT8)-(bits)); \ | |
| 161 | else \ | |
| 162 | (val) = token_zero_extend64((src) >> (shift), (UINT8)(bits)); \ | |
| 163 | } while (0) | |
| 164 | ||
| 165 | /* cheesy inline absolute value */ | |
| 166 | #define TOKENABS(v) (((v) < 0) ? -(v) : (v)) | |
| 167 | ||
| 168 | /* 32-bit integer unpacking */ | |
| 169 | #define TOKEN_GET_UINT32_UNPACK1(tp, val1, bits1) do { \ | |
| 170 | UINT32 token32 = TOKEN_GET_UINT32(tp); \ | |
| 171 | UNSHIFT_AND_MASK32(token32, val1, (bits1), 0); \ | |
| 172 | } while (0) | |
| 173 | ||
| 174 | #define TOKEN_GET_UINT32_UNPACK2(tp, val1, bits1, val2, bits2) do { \ | |
| 175 | UINT32 token32 = TOKEN_GET_UINT32(tp); \ | |
| 176 | UINT8 shift = 0; \ | |
| 177 | UNSHIFT_AND_MASK32(token32, val1, (bits1), shift); shift += TOKENABS(bits1); \ | |
| 178 | UNSHIFT_AND_MASK32(token32, val2, (bits2), shift); \ | |
| 179 | } while (0) | |
| 180 | ||
| 181 | #define TOKEN_GET_UINT32_UNPACK3(tp, val1, bits1, val2, bits2, val3, bits3) do { \ | |
| 182 | UINT32 token32 = TOKEN_GET_UINT32(tp); \ | |
| 183 | UINT8 shift = 0; \ | |
| 184 | UNSHIFT_AND_MASK32(token32, val1, (bits1), shift); shift += TOKENABS(bits1); \ | |
| 185 | UNSHIFT_AND_MASK32(token32, val2, (bits2), shift); shift += TOKENABS(bits2); \ | |
| 186 | UNSHIFT_AND_MASK32(token32, val3, (bits3), shift); \ | |
| 187 | } while (0) | |
| 188 | ||
| 189 | #define TOKEN_GET_UINT32_UNPACK4(tp, val1, bits1, val2, bits2, val3, bits3, val4, bits4) do { \ | |
| 190 | UINT32 token32 = TOKEN_GET_UINT32(tp); \ | |
| 191 | UINT8 shift = 0; \ | |
| 192 | UNSHIFT_AND_MASK32(token32, val1, (bits1), shift); shift += TOKENABS(bits1); \ | |
| 193 | UNSHIFT_AND_MASK32(token32, val2, (bits2), shift); shift += TOKENABS(bits2); \ | |
| 194 | UNSHIFT_AND_MASK32(token32, val3, (bits3), shift); shift += TOKENABS(bits3); \ | |
| 195 | UNSHIFT_AND_MASK32(token32, val4, (bits4), shift); \ | |
| 196 | } while (0) | |
| 197 | ||
| 198 | /* 64-bit integer unpacking */ | |
| 199 | #define TOKEN_GET_UINT64_UNPACK1(tp, val1, bits1) do { \ | |
| 200 | UINT64 token64; \ | |
| 201 | TOKEN_EXTRACT_UINT64(tp, token64); \ | |
| 202 | UNSHIFT_AND_MASK64(token64, val1, (bits1), 0); \ | |
| 203 | } while (0) | |
| 204 | ||
| 205 | #define TOKEN_GET_UINT64_UNPACK2(tp, val1, bits1, val2, bits2) do { \ | |
| 206 | UINT64 token64; \ | |
| 207 | UINT8 shift = 0; \ | |
| 208 | TOKEN_EXTRACT_UINT64(tp, token64); \ | |
| 209 | UNSHIFT_AND_MASK64(token64, val1, (bits1), shift); shift += TOKENABS(bits1); \ | |
| 210 | UNSHIFT_AND_MASK64(token64, val2, (bits2), shift); \ | |
| 211 | } while (0) | |
| 212 | ||
| 213 | #define TOKEN_GET_UINT64_UNPACK3(tp, val1, bits1, val2, bits2, val3, bits3) do { \ | |
| 214 | UINT64 token64; \ | |
| 215 | UINT8 shift = 0; \ | |
| 216 | TOKEN_EXTRACT_UINT64(tp, token64); \ | |
| 217 | UNSHIFT_AND_MASK64(token64, val1, (bits1), shift); shift += TOKENABS(bits1); \ | |
| 218 | UNSHIFT_AND_MASK64(token64, val2, (bits2), shift); shift += TOKENABS(bits2); \ | |
| 219 | UNSHIFT_AND_MASK64(token64, val3, (bits3), shift); \ | |
| 220 | } while (0) | |
| 221 | ||
| 222 | #define TOKEN_GET_UINT64_UNPACK4(tp, val1, bits1, val2, bits2, val3, bits3, val4, bits4) do { \ | |
| 223 | UINT64 token64; \ | |
| 224 | UINT8 shift = 0; \ | |
| 225 | TOKEN_EXTRACT_UINT64(tp, token64); \ | |
| 226 | UNSHIFT_AND_MASK64(token64, val1, (bits1), shift); shift += TOKENABS(bits1); \ | |
| 227 | UNSHIFT_AND_MASK64(token64, val2, (bits2), shift); shift += TOKENABS(bits2); \ | |
| 228 | UNSHIFT_AND_MASK64(token64, val3, (bits3), shift); shift += TOKENABS(bits3); \ | |
| 229 | UNSHIFT_AND_MASK64(token64, val4, (bits4), shift); \ | |
| 230 | } while (0) | |
| 231 | ||
| 232 | ||
| 233 | ||
| 234 | /*************************************************************************** | |
| 235 | INLINE FUNCTIONS | |
| 236 | ***************************************************************************/ | |
| 237 | ||
| 238 | INLINE UINT32 token_zero_extend32(UINT32 val, UINT8 bits) | |
| 239 | { | |
| 240 | return val & (((UINT32)1 << bits) - 1); | |
| 241 | } | |
| 242 | ||
| 243 | INLINE INT32 token_sign_extend32(UINT32 val, UINT8 bits) | |
| 244 | { | |
| 245 | return (INT32)(val << (32 - bits)) >> (32 - bits); | |
| 246 | } | |
| 247 | ||
| 248 | INLINE UINT64 token_zero_extend64(UINT64 val, UINT8 bits) | |
| 249 | { | |
| 250 | return val & (((UINT64)1 << bits) - 1); | |
| 251 | } | |
| 252 | ||
| 253 | INLINE INT64 token_sign_extend64(UINT64 val, UINT8 bits) | |
| 254 | { | |
| 255 | return (INT64)(val << (64 - bits)) >> (64 - bits); | |
| 256 | } | |
| 257 | ||
| 258 | #endif |
| r11508 | r11509 | |
|---|---|---|
| 168 | 168 | typedef struct _analog_item_data analog_item_data; |
| 169 | 169 | struct _analog_item_data |
| 170 | 170 | { |
| 171 | | |
| 171 | | |
| 172 | 172 | int type; |
| 173 | 173 | int min, max; |
| 174 | 174 | int cur; |
| r11508 | r11509 | |
| 327 | 327 | to the default sequence for the given field |
| 328 | 328 | -------------------------------------------------*/ |
| 329 | 329 | |
| 330 | INLINE const input_seq *get_field_default_seq( | |
| 330 | INLINE const input_seq *get_field_default_seq( | |
| 331 | 331 | { |
| 332 | 332 | if (input_seq_get_1(&field->seq[seqtype]) == SEQCODE_DEFAULT) |
| 333 | return input_type_seq(field-> | |
| 333 | return input_type_seq(field-> | |
| 334 | 334 | else |
| 335 | 335 | return &field->seq[seqtype]; |
| 336 | 336 | } |
| r11508 | r11509 | |
| 1625 | 1625 | |
| 1626 | 1626 | static void menu_main_populate(running_machine &machine, ui_menu *menu, void *state) |
| 1627 | 1627 | { |
| 1628 | const input_field_config *field; | |
| 1629 | const input_port_config *port; | |
| 1628 | input_field_config *field; | |
| 1629 | input_port_config *port; | |
| 1630 | 1630 | int has_categories = FALSE; |
| 1631 | 1631 | int has_configs = FALSE; |
| 1632 | 1632 | int has_analog = FALSE; |
| r11508 | r11509 | |
| 1634 | 1634 | |
| 1635 | 1635 | /* scan the input port array to see what options we need to enable */ |
| 1636 | 1636 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 1637 | for (field = port->fieldlist; field != NULL; field = field->next) | |
| 1637 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 1638 | 1638 | { |
| 1639 | 1639 | if (field->type == IPT_DIPSWITCH) |
| 1640 | 1640 | has_dips = TRUE; |
| r11508 | r11509 | |
| 1844 | 1844 | static void menu_input_specific_populate(running_machine &machine, ui_menu *menu, input_menu_state *menustate) |
| 1845 | 1845 | { |
| 1846 | 1846 | input_item_data *itemlist = NULL; |
| 1847 | const input_field_config *field; | |
| 1848 | const input_port_config *port; | |
| 1847 | input_field_config *field; | |
| 1848 | input_port_config *port; | |
| 1849 | 1849 | int suborder[SEQ_TYPE_TOTAL]; |
| 1850 | 1850 | astring tempstring; |
| 1851 | 1851 | |
| r11508 | r11509 | |
| 1856 | 1856 | |
| 1857 | 1857 | /* iterate over the input ports and add menu items */ |
| 1858 | 1858 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 1859 | for (field = port->fieldlist; field != NULL; field = field->next) | |
| 1859 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 1860 | 1860 | { |
| 1861 | 1861 | const char *name = input_field_name(field); |
| 1862 | 1862 | |
| r11508 | r11509 | |
| 1999 | 1999 | { |
| 2000 | 2000 | input_field_user_settings settings; |
| 2001 | 2001 | |
| 2002 | input_field_get_user_settings(( | |
| 2002 | input_field_get_user_settings(( | |
| 2003 | 2003 | settings.seq[seqchangeditem->seqtype] = seqchangeditem->seq; |
| 2004 | input_field_set_user_settings(( | |
| 2004 | input_field_set_user_settings(( | |
| 2005 | 2005 | } |
| 2006 | 2006 | |
| 2007 | 2007 | /* invalidate the menu to force an update */ |
| r11508 | r11509 | |
| 2156 | 2156 | /* handle events */ |
| 2157 | 2157 | if (menu_event != NULL && menu_event->itemref != NULL) |
| 2158 | 2158 | { |
| 2159 | | |
| 2159 | | |
| 2160 | 2160 | input_field_user_settings settings; |
| 2161 | 2161 | int changed = FALSE; |
| 2162 | 2162 | |
| r11508 | r11509 | |
| 2197 | 2197 | |
| 2198 | 2198 | static void menu_settings_populate(running_machine &machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type) |
| 2199 | 2199 | { |
| 2200 | const input_field_config *field; | |
| 2201 | const input_port_config *port; | |
| 2200 | input_field_config *field; | |
| 2201 | input_port_config *port; | |
| 2202 | 2202 | dip_descriptor **diplist_tailptr; |
| 2203 | 2203 | int dipcount = 0; |
| 2204 | 2204 | |
| r11508 | r11509 | |
| 2208 | 2208 | |
| 2209 | 2209 | /* loop over input ports and set up the current values */ |
| 2210 | 2210 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 2211 | for (field = port->fieldlist; field != NULL; field = field->next) | |
| 2211 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 2212 | 2212 | if (field->type == type && input_condition_true(machine, &field->condition)) |
| 2213 | 2213 | { |
| 2214 | 2214 | UINT32 flags = 0; |
| r11508 | r11509 | |
| 2223 | 2223 | ui_menu_item_append(menu, input_field_name(field), input_field_setting_name(field), flags, (void *)field); |
| 2224 | 2224 | |
| 2225 | 2225 | /* for DIP switches, build up the model */ |
| 2226 | if (type == IPT_DIPSWITCH && field->diploclist != | |
| 2226 | if (type == IPT_DIPSWITCH && field->diploclist().count() != 0 | |
| 2227 | 2227 | { |
| 2228 | 2228 | const input_field_diplocation *diploc; |
| 2229 | 2229 | input_field_user_settings settings; |
| r11508 | r11509 | |
| 2233 | 2233 | input_field_get_user_settings(field, &settings); |
| 2234 | 2234 | |
| 2235 | 2235 | /* iterate over each bit in the field */ |
| 2236 | for (diploc = field->diploclist; diploc != NULL; diploc = diploc->next) | |
| 2236 | for (diploc = field->diploclist().first(); diploc != NULL; diploc = diploc->next()) | |
| 2237 | 2237 | { |
| 2238 | 2238 | UINT32 mask = accummask & ~(accummask - 1); |
| 2239 | 2239 | dip_descriptor *dip; |
| r11508 | r11509 | |
| 2279 | 2279 | |
| 2280 | 2280 | static void menu_settings_custom_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) |
| 2281 | 2281 | { |
| 2282 | | |
| 2282 | | |
| 2283 | 2283 | settings_menu_state *menustate = (settings_menu_state *)state; |
| 2284 | 2284 | dip_descriptor *dip; |
| 2285 | 2285 | |
| r11508 | r11509 | |
| 2299 | 2299 | |
| 2300 | 2300 | /* determine the mask of selected bits */ |
| 2301 | 2301 | if (field != NULL) |
| 2302 | for (diploc = field->diploclist; diploc != NULL; diploc = diploc->next) | |
| 2302 | for (diploc = field->diploclist().first(); diploc != NULL; diploc = diploc->next()) | |
| 2303 | 2303 | if (strcmp(dip->name, diploc->swname) == 0) |
| 2304 | 2304 | selectedmask |= 1 << (diploc->swnum - 1); |
| 2305 | 2305 | |
| r11508 | r11509 | |
| 2455 | 2455 | |
| 2456 | 2456 | static void menu_analog_populate(running_machine &machine, ui_menu *menu) |
| 2457 | 2457 | { |
| 2458 | const input_field_config *field; | |
| 2459 | const input_port_config *port; | |
| 2458 | input_field_config *field; | |
| 2459 | input_port_config *port; | |
| 2460 | 2460 | astring subtext; |
| 2461 | 2461 | astring text; |
| 2462 | 2462 | |
| 2463 | 2463 | /* loop over input ports and add the items */ |
| 2464 | 2464 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 2465 | for (field = port->fieldlist; field != NULL; field = field->next) | |
| 2465 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 2466 | 2466 | if (input_type_is_analog(field->type) && input_condition_true(machine, &field->condition)) |
| 2467 | 2467 | { |
| 2468 | 2468 | input_field_user_settings settings; |
| r11508 | r11509 | |
|---|---|---|
| 787 | 787 | static void frame_update_analog_field(running_machine &machine, analog_field_state *analog); |
| 788 | 788 | static int frame_get_digital_field_state(const input_field_config *field, int mouse_down); |
| 789 | 789 | |
| 790 | /* port configuration helpers */ | |
| 791 | static void port_config_detokenize(ioport_list &portlist, const input_port_token *ipt, char *errorbuf, int errorbuflen, device_t *owner); | |
| 792 | static input_field_config *field_config_alloc(input_port_config *port, int type, input_port_value defvalue, input_port_value maskbits); | |
| 793 | static void field_config_insert(input_field_config *field, input_port_value *disallowedbits, char *errorbuf, int errorbuflen); | |
| 794 | static void field_config_free(input_field_config **fieldptr); | |
| 795 | static input_setting_config *setting_config_alloc(input_field_config *field, input_port_value value, const char *name); | |
| 796 | static void setting_config_free(input_setting_config **settingptr); | |
| 797 | static const input_field_diplocation *diplocation_list_alloc(const input_field_config *field, const char *location, char *errorbuf, int errorbuflen); | |
| 798 | static void diplocation_free(input_field_diplocation **diplocptr); | |
| 799 | ||
| 800 | 790 | /* tokenization helpers */ |
| 801 | 791 | static int token_to_input_field_type(running_machine &machine, const char *string, int *player); |
| 802 | 792 | static const char *input_field_type_to_token(running_machine &machine, int type, int player); |
| r11508 | r11509 | |
| 885 | 875 | |
| 886 | 876 | INLINE const char *get_port_tag(const input_port_config *port, char *tempbuffer) |
| 887 | 877 | { |
| 888 | const input_port_config *curport; | |
| 889 | int index = 0; | |
| 890 | ||
| 891 | if (port->tag != NULL) | |
| 892 | return port->tag; | |
| 893 | for (curport = port->machine().m_portlist.first(); curport != NULL; curport = curport->next()) | |
| 894 | { | |
| 895 | if (curport == port) | |
| 896 | break; | |
| 897 | index++; | |
| 898 | } | |
| 899 | sprintf(tempbuffer, "(PORT#%d)", index); | |
| 900 | return tempbuffer; | |
| 878 | return port->tag(); | |
| 901 | 879 | } |
| 902 | 880 | |
| 903 | 881 | |
| 904 | 882 | /*------------------------------------------------- |
| 905 | error_buf_append - append text to an error | |
| 906 | buffer | |
| 907 | -------------------------------------------------*/ | |
| 908 | ||
| 909 | INLINE void* ATTR_PRINTF(3,4) error_buf_append(char *errorbuf, int errorbuflen, const char *format, ...) | |
| 910 | { | |
| 911 | int curlen = (errorbuf != NULL) ? strlen(errorbuf) : 0; | |
| 912 | int bytesleft = errorbuflen - curlen; | |
| 913 | va_list va; | |
| 914 | ||
| 915 | va_start(va, format); | |
| 916 | if (strlen(format) + 25 < bytesleft) | |
| 917 | vsprintf(&errorbuf[curlen], format, va); | |
| 918 | va_end(va); | |
| 919 | ||
| 920 | return NULL; | |
| 921 | } | |
| 922 | ||
| 923 | ||
| 924 | /*------------------------------------------------- | |
| 925 | 883 | condition_equal - TRUE if two conditions are |
| 926 | 884 | equivalent |
| 927 | 885 | -------------------------------------------------*/ |
| r11508 | r11509 | |
| 934 | 892 | |
| 935 | 893 | |
| 936 | 894 | /*************************************************************************** |
| 937 | CUSTOM DEVICE I/O | |
| 938 | ***************************************************************************/ | |
| 939 | ||
| 940 | /*------------------------------------------------- | |
| 941 | custom_read_line_device - device handler | |
| 942 | stub to process PORT_CUSTOM behavior | |
| 943 | -------------------------------------------------*/ | |
| 944 | ||
| 945 | static READ_LINE_DEVICE_HANDLER( custom_read_line_device ) | |
| 946 | { | |
| 947 | const device_field_info *device_field = (const device_field_info *) device; | |
| 948 | ||
| 949 | return (*device_field->field->custom)(device_field->field, device_field->field->custom_param); | |
| 950 | } | |
| 951 | ||
| 952 | ||
| 953 | /*------------------------------------------------- | |
| 954 | changed_write_line_device - device handler | |
| 955 | stub to process PORT_CHANGED behavior | |
| 956 | -------------------------------------------------*/ | |
| 957 | ||
| 958 | static WRITE_LINE_DEVICE_HANDLER( changed_write_line_device ) | |
| 959 | { | |
| 960 | const device_field_info *device_field = (const device_field_info *) device; | |
| 961 | ||
| 962 | (*device_field->field->changed)(device_field->field, device_field->field->changed_param, device_field->oldval, state); | |
| 963 | } | |
| 964 | ||
| 965 | ||
| 966 | ||
| 967 | /*************************************************************************** | |
| 968 | 895 | CORE SYSTEM MANAGEMENT |
| 969 | 896 | ***************************************************************************/ |
| 970 | 897 | |
| r11508 | r11509 | |
| 973 | 900 | system |
| 974 | 901 | -------------------------------------------------*/ |
| 975 | 902 | |
| 976 | time_t input_port_init(running_machine &machine | |
| 903 | time_t input_port_init(running_machine &machine | |
| 977 | 904 | { |
| 978 | 905 | //input_port_private *portdata; |
| 979 | char errorbuf[1024]; | |
| 980 | 906 | time_t basetime; |
| 981 | 907 | |
| 982 | 908 | /* allocate memory for our data structure */ |
| r11508 | r11509 | |
| 991 | 917 | init_port_types(machine); |
| 992 | 918 | |
| 993 | 919 | /* if we have a token list, proceed */ |
| 994 | for (device_t *device = devicelist.first(); device != NULL; device = device->next()) | |
| 995 | if (device->input_ports() != NULL) | |
| 996 | { | |
| 997 | input_port_list_init(machine.m_portlist, device->input_ports(), errorbuf, sizeof(errorbuf), TRUE, device); | |
| 998 | if (errorbuf[0] != 0) | |
| 999 | mame_printf_error("Input port errors:\n%s", errorbuf); | |
| 1000 | } | |
| 920 | for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next()) | |
| 921 | { | |
| 922 | astring errors; | |
| 923 | input_port_list_init(*device, machine.m_portlist, errors); | |
| 924 | if (errors) | |
| 925 | mame_printf_error("Input port errors:\n%s", errors.cstr()); | |
| 926 | } | |
| 1001 | 927 | |
| 1002 | 928 | init_port_state(machine); |
| 1003 | 929 | /* register callbacks for when we load configurations */ |
| r11508 | r11509 | |
| 1035 | 961 | according to the given tokens |
| 1036 | 962 | -------------------------------------------------*/ |
| 1037 | 963 | |
| 1038 | void input_port_list_init(ioport_list &portlist, | |
| 964 | void input_port_list_init(device_t &device, ioport_list &portlist, a | |
| 1039 | 965 | { |
| 1040 | /* no tokens, no list */ | |
| 1041 | if (tokens == NULL) | |
| 966 | /* no constructor, no list */ | |
| 967 | ioport_constructor constructor = device.input_ports(); | |
| 968 | if (constructor == NULL) | |
| 1042 | 969 | return; |
| 1043 | 970 | |
| 1044 | 971 | /* reset error buffer */ |
| 1045 | if (errorbuf != NULL) | |
| 1046 | *errorbuf = 0; | |
| 972 | errorbuf.reset(); | |
| 1047 | 973 | |
| 1048 | 974 | /* detokenize into the list */ |
| 1049 | port_config_detokenize(portlist, tokens, errorbuf, errorbuflen, owner); | |
| 975 | (*constructor)(device, portlist, errorbuf); | |
| 976 | ||
| 977 | // collapse fields and sort the list | |
| 978 | for (input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 979 | port->collapse_fields(errorbuf); | |
| 1050 | 980 | } |
| 1051 | 981 | |
| 1052 | 982 | |
| r11508 | r11509 | |
| 1062 | 992 | |
| 1063 | 993 | /* if we got the port, look for the field */ |
| 1064 | 994 | if (port != NULL) |
| 1065 | for (const input_field_config *field = port->field | |
| 995 | for (const input_field_config *field = port->first_field() | |
| 1066 | 996 | if ((field->mask & mask) != 0) |
| 1067 | 997 | return field; |
| 1068 | 998 | |
| r11508 | r11509 | |
| 1089 | 1019 | return field->name; |
| 1090 | 1020 | |
| 1091 | 1021 | /* otherwise, return the name associated with the type */ |
| 1092 | return input_type_name(field-> | |
| 1022 | return input_type_name(field-> | |
| 1093 | 1023 | } |
| 1094 | 1024 | |
| 1095 | 1025 | |
| r11508 | r11509 | |
| 1112 | 1042 | |
| 1113 | 1043 | /* if the portseq is the special default code, return the expanded default value */ |
| 1114 | 1044 | if (input_seq_get_1(portseq) == SEQCODE_DEFAULT) |
| 1115 | return input_type_seq(field-> | |
| 1045 | return input_type_seq(field-> | |
| 1116 | 1046 | |
| 1117 | 1047 | /* otherwise, return the sequence as-is */ |
| 1118 | 1048 | return portseq; |
| r11508 | r11509 | |
| 1136 | 1066 | settings->seq[seqtype] = field->state->seq[seqtype]; |
| 1137 | 1067 | |
| 1138 | 1068 | /* if there's a list of settings or we're an adjuster, copy the current value */ |
| 1139 | if (field->settinglist != | |
| 1069 | if (field->settinglist().count() != 0 | |
| 1140 | 1070 | settings->value = field->state->value; |
| 1141 | 1071 | |
| 1142 | 1072 | /* if there's analog data, extract the analog settings */ |
| r11508 | r11509 | |
| 1163 | 1093 | /* copy the basics */ |
| 1164 | 1094 | for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++) |
| 1165 | 1095 | { |
| 1166 | const input_seq *defseq = input_type_seq(field-> | |
| 1096 | const input_seq *defseq = input_type_seq(field-> | |
| 1167 | 1097 | if (input_seq_cmp(defseq, &settings->seq[seqtype]) == 0) |
| 1168 | 1098 | field->state->seq[seqtype] = default_seq; |
| 1169 | 1099 | else |
| r11508 | r11509 | |
| 1171 | 1101 | } |
| 1172 | 1102 | |
| 1173 | 1103 | /* if there's a list of settings or we're an adjuster, copy the current value */ |
| 1174 | if (field->settinglist != | |
| 1104 | if (field->settinglist().count() != 0 | |
| 1175 | 1105 | field->state->value = settings->value; |
| 1176 | 1106 | |
| 1177 | 1107 | /* if there's analog data, extract the analog settings */ |
| r11508 | r11509 | |
| 1195 | 1125 | const input_setting_config *setting; |
| 1196 | 1126 | |
| 1197 | 1127 | /* only makes sense if we have settings */ |
| 1198 | assert(field->settinglist != | |
| 1128 | assert(field->settinglist().count() != 0 | |
| 1199 | 1129 | |
| 1200 | 1130 | /* scan the list of settings looking for a match on the current value */ |
| 1201 | for (setting = field->settinglist; setting != NULL; setting = setting->next) | |
| 1202 | if (input_condition_true(field->port->machine(), &setting->condition)) | |
| 1131 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) | |
| 1132 | if (input_condition_true(field->machine(), &setting->condition)) | |
| 1203 | 1133 | if (setting->value == field->state->value) |
| 1204 | 1134 | return setting->name; |
| 1205 | 1135 | |
| r11508 | r11509 | |
| 1217 | 1147 | const input_setting_config *setting; |
| 1218 | 1148 | |
| 1219 | 1149 | /* only makes sense if we have settings */ |
| 1220 | assert(field->settinglist != | |
| 1150 | assert(field->settinglist().count() != 0 | |
| 1221 | 1151 | |
| 1222 | 1152 | /* scan the list of settings looking for a match on the current value */ |
| 1223 | for (setting = field->settinglist; setting != NULL; setting = setting->next) | |
| 1224 | if (input_condition_true(field->port->machine(), &setting->condition)) | |
| 1153 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) | |
| 1154 | if (input_condition_true(field->machine(), &setting->condition)) | |
| 1225 | 1155 | return (setting->value != field->state->value); |
| 1226 | 1156 | |
| 1227 | 1157 | return FALSE; |
| r11508 | r11509 | |
| 1240 | 1170 | int found_match = FALSE; |
| 1241 | 1171 | |
| 1242 | 1172 | /* only makes sense if we have settings */ |
| 1243 | assert(field->settinglist != | |
| 1173 | assert(field->settinglist().count() != 0 | |
| 1244 | 1174 | |
| 1245 | 1175 | /* scan the list of settings looking for a match on the current value */ |
| 1246 | 1176 | prevsetting = NULL; |
| 1247 | for (setting = field->settinglist; setting != NULL; setting = setting->next) | |
| 1248 | if (input_condition_true(field->port->machine(), &setting->condition)) | |
| 1177 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) | |
| 1178 | if (input_condition_true(field->machine(), &setting->condition)) | |
| 1249 | 1179 | { |
| 1250 | 1180 | if (setting->value == field->state->value) |
| 1251 | 1181 | { |
| r11508 | r11509 | |
| 1259 | 1189 | /* if we didn't find a matching value, select the first */ |
| 1260 | 1190 | if (!found_match) |
| 1261 | 1191 | { |
| 1262 | for (prevsetting = field->settinglist; prevsetting != NULL; prevsetting = prevsetting->next) | |
| 1263 | if (input_condition_true(field->port->machine(), &prevsetting->condition)) | |
| 1192 | for (prevsetting = field->settinglist().first(); prevsetting != NULL; prevsetting = prevsetting->next()) | |
| 1193 | if (input_condition_true(field->machine(), &prevsetting->condition)) | |
| 1264 | 1194 | break; |
| 1265 | 1195 | } |
| 1266 | 1196 | |
| r11508 | r11509 | |
| 1281 | 1211 | int found = FALSE; |
| 1282 | 1212 | |
| 1283 | 1213 | /* only makes sense if we have settings */ |
| 1284 | assert(field->settinglist != | |
| 1214 | assert(field->settinglist().count() != 0 | |
| 1285 | 1215 | |
| 1286 | 1216 | /* scan the list of settings looking for a match on the current value */ |
| 1287 | for (setting = field->settinglist; setting != NULL; setting = setting->next) | |
| 1288 | if (input_condition_true(field->port->machine(), &setting->condition)) | |
| 1217 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) | |
| 1218 | if (input_condition_true(field->machine(), &setting->condition)) | |
| 1289 | 1219 | { |
| 1290 | 1220 | if (found) |
| 1291 | 1221 | return TRUE; |
| r11508 | r11509 | |
| 1308 | 1238 | const input_setting_config *setting, *nextsetting; |
| 1309 | 1239 | |
| 1310 | 1240 | /* only makes sense if we have settings */ |
| 1311 | assert(field->settinglist != | |
| 1241 | assert(field->settinglist().count() != 0 | |
| 1312 | 1242 | |
| 1313 | 1243 | /* scan the list of settings looking for a match on the current value */ |
| 1314 | 1244 | nextsetting = NULL; |
| 1315 | for (setting = field->settinglist; setting != NULL; setting = setting->next) | |
| 1316 | if (input_condition_true(field->port->machine(), &setting->condition)) | |
| 1245 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) | |
| 1246 | if (input_condition_true(field->machine(), &setting->condition)) | |
| 1317 | 1247 | if (setting->value == field->state->value) |
| 1318 | 1248 | break; |
| 1319 | 1249 | |
| 1320 | 1250 | /* if we found one, scan forward for the next valid one */ |
| 1321 | 1251 | if (setting != NULL) |
| 1322 | for (nextsetting = setting->next; nextsetting != NULL; nextsetting = nextsetting->next) | |
| 1323 | if (input_condition_true(field->port->machine(), &nextsetting->condition)) | |
| 1252 | for (nextsetting = setting->next(); nextsetting != NULL; nextsetting = nextsetting->next()) | |
| 1253 | if (input_condition_true(field->machine(), &nextsetting->condition)) | |
| 1324 | 1254 | break; |
| 1325 | 1255 | |
| 1326 | 1256 | /* if we hit the end, search from the beginning */ |
| 1327 | 1257 | if (nextsetting == NULL) |
| 1328 | for (nextsetting = field->settinglist; nextsetting != NULL; nextsetting = nextsetting->next) | |
| 1329 | if (input_condition_true(field->port->machine(), &nextsetting->condition)) | |
| 1258 | for (nextsetting = field->settinglist().first(); nextsetting != NULL; nextsetting = nextsetting->next()) | |
| 1259 | if (input_condition_true(field->machine(), &nextsetting->condition)) | |
| 1330 | 1260 | break; |
| 1331 | 1261 | |
| 1332 | 1262 | /* update the value to the previous one */ |
| r11508 | r11509 | |
| 1551 | 1481 | /* start with the digital */ |
| 1552 | 1482 | result = port->state->digital; |
| 1553 | 1483 | |
| 1554 | /* update | |
| 1484 | /* update read | |
| 1555 | 1485 | for (device_field = port->state->readdevicelist; device_field != NULL; device_field = device_field->next) |
| 1556 | 1486 | if (input_condition_true(port->machine(), &device_field->field->condition)) |
| 1557 | 1487 | { |
| 1558 | 1488 | /* replace the bits with bits from the device */ |
| 1559 | input_port_value newval = (*device_field->field->read | |
| 1489 | input_port_value newval = (*device_field->field->read)(*device_field->device, device_field->field, device_field->field->read_param); | |
| 1560 | 1490 | device_field->oldval = newval; |
| 1561 | 1491 | result = (result & ~device_field->field->mask) | ((newval << device_field->shift) & device_field->field->mask); |
| 1562 | 1492 | } |
| r11508 | r11509 | |
| 1570 | 1500 | result &= ~port->state->vblank; |
| 1571 | 1501 | } |
| 1572 | 1502 | |
| 1573 | /* apply active high/low state to digital, | |
| 1503 | /* apply active high/low state to digital, read | |
| 1574 | 1504 | result ^= port->state->defvalue; |
| 1575 | 1505 | |
| 1576 | 1506 | /* merge in analog portions */ |
| r11508 | r11509 | |
| 1662 | 1592 | |
| 1663 | 1593 | /* read all the lightgun values */ |
| 1664 | 1594 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 1665 | for (field = port->field | |
| 1595 | for (field = port->first_field() | |
| 1666 | 1596 | if (field->player == player && field->crossaxis != CROSSHAIR_AXIS_NONE) |
| 1667 | 1597 | if (input_condition_true(machine, &field->condition)) |
| 1668 | 1598 | { |
| r11508 | r11509 | |
| 1739 | 1669 | port->state->defvalue = 0; |
| 1740 | 1670 | |
| 1741 | 1671 | /* first compute the default value for the entire port */ |
| 1742 | for (field = port->field | |
| 1672 | for (field = port->first_field() | |
| 1743 | 1673 | if (input_condition_true(machine, &field->condition)) |
| 1744 | 1674 | port->state->defvalue = (port->state->defvalue & ~field->mask) | (field->state->value & field->mask); |
| 1745 | 1675 | } |
| r11508 | r11509 | |
| 1789 | 1719 | |
| 1790 | 1720 | void input_port_write_direct(const input_port_config *port, input_port_value data, input_port_value mem_mask) |
| 1791 | 1721 | { |
| 1792 | /* call device line | |
| 1722 | /* call device line writ | |
| 1793 | 1723 | device_field_info *device_field; |
| 1794 | 1724 | |
| 1795 | 1725 | COMBINE_DATA(&port->state->outputvalue); |
| r11508 | r11509 | |
| 1799 | 1729 | { |
| 1800 | 1730 | input_port_value newval = ( (port->state->outputvalue ^ device_field->field->defvalue ) & device_field->field->mask) >> device_field->shift; |
| 1801 | 1731 | |
| 1802 | /* if the bits have | |
| 1732 | /* if the bits have writ | |
| 1803 | 1733 | if (device_field->oldval != newval) |
| 1804 | 1734 | { |
| 1805 | (*device_field->field->write_li | |
| 1735 | (*device_field->field->write)(*device_field->device, device_field->field, device_field->field->write_param, device_field->oldval, newval); | |
| 1806 | 1736 | |
| 1807 | 1737 | device_field->oldval = newval; |
| 1808 | 1738 | } |
| r11508 | r11509 | |
| 1888 | 1818 | input_port_token to a default string |
| 1889 | 1819 | -------------------------------------------------*/ |
| 1890 | 1820 | |
| 1891 | const char *input_port_string_from_token(const | |
| 1821 | const char *input_port_string_from_token(const cha | |
| 1892 | 1822 | { |
| 1893 | 1823 | int index; |
| 1894 | 1824 | |
| 1895 | 1825 | /* 0 is an invalid index */ |
| 1896 | if (t | |
| 1826 | if (str | |
| 1897 | 1827 | return NULL; |
| 1898 | 1828 | |
| 1899 | 1829 | /* if the index is greater than the count, assume it to be a pointer */ |
| 1900 | if (token.i >= INPUT_STRING_COUNT) | |
| 1901 | return token.stringptr; | |
| 1830 | if (FPTR(string) >= INPUT_STRING_COUNT) | |
| 1831 | return string; | |
| 1902 | 1832 | |
| 1903 | 1833 | /* otherwise, scan the list for a matching string and return it */ |
| 1904 | 1834 | for (index = 0; index < ARRAY_LENGTH(input_port_default_strings); index++) |
| 1905 | if (input_port_default_strings[index].id == t | |
| 1835 | if (input_port_default_strings[index].id == FPTR(str | |
| 1906 | 1836 | return input_port_default_strings[index].string; |
| 1907 | 1837 | return "(Unknown Default)"; |
| 1908 | 1838 | } |
| r11508 | r11509 | |
| 2090 | 2020 | /* allocate a new input_port_info structure */ |
| 2091 | 2021 | portstate = auto_alloc_clear(machine, input_port_state); |
| 2092 | 2022 | ((input_port_config *)port)->state = portstate; |
| 2093 | ((input_port_config *)port)->set_machine(machine); | |
| 2094 | 2023 | |
| 2095 | 2024 | /* start with tail pointers to all the data */ |
| 2096 | 2025 | analogstatetail = &portstate->analoglist; |
| r11508 | r11509 | |
| 2098 | 2027 | writedevicetail = &portstate->writedevicelist; |
| 2099 | 2028 | |
| 2100 | 2029 | /* iterate over fields */ |
| 2101 | for (field = port->field | |
| 2030 | for (field = port->first_field() | |
| 2102 | 2031 | { |
| 2103 | 2032 | input_field_state *fieldstate; |
| 2104 | 2033 | int seqtype; |
| r11508 | r11509 | |
| 2129 | 2058 | } |
| 2130 | 2059 | |
| 2131 | 2060 | /* if this entry has device input, allocate memory for the tracking structure */ |
| 2132 | if (field->read | |
| 2061 | if (field->read | |
| 2133 | 2062 | { |
| 2134 | *readdevicetail = init_field_device_info(field,field->read_device | |
| 2063 | *readdevicetail = init_field_device_info(field,field->read_device | |
| 2135 | 2064 | readdevicetail = &(*readdevicetail)->next; |
| 2136 | 2065 | } |
| 2137 | 2066 | |
| 2138 | 2067 | /* if this entry has device output, allocate memory for the tracking structure */ |
| 2139 | if (field->write | |
| 2068 | if (field->write | |
| 2140 | 2069 | { |
| 2141 | *writedevicetail = init_field_device_info(field,field->write_device | |
| 2070 | *writedevicetail = init_field_device_info(field,field->write_device | |
| 2142 | 2071 | writedevicetail = &(*writedevicetail)->next; |
| 2143 | 2072 | } |
| 2144 | 2073 | |
| r11508 | r11509 | |
| 2168 | 2097 | /* look for 4-way joysticks and change the default map if we find any */ |
| 2169 | 2098 | if (joystick_map_default[0] == 0 || strcmp(joystick_map_default, "auto") == 0) |
| 2170 | 2099 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 2171 | for (field = port->field | |
| 2100 | for (field = port->first_field() | |
| 2172 | 2101 | if (field->state->joystick != NULL && field->way == 4) |
| 2173 | 2102 | { |
| 2174 | 2103 | input_device_set_joystick_map(machine, -1, (field->flags & FIELD_FLAG_ROTATED) ? joystick_map_4way_diagonal : joystick_map_4way_sticky); |
| r11508 | r11509 | |
| 2223 | 2152 | /* only scan the list if we haven't already enabled this class of control */ |
| 2224 | 2153 | if (portlist.first() != NULL && !input_device_class_enabled(portlist.first()->machine(), autoenable)) |
| 2225 | 2154 | for (port = portlist.first(); port != NULL; port = port->next()) |
| 2226 | for (field = port->field | |
| 2155 | for (field = port->first_field() | |
| 2227 | 2156 | |
| 2228 | 2157 | /* if this port type is in use, apply the autoselect criteria */ |
| 2229 | 2158 | if ((type1 != 0 && field->type == type1) || |
| r11508 | r11509 | |
| 2248 | 2177 | input_port_value mask; |
| 2249 | 2178 | |
| 2250 | 2179 | /* allocate memory */ |
| 2251 | info = auto_alloc_clear(field-> | |
| 2180 | info = auto_alloc_clear(field-> | |
| 2252 | 2181 | |
| 2253 | 2182 | /* fill in the data */ |
| 2254 | 2183 | info->field = field; |
| r11508 | r11509 | |
| 2256 | 2185 | info->shift++; |
| 2257 | 2186 | |
| 2258 | 2187 | if (device_name != NULL) |
| 2259 | info->device = field-> | |
| 2188 | info->device = field-> | |
| 2260 | 2189 | else |
| 2261 | info->device = | |
| 2190 | info->device = &f | |
| 2262 | 2191 | |
| 2263 | 2192 | info->oldval = field->defvalue >> info->shift; |
| 2264 | 2193 | return info; |
| r11508 | r11509 | |
| 2276 | 2205 | input_port_value mask; |
| 2277 | 2206 | |
| 2278 | 2207 | /* allocate memory */ |
| 2279 | state = auto_alloc_clear(field-> | |
| 2208 | state = auto_alloc_clear(field-> | |
| 2280 | 2209 | |
| 2281 | 2210 | /* compute the shift amount and number of bits */ |
| 2282 | 2211 | for (mask = field->mask; !(mask & 1); mask >>= 1) |
| r11508 | r11509 | |
| 2506 | 2435 | { |
| 2507 | 2436 | for (i = 0; i < ARRAY_LENGTH(code->field) && (code->field[i] != NULL); i++) |
| 2508 | 2437 | { |
| 2509 | if (code->field[i]->port == port) | |
| 2438 | if (&code->field[i]->port() == port) | |
| 2510 | 2439 | { |
| 2511 | 2440 | value = code->field[i]->mask; |
| 2512 | 2441 | *digital |= value; |
| r11508 | r11509 | |
| 2574 | 2503 | port->state->vblank = 0; |
| 2575 | 2504 | |
| 2576 | 2505 | /* now loop back and modify based on the inputs */ |
| 2577 | for (field = port->field | |
| 2506 | for (field = port->first_field() | |
| 2578 | 2507 | if (input_condition_true(port->machine(), &field->condition)) |
| 2579 | 2508 | { |
| 2580 | 2509 | /* accumulate VBLANK bits */ |
| r11508 | r11509 | |
| 2597 | 2526 | playback_port(port); |
| 2598 | 2527 | record_port(port); |
| 2599 | 2528 | |
| 2600 | /* call device line | |
| 2529 | /* call device line writ | |
| 2601 | 2530 | newvalue = input_port_read_direct(port); |
| 2602 | 2531 | for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next) |
| 2603 | 2532 | if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition)) |
| 2604 | 2533 | { |
| 2605 | 2534 | input_port_value newval = (newvalue & device_field->field->mask) >> device_field->shift; |
| 2606 | 2535 | |
| 2607 | /* if the bits have | |
| 2536 | /* if the bits have writ | |
| 2608 | 2537 | if (device_field->oldval != newval) |
| 2609 | 2538 | { |
| 2610 | (*device_field->field->write_li | |
| 2539 | (*device_field->field->write)(*device_field->device, device_field->field, device_field->field->write_param, device_field->oldval, newval); | |
| 2611 | 2540 | |
| 2612 | 2541 | device_field->oldval = newval; |
| 2613 | 2542 | } |
| r11508 | r11509 | |
| 2853 | 2782 | |
| 2854 | 2783 | static int frame_get_digital_field_state(const input_field_config *field, int mouse_down) |
| 2855 | 2784 | { |
| 2856 | int curstate = mouse_down || input_seq_pressed(field-> | |
| 2785 | int curstate = mouse_down || input_seq_pressed(field-> | |
| 2857 | 2786 | int changed = FALSE; |
| 2858 | 2787 | |
| 2859 | 2788 | /* if the state changed, look for switch down/switch up */ |
| r11508 | r11509 | |
| 2863 | 2792 | changed = TRUE; |
| 2864 | 2793 | } |
| 2865 | 2794 | |
| 2866 | if (field->type == IPT_KEYBOARD && ui_get_use_natural_keyboard(field-> | |
| 2795 | if (field->type == IPT_KEYBOARD && ui_get_use_natural_keyboard(field-> | |
| 2867 | 2796 | return FALSE; |
| 2868 | 2797 | |
| 2869 | 2798 | /* if this is a switch-down event, handle impulse and toggle */ |
| r11508 | r11509 | |
| 2876 | 2805 | /* toggle controls: flip the toggle state or advance to the next setting */ |
| 2877 | 2806 | if (field->flags & FIELD_FLAG_TOGGLE) |
| 2878 | 2807 | { |
| 2879 | if (field->settinglist == | |
| 2808 | if (field->settinglist().count() == 0 | |
| 2880 | 2809 | field->state->value ^= field->mask; |
| 2881 | 2810 | else |
| 2882 | 2811 | input_field_select_next_setting(field); |
| r11508 | r11509 | |
| 2909 | 2838 | } |
| 2910 | 2839 | |
| 2911 | 2840 | /* skip locked-out coin inputs */ |
| 2912 | if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field-> | |
| 2841 | if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field-> | |
| 2913 | 2842 | { |
| 2914 | 2843 | ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field)); |
| 2915 | 2844 | return FALSE; |
| r11508 | r11509 | |
| 2928 | 2857 | of port settings according to device settings |
| 2929 | 2858 | -------------------------------------------------*/ |
| 2930 | 2859 | |
| 2931 | ||
| 2860 | ||
| 2932 | 2861 | { |
| 2933 | 2862 | astring tempstring; |
| 2934 | 2863 | const input_device_default *def = NULL; |
| 2935 | if (owner!=NULL) { | |
| 2936 | def = owner->input_ports_defaults(); | |
| 2937 | if (def!=NULL) { | |
| 2938 | while (def->tag!=NULL) { | |
| 2939 | if ((strcmp(fulltag,owner->subtag(tempstring,def->tag))==0) && (def->mask == mask)) { | |
| 2940 | return def->defvalue; | |
| 2941 | } | |
| 2942 | def++; | |
| 2864 | def = owner.input_ports_defaults(); | |
| 2865 | if (def!=NULL) { | |
| 2866 | while (def->tag!=NULL) { | |
| 2867 | if ((strcmp(fulltag,owner.subtag(tempstring,def->tag))==0) && (def->mask == mask)) { | |
| 2868 | return def->defvalue; | |
| 2943 | 2869 | } |
| 2870 | def++; | |
| 2944 | 2871 | } |
| 2945 | 2872 | } |
| 2946 | 2873 | return defval; |
| 2947 | 2874 | } |
| 2948 | 2875 | |
| 2949 | /*------------------------------------------------- | |
| 2950 | port_config_detokenize - recursively | |
| 2951 | detokenize a series of input port tokens | |
| 2952 | -------------------------------------------------*/ | |
| 2953 | 2876 | |
| 2954 | static void port_config_detokenize(ioport_list &portlist, const input_port_token *ipt, char *errorbuf, int errorbuflen, device_t *owner) | |
| 2955 | { | |
| 2956 | UINT32 entrytype = INPUT_TOKEN_INVALID; | |
| 2957 | input_setting_config *cursetting = NULL; | |
| 2958 | input_field_config *curfield = NULL; | |
| 2959 | input_port_config *curport = NULL; | |
| 2960 | input_port_value maskbits = 0; | |
| 2961 | astring tempstring; | |
| 2962 | const char *fulltag = NULL; | |
| 2963 | UINT16 category; /* (MESS-specific) category */ | |
| 2964 | ||
| 2965 | /* loop over tokens until we hit the end */ | |
| 2966 | while (entrytype != INPUT_TOKEN_END) | |
| 2967 | { | |
| 2968 | UINT32 mask, defval, type, val; | |
| 2969 | input_port_token temptoken; | |
| 2970 | input_condition condition; | |
| 2971 | const char *string; | |
| 2972 | int hasdiploc; | |
| 2973 | int index; | |
| 2974 | ||
| 2975 | /* unpack the token from the first entry */ | |
| 2976 | TOKEN_GET_UINT32_UNPACK1(ipt, entrytype, 8); | |
| 2977 | switch (entrytype) | |
| 2978 | { | |
| 2979 | /* end */ | |
| 2980 | case INPUT_TOKEN_END: | |
| 2981 | break; | |
| 2982 | ||
| 2983 | /* including */ | |
| 2984 | case INPUT_TOKEN_INCLUDE: | |
| 2985 | if (curfield != NULL) | |
| 2986 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 2987 | maskbits = 0; | |
| 2988 | ||
| 2989 | port_config_detokenize(portlist, TOKEN_GET_PTR(ipt, tokenptr), errorbuf, errorbuflen, owner); | |
| 2990 | curport = NULL; | |
| 2991 | curfield = NULL; | |
| 2992 | cursetting = NULL; | |
| 2993 | break; | |
| 2994 | ||
| 2995 | /* start of a new input port */ | |
| 2996 | case INPUT_TOKEN_START: | |
| 2997 | if (curfield != NULL) | |
| 2998 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 2999 | maskbits = 0; | |
| 3000 | ||
| 3001 | string = TOKEN_GET_STRING(ipt); | |
| 3002 | if (owner!=NULL) { | |
| 3003 | fulltag = core_strdup(owner->subtag(tempstring, string)); | |
| 3004 | } else { | |
| 3005 | fulltag = string; | |
| 3006 | } | |
| 3007 | curport = &portlist.append(fulltag, *global_alloc(input_port_config(fulltag))); | |
| 3008 | curfield = NULL; | |
| 3009 | cursetting = NULL; | |
| 3010 | break; | |
| 3011 | ||
| 3012 | /* modify an existing port */ | |
| 3013 | case INPUT_TOKEN_MODIFY: | |
| 3014 | if (curfield != NULL) | |
| 3015 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 3016 | maskbits = 0; | |
| 3017 | ||
| 3018 | curport = portlist.find(TOKEN_GET_STRING(ipt)); | |
| 3019 | curfield = NULL; | |
| 3020 | cursetting = NULL; | |
| 3021 | break; | |
| 3022 | ||
| 3023 | /* input field definition */ | |
| 3024 | case INPUT_TOKEN_FIELD: | |
| 3025 | TOKEN_UNGET_UINT32(ipt); | |
| 3026 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, type, 24); | |
| 3027 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); | |
| 3028 | ||
| 3029 | if (curport == NULL) | |
| 3030 | { | |
| 3031 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_FIELD encountered with no active port (mask=%X defval=%X)\n", mask, defval); | |
| 3032 | return; | |
| 3033 | } | |
| 3034 | ||
| 3035 | if (type != IPT_UNKNOWN && type != IPT_UNUSED) | |
| 3036 | curport->active |= mask; | |
| 3037 | ||
| 3038 | if (curfield != NULL) | |
| 3039 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 3040 | curfield = field_config_alloc(curport, type, defval, mask); | |
| 3041 | cursetting = NULL; | |
| 3042 | break; | |
| 3043 | ||
| 3044 | /* field or setting condition */ | |
| 3045 | case INPUT_TOKEN_CONDITION: | |
| 3046 | TOKEN_UNGET_UINT32(ipt); | |
| 3047 | if (curfield == NULL && cursetting == NULL) | |
| 3048 | { | |
| 3049 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CONDITION encountered with no active field or setting\n"); | |
| 3050 | TOKEN_SKIP_UINT32(ipt); | |
| 3051 | TOKEN_SKIP_UINT64(ipt); | |
| 3052 | break; | |
| 3053 | } | |
| 3054 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, condition.condition, 24); | |
| 3055 | TOKEN_GET_UINT64_UNPACK2(ipt, condition.mask, 32, condition.value, 32); | |
| 3056 | condition.tag = TOKEN_GET_STRING(ipt); | |
| 3057 | ||
| 3058 | if (cursetting != NULL) | |
| 3059 | cursetting->condition = condition; | |
| 3060 | else | |
| 3061 | curfield->condition = condition; | |
| 3062 | break; | |
| 3063 | ||
| 3064 | /* field player select */ | |
| 3065 | case INPUT_TOKEN_PLAYER1: | |
| 3066 | case INPUT_TOKEN_PLAYER2: | |
| 3067 | case INPUT_TOKEN_PLAYER3: | |
| 3068 | case INPUT_TOKEN_PLAYER4: | |
| 3069 | case INPUT_TOKEN_PLAYER5: | |
| 3070 | case INPUT_TOKEN_PLAYER6: | |
| 3071 | case INPUT_TOKEN_PLAYER7: | |
| 3072 | case INPUT_TOKEN_PLAYER8: | |
| 3073 | if (curfield == NULL) | |
| 3074 | { | |
| 3075 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_PLAYERn encountered with no active field\n"); | |
| 3076 | break; | |
| 3077 | } | |
| 3078 | curfield->player = entrytype - INPUT_TOKEN_PLAYER1; | |
| 3079 | break; | |
| 3080 | ||
| 3081 | /* field category */ | |
| 3082 | case INPUT_TOKEN_CATEGORY: | |
| 3083 | TOKEN_UNGET_UINT32(ipt); | |
| 3084 | if (curfield == NULL) | |
| 3085 | { | |
| 3086 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CATEGORY encountered with no active field\n"); | |
| 3087 | TOKEN_SKIP_UINT32(ipt); | |
| 3088 | break; | |
| 3089 | } | |
| 3090 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, curfield->category, 24); | |
| 3091 | break; | |
| 3092 | ||
| 3093 | /* field flags */ | |
| 3094 | case INPUT_TOKEN_UNUSED: | |
| 3095 | if (curfield == NULL) | |
| 3096 | { | |
| 3097 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_UNUSED encountered with no active field\n"); | |
| 3098 | break; | |
| 3099 | } | |
| 3100 | curfield->flags |= FIELD_FLAG_UNUSED; | |
| 3101 | break; | |
| 3102 | ||
| 3103 | case INPUT_TOKEN_COCKTAIL: | |
| 3104 | if (curfield == NULL) | |
| 3105 | { | |
| 3106 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_COCKTAIL encountered with no active field\n"); | |
| 3107 | break; | |
| 3108 | } | |
| 3109 | curfield->flags |= FIELD_FLAG_COCKTAIL; | |
| 3110 | curfield->player = 1; | |
| 3111 | break; | |
| 3112 | ||
| 3113 | case INPUT_TOKEN_ROTATED: | |
| 3114 | if (curfield == NULL) | |
| 3115 | { | |
| 3116 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_ROTATED encountered with no active field\n"); | |
| 3117 | break; | |
| 3118 | } | |
| 3119 | curfield->flags |= FIELD_FLAG_ROTATED; | |
| 3120 | break; | |
| 3121 | ||
| 3122 | case INPUT_TOKEN_TOGGLE: | |
| 3123 | if (curfield == NULL) | |
| 3124 | { | |
| 3125 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_TOGGLE encountered with no active field\n"); | |
| 3126 | break; | |
| 3127 | } | |
| 3128 | curfield->flags |= FIELD_FLAG_TOGGLE; | |
| 3129 | break; | |
| 3130 | ||
| 3131 | /* field impulse */ | |
| 3132 | case INPUT_TOKEN_IMPULSE: | |
| 3133 | TOKEN_UNGET_UINT32(ipt); | |
| 3134 | if (curfield == NULL) | |
| 3135 | { | |
| 3136 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_IMPULSE encountered with no active field\n"); | |
| 3137 | TOKEN_SKIP_UINT32(ipt); | |
| 3138 | break; | |
| 3139 | } | |
| 3140 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, curfield->impulse, 24); | |
| 3141 | break; | |
| 3142 | ||
| 3143 | /* field name */ | |
| 3144 | case INPUT_TOKEN_NAME: | |
| 3145 | if (curfield == NULL) | |
| 3146 | { | |
| 3147 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_NAME encountered with no active field\n"); | |
| 3148 | TOKEN_SKIP_STRING(ipt); | |
| 3149 | break; | |
| 3150 | } | |
| 3151 | curfield->name = input_port_string_from_token(*ipt++); | |
| 3152 | break; | |
| 3153 | ||
| 3154 | /* field code sequence */ | |
| 3155 | case INPUT_TOKEN_CODE: | |
| 3156 | TOKEN_UNGET_UINT32(ipt); | |
| 3157 | if (curfield == NULL) | |
| 3158 | { | |
| 3159 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CODE encountered with no active field\n"); | |
| 3160 | TOKEN_SKIP_UINT64(ipt); | |
| 3161 | break; | |
| 3162 | } | |
| 3163 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, val, 32); | |
| 3164 | input_seq_append_or(&curfield->seq[SEQ_TYPE_STANDARD], val); | |
| 3165 | break; | |
| 3166 | ||
| 3167 | /* field custom callback */ | |
| 3168 | case INPUT_TOKEN_CUSTOM: | |
| 3169 | if (curfield == NULL) | |
| 3170 | { | |
| 3171 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CUSTOM encountered with no active field\n"); | |
| 3172 | TOKEN_SKIP_PTR(ipt); | |
| 3173 | TOKEN_SKIP_PTR(ipt); | |
| 3174 | break; | |
| 3175 | } | |
| 3176 | curfield->read_line_device = custom_read_line_device; | |
| 3177 | curfield->read_device_name = NULL; | |
| 3178 | curfield->custom = TOKEN_GET_PTR(ipt, customptr); | |
| 3179 | curfield->custom_param = (void *)TOKEN_GET_PTR(ipt, voidptr); | |
| 3180 | break; | |
| 3181 | ||
| 3182 | /* field changed callback */ | |
| 3183 | case INPUT_TOKEN_CHANGED: | |
| 3184 | if (curfield == NULL) | |
| 3185 | { | |
| 3186 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CHANGED encountered with no active field\n"); | |
| 3187 | TOKEN_SKIP_PTR(ipt); | |
| 3188 | TOKEN_SKIP_PTR(ipt); | |
| 3189 | break; | |
| 3190 | } | |
| 3191 | curfield->write_line_device = changed_write_line_device; | |
| 3192 | curfield->write_device_name = NULL; | |
| 3193 | curfield->changed = TOKEN_GET_PTR(ipt, changedptr); | |
| 3194 | curfield->changed_param = (void *)TOKEN_GET_PTR(ipt, voidptr); | |
| 3195 | break; | |
| 3196 | ||
| 3197 | /* DIP switch location */ | |
| 3198 | case INPUT_TOKEN_DIPLOCATION: | |
| 3199 | if (curfield == NULL) | |
| 3200 | { | |
| 3201 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_DIPLOCATION encountered with no active field\n"); | |
| 3202 | TOKEN_SKIP_STRING(ipt); | |
| 3203 | break; | |
| 3204 | } | |
| 3205 | if (curfield->diploclist != NULL) | |
| 3206 | { | |
| 3207 | error_buf_append(errorbuf, errorbuflen, "multiple INPUT_TOKEN_DIPLOCATIONs encountered for a single field\n"); | |
| 3208 | TOKEN_SKIP_STRING(ipt); | |
| 3209 | break; | |
| 3210 | } | |
| 3211 | curfield->diploclist = diplocation_list_alloc(curfield, TOKEN_GET_STRING(ipt), errorbuf, errorbuflen); | |
| 3212 | break; | |
| 3213 | ||
| 3214 | /* joystick flags */ | |
| 3215 | case INPUT_TOKEN_2WAY: | |
| 3216 | case INPUT_TOKEN_4WAY: | |
| 3217 | case INPUT_TOKEN_8WAY: | |
| 3218 | case INPUT_TOKEN_16WAY: | |
| 3219 | if (curfield == NULL) | |
| 3220 | { | |
| 3221 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_nWAY encountered with no active field\n"); | |
| 3222 | break; | |
| 3223 | } | |
| 3224 | curfield->way = 2 << (entrytype - INPUT_TOKEN_2WAY); | |
| 3225 | break; | |
| 3226 | ||
| 3227 | /* (MESS) natural keyboard support */ | |
| 3228 | case INPUT_TOKEN_CHAR: | |
| 3229 | TOKEN_UNGET_UINT32(ipt); | |
| 3230 | if (curfield == NULL) | |
| 3231 | { | |
| 3232 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CHAR encountered with no active field\n"); | |
| 3233 | TOKEN_SKIP_UINT64(ipt); | |
| 3234 | break; | |
| 3235 | } | |
| 3236 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, val, 32); | |
| 3237 | for (index = 0; index < ARRAY_LENGTH(curfield->chars); index++) | |
| 3238 | if (curfield->chars[index] == 0) | |
| 3239 | { | |
| 3240 | curfield->chars[index] = (unicode_char)val; | |
| 3241 | break; | |
| 3242 | } | |
| 3243 | break; | |
| 3244 | ||
| 3245 | /* analog minimum/maximum */ | |
| 3246 | case INPUT_TOKEN_MINMAX: | |
| 3247 | if (curfield == NULL) | |
| 3248 | { | |
| 3249 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_MINMAX encountered with no active field\n"); | |
| 3250 | TOKEN_SKIP_UINT64(ipt); | |
| 3251 | break; | |
| 3252 | } | |
| 3253 | TOKEN_GET_UINT64_UNPACK2(ipt, curfield->min, 32, curfield->max, 32); | |
| 3254 | break; | |
| 3255 | ||
| 3256 | /* analog sensitivity */ | |
| 3257 | case INPUT_TOKEN_SENSITIVITY: | |
| 3258 | TOKEN_UNGET_UINT32(ipt); | |
| 3259 | if (curfield == NULL) | |
| 3260 | { | |
| 3261 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_SENSITIVITY encountered with no active field\n"); | |
| 3262 | TOKEN_SKIP_UINT32(ipt); | |
| 3263 | break; | |
| 3264 | } | |
| 3265 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, curfield->sensitivity, 24); | |
| 3266 | break; | |
| 3267 | ||
| 3268 | /* analog keyboard delta */ | |
| 3269 | case INPUT_TOKEN_KEYDELTA: | |
| 3270 | TOKEN_UNGET_UINT32(ipt); | |
| 3271 | if (curfield == NULL) | |
| 3272 | { | |
| 3273 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_KEYDELTA encountered with no active field\n"); | |
| 3274 | TOKEN_SKIP_UINT32(ipt); | |
| 3275 | break; | |
| 3276 | } | |
| 3277 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, curfield->delta, -24); | |
| 3278 | curfield->centerdelta = curfield->delta; | |
| 3279 | break; | |
| 3280 | ||
| 3281 | /* analog autocenter delta */ | |
| 3282 | case INPUT_TOKEN_CENTERDELTA: | |
| 3283 | TOKEN_UNGET_UINT32(ipt); | |
| 3284 | if (curfield == NULL) | |
| 3285 | { | |
| 3286 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CENTERDELTA encountered with no active field\n"); | |
| 3287 | TOKEN_SKIP_UINT32(ipt); | |
| 3288 | break; | |
| 3289 | } | |
| 3290 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, curfield->centerdelta, -24); | |
| 3291 | break; | |
| 3292 | ||
| 3293 | /* analog reverse flags */ | |
| 3294 | case INPUT_TOKEN_REVERSE: | |
| 3295 | if (curfield == NULL) | |
| 3296 | { | |
| 3297 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_REVERSE encountered with no active field\n"); | |
| 3298 | break; | |
| 3299 | } | |
| 3300 | curfield->flags |= ANALOG_FLAG_REVERSE; | |
| 3301 | break; | |
| 3302 | ||
| 3303 | case INPUT_TOKEN_RESET: | |
| 3304 | if (curfield == NULL) | |
| 3305 | { | |
| 3306 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_RESET encountered with no active field\n"); | |
| 3307 | break; | |
| 3308 | } | |
| 3309 | curfield->flags |= ANALOG_FLAG_RESET; | |
| 3310 | break; | |
| 3311 | ||
| 3312 | case INPUT_TOKEN_WRAPS: | |
| 3313 | if (curfield == NULL) | |
| 3314 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_WRAPS encountered with no active field\n"); | |
| 3315 | curfield->flags |= ANALOG_FLAG_WRAPS; | |
| 3316 | break; | |
| 3317 | ||
| 3318 | case INPUT_TOKEN_INVERT: | |
| 3319 | if (curfield == NULL) | |
| 3320 | { | |
| 3321 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_INVERT encountered with no active field\n"); | |
| 3322 | break; | |
| 3323 | } | |
| 3324 | curfield->flags |= ANALOG_FLAG_INVERT; | |
| 3325 | break; | |
| 3326 | ||
| 3327 | /* analog crosshair parameters */ | |
| 3328 | case INPUT_TOKEN_CROSSHAIR: | |
| 3329 | TOKEN_UNGET_UINT32(ipt); | |
| 3330 | if (curfield == NULL) | |
| 3331 | { | |
| 3332 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CROSSHAIR encountered with no active field\n"); | |
| 3333 | TOKEN_SKIP_UINT32(ipt); | |
| 3334 | TOKEN_SKIP_UINT64(ipt); | |
| 3335 | break; | |
| 3336 | } | |
| 3337 | TOKEN_GET_UINT32_UNPACK3(ipt, entrytype, 8, curfield->crossaxis, 4, curfield->crossaltaxis, -20); | |
| 3338 | TOKEN_GET_UINT64_UNPACK2(ipt, curfield->crossscale, -32, curfield->crossoffset, -32); | |
| 3339 | curfield->crossaltaxis *= 1.0f / 65536.0f; | |
| 3340 | curfield->crossscale *= 1.0f / 65536.0f; | |
| 3341 | curfield->crossoffset *= 1.0f / 65536.0f; | |
| 3342 | break; | |
| 3343 | ||
| 3344 | /* crosshair mapper callback */ | |
| 3345 | case INPUT_TOKEN_CROSSHAIR_MAPPER: | |
| 3346 | if (curfield == NULL) | |
| 3347 | { | |
| 3348 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CROSSHAIR_MAPPER encountered with no active field\n"); | |
| 3349 | TOKEN_SKIP_PTR(ipt); | |
| 3350 | break; | |
| 3351 | } | |
| 3352 | curfield->crossmapper = TOKEN_GET_PTR(ipt, crossmapptr); | |
| 3353 | break; | |
| 3354 | ||
| 3355 | /* analog decrement sequence */ | |
| 3356 | case INPUT_TOKEN_CODE_DEC: | |
| 3357 | TOKEN_UNGET_UINT32(ipt); | |
| 3358 | if (curfield == NULL) | |
| 3359 | { | |
| 3360 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CODE_DEC encountered with no active field\n"); | |
| 3361 | TOKEN_SKIP_UINT64(ipt); | |
| 3362 | break; | |
| 3363 | } | |
| 3364 | index = entrytype - INPUT_TOKEN_CODE; | |
| 3365 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, val, 32); | |
| 3366 | input_seq_append_or(&curfield->seq[SEQ_TYPE_DECREMENT], val); | |
| 3367 | break; | |
| 3368 | ||
| 3369 | /* analog increment sequence */ | |
| 3370 | case INPUT_TOKEN_CODE_INC: | |
| 3371 | TOKEN_UNGET_UINT32(ipt); | |
| 3372 | if (curfield == NULL) | |
| 3373 | { | |
| 3374 | TOKEN_SKIP_UINT64(ipt); | |
| 3375 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CODE_INC encountered with no active field\n"); | |
| 3376 | break; | |
| 3377 | } | |
| 3378 | index = entrytype - INPUT_TOKEN_CODE; | |
| 3379 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, val, 32); | |
| 3380 | input_seq_append_or(&curfield->seq[SEQ_TYPE_INCREMENT], val); | |
| 3381 | break; | |
| 3382 | ||
| 3383 | /* analog full turn count */ | |
| 3384 | case INPUT_TOKEN_FULL_TURN_COUNT: | |
| 3385 | TOKEN_UNGET_UINT32(ipt); | |
| 3386 | if (curfield == NULL) | |
| 3387 | { | |
| 3388 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_FULL_TURN_COUNT encountered with no active field\n"); | |
| 3389 | TOKEN_SKIP_UINT32(ipt); | |
| 3390 | break; | |
| 3391 | } | |
| 3392 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, curfield->full_turn_count, 24); | |
| 3393 | break; | |
| 3394 | ||
| 3395 | case INPUT_TOKEN_POSITIONS: | |
| 3396 | TOKEN_UNGET_UINT32(ipt); | |
| 3397 | if (curfield == NULL) | |
| 3398 | { | |
| 3399 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_POSITIONS encountered with no active field\n"); | |
| 3400 | TOKEN_SKIP_UINT32(ipt); | |
| 3401 | break; | |
| 3402 | } | |
| 3403 | TOKEN_GET_UINT32_UNPACK2(ipt, entrytype, 8, curfield->max, 24); | |
| 3404 | break; | |
| 3405 | ||
| 3406 | case INPUT_TOKEN_REMAP_TABLE: | |
| 3407 | if (curfield == NULL) | |
| 3408 | { | |
| 3409 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_REMAP_TABLE encountered with no active field\n"); | |
| 3410 | TOKEN_SKIP_PTR(ipt); | |
| 3411 | break; | |
| 3412 | } | |
| 3413 | curfield->remap_table = TOKEN_GET_PTR(ipt, ui32ptr); | |
| 3414 | break; | |
| 3415 | ||
| 3416 | /* DIP switch definition */ | |
| 3417 | case INPUT_TOKEN_DIPNAME: | |
| 3418 | if (curport == NULL) | |
| 3419 | { | |
| 3420 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_DIPNAME encountered with no active port\n"); | |
| 3421 | TOKEN_SKIP_UINT64(ipt); | |
| 3422 | TOKEN_SKIP_STRING(ipt); | |
| 3423 | break; | |
| 3424 | } | |
| 3425 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); | |
| 3426 | if (curfield != NULL) | |
| 3427 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 3428 | defval = port_default_value(fulltag,mask,defval,owner); | |
| 3429 | curfield = field_config_alloc(curport, IPT_DIPSWITCH, defval, mask); | |
| 3430 | cursetting = NULL; | |
| 3431 | curfield->name = input_port_string_from_token(*ipt++); | |
| 3432 | break; | |
| 3433 | ||
| 3434 | /* DIP switch setting */ | |
| 3435 | case INPUT_TOKEN_DIPSETTING: | |
| 3436 | TOKEN_UNGET_UINT32(ipt); | |
| 3437 | if (curfield == NULL) | |
| 3438 | { | |
| 3439 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_DIPSETTING encountered with no active field\n"); | |
| 3440 | TOKEN_SKIP_UINT64(ipt); | |
| 3441 | TOKEN_SKIP_STRING(ipt); | |
| 3442 | break; | |
| 3443 | } | |
| 3444 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, defval, 32); | |
| 3445 | cursetting = setting_config_alloc(curfield, defval & curfield->mask, input_port_string_from_token(*ipt++)); | |
| 3446 | break; | |
| 3447 | ||
| 3448 | /* special DIP switch with on/off values */ | |
| 3449 | case INPUT_TOKEN_SPECIAL_ONOFF: | |
| 3450 | TOKEN_UNGET_UINT32(ipt); | |
| 3451 | TOKEN_GET_UINT32_UNPACK3(ipt, entrytype, 8, hasdiploc, 1, temptoken.i, 23); | |
| 3452 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); | |
| 3453 | ||
| 3454 | if (curport == NULL) | |
| 3455 | { | |
| 3456 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_SPECIAL_ONOFF encountered with no active port\n"); | |
| 3457 | TOKEN_SKIP_UINT32(ipt); | |
| 3458 | TOKEN_SKIP_UINT64(ipt); | |
| 3459 | if (hasdiploc) | |
| 3460 | TOKEN_SKIP_STRING(ipt); | |
| 3461 | break; | |
| 3462 | } | |
| 3463 | if (curfield != NULL) | |
| 3464 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 3465 | curfield = field_config_alloc(curport, IPT_DIPSWITCH, defval, mask); | |
| 3466 | cursetting = NULL; | |
| 3467 | ||
| 3468 | curfield->name = input_port_string_from_token(temptoken); | |
| 3469 | if (temptoken.i == INPUT_STRING_Service_Mode) | |
| 3470 | { | |
| 3471 | curfield->flags |= FIELD_FLAG_TOGGLE; | |
| 3472 | curfield->seq[SEQ_TYPE_STANDARD].code[0] = KEYCODE_F2; | |
| 3473 | } | |
| 3474 | if (hasdiploc) | |
| 3475 | { | |
| 3476 | if (curfield->diploclist != NULL) | |
| 3477 | { | |
| 3478 | error_buf_append(errorbuf, errorbuflen, "multiple INPUT_TOKEN_DIPLOCATIONs encountered for a single field\n"); | |
| 3479 | TOKEN_SKIP_STRING(ipt); | |
| 3480 | break; | |
| 3481 | } | |
| 3482 | curfield->diploclist = diplocation_list_alloc(curfield, TOKEN_GET_STRING(ipt), errorbuf, errorbuflen); | |
| 3483 | } | |
| 3484 | ||
| 3485 | temptoken.i = INPUT_STRING_Off; | |
| 3486 | cursetting = setting_config_alloc(curfield, defval & mask, input_port_string_from_token(temptoken)); | |
| 3487 | ||
| 3488 | temptoken.i = INPUT_STRING_On; | |
| 3489 | cursetting = setting_config_alloc(curfield, ~defval & mask, input_port_string_from_token(temptoken)); | |
| 3490 | ||
| 3491 | /* reset cursetting to NULL to allow subsequent conditions to apply to the field */ | |
| 3492 | cursetting = NULL; | |
| 3493 | break; | |
| 3494 | ||
| 3495 | /* configuration definition */ | |
| 3496 | case INPUT_TOKEN_CONFNAME: | |
| 3497 | if (curport == NULL) | |
| 3498 | { | |
| 3499 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CONFNAME encountered with no active port\n"); | |
| 3500 | TOKEN_SKIP_UINT64(ipt); | |
| 3501 | TOKEN_SKIP_STRING(ipt); | |
| 3502 | break; | |
| 3503 | } | |
| 3504 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); | |
| 3505 | if (curfield != NULL) | |
| 3506 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 3507 | defval = port_default_value(fulltag,mask,defval,owner); | |
| 3508 | curfield = field_config_alloc(curport, IPT_CONFIG, defval, mask); | |
| 3509 | cursetting = NULL; | |
| 3510 | curfield->name = input_port_string_from_token(*ipt++); | |
| 3511 | break; | |
| 3512 | ||
| 3513 | /* configuration setting */ | |
| 3514 | case INPUT_TOKEN_CONFSETTING: | |
| 3515 | TOKEN_UNGET_UINT32(ipt); | |
| 3516 | if (curfield == NULL) | |
| 3517 | { | |
| 3518 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CONFSETTING encountered with no active field\n"); | |
| 3519 | TOKEN_SKIP_UINT64(ipt); | |
| 3520 | TOKEN_SKIP_STRING(ipt); | |
| 3521 | break; | |
| 3522 | } | |
| 3523 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, defval, 32); | |
| 3524 | cursetting = setting_config_alloc(curfield, defval & curfield->mask, input_port_string_from_token(*ipt++)); | |
| 3525 | break; | |
| 3526 | ||
| 3527 | /* configuration definition */ | |
| 3528 | case INPUT_TOKEN_CATEGORY_NAME: | |
| 3529 | if (curport == NULL) | |
| 3530 | { | |
| 3531 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CATEGORY_NAME encountered with no active port\n"); | |
| 3532 | TOKEN_SKIP_UINT64(ipt); | |
| 3533 | TOKEN_SKIP_STRING(ipt); | |
| 3534 | break; | |
| 3535 | } | |
| 3536 | TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32); | |
| 3537 | if (curfield != NULL) | |
| 3538 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 3539 | defval = port_default_value(fulltag,mask,defval,owner); | |
| 3540 | curfield = field_config_alloc(curport, IPT_CATEGORY, defval, mask); | |
| 3541 | cursetting = NULL; | |
| 3542 | curfield->name = input_port_string_from_token(*ipt++); | |
| 3543 | break; | |
| 3544 | ||
| 3545 | /* category setting */ | |
| 3546 | case INPUT_TOKEN_CATEGORY_SETTING: | |
| 3547 | TOKEN_UNGET_UINT32(ipt); | |
| 3548 | if (curfield == NULL) | |
| 3549 | { | |
| 3550 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_CATEGORY_SETTING encountered with no active field\n"); | |
| 3551 | TOKEN_SKIP_UINT64(ipt); | |
| 3552 | TOKEN_SKIP_STRING(ipt); | |
| 3553 | break; | |
| 3554 | } | |
| 3555 | TOKEN_GET_UINT64_UNPACK3(ipt, entrytype, 8, defval, 32, category, 16); | |
| 3556 | cursetting = setting_config_alloc(curfield, defval & curfield->mask, input_port_string_from_token(*ipt++)); | |
| 3557 | cursetting->category = category; | |
| 3558 | break; | |
| 3559 | ||
| 3560 | /* analog adjuster definition */ | |
| 3561 | case INPUT_TOKEN_ADJUSTER: | |
| 3562 | TOKEN_UNGET_UINT32(ipt); | |
| 3563 | if (curport == NULL) | |
| 3564 | { | |
| 3565 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_ADJUSTER encountered with no active port\n"); | |
| 3566 | TOKEN_SKIP_UINT64(ipt); | |
| 3567 | TOKEN_SKIP_STRING(ipt); | |
| 3568 | break; | |
| 3569 | } | |
| 3570 | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, defval, 32); | |
| 3571 | if (curfield != NULL) | |
| 3572 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 3573 | curfield = field_config_alloc(curport, IPT_ADJUSTER, defval, 0xff); | |
| 3574 | cursetting = NULL; | |
| 3575 | curfield->name = TOKEN_GET_STRING(ipt); | |
| 3576 | break; | |
| 3577 | ||
| 3578 | /* input device handler */ | |
| 3579 | case INPUT_TOKEN_READ_LINE_DEVICE: | |
| 3580 | if (curfield == NULL) | |
| 3581 | { | |
| 3582 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_READ_LINE_DEVICE encountered with no active field\n"); | |
| 3583 | TOKEN_SKIP_STRING(ipt); | |
| 3584 | TOKEN_SKIP_PTR(ipt); | |
| 3585 | break; | |
| 3586 | } | |
| 3587 | curfield->read_device_name = TOKEN_GET_STRING(ipt); | |
| 3588 | if (!strcmp(curfield->read_device_name, DEVICE_SELF)) | |
| 3589 | { | |
| 3590 | if (owner) | |
| 3591 | curfield->read_device_name = owner->tag(); | |
| 3592 | else | |
| 3593 | error_buf_append(errorbuf, errorbuflen, "DEVICE_SELF used while not in device context\n"); | |
| 3594 | } | |
| 3595 | curfield->read_line_device = TOKEN_GET_PTR(ipt, read_line_device); | |
| 3596 | break; | |
| 3597 | ||
| 3598 | /* output device handler */ | |
| 3599 | case INPUT_TOKEN_WRITE_LINE_DEVICE: | |
| 3600 | if (curfield == NULL) | |
| 3601 | { | |
| 3602 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_WRITE_LINE_DEVICE encountered with no active field\n"); | |
| 3603 | TOKEN_SKIP_STRING(ipt); | |
| 3604 | TOKEN_SKIP_PTR(ipt); | |
| 3605 | break; | |
| 3606 | } | |
| 3607 | curfield->write_device_name = TOKEN_GET_STRING(ipt); | |
| 3608 | if (!strcmp(curfield->write_device_name, DEVICE_SELF)) | |
| 3609 | { | |
| 3610 | if (owner) | |
| 3611 | curfield->write_device_name = owner->tag(); | |
| 3612 | else | |
| 3613 | error_buf_append(errorbuf, errorbuflen, "DEVICE_SELF used while not in device context\n"); | |
| 3614 | } | |
| 3615 | curfield->write_line_device = TOKEN_GET_PTR(ipt, write_line_device); | |
| 3616 | break; | |
| 3617 | ||
| 3618 | default: | |
| 3619 | error_buf_append(errorbuf, errorbuflen, "Invalid token %d in input ports\n", entrytype); | |
| 3620 | break; | |
| 3621 | } | |
| 3622 | } | |
| 3623 | ||
| 3624 | /* insert any pending fields */ | |
| 3625 | if (curfield != NULL) | |
| 3626 | field_config_insert(curfield, &maskbits, errorbuf, errorbuflen); | |
| 3627 | } | |
| 3628 | ||
| 3629 | ||
| 3630 | 2877 | /*------------------------------------------------- |
| 3631 | 2878 | input_port_config - constructor for an |
| 3632 | 2879 | I/O port configuration object |
| 3633 | 2880 | -------------------------------------------------*/ |
| 3634 | 2881 | |
| 3635 | input_port_config::input_port_config(const char *_tag) | |
| 3636 | : m_next(NULL), | |
| 3637 | tag(_tag), | |
| 3638 | fieldlist(NULL), | |
| 3639 | state(NULL), | |
| 3640 | owner(NULL), | |
| 2882 | input_port_config::input_port_config(device_t &owner, const char *tag) | |
| 2883 | : state(NULL), | |
| 3641 | 2884 | active(0), |
| 3642 | m_machine(NULL) | |
| 2885 | m_next(NULL), | |
| 2886 | m_owner(owner), | |
| 2887 | m_tag(tag), | |
| 2888 | m_modcount(0) | |
| 3643 | 2889 | { |
| 3644 | 2890 | } |
| 3645 | 2891 | |
| 3646 | 2892 | |
| 3647 | /*------------------------------------------------- | |
| 3648 | ~input_port_config - destructor for an | |
| 3649 | I/O port configuration object | |
| 3650 | -------------------------------------------------*/ | |
| 3651 | ||
| 3652 | input_port_config::~input_port_config() | |
| 2893 | running_machine &input_port_config::machine() const | |
| 3653 | 2894 | { |
| 3654 | while (fieldlist != NULL) | |
| 3655 | field_config_free((input_field_config **)&fieldlist); | |
| 2895 | return m_owner.machine(); | |
| 3656 | 2896 | } |
| 3657 | 2897 | |
| 3658 | 2898 | |
| 3659 | ||
| 3660 | 2899 | /*------------------------------------------------- |
| 3661 | 2900 | field_config_alloc - allocate a new input |
| 3662 | 2901 | port field config |
| 3663 | 2902 | -------------------------------------------------*/ |
| 3664 | 2903 | |
| 3665 | static input_field_config *field_config_alloc(input_port_config *port, int type, input_port_value defvalue, input_port_value maskbits) | |
| 2904 | input_field_config::input_field_config(input_port_config &port, int _type, input_port_value _defvalue, input_port_value _maskbits, const char *_name) | |
| 2905 | : mask(_maskbits), | |
| 2906 | defvalue(_defvalue & _maskbits), | |
| 2907 | type(_type), | |
| 2908 | player(0), | |
| 2909 | category(0), | |
| 2910 | flags(0), | |
| 2911 | impulse(0), | |
| 2912 | name(_name), | |
| 2913 | read(NULL), | |
| 2914 | read_param(NULL), | |
| 2915 | read_device(NULL), | |
| 2916 | write(NULL), | |
| 2917 | write_param(NULL), | |
| 2918 | write_device(NULL), | |
| 2919 | min(0), | |
| 2920 | max(_maskbits), | |
| 2921 | sensitivity(0), | |
| 2922 | delta(0), | |
| 2923 | centerdelta(0), | |
| 2924 | crossaxis(0), | |
| 2925 | crossscale(0), | |
| 2926 | crossoffset(0), | |
| 2927 | crossaltaxis(0), | |
| 2928 | crossmapper(NULL), | |
| 2929 | full_turn_count(0), | |
| 2930 | remap_table(NULL), | |
| 2931 | way(0), | |
| 2932 | state(NULL), | |
| 2933 | m_next(NULL), | |
| 2934 | m_port(port), | |
| 2935 | m_modcount(port.modcount()) | |
| 3666 | 2936 | { |
| 3667 | input_field_config *config; | |
| 3668 | int seqtype; | |
| 2937 | memset(&condition, 0, sizeof(condition)); | |
| 2938 | for (int seqtype = 0; seqtype < ARRAY_LENGTH(seq); seqtype++) | |
| 2939 | input_seq_set_1(&seq[seqtype], SEQCODE_DEFAULT); | |
| 2940 | } | |
| 3669 | 2941 | |
| 3670 | /* allocate memory */ | |
| 3671 | config = global_alloc_clear(input_field_config); | |
| 3672 | 2942 | |
| 3673 | /* fill in the basic field values */ | |
| 3674 | config->port = port; | |
| 3675 | config->type = type; | |
| 3676 | config->mask = maskbits; | |
| 3677 | config->defvalue = defvalue & maskbits; | |
| 3678 | config->max = maskbits; | |
| 3679 | for (seqtype = 0; seqtype < ARRAY_LENGTH(config->seq); seqtype++) | |
| 3680 | input_seq_set_1(&config->seq[seqtype], SEQCODE_DEFAULT); | |
| 2943 | input_setting_config::input_setting_config(input_field_config &field, input_port_value _value, const char *_name) | |
| 2944 | : value(_value), | |
| 2945 | name(_name), | |
| 2946 | category(0), | |
| 2947 | m_field(field), | |
| 2948 | m_next(NULL) | |
| 2949 | { | |
| 2950 | memset(&condition, 0, sizeof(condition)); | |
| 2951 | } | |
| 3681 | 2952 | |
| 3682 | return config; | |
| 2953 | input_field_diplocation::input_field_diplocation(const char *string, UINT8 _swnum, bool _invert) | |
| 2954 | : swname(string), | |
| 2955 | swnum(_swnum), | |
| 2956 | invert(_invert) | |
| 2957 | { | |
| 3683 | 2958 | } |
| 3684 | 2959 | |
| 3685 | ||
| 3686 | 2960 | /*------------------------------------------------- |
| 3687 | 2961 | field_config_insert - insert an allocated |
| 3688 | 2962 | input port field config, replacing any |
| r11508 | r11509 | |
| 3690 | 2964 | inserting at the correct sorted location |
| 3691 | 2965 | -------------------------------------------------*/ |
| 3692 | 2966 | |
| 3693 | ||
| 2967 | ||
| 3694 | 2968 | { |
| 3695 | const input_field_config * const *scanfieldptr; | |
| 3696 | const input_field_config * const *scanfieldnextptr; | |
| 3697 | input_field_config *config; | |
| 3698 | input_port_value lowbit; | |
| 2969 | input_field_config *list = m_fieldlist.detach_all(); | |
| 2970 | input_port_value maskbits = 0; | |
| 2971 | int lastmodcount = -1; | |
| 2972 | while (list != NULL) | |
| 2973 | { | |
| 2974 | if (list->modcount() != lastmodcount) | |
| 2975 | { | |
| 2976 | lastmodcount = list->modcount(); | |
| 2977 | maskbits = 0; | |
| 2978 | } | |
| 2979 | input_field_config *current = list; | |
| 2980 | list = list->next(); | |
| 2981 | field_config_insert(*current, maskbits, errorbuf); | |
| 2982 | } | |
| 2983 | } | |
| 3699 | 2984 | |
| 2985 | void field_config_insert(input_field_config &newfield, input_port_value &disallowedbits, astring &errorbuf) | |
| 2986 | { | |
| 2987 | input_port_value lowbit; | |
| 2988 | ||
| 3700 | 2989 | /* verify against the disallowed bits, but only if we are condition-free */ |
| 3701 | if (field | |
| 2990 | if (newfield. | |
| 3702 | 2991 | { |
| 3703 | if ((field->mask & *disallowedbits) != 0) | |
| 3704 | error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_FIELD specifies duplicate port bits (mask=%X)\n", field->mask); | |
| 3705 | *disallowedbits |= field->mask; | |
| 2992 | if ((newfield.mask & disallowedbits) != 0) | |
| 2993 | errorbuf.catprintf("INPUT_TOKEN_FIELD specifies duplicate port bits (port=%s mask=%X)\n", newfield.port().tag(), newfield.mask); | |
| 2994 | disallowedbits |= newfield.mask; | |
| 3706 | 2995 | } |
| 3707 | 2996 | |
| 3708 | 2997 | /* first modify/nuke any entries that intersect our maskbits */ |
| 3709 | for (scanfieldptr = &field->port->fieldlist; *scanfieldptr != NULL; scanfieldptr = scanfieldnextptr) | |
| 2998 | input_field_config *nextfield; | |
| 2999 | for (input_field_config *field = newfield.port().fieldlist().first(); field != NULL; field = nextfield) | |
| 3710 | 3000 | { |
| 3711 | scanfieldnextptr = &(*scanfieldptr)->next; | |
| 3712 | if (((*scanfieldptr)->mask & field->mask) != 0 && (field->condition.condition == PORTCOND_ALWAYS || | |
| 3713 | (*scanfieldptr)->condition.condition == PORTCOND_ALWAYS || | |
| 3714 | condition_equal(&(*scanfieldptr)->condition, &field->condition))) | |
| 3001 | nextfield = field->next(); | |
| 3002 | if ((field->mask & newfield.mask) != 0 && (newfield.condition.condition == PORTCOND_ALWAYS || | |
| 3003 | field->condition.condition == PORTCOND_ALWAYS || | |
| 3004 | condition_equal(&field->condition, &newfield.condition))) | |
| 3715 | 3005 | { |
| 3716 | 3006 | /* reduce the mask of the field we found */ |
| 3717 | config = (input_field_config *)*scanfieldptr; | |
| 3718 | config->mask &= ~field->mask; | |
| 3007 | field->mask &= ~newfield.mask; | |
| 3719 | 3008 | |
| 3720 | 3009 | /* if the new entry fully overrides the previous one, we nuke */ |
| 3721 | if (INPUT_PORT_OVERRIDE_FULLY_NUKES_PREVIOUS || config->mask == 0) | |
| 3722 | { | |
| 3723 | field_config_free((input_field_config **)scanfieldptr); | |
| 3724 | scanfieldnextptr = scanfieldptr; | |
| 3725 | } | |
| 3010 | if (INPUT_PORT_OVERRIDE_FULLY_NUKES_PREVIOUS || field->mask == 0) | |
| 3011 | newfield.port().fieldlist().remove(*field); | |
| 3726 | 3012 | } |
| 3727 | 3013 | } |
| 3728 | 3014 | |
| 3729 | 3015 | /* make a mask of just the low bit */ |
| 3730 | lowbit = (field | |
| 3016 | lowbit = (newfield. | |
| 3731 | 3017 | |
| 3732 | 3018 | /* scan forward to find where to insert ourselves */ |
| 3733 | for (scanfieldptr = (const input_field_config * const *)&field->port->fieldlist; *scanfieldptr != NULL; scanfieldptr = &(*scanfieldptr)->next) | |
| 3734 | if ((*scanfieldptr)->mask > lowbit) | |
| 3019 | input_field_config *field; | |
| 3020 | for (field = newfield.port().fieldlist().first(); field != NULL; field = field->next()) | |
| 3021 | if (field->mask > lowbit) | |
| 3735 | 3022 | break; |
| 3736 | 3023 | |
| 3737 | 3024 | /* insert it into the list */ |
| 3738 | field->next = *scanfieldptr; | |
| 3739 | *(input_field_config **)scanfieldptr = field; | |
| 3025 | newfield.port().fieldlist().insert_before(newfield, field); | |
| 3740 | 3026 | } |
| 3741 | 3027 | |
| 3742 | 3028 | |
| 3743 | 3029 | /*------------------------------------------------- |
| 3744 | field_config_free - free an allocated input | |
| 3745 | field configuration | |
| 3746 | -------------------------------------------------*/ | |
| 3747 | ||
| 3748 | static void field_config_free(input_field_config **fieldptr) | |
| 3749 | { | |
| 3750 | input_field_config *field = *fieldptr; | |
| 3751 | ||
| 3752 | /* free any settings and DIP locations first */ | |
| 3753 | while (field->settinglist != NULL) | |
| 3754 | setting_config_free((input_setting_config **)&field->settinglist); | |
| 3755 | while (field->diploclist != NULL) | |
| 3756 | diplocation_free((input_field_diplocation **)&field->diploclist); | |
| 3757 | ||
| 3758 | /* remove ourself from the list */ | |
| 3759 | *fieldptr = (input_field_config *)field->next; | |
| 3760 | ||
| 3761 | /* free ourself */ | |
| 3762 | global_free(field); | |
| 3763 | } | |
| 3764 | ||
| 3765 | ||
| 3766 | /*------------------------------------------------- | |
| 3767 | setting_config_alloc - allocate a new input | |
| 3768 | port setting and append it to the end of the | |
| 3769 | list | |
| 3770 | -------------------------------------------------*/ | |
| 3771 | ||
| 3772 | static input_setting_config *setting_config_alloc(input_field_config *field, input_port_value value, const char *name) | |
| 3773 | { | |
| 3774 | const input_setting_config * const *tailptr; | |
| 3775 | input_setting_config *config; | |
| 3776 | ||
| 3777 | /* allocate memory */ | |
| 3778 | config = global_alloc_clear(input_setting_config); | |
| 3779 | ||
| 3780 | /* fill in the basic setting values */ | |
| 3781 | config->field = field; | |
| 3782 | config->value = value; | |
| 3783 | config->name = name; | |
| 3784 | ||
| 3785 | /* add it to the tail */ | |
| 3786 | for (tailptr = &field->settinglist; *tailptr != NULL; tailptr = &(*tailptr)->next) ; | |
| 3787 | *(input_setting_config **)tailptr = config; | |
| 3788 | ||
| 3789 | return config; | |
| 3790 | } | |
| 3791 | ||
| 3792 | ||
| 3793 | /*------------------------------------------------- | |
| 3794 | setting_config_free - free an allocated input | |
| 3795 | setting configuration | |
| 3796 | -------------------------------------------------*/ | |
| 3797 | ||
| 3798 | static void setting_config_free(input_setting_config **settingptr) | |
| 3799 | { | |
| 3800 | input_setting_config *setting = (input_setting_config *)*settingptr; | |
| 3801 | ||
| 3802 | /* remove ourself from the list */ | |
| 3803 | *settingptr = (input_setting_config *)setting->next; | |
| 3804 | ||
| 3805 | /* free ourself */ | |
| 3806 | global_free(setting); | |
| 3807 | } | |
| 3808 | ||
| 3809 | ||
| 3810 | /*------------------------------------------------- | |
| 3811 | 3030 | diplocation_expand - expand a string-based |
| 3812 | 3031 | DIP location into a linked list of |
| 3813 | 3032 | descriptions |
| 3814 | 3033 | -------------------------------------------------*/ |
| 3815 | 3034 | |
| 3816 | ||
| 3035 | v | |
| 3817 | 3036 | { |
| 3818 | input_field_diplocation *head = NULL; | |
| 3819 | input_field_diplocation **tailptr = &head; | |
| 3820 | const char *curentry = location; | |
| 3821 | char *lastname = NULL; | |
| 3822 | char tempbuf[100]; | |
| 3823 | input_port_value temp; | |
| 3824 | int entries = 0; | |
| 3825 | int val, bits; | |
| 3826 | ||
| 3827 | 3037 | /* if nothing present, bail */ |
| 3828 | 3038 | if (location == NULL) |
| 3829 | return | |
| 3039 | return | |
| 3830 | 3040 | |
| 3041 | field.diploclist().reset(); | |
| 3042 | ||
| 3831 | 3043 | /* parse the string */ |
| 3044 | const char *lastname = NULL; | |
| 3045 | const char *curentry = location; | |
| 3046 | int entries = 0; | |
| 3832 | 3047 | while (*curentry != 0) |
| 3833 | 3048 | { |
| 3834 | const char *comma, *colon, *number; | |
| 3835 | ||
| 3836 | /* allocate a new entry */ | |
| 3837 | *tailptr = global_alloc_clear(input_field_diplocation); | |
| 3838 | entries++; | |
| 3839 | ||
| 3840 | 3049 | /* find the end of this entry */ |
| 3841 | comma = strchr(curentry, ','); | |
| 3050 | const char *comma = strchr(curentry, ','); | |
| 3842 | 3051 | if (comma == NULL) |
| 3843 | 3052 | comma = curentry + strlen(curentry); |
| 3844 | 3053 | |
| 3845 | 3054 | /* extract it to tempbuf */ |
| 3846 | strncpy(tempbuf, curentry, comma - curentry); | |
| 3847 | tempbuf[comma - curentry] = 0; | |
| 3055 | astring tempstr; | |
| 3056 | tempstr.cpy(curentry, comma - curentry); | |
| 3848 | 3057 | |
| 3849 | 3058 | /* first extract the switch name if present */ |
| 3850 | number = tempbuf; | |
| 3851 | colon = strchr(tempbuf, ':'); | |
| 3059 | const char *number = tempstr; | |
| 3060 | const char *colon = strchr(tempstr, ':'); | |
| 3852 | 3061 | |
| 3853 | 3062 | /* allocate and copy the name if it is present */ |
| 3063 | astring name; | |
| 3854 | 3064 | if (colon != NULL) |
| 3855 | 3065 | { |
| 3856 | (*tailptr)->swname = lastname = global_alloc_array(char, colon - tempbuf + 1); | |
| 3857 | strncpy(lastname, tempbuf, colon - tempbuf); | |
| 3858 | lastname[colon - tempbuf] = 0; | |
| 3066 | lastname = name.cpy(number, colon - number); | |
| 3859 | 3067 | number = colon + 1; |
| 3860 | 3068 | } |
| 3861 | 3069 | |
| 3862 | 3070 | /* otherwise, just copy the last name */ |
| 3863 | 3071 | else |
| 3864 | 3072 | { |
| 3865 | char *namecopy; | |
| 3866 | 3073 | if (lastname == NULL) |
| 3867 | 3074 | { |
| 3868 | error | |
| 3075 | error | |
| 3869 | 3076 | lastname = (char *)"UNK"; |
| 3870 | 3077 | } |
| 3871 | (*tailptr)->swname = namecopy = global_alloc_array(char, strlen(lastname) + 1); | |
| 3872 | strcpy(namecopy, lastname); | |
| 3078 | name.cpy(lastname); | |
| 3873 | 3079 | } |
| 3874 | 3080 | |
| 3875 | 3081 | /* if the number is preceded by a '!' it's active high */ |
| 3876 | | |
| 3082 | boo | |
| 3877 | 3083 | if (*number == '!') |
| 3878 | 3084 | { |
| 3879 | | |
| 3085 | | |
| 3880 | 3086 | number++; |
| 3881 | 3087 | } |
| 3882 | 3088 | |
| 3883 | 3089 | /* now scan the switch number */ |
| 3884 | if (sscanf(number, "%d", &val) != 1) | |
| 3885 | error_buf_append(errorbuf, errorbuflen, "Switch location '%s' has invalid format!\n", location); | |
| 3886 | else | |
| 3887 | (*tailptr)->swnum = val; | |
| 3090 | int swnum = -1; | |
| 3091 | if (sscanf(number, "%d", &swnum) != 1) | |
| 3092 | errorbuf.catprintf("Switch location '%s' has invalid format!\n", location); | |
| 3888 | 3093 | |
| 3094 | /* allocate a new entry */ | |
| 3095 | field.diploclist().append(*global_alloc(input_field_diplocation(name, swnum, invert))); | |
| 3096 | entries++; | |
| 3097 | ||
| 3889 | 3098 | /* advance to the next item */ |
| 3890 | 3099 | curentry = comma; |
| 3891 | 3100 | if (*curentry != 0) |
| 3892 | 3101 | curentry++; |
| 3893 | tailptr = &(*tailptr)->next; | |
| 3894 | 3102 | } |
| 3895 | 3103 | |
| 3896 | 3104 | /* then verify the number of bits in the mask matches */ |
| 3897 | for (bits = 0, temp = field->mask; temp != 0 && bits < 32; bits++) | |
| 3105 | input_port_value temp; | |
| 3106 | int bits; | |
| 3107 | for (bits = 0, temp = field.mask; temp != 0 && bits < 32; bits++) | |
| 3898 | 3108 | temp &= temp - 1; |
| 3899 | 3109 | if (bits != entries) |
| 3900 | error_buf_append(errorbuf, errorbuflen, "Switch location '%s' does not describe enough bits for mask %X\n", location, field->mask); | |
| 3901 | return head; | |
| 3110 | errorbuf.catprintf("Switch location '%s' does not describe enough bits for mask %X\n", location, field.mask); | |
| 3902 | 3111 | } |
| 3903 | 3112 | |
| 3904 | 3113 | |
| 3905 | /*------------------------------------------------- | |
| 3906 | diplocation_free - free an allocated dip | |
| 3907 | location | |
| 3908 | -------------------------------------------------*/ | |
| 3909 | 3114 | |
| 3910 | static void diplocation_free(input_field_diplocation **diplocptr) | |
| 3911 | { | |
| 3912 | input_field_diplocation *diploc = (input_field_diplocation *)*diplocptr; | |
| 3913 | ||
| 3914 | /* free the name */ | |
| 3915 | if (diploc->swname != NULL) | |
| 3916 | global_free(diploc->swname); | |
| 3917 | ||
| 3918 | /* remove ourself from the list */ | |
| 3919 | *diplocptr = (input_field_diplocation *)diploc->next; | |
| 3920 | ||
| 3921 | /* free ourself */ | |
| 3922 | global_free(diploc); | |
| 3923 | } | |
| 3924 | ||
| 3925 | ||
| 3926 | ||
| 3927 | 3115 | /*************************************************************************** |
| 3928 | 3116 | TOKENIZATION HELPERS |
| 3929 | 3117 | ***************************************************************************/ |
| r11508 | r11509 | |
| 4190 | 3378 | /* find the port we want; if no tag, search them all */ |
| 4191 | 3379 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 4192 | 3380 | if (tag == NULL || strcmp(get_port_tag(port, tempbuffer), tag) == 0) |
| 4193 | for (field = port->field | |
| 3381 | for (field = port->first_field() | |
| 4194 | 3382 | |
| 4195 | 3383 | /* find the matching mask and defvalue */ |
| 4196 | 3384 | if (field->type == type && field->player == player && |
| r11508 | r11509 | |
| 4351 | 3539 | |
| 4352 | 3540 | /* iterate over ports */ |
| 4353 | 3541 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 4354 | for (field = port->field | |
| 3542 | for (field = port->first_field() | |
| 4355 | 3543 | if (save_this_input_field_type(field->type)) |
| 4356 | 3544 | { |
| 4357 | 3545 | int changed = FALSE; |
| r11508 | r11509 | |
| 4829 | 4017 | const input_port_config *port; |
| 4830 | 4018 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 4831 | 4019 | { |
| 4832 | for (field = port->field | |
| 4020 | for (field = port->first_field() | |
| 4833 | 4021 | { |
| 4834 | 4022 | if (field->type == IPT_KEYBOARD) |
| 4835 | 4023 | { |
| r11508 | r11509 | |
| 4908 | 4096 | |
| 4909 | 4097 | for (port = portconfig; port != NULL; port = port->next()) |
| 4910 | 4098 | { |
| 4911 | for (field = port->field | |
| 4099 | for (field = port->first_field() | |
| 4912 | 4100 | { |
| 4913 | 4101 | if (field->type == IPT_KEYBOARD) |
| 4914 | 4102 | { |
| r11508 | r11509 | |
| 5537 | 4725 | |
| 5538 | 4726 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 5539 | 4727 | { |
| 5540 | for (field = port->field | |
| 4728 | for (field = port->first_field() | |
| 5541 | 4729 | { |
| 5542 | 4730 | if (input_classify_port(field) == inputclass) |
| 5543 | 4731 | return TRUE; |
| r11508 | r11509 | |
| 5562 | 4750 | joystick_count = 0; |
| 5563 | 4751 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 5564 | 4752 | { |
| 5565 | for (field = port->field | |
| 4753 | for (field = port->first_field() | |
| 5566 | 4754 | { |
| 5567 | 4755 | if (input_classify_port(field) == INPUT_CLASS_CONTROLLER) |
| 5568 | 4756 | { |
| r11508 | r11509 | |
| 5593 | 4781 | /* loop through the input ports */ |
| 5594 | 4782 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 5595 | 4783 | { |
| 5596 | for (field = port->field | |
| 4784 | for (field = port->first_field() | |
| 5597 | 4785 | { |
| 5598 | 4786 | /* is this field a category? */ |
| 5599 | 4787 | if (field->type == IPT_CATEGORY) |
| r11508 | r11509 | |
| 5601 | 4789 | /* get the settings value */ |
| 5602 | 4790 | input_field_get_user_settings(field, &settings); |
| 5603 | 4791 | |
| 5604 | for (setting = field->settinglist; setting != NULL; setting = setting->next) | |
| 4792 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) | |
| 5605 | 4793 | { |
| 5606 | 4794 | /* is this the category we want? if so, is this settings value correct? */ |
| 5607 | 4795 | if ((setting->category == category) && (settings.value == setting->value)) |
| r11508 | r11509 | |
| 5703 | 4891 | fclose(file); |
| 5704 | 4892 | |
| 5705 | 4893 | } |
| 4894 | ||
| 4895 | ||
| 4896 | ||
| 4897 | input_port_config *ioconfig_alloc_port(ioport_list &portlist, device_t &device, const char *tag) | |
| 4898 | { | |
| 4899 | astring fulltag; | |
| 4900 | device.subtag(fulltag, tag); | |
| 4901 | return &portlist.append(fulltag, *global_alloc(input_port_config(device, fulltag))); | |
| 4902 | } | |
| 4903 | ||
| 4904 | input_port_config *ioconfig_modify_port(ioport_list &portlist, device_t &device, const char *tag) | |
| 4905 | { | |
| 4906 | astring fulltag; | |
| 4907 | device.subtag(fulltag, tag); | |
| 4908 | input_port_config *port = portlist.find(fulltag.cstr()); | |
| 4909 | if (port == NULL) | |
| 4910 | throw emu_fatalerror("Requested to modify nonexistent port '%s'", fulltag.cstr()); | |
| 4911 | port->bump_modcount(); | |
| 4912 | return port; | |
| 4913 | } | |
| 4914 | ||
| 4915 | input_field_config *ioconfig_alloc_field(input_port_config &port, int type, input_port_value defval, input_port_value mask, const char *name) | |
| 4916 | { | |
| 4917 | if (&port == NULL) | |
| 4918 | throw emu_fatalerror("INPUT_TOKEN_FIELD encountered with no active port (mask=%X defval=%X)\n", mask, defval); \ | |
| 4919 | if (type != IPT_UNKNOWN && type != IPT_UNUSED) | |
| 4920 | port.active |= mask; | |
| 4921 | if (type == IPT_DIPSWITCH || type == IPT_CONFIG || type == IPT_CATEGORY) | |
| 4922 | defval = port_default_value(port.tag(), mask, defval, port.owner()); | |
| 4923 | return &port.fieldlist().append(*global_alloc(input_field_config(port, type, defval, mask, input_port_string_from_token(name)))); | |
| 4924 | } | |
| 4925 | ||
| 4926 | input_field_config *ioconfig_alloc_onoff(input_port_config &port, const char *name, input_port_value defval, input_port_value mask, const char *diplocation, astring &errorbuf) | |
| 4927 | { | |
| 4928 | input_field_config *curfield = ioconfig_alloc_field(port, IPT_DIPSWITCH, defval, mask, name); | |
| 4929 | if (name == DEF_STR(Service_Mode)) | |
| 4930 | { | |
| 4931 | curfield->flags |= FIELD_FLAG_TOGGLE; | |
| 4932 | curfield->seq[SEQ_TYPE_STANDARD].code[0] = KEYCODE_F2; | |
| 4933 | } | |
| 4934 | if (diplocation != NULL) | |
| 4935 | diplocation_list_alloc(*curfield, diplocation, errorbuf); | |
| 4936 | ioconfig_alloc_setting(*curfield, defval & mask, DEF_STR(Off)); | |
| 4937 | ioconfig_alloc_setting(*curfield, ~defval & mask, DEF_STR(On)); | |
| 4938 | return curfield; | |
| 4939 | } | |
| 4940 | ||
| 4941 | input_setting_config *ioconfig_alloc_setting(input_field_config &field, input_port_value value, const char *name) | |
| 4942 | { | |
| 4943 | return &field.settinglist().append(*global_alloc(input_setting_config(field, value, input_port_string_from_token(name)))); | |
| 4944 | } | |
| 4945 | ||
| 4946 | void ioconfig_field_add_char(input_field_config &field, unicode_char ch, astring &errorbuf) | |
| 4947 | { | |
| 4948 | for (int index = 0; index < ARRAY_LENGTH(field.chars); index++) | |
| 4949 | if (field.chars[index] == 0) | |
| 4950 | { | |
| 4951 | field.chars[index] = ch; | |
| 4952 | break; | |
| 4953 | } | |
| 4954 | } | |
| 4955 | ||
| 4956 | void ioconfig_add_code(input_field_config &field, int which, input_code code) | |
| 4957 | { | |
| 4958 | input_seq_append_or(&field.seq[which], code); | |
| 4959 | } | |
| 4960 |
| r11508 | r11509 | |
|---|---|---|
| 809 | 809 | // input ports description for this device |
| 810 | 810 | //------------------------------------------------- |
| 811 | 811 | |
| 812 | const | |
| 812 | ioport_constr | |
| 813 | 813 | { |
| 814 | 814 | // none by default |
| 815 | 815 | return NULL; |
| r11508 | r11509 | |
|---|---|---|
| 373 | 373 | }; |
| 374 | 374 | |
| 375 | 375 | |
| 376 | /* token types */ | |
| 377 | enum | |
| 378 | { | |
| 379 | INPUT_TOKEN_INVALID, | |
| 380 | INPUT_TOKEN_END, | |
| 381 | INPUT_TOKEN_INCLUDE, | |
| 382 | INPUT_TOKEN_START, | |
| 383 | INPUT_TOKEN_MODIFY, | |
| 384 | INPUT_TOKEN_FIELD, | |
| 385 | INPUT_TOKEN_SPECIAL_ONOFF, | |
| 386 | INPUT_TOKEN_CODE, | |
| 387 | INPUT_TOKEN_CODE_DEC, | |
| 388 | INPUT_TOKEN_CODE_INC, | |
| 389 | INPUT_TOKEN_2WAY, | |
| 390 | INPUT_TOKEN_4WAY, | |
| 391 | INPUT_TOKEN_8WAY, | |
| 392 | INPUT_TOKEN_16WAY, | |
| 393 | INPUT_TOKEN_ROTATED, | |
| 394 | INPUT_TOKEN_PLAYER1, | |
| 395 | INPUT_TOKEN_PLAYER2, | |
| 396 | INPUT_TOKEN_PLAYER3, | |
| 397 | INPUT_TOKEN_PLAYER4, | |
| 398 | INPUT_TOKEN_PLAYER5, | |
| 399 | INPUT_TOKEN_PLAYER6, | |
| 400 | INPUT_TOKEN_PLAYER7, | |
| 401 | INPUT_TOKEN_PLAYER8, | |
| 402 | INPUT_TOKEN_COCKTAIL, | |
| 403 | INPUT_TOKEN_TOGGLE, | |
| 404 | INPUT_TOKEN_NAME, | |
| 405 | INPUT_TOKEN_IMPULSE, | |
| 406 | INPUT_TOKEN_REVERSE, | |
| 407 | INPUT_TOKEN_RESET, | |
| 408 | INPUT_TOKEN_MINMAX, | |
| 409 | INPUT_TOKEN_SENSITIVITY, | |
| 410 | INPUT_TOKEN_KEYDELTA, | |
| 411 | INPUT_TOKEN_CENTERDELTA, | |
| 412 | INPUT_TOKEN_CROSSHAIR, | |
| 413 | INPUT_TOKEN_CROSSHAIR_MAPPER, | |
| 414 | INPUT_TOKEN_FULL_TURN_COUNT, | |
| 415 | INPUT_TOKEN_POSITIONS, | |
| 416 | INPUT_TOKEN_WRAPS, | |
| 417 | INPUT_TOKEN_REMAP_TABLE, | |
| 418 | INPUT_TOKEN_INVERT, | |
| 419 | INPUT_TOKEN_UNUSED, | |
| 420 | INPUT_TOKEN_CUSTOM, | |
| 421 | INPUT_TOKEN_CHANGED, | |
| 422 | INPUT_TOKEN_DIPNAME, | |
| 423 | INPUT_TOKEN_DIPSETTING, | |
| 424 | INPUT_TOKEN_DIPLOCATION, | |
| 425 | INPUT_TOKEN_CONDITION, | |
| 426 | INPUT_TOKEN_ADJUSTER, | |
| 427 | INPUT_TOKEN_CONFNAME, | |
| 428 | INPUT_TOKEN_CONFSETTING, | |
| 429 | INPUT_TOKEN_CHAR, | |
| 430 | INPUT_TOKEN_CATEGORY, | |
| 431 | INPUT_TOKEN_CATEGORY_NAME, | |
| 432 | INPUT_TOKEN_CATEGORY_SETTING, | |
| 433 | INPUT_TOKEN_READ_LINE_DEVICE, | |
| 434 | INPUT_TOKEN_WRITE_LINE_DEVICE, | |
| 435 | }; | |
| 436 | ||
| 437 | ||
| 438 | 376 | /* default strings used in port definitions */ |
| 439 | 377 | enum |
| 440 | 378 | { |
| r11508 | r11509 | |
| 595 | 533 | |
| 596 | 534 | /* forward declarations */ |
| 597 | 535 | class input_port_config; |
| 598 | ||
| 536 | ||
| 599 | 537 | |
| 600 | 538 | |
| 601 | 539 | /* template specializations */ |
| 602 | 540 | typedef tagged_list<input_port_config> ioport_list; |
| 603 | 541 | |
| 604 | 542 | |
| 605 | /* custom input port callback function */ | |
| 606 | typedef UINT32 (*input_field_custom_func)(const input_field_config *field, void *param); | |
| 543 | /* read input port callback function */ | |
| 544 | typedef UINT32 (*input_field_read_func)(device_t &device, const input_field_config *field, void *param); | |
| 607 | 545 | |
| 608 | /* input port changed callback function */ | |
| 609 | typedef void (*input_field_changed_func)(const input_field_config *field, void *param, UINT32 oldval, UINT32 newval); | |
| 546 | /* input port write callback function */ | |
| 547 | typedef void (*input_field_write_func)(device_t &device, const input_field_config *field, void *param, UINT32 oldval, UINT32 newval); | |
| 610 | 548 | |
| 611 | 549 | /* crosshair mapping function */ |
| 612 | 550 | typedef float (*input_field_crossmap_func)(const input_field_config *field, float linear_value); |
| 613 | 551 | |
| 614 | 552 | |
| 615 | /* this type is used to encode input port definitions */ | |
| 616 | typedef union _input_port_token input_port_token; | |
| 617 | union _input_port_token | |
| 618 | { | |
| 619 | TOKEN_COMMON_FIELDS | |
| 620 | const input_port_token * tokenptr; | |
| 621 | input_field_custom_func customptr; | |
| 622 | input_field_changed_func changedptr; | |
| 623 | input_field_crossmap_func crossmapptr; | |
| 624 | read_line_device_func read_line_device; | |
| 625 | write_line_device_func write_line_device; | |
| 626 | }; | |
| 627 | ||
| 628 | ||
| 629 | 553 | /* encapsulates a condition on a port field or setting */ |
| 630 | 554 | typedef struct _input_condition input_condition; |
| 631 | 555 | struct _input_condition |
| r11508 | r11509 | |
| 638 | 562 | |
| 639 | 563 | |
| 640 | 564 | /* a single setting for a configuration or DIP switch */ |
| 641 | typedef struct _input_setting_config input_setting_config; | |
| 642 | struct _input_setting_config | |
| 565 | class input_setting_config | |
| 643 | 566 | { |
| 644 | const input_setting_config *next; /* pointer to next setting in sequence */ | |
| 645 | const input_field_config * field; /* pointer back to the field that owns us */ | |
| 567 | DISABLE_COPYING(input_setting_config); | |
| 568 | friend class simple_list<input_setting_config>; | |
| 569 | ||
| 570 | public: | |
| 571 | input_setting_config(input_field_config &field, input_port_value value, const char *name); | |
| 572 | input_setting_config *next() const { return m_next; } | |
| 573 | ||
| 646 | 574 | input_port_value value; /* value of the bits in this setting */ |
| 647 | 575 | input_condition condition; /* condition under which this setting is valid */ |
| 648 | 576 | const char * name; /* user-friendly name to display */ |
| 649 | 577 | UINT16 category; /* (MESS-specific) category */ |
| 578 | ||
| 579 | private: | |
| 580 | input_field_config & m_field; /* pointer back to the field that owns us */ | |
| 581 | input_setting_config * m_next; /* pointer to next setting in sequence */ | |
| 650 | 582 | }; |
| 651 | 583 | |
| 652 | 584 | |
| 653 | 585 | /* a mapping from a bit to a physical DIP switch description */ |
| 654 | typedef struct _input_field_diplocation input_field_diplocation; | |
| 655 | struct _input_field_diplocation | |
| 586 | class input_field_diplocation | |
| 656 | 587 | { |
| 657 | input_field_diplocation * next; /* pointer to the next bit */ | |
| 658 | const char * swname; /* name of the physical DIP switch */ | |
| 588 | DISABLE_COPYING(input_field_diplocation); | |
| 589 | friend class simple_list<input_field_diplocation>; | |
| 590 | ||
| 591 | public: | |
| 592 | input_field_diplocation(const char *string, UINT8 swnum, bool invert); | |
| 593 | input_field_diplocation *next() const { return m_next; } | |
| 594 | ||
| 595 | astring swname; /* name of the physical DIP switch */ | |
| 659 | 596 | UINT8 swnum; /* physical switch number */ |
| 660 | UINT8 invert; /* is this an active-high DIP? */ | |
| 597 | bool invert; /* is this an active-high DIP? */ | |
| 598 | ||
| 599 | private: | |
| 600 | input_field_diplocation * m_next; /* pointer to the next bit */ | |
| 661 | 601 | }; |
| 662 | 602 | |
| 663 | 603 | |
| 664 | 604 | /* a single bitfield within an input port */ |
| 665 | ||
| 605 | ||
| 666 | 606 | { |
| 607 | DISABLE_COPYING(input_field_config); | |
| 608 | friend class simple_list<input_field_config>; | |
| 609 | ||
| 610 | public: | |
| 611 | input_field_config(input_port_config &port, int type, input_port_value defvalue, input_port_value maskbits, const char *name = NULL); | |
| 612 | ||
| 613 | input_field_config *next() const { return m_next; } | |
| 614 | input_port_config &port() const { return m_port; } | |
| 615 | running_machine &machine() const; | |
| 616 | simple_list<input_setting_config> &settinglist() { return m_settinglist; } | |
| 617 | const simple_list<input_setting_config> &settinglist() const { return m_settinglist; } | |
| 618 | simple_list<input_field_diplocation> &diploclist() { return m_diploclist; } | |
| 619 | int modcount() const { return m_modcount; } | |
| 620 | ||
| 667 | 621 | /* generally-applicable data */ |
| 668 | const input_field_config * next; /* pointer to next field in sequence */ | |
| 669 | const input_port_config * port; /* pointer back to the port that owns us */ | |
| 670 | 622 | input_port_value mask; /* mask of bits belonging to the field */ |
| 671 | 623 | input_port_value defvalue; /* default value of these bits */ |
| 672 | 624 | input_condition condition; /* condition under which this field is relevant */ |
| r11508 | r11509 | |
| 677 | 629 | UINT8 impulse; /* number of frames before reverting to defvalue */ |
| 678 | 630 | const char * name; /* user-friendly name to display */ |
| 679 | 631 | input_seq seq[SEQ_TYPE_TOTAL];/* sequences of all types */ |
| 680 | read_line_device_func read_line_device; /* input device handler */ | |
| 681 | const char * read_device_name; /* input device name */ | |
| 682 | write_line_device_func write_line_device; /* output device handler */ | |
| 683 | const char * write_device_name; /* input device name */ | |
| 684 | input_field_custom_func custom; /* custom callback routine */ | |
| 685 | void * custom_param; /* parameter for custom callback routine */ | |
| 686 | input_field_changed_func changed; /* changed callback routine */ | |
| 687 | void * changed_param; /* parameter for changed callback routine */ | |
| 632 | input_field_read_func read; /* read callback routine */ | |
| 633 | void * read_param; /* parameter for read callback routine */ | |
| 634 | const char * read_device; /* parameter for read callback routine */ | |
| 635 | input_field_write_func write; /* write callback routine */ | |
| 636 | void * write_param; /* parameter for write callback routine */ | |
| 637 | const char * write_device; /* parameter for write callback routine */ | |
| 688 | 638 | |
| 689 | 639 | /* data relevant to analog control types */ |
| 690 | 640 | INT32 min; /* minimum value for absolute axes */ |
| r11508 | r11509 | |
| 701 | 651 | const input_port_value * remap_table; /* pointer to an array that remaps the port value */ |
| 702 | 652 | |
| 703 | 653 | /* data relevant to other specific types */ |
| 704 | const input_setting_config *settinglist; /* list of input_setting_configs */ | |
| 705 | const input_field_diplocation *diploclist; /* list of locations for various bits */ | |
| 706 | 654 | UINT8 way; /* digital joystick 2/4/8-way descriptions */ |
| 707 | 655 | unicode_char chars[3]; /* (MESS-specific) unicode key data */ |
| 708 | 656 | |
| 709 | 657 | /* this field is only valid if the device is live */ |
| 710 | 658 | input_field_state * state; /* live state of field (NULL if not live) */ |
| 659 | ||
| 660 | private: | |
| 661 | input_field_config * m_next; /* pointer to next field in sequence */ | |
| 662 | input_port_config & m_port; /* pointer back to the port that owns us */ | |
| 663 | int m_modcount; | |
| 664 | simple_list<input_setting_config> m_settinglist; /* list of input_setting_configs */ | |
| 665 | simple_list<input_field_diplocation> m_diploclist; /* list of locations for various bits */ | |
| 711 | 666 | }; |
| 712 | 667 | |
| 713 | 668 | |
| r11508 | r11509 | |
| 731 | 686 | input_port_value mask; /* mask to apply to the port */ |
| 732 | 687 | input_port_value defvalue; /* new default value */ |
| 733 | 688 | }; |
| 689 | ||
| 734 | 690 | /* a single input port configuration */ |
| 735 | 691 | class input_port_config |
| 736 | 692 | { |
| 737 | 693 | DISABLE_COPYING(input_port_config); |
| 694 | friend class simple_list<input_port_config>; | |
| 738 | 695 | |
| 739 | 696 | public: |
| 740 | input_port_config(const char *tag); | |
| 741 | ~input_port_config(); | |
| 697 | // construction/destruction | |
| 698 | input_port_config(device_t &owner, const char *tag); | |
| 742 | 699 | |
| 700 | // getters | |
| 743 | 701 | input_port_config *next() const { return m_next; } |
| 744 | running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } | |
| 745 | void set_machine(running_machine &machine) { m_machine = &machine; } | |
| 702 | device_t &owner() const { return m_owner; } | |
| 703 | running_machine &machine() const; | |
| 704 | input_field_config *first_field() const { return m_fieldlist.first(); } | |
| 705 | simple_list<input_field_config> &fieldlist() { return m_fieldlist; } | |
| 706 | const char *tag() const { return m_tag; } | |
| 707 | int modcount() const { return m_modcount; } | |
| 708 | ||
| 709 | void bump_modcount() { m_modcount++; } | |
| 710 | ||
| 711 | void collapse_fields(astring &errorbuf); | |
| 746 | 712 | |
| 747 | input_port_config * m_next; /* pointer to next port */ | |
| 748 | const char * tag; /* pointer to this port's tag */ | |
| 749 | const input_field_config * fieldlist; /* list of input_field_configs */ | |
| 750 | ||
| 751 | 713 | /* these fields are only valid if the port is live */ |
| 752 | 714 | input_port_state * state; /* live state of port (NULL if not live) */ |
| 753 | device_t * owner; /* associated device, when appropriate */ | |
| 754 | 715 | input_port_value active; /* mask of active bits in the port */ |
| 755 | 716 | |
| 756 | 717 | private: |
| 757 | running_machine * m_machine; /* machine if port is live */ | |
| 718 | input_port_config * m_next; /* pointer to next port */ | |
| 719 | device_t & m_owner; /* associated device, when appropriate */ | |
| 720 | simple_list<input_field_config> m_fieldlist; /* list of input_field_configs */ | |
| 721 | astring m_tag; /* pointer to this port's tag */ | |
| 722 | int m_modcount; | |
| 758 | 723 | }; |
| 759 | 724 | |
| 760 | 725 | |
| r11508 | r11509 | |
| 791 | 756 | MACROS |
| 792 | 757 | ***************************************************************************/ |
| 793 | 758 | |
| 794 | /* macro for a custom callback functions (PORT_CUSTOM) */ | |
| 795 | #define CUSTOM_INPUT(name) UINT32 name(const input_field_config *field, void *param) | |
| 759 | /* macro for a read callback function (PORT_CUSTOM) */ | |
| 760 | #define CUSTOM_INPUT(name) input_port_value name(device_t &device, const input_field_config *field, void *param) | |
| 796 | 761 | |
| 797 | /* macro for port changed callback functions (PORT_CHANGED) */ | |
| 798 | #define INPUT_CHANGED(name) void name(const input_field_config *field, void *param, UINT32 oldval, UINT32 newval) | |
| 762 | /* macro for port write callback functions (PORT_CHANGED) */ | |
| 763 | #define INPUT_CHANGED(name) void name(device_t &device, const input_field_config *field, void *param, input_port_value oldval, input_port_value newval) | |
| 799 | 764 | |
| 800 | 765 | /* macro for port changed callback functions (PORT_CROSSHAIR_MAPPER) */ |
| 801 | 766 | #define CROSSHAIR_MAPPER(name) float name(const input_field_config *field, float linear_value) |
| r11508 | r11509 | |
| 804 | 769 | #define DEF_STR(str_num) ((const char *)INPUT_STRING_##str_num) |
| 805 | 770 | |
| 806 | 771 | |
| 772 | template<int (*_ReadLine)(device_t *)> | |
| 773 | input_port_value ioport_read_line_wrapper(device_t &device, const input_field_config *field, void *param) | |
| 774 | { | |
| 775 | return (*_ReadLine)(&device); | |
| 776 | } | |
| 807 | 777 | |
| 778 | template<void (*_WriteLine)(device_t *, int)> | |
| 779 | void ioport_write_line_wrapper(device_t &device, const input_field_config *field, void *param, input_port_value oldval, input_port_value newval) | |
| 780 | { | |
| 781 | return (*_WriteLine)(&device, newval); | |
| 782 | } | |
| 783 | ||
| 784 | ||
| 785 | ||
| 808 | 786 | /*************************************************************************** |
| 809 | 787 | MACROS FOR BUILDING INPUT PORTS |
| 810 | 788 | ***************************************************************************/ |
| 811 | 789 | |
| 790 | typedef void (*ioport_constructor)(device_t &owner, ioport_list &portlist, astring &errorbuf); | |
| 791 | ||
| 812 | 792 | /* so that "0" can be used for unneeded input ports */ |
| 813 | #define ipt_0 NULL | |
| 793 | #define construct_ioport_0 NULL | |
| 814 | 794 | |
| 815 | 795 | /* name of table */ |
| 816 | #define INPUT_PORTS_NAME(_name) ipt_##_name | |
| 796 | #define INPUT_PORTS_NAME(_name) construct_ioport_##_name | |
| 817 | 797 | |
| 818 | 798 | /* start of table */ |
| 819 | 799 | #define INPUT_PORTS_START(_name) \ |
| 820 | const input_port_token INPUT_PORTS_NAME(_name)[] = { | |
| 800 | void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, astring &errorbuf) \ | |
| 801 | { \ | |
| 802 | astring fulltag; \ | |
| 803 | input_setting_config *cursetting = NULL; \ | |
| 804 | input_field_config *curfield = NULL; \ | |
| 805 | input_port_config *curport = NULL; \ | |
| 806 | input_port_value maskbits = 0; \ | |
| 807 | (void)cursetting; (void)curfield; (void)curport; (void)maskbits; \ | |
| 821 | 808 | |
| 822 | 809 | /* end of table */ |
| 823 | 810 | #define INPUT_PORTS_END \ |
| 824 | ||
| 811 | ||
| 825 | 812 | |
| 826 | 813 | /* aliasing */ |
| 827 | 814 | #define INPUT_PORTS_EXTERN(_name) \ |
| 828 | extern | |
| 815 | extern vo | |
| 829 | 816 | |
| 830 | 817 | /* including */ |
| 831 | 818 | #define PORT_INCLUDE(_name) \ |
| 832 | TOKEN_UINT32_PACK1(INPUT_TOKEN_INCLUDE, 8), \ | |
| 833 | TOKEN_PTR(tokenptr, &INPUT_PORTS_NAME(_name)[0]), | |
| 819 | INPUT_PORTS_NAME(_name)(owner, portlist, errorbuf); \ | |
| 834 | 820 | |
| 835 | 821 | /* start of a new input port (with included tag) */ |
| 836 | 822 | #define PORT_START(_tag) \ |
| 837 | TOKEN_UINT32_PACK1(INPUT_TOKEN_START, 8), \ | |
| 838 | TOKEN_STRING(_tag), | |
| 823 | curport = ioconfig_alloc_port(portlist, owner, _tag); \ | |
| 824 | curfield = NULL; \ | |
| 825 | cursetting = NULL; \ | |
| 826 | maskbits = 0; \ | |
| 839 | 827 | |
| 840 | 828 | /* modify an existing port */ |
| 841 | 829 | #define PORT_MODIFY(_tag) \ |
| 842 | TOKEN_UINT32_PACK1(INPUT_TOKEN_MODIFY, 8), \ | |
| 843 | TOKEN_STRING(_tag), | |
| 830 | curport = ioconfig_modify_port(portlist, owner, _tag); \ | |
| 831 | curfield = NULL; \ | |
| 832 | cursetting = NULL; \ | |
| 833 | maskbits = 0; \ | |
| 844 | 834 | |
| 845 | 835 | /* input bit definition */ |
| 846 | 836 | #define PORT_BIT(_mask, _default, _type) \ |
| 847 | TOKEN_UINT32_PACK2(INPUT_TOKEN_FIELD, 8, _type, 24), \ | |
| 848 | TOKEN_UINT64_PACK2(_mask, 32, _default, 32), | |
| 837 | curfield = ioconfig_alloc_field(*curport, (_type), (_default), (_mask)); \ | |
| 838 | cursetting = NULL; | |
| 849 | 839 | |
| 850 | #define PORT_SPECIAL_ONOFF(_mask, _default, _strindex) \ | |
| 851 | TOKEN_UINT32_PACK3(INPUT_TOKEN_SPECIAL_ONOFF, 8, FALSE, 1, INPUT_STRING_##_strindex, 23), \ | |
| 852 | TOKEN_UINT64_PACK2(_mask, 32, _default, 32), | |
| 840 | #define PORT_SPECIAL_ONOFF(_mask, _default, _strindex) PORT_SPECIAL_ONOFF_DIPLOC(_mask, _default, _strindex, NULL) | |
| 853 | 841 | |
| 854 | 842 | #define PORT_SPECIAL_ONOFF_DIPLOC(_mask, _default, _strindex, _diploc) \ |
| 855 | TOKEN_UINT32_PACK3(INPUT_TOKEN_SPECIAL_ONOFF, 8, TRUE, 1, INPUT_STRING_##_strindex, 23), \ | |
| 856 | TOKEN_UINT64_PACK2(_mask, 32, _default, 32), \ | |
| 857 | TOKEN_STRING(_diploc), | |
| 843 | curfield = ioconfig_alloc_onoff(*curport, DEF_STR(_strindex), _default, _mask, _diploc, errorbuf); \ | |
| 844 | cursetting = NULL; | |
| 858 | 845 | |
| 859 | 846 | /* append a code */ |
| 860 | 847 | #define PORT_CODE(_code) \ |
| 861 | | |
| 848 | ioconfig_add | |
| 862 | 849 | |
| 863 | 850 | #define PORT_CODE_DEC(_code) \ |
| 864 | | |
| 851 | ioconfig_add | |
| 865 | 852 | |
| 866 | 853 | #define PORT_CODE_INC(_code) \ |
| 867 | | |
| 854 | ioconfig_add | |
| 868 | 855 | |
| 869 | 856 | /* joystick flags */ |
| 870 | 857 | #define PORT_2WAY \ |
| 871 | | |
| 858 | curfield->way | |
| 872 | 859 | |
| 873 | 860 | #define PORT_4WAY \ |
| 874 | | |
| 861 | curfield->way | |
| 875 | 862 | |
| 876 | 863 | #define PORT_8WAY \ |
| 877 | | |
| 864 | curfield->way | |
| 878 | 865 | |
| 879 | 866 | #define PORT_16WAY \ |
| 880 | | |
| 867 | curfield->way = | |
| 881 | 868 | |
| 882 | 869 | #define PORT_ROTATED \ |
| 883 | | |
| 870 | curfield->flags |= FIELD_FL | |
| 884 | 871 | |
| 885 | 872 | /* general flags */ |
| 886 | 873 | #define PORT_NAME(_name) \ |
| 887 | TOKEN_UINT32_PACK1(INPUT_TOKEN_NAME, 8), \ | |
| 888 | TOKEN_STRING(_name), | |
| 874 | curfield->name = input_port_string_from_token(_name); | |
| 889 | 875 | |
| 890 | #define PORT_PLAYER(player_) \ | |
| 891 | TOKEN_UINT32_PACK1(INPUT_TOKEN_PLAYER1 + (((player_) - 1) % MAX_PLAYERS), 8), | |
| 876 | #define PORT_PLAYER(_player) \ | |
| 877 | curfield->player = (_player) - 1; | |
| 892 | 878 | |
| 893 | 879 | #define PORT_COCKTAIL \ |
| 894 | TOKEN_UINT32_PACK1(INPUT_TOKEN_COCKTAIL, 8), | |
| 880 | curfield->flags |= FIELD_FLAG_COCKTAIL; \ | |
| 881 | curfield->player = 1; | |
| 895 | 882 | |
| 896 | 883 | #define PORT_TOGGLE \ |
| 897 | | |
| 884 | curfield->flags |= FIELD_FL | |
| 898 | 885 | |
| 899 | 886 | #define PORT_IMPULSE(_duration) \ |
| 900 | | |
| 887 | curfield->impulse | |
| 901 | 888 | |
| 902 | 889 | #define PORT_REVERSE \ |
| 903 | | |
| 890 | curfield->flags |= A | |
| 904 | 891 | |
| 905 | 892 | #define PORT_RESET \ |
| 906 | | |
| 893 | curfield->flags |= A | |
| 907 | 894 | |
| 908 | 895 | #define PORT_UNUSED \ |
| 909 | | |
| 896 | curfield->flags |= FIELD_FL | |
| 910 | 897 | |
| 911 | 898 | /* analog settings */ |
| 912 | 899 | /* if this macro is not used, the minimum defaluts to 0 and maximum defaults to the mask value */ |
| 913 | 900 | #define PORT_MINMAX(_min, _max) \ |
| 914 | TOKEN_UINT32_PACK1(INPUT_TOKEN_MINMAX, 8), \ | |
| 915 | TOKEN_UINT64_PACK2(_min, 32, _max, 32), | |
| 901 | curfield->min = _min; \ | |
| 902 | curfield->max = _max; | |
| 916 | 903 | |
| 917 | 904 | #define PORT_SENSITIVITY(_sensitivity) \ |
| 918 | | |
| 905 | curfield->sensitivity | |
| 919 | 906 | |
| 920 | 907 | #define PORT_KEYDELTA(_delta) \ |
| 921 | | |
| 908 | curfield->delta | |
| 922 | 909 | |
| 923 | 910 | /* note that PORT_CENTERDELTA must appear after PORT_KEYDELTA */ |
| 924 | 911 | #define PORT_CENTERDELTA(_delta) \ |
| 925 | | |
| 912 | curfield->delta | |
| 926 | 913 | |
| 927 | 914 | #define PORT_CROSSHAIR(axis, scale, offset, altaxis) \ |
| 928 | TOKEN_UINT32_PACK3(INPUT_TOKEN_CROSSHAIR, 8, CROSSHAIR_AXIS_##axis, 4, (INT32)((altaxis) * 65536.0f), 20), \ | |
| 929 | TOKEN_UINT64_PACK2((INT32)((scale) * 65536.0f), 32, (INT32)((offset) * 65536.0f), 32), | |
| 915 | curfield->crossaxis = CROSSHAIR_AXIS_##axis; \ | |
| 916 | curfield->crossaltaxis = altaxis; \ | |
| 917 | curfield->crossscale = scale; \ | |
| 918 | curfield->crossoffset = offset; | |
| 930 | 919 | |
| 931 | 920 | #define PORT_CROSSHAIR_MAPPER(_callback) \ |
| 932 | TOKEN_UINT32_PACK1(INPUT_TOKEN_CROSSHAIR_MAPPER, 8), \ | |
| 933 | TOKEN_PTR(crossmapptr, _callback), | |
| 921 | curfield->crossmapper = _callback; | |
| 934 | 922 | |
| 935 | 923 | /* how many optical counts for 1 full turn of the control */ |
| 936 | 924 | #define PORT_FULL_TURN_COUNT(_count) \ |
| 937 | | |
| 925 | curfield->full_turn | |
| 938 | 926 | |
| 939 | 927 | /* positional controls can be binary or 1 of X */ |
| 940 | 928 | /* 1 of X not completed yet */ |
| 941 | 929 | /* if it is specified as PORT_REMAP_TABLE then it is binary, but remapped */ |
| 942 | 930 | /* otherwise it is binary */ |
| 943 | 931 | #define PORT_POSITIONS(_positions) \ |
| 944 | | |
| 932 | curfield->max | |
| 945 | 933 | |
| 946 | 934 | /* positional control wraps at min/max */ |
| 947 | 935 | #define PORT_WRAPS \ |
| 948 | | |
| 936 | curfield->flags |= A | |
| 949 | 937 | |
| 950 | 938 | /* positional control uses this remap table */ |
| 951 | 939 | #define PORT_REMAP_TABLE(_table) \ |
| 952 | TOKEN_UINT32_PACK1(INPUT_TOKEN_REMAP_TABLE, 8), \ | |
| 953 | TOKEN_PTR(ui32ptr, _table), | |
| 940 | curfield->remap_table = _table; | |
| 954 | 941 | |
| 955 | 942 | /* positional control bits are active low */ |
| 956 | 943 | #define PORT_INVERT \ |
| 957 | | |
| 944 | curfield->flags |= A | |
| 958 | 945 | |
| 959 | /* | |
| 946 | /* read | |
| 960 | 947 | #define PORT_CUSTOM(_callback, _param) \ |
| 961 | TOKEN_UINT32_PACK1(INPUT_TOKEN_CUSTOM, 8), \ | |
| 962 | TOKEN_PTR(customptr, _callback), \ | |
| 963 | TOKEN_PTR(voidptr, _param), | |
| 948 | curfield->read = _callback; \ | |
| 949 | curfield->read_param = (void *)(_param); \ | |
| 950 | curfield->read_device = NULL; | |
| 964 | 951 | |
| 965 | /* | |
| 952 | /* writ | |
| 966 | 953 | #define PORT_CHANGED(_callback, _param) \ |
| 967 | TOKEN_UINT32_PACK1(INPUT_TOKEN_CHANGED, 8), \ | |
| 968 | TOKEN_PTR(changedptr, _callback), \ | |
| 969 | TOKEN_PTR(voidptr, _param), | |
| 954 | curfield->write = _callback; \ | |
| 955 | curfield->write_param = (void *)(_param); \ | |
| 956 | curfield->write_device = NULL; | |
| 970 | 957 | |
| 971 | 958 | /* input device handler */ |
| 972 | 959 | #define PORT_READ_LINE_DEVICE(_device, _read_line_device) \ |
| 973 | TOKEN_UINT32_PACK1(INPUT_TOKEN_READ_LINE_DEVICE, 8), \ | |
| 974 | TOKEN_STRING(_device), \ | |
| 975 | TOKEN_PTR(read_line_device, _read_line_device), | |
| 960 | curfield->read = &ioport_read_line_wrapper<_read_line_device>; \ | |
| 961 | curfield->read_param = NULL; \ | |
| 962 | curfield->read_device = _device; | |
| 976 | 963 | |
| 977 | 964 | /* output device handler */ |
| 978 | 965 | #define PORT_WRITE_LINE_DEVICE(_device, _write_line_device) \ |
| 979 | TOKEN_UINT32_PACK1(INPUT_TOKEN_WRITE_LINE_DEVICE, 8), \ | |
| 980 | TOKEN_STRING(_device), \ | |
| 981 | TOKEN_PTR(write_line_device, _write_line_device), | |
| 966 | curfield->write = &ioport_write_line_wrapper<_write_line_device>; \ | |
| 967 | curfield->write_param = NULL; \ | |
| 968 | curfield->write_device = _device; | |
| 982 | 969 | |
| 983 | 970 | /* dip switch definition */ |
| 984 | 971 | #define PORT_DIPNAME(_mask, _default, _name) \ |
| 985 | TOKEN_UINT32_PACK1(INPUT_TOKEN_DIPNAME, 8), \ | |
| 986 | TOKEN_UINT64_PACK2(_mask, 32, _default, 32), \ | |
| 987 | TOKEN_STRING(_name), | |
| 972 | curfield = ioconfig_alloc_field(*curport, IPT_DIPSWITCH, (_default), (_mask), (_name)); \ | |
| 973 | cursetting = NULL; | |
| 988 | 974 | |
| 989 | 975 | #define PORT_DIPSETTING(_default, _name) \ |
| 990 | TOKEN_UINT64_PACK2(INPUT_TOKEN_DIPSETTING, 8, _default, 32), \ | |
| 991 | TOKEN_STRING(_name), | |
| 976 | cursetting = ioconfig_alloc_setting(*curfield, (_default) & curfield->mask, (_name)); | |
| 992 | 977 | |
| 993 | 978 | /* physical location, of the form: name:[!]sw,[name:][!]sw,... */ |
| 994 | 979 | /* note that these are specified LSB-first */ |
| 995 | 980 | #define PORT_DIPLOCATION(_location) \ |
| 996 | TOKEN_UINT32_PACK1(INPUT_TOKEN_DIPLOCATION, 8), \ | |
| 997 | TOKEN_STRING(_location), | |
| 981 | diplocation_list_alloc(*curfield, _location, errorbuf); | |
| 998 | 982 | |
| 999 | 983 | /* conditionals for dip switch settings */ |
| 1000 | 984 | #define PORT_CONDITION(_tag, _mask, _condition, _value) \ |
| 1001 | TOKEN_UINT32_PACK2(INPUT_TOKEN_CONDITION, 8, _condition, 24), \ | |
| 1002 | TOKEN_UINT64_PACK2(_mask, 32, _value, 32), \ | |
| 1003 | TOKEN_STRING(_tag), | |
| 985 | { \ | |
| 986 | input_condition &condition = (cursetting != NULL) ? cursetting->condition : curfield->condition; \ | |
| 987 | condition.tag = (_tag); \ | |
| 988 | condition.mask = (_mask); \ | |
| 989 | condition.condition = (_condition); \ | |
| 990 | condition.value = (_value); \ | |
| 991 | } | |
| 1004 | 992 | |
| 1005 | 993 | /* analog adjuster definition */ |
| 1006 | 994 | #define PORT_ADJUSTER(_default, _name) \ |
| 1007 | TOKEN_UINT64_PACK2(INPUT_TOKEN_ADJUSTER, 8, _default, 32), \ | |
| 1008 | TOKEN_STRING(_name), | |
| 995 | curfield = ioconfig_alloc_field(*curport, IPT_ADJUSTER, (_default), 0xff, (_name)); \ | |
| 996 | cursetting = NULL; \ | |
| 1009 | 997 | |
| 1010 | 998 | /* config definition */ |
| 1011 | 999 | #define PORT_CONFNAME(_mask, _default, _name) \ |
| 1012 | TOKEN_UINT32_PACK1(INPUT_TOKEN_CONFNAME, 8), \ | |
| 1013 | TOKEN_UINT64_PACK2(_mask, 32, _default, 32), \ | |
| 1014 | TOKEN_STRING(_name), | |
| 1000 | curfield = ioconfig_alloc_field(*curport, IPT_CONFIG, (_default), (_mask), (_name)); \ | |
| 1001 | cursetting = NULL; \ | |
| 1015 | 1002 | |
| 1016 | 1003 | #define PORT_CONFSETTING(_default, _name) \ |
| 1017 | TOKEN_UINT64_PACK2(INPUT_TOKEN_CONFSETTING, 8, _default, 32), \ | |
| 1018 | TOKEN_STRING(_name), | |
| 1004 | cursetting = ioconfig_alloc_setting(*curfield, (_default) & curfield->mask, (_name)); | |
| 1019 | 1005 | |
| 1020 | 1006 | /* keyboard chars */ |
| 1021 | 1007 | #define PORT_CHAR(_ch) \ |
| 1022 | | |
| 1008 | ioconfig_field | |
| 1023 | 1009 | |
| 1024 | 1010 | /* categories */ |
| 1025 | 1011 | #define PORT_CATEGORY(_category) \ |
| 1026 | | |
| 1012 | curfield->category | |
| 1027 | 1013 | |
| 1028 | 1014 | #define PORT_CATEGORY_CLASS(_mask, _default, _name) \ |
| 1029 | TOKEN_UINT32_PACK1(INPUT_TOKEN_CATEGORY_NAME, 8), \ | |
| 1030 | TOKEN_UINT64_PACK2(_mask, 32, _default, 32), \ | |
| 1031 | TOKEN_STRING(_name), | |
| 1015 | curfield = ioconfig_alloc_field(*curport, IPT_CATEGORY, (_default), (_mask), (_name)); \ | |
| 1016 | cursetting = NULL; | |
| 1032 | 1017 | |
| 1033 | 1018 | #define PORT_CATEGORY_ITEM(_default, _name, _category) \ |
| 1034 | TOKEN_UINT64_PACK3(INPUT_TOKEN_CATEGORY_SETTING, 8, _default, 32, _category, 16), \ | |
| 1035 | TOKEN_STRING(_name), | |
| 1019 | cursetting = ioconfig_alloc_setting(*curfield, (_default) & curfield->mask, (_name)); \ | |
| 1020 | cursetting->category = (_category); | |
| 1036 | 1021 | |
| 1037 | 1022 | |
| 1038 | 1023 | /* name of table */ |
| r11508 | r11509 | |
| 1085 | 1070 | /* ----- core system management ----- */ |
| 1086 | 1071 | |
| 1087 | 1072 | /* initialize the input ports, processing the given token list */ |
| 1088 | time_t input_port_init(running_machine &machine | |
| 1073 | time_t input_port_init(running_machine &machine | |
| 1089 | 1074 | |
| 1090 | 1075 | |
| 1091 | 1076 | |
| 1092 | 1077 | /* ----- port configurations ----- */ |
| 1093 | 1078 | |
| 1094 | 1079 | /* initialize an input port list structure and allocate ports according to the given tokens */ |
| 1095 | void input_port_list_init(ioport_list &portlist, | |
| 1080 | void input_port_list_init(device_t &device, ioport_list &portlist, a | |
| 1096 | 1081 | |
| 1097 | 1082 | /* return the field that matches the given tag and mask */ |
| 1098 | 1083 | const input_field_config *input_field_by_tag_and_mask(const ioport_list &portlist, const char *tag, input_port_value mask); |
| r11508 | r11509 | |
| 1207 | 1192 | int input_condition_true(running_machine &machine, const input_condition *condition); |
| 1208 | 1193 | |
| 1209 | 1194 | /* convert an input_port_token to a default string */ |
| 1210 | const char *input_port_string_from_token(const | |
| 1195 | const char *input_port_string_from_token(const cha | |
| 1211 | 1196 | |
| 1212 | 1197 | /* return TRUE if machine use full keyboard emulation */ |
| 1213 | 1198 | int input_machine_has_keyboard(running_machine &machine); |
| r11508 | r11509 | |
| 1240 | 1225 | int input_count_players(running_machine &machine); |
| 1241 | 1226 | int input_category_active(running_machine &machine, int category); |
| 1242 | 1227 | |
| 1228 | ||
| 1229 | inline running_machine &input_field_config::machine() const | |
| 1230 | { | |
| 1231 | return m_port.machine(); | |
| 1232 | } | |
| 1233 | ||
| 1234 | ||
| 1235 | // temporary construction helpers | |
| 1236 | void field_config_insert(input_field_config &newfield, input_port_value &disallowedbits, astring &errorbuf); | |
| 1237 | void diplocation_list_alloc(input_field_config &field, const char *location, astring &errorbuf); | |
| 1238 | ||
| 1239 | ||
| 1240 | input_port_config *ioconfig_alloc_port(ioport_list &portlist, device_t &device, const char *tag); | |
| 1241 | input_port_config *ioconfig_modify_port(ioport_list &portlist, device_t &device, const char *tag); | |
| 1242 | input_field_config *ioconfig_alloc_field(input_port_config &port, int type, input_port_value defval, input_port_value mask, const char *name = NULL); | |
| 1243 | input_field_config *ioconfig_alloc_onoff(input_port_config &port, const char *name, input_port_value defval, input_port_value mask, const char *diplocation, astring &errorbuf); | |
| 1244 | input_setting_config *ioconfig_alloc_setting(input_field_config &field, input_port_value value, const char *name); | |
| 1245 | void ioconfig_field_add_char(input_field_config &field, unicode_char ch, astring &errorbuf); | |
| 1246 | void ioconfig_add_code(input_field_config &field, int which, input_code code); | |
| 1247 | ||
| 1243 | 1248 | #endif /* __INPTPORT_H__ */ |
| r11508 | r11509 | |
|---|---|---|
| 93 | 93 | struct rom_entry; |
| 94 | 94 | class machine_config; |
| 95 | 95 | class emu_timer; |
| 96 | typedef union _input_port_token input_port_token; | |
| 97 | 96 | typedef struct _input_device_default input_device_default; |
| 98 | 97 | |
| 99 | 98 | |
| r11508 | r11509 | |
| 207 | 206 | const input_device_default *input_ports_defaults() const { return m_input_defaults; } |
| 208 | 207 | const rom_entry *rom_region() const { return device_rom_region(); } |
| 209 | 208 | machine_config_constructor machine_config_additions() const { return device_mconfig_additions(); } |
| 210 | const | |
| 209 | ioport_constr | |
| 211 | 210 | |
| 212 | 211 | // iteration helpers |
| 213 | 212 | device_t *next() const { return m_next; } |
| r11508 | r11509 | |
| 296 | 295 | // device-level overrides |
| 297 | 296 | virtual const rom_entry *device_rom_region() const; |
| 298 | 297 | virtual machine_config_constructor device_mconfig_additions() const; |
| 299 | virtual const | |
| 298 | virtual ioport_constr | |
| 300 | 299 | virtual void device_config_complete(); |
| 301 | 300 | virtual bool device_validity_check(emu_options &options, const game_driver &driver) const; |
| 302 | 301 | virtual void device_start() = 0; |
| r11508 | r11509 | |
|---|---|---|
| 64 | 64 | #include "attotime.h" |
| 65 | 65 | #include "hash.h" |
| 66 | 66 | #include "fileio.h" // remove me once NVRAM is implemented as device |
| 67 | #include "tokenize.h" | |
| 68 | 67 | #include "delegate.h" |
| 69 | 68 | |
| 70 | 69 | // memory and address spaces |
| r11508 | r11509 | |
| 80 | 79 | class machine_config; |
| 81 | 80 | typedef device_t * (*machine_config_constructor)(machine_config &config, device_t *owner); |
| 82 | 81 | |
| 82 | // I/O | |
| 83 | #include "input.h" | |
| 84 | #include "inputseq.h" | |
| 85 | #include "inptport.h" | |
| 86 | #include "output.h" | |
| 87 | ||
| 83 | 88 | // devices and callbacks |
| 84 | 89 | #include "devintrf.h" |
| 85 | 90 | #include "distate.h" |
| r11508 | r11509 | |
| 95 | 100 | #include "schedule.h" |
| 96 | 101 | #include "timer.h" |
| 97 | 102 | |
| 98 | // I/O | |
| 99 | #include "input.h" | |
| 100 | #include "inputseq.h" | |
| 101 | #include "inptport.h" | |
| 102 | #include "output.h" | |
| 103 | ||
| 104 | 103 | // timers, CPU and scheduling |
| 105 | 104 | #include "devcpu.h" |
| 106 | 105 | #include "watchdog.h" |
| r11508 | r11509 | |
|---|---|---|
| 279 | 279 | // initialize the input system and input ports for the game |
| 280 | 280 | // this must be done before memory_init in order to allow specifying |
| 281 | 281 | // callbacks based on input port tags |
| 282 | time_t newbase = input_port_init(*this | |
| 282 | time_t newbase = input_port_init(*this | |
| 283 | 283 | if (newbase != 0) |
| 284 | 284 | m_base_time = newbase; |
| 285 | 285 | |
| r11508 | r11509 | |
| 1145 | 1145 | // game's input ports |
| 1146 | 1146 | //------------------------------------------------- |
| 1147 | 1147 | |
| 1148 | const | |
| 1148 | ioport_constr | |
| 1149 | 1149 | { |
| 1150 | 1150 | return m_system->ipt; |
| 1151 | 1151 | } |
| r11508 | r11509 | |
|---|---|---|
| 576 | 576 | |
| 577 | 577 | // device-level overrides |
| 578 | 578 | virtual const rom_entry *device_rom_region() const; |
| 579 | virtual const | |
| 579 | virtual ioport_constr | |
| 580 | 580 | virtual void device_start(); |
| 581 | 581 | virtual void device_reset(); |
| 582 | 582 |
| r11508 | r11509 | |
|---|---|---|
| 1595 | 1595 | |
| 1596 | 1596 | static slider_state *slider_init(running_machine &machine) |
| 1597 | 1597 | { |
| 1598 | const input_field_config *field; | |
| 1599 | const input_port_config *port; | |
| 1598 | input_field_config *field; | |
| 1599 | input_port_config *port; | |
| 1600 | 1600 | device_t *device; |
| 1601 | 1601 | slider_state *listhead = NULL; |
| 1602 | 1602 | slider_state **tailptr = &listhead; |
| r11508 | r11509 | |
| 1625 | 1625 | |
| 1626 | 1626 | /* add analog adjusters */ |
| 1627 | 1627 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 1628 | for (field = port->fieldlist; field != NULL; field = field->next) | |
| 1628 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 1629 | 1629 | if (field->type == IPT_ADJUSTER) |
| 1630 | 1630 | { |
| 1631 | 1631 | void *param = (void *)field; |
| r11508 | r11509 | |
| 1730 | 1730 | #ifdef MAME_DEBUG |
| 1731 | 1731 | /* add crosshair adjusters */ |
| 1732 | 1732 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 1733 | for (field = port->fieldlist; field != NULL; field = field->next) | |
| 1733 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 1734 | 1734 | if (field->crossaxis != CROSSHAIR_AXIS_NONE && field->player == 0) |
| 1735 | 1735 | { |
| 1736 | 1736 | void *param = (void *)field; |
| r11508 | r11509 | |
|---|---|---|
| 220 | 220 | global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT; |
| 221 | 221 | |
| 222 | 222 | /* determine who needs crosshairs */ |
| 223 | for (const input_port_config *port = machine.m_portlist.first(); port != NULL; port = port->next()) | |
| 224 | for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next) | |
| 223 | for (input_port_config *port = machine.m_portlist.first(); port != NULL; port = port->next()) | |
| 224 | for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 225 | 225 | if (field->crossaxis != CROSSHAIR_AXIS_NONE) |
| 226 | 226 | { |
| 227 | 227 | int player = field->player; |
| r11508 | r11509 | |
|---|---|---|
| 141 | 141 | return prepend(object); |
| 142 | 142 | object.m_next = insert_after->m_next; |
| 143 | 143 | insert_after->m_next = &object; |
| 144 | if (m_tail == insert_after) | |
| 145 | m_tail = &object; | |
| 144 | 146 | m_count++; |
| 145 | 147 | return object; |
| 146 | 148 | } |
| 147 | 149 | |
| 150 | // insert the given object before a particular object (NULL means append) | |
| 151 | _ElementType &insert_before(_ElementType &object, _ElementType *insert_before) | |
| 152 | { | |
| 153 | if (insert_before == NULL) | |
| 154 | return append(object); | |
| 155 | for (_ElementType **curptr = &m_head; *curptr != NULL; curptr = &(*curptr)->m_next) | |
| 156 | if (*curptr == insert_before) | |
| 157 | { | |
| 158 | object.m_next = insert_before; | |
| 159 | *curptr = &object; | |
| 160 | if (m_head == insert_before) | |
| 161 | m_head = &object; | |
| 162 | m_count++; | |
| 163 | return object; | |
| 164 | } | |
| 165 | return object; | |
| 166 | } | |
| 167 | ||
| 148 | 168 | // replace an item in the list at the same location, and remove it |
| 149 | 169 | _ElementType &replace_and_remove(_ElementType &object, _ElementType &toreplace) |
| 150 | 170 | { |
| r11508 | r11509 | |
|---|---|---|
| 390 | 390 | device_nvram_func nvram; // DEVINFO_FCT_NVRAM |
| 391 | 391 | const rom_entry * romregion; // DEVINFO_PTR_ROM_REGION |
| 392 | 392 | machine_config_constructor machine_config; // DEVINFO_PTR_MACHINE_CONFIG |
| 393 | const | |
| 393 | ioport_constr | |
| 394 | 394 | address_map_constructor internal_map8; // DEVINFO_PTR_INTERNAL_MEMORY_MAP |
| 395 | 395 | address_map_constructor internal_map16; // DEVINFO_PTR_INTERNAL_MEMORY_MAP |
| 396 | 396 | address_map_constructor internal_map32; // DEVINFO_PTR_INTERNAL_MEMORY_MAP |
| r11508 | r11509 | |
| 428 | 428 | // device-level overrides |
| 429 | 429 | virtual const rom_entry *device_rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_ptr(DEVINFO_PTR_ROM_REGION)); } |
| 430 | 430 | virtual machine_config_constructor device_mconfig_additions() const { return reinterpret_cast<machine_config_constructor>(get_legacy_ptr(DEVINFO_PTR_MACHINE_CONFIG)); } |
| 431 | virtual const | |
| 431 | virtual ioport_constr | |
| 432 | 432 | virtual bool device_validity_check(emu_options &options, const game_driver &driver) const; |
| 433 | 433 | virtual void device_start(); |
| 434 | 434 | virtual void device_reset(); |
| r11508 | r11509 | |
|---|---|---|
| 75 | 75 | |
| 76 | 76 | INLINE const char *input_port_string_from_index(UINT32 index) |
| 77 | 77 | { |
| 78 | input_port_token token; | |
| 79 | token.i = index; | |
| 80 | return input_port_string_from_token(token); | |
| 78 | return input_port_string_from_token((const char *)index); | |
| 81 | 79 | } |
| 82 | 80 | |
| 83 | 81 | |
| r11508 | r11509 | |
| 741 | 739 | analog input field |
| 742 | 740 | -------------------------------------------------*/ |
| 743 | 741 | |
| 744 | static void validate_analog_input_field( | |
| 742 | static void validate_analog_input_field( | |
| 745 | 743 | { |
| 746 | 744 | INT32 analog_max = field->max; |
| 747 | 745 | INT32 analog_min = field->min; |
| r11508 | r11509 | |
| 850 | 848 | setting |
| 851 | 849 | -------------------------------------------------*/ |
| 852 | 850 | |
| 853 | static void validate_dip_settings( | |
| 851 | static void validate_dip_settings( | |
| 854 | 852 | { |
| 855 | 853 | const char *demo_sounds = input_port_string_from_index(INPUT_STRING_Demo_Sounds); |
| 856 | 854 | const char *flipscreen = input_port_string_from_index(INPUT_STRING_Flip_Screen); |
| r11508 | r11509 | |
| 859 | 857 | int coin_error = FALSE; |
| 860 | 858 | |
| 861 | 859 | /* iterate through the settings */ |
| 862 | for (setting = field->settinglist; setting != NULL; setting = setting->next) | |
| 860 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) | |
| 863 | 861 | { |
| 864 | 862 | int strindex = get_defstr_index(defstr_map, setting->name, driver, error); |
| 865 | 863 | |
| r11508 | r11509 | |
| 889 | 887 | } |
| 890 | 888 | |
| 891 | 889 | /* if we have a neighbor, compare ourselves to him */ |
| 892 | if (setting->next != NULL) | |
| 890 | if (setting->next() != NULL) | |
| 893 | 891 | { |
| 894 | int next_strindex = get_defstr_index(defstr_map, setting->next->name, driver, error); | |
| 892 | int next_strindex = get_defstr_index(defstr_map, setting->next()->name, driver, error); | |
| 895 | 893 | |
| 896 | 894 | /* check for inverted off/on dispswitch order */ |
| 897 | 895 | if (strindex == INPUT_STRING_On && next_strindex == INPUT_STRING_Off) |
| r11508 | r11509 | |
| 916 | 914 | |
| 917 | 915 | /* check for proper coin ordering */ |
| 918 | 916 | else if (strindex >= INPUT_STRING_9C_1C && strindex <= INPUT_STRING_1C_9C && next_strindex >= INPUT_STRING_9C_1C && next_strindex <= INPUT_STRING_1C_9C && |
| 919 | strindex >= next_strindex && memcmp(&setting->condition, &setting->next->condition, sizeof(setting->condition)) == 0) | |
| 917 | strindex >= next_strindex && memcmp(&setting->condition, &setting->next()->condition, sizeof(setting->condition)) == 0) | |
| 920 | 918 | { |
| 921 | mame_printf_error("%s: %s has unsorted coinage %s > %s\n", driver.source_file, driver.name, setting->name, setting->next->name); | |
| 919 | mame_printf_error("%s: %s has unsorted coinage %s > %s\n", driver.source_file, driver.name, setting->name, setting->next()->name); | |
| 922 | 920 | coin_error = *error = true; |
| 923 | 921 | } |
| 924 | 922 | } |
| r11508 | r11509 | |
| 943 | 941 | |
| 944 | 942 | static bool validate_inputs(driver_enumerator &drivlist, int_map &defstr_map, ioport_list &portlist) |
| 945 | 943 | { |
| 946 | const input_port_config *scanport; | |
| 947 | const input_port_config *port; | |
| 948 | const input_field_config *field; | |
| 944 | input_port_config *scanport; | |
| 945 | input_port_config *port; | |
| 946 | input_field_config *field; | |
| 949 | 947 | const game_driver &driver = drivlist.driver(); |
| 950 | 948 | const machine_config &config = drivlist.config(); |
| 951 | 949 | int empty_string_found = FALSE; |
| 952 | char errorbuf[1024]; | |
| 953 | 950 | bool error = false; |
| 951 | astring errorbuf; | |
| 954 | 952 | |
| 955 | 953 | /* skip if no ports */ |
| 956 | 954 | if (driver.ipt == NULL) |
| r11508 | r11509 | |
| 958 | 956 | |
| 959 | 957 | /* allocate the input ports */ |
| 960 | 958 | for (device_t *cfg = config.devicelist().first(); cfg != NULL; cfg = cfg->next()) |
| 961 | if (cfg->input_ports() != NULL) | |
| 959 | { | |
| 960 | input_port_list_init(*cfg, portlist, errorbuf); | |
| 961 | if (errorbuf) | |
| 962 | 962 | { |
| 963 | input_port_list_init(portlist, cfg->input_ports(), errorbuf, sizeof(errorbuf), FALSE, cfg); | |
| 964 | if (errorbuf[0] != 0) | |
| 965 | { | |
| 966 | mame_printf_error("%s: %s has input port errors:\n%s\n", driver.source_file, driver.name, errorbuf); | |
| 967 | error = true; | |
| 968 | } | |
| 963 | mame_printf_error("%s: %s has input port errors:\n%s\n", driver.source_file, driver.name, errorbuf.cstr()); | |
| 964 | error = true; | |
| 969 | 965 | } |
| 966 | } | |
| 970 | 967 | |
| 971 | 968 | /* check for duplicate tags */ |
| 972 | 969 | for (port = portlist.first(); port != NULL; port = port->next()) |
| 973 | if (port->tag != NULL) | |
| 974 | for (scanport = port->next(); scanport != NULL; scanport = scanport->next()) | |
| 975 | if (scanport->tag != NULL && strcmp(port->tag, scanport->tag) == 0) | |
| 976 | { | |
| 977 | mame_printf_error("%s: %s has a duplicate input port tag '%s'\n", driver.source_file, driver.name, port->tag); | |
| 978 | error = true; | |
| 979 | } | |
| 970 | for (scanport = port->next(); scanport != NULL; scanport = scanport->next()) | |
| 971 | if (strcmp(port->tag(), scanport->tag()) == 0) | |
| 972 | { | |
| 973 | mame_printf_error("%s: %s has a duplicate input port tag '%s'\n", driver.source_file, driver.name, port->tag()); | |
| 974 | error = true; | |
| 975 | } | |
| 980 | 976 | |
| 981 | 977 | /* iterate over the results */ |
| 982 | 978 | for (port = portlist.first(); port != NULL; port = port->next()) |
| 983 | for (field = port->fieldlist; field != NULL; field = field->next) | |
| 979 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 984 | 980 | { |
| 985 | | |
| 981 | | |
| 986 | 982 | //int strindex = 0; |
| 987 | 983 | |
| 988 | 984 | /* verify analog inputs */ |
| r11508 | r11509 | |
| 1043 | 1039 | { |
| 1044 | 1040 | /* find a matching port */ |
| 1045 | 1041 | for (scanport = portlist.first(); scanport != NULL; scanport = scanport->next()) |
| 1046 | if (s | |
| 1042 | if (s | |
| 1047 | 1043 | break; |
| 1048 | 1044 | |
| 1049 | 1045 | /* if none, error */ |
| r11508 | r11509 | |
| 1055 | 1051 | } |
| 1056 | 1052 | |
| 1057 | 1053 | /* verify conditions on the settings */ |
| 1058 | for (setting = field->settinglist; setting != NULL; setting = setting->next) | |
| 1054 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) | |
| 1059 | 1055 | if (setting->condition.tag != NULL) |
| 1060 | 1056 | { |
| 1061 | 1057 | /* find a matching port */ |
| 1062 | 1058 | for (scanport = portlist.first(); scanport != NULL; scanport = scanport->next()) |
| 1063 | if (s | |
| 1059 | if (s | |
| 1064 | 1060 | break; |
| 1065 | 1061 | |
| 1066 | 1062 | /* if none, error */ |
| r11508 | r11509 | |
|---|---|---|
| 368 | 368 | // device-level overrides |
| 369 | 369 | virtual const rom_entry *device_rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_ptr(DEVINFO_PTR_ROM_REGION)); } |
| 370 | 370 | virtual machine_config_constructor device_mconfig_additions() const { return reinterpret_cast<machine_config_constructor>(get_legacy_ptr(DEVINFO_PTR_MACHINE_CONFIG)); } |
| 371 | virtual const | |
| 371 | virtual ioport_constr | |
| 372 | 372 | virtual void device_start(); |
| 373 | 373 | virtual void device_reset(); |
| 374 | 374 | virtual void device_stop(); |
| r11508 | r11509 | |
|---|---|---|
| 248 | 248 | // allocate input ports |
| 249 | 249 | machine_config &config = m_drivlist.config(); |
| 250 | 250 | ioport_list portlist; |
| 251 | astring errors; | |
| 251 | 252 | for (device_t *device = config.devicelist().first(); device != NULL; device = device->next()) |
| 252 | if (device->input_ports() != NULL) | |
| 253 | input_port_list_init(portlist, device->input_ports(), NULL, 0, FALSE, device); | |
| 253 | input_port_list_init(*device, portlist, errors); | |
| 254 | 254 | |
| 255 | 255 | // print the header and the game name |
| 256 | 256 | fprintf(m_output, "\t<" XML_TOP); |
| r11508 | r11509 | |
| 693 | 693 | bool keyboard = false; |
| 694 | 694 | |
| 695 | 695 | // iterate over the ports |
| 696 | for (const input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 697 | for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next) | |
| 696 | for (input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 697 | for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 698 | 698 | { |
| 699 | 699 | int analogtype = -1; |
| 700 | 700 | |
| r11508 | r11509 | |
| 889 | 889 | void info_xml_creator::output_switches(const ioport_list &portlist, int type, const char *outertag, const char *innertag) |
| 890 | 890 | { |
| 891 | 891 | // iterate looking for DIP switches |
| 892 | for (const input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 893 | for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next) | |
| 892 | for (input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 893 | for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 894 | 894 | if (field->type == type) |
| 895 | 895 | { |
| 896 | 896 | // output the switch name information |
| 897 | 897 | fprintf(m_output, "\t\t<%s name=\"%s\"", outertag, xml_normalize_string(input_field_name(field))); |
| 898 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(field->port | |
| 898 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(field->port().tag())); | |
| 899 | 899 | fprintf(m_output, " mask=\"%u\"", field->mask); |
| 900 | 900 | fprintf(m_output, ">\n"); |
| 901 | 901 | |
| 902 | 902 | // loop over settings |
| 903 | for ( | |
| 903 | for ( | |
| 904 | 904 | { |
| 905 | 905 | fprintf(m_output, "\t\t\t<%s name=\"%s\"", innertag, xml_normalize_string(setting->name)); |
| 906 | 906 | fprintf(m_output, " value=\"%u\"", setting->value); |
| r11508 | r11509 | |
| 923 | 923 | void info_xml_creator::output_adjusters(const ioport_list &portlist) |
| 924 | 924 | { |
| 925 | 925 | // iterate looking for Adjusters |
| 926 | for (const input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 927 | for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next) | |
| 926 | for (input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 927 | for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 928 | 928 | if (field->type == IPT_ADJUSTER) |
| 929 | 929 | fprintf(m_output, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", xml_normalize_string(input_field_name(field)), field->defvalue); |
| 930 | 930 | } |
| r11508 | r11509 | |
| 1002 | 1002 | void info_xml_creator::output_categories(const ioport_list &portlist) |
| 1003 | 1003 | { |
| 1004 | 1004 | // iterate looking for Categories |
| 1005 | for (const input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 1006 | for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next) | |
| 1005 | for (input_port_config *port = portlist.first(); port != NULL; port = port->next()) | |
| 1006 | for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next()) | |
| 1007 | 1007 | if (field->type == IPT_CATEGORY) |
| 1008 | 1008 | { |
| 1009 | 1009 | // output the category name information |
| 1010 | 1010 | fprintf(m_output, "\t\t<category name=\"%s\">\n", xml_normalize_string(input_field_name(field))); |
| 1011 | 1011 | |
| 1012 | 1012 | // loop over item settings |
| 1013 | for ( | |
| 1013 | for ( | |
| 1014 | 1014 | { |
| 1015 | 1015 | fprintf(m_output, "\t\t\t<item name=\"%s\"", xml_normalize_string(setting->name)); |
| 1016 | 1016 | if (setting->value == field->defvalue) |
| r11508 | r11509 | |
|---|---|---|
| 4592 | 4592 | { |
| 4593 | 4593 | m_ioport = &ioport; |
| 4594 | 4594 | if (m_datawidth == 8) |
| 4595 | set_delegate(read8_delegate(&handler_entry_read::read_stub_ioport<UINT8>, ioport.tag, this)); | |
| 4595 | set_delegate(read8_delegate(&handler_entry_read::read_stub_ioport<UINT8>, ioport.tag(), this)); | |
| 4596 | 4596 | else if (m_datawidth == 16) |
| 4597 | set_delegate(read16_delegate(&handler_entry_read::read_stub_ioport<UINT16>, ioport.tag, this)); | |
| 4597 | set_delegate(read16_delegate(&handler_entry_read::read_stub_ioport<UINT16>, ioport.tag(), this)); | |
| 4598 | 4598 | else if (m_datawidth == 32) |
| 4599 | set_delegate(read32_delegate(&handler_entry_read::read_stub_ioport<UINT32>, ioport.tag, this)); | |
| 4599 | set_delegate(read32_delegate(&handler_entry_read::read_stub_ioport<UINT32>, ioport.tag(), this)); | |
| 4600 | 4600 | else if (m_datawidth == 64) |
| 4601 | set_delegate(read64_delegate(&handler_entry_read::read_stub_ioport<UINT64>, ioport.tag, this)); | |
| 4601 | set_delegate(read64_delegate(&handler_entry_read::read_stub_ioport<UINT64>, ioport.tag(), this)); | |
| 4602 | 4602 | } |
| 4603 | 4603 | |
| 4604 | 4604 | |
| r11508 | r11509 | |
| 4919 | 4919 | { |
| 4920 | 4920 | m_ioport = &ioport; |
| 4921 | 4921 | if (m_datawidth == 8) |
| 4922 | set_delegate(write8_delegate(&handler_entry_write::write_stub_ioport<UINT8>, ioport.tag, this)); | |
| 4922 | set_delegate(write8_delegate(&handler_entry_write::write_stub_ioport<UINT8>, ioport.tag(), this)); | |
| 4923 | 4923 | else if (m_datawidth == 16) |
| 4924 | set_delegate(write16_delegate(&handler_entry_write::write_stub_ioport<UINT16>, ioport.tag, this)); | |
| 4924 | set_delegate(write16_delegate(&handler_entry_write::write_stub_ioport<UINT16>, ioport.tag(), this)); | |
| 4925 | 4925 | else if (m_datawidth == 32) |
| 4926 | set_delegate(write32_delegate(&handler_entry_write::write_stub_ioport<UINT32>, ioport.tag, this)); | |
| 4926 | set_delegate(write32_delegate(&handler_entry_write::write_stub_ioport<UINT32>, ioport.tag(), this)); | |
| 4927 | 4927 | else if (m_datawidth == 64) |
| 4928 | set_delegate(write64_delegate(&handler_entry_write::write_stub_ioport<UINT64>, ioport.tag, this)); | |
| 4928 | set_delegate(write64_delegate(&handler_entry_write::write_stub_ioport<UINT64>, ioport.tag(), this)); | |
| 4929 | 4929 | } |
| 4930 | 4930 | |
| 4931 | 4931 |
| r11508 | r11509 | |
|---|---|---|
| 748 | 748 | CUSTOM_INPUT( custom_port_read ) |
| 749 | 749 | { |
| 750 | 750 | const char *tag = (const char *)param; |
| 751 | return input_port_read(field-> | |
| 751 | return input_port_read(field-> | |
| 752 | 752 | } |
| r11508 | r11509 | |
|---|---|---|
| 100 | 100 | const char * year; /* year the game was released */ |
| 101 | 101 | const char * manufacturer; /* manufacturer of the game */ |
| 102 | 102 | machine_config_constructor machine_config; /* machine driver tokens */ |
| 103 | const | |
| 103 | ioport_constr | |
| 104 | 104 | void (*driver_init)(running_machine &machine); /* DRIVER_INIT callback */ |
| 105 | 105 | const rom_entry * rom; /* pointer to list of ROMs for the game */ |
| 106 | 106 | const char * compatible_with; |
| r11508 | r11509 | |
|---|---|---|
| 160 | 160 | // input_ports - device-specific input ports |
| 161 | 161 | //------------------------------------------------- |
| 162 | 162 | |
| 163 | const | |
| 163 | ioport_constr | |
| 164 | 164 | { |
| 165 | 165 | return INPUT_PORTS_NAME( comxpl80 ); |
| 166 | 166 | } |
| r11508 | r11509 | |
|---|---|---|
| 52 | 52 | // optional information overrides |
| 53 | 53 | virtual const rom_entry *device_rom_region() const; |
| 54 | 54 | virtual machine_config_constructor device_mconfig_additions() const; |
| 55 | virtual const | |
| 55 | virtual ioport_constr | |
| 56 | 56 | |
| 57 | 57 | DECLARE_WRITE8_MEMBER( pa_w ); |
| 58 | 58 | DECLARE_WRITE8_MEMBER( pb_w ); |
| r11508 | r11509 | |
|---|---|---|
| 1489 | 1489 | |
| 1490 | 1490 | INPUT_CHANGED( coco_keyboard_changed ) |
| 1491 | 1491 | { |
| 1492 | coco_state *state = field->port->machine().driver_data<coco_state>(); | |
| 1493 | (*state->update_keyboard)(field->port->machine()); | |
| 1492 | coco_state *state = field->machine().driver_data<coco_state>(); | |
| 1493 | (*state->update_keyboard)(field->machine()); | |
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | static TIMER_CALLBACK( coco_m_update_keyboard_timerproc ) |
| r11508 | r11509 | |
| 2913 | 2913 | |
| 2914 | 2914 | INPUT_CHANGED( coco_joystick_mode_changed ) |
| 2915 | 2915 | { |
| 2916 | update_lightgun(field-> | |
| 2916 | update_lightgun(field-> | |
| 2917 | 2917 | } |
| 2918 | 2918 | |
| 2919 | 2919 | static TIMER_CALLBACK( update_lightgun_timer_callback ) |
| r11508 | r11509 | |
|---|---|---|
| 509 | 509 | // input_ports - device-specific input ports |
| 510 | 510 | //------------------------------------------------- |
| 511 | 511 | |
| 512 | const | |
| 512 | ioport_constr | |
| 513 | 513 | { |
| 514 | 514 | return INPUT_PORTS_NAME( ibm5160_mb ); |
| 515 | 515 | } |
| r11508 | r11509 | |
|---|---|---|
| 1056 | 1056 | int bit_mask = (FPTR)param; |
| 1057 | 1057 | UINT8 port = 0; |
| 1058 | 1058 | |
| 1059 | if ((input_port_read(field->port->machine(), "CTRLSEL") & 0xf0) == 0x10) | |
| 1060 | port |= (input_port_read(field->port->machine(), "FAKE0") & bit_mask) ? 1 : 0; | |
| 1059 | if ((input_port_read(field->machine(), "CTRLSEL") & 0xf0) == 0x10) | |
| 1060 | port |= (input_port_read(field->machine(), "FAKE0") & bit_mask) ? 1 : 0; | |
| 1061 | 1061 | |
| 1062 | if ((input_port_read(field->port->machine(), "CTRLSEL") & 0xf0) == 0x00) | |
| 1063 | port |= (input_port_read(field->port->machine(), "FAKE1") & bit_mask) ? 1 : 0; | |
| 1062 | if ((input_port_read(field->machine(), "CTRLSEL") & 0xf0) == 0x00) | |
| 1063 | port |= (input_port_read(field->machine(), "FAKE1") & bit_mask) ? 1 : 0; | |
| 1064 | 1064 | |
| 1065 | 1065 | return port; |
| 1066 | 1066 | } |
| r11508 | r11509 | |
|---|---|---|
| 627 | 627 | |
| 628 | 628 | INPUT_CHANGED( comx35_reset ) |
| 629 | 629 | { |
| 630 | comx35_state *state = field-> | |
| 630 | comx35_state *state = field-> | |
| 631 | 631 | |
| 632 | if (BIT(input_port_read(field-> | |
| 632 | if (BIT(input_port_read(field-> | |
| 633 | 633 | { |
| 634 | 634 | state->machine_reset(); |
| 635 | 635 | } |
| r11508 | r11509 | |
|---|---|---|
| 376 | 376 | INPUT_CHANGED( z80ne_reset ) |
| 377 | 377 | { |
| 378 | 378 | UINT8 rst; |
| 379 | rst = input_port_read(field-> | |
| 379 | rst = input_port_read(field-> | |
| 380 | 380 | |
| 381 | 381 | if ( ! BIT(rst, 0)) |
| 382 | 382 | { |
| 383 | running_machine &machine = field-> | |
| 383 | running_machine &machine = field-> | |
| 384 | 384 | machine.schedule_soft_reset(); |
| 385 | 385 | } |
| 386 | 386 | } |
| r11508 | r11509 | |
| 388 | 388 | INPUT_CHANGED( z80ne_nmi ) |
| 389 | 389 | { |
| 390 | 390 | UINT8 nmi; |
| 391 | nmi = input_port_read(field-> | |
| 391 | nmi = input_port_read(field-> | |
| 392 | 392 | |
| 393 | 393 | if ( ! BIT(nmi, 0)) |
| 394 | 394 | { |
| 395 | cputag_set_input_line(field-> | |
| 395 | cputag_set_input_line(field-> | |
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 |
| r11508 | r11509 | |
|---|---|---|
| 240 | 240 | |
| 241 | 241 | INPUT_CHANGED( abc99_device::keyboard_reset ) |
| 242 | 242 | { |
| 243 | abc99_device *keyboard = static_cast<abc99_device *>(field-> | |
| 243 | abc99_device *keyboard = static_cast<abc99_device *>(field-> | |
| 244 | 244 | |
| 245 | 245 | device_set_input_line(keyboard->m_mousecpu, INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); |
| 246 | 246 | } |
| r11508 | r11509 | |
| 445 | 445 | // input_ports - device-specific input ports |
| 446 | 446 | //------------------------------------------------- |
| 447 | 447 | |
| 448 | const | |
| 448 | ioport_constr | |
| 449 | 449 | { |
| 450 | 450 | return INPUT_PORTS_NAME( abc99 ); |
| 451 | 451 | } |
| r11508 | r11509 | |
|---|---|---|
| 54 | 54 | // optional information overrides |
| 55 | 55 | virtual const rom_entry *device_rom_region() const; |
| 56 | 56 | virtual machine_config_constructor device_mconfig_additions() const; |
| 57 | virtual const | |
| 57 | virtual ioport_constr | |
| 58 | 58 | |
| 59 | 59 | static INPUT_CHANGED( keyboard_reset ); |
| 60 | 60 |
| r11508 | r11509 | |
|---|---|---|
| 371 | 371 | // input_ports - device-specific input ports |
| 372 | 372 | //------------------------------------------------- |
| 373 | 373 | |
| 374 | const | |
| 374 | ioport_constr | |
| 375 | 375 | { |
| 376 | 376 | return INPUT_PORTS_NAME( luxor_55_21046 ); |
| 377 | 377 | } |
| r11508 | r11509 | |
|---|---|---|
| 81 | 81 | // optional information overrides |
| 82 | 82 | virtual const rom_entry *device_rom_region() const; |
| 83 | 83 | virtual machine_config_constructor device_mconfig_additions() const; |
| 84 | virtual const | |
| 84 | virtual ioport_constr | |
| 85 | 85 | |
| 86 | 86 | DECLARE_READ8_MEMBER( _3d_r ); |
| 87 | 87 | DECLARE_WRITE8_MEMBER( _4d_w ); |
| r11508 | r11509 | |
|---|---|---|
| 411 | 411 | // input_ports - device-specific input ports |
| 412 | 412 | //------------------------------------------------- |
| 413 | 413 | |
| 414 | const | |
| 414 | ioport_constr | |
| 415 | 415 | { |
| 416 | 416 | return INPUT_PORTS_NAME( luxor_55_10828 ); |
| 417 | 417 | } |
| r11508 | r11509 | |
|---|---|---|
| 96 | 96 | // optional information overrides |
| 97 | 97 | virtual const rom_entry *device_rom_region() const; |
| 98 | 98 | virtual machine_config_constructor device_mconfig_additions() const; |
| 99 | virtual const | |
| 99 | virtual ioport_constr | |
| 100 | 100 | |
| 101 | 101 | protected: |
| 102 | 102 | // device-level overrides |
| r11508 | r11509 | |
|---|---|---|
| 181 | 181 | |
| 182 | 182 | INPUT_CHANGED( abc77_device::keyboard_reset ) |
| 183 | 183 | { |
| 184 | abc77_device *keyboard = static_cast<abc77_device *>(field-> | |
| 184 | abc77_device *keyboard = static_cast<abc77_device *>(field-> | |
| 185 | 185 | |
| 186 | 186 | if (oldval && !newval) |
| 187 | 187 | { |
| r11508 | r11509 | |
| 341 | 341 | // input_ports - device-specific input ports |
| 342 | 342 | //------------------------------------------------- |
| 343 | 343 | |
| 344 | const | |
| 344 | ioport_constr | |
| 345 | 345 | { |
| 346 | 346 | return INPUT_PORTS_NAME( abc77 ); |
| 347 | 347 | } |
| r11508 | r11509 | |
|---|---|---|
| 61 | 61 | // optional information overrides |
| 62 | 62 | virtual const rom_entry *device_rom_region() const; |
| 63 | 63 | virtual machine_config_constructor device_mconfig_additions() const; |
| 64 | virtual const | |
| 64 | virtual ioport_constr | |
| 65 | 65 | |
| 66 | 66 | static INPUT_CHANGED( keyboard_reset ); |
| 67 | 67 |
| r11508 | r11509 | |
|---|---|---|
| 37 | 37 | |
| 38 | 38 | // optional information overrides |
| 39 | 39 | virtual machine_config_constructor device_mconfig_additions() const; |
| 40 | virtual const | |
| 40 | virtual ioport_constr | |
| 41 | 41 | protected: |
| 42 | 42 | // device-level overrides |
| 43 | 43 | virtual void device_start(); |
| r11508 | r11509 | |
|---|---|---|
| 303 | 303 | |
| 304 | 304 | static INPUT_CHANGED( reset_w ) |
| 305 | 305 | { |
| 306 | vip_state *state = field-> | |
| 306 | vip_state *state = field-> | |
| 307 | 307 | |
| 308 | 308 | if (oldval && !newval) |
| 309 | 309 | { |
| r11508 | r11509 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | static INPUT_CHANGED( input_w ) |
| 89 | 89 | { |
| 90 | elf2_state *state = field-> | |
| 90 | elf2_state *state = field-> | |
| 91 | 91 | |
| 92 | 92 | if (newval) |
| 93 | 93 | { |
| r11508 | r11509 | |
|---|---|---|
| 1547 | 1547 | /* TODO: key repeat, remove port impulse! */ |
| 1548 | 1548 | static INPUT_CHANGED( key_stroke ) |
| 1549 | 1549 | { |
| 1550 | pc9801_state *state = field-> | |
| 1550 | pc9801_state *state = field-> | |
| 1551 | 1551 | |
| 1552 | 1552 | if(newval && !oldval) |
| 1553 | 1553 | { |
| 1554 | 1554 | state->m_keyb_press = (UINT8)(FPTR)(param) & 0x7f; |
| 1555 | pic8259_ir1_w(field-> | |
| 1555 | pic8259_ir1_w(field-> | |
| 1556 | 1556 | } |
| 1557 | 1557 | |
| 1558 | 1558 | if(oldval && !newval) |
| r11508 | r11509 | |
| 1562 | 1562 | /* for key modifiers */ |
| 1563 | 1563 | static INPUT_CHANGED( shift_stroke ) |
| 1564 | 1564 | { |
| 1565 | pc9801_state *state = field-> | |
| 1565 | pc9801_state *state = field-> | |
| 1566 | 1566 | |
| 1567 | 1567 | if((newval && !oldval) || (oldval && !newval)) |
| 1568 | 1568 | { |
| 1569 | 1569 | state->m_keyb_press = (UINT8)(FPTR)(param) & 0x7f; |
| 1570 | pic8259_ir1_w(field-> | |
| 1570 | pic8259_ir1_w(field-> | |
| 1571 | 1571 | } |
| 1572 | 1572 | else |
| 1573 | 1573 | state->m_keyb_press = 0; |
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | ||
| 1576 | ||
| 1577 | 1577 | { |
| 1578 | 1578 | pc9801_state *state = device->machine().driver_data<pc9801_state>(); |
| 1579 | 1579 | |
| r11508 | r11509 | |
| 1742 | 1742 | PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-8") PORT_IMPULSE(1) PORT_CHANGED(key_stroke, 0x7f) //PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 1743 | 1743 | |
| 1744 | 1744 | PORT_START("DSW1") |
| 1745 | PORT_BIT(0x0001, IP_ACTIVE_HIGH,IPT_SPECIAL) PORT_READ_LINE_DEVICE("upd1990a", upd1990a_data_out_r) | |
| 1745 | PORT_BIT(0x0001, IP_ACTIVE_HIGH,IPT_SPECIAL) PORT_READ_LINE_DEVICE("upd1990a", upd1990a_data_out_pc9801_r) | |
| 1746 | 1746 | PORT_DIPNAME( 0x0002, 0x0000, "DSW1" ) // error beep if OFF |
| 1747 | 1747 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) |
| 1748 | 1748 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| r11508 | r11509 | |
|---|---|---|
| 310 | 310 | |
| 311 | 311 | static INPUT_CHANGED( trigger_irq ) |
| 312 | 312 | { |
| 313 | nakajies_state *state = field->port->machine().driver_data<nakajies_state>(); | |
| 314 | UINT8 irqs = input_port_read( field->port->machine(), "debug" ); | |
| 313 | nakajies_state *state = field->machine().driver_data<nakajies_state>(); | |
| 314 | UINT8 irqs = input_port_read( field->machine(), "debug" ); | |
| 315 | 315 | |
| 316 | 316 | state->m_irq_active |= irqs; |
| 317 | nakajies_update_irqs(field-> | |
| 317 | nakajies_update_irqs(field-> | |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 |
| r11508 | r11509 | |
|---|---|---|
| 2007 | 2007 | |
| 2008 | 2008 | static INPUT_CHANGED( ipl_reset ) |
| 2009 | 2009 | { |
| 2010 | //address_space *space = field->port->machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 2011 | x1_state *state = field->port->machine().driver_data<x1_state>(); | |
| 2010 | //address_space *space = field->machine().device("maincpu")->memory().space(AS_PROGRAM); | |
| 2011 | x1_state *state = field->machine().driver_data<x1_state>(); | |
| 2012 | 2012 | |
| 2013 | cputag_set_input_line(field-> | |
| 2013 | cputag_set_input_line(field-> | |
| 2014 | 2014 | |
| 2015 | 2015 | state->m_ram_bank = 0x00; |
| 2016 | 2016 | if(state->m_is_turbo) { state->m_ex_bank = 0x10; } |
| r11508 | r11509 | |
| 2020 | 2020 | /* Apparently most games doesn't support this (not even the Konami ones!), one that does is...177 :o */ |
| 2021 | 2021 | static INPUT_CHANGED( nmi_reset ) |
| 2022 | 2022 | { |
| 2023 | cputag_set_input_line(field-> | |
| 2023 | cputag_set_input_line(field-> | |
| 2024 | 2024 | } |
| 2025 | 2025 | |
| 2026 | 2026 | static INPUT_PORTS_START( x1 ) |
| r11508 | r11509 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | static INPUT_CHANGED( pen_check ) |
| 38 | 38 | { |
| 39 | UINT8 button = input_port_read(field->port->machine(), "PENB"); | |
| 40 | device_t *mc68328_device = field->port->machine().device("dragonball"); | |
| 39 | UINT8 button = input_port_read(field->machine(), "PENB"); | |
| 40 | device_t *mc68328_device = field->machine().device("dragonball"); | |
| 41 | 41 | if(button) |
| 42 | 42 | { |
| 43 | 43 | mc68328_set_penirq_line(mc68328_device, 1); |
| r11508 | r11509 | |
| 50 | 50 | |
| 51 | 51 | static INPUT_CHANGED( button_check ) |
| 52 | 52 | { |
| 53 | UINT8 button_state = input_port_read(field->port->machine(), "PORTD"); | |
| 54 | device_t *mc68328_device = field->port->machine().device("dragonball"); | |
| 53 | UINT8 button_state = input_port_read(field->machine(), "PORTD"); | |
| 54 | device_t *mc68328_device = field->machine().device("dragonball"); | |
| 55 | 55 | |
| 56 | 56 | mc68328_set_port_d_lines(mc68328_device, button_state, (int)(FPTR)param); |
| 57 | 57 | } |
| r11508 | r11509 | |
|---|---|---|
| 118 | 118 | static INPUT_CHANGED( kim1_reset ) |
| 119 | 119 | { |
| 120 | 120 | if (newval == 0) |
| 121 | field-> | |
| 121 | field-> | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 |
| r11508 | r11509 | |
|---|---|---|
| 399 | 399 | // vco_voltage_w - CSG VCO voltage select |
| 400 | 400 | //------------------------------------------------- |
| 401 | 401 | |
| 402 | ||
| 402 | ||
| 403 | 403 | { |
| 404 | 404 | sn76477_vco_voltage_w(device, state ? 2.5 : 0); |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | WRITE_LINE_DEVICE_HANDLER(port_sn76477_enable_w) | |
| 408 | { | |
| 409 | sn76477_enable_w(device,state); | |
| 410 | } | |
| 407 | 411 | |
| 412 | WRITE_LINE_DEVICE_HANDLER(port_sn76477_vco_w) | |
| 413 | { | |
| 414 | sn76477_vco_w(device,state); | |
| 415 | } | |
| 408 | 416 | |
| 417 | WRITE_LINE_DEVICE_HANDLER(port_sn76477_mixer_b_w) | |
| 418 | { | |
| 419 | sn76477_mixer_b_w(device,state); | |
| 420 | } | |
| 421 | ||
| 422 | WRITE_LINE_DEVICE_HANDLER(port_sn76477_mixer_a_w) | |
| 423 | { | |
| 424 | sn76477_mixer_a_w(device,state); | |
| 425 | } | |
| 426 | ||
| 427 | WRITE_LINE_DEVICE_HANDLER(port_sn76477_mixer_c_w) | |
| 428 | { | |
| 429 | sn76477_mixer_c_w(device,state); | |
| 430 | } | |
| 431 | ||
| 432 | WRITE_LINE_DEVICE_HANDLER(port_sn76477_envelope_2_w) | |
| 433 | { | |
| 434 | sn76477_envelope_2_w(device,state); | |
| 435 | } | |
| 436 | ||
| 437 | WRITE_LINE_DEVICE_HANDLER(port_sn76477_envelope_1_w) | |
| 438 | { | |
| 439 | sn76477_envelope_1_w(device,state); | |
| 440 | } | |
| 441 | ||
| 409 | 442 | //************************************************************************** |
| 410 | 443 | // ADDRESS MAPS |
| 411 | 444 | //************************************************************************** |
| r11508 | r11509 | |
| 458 | 491 | PORT_INCLUDE(fake_keyboard) |
| 459 | 492 | |
| 460 | 493 | PORT_START("SN76477") |
| 461 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, sn76477_enable_w) | |
| 494 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, port_sn76477_enable_w) | |
| 462 | 495 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, vco_voltage_w) |
| 463 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, sn76477_vco_w) | |
| 464 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, sn76477_mixer_b_w) | |
| 465 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, sn76477_mixer_a_w) | |
| 466 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, sn76477_mixer_c_w) | |
| 467 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, sn76477_envelope_2_w) | |
| 468 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, sn76477_envelope_1_w) | |
| 496 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, port_sn76477_vco_w) | |
| 497 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, port_sn76477_mixer_b_w) | |
| 498 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, port_sn76477_mixer_a_w) | |
| 499 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, port_sn76477_mixer_c_w) | |
| 500 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, port_sn76477_envelope_2_w) | |
| 501 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE(SN76477_TAG, port_sn76477_envelope_1_w) | |
| 469 | 502 | INPUT_PORTS_END |
| 470 | 503 | |
| 471 | 504 |
| r11508 | r11509 | |
|---|---|---|
| 79 | 79 | |
| 80 | 80 | static INPUT_CHANGED( trigger_nmi ) |
| 81 | 81 | { |
| 82 | cputag_set_input_line(field-> | |
| 82 | cputag_set_input_line(field-> | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | static INPUT_CHANGED( trigger_irq ) |
| 86 | 86 | { |
| 87 | cputag_set_input_line(field-> | |
| 87 | cputag_set_input_line(field-> | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | static INPUT_PORTS_START( mpf1 ) |
| r11508 | r11509 | |
|---|---|---|
| 259 | 259 | |
| 260 | 260 | static INPUT_CHANGED( reset_w ) |
| 261 | 261 | { |
| 262 | studio2_state *state = field-> | |
| 262 | studio2_state *state = field-> | |
| 263 | 263 | |
| 264 | 264 | if (oldval && !newval) |
| 265 | 265 | { |
| r11508 | r11509 | |
|---|---|---|
| 179 | 179 | /* The ON LINE switch is directly connected to the INT1 input of the CPU */ |
| 180 | 180 | static INPUT_CHANGED( online_switch ) |
| 181 | 181 | { |
| 182 | ex800_state *state = field-> | |
| 182 | ex800_state *state = field-> | |
| 183 | 183 | if (newval) |
| 184 | 184 | { |
| 185 | cputag_set_input_line(field-> | |
| 185 | cputag_set_input_line(field-> | |
| 186 | 186 | state->m_irq_state = (state->m_irq_state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE; |
| 187 | 187 | } |
| 188 | 188 | } |
| r11508 | r11509 | |
|---|---|---|
| 411 | 411 | |
| 412 | 412 | static INPUT_CHANGED( trigger_irq ) |
| 413 | 413 | { |
| 414 | rex6000_state *state = field-> | |
| 414 | rex6000_state *state = field-> | |
| 415 | 415 | |
| 416 | 416 | if (!(state->m_irq_mask & IRQ_FLAG_KEYCHANGE)) |
| 417 | 417 | { |
| r11508 | r11509 | |
|---|---|---|
| 79 | 79 | |
| 80 | 80 | static INPUT_CHANGED( panel_check ) |
| 81 | 81 | { |
| 82 | ssem_state *state = field->port->machine().driver_data<ssem_state>(); | |
| 83 | UINT8 edit0_state = input_port_read(field->port->machine(), "EDIT0"); | |
| 84 | UINT8 edit1_state = input_port_read(field->port->machine(), "EDIT1"); | |
| 85 | UINT8 edit2_state = input_port_read(field->port->machine(), "EDIT2"); | |
| 86 | UINT8 edit3_state = input_port_read(field->port->machine(), "EDIT3"); | |
| 87 | UINT8 misc_state = input_port_read(field->port->machine(), "MISC"); | |
| 88 | device_t *ssem_cpu = field->port->machine().device("maincpu"); | |
| 82 | ssem_state *state = field->machine().driver_data<ssem_state>(); | |
| 83 | UINT8 edit0_state = input_port_read(field->machine(), "EDIT0"); | |
| 84 | UINT8 edit1_state = input_port_read(field->machine(), "EDIT1"); | |
| 85 | UINT8 edit2_state = input_port_read(field->machine(), "EDIT2"); | |
| 86 | UINT8 edit3_state = input_port_read(field->machine(), "EDIT3"); | |
| 87 | UINT8 misc_state = input_port_read(field->machine(), "MISC"); | |
| 88 | device_t *ssem_cpu = field->machine().device("maincpu"); | |
| 89 | 89 | |
| 90 | 90 | switch( (int)(FPTR)param ) |
| 91 | 91 | { |
| r11508 | r11509 | |
|---|---|---|
| 429 | 429 | ADDRESS_MAP_END |
| 430 | 430 | |
| 431 | 431 | /* Input Ports */ |
| 432 | ||
| 432 | /* | |
| 433 | 433 | static INPUT_PORTS_START( v1050_real ) |
| 434 | 434 | PORT_START("X0") |
| 435 | 435 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| r11508 | r11509 | |
| 551 | 551 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 552 | 552 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 553 | 553 | INPUT_PORTS_END |
| 554 | ||
| 554 | */ | |
| 555 | 555 | static INPUT_PORTS_START( v1050 ) |
| 556 | 556 | PORT_START("ROW0") |
| 557 | 557 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) /* HELP */ |
| r11508 | r11509 | |
|---|---|---|
| 668 | 668 | /* TODO: shift break */ |
| 669 | 669 | static INPUT_CHANGED( key_stroke ) |
| 670 | 670 | { |
| 671 | qx10_state *state = field-> | |
| 671 | qx10_state *state = field-> | |
| 672 | 672 | |
| 673 | 673 | if(newval && !oldval) |
| 674 | 674 | { |
| 675 | 675 | state->m_keyb.rx = (UINT8)(FPTR)(param) & 0x7f; |
| 676 | pic8259_ir4_w(field-> | |
| 676 | pic8259_ir4_w(field-> | |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | if(oldval && !newval) |
| r11508 | r11509 | |
|---|---|---|
| 324 | 324 | |
| 325 | 325 | static INPUT_CHANGED( tmc2000_run_pressed ) |
| 326 | 326 | { |
| 327 | running_machine &machine = field-> | |
| 327 | running_machine &machine = field-> | |
| 328 | 328 | tmc2000_state *state = machine.driver_data<tmc2000_state>(); |
| 329 | 329 | |
| 330 | 330 | if (oldval && !newval) |
| r11508 | r11509 | |
| 420 | 420 | |
| 421 | 421 | static INPUT_CHANGED( run_pressed ) |
| 422 | 422 | { |
| 423 | running_machine &machine = field-> | |
| 423 | running_machine &machine = field-> | |
| 424 | 424 | nano_state *state = machine.driver_data<nano_state>(); |
| 425 | 425 | |
| 426 | 426 | if (oldval && !newval) |
| r11508 | r11509 | |
| 431 | 431 | |
| 432 | 432 | static INPUT_CHANGED( monitor_pressed ) |
| 433 | 433 | { |
| 434 | running_machine &machine = field-> | |
| 434 | running_machine &machine = field-> | |
| 435 | 435 | nano_state *state = machine.driver_data<nano_state>(); |
| 436 | 436 | |
| 437 | 437 | if (oldval && !newval) |
| r11508 | r11509 | |
|---|---|---|
| 203 | 203 | |
| 204 | 204 | static INPUT_CHANGED( trigger_nmi ) |
| 205 | 205 | { |
| 206 | crvision_state *state = field-> | |
| 206 | crvision_state *state = field-> | |
| 207 | 207 | |
| 208 | 208 | state->m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| 209 | 209 | } |
| r11508 | r11509 | |
|---|---|---|
| 116 | 116 | |
| 117 | 117 | static INPUT_CHANGED( port_changed ) |
| 118 | 118 | { |
| 119 | gizmondo_state *gizmondo = field-> | |
| 119 | gizmondo_state *gizmondo = field-> | |
| 120 | 120 | s3c2440_request_eint( gizmondo->m_s3c2440, 4); |
| 121 | 121 | //s3c2440_request_irq( device, S3C2440_INT_EINT1); |
| 122 | 122 | } |
| r11508 | r11509 | |
|---|---|---|
| 312 | 312 | /* Steph 2000-10-27 I remapped the 'Machine Name' Dip Switches (easier to understand) */ |
| 313 | 313 | static INPUT_CHANGED( cpc_monitor_changed ) |
| 314 | 314 | { |
| 315 | running_machine &machine = field-> | |
| 315 | running_machine &machine = field-> | |
| 316 | 316 | const UINT8 *color_prom = NULL; |
| 317 | 317 | |
| 318 | 318 | if ( (input_port_read(machine, "green_display")) & 0x01 ) |
| r11508 | r11509 | |
|---|---|---|
| 39 | 39 | static INPUT_CHANGED( junior_reset ) |
| 40 | 40 | { |
| 41 | 41 | if (newval == 0) |
| 42 | field-> | |
| 42 | field-> | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 |
| r11508 | r11509 | |
|---|---|---|
| 763 | 763 | |
| 764 | 764 | static INPUT_CHANGED( input_update ) |
| 765 | 765 | { |
| 766 | UINT32 buttons = input_port_read(field-> | |
| 766 | UINT32 buttons = input_port_read(field-> | |
| 767 | 767 | |
| 768 | ps_intc_set_interrupt_line(field->port->machine(), PS_INT_BTN_ACTION, (buttons & 1) ? 1 : 0); | |
| 769 | ps_intc_set_interrupt_line(field->port->machine(), PS_INT_BTN_RIGHT, (buttons & 2) ? 1 : 0); | |
| 770 | ps_intc_set_interrupt_line(field->port->machine(), PS_INT_BTN_LEFT, (buttons & 4) ? 1 : 0); | |
| 771 | ps_intc_set_interrupt_line(field->port->machine(), PS_INT_BTN_DOWN, (buttons & 8) ? 1 : 0); | |
| 772 | ps_intc_set_interrupt_line(field->port->machine(), PS_INT_BTN_UP, (buttons & 16) ? 1 : 0); | |
| 768 | ps_intc_set_interrupt_line(field->machine(), PS_INT_BTN_ACTION, (buttons & 1) ? 1 : 0); | |
| 769 | ps_intc_set_interrupt_line(field->machine(), PS_INT_BTN_RIGHT, (buttons & 2) ? 1 : 0); | |
| 770 | ps_intc_set_interrupt_line(field->machine(), PS_INT_BTN_LEFT, (buttons & 4) ? 1 : 0); | |
| 771 | ps_intc_set_interrupt_line(field->machine(), PS_INT_BTN_DOWN, (buttons & 8) ? 1 : 0); | |
| 772 | ps_intc_set_interrupt_line(field->machine(), PS_INT_BTN_UP, (buttons & 16) ? 1 : 0); | |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | static READ32_HANDLER(ps_rombank_r) |
| r11508 | r11509 | |
|---|---|---|
| 1114 | 1114 | |
| 1115 | 1115 | static INPUT_CHANGED( update_udk ) |
| 1116 | 1116 | { |
| 1117 | x07_state *state = field-> | |
| 1117 | x07_state *state = field-> | |
| 1118 | 1118 | |
| 1119 | state->draw_udk(field-> | |
| 1119 | state->draw_udk(field-> | |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | 1122 | static INPUT_CHANGED( kb_keys ) |
| 1123 | 1123 | { |
| 1124 | x07_state *state = field-> | |
| 1124 | x07_state *state = field-> | |
| 1125 | 1125 | |
| 1126 | 1126 | if (!newval) |
| 1127 | state->kb_scan_keys(field-> | |
| 1127 | state->kb_scan_keys(field-> | |
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | 1130 | static INPUT_CHANGED( kb_func_keys ) |
| 1131 | 1131 | { |
| 1132 | x07_state *state = field-> | |
| 1132 | x07_state *state = field-> | |
| 1133 | 1133 | |
| 1134 | 1134 | if (newval) |
| 1135 | state->kb_fun_keys(field-> | |
| 1135 | state->kb_fun_keys(field-> | |
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | static INPUT_CHANGED( kb_break ) |
| 1139 | 1139 | { |
| 1140 | x07_state *state = field-> | |
| 1140 | x07_state *state = field-> | |
| 1141 | 1141 | |
| 1142 | 1142 | if (newval) |
| 1143 | 1143 | { |
| r11508 | r11509 | |
|---|---|---|
| 240 | 240 | |
| 241 | 241 | static INPUT_CHANGED( trigger_reset ) |
| 242 | 242 | { |
| 243 | cputag_set_input_line(field-> | |
| 243 | cputag_set_input_line(field-> | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 |
| r11508 | r11509 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | static INPUT_CHANGED( trigger_reset ) |
| 51 | 51 | { |
| 52 | cputag_set_input_line(field-> | |
| 52 | cputag_set_input_line(field-> | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | static INPUT_CHANGED( trigger_rst75 ) |
| 56 | 56 | { |
| 57 | cputag_set_input_line(field-> | |
| 57 | cputag_set_input_line(field-> | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | static INPUT_PORTS_START( exp85 ) |
| r11508 | r11509 | |
|---|---|---|
| 229 | 229 | |
| 230 | 230 | static INPUT_CHANGED( port_changed ) |
| 231 | 231 | { |
| 232 | hp49gp_state *hp49gp = field-> | |
| 232 | hp49gp_state *hp49gp = field-> | |
| 233 | 233 | s3c2410_request_eint( hp49gp->m_s3c2410, (FPTR)param + 8); |
| 234 | 234 | } |
| 235 | 235 |
| r11508 | r11509 | |
|---|---|---|
| 504 | 504 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) |
| 505 | 505 | INPUT_PORTS_END |
| 506 | 506 | |
| 507 | /* | |
| 507 | 508 | static INPUT_PORTS_START( trs80m2_real ) |
| 508 | 509 | PORT_START("ROW0") |
| 509 | 510 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r11508 | r11509 | |
| 625 | 626 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') |
| 626 | 627 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 627 | 628 | INPUT_PORTS_END |
| 628 | ||
| 629 | */ | |
| 629 | 630 | /* Video */ |
| 630 | 631 | |
| 631 | 632 | static MC6845_UPDATE_ROW( trs80m2_update_row ) |
| r11508 | r11509 | |
|---|---|---|
| 554 | 554 | |
| 555 | 555 | static INPUT_CHANGED( power_callback ) |
| 556 | 556 | { |
| 557 | ngp_state *state = field-> | |
| 557 | ngp_state *state = field-> | |
| 558 | 558 | |
| 559 | 559 | if ( state->m_io_reg[0x33] & 0x04 ) |
| 560 | 560 | { |
| 561 | 561 | device_set_input_line( state->m_tlcs900, TLCS900_NMI, |
| 562 | (input_port_read(field-> | |
| 562 | (input_port_read(field-> | |
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | 565 |
| r11508 | r11509 | |
|---|---|---|
| 262 | 262 | /* the 'reset' key is directly tied to the reset line of the cpu */ |
| 263 | 263 | static INPUT_CHANGED( aquarius_reset ) |
| 264 | 264 | { |
| 265 | cputag_set_input_line(field-> | |
| 265 | cputag_set_input_line(field-> | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | static INPUT_PORTS_START( aquarius ) |
| r11508 | r11509 | |
|---|---|---|
| 237 | 237 | |
| 238 | 238 | static INPUT_CHANGED( gm_changed ) |
| 239 | 239 | { |
| 240 | device_t *board = field-> | |
| 240 | device_t *board = field-> | |
| 241 | 241 | set_gm_switches(board, (UINT8)((UINT64)param&0x03), newval); |
| 242 | 242 | } |
| 243 | 243 |
| r11508 | r11509 | |
|---|---|---|
| 156 | 156 | |
| 157 | 157 | /* Input Ports */ |
| 158 | 158 | |
| 159 | ||
| 159 | ||
| 160 | 160 | { |
| 161 | 161 | pc8001_state *driver_state = device->machine().driver_data<pc8001_state>(); |
| 162 | 162 | driver_state->m_rtc->c0_w(state); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | ||
| 165 | ||
| 166 | 166 | { |
| 167 | 167 | pc8001_state *driver_state = device->machine().driver_data<pc8001_state>(); |
| 168 | 168 | driver_state->m_rtc->c1_w(state); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | ||
| 171 | ||
| 172 | 172 | { |
| 173 | 173 | pc8001_state *driver_state = device->machine().driver_data<pc8001_state>(); |
| 174 | 174 | driver_state->m_rtc->c2_w(state); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | ||
| 177 | ||
| 178 | 178 | { |
| 179 | 179 | pc8001_state *driver_state = device->machine().driver_data<pc8001_state>(); |
| 180 | 180 | driver_state->m_rtc->data_in_w(state); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | ||
| 183 | ||
| 184 | 184 | { |
| 185 | 185 | pc8001_state *driver_state = device->machine().driver_data<pc8001_state>(); |
| 186 | 186 | driver_state->m_rtc->stb_w(state); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | ||
| 189 | ||
| 190 | 190 | { |
| 191 | 191 | pc8001_state *driver_state = device->machine().driver_data<pc8001_state>(); |
| 192 | 192 | driver_state->m_rtc->clk_w(state); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | ||
| 195 | ||
| 196 | 196 | { |
| 197 | 197 | pc8001_state *state = device->machine().driver_data<pc8001_state>(); |
| 198 | 198 | return state->m_rtc->data_out_r(); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | ||
| 201 | ||
| 202 | 202 | { |
| 203 | 203 | pc8001_state *state = device->machine().driver_data<pc8001_state>(); |
| 204 | 204 | return state->m_crtc->vrtc_r(); |
| r11508 | r11509 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | static INPUT_CHANGED( trigger_reset ) |
| 31 | 31 | { |
| 32 | cputag_set_input_line(field-> | |
| 32 | cputag_set_input_line(field-> | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | static INPUT_PORTS_START( beta ) |
| r11508 | r11509 | |
|---|---|---|
| 918 | 918 | |
| 919 | 919 | static INPUT_CHANGED( key_callback ) |
| 920 | 920 | { |
| 921 | px4_state *px4 = field-> | |
| 921 | px4_state *px4 = field-> | |
| 922 | 922 | UINT32 oldvalue = oldval * field->mask, newvalue = newval * field->mask; |
| 923 | 923 | UINT32 delta = oldvalue ^ newvalue; |
| 924 | 924 | int i, scancode = 0xff, down = 0; |
| r11508 | r11509 | |
| 951 | 951 | logerror("upd7508: key interrupt\n"); |
| 952 | 952 | |
| 953 | 953 | px4->m_isr |= INT0_7508; |
| 954 | gapnit_interrupt(field-> | |
| 954 | gapnit_interrupt(field-> | |
| 955 | 955 | } |
| 956 | 956 | } |
| 957 | 957 | } |
| r11508 | r11509 | |
| 1320 | 1320 | INPUT_PORTS_END |
| 1321 | 1321 | |
| 1322 | 1322 | /* item keyboard */ |
| 1323 | static INPUT_PORTS_START( px4_h421a ) | |
| 1323 | /*static INPUT_PORTS_START( px4_h421a ) | |
| 1324 | 1324 | PORT_INCLUDE(px4_dips) |
| 1325 | 1325 | PORT_INCLUDE(tf20) |
| 1326 | 1326 | INPUT_PORTS_END |
| 1327 | */ | |
| 1327 | 1328 | |
| 1328 | ||
| 1329 | 1329 | /*************************************************************************** |
| 1330 | 1330 | PALETTE |
| 1331 | 1331 | ***************************************************************************/ |
| r11508 | r11509 | |
|---|---|---|
| 1617 | 1617 | - "Help" is mapped to 'F8' |
| 1618 | 1618 | */ |
| 1619 | 1619 | |
| 1620 | ||
| 1620 | ||
| 1621 | 1621 | { |
| 1622 | 1622 | pc8801_state *state = device->machine().driver_data<pc8801_state>(); |
| 1623 | 1623 | |
| r11508 | r11509 | |
| 1812 | 1812 | PORT_DIPNAME( 0x08, 0x08, "Auto-boot floppy at start-up" ) |
| 1813 | 1813 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1814 | 1814 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1815 | PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE("upd1990a", upd1990a_data_out_r) | |
| 1815 | PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE("upd1990a", upd1990a_data_out_pc88001_r) | |
| 1816 | 1816 | PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_VBLANK ) |
| 1817 | 1817 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1818 | 1818 |
| r11508 | r11509 | |
|---|---|---|
| 65 | 65 | |
| 66 | 66 | static INPUT_CHANGED( trigger_reset ) |
| 67 | 67 | { |
| 68 | cputag_set_input_line(field-> | |
| 68 | cputag_set_input_line(field-> | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | static INPUT_CHANGED( trigger_nmi ) |
| 72 | 72 | { |
| 73 | cputag_set_input_line(field-> | |
| 73 | cputag_set_input_line(field-> | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | static INPUT_PORTS_START( poly880 ) |
| r11508 | r11509 | |
|---|---|---|
| 217 | 217 | |
| 218 | 218 | static INPUT_CHANGED( trigger_reset ) |
| 219 | 219 | { |
| 220 | cputag_set_input_line(field-> | |
| 220 | cputag_set_input_line(field-> | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /*------------------------------------------------- |
| r11508 | r11509 | |
|---|---|---|
| 50 | 50 | |
| 51 | 51 | static INPUT_CHANGED( trigger_reset ) |
| 52 | 52 | { |
| 53 | cputag_set_input_line(field-> | |
| 53 | cputag_set_input_line(field-> | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | static INPUT_CHANGED( trigger_nmi ) |
| 57 | 57 | { |
| 58 | cputag_set_input_line(field-> | |
| 58 | cputag_set_input_line(field-> | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | static INPUT_PORTS_START( lc80 ) |
| r11508 | r11509 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | static INPUT_CHANGED( trigger_reset ) |
| 29 | 29 | { |
| 30 | cputag_set_input_line(field-> | |
| 30 | cputag_set_input_line(field-> | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | static INPUT_CHANGED( trigger_nmi ) |
| 34 | 34 | { |
| 35 | cputag_set_input_line(field-> | |
| 35 | cputag_set_input_line(field-> | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | static INPUT_PORTS_START( c80 ) |
| r11508 | r11509 | |
|---|---|---|
| 965 | 965 | |
| 966 | 966 | static INPUT_CHANGED( fidelz80_trigger_reset ) |
| 967 | 967 | { |
| 968 | fidelz80_state *state = field-> | |
| 968 | fidelz80_state *state = field-> | |
| 969 | 969 | |
| 970 | 970 | device_set_input_line(state->m_maincpu, INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | static INPUT_CHANGED( abc_trigger_reset ) |
| 974 | 974 | { |
| 975 | fidelz80_state *state = field-> | |
| 975 | fidelz80_state *state = field-> | |
| 976 | 976 | |
| 977 | 977 | device_set_input_line(state->m_maincpu, INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); |
| 978 | 978 | device_set_input_line(state->m_i8041, INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); |
| r11508 | r11509 | |
|---|---|---|
| 273 | 273 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CODE(JOYCODE_BUTTON1) |
| 274 | 274 | INPUT_PORTS_END |
| 275 | 275 | |
| 276 | static INPUT_PORTS_START( apple2_paddle ) | |
| 276 | /*static INPUT_PORTS_START( apple2_paddle ) | |
| 277 | 277 | PORT_START("paddle_0") |
| 278 | 278 | PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_NAME("P1 Paddle 0") |
| 279 | 279 | PORT_SENSITIVITY(PADDLE_SENSITIVITY) |
| r11508 | r11509 | |
| 308 | 308 | PORT_MINMAX(0,0xff) PORT_PLAYER(2) |
| 309 | 309 | PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) |
| 310 | 310 | INPUT_PORTS_END |
| 311 | ||
| 311 | */ | |
| 312 | 312 | static INPUT_PORTS_START( apple2_gameport ) |
| 313 | 313 | PORT_INCLUDE( apple2_joystick ) |
| 314 | 314 | //PORT_INCLUDE( apple2_paddle ) |
| r11508 | r11509 | |
|---|---|---|
| 236 | 236 | |
| 237 | 237 | static INPUT_CHANGED( ti68k_on_key ) |
| 238 | 238 | { |
| 239 | ti68k_state *state = field-> | |
| 239 | ti68k_state *state = field-> | |
| 240 | 240 | |
| 241 | 241 | state->m_on_key = newval; |
| 242 | 242 |
| r11508 | r11509 | |
|---|---|---|
| 544 | 544 | PORT_INCLUDE( pcvideo_cga ) |
| 545 | 545 | INPUT_PORTS_END |
| 546 | 546 | |
| 547 | static INPUT_PORTS_START( ibm5150 ) | |
| 548 | PORT_START("IN0") /* IN0 */ | |
| 549 | PORT_BIT ( 0xf0, 0xf0, IPT_UNUSED ) | |
| 550 | PORT_BIT ( 0x08, 0x08, IPT_VBLANK ) | |
| 551 | PORT_BIT ( 0x07, 0x07, IPT_UNUSED ) | |
| 552 | ||
| 553 | PORT_START("DSW0") /* IN1 */ | |
| 554 | PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives") | |
| 555 | PORT_DIPSETTING( 0x00, "1" ) | |
| 556 | PORT_DIPSETTING( 0x40, "2" ) | |
| 557 | PORT_DIPSETTING( 0x80, "3" ) | |
| 558 | PORT_DIPSETTING( 0xc0, "4" ) | |
| 559 | PORT_DIPNAME( 0x30, 0x20, "Graphics adapter") | |
| 560 | PORT_DIPSETTING( 0x00, "EGA/VGA" ) | |
| 561 | PORT_DIPSETTING( 0x10, "Color 40x25" ) | |
| 562 | PORT_DIPSETTING( 0x20, "Color 80x25" ) | |
| 563 | PORT_DIPSETTING( 0x30, "Monochrome" ) | |
| 564 | PORT_DIPNAME( 0x0c, 0x0c, "RAM banks") | |
| 565 | PORT_DIPSETTING( 0x00, "1 - 16 64 256K" ) | |
| 566 | PORT_DIPSETTING( 0x04, "2 - 32 128 512K" ) | |
| 567 | PORT_DIPSETTING( 0x08, "3 - 48 192 576K" ) | |
| 568 | PORT_DIPSETTING( 0x0c, "4 - 64 256 640K" ) | |
| 569 | PORT_DIPNAME( 0x02, 0x00, "80387 installed") | |
| 570 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 571 | PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) | |
| 572 | PORT_DIPNAME( 0x01, 0x01, "Floppy installed") | |
| 573 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 574 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) | |
| 575 | ||
| 576 | PORT_START("DSW1") /* IN2 */ | |
| 577 | PORT_DIPNAME( 0x80, 0x80, "COM1: enable") | |
| 578 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 579 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) | |
| 580 | PORT_DIPNAME( 0x40, 0x40, "COM2: enable") | |
| 581 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 582 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 583 | PORT_DIPNAME( 0x20, 0x00, "COM3: enable") | |
| 584 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 585 | PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) | |
| 586 | PORT_DIPNAME( 0x10, 0x00, "COM4: enable") | |
| 587 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 588 | PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) | |
| 589 | PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") | |
| 590 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 591 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) | |
| 592 | PORT_DIPNAME( 0x04, 0x00, "LPT2: enable") | |
| 593 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 594 | PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) | |
| 595 | PORT_DIPNAME( 0x02, 0x00, "LPT3: enable") | |
| 596 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 597 | PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) | |
| 598 | PORT_DIPNAME( 0x01, 0x00, "Game port enable") | |
| 599 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 600 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) | |
| 601 | ||
| 602 | PORT_START("DSW2") /* IN3 */ | |
| 603 | PORT_DIPNAME( 0xf0, 0x80, "Serial mouse") | |
| 604 | PORT_DIPSETTING( 0x80, "COM1" ) | |
| 605 | PORT_DIPSETTING( 0x40, "COM2" ) | |
| 606 | PORT_DIPSETTING( 0x20, "COM3" ) | |
| 607 | PORT_DIPSETTING( 0x10, "COM4" ) | |
| 608 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) | |
| 609 | PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") | |
| 610 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 611 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) | |
| 612 | PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") | |
| 613 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 614 | PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) | |
| 615 | PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ | |
| 616 | PORT_BIT( 0x01, 0x01, IPT_UNUSED ) | |
| 617 | ||
| 618 | PORT_INCLUDE( kb_keytronic_pc ) /* IN4 - IN11 */ | |
| 619 | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ | |
| 620 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ | |
| 621 | PORT_INCLUDE( pcvideo_cga ) | |
| 622 | INPUT_PORTS_END | |
| 623 | ||
| 624 | 547 | static INPUT_PORTS_START( europc ) |
| 625 | 548 | PORT_START("IN0") /* IN0 */ |
| 626 | 549 | PORT_BIT ( 0xf0, 0xf0, IPT_UNUSED ) |
| r11508 | r11509 | |
| 757 | 680 | PORT_INCLUDE( pcvideo_cga ) |
| 758 | 681 | INPUT_PORTS_END |
| 759 | 682 | |
| 760 | static INPUT_PORTS_START( xtcga ) | |
| 761 | PORT_START("IN0") /* IN0 */ | |
| 762 | PORT_BIT ( 0xf0, 0xf0, IPT_UNUSED ) | |
| 763 | PORT_BIT ( 0x08, 0x08, IPT_VBLANK ) | |
| 764 | PORT_BIT ( 0x07, 0x07, IPT_UNUSED ) | |
| 765 | ||
| 766 | PORT_START("DSW0") /* IN1 */ | |
| 767 | PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives") | |
| 768 | PORT_DIPSETTING( 0x00, "1" ) | |
| 769 | PORT_DIPSETTING( 0x40, "2" ) | |
| 770 | PORT_DIPSETTING( 0x80, "3" ) | |
| 771 | PORT_DIPSETTING( 0xc0, "4" ) | |
| 772 | PORT_DIPNAME( 0x30, 0x20, "Graphics adapter") | |
| 773 | PORT_DIPSETTING( 0x00, "EGA/VGA" ) | |
| 774 | PORT_DIPSETTING( 0x10, "Color 40x25" ) | |
| 775 | PORT_DIPSETTING( 0x20, "Color 80x25" ) | |
| 776 | PORT_DIPSETTING( 0x30, "Monochrome" ) | |
| 777 | PORT_DIPNAME( 0x0c, 0x0c, "RAM banks") | |
| 778 | PORT_DIPSETTING( 0x00, "1 - 16 64 256K" ) | |
| 779 | PORT_DIPSETTING( 0x04, "2 - 32 128 512K" ) | |
| 780 | PORT_DIPSETTING( 0x08, "3 - 48 192 576K" ) | |
| 781 | PORT_DIPSETTING( 0x0c, "4 - 64 256 640K" ) | |
| 782 | PORT_DIPNAME( 0x02, 0x00, "80387 installed") | |
| 783 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 784 | PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) | |
| 785 | PORT_DIPNAME( 0x01, 0x01, "Floppy installed") | |
| 786 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 787 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) | |
| 788 | ||
| 789 | PORT_START("DSW1") /* IN2 */ | |
| 790 | PORT_DIPNAME( 0x80, 0x80, "COM1: enable") | |
| 791 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 792 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) | |
| 793 | PORT_DIPNAME( 0x40, 0x40, "COM2: enable") | |
| 794 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 795 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) | |
| 796 | PORT_DIPNAME( 0x20, 0x00, "COM3: enable") | |
| 797 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 798 | PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) | |
| 799 | PORT_DIPNAME( 0x10, 0x00, "COM4: enable") | |
| 800 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 801 | PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) | |
| 802 | PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") | |
| 803 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 804 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) | |
| 805 | PORT_DIPNAME( 0x04, 0x00, "LPT2: enable") | |
| 806 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 807 | PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) | |
| 808 | PORT_DIPNAME( 0x02, 0x00, "LPT3: enable") | |
| 809 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 810 | PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) | |
| 811 | PORT_DIPNAME( 0x01, 0x00, "Game port enable") | |
| 812 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 813 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) | |
| 814 | ||
| 815 | PORT_START("DSW2") /* IN3 */ | |
| 816 | PORT_DIPNAME( 0xf0, 0x80, "Serial mouse") | |
| 817 | PORT_DIPSETTING( 0x80, "COM1" ) | |
| 818 | PORT_DIPSETTING( 0x40, "COM2" ) | |
| 819 | PORT_DIPSETTING( 0x20, "COM3" ) | |
| 820 | PORT_DIPSETTING( 0x10, "COM4" ) | |
| 821 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) | |
| 822 | PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") | |
| 823 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 824 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) | |
| 825 | PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") | |
| 826 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) | |
| 827 | PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) | |
| 828 | // PORT_DIPNAME( 0x02, 0x02, "Turbo Switch" ) | |
| 829 | // PORT_DIPSETTING( 0x00, "Off (4.77 MHz)" ) | |
| 830 | // PORT_DIPSETTING( 0x02, "On (12 MHz)" ) | |
| 831 | PORT_BIT( 0x01, 0x01, IPT_UNUSED ) | |
| 832 | ||
| 833 | PORT_INCLUDE( pc_keyboard ) /* IN4 - IN11 */ | |
| 834 | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ | |
| 835 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ | |
| 836 | PORT_INCLUDE( pcvideo_cga ) | |
| 837 | INPUT_PORTS_END | |
| 838 | ||
| 839 | 683 | static INPUT_PORTS_START( tandy1t ) |
| 840 | 684 | PORT_START("IN0") /* IN0 */ |
| 841 | 685 | PORT_BIT ( 0xf0, 0xf0, IPT_UNUSED ) |
| r11508 | r11509 | |
|---|---|---|
| 50 | 50 | |
| 51 | 51 | static INPUT_CHANGED( ef_w ) |
| 52 | 52 | { |
| 53 | cputag_set_input_line(field-> | |
| 53 | cputag_set_input_line(field-> | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | static INPUT_PORTS_START( pecom ) |
| r11508 | r11509 | |
|---|---|---|
| 88 | 88 | |
| 89 | 89 | static INPUT_CHANGED( gk_changed ) |
| 90 | 90 | { |
| 91 | device_t *cartsys = field-> | |
| 91 | device_t *cartsys = field-> | |
| 92 | 92 | set_gk_switches(cartsys, (UINT8)((UINT64)param&0x07), newval); |
| 93 | 93 | } |
| 94 | 94 |
| r11508 | r11509 | |
|---|---|---|
| 159 | 159 | |
| 160 | 160 | static INPUT_CHANGED( data ) |
| 161 | 161 | { |
| 162 | cosmicos_state *state = field->port->machine().driver_data<cosmicos_state>(); | |
| 163 | UINT8 data = input_port_read(field->port->machine(), "DATA"); | |
| 162 | cosmicos_state *state = field->machine().driver_data<cosmicos_state>(); | |
| 163 | UINT8 data = input_port_read(field->machine(), "DATA"); | |
| 164 | 164 | int i; |
| 165 | 165 | |
| 166 | 166 | for (i = 0; i < 8; i++) |
| r11508 | r11509 | |
| 175 | 175 | |
| 176 | 176 | static INPUT_CHANGED( enter ) |
| 177 | 177 | { |
| 178 | cosmicos_state *state = field-> | |
| 178 | cosmicos_state *state = field-> | |
| 179 | 179 | |
| 180 | 180 | if (!newval && !state->m_wait && !state->m_clear) |
| 181 | 181 | { |
| 182 | cputag_set_input_line(field-> | |
| 182 | cputag_set_input_line(field-> | |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| r11508 | r11509 | |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | static INPUT_CHANGED( run ) { cosmicos_state *state = field->port->machine().driver_data<cosmicos_state>(); if (!newval) state->set_cdp1802_mode(MODE_RUN); } | |
| 235 | static INPUT_CHANGED( load ) { cosmicos_state *state = field->port->machine().driver_data<cosmicos_state>(); if (!newval) state->set_cdp1802_mode(MODE_LOAD); } | |
| 236 | static INPUT_CHANGED( cosmicos_pause ) { cosmicos_state *state = field->port->machine().driver_data<cosmicos_state>(); if (!newval) state->set_cdp1802_mode(MODE_PAUSE); } | |
| 237 | static INPUT_CHANGED( reset ) { cosmicos_state *state = field->port->machine().driver_data<cosmicos_state>(); if (!newval) state->set_cdp1802_mode(MODE_RESET); } | |
| 234 | static INPUT_CHANGED( run ) { cosmicos_state *state = field->machine().driver_data<cosmicos_state>(); if (!newval) state->set_cdp1802_mode(MODE_RUN); } | |
| 235 | static INPUT_CHANGED( load ) { cosmicos_state *state = field->machine().driver_data<cosmicos_state>(); if (!newval) state->set_cdp1802_mode(MODE_LOAD); } | |
| 236 | static INPUT_CHANGED( cosmicos_pause ) { cosmicos_state *state = field->machine().driver_data<cosmicos_state>(); if (!newval) state->set_cdp1802_mode(MODE_PAUSE); } | |
| 237 | static INPUT_CHANGED( reset ) { cosmicos_state *state = field->machine().driver_data<cosmicos_state>(); if (!newval) state->set_cdp1802_mode(MODE_RESET); } | |
| 238 | 238 | |
| 239 | 239 | void cosmicos_state::clear_input_data() |
| 240 | 240 | { |
| r11508 | r11509 | |
| 250 | 250 | |
| 251 | 251 | static INPUT_CHANGED( clear_data ) |
| 252 | 252 | { |
| 253 | cosmicos_state *state = field-> | |
| 253 | cosmicos_state *state = field-> | |
| 254 | 254 | |
| 255 | 255 | state->clear_input_data(); |
| 256 | 256 | } |
| r11508 | r11509 | |
| 279 | 279 | |
| 280 | 280 | static INPUT_CHANGED( memory_protect ) |
| 281 | 281 | { |
| 282 | cosmicos_state *state = field-> | |
| 282 | cosmicos_state *state = field-> | |
| 283 | 283 | |
| 284 | 284 | state->m_ram_protect = newval; |
| 285 | 285 | |
| r11508 | r11509 | |
| 288 | 288 | |
| 289 | 289 | static INPUT_CHANGED( memory_disable ) |
| 290 | 290 | { |
| 291 | cosmicos_state *state = field-> | |
| 291 | cosmicos_state *state = field-> | |
| 292 | 292 | |
| 293 | 293 | state->m_ram_disable = newval; |
| 294 | 294 |
| r11508 | r11509 | |
|---|---|---|
| 461 | 461 | |
| 462 | 462 | static INPUT_CHANGED( psion_on ) |
| 463 | 463 | { |
| 464 | cpu_device *cpu = field-> | |
| 464 | cpu_device *cpu = field-> | |
| 465 | 465 | |
| 466 | 466 | /* reset the CPU for resume from standby */ |
| 467 | 467 | if (cpu->suspended(SUSPEND_REASON_HALT)) |
| Previous | 15994 Revisions | Next |