static READ8_HANDLER( analog_port_r ) { return input_port_read(space->machine, /* player_mux ? "DIAL2" : */ "DIAL1"); }
static READ8_HANDLER( changela_30_r ) { return input_port_read(space->machine, "WHEEL") & 0x0f; //wheel control (clocked input) signal on bits 3,2,1,0 }
static READ16_HANDLER( dassault_sub_control_r ) { return input_port_read(space->machine(), "VBLANK1"); }
static READ8_HANDLER( ultratnk_analog_r ) { return (input_port_read(space->machine, "ANALOG") << (~offset & 7)) & 0x80; }
static READ8_DEVICE_HANDLER( riot_joystick_r ) { return input_port_read(device->machine(), "joysticks"); }
static INTERRUPT_GEN( bzone_interrupt ) { if (input_port_read(device->machine, "IN0") & 0x10) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); }
static READ8_HANDLER( controller_r ) { beaminv_state *state = space->machine().driver_data<beaminv_state>(); return input_port_read(space->machine(), (state->m_controller_select == 1) ? P1_CONTROL_PORT_TAG : P2_CONTROL_PORT_TAG); }
static READ8_HANDLER( sprint2_dip_r ) { return (input_port_read(space->machine, "DSW") << (2 * ((offset & 3) ^ 3))) & 0xc0; }
static READ16_HANDLER( othunder_lightgun_r ) { static const char *const portname[4] = { P1X_PORT_TAG, P1Y_PORT_TAG, P2X_PORT_TAG, P2Y_PORT_TAG }; return input_port_read(space->machine(), portname[offset]); }
static CUSTOM_INPUT( wolfpack_dial_r ) { int bit = (FPTR)param; return ((input_port_read(field->port->machine, "DIAL") + bit) / 2) & 0x01; }
static READ8_HANDLER( vblank_r ) { return input_port_read(space->machine(), "IN0"); }
static INTERRUPT_GEN( capbowl_interrupt ) { if (input_port_read(device->machine, "SERVICE") & 1) /* get status of the F2 key */ cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); /* trigger self test */ }
static READ16_HANDLER( control_3_r ) { return (input_port_read(space->machine(), "IN2") << 8); }
static READ8_HANDLER( player_inputs_r ) { return input_port_read(space->machine, /* player_mux ? "INPUTS2" : */ "INPUTS1"); }
static READ8_DEVICE_HANDLER( amspdwy_sound_r ) { return (ym2151_status_port_r(device, 0) & ~ 0x30) | input_port_read(device->machine(), "IN0"); }
static READ8_DEVICE_HANDLER( runaway_pot_r ) { return (input_port_read(device->machine, "7000") << (7 - offset)) & 0x80; }
static READ8_DEVICE_HANDLER( p1c_r ) { taxidrvr_state *state = device->machine().driver_data<taxidrvr_state>(); return (state->m_s2 << 7) | (state->m_s4 << 6) | ((input_port_read(device->machine(), "SERVCOIN") & 1) << 4); }
static READ8_HANDLER( omegrace_spinner1_r ) { return (spinnerTable[input_port_read(space->machine(), "SPIN0") & 0x3f]); }
static READ8_DEVICE_HANDLER( redbaron_joy_r ) { return input_port_read(device->machine, rb_input_select ? "FAKE1" : "FAKE2"); }
static READ8_DEVICE_HANDLER(via_b_in) { return input_port_read(device->machine, "IN3"); }
static READ16_HANDLER( joystick_r ) { return (((input_port_read(space->machine, "STICKZ") - 0xf) << 8) | ((input_port_read(space->machine, "STICKY") - 0xf) & 0xff)); }
/* 8741 update */ static void taito8741_update(const address_space *space, int num) { I8741 *st,*sst; int next = num; int data; do{ num = next; st = &taito8741[num]; if( st->connect != -1 ) sst = &taito8741[st->connect]; else sst = 0; next = -1; /* check pending command */ switch(st->phase) { case CMD_08: /* serial data latch */ if( st->serial_out) { st->status &= 0xfb; /* patch for gsword */ st->phase = CMD_IDLE; next = num; /* continue this chip */ } break; case CMD_4a: /* wait for syncronus ? */ if(!st->pending4a) { taito8741_hostdata_w(st,0); st->phase = CMD_IDLE; next = num; /* continue this chip */ } break; case CMD_IDLE: /* ----- data in port check ----- */ data = taito8741_hostdata_r(st); if( data != -1 ) { switch(st->mode) { case TAITO8741_MASTER: case TAITO8741_SLAVE: /* buffering transmit data */ if( st->txpoint < 8 ) { //if (st->txpoint == 0 && num==1 && data&0x80) logerror("Coin Put\n"); st->txd[st->txpoint++] = data; } break; case TAITO8741_PORT: if( data & 0xf8) { /* ?? */ } else { /* port select */ st->parallelselect = data & 0x07; taito8741_hostdata_w(st,st->portHandler ? st->portHandler(space,st->parallelselect) : st->portName ? input_port_read(space->machine, st->portName) : 0); } } } /* ----- new command fetch ----- */ data = taito8741_hostcmd_r(st); switch( data ) { case -1: /* no command data */ break; case 0x00: /* read from parallel port */ taito8741_hostdata_w(st,st->portHandler ? st->portHandler(space,0) : st->portName ? input_port_read(space->machine, st->portName) : 0 ); break; case 0x01: /* read receive buffer 0 */ case 0x02: /* read receive buffer 1 */ case 0x03: /* read receive buffer 2 */ case 0x04: /* read receive buffer 3 */ case 0x05: /* read receive buffer 4 */ case 0x06: /* read receive buffer 5 */ case 0x07: /* read receive buffer 6 */ //if (data == 2 && num==0 && st->rxd[data-1]&0x80) logerror("Coin Get\n"); taito8741_hostdata_w(st,st->rxd[data-1]); break; case 0x08: /* latch received serial data */ st->txd[0] = st->portHandler ? st->portHandler(space,0) : st->portName ? input_port_read(space->machine, st->portName) : 0; if( sst ) { timer_call_after_resynch(space->machine, NULL, num, taito8741_serial_tx); st->serial_out = 0; st->status |= 0x04; st->phase = CMD_08; } break; case 0x0a: /* 8741-0 : set serial comminucation mode 'MASTER' */ //st->mode = TAITO8741_MASTER; break; case 0x0b: /* 8741-1 : set serial comminucation mode 'SLAVE' */ //st->mode = TAITO8741_SLAVE; break; case 0x1f: /* 8741-2,3 : ?? set parallelport mode ?? */ case 0x3f: /* 8741-2,3 : ?? set parallelport mode ?? */ case 0xe1: /* 8741-2,3 : ?? set parallelport mode ?? */ st->mode = TAITO8741_PORT; st->parallelselect = 1; /* preset read number */ break; case 0x62: /* 8741-3 : ? */ break; case 0x4a: /* ?? syncronus with other cpu and return 00H */ if( sst ) { if(sst->pending4a) { sst->pending4a = 0; /* syncronus */ taito8741_hostdata_w(st,0); /* return for host */ next = st->connect; } else st->phase = CMD_4a; } break; case 0x80: /* 8741-3 : return check code */ taito8741_hostdata_w(st,0x66); break; case 0x81: /* 8741-2 : return check code */ taito8741_hostdata_w(st,0x48); break; case 0xf0: /* GSWORD 8741-1 : initialize ?? */ break; case 0x82: /* GSWORD 8741-2 unknown */ break; } break; } }while(next>=0); }
static READ8_HANDLER( ultratnk_collision_r ) { return (input_port_read(space->machine, "COLLISION") << (~offset & 7)) & 0x80; }
/* read data port */ static int I8741_data_r(const address_space *space, int num) { I8741 *st = &taito8741[num]; int ret = st->toData; st->status &= 0xfe; LOG(("%s:8741-%d DATA Read %02x\n",cpuexec_describe_context(space->machine),num,ret)); /* update chip */ taito8741_update(space, num); switch( st->mode ) { case TAITO8741_PORT: /* parallel data */ taito8741_hostdata_w(st,st->portHandler ? st->portHandler(space, st->parallelselect) : st->portName ? input_port_read(space->machine, st->portName) : 0); break; } return ret; }
static READ8_DEVICE_HANDLER( riot_console_button_r ) { return input_port_read(device->machine(), "console_buttons"); }
static void josvolly_8741_w(const address_space *space, int num, int offset, int data) { JV8741 *mcu = &i8741[num]; if(offset==1) { LOG(("%s:8741[%d] CW %02X\n", cpuexec_describe_context(space->machine), num, data)); /* read pointer */ mcu->cmd = data; /* CMD */ switch(data) { case 0: mcu->txd = data ^ 0x40; mcu->sts |= 0x02; break; case 1: mcu->txd = data ^ 0x40; mcu->sts |= 0x02; #if 1 /* ?? */ mcu->rxd = 0; /* SBSTS ( DIAG ) , killed */ mcu->sts |= 0x01; /* RD ready */ #endif break; case 2: #if 1 mcu->rxd = input_port_read(space->machine, "DSW2"); mcu->sts |= 0x01; /* RD ready */ #endif break; case 3: /* normal mode ? */ break; case 0xf0: /* clear main sts ? */ mcu->txd = data ^ 0x40; mcu->sts |= 0x02; break; } } else { /* data */ LOG(("%s:8741[%d] DW %02X\n", cpuexec_describe_context(space->machine), num, data)); mcu->txd = data ^ 0x40; /* parity reverce ? */ mcu->sts |= 0x02; /* TXD busy */ #if 1 /* interrupt ? */ if(num == 0) { if(josvolly_nmi_enable) { cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); josvolly_nmi_enable = 0; } } #endif } josvolly_8741_do(space->machine, num); }
static READ8_HANDLER( changela_68705_port_b_r ) { changela_state *state = (changela_state *)space->machine->driver_data; return (state->port_b_out & state->ddr_b) | (input_port_read(space->machine, "MCU") & ~state->ddr_b); }
static READ8_HANDLER( circus_paddle_r ) { // also clears irq cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); return input_port_read(space->machine, "PADDLE"); }
static READ16_HANDLER( rlt_io_r ) { rltennis_state *state = space->machine().driver_data<rltennis_state>(); return (input_port_read(space->machine(), "P1" )&0x1fff) | (state->m_unk_counter<<13); /* top 3 bits controls smaple address update */ }
static WRITE16_HANDLER( a2d_select_w ) { static const char *const portnames[] = { "A2D0", "A2D1" }; analog_data = input_port_read(space->machine, portnames[offset != 0]); }