trunk/src/mame/drivers/wico.c
| r18214 | r18215 | |
| 1 | 1 | /************************************************************************** |
| 2 | 2 | |
| 3 | | Pinball |
| 4 | | Wico's only game : Af-tor |
| 3 | Pinball |
| 4 | Wico's only game : Af-tor |
| 5 | 5 | |
| 6 | Schematic and PinMAME used as references. |
| 7 | Code for the interrupts/timers was derived from PinMAME. |
| 8 | |
| 9 | |
| 6 | 10 | ***************************************************************************/ |
| 7 | 11 | |
| 8 | | #include "emu.h" |
| 12 | #include "machine/genpin.h" |
| 9 | 13 | #include "cpu/m6809/m6809.h" |
| 14 | #include "machine/nvram.h" |
| 15 | #include "sound/sn76496.h" |
| 16 | //#include "wico.lh" |
| 10 | 17 | |
| 18 | |
| 11 | 19 | class wico_state : public driver_device |
| 12 | 20 | { |
| 13 | 21 | public: |
| 14 | 22 | wico_state(const machine_config &mconfig, device_type type, const char *tag) |
| 15 | 23 | : driver_device(mconfig, type, tag), |
| 16 | | m_maincpu(*this, "maincpu") |
| 24 | m_maincpu(*this, "maincpu"), |
| 25 | m_cpu2(*this, "maincpu"), |
| 26 | m_shared_ram(*this, "sharedram"), |
| 27 | m_samples(*this, "samples") |
| 17 | 28 | { } |
| 18 | 29 | |
| 30 | DECLARE_WRITE8_MEMBER(zcres_w); |
| 31 | TIMER_DEVICE_CALLBACK_MEMBER(irq_housekeeping); |
| 32 | TIMER_DEVICE_CALLBACK_MEMBER(firq_housekeeping); |
| 19 | 33 | protected: |
| 20 | 34 | |
| 21 | 35 | // devices |
| 22 | 36 | required_device<cpu_device> m_maincpu; |
| 37 | required_device<cpu_device> m_cpu2; |
| 38 | required_shared_ptr<UINT8> m_shared_ram; |
| 39 | required_device<samples_device> m_samples; |
| 23 | 40 | |
| 24 | 41 | // driver_device overrides |
| 25 | 42 | virtual void machine_reset(); |
| 43 | private: |
| 44 | UINT8 m_zcen; |
| 45 | UINT8 m_gten; |
| 46 | UINT8 m_firqtimer; |
| 26 | 47 | public: |
| 27 | 48 | DECLARE_DRIVER_INIT(wico); |
| 28 | 49 | }; |
| 29 | 50 | |
| 30 | | |
| 51 | // housekeeping cpu |
| 31 | 52 | static ADDRESS_MAP_START( wico_map, AS_PROGRAM, 8, wico_state ) |
| 32 | | AM_RANGE(0x0000, 0x07ff) AM_RAM |
| 33 | | //AM_RANGE(0x1fe0, 0x1fef) AM_READWRITE(io_r,io_w) |
| 53 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("sharedram") |
| 54 | AM_RANGE(0x1fe0, 0x1fe0) AM_NOP //AM_WRITE(muxld_w) |
| 55 | //AM_RANGE(0x1fe1, 0x1fe1) AM_WRITE(store_w) |
| 56 | //AM_RANGE(0x1fe2, 0x1fe2) AM_WRITE(muxen_w) |
| 57 | //AM_RANGE(0x1fe3, 0x1fe3) AM_WRITE(csols_w) |
| 58 | //AM_RANGE(0x1fe4, 0x1fe4) AM_WRITE(msols_w) |
| 59 | //AM_RANGE(0x1fe5, 0x1fe5) AM_DEVWRITE("sn76494", sn76494_new_device, write) |
| 60 | AM_RANGE(0x1fe6, 0x1fe6) AM_NOP //WRITE(wdogcl_w) |
| 61 | AM_RANGE(0x1fe7, 0x1fe7) AM_WRITE(zcres_w) |
| 62 | //AM_RANGE(0x1fe8, 0x1fe8) AM_WRITE(dled0_w) |
| 63 | //AM_RANGE(0x1fe9, 0x1fe9) AM_WRITE(dled1_w) |
| 64 | //AM_RANGE(0x1fea, 0x1fea) AM_WRITE(gentmrcl_w) |
| 65 | //AM_RANGE(0x1feb, 0x1feb) AM_READ(lampst_r) |
| 66 | //AM_RANGE(0x1fec, 0x1fec) AM_READ(sast_r) |
| 67 | //AM_RANGE(0x1fed, 0x1fed) AM_READ(solst1_r) |
| 68 | //AM_RANGE(0x1fee, 0x1fee) AM_READ(solst0_r) |
| 69 | //AM_RANGE(0x1fef, 0x1fef) AM_READ(switch_r) |
| 34 | 70 | AM_RANGE(0xf000, 0xffff) AM_ROM |
| 35 | 71 | ADDRESS_MAP_END |
| 36 | 72 | |
| 73 | // command cpu |
| 37 | 74 | static ADDRESS_MAP_START( wico_sub_map, AS_PROGRAM, 8, wico_state ) |
| 38 | | AM_RANGE(0x0000, 0x07ff) AM_RAM // shared ram with other cpu |
| 39 | | //AM_RANGE(0x1fe0, 0x1fef) AM_READWRITE(io_r,io_w) |
| 40 | | AM_RANGE(0x4000, 0x40ff) AM_RAM //nvram |
| 75 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("sharedram") // 2128 2k RAM |
| 76 | //AM_RANGE(0x1fe0, 0x1fe0) AM_WRITE(muxld_w) // to display module |
| 77 | //AM_RANGE(0x1fe1, 0x1fe1) AM_WRITE(store_w) // enable save to nvram |
| 78 | //AM_RANGE(0x1fe2, 0x1fe2) AM_WRITE(muxen_w) // digit to display on diagnostic LED; d0=L will disable main displays |
| 79 | //AM_RANGE(0x1fe3, 0x1fe3) AM_WRITE(csols_w) // solenoid column |
| 80 | //AM_RANGE(0x1fe4, 0x1fe4) AM_WRITE(msols_w) // solenoid row |
| 81 | //AM_RANGE(0x1fe5, 0x1fe5) AM_DEVWRITE("sn76494", sn76494_new_device, write) |
| 82 | //AM_RANGE(0x1fe6, 0x1fe6) AM_WRITE(wdogcl_w) // watchdog clear |
| 83 | AM_RANGE(0x1fe7, 0x1fe7) AM_WRITE(zcres_w) // enable IRQ on maincpu |
| 84 | //AM_RANGE(0x1fe8, 0x1fe8) AM_WRITE(dled0_w) // turn off diagnostic LED |
| 85 | //AM_RANGE(0x1fe9, 0x1fe9) AM_WRITE(dled1_w) // turn on diagnotic LED |
| 86 | //AM_RANGE(0x1fea, 0x1fea) AM_WRITE(gentmrcl_w) // enable IRQ on cpu2 |
| 87 | //AM_RANGE(0x1feb, 0x1feb) AM_READ(lampst_r) // lamps? |
| 88 | //AM_RANGE(0x1fec, 0x1fec) AM_READ(sast_r) // a pwron pulse to d0 L->H |
| 89 | //AM_RANGE(0x1fed, 0x1fed) AM_READ(solst1_r) // switches |
| 90 | //AM_RANGE(0x1fee, 0x1fee) AM_READ(solst0_r) // switches |
| 91 | //AM_RANGE(0x1fef, 0x1fef) AM_READ(switch_r) // switches |
| 92 | AM_RANGE(0x4000, 0x40ff) AM_RAM AM_SHARE("nvram") // X2212 4bit x 256 NVRAM, stores only when store_w is active |
| 41 | 93 | AM_RANGE(0x8000, 0x9fff) AM_ROM |
| 42 | 94 | AM_RANGE(0xe000, 0xffff) AM_ROM |
| 43 | 95 | ADDRESS_MAP_END |
| r18214 | r18215 | |
| 47 | 99 | |
| 48 | 100 | void wico_state::machine_reset() |
| 49 | 101 | { |
| 102 | m_zcen = 0; |
| 103 | m_gten = 0; |
| 50 | 104 | } |
| 51 | 105 | |
| 52 | 106 | DRIVER_INIT_MEMBER(wico_state,wico) |
| 53 | 107 | { |
| 54 | 108 | } |
| 55 | 109 | |
| 110 | WRITE8_MEMBER( wico_state::zcres_w ) |
| 111 | { |
| 112 | m_zcen = 1; |
| 113 | } |
| 114 | |
| 115 | |
| 116 | TIMER_DEVICE_CALLBACK_MEMBER( wico_state::irq_housekeeping ) |
| 117 | { |
| 118 | if (m_zcen) |
| 119 | generic_pulse_irq_line(m_maincpu, M6809_IRQ_LINE,1); |
| 120 | } |
| 121 | |
| 122 | TIMER_DEVICE_CALLBACK_MEMBER( wico_state::firq_housekeeping ) |
| 123 | { |
| 124 | if (!m_gten) |
| 125 | generic_pulse_irq_line(m_maincpu, M6809_FIRQ_LINE,1); |
| 126 | |
| 127 | // Gen. timer irq of command CPU kicks in every 4 interrupts of this timer |
| 128 | m_firqtimer++; |
| 129 | if (m_firqtimer > 3) |
| 130 | { |
| 131 | generic_pulse_irq_line(m_cpu2, M6809_IRQ_LINE,1); |
| 132 | m_firqtimer = 0; |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | |
| 137 | //------------------------------------------------- |
| 138 | // sn76496_config psg_intf |
| 139 | //------------------------------------------------- |
| 140 | |
| 141 | static const sn76496_config psg_intf = |
| 142 | { |
| 143 | DEVCB_NULL |
| 144 | }; |
| 145 | |
| 56 | 146 | static MACHINE_CONFIG_START( wico, wico_state ) |
| 57 | 147 | /* basic machine hardware */ |
| 58 | 148 | MCFG_CPU_ADD("maincpu", M6809, 10000000 / 8) |
| 59 | 149 | MCFG_CPU_PROGRAM_MAP(wico_map) |
| 150 | MCFG_TIMER_DRIVER_ADD_PERIODIC("irq", wico_state, irq_housekeeping, attotime::from_hz(120)) // zero crossing |
| 151 | MCFG_TIMER_DRIVER_ADD_PERIODIC("firq", wico_state, firq_housekeeping, attotime::from_hz(750)) // time generator |
| 60 | 152 | MCFG_CPU_ADD("cpu2", M6809, 10000000 / 8) |
| 61 | 153 | MCFG_CPU_PROGRAM_MAP(wico_sub_map) |
| 154 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 155 | |
| 156 | /* Video */ |
| 157 | //MCFG_DEFAULT_LAYOUT(layout_wico) |
| 158 | |
| 159 | /* Sound */ |
| 160 | MCFG_FRAGMENT_ADD( genpin_audio ) |
| 161 | MCFG_SOUND_ADD("sn76494", SN76494, 10000000 / 8) |
| 162 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 163 | MCFG_SOUND_CONFIG(psg_intf) |
| 62 | 164 | MACHINE_CONFIG_END |
| 63 | 165 | |
| 64 | 166 | /*------------------------------------------------------------------- |
| r18214 | r18215 | |
| 77 | 179 | / Big Top (1977) |
| 78 | 180 | /-------------------------------------------------------------------*/ |
| 79 | 181 | |
| 80 | | GAME(1984, aftor, 0, wico, wico, wico_state, wico, ROT0, "Wico", "Af-Tor", GAME_IS_SKELETON_MECHANICAL) |
| 182 | GAME(1984, aftor, 0, wico, wico, wico_state, wico, ROT0, "Wico", "Af-Tor", GAME_IS_SKELETON_MECHANICAL) |