Previous 15994 Revisions Next

r6327 Saturday 7th November, 2009 at 18:16:52 UTC by Fabio Priuli
[SMS] Added Terebi Oekaki tablet support to smsj & sg1000m3 (code taken from sg1000.c). Tablet emulation must be enabled by the user (see messnew.txt)
[docs]messnew.txt
[src/mess/drivers]sms.c
[src/mess/machine]sms.c

src/mess/machine/sms.c
r6326r6327
7676   /* Data needed for SegaScope (3D glasses) */
7777   UINT8 sscope_state;
7878
79   /* Data needed for Terebi Oekaki (TV Draw) */
80   UINT8 tvdraw_data;
81
7982   /* Cartridge slot info */
8083   UINT8 current_cartridge;
8184   struct
r6326r6327
156159
157160static TIMER_CALLBACK( lightgun_tick )
158161{
162   /* is there a Light Phaser in P1 port? */
159163   if ((input_port_read_safe(machine, "CTRLSEL", 0x00) & 0x0f) == 0x01)
160   {
161         /* enable crosshair */
162         crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL);
163   }
164      crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL);   /* enable crosshair */
164165   else
165   {
166         /* disable crosshair */
167         crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE);
168   }
166      crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE);  /* disable crosshair */
169167   
168   /* is there a Light Phaser in P2 port? */
170169   if ((input_port_read_safe(machine, "CTRLSEL", 0x00) & 0xf0) == 0x10)
171   {
172         /* enable crosshair */
173         crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_ALL);
174   }
170      crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_ALL);   /* enable crosshair */
175171   else
176   {
177         /* disable crosshair */
178         crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_NONE);
179   }
172      crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_NONE);  /* disable crosshair */
180173}
181174
182175
r6326r6327
621614   return sms_state.mapper[offset];
622615}
623616
617/* Terebi Oekaki */
618/* The following code comes from sg1000.c. We should eventually merge these TV Draw implementations */
619static WRITE8_HANDLER( sms_tvdraw_axis_w )
620{
621   UINT8 tvboard_on = input_port_read_safe(space->machine, "TVDRAW", 0x00);
622   if (data & 0x01)
623   {
624      sms_state.tvdraw_data = tvboard_on ? input_port_read(space->machine, "TVDRAW_X") : 0x80;
624625
626      if (sms_state.tvdraw_data < 4) sms_state.tvdraw_data = 4;
627      if (sms_state.tvdraw_data > 251) sms_state.tvdraw_data = 251;
628   }
629   else
630   {
631      sms_state.tvdraw_data = tvboard_on ? input_port_read(space->machine, "TVDRAW_Y") + 0x20 : 0x80;
632   }
633}
634
635static READ8_HANDLER( sms_tvdraw_status_r )
636{
637   UINT8 tvboard_on = input_port_read_safe(space->machine, "TVDRAW", 0x00);
638   return tvboard_on ? input_port_read(space->machine, "TVDRAW_PEN") : 0x01;
639}
640
641static READ8_HANDLER( sms_tvdraw_data_r )
642{
643   return sms_state.tvdraw_data;
644}
645
646
625647WRITE8_HANDLER( sms_mapper_w )
626648{
627649   int page;
r6326r6327
11331155   return 0;
11341156}
11351157
1158
1159static int detect_tvdraw( UINT8 *rom )
1160{
1161   static const UINT8 terebi_oekaki[7] = { 0x61, 0x6e, 0x6e, 0x61, 0x6b, 0x6d, 0x6e };   // "annakmn"
1162
1163   if (!memcmp(&rom[0x13b3], terebi_oekaki, 7))
1164      return 1;
1165
1166   return 0;
1167}
1168
1169
11361170static int detect_lphaser_xoffset( UINT8 *rom )
11371171{
11381172   static const UINT8 signatures[6][16] =
r6326r6327
12911325         sms_state.cartridge[index].features |= CF_GG_SMS_MODE;
12921326
12931327      /* Check for 93C46 eeprom */
1294      if (strstr( extrainfo, "93C46"))
1328      if (strstr(extrainfo, "93C46"))
12951329         sms_state.cartridge[index].features |= CF_93C46_EEPROM;
12961330
12971331      /* Check for 8KB on-cart RAM */
r6326r6327
13361370   /* For Light Phaser games, we have to detect the x offset */
13371371   sms_state.lphaser_x_offs = detect_lphaser_xoffset(sms_state.cartridge[index].ROM);
13381372
1373   /* Terebi Oekaki (TV Draw) is a SG1000 game with special input device which is compatible with SG1000 Mark III */
1374   if ((detect_tvdraw(sms_state.cartridge[index].ROM)) && sms_state.is_region_japan)
1375   {
1376      const address_space *program = cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
1377      memory_install_write8_handler(program, 0x6000, 0x6000, 0, 0, &sms_tvdraw_axis_w);
1378      memory_install_read8_handler(program, 0x8000, 0x8000, 0, 0, &sms_tvdraw_status_r);
1379      memory_install_readwrite8_handler(program, 0xa000, 0xa000, 0, 0, &sms_tvdraw_data_r, SMH_NOP);
1380   }
1381
13391382   /* Load battery backed RAM, if available */
13401383   image_battery_load(image, sms_state.cartridge[index].cartSRAM, sizeof(UINT8) * NVRAM_SIZE);
13411384
r6326r6327
14671510
14681511   sms_state.sscope_state = 0;
14691512
1513   sms_state.tvdraw_data = 0;
1514
14701515   /* Check if lightgun has been chosen as input: if so, enable crosshair */
14711516   timer_set(space->machine, attotime_zero, NULL, 0, lightgun_tick);
14721517}
src/mess/drivers/sms.c
r6326r6327
252252   PORT_CONFSETTING( 0x01, DEF_STR( On ) )
253253INPUT_PORTS_END
254254
255static INPUT_PORTS_START( smsj )
256   PORT_INCLUDE( sms1 )
257
258   PORT_START("TVDRAW")
259   PORT_CONFNAME( 0x01, 0x00, "Terebi Oekaki Graphics Tablet" )
260   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
261   PORT_CONFSETTING( 0x01, DEF_STR( On ) )
262
263   PORT_START("TVDRAW_X")
264   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_NAME("Tablet - X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
265      PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
266
267   PORT_START("TVDRAW_Y")
268   PORT_BIT( 0xff, 0x60, IPT_LIGHTGUN_Y ) PORT_NAME("Tablet - Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 191) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
269      PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
270
271   PORT_START("TVDRAW_PEN")
272   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Tablet - Pen") PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
273INPUT_PORTS_END
274
255275static INPUT_PORTS_START( gg )
256276   PORT_START("PORT_DC")
257277   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
r6326r6327
796816***************************************************************************/
797817
798818/*    YEAR  NAME        PARENT      COMPAT  MACHINE      INPUT   INIT      CONFIG    COMPANY     FULLNAME                            FLAGS */
799CONS( 1984, sg1000m3,   sms,        0,      sg1000m3,    sms1,   sg1000m3, 0,        "Sega",     "SG-1000 Mark III",                 0 )
819CONS( 1984, sg1000m3,   sms,        0,      sg1000m3,    smsj,   sg1000m3, 0,        "Sega",     "SG-1000 Mark III",                 0 )
800820CONS( 1986, sms1,       sms,        0,      sms1_ntsc,   sms1,   sms1,     0,        "Sega",     "Master System I",                  0 )
801821CONS( 1986, sms1pal,    sms,        0,      sms1_pal,    sms1,   sms1,     0,        "Sega",     "Master System I (PAL)" ,           0 )
802822CONS( 1986, smssdisp,   sms,        0,      sms_sdisp,   sms,    smssdisp, 0,        "Sega",     "Master System Store Display Unit", GAME_NOT_WORKING )
803CONS( 1987, smsj,       sms,        0,      sms_fm,      sms1,   smsj,     0,        "Sega",     "Master System (Japan)",            0 )
823CONS( 1987, smsj,       sms,        0,      sms_fm,      smsj,   smsj,     0,        "Sega",     "Master System (Japan)",            0 )
804824CONS( 1990, sms,        0,          0,      sms2_ntsc,   sms,    sms1,     0,        "Sega",     "Master System II",                 0 )
805825CONS( 1990, smspal,     sms,        0,      sms2_pal,    sms,    sms1,     0,        "Sega",     "Master System II (PAL)",           0 )
806826CONS( 1990, sms2kr,     sms,        0,      sms2_fm,     sms,    sms2kr,   0,        "Samsung",  "Gam*Boy II (Korea)",               0 )
docs/messnew.txt
r6326r6327
2121System Driver Changes:
2222----------------------
2323- [SMS] Added SegaScope (3D-Glasses) support to Sega Master System I
24  drivers (i.e. sms1, sms1pal, smsj, sg1000m3). To enable this, enter
24  drivers (i.e. sms1, sms1pal, smsj & sg1000m3). To enable this, enter
2525  Driver Configuration menu and turn on SegaScope, then go in the Video
2626  Options menu and choose one of the SegaScope views. [Fabio Priuli]
2727
28- [SMS] Added Terebi Oekaki graphic board support to Japanese drivers
29  (i.e. smsj & sg1000m3). To enable this, start emulation of "Terebi
30  Oekaki", then enter Driver Configuration menu and turn on the Tablet.
31  Once enabled, remappable controls will also appear in the Input (this
32  System) menu. [Fabio Priuli]
33
2834- [TI85/TI86] Converted the serial interface to a device. [Wilbert Pol]
2935
3036

Previous 15994 Revisions Next


© 1998-2018 The MESS Team