DRIVER_INIT_MEMBER(pmd85_state,mato) { m_model = MATO; update_memory = &pmd85_state::mato_update_memory; static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", "KEY8" }; for ( int i = 0; i < 9; i++ ) { m_io_port[i] = ioport( keynames[i] ); } for ( int i = 9; i < 16; i++ ) { m_io_port[i] = NULL; } }
ADDRESS_MAP_END /* Input Ports */ INPUT_CHANGED_MEMBER( cosmicos_state::data ) { UINT8 data = ioport("DATA")->read(); int i; for (i = 0; i < 8; i++) { if (!BIT(data, i)) { m_data |= (1 << i); output_set_led_value(LED_D0 - i, 1); } } }
UINT8 mecmouse_device::read_dev() { int answer; int buttons = ioport("MOUSE0")->read() & 3; answer = (m_read_y_axis? m_y_buf : m_x_buf) << 1; if ((buttons & 1)==0) /* action button */ answer |= 0x01; if ((buttons & 2)==0) /* home button */ answer |= 0x10; // answer: |0|0|0|B2|V|V|V|B1| return answer; }
void mgolf_state::update_plunger( ) { UINT8 val = ioport("BUTTON")->read(); if (m_prev != val) { if (val == 0) { m_time_released = machine().time(); if (!m_mask) m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } else m_time_pushed = machine().time(); m_prev = val; } }
ADDRESS_MAP_END //************************************************************************** // INPUT PORTS //************************************************************************** //------------------------------------------------- // INPUT_CHANGED( comx35_reset ) //------------------------------------------------- INPUT_CHANGED_MEMBER( comx35_state::trigger_reset ) { if (newval && BIT(ioport("D6")->read(), 7)) { machine_reset(); } }
void videopin_state::update_plunger() { UINT8 val = ioport("IN2")->read(); if (m_prev != val) { if (val == 0) { m_time_released = machine().time(); if (!m_mask) m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } else m_time_pushed = machine().time(); m_prev = val; } }
int sprint2_state::service_mode() { uint8_t v = ioport("INB")->read(); if (MACHINE_IS_SPRINT1) { return (v & 0x10) == 0; } if (MACHINE_IS_SPRINT2) { return (v & 0x04) == 0; } if (MACHINE_IS_DOMINOS) { return (v & 0x40) == 0; } return 0; }
void xyonix_state::handle_coins(int coin) { static const int coinage_table[4][2] = {{2,3},{2,1},{1,2},{1,1}}; int tmp = 0; //popmessage("Coin %d", m_coin); if (coin & 1) // Coin 2 ! { tmp = (ioport("DSW")->read() & 0xc0) >> 6; m_coins++; if (m_coins >= coinage_table[tmp][0]) { m_credits += coinage_table[tmp][1]; m_coins -= coinage_table[tmp][0]; } coin_lockout_global_w(machine(), 0); /* Unlock all coin slots */ coin_counter_w(machine(),1,1); coin_counter_w(machine(),1,0); /* Count slot B */ }
/* Variation for TI-99/8 */ int mecmouse_device::get_values8(int mode) { int answer; int buttons = ioport("MOUSE0")->read() & 3; if (mode == 0) { answer = ((m_read_y ? m_y_buf : m_x_buf) << 7) & 0x80; if ((buttons & 1)==0) /* action button */ answer |= 0x40; } else { answer = ((m_read_y ? m_y_buf : m_x_buf) << 1) & 0x03; if ((buttons & 2)==0) /* home button */ answer |= 0x04; } return answer; }
uint8_t speedatk_state::iox_key_matrix_calc(uint8_t p_side) { static const char *const keynames[] = { "P1_ROW0", "P1_ROW1", "P2_ROW0", "P2_ROW1" }; int i, j, t; for (i = 0x00 ; i < 0x10 ; i += 8) { j = (i / 0x08); for (t = 0 ; t < 8 ; t ++) { if (!(ioport(keynames[j+p_side])->read() & ( 1 << t ))) { return (i + t) | (p_side ? 0x20 : 0x00); } } } return 0; }
UINT8 mayumi_state::key_matrix_r(UINT8 offset) { int p, i, ret; static const char *const keynames[2][5] = { { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" }, { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" } }; ret = 0xff; p = ~m_input_sel & 0x1f; for (i = 0; i < 5; i++) { if (BIT(p, i)) ret &= ioport(keynames[offset][i])->read(); } return ret; }
void mexico86_state::machine_reset() { /*TODO: check the PCB and see how the halt / reset lines are connected. */ if (m_subcpu != NULL) m_subcpu->set_input_line(INPUT_LINE_RESET, (ioport("DSW1")->read() & 0x80) ? ASSERT_LINE : CLEAR_LINE); m_port_a_in = 0; m_port_a_out = 0; m_ddr_a = 0; m_port_b_in = 0; m_port_b_out = 0; m_ddr_b = 0; m_address = 0; m_latch = 0; m_mcu_running = 0; m_mcu_initialised = 0; m_coin_last = 0; m_charbank = 0; }
void mie_device::device_start() { maple_device::device_start(); cpu = subdevice<z80_device>("mie"); timer = timer_alloc(0); jvs = machine().device<mie_jvs_device>(jvs_name); for (int i = 0; i < ARRAY_LENGTH(gpio_name); i++) { gpio_port[i] = gpio_name[i] ? ioport(gpio_name[i]) : nullptr; } save_item(NAME(gpiodir)); save_item(NAME(gpio_val)); save_item(NAME(irq_enable)); save_item(NAME(irq_pending)); save_item(NAME(maple_irqlevel)); // patch out MIE RAM test // TODO: figure out why SH4 code doesn't wait long enough for internal firmware's RAM test completed in the case of reset uint32_t *rom = (uint32_t*)memregion("mie")->base(); rom[0x144/4] = 0x0001d8c3; }
void horizon_ramdisk_device::nvram_read(emu_file &file) { int size = 2097152*(1 << ioport("HORIZONSIZE")->read()); // NVRAM plus ROS uint8_t* buffer = global_alloc_array_clear<uint8_t>(MAXSIZE + ROSSIZE); memset(m_nvram->pointer(), 0, size); memset(m_ros->pointer(), 0, ROSSIZE); // We assume the last 8K is ROS int filesize = file.read(buffer, MAXSIZE+ROSSIZE); int nvramsize = filesize - ROSSIZE; // If there is a reasonable size if (nvramsize >= 0) { // Copy from buffer to NVRAM and ROS memcpy(m_nvram->pointer(), buffer, nvramsize); memcpy(m_ros->pointer(), buffer + nvramsize, ROSSIZE); } global_free_array(buffer); }
/* 16x16 tiles, 4 Planes, each plane is 0x10000 bytes */ static const gfx_layout tiles = { 16,16, 2048, 4, { 0x30000*8,0x00000*8,0x10000*8,0x20000*8 }, { 16*8, 1+(16*8), 2+(16*8), 3+(16*8), 4+(16*8), 5+(16*8), 6+(16*8), 7+(16*8), 0,1,2,3,4,5,6,7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 ,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8}, 16*16 }; static GFXDECODE_START( karnov ) GFXDECODE_ENTRY( "gfx1", 0, chars, 0, 4 ) /* colors 0-31 */ GFXDECODE_ENTRY( "gfx2", 0, tiles, 512, 16 ) /* colors 512-767 */ GFXDECODE_ENTRY( "gfx3", 0, sprites, 256, 16 ) /* colors 256-511 */ GFXDECODE_END /************************************* * * Interrupt generator * *************************************/ INTERRUPT_GEN_MEMBER(karnov_state::karnov_interrupt) { UINT8 port = ioport("FAKE")->read(); /* Coin input to the i8751 generates an interrupt to the main cpu */ if (port == m_coin_mask) m_latch = 1; if (port != m_coin_mask && m_latch) { if (m_i8751_needs_ack) { /* i8751 is busy - queue the command */ m_i8751_coin_pending = port | 0x8000; } else { m_i8751_return = port | 0x8000; device.execute().set_input_line(6, HOLD_LINE); m_i8751_needs_ack = 1; } m_latch = 0; } device.execute().set_input_line(7, HOLD_LINE); /* VBL */ }
void ti_pcode_card_device::device_reset() { if (m_genmod) { m_select_mask = 0x1fe000; m_select_value = 0x174000; } else { m_select_mask = 0x7e000; m_select_value = 0x74000; } m_bank_select = 1; m_selected = false; m_clock_count = 0; m_clockhigh = false; m_active = ioport(ACTIVE_TAG)->read(); m_isrom0 = false; m_isrom12 = false; m_isgrom = false; m_address = 0; }
void amu880_state::scan_keyboard() { static const char *const keynames[] = { "Y0", "Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7", "Y8", "Y9", "Y10", "Y11", "Y12", "Y13", "Y14", "Y15" }; UINT8 data = ioport(keynames[m_key_a8 ? m_key_d6 : m_key_d7])->read(); int a8 = (data & 0x0f) == 0x0f; if (m_key_a8 && !a8) { m_key_d7 = m_key_d6; m_key_a4 = !(BIT(data, 1) && BIT(data, 3)); m_key_a5 = !(BIT(data, 2) && BIT(data, 3)); } m_key_a8 = a8; m_key_d6++; if (m_key_d6 == 16) { m_key_d6 = 0; } }
void luxor_55_21046_device::abcbus_cs(UINT8 data) { m_cs = (data == ioport("SW3")->read()); }
void horizon_ramdisk_device::nvram_default() { int size = 2097152*(1 << ioport("HORIZONSIZE")->read()); memset(m_nvram->pointer(), 0, size); memset(m_ros->pointer(), 0, ROSSIZE); }
void nbmj8891_state::nbmj8891_gfxdraw() { UINT8 *GFX = memregion("gfx1")->base(); int width = machine().primary_screen->width(); int x, y; int dx1, dx2, dy1, dy2; int startx, starty; int sizex, sizey; int skipx, skipy; int ctrx, ctry; UINT8 color, color1, color2; int gfxaddr, gfxlen; nb1413m3_busyctr = 0; startx = m_blitter_destx + m_blitter_sizex; starty = m_blitter_desty + m_blitter_sizey; if (m_blitter_direction_x) { sizex = m_blitter_sizex ^ 0xff; skipx = 1; } else { sizex = m_blitter_sizex; skipx = -1; } if (m_blitter_direction_y) { sizey = m_blitter_sizey ^ 0xff; skipy = 1; } else { sizey = m_blitter_sizey; skipy = -1; } gfxlen = memregion("gfx1")->bytes(); gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1); for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) { for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) { if ((gfxaddr > (gfxlen - 1))) { #ifdef MAME_DEBUG popmessage("GFXROM ADDRESS OVER!!"); #endif gfxaddr &= (gfxlen - 1); } color = GFX[gfxaddr++]; // for hanamomo font type if (nb1413m3_type == NB1413M3_HANAMOMO) { if ((ioport("FONTTYPE")->read()) == 0x00) { if ((gfxaddr >= 0x20000) && (gfxaddr < 0x28000)) { color |= ((color & 0x0f) << 4); } } } dx1 = (2 * x + 0) & 0x1ff; dx2 = (2 * x + 1) & 0x1ff; if (m_gfxdraw_mode) { // 2 layer type dy1 = y & 0xff; dy2 = (y + m_scrolly) & 0xff; } else { // 1 layer type dy1 = (y + m_scrolly) & 0xff; dy2 = 0; } if (!m_flipscreen) { dx1 ^= 0x1ff; dx2 ^= 0x1ff; dy1 ^= 0xff; dy2 ^= 0xff; } if (m_blitter_direction_x) { // flip color1 = (color & 0x0f) >> 0; color2 = (color & 0xf0) >> 4; } else { // normal color1 = (color & 0xf0) >> 4; color2 = (color & 0x0f) >> 0; } color1 = m_clut[((m_clutsel & 0x7f) << 4) + color1]; color2 = m_clut[((m_clutsel & 0x7f) << 4) + color2]; if ((!m_gfxdraw_mode) || (m_vram & 0x01)) { // layer 1 if (color1 != 0xff) { m_videoram0[(dy1 * width) + dx1] = color1; update_pixel0(dx1, dy1); } if (color2 != 0xff) { m_videoram0[(dy1 * width) + dx2] = color2; update_pixel0(dx2, dy1); } } if (m_gfxdraw_mode && (m_vram & 0x02)) { // layer 2 if (m_vram & 0x08) { // transparent enable if (color1 != 0xff) { m_videoram1[(dy2 * width) + dx1] = color1; update_pixel1(dx1, dy2); } if (color2 != 0xff) { m_videoram1[(dy2 * width) + dx2] = color2; update_pixel1(dx2, dy2); } } else { // transparent disable m_videoram1[(dy2 * width) + dx1] = color1; update_pixel1(dx1, dy2); m_videoram1[(dy2 * width) + dx2] = color2; update_pixel1(dx2, dy2); } } nb1413m3_busyctr++; } }
void ssystem3_state::ssystem3_playfield_read(int *on, int *ready) { *on=!(ioport("Configuration")->read()&1); // *on=!m_playfield.on; *ready=FALSE; }
void k7659_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { UINT8 retVal = 0;//m_lookup; UINT8 a1 = ioport("A1")->read(); UINT8 a2 = ioport("A2")->read(); UINT8 a3 = ioport("A3")->read(); UINT8 a4 = ioport("A4")->read(); UINT8 a5 = ioport("A5")->read(); UINT8 a6 = ioport("A6")->read(); UINT8 a7 = ioport("A7")->read(); UINT8 a8 = ioport("A8")->read(); UINT8 a9 = ioport("A9")->read(); UINT8 a10 = ioport("A10")->read(); UINT8 a11 = ioport("A11")->read(); UINT8 a12 = ioport("A12")->read(); UINT16 code = 0; if (a1) code = 0x10 + key_pos(a1); else if (a2) code = 0x20 + key_pos(a2); else if (a3) code = 0x30 + key_pos(a3); else if (a4) code = 0x40 + key_pos(a4); else if (a5) code = 0x50 + key_pos(a5); else if (a6) code = 0x60 + key_pos(a6); else if (a7) code = 0x70 + key_pos(a7); else if (a9) code = 0x80 + key_pos(a9); else if (a10) code = 0x90 + key_pos(a10); else if (a11) code = 0xA0 + key_pos(a11); if (code) { if (BIT(a8,6) || BIT(a8,7)) code |= 0x100; else if (BIT(a12,6)) code |= 0x200; m_lookup = m_p_rom[code]; retVal = m_lookup | 0x80; } m_key = retVal; }
void sacstate_state::machine_reset() { m_term_data = 0; m_val = ioport("CONFIG")->read(); }
int horizon_ramdisk_device::get_size() { int size = 8192 + 2097152*(1 << ioport("HORIZONSIZE")->read()); if (VERBOSE>2) LOG("horizon: size = %d\n", size); return size; }
INPUT_PORTS_END /* Not a real interrupt - just handle keyboard input */ INTERRUPT_GEN_MEMBER(apexc_state::apexc_interrupt) { address_space& space = m_maincpu->space(AS_PROGRAM); UINT32 edit_keys; int control_keys; int control_transitions; /* read new state of edit keys */ edit_keys = ioport("data")->read(); /* toggle data reg according to transitions */ m_panel_data_reg ^= edit_keys & (~m_old_edit_keys); /* remember new state of edit keys */ m_old_edit_keys = edit_keys; /* read new state of control keys */ control_keys = ioport("panel")->read(); /* compute transitions */ control_transitions = control_keys & (~m_old_control_keys); /* process commands */ if (control_transitions & panel_run) { /* toggle run/stop state */ device.state().set_state_int(APEXC_STATE, ! device.state().state_int(APEXC_STATE)); } while (control_transitions & (panel_CR | panel_A | panel_R | panel_ML | panel_HB)) { /* read/write a register */ /* note that we must take into account the possibility of simulteanous keypresses (which would be a goofy thing to do when reading, but a normal one when writing, if the user wants to clear several registers at once) */ int reg_id = -1; /* determinate value of reg_id */ if (control_transitions & panel_CR) { /* CR register selected ? */ control_transitions &= ~panel_CR; /* clear so that it is ignored on next iteration */ reg_id = APEXC_CR; /* matching register ID */ } else if (control_transitions & panel_A) { control_transitions &= ~panel_A; reg_id = APEXC_A; } else if (control_transitions & panel_R) { control_transitions &= ~panel_R; reg_id = APEXC_R; } else if (control_transitions & panel_HB) { control_transitions &= ~panel_HB; reg_id = APEXC_WS; } else if (control_transitions & panel_ML) { control_transitions &= ~panel_ML; reg_id = APEXC_ML; } if (-1 != reg_id) { /* read/write register #reg_id */ if (control_keys & panel_write) /* write reg */ device.state().set_state_int(reg_id, m_panel_data_reg); else /* read reg */ m_panel_data_reg = device.state().state_int(reg_id); } } if (control_transitions & panel_mem) { /* read/write memory */ if (control_keys & panel_write) { /* write memory */ space.write_dword(device.state().state_int(APEXC_ML_FULL)<<2, m_panel_data_reg); } else { /* read memory */ m_panel_data_reg = space.read_dword(device.state().state_int(APEXC_ML_FULL)<<2); } } /* remember new state of control keys */ m_old_control_keys = control_keys; }
uint8_t pce_common_state::joy_read() { return ioport("JOY")->read(); }
inline void exidy_state::latch_condition(int collision) { collision ^= m_collision_invert; m_int_condition = (ioport("INTSOURCE")->read() & ~0x1c) | (collision & m_collision_mask); }
ADDRESS_MAP_END READ8_MEMBER(spool99_state::vcarn_io_r) { UINT8 *ROM = memregion("maincpu")->base(); // if(!(io_switch)) { switch(offset+0xa700) { case 0xa720: return ioport("SERVICE1")->read();//attract mode case 0xa722: return ioport("COIN1")->read(); case 0xa723: return ioport("COIN2")->read(); case 0xa724: return ioport("SERVICE2")->read();//attract mode case 0xa725: return ioport("HOLD3")->read(); case 0xa726: return ioport("HOLD4")->read(); case 0xa727: return ioport("HOLD2")->read(); case 0xa780: return m_oki->read(space,0); case 0xa7a0: return ioport("HOLD1")->read(); case 0xa7a1: return ioport("HOLD5")->read(); case 0xa7a2: return ioport("START")->read(); case 0xa7a3: return ioport("BET")->read();//system 2 case 0xa7a7: return m_eeprom->read_bit(); } } // printf("%04x\n",offset+0xa700); return ROM[0xa700+offset]; }
UINT8 generic_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) { static const char *const keynames[] = { "TERM_LINE0", "TERM_LINE1", "TERM_LINE2", "TERM_LINE3", "TERM_LINE4", "TERM_LINE5", "TERM_LINE6", "TERM_LINE7" }; int i; UINT8 code; UINT8 key_code = 0; UINT8 retVal = 0; UINT8 shift = BIT(ioport("TERM_LINEC")->read(), 1); UINT8 caps = BIT(ioport("TERM_LINEC")->read(), 2); UINT8 ctrl = BIT(ioport("TERM_LINEC")->read(), 0); i = *scan_line; { code = ioport(keynames[i])->read(); if (code != 0) { if (i==0 && shift==0) { key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs } if (i==0 && shift==1) { key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers } if (i==1 && shift==0) { if (row_number(code) < 4) { key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs } else { key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs } } if (i==1 && shift==1) { if (row_number(code) < 4) { key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs } else { key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs } } if (i>=2 && i<=4 && (shift ^ caps)==0 && ctrl==0) { key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters } if (i>=2 && i<=4 && (shift ^ caps)==1 && ctrl==0) { key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters } if (i>=2 && i<=4 && ctrl==1) { key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters } if (i==5 && shift==1 && ctrl==0) { if (row_number(code)<7) { if (row_number(code)<3) { key_code = (caps ? 0x60 : 0x40) + row_number(code) + (i-2)*8; // for big letters } else { key_code = 0x60 + row_number(code) + (i-2)*8; // for upper symbols letters } } else { key_code = 0x40 + row_number(code) + (i-2)*8; // for DEL it is switched } } if (i==5 && shift==0 && ctrl==0) { if (row_number(code)<7) { if (row_number(code)<3) { key_code = (caps ? 0x40 : 0x60) + row_number(code) + (i-2)*8; // for small letters } else { key_code = 0x40 + row_number(code) + (i-2)*8; // for lower symbols letters } } else { key_code = 0x60 + row_number(code) + (i-2)*8; // for DEL it is switched } } if (i==5 && shift==1 && ctrl==1) { key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl } if (i==6) { switch(row_number(code)) { /* case 0: key_code = 0x11; break; case 1: key_code = 0x12; break; case 2: key_code = 0x13; break; case 3: key_code = 0x14; break;*/ case 4: key_code = 0x20; break; // Space case 5: key_code = 0x0A; break; // LineFeed case 6: key_code = 0x09; break; // TAB case 7: key_code = 0x0D; break; // Enter } } if (i==7) { switch(row_number(code)) { case 0: key_code = 0x1B; break; // Escape case 1: key_code = 0x08; break; // Backspace } } retVal = key_code; } else { *scan_line += 1; if (*scan_line==8) { *scan_line = 0; } } } return retVal; }
void c64_switchable_8k_cartridge_device::device_reset() { m_bank = ioport("SW")->read(); }