Previous 199869 Revisions Next

r34644 Tuesday 27th January, 2015 at 07:34:57 UTC by Fabio Priuli
(MESS) sms/gamegear: misc improvements [Enik Land]
- Renamed the gear2gear port to EXT port, after reading the references
 in the official GG documents
- Invert Y1 pin signal bits: now high is 1 and low is 0;
- More complete Y1 behavior: goes low only for transparent pixels;
- Fix color of column 0 when it doesn't completely entered in the active display;
- Improve behavior of sprite overflow, to not be flagged when VINT is active.

out of whatsnew: the new Y1 pin behavior of the SMS VDP is based on Charles' findings and TMS9918 manual.
[src/emu/bus]bus.mak
[src/emu/bus/gamegear]gear2gear.c gear2gear.h ggext.c* ggext.h* smsctrladp.c smsctrladp.h
[src/emu/video]315_5124.c
[src/mame/drivers]segae.c
[src/mess/drivers]sms.c
[src/mess/includes]sms.h
[src/mess/machine]sms.c

trunk/src/emu/bus/bus.mak
r243155r243156
12911291
12921292#-------------------------------------------------
12931293#
1294#@src/emu/bus/gamegear/gear2gear.h,BUSES += GAMEGEAR
1294#@src/emu/bus/gamegear/ggext.h,BUSES += GAMEGEAR
12951295#-------------------------------------------------
12961296
12971297ifneq ($(filter GAMEGEAR,$(BUSES)),)
12981298OBJDIRS += $(BUSOBJ)/gamegear
1299BUSOBJS += $(BUSOBJ)/gamegear/gear2gear.o
1299BUSOBJS += $(BUSOBJ)/gamegear/ggext.o
13001300BUSOBJS += $(BUSOBJ)/gamegear/smsctrladp.o
13011301endif
13021302
trunk/src/emu/bus/gamegear/gear2gear.c
r243155r243156
1/**********************************************************************
2
3    Sega Game Gear "Gear to Gear Port" emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "gear2gear.h"
11// slot devices
12#include "smsctrladp.h"
13
14
15
16//**************************************************************************
17//  GLOBAL VARIABLES
18//**************************************************************************
19
20const device_type GG_GEAR2GEAR_PORT = &device_creator<gg_gear2gear_port_device>;
21
22
23
24//**************************************************************************
25//  CARD INTERFACE
26//**************************************************************************
27
28//-------------------------------------------------
29//  device_gg_gear2gear_port_interface - constructor
30//-------------------------------------------------
31
32device_gg_gear2gear_port_interface::device_gg_gear2gear_port_interface(const machine_config &mconfig, device_t &device)
33   : device_slot_card_interface(mconfig,device)
34{
35   m_port = dynamic_cast<gg_gear2gear_port_device *>(device.owner());
36}
37
38
39//-------------------------------------------------
40//  ~device_gg_gear2gear_port_interface - destructor
41//-------------------------------------------------
42
43device_gg_gear2gear_port_interface::~device_gg_gear2gear_port_interface()
44{
45}
46
47
48
49//**************************************************************************
50//  LIVE DEVICE
51//**************************************************************************
52
53//-------------------------------------------------
54//  gg_gear2gear_port_device - constructor
55//-------------------------------------------------
56
57gg_gear2gear_port_device::gg_gear2gear_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
58                  device_t(mconfig, GG_GEAR2GEAR_PORT, "Gear to Gear Port", tag, owner, clock, "gg_gear2gear_port", __FILE__),
59                  device_slot_interface(mconfig, *this),
60                  m_th_pin_handler(*this),
61                  m_pixel_handler(*this)
62{
63}
64
65
66//-------------------------------------------------
67//  gg_gear2gear_port_device - destructor
68//-------------------------------------------------
69
70gg_gear2gear_port_device::~gg_gear2gear_port_device()
71{
72}
73
74
75//-------------------------------------------------
76//  device_start - device-specific startup
77//-------------------------------------------------
78
79void gg_gear2gear_port_device::device_start()
80{
81   m_device = dynamic_cast<device_gg_gear2gear_port_interface *>(get_card_device());
82
83   m_th_pin_handler.resolve_safe();
84   m_pixel_handler.resolve_safe(0);
85}
86
87
88UINT8 gg_gear2gear_port_device::port_r()
89{
90   UINT8 data = 0xff;
91   if (m_device)
92      data = m_device->peripheral_r();
93   return data;
94}
95
96void gg_gear2gear_port_device::port_w( UINT8 data )
97{
98   if (m_device)
99      m_device->peripheral_w(data);
100}
101
102
103void gg_gear2gear_port_device::th_pin_w(int state)
104{
105   m_th_pin_handler(state);
106}
107
108UINT32 gg_gear2gear_port_device::pixel_r()
109{
110   return m_pixel_handler();
111}
112
113
114//-------------------------------------------------
115//  SLOT_INTERFACE( gg_gear2gear_port_devices )
116//-------------------------------------------------
117
118SLOT_INTERFACE_START( gg_gear2gear_port_devices )
119   SLOT_INTERFACE("smsctrladp", SMS_CTRL_ADAPTOR)
120SLOT_INTERFACE_END
trunk/src/emu/bus/gamegear/gear2gear.h
r243155r243156
1/**********************************************************************
2
3    Sega Game Gear "Gear to Gear Port" emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9
10
11**********************************************************************/
12
13#pragma once
14
15#ifndef __GG_GEAR2GEAR_PORT__
16#define __GG_GEAR2GEAR_PORT__
17
18#include "emu.h"
19
20
21
22//**************************************************************************
23//  INTERFACE CONFIGURATION MACROS
24//**************************************************************************
25
26#define MCFG_GG_GEAR2GEAR_PORT_ADD(_tag, _slot_intf, _def_slot) \
27   MCFG_DEVICE_ADD(_tag, GG_GEAR2GEAR_PORT, 0) \
28   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
29#define MCFG_GG_GEAR2GEAR_PORT_MODIFY(_tag) \
30   MCFG_DEVICE_MODIFY(_tag)
31
32
33#define MCFG_GG_GEAR2GEAR_PORT_TH_INPUT_HANDLER(_devcb) \
34   devcb = &gg_gear2gear_port_device::set_th_input_handler(*device, DEVCB_##_devcb);
35
36
37#define MCFG_GG_GEAR2GEAR_PORT_PIXEL_HANDLER(_devcb) \
38   devcb = &gg_gear2gear_port_device::set_pixel_handler(*device, DEVCB_##_devcb);
39
40
41
42//**************************************************************************
43//  TYPE DEFINITIONS
44//**************************************************************************
45
46// ======================> gg_gear2gear_port_device
47
48class device_gg_gear2gear_port_interface;
49
50class gg_gear2gear_port_device : public device_t,
51                        public device_slot_interface
52{
53public:
54   // construction/destruction
55   gg_gear2gear_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
56   virtual ~gg_gear2gear_port_device();
57
58   // static configuration helpers
59   template<class _Object> static devcb_base &set_th_input_handler(device_t &device, _Object object) { return downcast<gg_gear2gear_port_device &>(device).m_th_pin_handler.set_callback(object); }
60
61   template<class _Object> static devcb_base &set_pixel_handler(device_t &device, _Object object) { return downcast<gg_gear2gear_port_device &>(device).m_pixel_handler.set_callback(object); }
62
63   // Currently, only the support for SMS Controller Adaptor is emulated,
64   // for when SMS Compatibility mode is enabled. In that mode, the 10
65   // pins of the Gear to Gear Port follows the same numbering of a SMS
66   // Control port.
67
68   // Data returned by the port_r methods:
69   // bit 0 - pin 1 - Up
70   // bit 1 - pin 2 - Down
71   // bit 2 - pin 3 - Left
72   // bit 3 - pin 4 - Right
73   // bit 4 - pin 5 - Vcc (no data)
74   // bit 5 - pin 6 - TL (Button 1/Light Phaser Trigger)
75   // bit 6 - pin 7 - TH (Light Phaser sensor)
76   //         pin 8 - GND
77   // bit 7 - pin 9 - TR (Button 2)
78   //         pin 10 - Not connected
79   //
80   UINT8 port_r();
81   void port_w( UINT8 data );
82
83   void th_pin_w(int state);
84   UINT32 pixel_r();
85
86//protected:
87   // device-level overrides
88   virtual void device_start();
89
90   device_gg_gear2gear_port_interface *m_device;
91
92private:
93   devcb_write_line m_th_pin_handler;
94   devcb_read32 m_pixel_handler;
95};
96
97
98// ======================> device_gg_gear2gear_port_interface
99
100// class representing interface-specific live sms_expansion card
101class device_gg_gear2gear_port_interface : public device_slot_card_interface
102{
103public:
104   // construction/destruction
105   device_gg_gear2gear_port_interface(const machine_config &mconfig, device_t &device);
106   virtual ~device_gg_gear2gear_port_interface();
107
108   virtual UINT8 peripheral_r() { return 0xff; };
109   virtual void peripheral_w(UINT8 data) { };
110
111protected:
112   gg_gear2gear_port_device *m_port;
113};
114
115
116// device type definition
117extern const device_type GG_GEAR2GEAR_PORT;
118
119
120SLOT_INTERFACE_EXTERN( gg_gear2gear_port_devices );
121
122
123#endif
trunk/src/emu/bus/gamegear/ggext.c
r0r243156
1/**********************************************************************
2
3    Sega Game Gear EXT port emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "ggext.h"
11// slot devices
12#include "smsctrladp.h"
13
14
15
16//**************************************************************************
17//  GLOBAL VARIABLES
18//**************************************************************************
19
20const device_type GG_EXT_PORT = &device_creator<gg_ext_port_device>;
21
22
23
24//**************************************************************************
25//  CARD INTERFACE
26//**************************************************************************
27
28//-------------------------------------------------
29//  device_gg_ext_port_interface - constructor
30//-------------------------------------------------
31
32device_gg_ext_port_interface::device_gg_ext_port_interface(const machine_config &mconfig, device_t &device)
33   : device_slot_card_interface(mconfig,device)
34{
35   m_port = dynamic_cast<gg_ext_port_device *>(device.owner());
36}
37
38
39//-------------------------------------------------
40//  ~device_gg_ext_port_interface - destructor
41//-------------------------------------------------
42
43device_gg_ext_port_interface::~device_gg_ext_port_interface()
44{
45}
46
47
48
49//**************************************************************************
50//  LIVE DEVICE
51//**************************************************************************
52
53//-------------------------------------------------
54//  gg_ext_port_device - constructor
55//-------------------------------------------------
56
57gg_ext_port_device::gg_ext_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
58                  device_t(mconfig, GG_EXT_PORT, "EXT Port", tag, owner, clock, "gg_ext_port", __FILE__),
59                  device_slot_interface(mconfig, *this),
60                  m_th_pin_handler(*this),
61                  m_pixel_handler(*this)
62{
63}
64
65
66//-------------------------------------------------
67//  gg_ext_port_device - destructor
68//-------------------------------------------------
69
70gg_ext_port_device::~gg_ext_port_device()
71{
72}
73
74
75//-------------------------------------------------
76//  device_start - device-specific startup
77//-------------------------------------------------
78
79void gg_ext_port_device::device_start()
80{
81   m_device = dynamic_cast<device_gg_ext_port_interface *>(get_card_device());
82
83   m_th_pin_handler.resolve_safe();
84   m_pixel_handler.resolve_safe(0);
85}
86
87
88UINT8 gg_ext_port_device::port_r()
89{
90   UINT8 data = 0xff;
91   if (m_device)
92      data = m_device->peripheral_r();
93   return data;
94}
95
96void gg_ext_port_device::port_w( UINT8 data )
97{
98   if (m_device)
99      m_device->peripheral_w(data);
100}
101
102
103void gg_ext_port_device::th_pin_w(int state)
104{
105   m_th_pin_handler(state);
106}
107
108UINT32 gg_ext_port_device::pixel_r()
109{
110   return m_pixel_handler();
111}
112
113
114//-------------------------------------------------
115//  SLOT_INTERFACE( gg_ext_port_devices )
116//-------------------------------------------------
117
118SLOT_INTERFACE_START( gg_ext_port_devices )
119   SLOT_INTERFACE("smsctrladp", SMS_CTRL_ADAPTOR)
120SLOT_INTERFACE_END
trunk/src/emu/bus/gamegear/ggext.h
r0r243156
1/**********************************************************************
2
3    Sega Game Gear EXT port emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9
10
11**********************************************************************/
12
13#pragma once
14
15#ifndef __GG_EXT_PORT__
16#define __GG_EXT_PORT__
17
18#include "emu.h"
19
20
21
22//**************************************************************************
23//  INTERFACE CONFIGURATION MACROS
24//**************************************************************************
25
26#define MCFG_GG_EXT_PORT_ADD(_tag, _slot_intf, _def_slot) \
27   MCFG_DEVICE_ADD(_tag, GG_EXT_PORT, 0) \
28   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
29#define MCFG_GG_EXT_PORT_MODIFY(_tag) \
30   MCFG_DEVICE_MODIFY(_tag)
31
32
33#define MCFG_GG_EXT_PORT_TH_INPUT_HANDLER(_devcb) \
34   devcb = &gg_ext_port_device::set_th_input_handler(*device, DEVCB_##_devcb);
35
36
37#define MCFG_GG_EXT_PORT_PIXEL_HANDLER(_devcb) \
38   devcb = &gg_ext_port_device::set_pixel_handler(*device, DEVCB_##_devcb);
39
40
41
42//**************************************************************************
43//  TYPE DEFINITIONS
44//**************************************************************************
45
46// ======================> gg_ext_port_device
47
48class device_gg_ext_port_interface;
49
50class gg_ext_port_device : public device_t,
51                        public device_slot_interface
52{
53public:
54   // construction/destruction
55   gg_ext_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
56   virtual ~gg_ext_port_device();
57
58   // static configuration helpers
59   template<class _Object> static devcb_base &set_th_input_handler(device_t &device, _Object object) { return downcast<gg_ext_port_device &>(device).m_th_pin_handler.set_callback(object); }
60
61   template<class _Object> static devcb_base &set_pixel_handler(device_t &device, _Object object) { return downcast<gg_ext_port_device &>(device).m_pixel_handler.set_callback(object); }
62
63   // Currently, only the support for SMS Controller Adaptor is emulated,
64   // for when SMS Compatibility mode is enabled. In that mode, the 10 pins
65   // of the EXT port follows the same numbering of a SMS Control port.
66
67   // Data returned by the port_r methods:
68   // bit 0 - pin 1 - Up
69   // bit 1 - pin 2 - Down
70   // bit 2 - pin 3 - Left
71   // bit 3 - pin 4 - Right
72   // bit 4 - pin 5 - Vcc (no data)
73   // bit 5 - pin 6 - TL (Button 1/Light Phaser Trigger)
74   // bit 6 - pin 7 - TH (Light Phaser sensor)
75   //         pin 8 - GND
76   // bit 7 - pin 9 - TR (Button 2)
77   //         pin 10 - Not connected
78   //
79   UINT8 port_r();
80   void port_w( UINT8 data );
81
82   void th_pin_w(int state);
83   UINT32 pixel_r();
84
85//protected:
86   // device-level overrides
87   virtual void device_start();
88
89   device_gg_ext_port_interface *m_device;
90
91private:
92   devcb_write_line m_th_pin_handler;
93   devcb_read32 m_pixel_handler;
94};
95
96
97// ======================> device_gg_ext_port_interface
98
99// class representing interface-specific live sms_expansion card
100class device_gg_ext_port_interface : public device_slot_card_interface
101{
102public:
103   // construction/destruction
104   device_gg_ext_port_interface(const machine_config &mconfig, device_t &device);
105   virtual ~device_gg_ext_port_interface();
106
107   virtual UINT8 peripheral_r() { return 0xff; };
108   virtual void peripheral_w(UINT8 data) { };
109
110protected:
111   gg_ext_port_device *m_port;
112};
113
114
115// device type definition
116extern const device_type GG_EXT_PORT;
117
118
119SLOT_INTERFACE_EXTERN( gg_ext_port_devices );
120
121
122#endif
trunk/src/emu/bus/gamegear/smsctrladp.c
r243155r243156
11/**********************************************************************
22
3    Sega Game Gear "Gear to Gear Port SMS Controller Adaptor" emulation
3    Sega Game Gear "SMS Controller Adaptor" emulation
44    Also known as "Master Link" cable.
55
66    Copyright MESS Team.
r243155r243156
2929
3030sms_ctrl_adaptor_device::sms_ctrl_adaptor_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
3131   device_t(mconfig, SMS_CTRL_ADAPTOR, "SMS Controller Adaptor", tag, owner, clock, "sms_ctrl_adaptor", __FILE__),
32   device_gg_gear2gear_port_interface(mconfig, *this),
32   device_gg_ext_port_interface(mconfig, *this),
3333   m_subctrl_port(*this, "ctrl")
3434{
3535}
trunk/src/emu/bus/gamegear/smsctrladp.h
r243155r243156
11/**********************************************************************
22
3    Sega Game Gear "Gear to Gear Port SMS Controller Adaptor" emulation
3    Sega Game Gear "SMS Controller Adaptor" emulation
44    Also known as "Master Link" cable.
55
66    Copyright MESS Team.
r243155r243156
1515
1616
1717#include "emu.h"
18#include "gear2gear.h"
18#include "ggext.h"
1919#include "../sms_ctrl/smsctrl.h"
2020
2121
r243155r243156
2727// ======================> sms_ctrl_adaptor_device
2828
2929class sms_ctrl_adaptor_device : public device_t,
30                     public device_gg_gear2gear_port_interface
30                     public device_gg_ext_port_interface
3131{
3232public:
3333   // construction/destruction
r243155r243156
4141   virtual void device_start();
4242   virtual machine_config_constructor device_mconfig_additions() const;
4343
44   // device_gg_gear2gear_port_interface overrides
44   // device_gg_ext_port_interface overrides
4545   virtual UINT8 peripheral_r();
4646   virtual void peripheral_w(UINT8 data);
4747
trunk/src/emu/video/315_5124.c
r243155r243156
1414  - Display mode 1 (text)
1515  - Display mode 3 (multicolor)
1616  - Sprite doubling bug of the 315-5124 chip
17  - Verify timing on the Game Gear (315-5378 chip)
1718
1819
1920SMS Display Timing
r243155r243156
343344         rec.min_x = SEGA315_5124_LBORDER_START;
344345         rec.max_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 1;
345346         m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
346         m_y1_bitmap.fill(1, rec);
347         m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
347348      }
348349      break;
349350
r243155r243156
358359         rec.min_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256;
359360         rec.max_x = rec.min_x + SEGA315_5124_RBORDER_WIDTH - 1;
360361         m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
361         m_y1_bitmap.fill(1, rec);
362         m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
362363      }
363364      break;
364365
r243155r243156
847848            //logerror("%x %x\n", pixel_plot_x, line);
848849            if (tile_column == 0 && (x_scroll & 0x07))
849850            {
850               /* the VDP only draws the first column when it has completely entered
851                  in the screen, else it is filled with the sprite pattern #0 */
852               line_buffer[pixel_plot_x] = m_current_palette[0x10];
851               /* when the first column hasn't completely entered in the screen, its
852                  background is filled only with color #0 of the selected palette */
853               line_buffer[pixel_plot_x] = m_current_palette[palette_selected ? 0x10 : 0x00];
854               priority_selected[pixel_plot_x] = priority_select;
853855            }
854856            else
855857            {
856858               line_buffer[pixel_plot_x] = m_current_palette[pen_selected];
859               priority_selected[pixel_plot_x] = priority_select | (pen_selected & 0x0f);
857860            }
858            priority_selected[pixel_plot_x] = priority_select | (pen_selected & 0x0f);
859861         }
860862      }
861863   }
r243155r243156
10121014
10131015      m_sprite_count = max_sprites;
10141016
1015      if (line >= 0 && line < m_frame_timing[ACTIVE_DISPLAY_V])
1017      /* Overflow is flagged only on active display and when VINT isn't active */
1018      if (!(m_status & STATUS_VINT) && line >= 0 && line < m_frame_timing[ACTIVE_DISPLAY_V])
10161019      {
10171020         m_pending_status |= STATUS_SPROVR;
10181021      }
r243155r243156
10301033   if (m_display_disabled || m_sprite_count == 0)
10311034      return;
10321035
1033   /* Sprites aren't drawn and collisions don't occur on column 0 if it is disabled */
1036   /* Sprites aren't drawn and collisions don't occur on column 0 if it is disabled.
1037      Note: On Megadrive/Genesis VDP, collisions occur on the disabled column 0. */
10341038   if (m_reg[0x00] & 0x20)
10351039      plot_min_x = 8;
10361040
r243155r243156
10841088               continue;
10851089            }
10861090
1091            /* Draw sprite pixel */
1092            /* Check if the background has lower priority */
10871093            if (!(priority_selected[pixel_plot_x] & PRIORITY_BIT))
10881094            {
10891095               line_buffer[pixel_plot_x] = m_current_palette[pen_selected];
r243155r243156
12961302
12971303   if ( line < m_frame_timing[ACTIVE_DISPLAY_V] )
12981304   {
1305      memset(priority_selected, 1, sizeof(priority_selected));
1306
12991307      switch( m_vdp_mode )
13001308      {
13011309      case 0:
1302         memset(priority_selected, 1, sizeof(priority_selected));
13031310         if ( line >= 0 )
13041311         {
13051312            draw_scanline_mode0( blitline_buffer, line );
r243155r243156
13111318         break;
13121319
13131320      case 2:
1314         memset(priority_selected, 1, sizeof(priority_selected));
13151321         if ( line >= 0 )
13161322         {
13171323            draw_scanline_mode2( blitline_buffer, line );
r243155r243156
13241330
13251331      case 4:
13261332      default:
1327         memset(priority_selected, 0, sizeof(priority_selected));
13281333         if ( line >= 0 )
13291334         {
13301335            draw_scanline_mode4( blitline_buffer, priority_selected, line );
r243155r243156
13461351      rec.min_x = pixel_offset_x;
13471352      rec.max_x = pixel_offset_x + 255;
13481353      m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
1349      m_y1_bitmap.fill(1, rec);
1354      m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
13501355   }
13511356   else
13521357   {
r243155r243156
13611366   UINT8  *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
13621367   int x = 0;
13631368
1364   if (m_vdp_mode == 4 && m_reg[0x00] & 0x20)
1369   if (m_vdp_mode == 4 && (m_reg[0x00] & 0x20))
13651370   {
13661371      /* Fill column 0 with overscan color from m_reg[0x07] */
13671372      do
13681373      {
13691374         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1370         p_y1[x] = 1;
1375         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
13711376      }
13721377      while(++x < 8);
13731378   }
r243155r243156
13751380   do
13761381   {
13771382      p_bitmap[x] = m_palette->pen(line_buffer[x]);
1378      p_y1[x] = ( priority_selected[x] & 0x0f ) ? 0 : 1;
1383      p_y1[x] = ( priority_selected[x] & 0x0f ) ? 1 : 0;
13791384   }
13801385   while(++x < 256);
13811386}
r243155r243156
13971402      do
13981403      {
13991404         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1400         p_y1[x] = 1; // not verified
1405         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
14011406      }
14021407      while (++x < 48);
14031408
r243155r243156
14061411         do
14071412         {
14081413            p_bitmap[x] = m_palette->pen(line_buffer[x]);
1409            p_y1[x] = ( priority_selected[x] & 0x0f ) ? 0 : 1;
1414            p_y1[x] = ( priority_selected[x] & 0x0f ) ? 1 : 0;
14101415         }
14111416         while (++x < 208);
14121417      }
r243155r243156
14161421         do
14171422         {
14181423            p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1419            p_y1[x] = 1; // not verified
1424            p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
14201425         }
14211426         while (++x < 208);
14221427      }
r243155r243156
14251430      do
14261431      {
14271432         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1428         p_y1[x] = 1; // not verified
1433         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
14291434      }
14301435      while (++x < 256);
14311436   }
trunk/src/mame/drivers/segae.c
r243155r243156
956956
957957      for ( int x = cliprect.min_x; x <= cliprect.max_x; x++ )
958958      {
959         dest_ptr[x] = ( y1_ptr[x] ) ? vdp1_ptr[x] : vdp2_ptr[x];
960//dest_ptr[x] = y1_ptr[x] ? 0xFF0000 : 0x00FF00;
959         dest_ptr[x] = ( y1_ptr[x] ) ? vdp2_ptr[x] : vdp1_ptr[x];
960         //dest_ptr[x] = y1_ptr[x] ? 0x00FF00 : 0xFF0000;
961961      }
962962   }
963963
trunk/src/mess/drivers/sms.c
r243155r243156
1414
1515 - SIO interface for Game Gear (needs netplay, I guess)
1616 - Sega Demo Unit II (kiosk expansion device)
17 - SMS 8 slot game changer (kiosk expansion device)
1718 - SMS Disk System (floppy disk drive expansion device) - unreleased
1819 - Rapid button of Japanese Master System
1920 - Keyboard support for Sega Mark III (sg1000m3 driver)
r243155r243156
5758- Few games of the ones with FM support need to detect the system region as
5859  Japanese to play FM sound;
5960- The Light Phaser gun doesn't work with the Japanese SMS;
60- There are reports about Light Phaser working on the second Korean console
61- There are reports about Light Phaser working on the second Korean SMS
6162  version, and a Korean advert shows support on the first version (Gam*Boy I,
6263  although based on Japanese SMS);
6364- The Korean SMS versions have Japanese-format cartridge slot, but only on the
6465  first (Gam*Boy I) the region is detected as Japanese;
6566- Some SMS ROMs don't run when are plugged-in to SMS expansion slot, through
6667  the gender adapter;
67- Some SMS ROMs don't run when are plugged-in to a Game Gear, through the
68  Master Gear adapter;
68- Some SMS ROMs don't run or have issues when are plugged-in to a Game Gear,
69  through the Master Gear adapter;
6970
7071--------------------------------------------------------------------------------
7172
r243155r243156
405406INPUT_PORTS_END
406407
407408static INPUT_PORTS_START( smssdisp )
409   // For each peripheral port (for controllers or 3-D glasses), there are sets
410   // of two connectors wired in parallel on the real hardware. This allows to
411   // have different controllers, like a pad and a Light Phaser, plugged together
412   // for a player input, what avoids having to re-plug them every time a game is
413   // changed to another that requires a different controller. Also, this allows
414   // 3-D games to be properly watched by two persons at same time.
415   // For now the driver just uses single input ports.
408416   PORT_INCLUDE( sms1 )
409417
410418   PORT_START("DSW")
r243155r243156
805813
806814   MCFG_SOFTWARE_LIST_ADD("cart_list", "gamegear")
807815
808   MCFG_GG_GEAR2GEAR_PORT_ADD("gear2gear", gg_gear2gear_port_devices, NULL)
809   MCFG_GG_GEAR2GEAR_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) // not verified
810   //MCFG_GG_GEAR2GEAR_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) // only for GG-TV mod
816   MCFG_GG_EXT_PORT_ADD("ext", gg_ext_port_devices, NULL)
817   MCFG_GG_EXT_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) // not verified
818   //MCFG_GG_EXT_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) // only for GG-TV mod
811819MACHINE_CONFIG_END
812820
813821
trunk/src/mess/includes/sms.h
r243155r243156
1919#define CONTROL1_TAG   "ctrl1"
2020#define CONTROL2_TAG   "ctrl2"
2121
22#include "bus/gamegear/gear2gear.h"
22#include "bus/gamegear/ggext.h"
2323#include "bus/sms_ctrl/smsctrl.h"
2424#include "bus/sms_exp/smsexp.h"
2525#include "bus/sega8/sega8_slot.h"
r243155r243156
3737      m_region_maincpu(*this, "maincpu"),
3838      m_port_ctrl1(*this, CONTROL1_TAG),
3939      m_port_ctrl2(*this, CONTROL2_TAG),
40      m_port_gear2gear(*this, "gear2gear"),
40      m_port_gg_ext(*this, "ext"),
4141      m_port_gg_dc(*this, "GG_PORT_DC"),
4242      m_port_pause(*this, "PAUSE"),
4343      m_port_reset(*this, "RESET"),
r243155r243156
6666   required_memory_region m_region_maincpu;
6767   optional_device<sms_control_port_device> m_port_ctrl1;
6868   optional_device<sms_control_port_device> m_port_ctrl2;
69   optional_device<gg_gear2gear_port_device> m_port_gear2gear;
69   optional_device<gg_ext_port_device> m_port_gg_ext;
7070   optional_ioport m_port_gg_dc;
7171   optional_ioport m_port_pause;
7272   optional_ioport m_port_reset;
r243155r243156
7575   optional_ioport m_port_scope_binocular;
7676   optional_ioport m_port_persist;
7777
78   device_t *m_left_lcd;
79   device_t *m_right_lcd;
8078   address_space *m_space;
81
82   UINT8 m_bios_page_count;
83   UINT8 m_fm_detect;
84   UINT8 m_io_ctrl_reg;
85   int m_paused;
86   UINT8 m_mem_ctrl_reg;
87   UINT8 m_mem_device_enabled;
8879   UINT8 *m_mainram;
8980   UINT8 *m_BIOS;
90   UINT8 m_mapper[4];
91   UINT8 m_port_dc_reg;
92   UINT8 m_port_dd_reg;
93   UINT8 m_gg_sio[5];
9481
95   // [0] for 0x400-0x3fff, [1] for 0x4000-0x7fff, [2] for 0x8000-0xffff, [3] for 0x0000-0x0400
96   UINT8 m_bios_page[4];
82   // for 3D glass binocular hack
83   device_t *m_left_lcd;
84   device_t *m_right_lcd;
85   bitmap_rgb32 m_prevleft_bitmap;
86   bitmap_rgb32 m_prevright_bitmap;
9787
9888   // for gamegear LCD persistence hack
9989   bitmap_rgb32 m_prev_bitmap;
r243155r243156
10595   // vertical scaling in the gamegear sms compatibility mode.
10696   int *m_line_buffer;
10797
108   // for 3D glass binocular hack
109   bitmap_rgb32 m_prevleft_bitmap;
110   bitmap_rgb32 m_prevright_bitmap;
111
11298   // model identifiers
11399   UINT8 m_is_gamegear;
114100   UINT8 m_is_gg_region_japan;
r243155r243156
121107   UINT8 m_has_fm;
122108   UINT8 m_has_jpn_sms_cart_slot;
123109
110   // [0] for 0x400-0x3fff, [1] for 0x4000-0x7fff, [2] for 0x8000-0xffff, [3] for 0x0000-0x0400
111   UINT8 m_bios_page[4];
112
113   UINT8 m_bios_page_count;
114   UINT8 m_mapper[4];
115   UINT8 m_io_ctrl_reg;
116   UINT8 m_mem_ctrl_reg;
117   UINT8 m_mem_device_enabled;
118   UINT8 m_fm_detect;
119   UINT8 m_port_dc_reg;
120   UINT8 m_port_dd_reg;
121   UINT8 m_gg_sio[5];
122   int m_paused;
123
124124   // Data needed for Light Phaser
125125   UINT8 m_ctrl1_th_state;
126126   UINT8 m_ctrl2_th_state;
r243155r243156
132132   UINT8 m_sscope_state;
133133   UINT8 m_frame_sscope_state;
134134
135   // slot devices
135136   sega8_cart_slot_device *m_cartslot;
136137   sega8_card_slot_device *m_cardslot;
137138   sms_expansion_slot_device *m_expslot;
138139
139140   // these are only used by the Store Display unit, but we keep them here temporarily to avoid the need of separate start/reset
141   sega8_cart_slot_device *m_slots[16];
142   sega8_card_slot_device *m_cards[16];
140143   UINT8 m_store_control;
141144   UINT8 m_store_cart_selection_data;
142   sega8_cart_slot_device *m_slots[16];
143   sega8_card_slot_device *m_cards[16];
144145   void store_post_load();
145146   void store_select_cart(UINT8 data);
146147
147   /* Cartridge slot info */
148   DECLARE_WRITE8_MEMBER(sms_fm_detect_w);
149   DECLARE_READ8_MEMBER(sms_fm_detect_r);
148   DECLARE_READ8_MEMBER(read_0000);
149   DECLARE_READ8_MEMBER(read_4000);
150   DECLARE_READ8_MEMBER(read_8000);
151   DECLARE_READ8_MEMBER(read_ram);
152   DECLARE_WRITE8_MEMBER(write_ram);
153   DECLARE_WRITE8_MEMBER(write_cart);
154
155   DECLARE_READ8_MEMBER(sms_mapper_r);
156   DECLARE_WRITE8_MEMBER(sms_mapper_w);
157   DECLARE_WRITE8_MEMBER(sms_mem_control_w);
150158   DECLARE_WRITE8_MEMBER(sms_io_control_w);
151159   DECLARE_READ8_MEMBER(sms_count_r);
152160   DECLARE_READ8_MEMBER(sms_input_port_dc_r);
153161   DECLARE_READ8_MEMBER(sms_input_port_dd_r);
154162   DECLARE_READ8_MEMBER(gg_input_port_00_r);
163   DECLARE_WRITE8_MEMBER(gg_sio_w);
164   DECLARE_READ8_MEMBER(gg_sio_r);
165   DECLARE_WRITE8_MEMBER(sms_fm_detect_w);
166   DECLARE_READ8_MEMBER(sms_fm_detect_r);
155167   DECLARE_WRITE8_MEMBER(sms_ym2413_register_port_w);
156168   DECLARE_WRITE8_MEMBER(sms_ym2413_data_port_w);
157169   DECLARE_READ8_MEMBER(sms_sscope_r);
158170   DECLARE_WRITE8_MEMBER(sms_sscope_w);
159   DECLARE_READ8_MEMBER(sms_mapper_r);
160171
161   DECLARE_READ8_MEMBER(read_0000);
162   DECLARE_READ8_MEMBER(read_4000);
163   DECLARE_READ8_MEMBER(read_8000);
164   DECLARE_READ8_MEMBER(read_ram);
165   DECLARE_WRITE8_MEMBER(write_ram);
166   DECLARE_WRITE8_MEMBER(write_cart);
172   DECLARE_WRITE_LINE_MEMBER(sms_int_callback);
173   DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
174   DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input);
175   DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input);
176   DECLARE_READ32_MEMBER(sms_pixel_color);
167177
168   DECLARE_WRITE8_MEMBER(sms_mapper_w);
169   DECLARE_WRITE8_MEMBER(sms_mem_control_w);
170   DECLARE_WRITE8_MEMBER(gg_sio_w);
171   DECLARE_READ8_MEMBER(gg_sio_r);
172178   DECLARE_DRIVER_INIT(sg1000m3);
173179   DECLARE_DRIVER_INIT(gamegear);
174180   DECLARE_DRIVER_INIT(gamegeaj);
r243155r243156
183189   DECLARE_VIDEO_RESET(gamegear);
184190   DECLARE_VIDEO_START(sms1);
185191   DECLARE_VIDEO_RESET(sms1);
186   void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
187   UINT32 screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
192
188193   UINT32 screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
189194   UINT32 screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
195   UINT32 screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
196   void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
190197   void screen_vblank_sms1(screen_device &screen, bool state);
191   DECLARE_WRITE_LINE_MEMBER(sms_int_callback);
192   DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
193   DECLARE_READ32_MEMBER(sms_pixel_color);
194   DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input);
195   DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input);
196198
197199protected:
198200   UINT8 read_bus(address_space &space, unsigned int bank, UINT16 base_addr, UINT16 offset);
trunk/src/mess/machine/sms.c
r243155r243156
9494      data1 = m_port_gg_dc->read();
9595      m_port_dc_reg &= ~0x03f | data1;
9696
97      data2 = m_port_gear2gear->port_r();
97      data2 = m_port_gg_ext->port_r();
9898   }
9999   else
100100   {
r243155r243156
207207      if (!m_is_gamegear)
208208         m_port_ctrl2->port_w(ctrl2_port_data);
209209      else
210         m_port_gear2gear->port_w(ctrl2_port_data); // not verified
210         m_port_gg_ext->port_w(ctrl2_port_data); // not verified
211211   }
212212   // check if TH is set to input (1).
213213   if (data & 0x08)
r243155r243156
215215      if (!m_is_gamegear)
216216         ctrl2_port_data &= ~0x40 | m_port_ctrl2->port_r();
217217      else
218         ctrl2_port_data &= ~0x40 | m_port_gear2gear->port_r(); // not verified
218         ctrl2_port_data &= ~0x40 | m_port_gg_ext->port_r(); // not verified
219219
220220      // check if TH input level is high (1) and was output/low (0)
221221      if ((ctrl2_port_data & 0x40) && !(m_io_ctrl_reg & 0x88))


Previous 199869 Revisions Next


© 1997-2024 The MAME Team