branches/kale/src/mame/drivers/junofrst.c
| r244619 | r244620 | |
| 95 | 95 | junofrst_state(const machine_config &mconfig, device_type type, const char *tag) |
| 96 | 96 | : tutankhm_state(mconfig, type, tag), |
| 97 | 97 | m_audiocpu(*this, "audiocpu"), |
| 98 | | m_i8039(*this, "mcu") { } |
| 98 | m_i8039(*this, "mcu"), |
| 99 | m_filter_0_0(*this, "filter.0.0"), |
| 100 | m_filter_0_1(*this, "filter.0.1"), |
| 101 | m_filter_0_2(*this, "filter.0.2") { } |
| 99 | 102 | |
| 103 | required_device<cpu_device> m_audiocpu; |
| 104 | required_device<cpu_device> m_i8039; |
| 105 | required_device<filter_rc_device> m_filter_0_0; |
| 106 | required_device<filter_rc_device> m_filter_0_1; |
| 107 | required_device<filter_rc_device> m_filter_0_2; |
| 108 | |
| 100 | 109 | UINT8 m_blitterdata[4]; |
| 101 | 110 | int m_i8039_status; |
| 102 | 111 | int m_last_irq; |
| 103 | | |
| 104 | | required_device<cpu_device> m_audiocpu; |
| 105 | | required_device<cpu_device> m_i8039; |
| 106 | | |
| 107 | | device_t *m_filter_0_0; |
| 108 | | device_t *m_filter_0_1; |
| 109 | | device_t *m_filter_0_2; |
| 110 | | DECLARE_WRITE8_MEMBER(junofrst_blitter_w); |
| 111 | | DECLARE_WRITE8_MEMBER(junofrst_bankselect_w); |
| 112 | | DECLARE_WRITE8_MEMBER(junofrst_sh_irqtrigger_w); |
| 113 | | DECLARE_WRITE8_MEMBER(junofrst_i8039_irq_w); |
| 112 | |
| 113 | DECLARE_WRITE8_MEMBER(blitter_w); |
| 114 | DECLARE_WRITE8_MEMBER(bankselect_w); |
| 115 | DECLARE_WRITE8_MEMBER(sh_irqtrigger_w); |
| 116 | DECLARE_WRITE8_MEMBER(i8039_irq_w); |
| 114 | 117 | DECLARE_WRITE8_MEMBER(i8039_irqen_and_status_w); |
| 115 | 118 | DECLARE_WRITE8_MEMBER(flip_screen_w); |
| 116 | | DECLARE_WRITE8_MEMBER(junofrst_coin_counter_w); |
| 117 | | DECLARE_WRITE8_MEMBER(junofrst_irq_enable_w); |
| 118 | | DECLARE_READ8_MEMBER(junofrst_portA_r); |
| 119 | | DECLARE_WRITE8_MEMBER(junofrst_portB_w); |
| 119 | DECLARE_WRITE8_MEMBER(coincounter_w); |
| 120 | DECLARE_WRITE8_MEMBER(irq_enable_w); |
| 121 | DECLARE_READ8_MEMBER(portA_r); |
| 122 | DECLARE_WRITE8_MEMBER(portB_w); |
| 123 | |
| 120 | 124 | DECLARE_DRIVER_INIT(junofrst); |
| 121 | 125 | DECLARE_MACHINE_START(junofrst); |
| 122 | 126 | DECLARE_MACHINE_RESET(junofrst); |
| 123 | | INTERRUPT_GEN_MEMBER(junofrst_30hz_irq); |
| 127 | |
| 128 | INTERRUPT_GEN_MEMBER(_30hz_irq); |
| 124 | 129 | }; |
| 125 | 130 | |
| 126 | 131 | |
| r244619 | r244620 | |
| 142 | 147 | We have to mask it off otherwise the "Juno First" logo on the title screen is wrong. |
| 143 | 148 | */ |
| 144 | 149 | |
| 145 | | WRITE8_MEMBER(junofrst_state::junofrst_blitter_w) |
| 150 | WRITE8_MEMBER(junofrst_state::blitter_w) |
| 146 | 151 | { |
| 147 | 152 | m_blitterdata[offset] = data; |
| 148 | 153 | |
| r244619 | r244620 | |
| 195 | 200 | } |
| 196 | 201 | |
| 197 | 202 | |
| 198 | | WRITE8_MEMBER(junofrst_state::junofrst_bankselect_w) |
| 203 | WRITE8_MEMBER(junofrst_state::bankselect_w) |
| 199 | 204 | { |
| 200 | 205 | membank("bank1")->set_entry(data & 0x0f); |
| 201 | 206 | } |
| 202 | 207 | |
| 203 | 208 | |
| 204 | | READ8_MEMBER(junofrst_state::junofrst_portA_r) |
| 209 | READ8_MEMBER(junofrst_state::portA_r) |
| 205 | 210 | { |
| 206 | 211 | int timer; |
| 207 | 212 | |
| r244619 | r244620 | |
| 217 | 222 | } |
| 218 | 223 | |
| 219 | 224 | |
| 220 | | WRITE8_MEMBER(junofrst_state::junofrst_portB_w) |
| 225 | WRITE8_MEMBER(junofrst_state::portB_w) |
| 221 | 226 | { |
| 222 | | device_t *filter[3] = { m_filter_0_0, m_filter_0_1, m_filter_0_2 }; |
| 227 | filter_rc_device *filter[3] = { m_filter_0_0, m_filter_0_1, m_filter_0_2 }; |
| 223 | 228 | int i; |
| 224 | 229 | |
| 225 | 230 | for (i = 0; i < 3; i++) |
| r244619 | r244620 | |
| 232 | 237 | C += 220000; /* 220000pF = 0.22uF */ |
| 233 | 238 | |
| 234 | 239 | data >>= 2; |
| 235 | | dynamic_cast<filter_rc_device*>(filter[i])->filter_rc_set_RC(FLT_RC_LOWPASS, 1000, 2200, 200, CAP_P(C)); |
| 240 | filter[i]->filter_rc_set_RC(FLT_RC_LOWPASS, 1000, 2200, 200, CAP_P(C)); |
| 236 | 241 | } |
| 237 | 242 | } |
| 238 | 243 | |
| 239 | 244 | |
| 240 | | WRITE8_MEMBER(junofrst_state::junofrst_sh_irqtrigger_w) |
| 245 | WRITE8_MEMBER(junofrst_state::sh_irqtrigger_w) |
| 241 | 246 | { |
| 242 | 247 | if (m_last_irq == 0 && data == 1) |
| 243 | 248 | { |
| r244619 | r244620 | |
| 249 | 254 | } |
| 250 | 255 | |
| 251 | 256 | |
| 252 | | WRITE8_MEMBER(junofrst_state::junofrst_i8039_irq_w) |
| 257 | WRITE8_MEMBER(junofrst_state::i8039_irq_w) |
| 253 | 258 | { |
| 254 | 259 | m_i8039->set_input_line(0, ASSERT_LINE); |
| 255 | 260 | } |
| r244619 | r244620 | |
| 270 | 275 | } |
| 271 | 276 | |
| 272 | 277 | |
| 273 | | WRITE8_MEMBER(junofrst_state::junofrst_coin_counter_w) |
| 278 | WRITE8_MEMBER(junofrst_state::coincounter_w) |
| 274 | 279 | { |
| 275 | 280 | coin_counter_w(machine(), offset, data); |
| 276 | 281 | } |
| 277 | 282 | |
| 278 | | WRITE8_MEMBER(junofrst_state::junofrst_irq_enable_w) |
| 283 | WRITE8_MEMBER(junofrst_state::irq_enable_w) |
| 279 | 284 | { |
| 280 | 285 | m_irq_enable = data & 1; |
| 281 | 286 | if (!m_irq_enable) |
| r244619 | r244620 | |
| 291 | 296 | AM_RANGE(0x8024, 0x8024) AM_READ_PORT("P1") |
| 292 | 297 | AM_RANGE(0x8028, 0x8028) AM_READ_PORT("P2") |
| 293 | 298 | AM_RANGE(0x802c, 0x802c) AM_READ_PORT("DSW1") |
| 294 | | AM_RANGE(0x8030, 0x8030) AM_WRITE(junofrst_irq_enable_w) |
| 295 | | AM_RANGE(0x8031, 0x8032) AM_WRITE(junofrst_coin_counter_w) |
| 299 | AM_RANGE(0x8030, 0x8030) AM_WRITE(irq_enable_w) |
| 300 | AM_RANGE(0x8031, 0x8032) AM_WRITE(coincounter_w) |
| 296 | 301 | AM_RANGE(0x8033, 0x8033) AM_WRITEONLY AM_SHARE("scroll") /* not used in Juno */ |
| 297 | 302 | AM_RANGE(0x8034, 0x8035) AM_WRITE(flip_screen_w) |
| 298 | | AM_RANGE(0x8040, 0x8040) AM_WRITE(junofrst_sh_irqtrigger_w) |
| 303 | AM_RANGE(0x8040, 0x8040) AM_WRITE(sh_irqtrigger_w) |
| 299 | 304 | AM_RANGE(0x8050, 0x8050) AM_WRITE(soundlatch_byte_w) |
| 300 | | AM_RANGE(0x8060, 0x8060) AM_WRITE(junofrst_bankselect_w) |
| 301 | | AM_RANGE(0x8070, 0x8073) AM_WRITE(junofrst_blitter_w) |
| 305 | AM_RANGE(0x8060, 0x8060) AM_WRITE(bankselect_w) |
| 306 | AM_RANGE(0x8070, 0x8073) AM_WRITE(blitter_w) |
| 302 | 307 | AM_RANGE(0x8100, 0x8fff) AM_RAM |
| 303 | 308 | AM_RANGE(0x9000, 0x9fff) AM_ROMBANK("bank1") |
| 304 | 309 | AM_RANGE(0xa000, 0xffff) AM_ROM |
| r244619 | r244620 | |
| 313 | 318 | AM_RANGE(0x4001, 0x4001) AM_DEVREAD("aysnd", ay8910_device, data_r) |
| 314 | 319 | AM_RANGE(0x4002, 0x4002) AM_DEVWRITE("aysnd", ay8910_device, data_w) |
| 315 | 320 | AM_RANGE(0x5000, 0x5000) AM_WRITE(soundlatch2_byte_w) |
| 316 | | AM_RANGE(0x6000, 0x6000) AM_WRITE(junofrst_i8039_irq_w) |
| 321 | AM_RANGE(0x6000, 0x6000) AM_WRITE(i8039_irq_w) |
| 317 | 322 | ADDRESS_MAP_END |
| 318 | 323 | |
| 319 | 324 | |
| r244619 | r244620 | |
| 370 | 375 | |
| 371 | 376 | MACHINE_START_MEMBER(junofrst_state,junofrst) |
| 372 | 377 | { |
| 373 | | m_filter_0_0 = machine().device("filter.0.0"); |
| 374 | | m_filter_0_1 = machine().device("filter.0.1"); |
| 375 | | m_filter_0_2 = machine().device("filter.0.2"); |
| 376 | | |
| 377 | 378 | save_item(NAME(m_i8039_status)); |
| 378 | 379 | save_item(NAME(m_last_irq)); |
| 379 | 380 | save_item(NAME(m_irq_toggle)); |
| r244619 | r244620 | |
| 395 | 396 | m_blitterdata[3] = 0; |
| 396 | 397 | } |
| 397 | 398 | |
| 398 | | INTERRUPT_GEN_MEMBER(junofrst_state::junofrst_30hz_irq) |
| 399 | INTERRUPT_GEN_MEMBER(junofrst_state::_30hz_irq) |
| 399 | 400 | { |
| 400 | 401 | /* flip flops cause the interrupt to be signalled every other frame */ |
| 401 | 402 | m_irq_toggle ^= 1; |
| r244619 | r244620 | |
| 408 | 409 | /* basic machine hardware */ |
| 409 | 410 | MCFG_CPU_ADD("maincpu", M6809, 1500000) /* 1.5 MHz ??? */ |
| 410 | 411 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 411 | | MCFG_CPU_VBLANK_INT_DRIVER("screen", junofrst_state, junofrst_30hz_irq) |
| 412 | MCFG_CPU_VBLANK_INT_DRIVER("screen", junofrst_state, _30hz_irq) |
| 412 | 413 | |
| 413 | 414 | MCFG_CPU_ADD("audiocpu", Z80,14318000/8) /* 1.78975 MHz */ |
| 414 | 415 | MCFG_CPU_PROGRAM_MAP(audio_map) |
| r244619 | r244620 | |
| 432 | 433 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 433 | 434 | |
| 434 | 435 | MCFG_SOUND_ADD("aysnd", AY8910, 14318000/8) |
| 435 | | MCFG_AY8910_PORT_A_READ_CB(READ8(junofrst_state, junofrst_portA_r)) |
| 436 | | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(junofrst_state, junofrst_portB_w)) |
| 436 | MCFG_AY8910_PORT_A_READ_CB(READ8(junofrst_state, portA_r)) |
| 437 | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(junofrst_state, portB_w)) |
| 437 | 438 | MCFG_SOUND_ROUTE(0, "filter.0.0", 0.30) |
| 438 | 439 | MCFG_SOUND_ROUTE(1, "filter.0.1", 0.30) |
| 439 | 440 | MCFG_SOUND_ROUTE(2, "filter.0.2", 0.30) |
| r244619 | r244620 | |
| 511 | 512 | } |
| 512 | 513 | |
| 513 | 514 | |
| 514 | | GAME( 1983, junofrst, 0, junofrst, junofrst, junofrst_state, junofrst, ROT90, "Konami", "Juno First", 0 ) |
| 515 | | GAME( 1983, junofrstg,junofrst, junofrst, junofrst, junofrst_state, junofrst, ROT90, "Konami (Gottlieb license)", "Juno First (Gottlieb)", 0 ) |
| 515 | GAME( 1983, junofrst, 0, junofrst, junofrst, junofrst_state, junofrst, ROT90, "Konami", "Juno First", GAME_SUPPORTS_SAVE ) |
| 516 | GAME( 1983, junofrstg,junofrst, junofrst, junofrst, junofrst_state, junofrst, ROT90, "Konami (Gottlieb license)", "Juno First (Gottlieb)", GAME_SUPPORTS_SAVE ) |