trunk/src/emu/bus/gamegear/gear2gear.c
| r243155 | r243156 | |
| 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 | | |
| 20 | | const 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 | | |
| 32 | | device_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 | | |
| 43 | | device_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 | | |
| 57 | | gg_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 | | |
| 70 | | gg_gear2gear_port_device::~gg_gear2gear_port_device() |
| 71 | | { |
| 72 | | } |
| 73 | | |
| 74 | | |
| 75 | | //------------------------------------------------- |
| 76 | | // device_start - device-specific startup |
| 77 | | //------------------------------------------------- |
| 78 | | |
| 79 | | void 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 | | |
| 88 | | UINT8 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 | | |
| 96 | | void gg_gear2gear_port_device::port_w( UINT8 data ) |
| 97 | | { |
| 98 | | if (m_device) |
| 99 | | m_device->peripheral_w(data); |
| 100 | | } |
| 101 | | |
| 102 | | |
| 103 | | void gg_gear2gear_port_device::th_pin_w(int state) |
| 104 | | { |
| 105 | | m_th_pin_handler(state); |
| 106 | | } |
| 107 | | |
| 108 | | UINT32 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 | | |
| 118 | | SLOT_INTERFACE_START( gg_gear2gear_port_devices ) |
| 119 | | SLOT_INTERFACE("smsctrladp", SMS_CTRL_ADAPTOR) |
| 120 | | SLOT_INTERFACE_END |
trunk/src/emu/bus/gamegear/gear2gear.h
| r243155 | r243156 | |
| 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 | | |
| 48 | | class device_gg_gear2gear_port_interface; |
| 49 | | |
| 50 | | class gg_gear2gear_port_device : public device_t, |
| 51 | | public device_slot_interface |
| 52 | | { |
| 53 | | public: |
| 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 | | |
| 92 | | private: |
| 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 |
| 101 | | class device_gg_gear2gear_port_interface : public device_slot_card_interface |
| 102 | | { |
| 103 | | public: |
| 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 | | |
| 111 | | protected: |
| 112 | | gg_gear2gear_port_device *m_port; |
| 113 | | }; |
| 114 | | |
| 115 | | |
| 116 | | // device type definition |
| 117 | | extern const device_type GG_GEAR2GEAR_PORT; |
| 118 | | |
| 119 | | |
| 120 | | SLOT_INTERFACE_EXTERN( gg_gear2gear_port_devices ); |
| 121 | | |
| 122 | | |
| 123 | | #endif |
trunk/src/emu/bus/gamegear/ggext.c
| r0 | r243156 | |
| 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 | |
| 20 | const 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 | |
| 32 | device_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 | |
| 43 | device_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 | |
| 57 | gg_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 | |
| 70 | gg_ext_port_device::~gg_ext_port_device() |
| 71 | { |
| 72 | } |
| 73 | |
| 74 | |
| 75 | //------------------------------------------------- |
| 76 | // device_start - device-specific startup |
| 77 | //------------------------------------------------- |
| 78 | |
| 79 | void 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 | |
| 88 | UINT8 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 | |
| 96 | void gg_ext_port_device::port_w( UINT8 data ) |
| 97 | { |
| 98 | if (m_device) |
| 99 | m_device->peripheral_w(data); |
| 100 | } |
| 101 | |
| 102 | |
| 103 | void gg_ext_port_device::th_pin_w(int state) |
| 104 | { |
| 105 | m_th_pin_handler(state); |
| 106 | } |
| 107 | |
| 108 | UINT32 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 | |
| 118 | SLOT_INTERFACE_START( gg_ext_port_devices ) |
| 119 | SLOT_INTERFACE("smsctrladp", SMS_CTRL_ADAPTOR) |
| 120 | SLOT_INTERFACE_END |
trunk/src/emu/bus/gamegear/ggext.h
| r0 | r243156 | |
| 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 | |
| 48 | class device_gg_ext_port_interface; |
| 49 | |
| 50 | class gg_ext_port_device : public device_t, |
| 51 | public device_slot_interface |
| 52 | { |
| 53 | public: |
| 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 | |
| 91 | private: |
| 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 |
| 100 | class device_gg_ext_port_interface : public device_slot_card_interface |
| 101 | { |
| 102 | public: |
| 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 | |
| 110 | protected: |
| 111 | gg_ext_port_device *m_port; |
| 112 | }; |
| 113 | |
| 114 | |
| 115 | // device type definition |
| 116 | extern const device_type GG_EXT_PORT; |
| 117 | |
| 118 | |
| 119 | SLOT_INTERFACE_EXTERN( gg_ext_port_devices ); |
| 120 | |
| 121 | |
| 122 | #endif |
trunk/src/emu/video/315_5124.c
| r243155 | r243156 | |
| 14 | 14 | - Display mode 1 (text) |
| 15 | 15 | - Display mode 3 (multicolor) |
| 16 | 16 | - Sprite doubling bug of the 315-5124 chip |
| 17 | - Verify timing on the Game Gear (315-5378 chip) |
| 17 | 18 | |
| 18 | 19 | |
| 19 | 20 | SMS Display Timing |
| r243155 | r243156 | |
| 343 | 344 | rec.min_x = SEGA315_5124_LBORDER_START; |
| 344 | 345 | rec.max_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 1; |
| 345 | 346 | 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); |
| 347 | 348 | } |
| 348 | 349 | break; |
| 349 | 350 | |
| r243155 | r243156 | |
| 358 | 359 | rec.min_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256; |
| 359 | 360 | rec.max_x = rec.min_x + SEGA315_5124_RBORDER_WIDTH - 1; |
| 360 | 361 | 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); |
| 362 | 363 | } |
| 363 | 364 | break; |
| 364 | 365 | |
| r243155 | r243156 | |
| 847 | 848 | //logerror("%x %x\n", pixel_plot_x, line); |
| 848 | 849 | if (tile_column == 0 && (x_scroll & 0x07)) |
| 849 | 850 | { |
| 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; |
| 853 | 855 | } |
| 854 | 856 | else |
| 855 | 857 | { |
| 856 | 858 | line_buffer[pixel_plot_x] = m_current_palette[pen_selected]; |
| 859 | priority_selected[pixel_plot_x] = priority_select | (pen_selected & 0x0f); |
| 857 | 860 | } |
| 858 | | priority_selected[pixel_plot_x] = priority_select | (pen_selected & 0x0f); |
| 859 | 861 | } |
| 860 | 862 | } |
| 861 | 863 | } |
| r243155 | r243156 | |
| 1012 | 1014 | |
| 1013 | 1015 | m_sprite_count = max_sprites; |
| 1014 | 1016 | |
| 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]) |
| 1016 | 1019 | { |
| 1017 | 1020 | m_pending_status |= STATUS_SPROVR; |
| 1018 | 1021 | } |
| r243155 | r243156 | |
| 1030 | 1033 | if (m_display_disabled || m_sprite_count == 0) |
| 1031 | 1034 | return; |
| 1032 | 1035 | |
| 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. */ |
| 1034 | 1038 | if (m_reg[0x00] & 0x20) |
| 1035 | 1039 | plot_min_x = 8; |
| 1036 | 1040 | |
| r243155 | r243156 | |
| 1084 | 1088 | continue; |
| 1085 | 1089 | } |
| 1086 | 1090 | |
| 1091 | /* Draw sprite pixel */ |
| 1092 | /* Check if the background has lower priority */ |
| 1087 | 1093 | if (!(priority_selected[pixel_plot_x] & PRIORITY_BIT)) |
| 1088 | 1094 | { |
| 1089 | 1095 | line_buffer[pixel_plot_x] = m_current_palette[pen_selected]; |
| r243155 | r243156 | |
| 1296 | 1302 | |
| 1297 | 1303 | if ( line < m_frame_timing[ACTIVE_DISPLAY_V] ) |
| 1298 | 1304 | { |
| 1305 | memset(priority_selected, 1, sizeof(priority_selected)); |
| 1306 | |
| 1299 | 1307 | switch( m_vdp_mode ) |
| 1300 | 1308 | { |
| 1301 | 1309 | case 0: |
| 1302 | | memset(priority_selected, 1, sizeof(priority_selected)); |
| 1303 | 1310 | if ( line >= 0 ) |
| 1304 | 1311 | { |
| 1305 | 1312 | draw_scanline_mode0( blitline_buffer, line ); |
| r243155 | r243156 | |
| 1311 | 1318 | break; |
| 1312 | 1319 | |
| 1313 | 1320 | case 2: |
| 1314 | | memset(priority_selected, 1, sizeof(priority_selected)); |
| 1315 | 1321 | if ( line >= 0 ) |
| 1316 | 1322 | { |
| 1317 | 1323 | draw_scanline_mode2( blitline_buffer, line ); |
| r243155 | r243156 | |
| 1324 | 1330 | |
| 1325 | 1331 | case 4: |
| 1326 | 1332 | default: |
| 1327 | | memset(priority_selected, 0, sizeof(priority_selected)); |
| 1328 | 1333 | if ( line >= 0 ) |
| 1329 | 1334 | { |
| 1330 | 1335 | draw_scanline_mode4( blitline_buffer, priority_selected, line ); |
| r243155 | r243156 | |
| 1346 | 1351 | rec.min_x = pixel_offset_x; |
| 1347 | 1352 | rec.max_x = pixel_offset_x + 255; |
| 1348 | 1353 | 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); |
| 1350 | 1355 | } |
| 1351 | 1356 | else |
| 1352 | 1357 | { |
| r243155 | r243156 | |
| 1361 | 1366 | UINT8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x); |
| 1362 | 1367 | int x = 0; |
| 1363 | 1368 | |
| 1364 | | if (m_vdp_mode == 4 && m_reg[0x00] & 0x20) |
| 1369 | if (m_vdp_mode == 4 && (m_reg[0x00] & 0x20)) |
| 1365 | 1370 | { |
| 1366 | 1371 | /* Fill column 0 with overscan color from m_reg[0x07] */ |
| 1367 | 1372 | do |
| 1368 | 1373 | { |
| 1369 | 1374 | 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; |
| 1371 | 1376 | } |
| 1372 | 1377 | while(++x < 8); |
| 1373 | 1378 | } |
| r243155 | r243156 | |
| 1375 | 1380 | do |
| 1376 | 1381 | { |
| 1377 | 1382 | 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; |
| 1379 | 1384 | } |
| 1380 | 1385 | while(++x < 256); |
| 1381 | 1386 | } |
| r243155 | r243156 | |
| 1397 | 1402 | do |
| 1398 | 1403 | { |
| 1399 | 1404 | 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; |
| 1401 | 1406 | } |
| 1402 | 1407 | while (++x < 48); |
| 1403 | 1408 | |
| r243155 | r243156 | |
| 1406 | 1411 | do |
| 1407 | 1412 | { |
| 1408 | 1413 | 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; |
| 1410 | 1415 | } |
| 1411 | 1416 | while (++x < 208); |
| 1412 | 1417 | } |
| r243155 | r243156 | |
| 1416 | 1421 | do |
| 1417 | 1422 | { |
| 1418 | 1423 | 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; |
| 1420 | 1425 | } |
| 1421 | 1426 | while (++x < 208); |
| 1422 | 1427 | } |
| r243155 | r243156 | |
| 1425 | 1430 | do |
| 1426 | 1431 | { |
| 1427 | 1432 | 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; |
| 1429 | 1434 | } |
| 1430 | 1435 | while (++x < 256); |
| 1431 | 1436 | } |
trunk/src/mess/drivers/sms.c
| r243155 | r243156 | |
| 14 | 14 | |
| 15 | 15 | - SIO interface for Game Gear (needs netplay, I guess) |
| 16 | 16 | - Sega Demo Unit II (kiosk expansion device) |
| 17 | - SMS 8 slot game changer (kiosk expansion device) |
| 17 | 18 | - SMS Disk System (floppy disk drive expansion device) - unreleased |
| 18 | 19 | - Rapid button of Japanese Master System |
| 19 | 20 | - Keyboard support for Sega Mark III (sg1000m3 driver) |
| r243155 | r243156 | |
| 57 | 58 | - Few games of the ones with FM support need to detect the system region as |
| 58 | 59 | Japanese to play FM sound; |
| 59 | 60 | - 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 |
| 61 | 62 | version, and a Korean advert shows support on the first version (Gam*Boy I, |
| 62 | 63 | although based on Japanese SMS); |
| 63 | 64 | - The Korean SMS versions have Japanese-format cartridge slot, but only on the |
| 64 | 65 | first (Gam*Boy I) the region is detected as Japanese; |
| 65 | 66 | - Some SMS ROMs don't run when are plugged-in to SMS expansion slot, through |
| 66 | 67 | 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; |
| 69 | 70 | |
| 70 | 71 | -------------------------------------------------------------------------------- |
| 71 | 72 | |
| r243155 | r243156 | |
| 405 | 406 | INPUT_PORTS_END |
| 406 | 407 | |
| 407 | 408 | static 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. |
| 408 | 416 | PORT_INCLUDE( sms1 ) |
| 409 | 417 | |
| 410 | 418 | PORT_START("DSW") |
| r243155 | r243156 | |
| 805 | 813 | |
| 806 | 814 | MCFG_SOFTWARE_LIST_ADD("cart_list", "gamegear") |
| 807 | 815 | |
| 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 |
| 811 | 819 | MACHINE_CONFIG_END |
| 812 | 820 | |
| 813 | 821 | |
trunk/src/mess/includes/sms.h
| r243155 | r243156 | |
| 19 | 19 | #define CONTROL1_TAG "ctrl1" |
| 20 | 20 | #define CONTROL2_TAG "ctrl2" |
| 21 | 21 | |
| 22 | | #include "bus/gamegear/gear2gear.h" |
| 22 | #include "bus/gamegear/ggext.h" |
| 23 | 23 | #include "bus/sms_ctrl/smsctrl.h" |
| 24 | 24 | #include "bus/sms_exp/smsexp.h" |
| 25 | 25 | #include "bus/sega8/sega8_slot.h" |
| r243155 | r243156 | |
| 37 | 37 | m_region_maincpu(*this, "maincpu"), |
| 38 | 38 | m_port_ctrl1(*this, CONTROL1_TAG), |
| 39 | 39 | m_port_ctrl2(*this, CONTROL2_TAG), |
| 40 | | m_port_gear2gear(*this, "gear2gear"), |
| 40 | m_port_gg_ext(*this, "ext"), |
| 41 | 41 | m_port_gg_dc(*this, "GG_PORT_DC"), |
| 42 | 42 | m_port_pause(*this, "PAUSE"), |
| 43 | 43 | m_port_reset(*this, "RESET"), |
| r243155 | r243156 | |
| 66 | 66 | required_memory_region m_region_maincpu; |
| 67 | 67 | optional_device<sms_control_port_device> m_port_ctrl1; |
| 68 | 68 | 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; |
| 70 | 70 | optional_ioport m_port_gg_dc; |
| 71 | 71 | optional_ioport m_port_pause; |
| 72 | 72 | optional_ioport m_port_reset; |
| r243155 | r243156 | |
| 75 | 75 | optional_ioport m_port_scope_binocular; |
| 76 | 76 | optional_ioport m_port_persist; |
| 77 | 77 | |
| 78 | | device_t *m_left_lcd; |
| 79 | | device_t *m_right_lcd; |
| 80 | 78 | 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; |
| 88 | 79 | UINT8 *m_mainram; |
| 89 | 80 | 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]; |
| 94 | 81 | |
| 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; |
| 97 | 87 | |
| 98 | 88 | // for gamegear LCD persistence hack |
| 99 | 89 | bitmap_rgb32 m_prev_bitmap; |
| r243155 | r243156 | |
| 105 | 95 | // vertical scaling in the gamegear sms compatibility mode. |
| 106 | 96 | int *m_line_buffer; |
| 107 | 97 | |
| 108 | | // for 3D glass binocular hack |
| 109 | | bitmap_rgb32 m_prevleft_bitmap; |
| 110 | | bitmap_rgb32 m_prevright_bitmap; |
| 111 | | |
| 112 | 98 | // model identifiers |
| 113 | 99 | UINT8 m_is_gamegear; |
| 114 | 100 | UINT8 m_is_gg_region_japan; |
| r243155 | r243156 | |
| 121 | 107 | UINT8 m_has_fm; |
| 122 | 108 | UINT8 m_has_jpn_sms_cart_slot; |
| 123 | 109 | |
| 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 | |
| 124 | 124 | // Data needed for Light Phaser |
| 125 | 125 | UINT8 m_ctrl1_th_state; |
| 126 | 126 | UINT8 m_ctrl2_th_state; |
| r243155 | r243156 | |
| 132 | 132 | UINT8 m_sscope_state; |
| 133 | 133 | UINT8 m_frame_sscope_state; |
| 134 | 134 | |
| 135 | // slot devices |
| 135 | 136 | sega8_cart_slot_device *m_cartslot; |
| 136 | 137 | sega8_card_slot_device *m_cardslot; |
| 137 | 138 | sms_expansion_slot_device *m_expslot; |
| 138 | 139 | |
| 139 | 140 | // 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]; |
| 140 | 143 | UINT8 m_store_control; |
| 141 | 144 | UINT8 m_store_cart_selection_data; |
| 142 | | sega8_cart_slot_device *m_slots[16]; |
| 143 | | sega8_card_slot_device *m_cards[16]; |
| 144 | 145 | void store_post_load(); |
| 145 | 146 | void store_select_cart(UINT8 data); |
| 146 | 147 | |
| 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); |
| 150 | 158 | DECLARE_WRITE8_MEMBER(sms_io_control_w); |
| 151 | 159 | DECLARE_READ8_MEMBER(sms_count_r); |
| 152 | 160 | DECLARE_READ8_MEMBER(sms_input_port_dc_r); |
| 153 | 161 | DECLARE_READ8_MEMBER(sms_input_port_dd_r); |
| 154 | 162 | 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); |
| 155 | 167 | DECLARE_WRITE8_MEMBER(sms_ym2413_register_port_w); |
| 156 | 168 | DECLARE_WRITE8_MEMBER(sms_ym2413_data_port_w); |
| 157 | 169 | DECLARE_READ8_MEMBER(sms_sscope_r); |
| 158 | 170 | DECLARE_WRITE8_MEMBER(sms_sscope_w); |
| 159 | | DECLARE_READ8_MEMBER(sms_mapper_r); |
| 160 | 171 | |
| 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); |
| 167 | 177 | |
| 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); |
| 172 | 178 | DECLARE_DRIVER_INIT(sg1000m3); |
| 173 | 179 | DECLARE_DRIVER_INIT(gamegear); |
| 174 | 180 | DECLARE_DRIVER_INIT(gamegeaj); |
| r243155 | r243156 | |
| 183 | 189 | DECLARE_VIDEO_RESET(gamegear); |
| 184 | 190 | DECLARE_VIDEO_START(sms1); |
| 185 | 191 | 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 | |
| 188 | 193 | UINT32 screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 189 | 194 | 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); |
| 190 | 197 | 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); |
| 196 | 198 | |
| 197 | 199 | protected: |
| 198 | 200 | UINT8 read_bus(address_space &space, unsigned int bank, UINT16 base_addr, UINT16 offset); |