Previous 199869 Revisions Next

r23727 Saturday 15th June, 2013 at 18:04:29 UTC by Fabio Priuli
(MESS) nes.c: emulated microphone input for old famicom controller,
as detected by games (i.e. it only detects voice/no voice, while the actual
transmission of your voice to the speakers is not emulated). To use it in
games expecting you to blow or shout in the mic, select the "Gamepad
(Older Version)" as "P2 Controller" in the Driver Configuration submenu,
and press "6" when the game requires it. [Fabio Priuli]

input is recognized both by BASIC (peeking at $4016) and by Raid on Bungeling Bay 2P mode, so I think it's correct...
[src/mess/drivers]nes.c
[src/mess/includes]nes.h
[src/mess/machine]nes.c

trunk/src/mess/machine/nes.c
r23726r23727
5151   m_paddle_btn_latch = 0;
5252}
5353
54static void nes_state_register( running_machine &machine )
54void nes_state::state_register()
5555{
56   nes_state *state = machine.driver_data<nes_state>();
56   save_item(NAME(m_last_frame_flip));
5757
58   state->save_item(NAME(state->m_last_frame_flip));
58   save_item(NAME(m_fds_motor_on));
59   save_item(NAME(m_fds_door_closed));
60   save_item(NAME(m_fds_current_side));
61   save_item(NAME(m_fds_head_position));
62   save_item(NAME(m_fds_status0));
63   save_item(NAME(m_fds_read_mode));
64   save_item(NAME(m_fds_write_reg));
65   save_item(NAME(m_fds_last_side));
66   save_item(NAME(m_fds_count));
67   save_item(NAME(m_fds_mirroring));
5968
60   state->save_item(NAME(state->m_fds_motor_on));
61   state->save_item(NAME(state->m_fds_door_closed));
62   state->save_item(NAME(state->m_fds_current_side));
63   state->save_item(NAME(state->m_fds_head_position));
64   state->save_item(NAME(state->m_fds_status0));
65   state->save_item(NAME(state->m_fds_read_mode));
66   state->save_item(NAME(state->m_fds_write_reg));
67   state->save_item(NAME(state->m_fds_last_side));
68   state->save_item(NAME(state->m_fds_count));
69   state->save_item(NAME(state->m_fds_mirroring));
69   save_pointer(NAME(m_ciram), 0x800);
7070
71   state->save_pointer(NAME(state->m_ciram), 0x800);
71   if (m_disk_expansion)
72      save_pointer(NAME(m_vram), 0x800);
7273
73   if (state->m_disk_expansion)
74      state->save_pointer(NAME(state->m_vram), 0x800);
75
76   state->save_item(NAME(state->m_pad_latch));
77   state->save_item(NAME(state->m_zapper_latch));
78   state->save_item(NAME(state->m_paddle_latch));
79   state->save_item(NAME(state->m_paddle_btn_latch));
80   state->save_item(NAME(state->m_mjpanel_latch));
74   save_item(NAME(m_pad_latch));
75   save_item(NAME(m_zapper_latch));
76   save_item(NAME(m_paddle_latch));
77   save_item(NAME(m_paddle_btn_latch));
78   save_item(NAME(m_mjpanel_latch));
79   save_item(NAME(m_fck_scan));
80   save_item(NAME(m_fck_mode));
81   save_item(NAME(m_mic_obstruct));
8182}
8283
8384
r23726r23727
197198      membank("fdsram")->set_base(m_fds_ram);
198199   }
199200
200   nes_state_register(machine());
201   state_register();
201202}
202203
203204
r23726r23727
374375
375376READ8_MEMBER(nes_state::fc_in0_r)
376377{
378   int cfg = m_io_ctrlsel->read();
377379   int exp = m_io_exp->read();
378380   
379381   // Some games expect bit 6 to be set because the last entry on the data bus shows up
r23726r23727
383385   
384386   // shift
385387   m_pad_latch[0] >>= 1;
386   
388
389   // microphone bit
390   if ((cfg & 0x00f0) == 0x00f0)
391      ret |= m_mic_obstruct;   //bit2!
392
387393   // EXP input
388394   switch (exp & 0x0f)
389395   {         
r23726r23727
542548   m_paddle_btn_latch = 0;
543549   m_paddle_latch = 0;
544550   m_mjpanel_latch = 0;
551   m_mic_obstruct = 0;
545552   
546553   // P1 inputs
547554   switch (cfg & 0x000f)
r23726r23727
566573         m_pad_latch[1] = m_io_cc_right->read();
567574         break;
568575
576      case 0x0f:  // pad 2 old style with microphone instead of START/SELECT keys
577         // we only emulate obstruction of mic (when you blow or talk into it)
578         m_mic_obstruct = m_io_pad[1]->read() & 0x04;
579         m_pad_latch[1] = (m_io_pad[1]->read() & ~0x04);
580         break;
569581   }
570582   
571583   // P3 & P4 inputs in Famicom (e.g. through Hori Twin Adapter or Hori 4 Players Adapter)
trunk/src/mess/includes/nes.h
r23726r23727
512512   DECLARE_READ8_MEMBER(psg_4015_r);
513513   DECLARE_WRITE8_MEMBER(psg_4015_w);
514514   DECLARE_WRITE8_MEMBER(psg_4017_w);
515   void state_register();
515516
516517   /***** FDS-floppy related *****/
517518
r23726r23727
551552
552553   void fds_irq(int scanline, int vblank, int blanked);
553554   
555   // input related
554556   UINT32 m_pad_latch[4];
555557   UINT8 m_zapper_latch[2][3];
556558   UINT8 m_paddle_latch, m_paddle_btn_latch;
557559   UINT8 m_mjpanel_latch;
558560   UINT8 m_fck_scan, m_fck_mode;
561   UINT8 m_mic_obstruct;
559562
560563protected:
561564   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
trunk/src/mess/drivers/nes.c
r23726r23727
184184   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
185185   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
186186   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
187   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 A") PORT_PLAYER(2)  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
188   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 B") PORT_PLAYER(2)  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
189   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Microphone") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
190   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )                                    PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
191   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)                PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
192   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
193   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
194   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
187195
188196INPUT_PORTS_END
189197
r23726r23727
523531   PORT_CONFSETTING(  0x0000, "Unconnected" )
524532   PORT_CONFSETTING(  0x0010, "Gamepad" )
525533   PORT_CONFSETTING(  0x0020, "Crazy Climber pad (Right)" )
534   PORT_CONFSETTING(  0x00f0, "Gamepad (Older Version)" )
526535   PORT_CONFNAME( 0x0f00, 0x0000, "P3 Controller") PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
527536   PORT_CONFSETTING(  0x0000, "Unconnected" )
528537   PORT_CONFSETTING(  0x0100, "Gamepad" )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team