trunk/src/mame/drivers/ggconnie.c
| r20282 | r20283 | |
| 24 | 24 | #include "cpu/h6280/h6280.h" |
| 25 | 25 | #include "sound/c6280.h" |
| 26 | 26 | #include "sound/okim6295.h" |
| 27 | #include "machine/msm6242.h" |
| 27 | 28 | |
| 28 | 29 | |
| 29 | 30 | class ggconnie_state : public pce_common_state |
| r20282 | r20283 | |
| 32 | 33 | ggconnie_state(const machine_config &mconfig, device_type type, const char *tag) |
| 33 | 34 | : pce_common_state(mconfig, type, tag), |
| 34 | 35 | m_huc6260(*this, "huc6260"), |
| 36 | m_rtc(*this, "rtc"), |
| 35 | 37 | m_oki(*this, "oki") |
| 36 | 38 | { } |
| 37 | 39 | |
| 38 | 40 | required_device <huc6260_device> m_huc6260; |
| 41 | required_device <msm6242_device> m_rtc; |
| 39 | 42 | required_device <okim6295_device> m_oki; |
| 40 | 43 | DECLARE_WRITE8_MEMBER(lamp_w); |
| 41 | 44 | DECLARE_WRITE8_MEMBER(output_w); |
| r20282 | r20283 | |
| 47 | 50 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 48 | 51 | }; |
| 49 | 52 | |
| 53 | UINT32 ggconnie_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 54 | { |
| 55 | m_huc6260->video_update( bitmap, cliprect ); |
| 56 | return 0; |
| 57 | } |
| 50 | 58 | |
| 59 | WRITE8_MEMBER(ggconnie_state::lamp_w) |
| 60 | { |
| 61 | output_set_value("lamp", !BIT(data,0)); |
| 62 | } |
| 63 | |
| 64 | WRITE8_MEMBER(ggconnie_state::output_w) |
| 65 | { |
| 66 | // written in "Output Test" in test mode |
| 67 | } |
| 68 | |
| 69 | /* TODO: banking not understood (is the ROM dumped correctly btw?) */ |
| 70 | WRITE8_MEMBER(ggconnie_state::oki_bank_w) |
| 71 | { |
| 72 | m_oki->set_bank_base((data) ? 0x40000 : 0x00000); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | static ADDRESS_MAP_START( sgx_mem , AS_PROGRAM, 8, ggconnie_state ) |
| 77 | AM_RANGE( 0x000000, 0x0fffff) AM_ROM |
| 78 | AM_RANGE( 0x110000, 0x1edfff) AM_NOP |
| 79 | AM_RANGE( 0x1ee800, 0x1effff) AM_NOP |
| 80 | AM_RANGE( 0x1f0000, 0x1f5fff) AM_RAM |
| 81 | AM_RANGE( 0x1f7000, 0x1f7000) AM_READ_PORT("SWA") |
| 82 | AM_RANGE( 0x1f7100, 0x1f7100) AM_READ_PORT("SWB") |
| 83 | AM_RANGE( 0x1f7200, 0x1f7200) AM_READ_PORT("SWC") |
| 84 | AM_RANGE( 0x1f7700, 0x1f7700) AM_READ_PORT("IN1") |
| 85 | AM_RANGE( 0x1f7800, 0x1f7800) AM_WRITE(output_w) |
| 86 | AM_RANGE( 0x1fe000, 0x1fe007) AM_DEVREADWRITE( "huc6270_0", huc6270_device, read, write ) AM_MIRROR(0x03E0) |
| 87 | AM_RANGE( 0x1fe008, 0x1fe00f) AM_DEVREADWRITE( "huc6202", huc6202_device, read, write ) AM_MIRROR(0x03E0) |
| 88 | AM_RANGE( 0x1fe010, 0x1fe017) AM_DEVREADWRITE( "huc6270_1", huc6270_device, read, write ) AM_MIRROR(0x03E0) |
| 89 | AM_RANGE( 0x1fe400, 0x1fe7ff) AM_DEVREADWRITE( "huc6260", huc6260_device, read, write ) |
| 90 | AM_RANGE( 0x1fe800, 0x1febff) AM_DEVREADWRITE("c6280", c6280_device, c6280_r, c6280_w) |
| 91 | AM_RANGE( 0x1fec00, 0x1fefff) AM_DEVREADWRITE("maincpu", h6280_device, timer_r, timer_w) |
| 92 | AM_RANGE( 0x1f7300, 0x1f7300) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 93 | AM_RANGE( 0x1f7400, 0x1f74ff) AM_WRITE(oki_bank_w) |
| 94 | AM_RANGE( 0x1f7500, 0x1f750f) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 95 | AM_RANGE( 0x1ff000, 0x1ff000) AM_READ_PORT("IN0") AM_WRITE(lamp_w) |
| 96 | AM_RANGE( 0x1ff400, 0x1ff7ff) AM_DEVREADWRITE("maincpu", h6280_device, irq_status_r, irq_status_w ) |
| 97 | ADDRESS_MAP_END |
| 98 | |
| 99 | static ADDRESS_MAP_START( sgx_io , AS_IO, 8, ggconnie_state ) |
| 100 | AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6202", huc6202_device, io_read, io_write ) |
| 101 | ADDRESS_MAP_END |
| 102 | |
| 103 | |
| 51 | 104 | static INPUT_PORTS_START(ggconnie) |
| 52 | 105 | PORT_START("IN0") |
| 53 | 106 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME( "Medal" ) |
| r20282 | r20283 | |
| 125 | 178 | PORT_DIPNAME(0x40, 0x00, "RAM Clear" ) PORT_DIPLOCATION("SWC:7") |
| 126 | 179 | PORT_DIPSETTING(0x40, DEF_STR(Off) ) |
| 127 | 180 | PORT_DIPSETTING(0x00, DEF_STR(On) ) |
| 128 | | PORT_SERVICE(0x80, IP_ACTIVE_LOW) PORT_DIPLOCATION("SWC:8") |
| 129 | | |
| 181 | PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_LOW) PORT_DIPLOCATION("SWC:8") |
| 130 | 182 | INPUT_PORTS_END |
| 131 | 183 | |
| 132 | | WRITE8_MEMBER(ggconnie_state::lamp_w) |
| 133 | | { |
| 134 | | output_set_value("lamp", !BIT(data,0)); |
| 135 | | } |
| 136 | | |
| 137 | | WRITE8_MEMBER(ggconnie_state::output_w) |
| 138 | | { |
| 139 | | // written in "Output Test" in test mode |
| 140 | | } |
| 141 | | |
| 142 | | /* TODO: unknown type */ |
| 143 | | READ8_MEMBER(ggconnie_state::rtc_r) |
| 144 | | { |
| 145 | | system_time systime; |
| 146 | | machine().base_datetime(systime); |
| 147 | | |
| 148 | | switch(offset) |
| 149 | | { |
| 150 | | case 0x00: return (systime.local_time.second % 10) & 0xf; |
| 151 | | case 0x01: return (systime.local_time.second / 10) & 0xf; |
| 152 | | case 0x02: return (systime.local_time.minute % 10) & 0xf; |
| 153 | | case 0x03: return (systime.local_time.minute / 10) & 0xf; |
| 154 | | case 0x04: return (systime.local_time.hour % 10) & 0xf; |
| 155 | | case 0x05: return (systime.local_time.hour / 10) & 0xf; |
| 156 | | case 0x07: return ((systime.local_time.day+1) % 10) & 0xf; |
| 157 | | case 0x08: return ((systime.local_time.day+1) / 10) & 0xf; |
| 158 | | case 0x09: return ((systime.local_time.month+1) % 10) & 0xf; |
| 159 | | case 0x0a: return ((systime.local_time.month+1) / 10) & 0xf; |
| 160 | | case 0x0b: return ((systime.local_time.year-1996) % 10) & 0xf; |
| 161 | | case 0x0c: return (((systime.local_time.year-1996) % 100) / 10) & 0xf; |
| 162 | | } |
| 163 | | |
| 164 | | return 0; |
| 165 | | } |
| 166 | | |
| 167 | | WRITE8_MEMBER(ggconnie_state::rtc_w) |
| 168 | | { |
| 169 | | } |
| 170 | | |
| 171 | | /* TODO: banking not understood (is the ROM dumped correctly btw?) */ |
| 172 | | WRITE8_MEMBER(ggconnie_state::oki_bank_w) |
| 173 | | { |
| 174 | | m_oki->set_bank_base((data) ? 0x40000 : 0x00000); |
| 175 | | } |
| 176 | | |
| 177 | | |
| 178 | | static ADDRESS_MAP_START( sgx_mem , AS_PROGRAM, 8, ggconnie_state ) |
| 179 | | AM_RANGE( 0x000000, 0x0fffff) AM_ROM |
| 180 | | AM_RANGE( 0x110000, 0x1edfff) AM_NOP |
| 181 | | AM_RANGE( 0x1ee800, 0x1effff) AM_NOP |
| 182 | | AM_RANGE( 0x1f0000, 0x1f5fff) AM_RAM |
| 183 | | AM_RANGE( 0x1f7000, 0x1f7000) AM_READ_PORT("SWA") |
| 184 | | AM_RANGE( 0x1f7100, 0x1f7100) AM_READ_PORT("SWB") |
| 185 | | AM_RANGE( 0x1f7200, 0x1f7200) AM_READ_PORT("SWC") |
| 186 | | AM_RANGE( 0x1f7700, 0x1f7700) AM_READ_PORT("IN1") |
| 187 | | AM_RANGE( 0x1f7800, 0x1f7800) AM_WRITE(output_w) |
| 188 | | AM_RANGE( 0x1fe000, 0x1fe007) AM_DEVREADWRITE( "huc6270_0", huc6270_device, read, write ) AM_MIRROR(0x03E0) |
| 189 | | AM_RANGE( 0x1fe008, 0x1fe00f) AM_DEVREADWRITE( "huc6202", huc6202_device, read, write ) AM_MIRROR(0x03E0) |
| 190 | | AM_RANGE( 0x1fe010, 0x1fe017) AM_DEVREADWRITE( "huc6270_1", huc6270_device, read, write ) AM_MIRROR(0x03E0) |
| 191 | | AM_RANGE( 0x1fe400, 0x1fe7ff) AM_DEVREADWRITE( "huc6260", huc6260_device, read, write ) |
| 192 | | AM_RANGE( 0x1fe800, 0x1febff) AM_DEVREADWRITE("c6280", c6280_device, c6280_r, c6280_w) |
| 193 | | AM_RANGE( 0x1fec00, 0x1fefff) AM_DEVREADWRITE("maincpu", h6280_device, timer_r, timer_w) |
| 194 | | AM_RANGE( 0x1f7300, 0x1f7300) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 195 | | AM_RANGE( 0x1f7400, 0x1f74ff) AM_WRITE(oki_bank_w) |
| 196 | | AM_RANGE( 0x1f7500, 0x1f750f) AM_READWRITE(rtc_r,rtc_w) |
| 197 | | AM_RANGE( 0x1ff000, 0x1ff000) AM_READ_PORT("IN0") AM_WRITE(lamp_w) |
| 198 | | AM_RANGE( 0x1ff400, 0x1ff7ff) AM_DEVREADWRITE("maincpu", h6280_device, irq_status_r, irq_status_w ) |
| 199 | | ADDRESS_MAP_END |
| 200 | | |
| 201 | | static ADDRESS_MAP_START( sgx_io , AS_IO, 8, ggconnie_state ) |
| 202 | | AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6202", huc6202_device, io_read, io_write ) |
| 203 | | ADDRESS_MAP_END |
| 204 | | |
| 205 | 184 | static const c6280_interface c6280_config = |
| 206 | 185 | { |
| 207 | 186 | "maincpu" |
| 208 | 187 | }; |
| 209 | 188 | |
| 210 | | UINT32 ggconnie_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 211 | | { |
| 212 | | m_huc6260->video_update( bitmap, cliprect ); |
| 213 | | return 0; |
| 214 | | } |
| 215 | | |
| 216 | | |
| 217 | 189 | WRITE_LINE_MEMBER(ggconnie_state::pce_irq_changed) |
| 218 | 190 | { |
| 219 | 191 | machine().device("maincpu")->execute().set_input_line(0, state); |
| r20282 | r20283 | |
| 277 | 249 | DEVCB_DEVICE_LINE_MEMBER( "huc6202", huc6202_device, hsync_changed ) |
| 278 | 250 | }; |
| 279 | 251 | |
| 252 | static MSM6242_INTERFACE( ggconnie_rtc_intf ) |
| 253 | { |
| 254 | DEVCB_NULL |
| 255 | }; |
| 280 | 256 | |
| 257 | |
| 281 | 258 | static MACHINE_CONFIG_START( ggconnie, ggconnie_state ) |
| 282 | 259 | /* basic machine hardware */ |
| 283 | 260 | MCFG_CPU_ADD("maincpu", H6280, PCE_MAIN_CLOCK/3) |
| 284 | 261 | MCFG_CPU_PROGRAM_MAP(sgx_mem) |
| 285 | 262 | MCFG_CPU_IO_MAP(sgx_io) |
| 286 | 263 | |
| 287 | | // MCFG_QUANTUM_TIME(attotime::from_hz(60)) |
| 288 | | |
| 289 | 264 | /* video hardware */ |
| 290 | 265 | MCFG_SCREEN_ADD("screen", RASTER) |
| 291 | 266 | MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK/3, HUC6260_WPF, 64, 64 + 1024 + 64, HUC6260_LPF, 18, 18 + 242) |
| r20282 | r20283 | |
| 299 | 274 | MCFG_HUC6270_ADD( "huc6270_1", sgx_huc6270_1_config ) |
| 300 | 275 | MCFG_HUC6202_ADD( "huc6202", sgx_huc6202_config ) |
| 301 | 276 | |
| 277 | MCFG_MSM6242_ADD("rtc", ggconnie_rtc_intf) |
| 278 | |
| 302 | 279 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") |
| 303 | 280 | MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6) |
| 304 | 281 | MCFG_SOUND_CONFIG(c6280_config) |