Previous 15994 Revisions Next

r770 Tuesday 31st July, 2007 at 17:29:18 UTC by Wilbert Pol
[SMS] Added support for Sega Rapid Fire Unit. (bug #1317)
[docs]messnew.txt
[src/mess/drivers]sms.c
[src/mess/machine]sms.c

src/mess/machine/sms.c
r769r770
3030UINT8 ggSIO[5] = { 0x7F, 0xFF, 0x00, 0xFF, 0x00 };
3131UINT8 sms_store_control = 0;
3232
33/* Data needed for Rapid Fire Unit support */
34mame_timer   *rapid_fire_timer;
35UINT8 rapid_fire_state_1;
36UINT8 rapid_fire_state_2;
37
3338struct {
3439   UINT8   *ROM;         /* Pointer to ROM image data */
3540   UINT32   size;         /* Size of the ROM image */
r769r770
4247} sms_cartridge[MAX_CARTRIDGES];
4348UINT8   sms_current_cartridge;
4449
50static TIMER_CALLBACK( rapid_fire_callback ) {
51   rapid_fire_state_1 ^= 0xFF;
52   rapid_fire_state_2 ^= 0xFF;
53}
54
4555WRITE8_HANDLER(sms_fm_detect_w) {
4656   if ( HAS_FM ) {
4757      smsFMDetect = (data & 0x01);
r769r770
5565      if ( biosPort & IO_CHIP ) {
5666         return 0xFF;
5767      } else {
58         return readinputport(0);
68         UINT8 data = readinputport(0);
69         /* Rapid Fire setting for Button A */
70         if ( readinputport(7) & 0x01 ) {
71            data = ( data & 0xEF ) | ( rapid_fire_state_1 & 0x10 );
72         }   
73         /* Check Rapid Fire setting for Button B */
74         if ( readinputport(7) & 0x02 ) {
75            data = ( data & 0xDF ) | ( rapid_fire_state_1 & 0x20 );
76         }
77         return data;
5978      }
6079   }
6180}
r769r770
84103   /* Merge version data with input port #2 data */
85104   temp = (temp & 0xC0) | (readinputport(1) & 0x3F);
86105
106   /* Rapid Fire setting for Button A */
107   if ( readinputport(7) & 0x04 ) {
108      temp = ( temp & 0xFB ) | ( rapid_fire_state_2 & 0x04 );
109   }   
110   /* Check Rapid Fire setting for Button B */
111   if ( readinputport(7) & 0x08 ) {
112      temp = ( temp & 0xF7 ) | ( rapid_fire_state_2 & 0x08 );
113   }
114
87115   return (temp);
88116}
89117
r769r770
114142   if (biosPort & IO_CHIP) {
115143      return (0xFF);
116144   } else {
117      return readinputport(0);
145      UINT8 data = readinputport(0);
146      /* Rapid Fire setting for Button A */
147      if ( readinputport(7) & 0x01 ) {
148         data = ( data & 0xEF ) | ( rapid_fire_state_1 & 0x10 );
149      }
150      /* Check Rapid Fire setting for Button B */
151      if ( readinputport(7) & 0x02 ) {
152         data = ( data & 0xDF ) | ( rapid_fire_state_1 & 0x20 );
153      }
154      return data;
118155   }
119156}
120157
r769r770
743780   setup_banks();
744781
745782   setup_rom();
783
784   rapid_fire_state_1 = 0;
785   rapid_fire_state_2 = 0;
786   rapid_fire_timer = mame_timer_alloc( rapid_fire_callback );
787   mame_timer_adjust( rapid_fire_timer, MAME_TIME_IN_HZ(10), 0, MAME_TIME_IN_HZ(10) );
746788}
747789
748790READ8_HANDLER(sms_store_cart_select_r) {
src/mess/drivers/sms.c
r769r770
181181   PORT_START   /* IN6 - Light phaser Y - player 2 */
182182//   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR( Y, 1.0, 0.0, 0 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_PLAYER(2)
183183
184   PORT_START   /* IN7 - Rapid Fire Unit */
185   PORT_DIPNAME( 0x03, 0x00, "Rapid Fire Unit - Player 1" )
186   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
187   PORT_DIPSETTING( 0x01, "Button A" )
188   PORT_DIPSETTING( 0x02, "Button B" )
189   PORT_DIPSETTING( 0x03, "Button A+B" )
190   PORT_DIPNAME( 0x0c, 0x00, "Rapid Fire Unit - Player 2" )
191   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
192   PORT_DIPSETTING( 0x04, "Button A" )
193   PORT_DIPSETTING( 0x08, "Button B" )
194   PORT_DIPSETTING( 0x0C, "Button A+B" )
195
184196INPUT_PORTS_END
185197
186198static PALETTE_INIT( sms ) {
r769r770
494506static void smssdisp_cartslot_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) {
495507   switch(state) {
496508      case DEVINFO_INT_COUNT:            info->i = 5; break;
509      case DEVINFO_INT_MUST_BE_LOADED:   info->i = 1; break;
497510      default:               sms_cartslot_getinfo(devclass, state, info); break;
498511   }
499512}
docs/messnew.txt
r769r770
4949- [SMS/GG] Fixed video code to prevent the video code from crashing during
5050  a hard reset.  (bug #1304) [Wilbert Pol]
5151
52- [SMS] Added support for Sega Rapid Fire Unit.  (bug #1317) [Wilbert Pol]
53
5254- [THOMSON] Fixed regressions introduced with 6821 changes.  [Antoine Mine]
5355
5456- [THOMSON] Fixed TO8/TO9+ ram bank handler (fixes BASIC 1.0 bug).  [Antoine

Previous 15994 Revisions Next


© 1998-2018 The MESS Team