Previous 15994 Revisions Next

r3417 Wednesday 8th October, 2008 at 16:57:17 UTC by Fabio Priuli
[GAMEGEAR] Fixed bug #1331
[src/mess/drivers]sms.c
[src/mess/machine]sms.c

src/mess/machine/sms.c
r3416r3417
129129   /* Player 1 */
130130   switch( input_port_read(machine, "CTRLSEL") & 0x0F ) {
131131   case 0x00:  /* Joystick */
132      data = input_port_read(machine, "JOY0");
132      data = input_port_read(machine, "PORT_DC");
133133      /* Rapid Fire setting for Button A */
134134      if ( input_port_read(machine, "RFU") & 0x01 ) {
135135         data = ( data & 0xEF ) | ( rapid_fire_state_1 & 0x10 );
r3416r3417
149149         data = data >> 4;
150150      }
151151      sms_input_port0 = ( sms_input_port0 & 0xC0 ) | ( data & 0x0F ) | ( paddle_read_state & 0x20 )
152                      | ( ( input_port_read(machine, "IN0") & 0x02 ) << 3 );
152                      | ( ( input_port_read(machine, "CTRLIPT") & 0x02 ) << 3 );
153153      break;
154154   case 0x03:   /* Sega Sports Pad */
155155      switch( sports_pad_state_1 ) {
r3416r3417
166166         data = sports_pad_1_y & 0x0F;
167167         break;
168168      }
169      sms_input_port0 = ( sms_input_port0 & 0xC0 ) | data | ( ( input_port_read(machine, "IN0") & 0x0C ) << 2 );
169      sms_input_port0 = ( sms_input_port0 & 0xC0 ) | data | ( ( input_port_read(machine, "CTRLIPT") & 0x0C ) << 2 );
170170      break;
171171   }
172172
173173   /* Player 2 */
174174   switch( input_port_read(machine, "CTRLSEL") >> 4 ) {
175175   case 0x00:   /* Joystick */
176      data = input_port_read(machine, "JOY0");
176      data = input_port_read(machine, "PORT_DC");
177177      sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( data & 0xC0 );
178      data = input_port_read(machine, "JOY1");
178      data = input_port_read(machine, "PORT_DD");
179179      if ( input_port_read(machine, "RFU") & 0x04 ) {
180180         data = ( data & 0xFB ) | ( rapid_fire_state_2 & 0x04 );
181181      }
r3416r3417
194194      }
195195      sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( ( data & 0x03 ) << 6 );
196196      sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( ( data & 0x0C ) >> 2 ) | ( paddle_read_state & 0x08 )
197                      | ( ( input_port_read(machine, "IN0") & 0x20 ) >> 3 );
197                      | ( ( input_port_read(machine, "CTRLIPT") & 0x20 ) >> 3 );
198198      break;
199199   case 0x03:   /* Sega Sports Pad */
200200      switch( sports_pad_state_2 ) {
r3416r3417
211211         break;
212212      }
213213      sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( ( data & 0x03 ) << 6 );
214      sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( data >> 2 ) | ( ( input_port_read(machine, "IN0") & 0xC0 ) >> 4 );
214      sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( data >> 2 ) | ( ( input_port_read(machine, "CTRLIPT") & 0xC0 ) >> 4 );
215215      break;
216216   }
217217}
r3416r3417
280280
281281void sms_check_pause_button( running_machine *machine ) {
282282   if ( ! IS_GAMEGEAR ) {
283      if ( ! (input_port_read(machine, "JOY2") & 0x80) ) {
283      if ( ! (input_port_read(machine, "PAUSE") & 0x80) ) {
284284         if ( ! smsPaused ) {
285285            cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE );
286286            cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE );
r3416r3417
315315}
316316
317317 READ8_HANDLER(gg_input_port_2_r) {
318   //logerror("joy 2 read, val: %02x, pc: %04x\n", (( IS_REGION_JAPAN ? 0x00 : 0x40) | (input_port_read(machine, "JOY2") & 0x80)), activecpu_get_pc());
319   return (( IS_REGION_JAPAN ? 0x00 : 0x40 ) | (input_port_read(machine, "JOY2") & 0x80));
318   //logerror("joy 2 read, val: %02x, pc: %04x\n", (( IS_REGION_JAPAN ? 0x00 : 0x40) | (input_port_read(machine, "START") & 0x80)), activecpu_get_pc());
319   return (( IS_REGION_JAPAN ? 0x00 : 0x40 ) | (input_port_read(machine, "START") & 0x80));
320320}
321321
322322 READ8_HANDLER(sms_mapper_r)
src/mess/drivers/sms.c
r3416r3417
128128   AM_RANGE(0x40, 0x7F)                 AM_READWRITE(sms_count_r, sn76496_0_w)
129129   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE(sms_vdp_data_r, sms_vdp_data_w)
130130   AM_RANGE(0x80, 0x81) AM_MIRROR(0x3e) AM_READWRITE(sms_vdp_ctrl_r, sms_vdp_ctrl_w)
131   AM_RANGE(0xC0, 0xC0)             AM_READ_PORT("JOY0")
132   AM_RANGE(0xC1, 0xC1)             AM_READ_PORT("JOY1")
133   AM_RANGE(0xDC, 0xDC)             AM_READ_PORT("JOY0")
134   AM_RANGE(0xDD, 0xDD)             AM_READ_PORT("JOY1")
131   AM_RANGE(0xC0, 0xC0)             AM_READ_PORT("PORT_DC")
132   AM_RANGE(0xC1, 0xC1)             AM_READ_PORT("PORT_DD")
133   AM_RANGE(0xDC, 0xDC)             AM_READ_PORT("PORT_DC")
134   AM_RANGE(0xDD, 0xDD)             AM_READ_PORT("PORT_DD")
135135ADDRESS_MAP_END
136136
137137
138138static INPUT_PORTS_START( sms )
139   PORT_START("JOY0")
140   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY
141   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY
142   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY
143   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY
144   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CATEGORY(10) PORT_PLAYER(1)
145   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CATEGORY(10) PORT_PLAYER(1)
146   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY
147   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY
139   PORT_START("PORT_DC")
140   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY
141   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY
142   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY
143   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY
144   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(10) PORT_PLAYER(1)
145   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CATEGORY(10) PORT_PLAYER(1)
146   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY
147   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY
148148
149   PORT_START("JOY1")
150   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY
151   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY
152   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CATEGORY(20) PORT_PLAYER(2)
153   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CATEGORY(20) PORT_PLAYER(2)
149   PORT_START("PORT_DD")
150   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY
151   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY
152   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(20) PORT_PLAYER(2)
153   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CATEGORY(20) PORT_PLAYER(2)
154154   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* Software Reset bit */
155155   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
156156   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
157157   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
158158
159   PORT_START("JOY2")
160   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED)
161   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
162   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
163   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
164   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
165   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
166   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
167   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) /* Game Gear START */
159   PORT_START("PAUSE")
160   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
161   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Pause") /* Game Gear START */
168162
169163   PORT_START("LPHASER0")   /* Light phaser X - player 1 */
170164//  PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR( X, 1.0, 0.0, 0 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_CATEGORY(11) PORT_PLAYER(1)
r3416r3417
196190   PORT_START("PADDLE1")   /* Paddle player 2 */
197191   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CATEGORY(22) PORT_PLAYER(2)
198192
199   PORT_START("IN0")   /* Light Phaser and Paddle Control buttons */
193   PORT_START("CTRLIPT")   /* Light Phaser and Paddle Control buttons */
200194   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(11) PORT_PLAYER(1)
201195   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(12) PORT_PLAYER(1)
202196   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(13) PORT_PLAYER(1)
r3416r3417
231225   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_CATEGORY(23) PORT_PLAYER(2)
232226INPUT_PORTS_END
233227
228static INPUT_PORTS_START( gg )
229   PORT_START("PORT_DC")
230   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
231   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
232   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
233   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
234   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
235   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
236   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
237
238   PORT_START("PORT_DD")
239   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
240
241   PORT_START("START")
242   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
243   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */
244INPUT_PORTS_END
245
234246static PALETTE_INIT( sms ) {
235247   int i;
236248   for( i = 0; i < 64; i++ ) {
r3416r3417
618630CONS( 1990, smspal,     sms,        0,      sms2pal,    sms,    0,      sms,        "Sega",     "Master System II (PAL)",           FLAG_BIOS_FULL )
619631CONS( 1990, sms2kr,     sms,        0,      sms2fm,     sms,    0,      sms,        "Samsung",  "Gam*Boy II (Korea)",               FLAG_REGION_JAPAN | FLAG_BIOS_FULL | FLAG_FM )
620632
621CONS( 1990, gamegear,   0,          sms,    gamegear,   sms,    0,      gamegear,   "Sega",     "Game Gear (Europe/America)",       FLAG_GAMEGEAR )
622CONS( 1990, gamegeaj,   gamegear,   0,      gamegear,   sms,    0,      gamegear,   "Sega",     "Game Gear (Japan)",                FLAG_REGION_JAPAN | FLAG_GAMEGEAR | FLAG_BIOS_0400 )
633CONS( 1990, gamegear,   0,          sms,    gamegear,   gg,     0,      gamegear,   "Sega",     "Game Gear (Europe/America)",       FLAG_GAMEGEAR )
634CONS( 1990, gamegeaj,   gamegear,   0,      gamegear,   gg,     0,      gamegear,   "Sega",     "Game Gear (Japan)",                FLAG_REGION_JAPAN | FLAG_GAMEGEAR | FLAG_BIOS_0400 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team