Previous 199869 Revisions Next

r18215 Sunday 30th September, 2012 at 15:55:04 UTC by Robbbert
AFTOR - wip
[src/mame/drivers]wico.c

trunk/src/mame/drivers/wico.c
r18214r18215
11/**************************************************************************
22
3Pinball
4Wico's only game : Af-tor
3    Pinball
4    Wico's only game : Af-tor
55
6    Schematic and PinMAME used as references.
7    Code for the interrupts/timers was derived from PinMAME.
8
9
610***************************************************************************/
711
8#include "emu.h"
12#include "machine/genpin.h"
913#include "cpu/m6809/m6809.h"
14#include "machine/nvram.h"
15#include "sound/sn76496.h"
16//#include "wico.lh"
1017
18
1119class wico_state : public driver_device
1220{
1321public:
1422   wico_state(const machine_config &mconfig, device_type type, const char *tag)
1523      : 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")
1728   { }
1829
30   DECLARE_WRITE8_MEMBER(zcres_w);
31   TIMER_DEVICE_CALLBACK_MEMBER(irq_housekeeping);
32   TIMER_DEVICE_CALLBACK_MEMBER(firq_housekeeping);
1933protected:
2034
2135   // devices
2236   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;
2340
2441   // driver_device overrides
2542   virtual void machine_reset();
43private:
44   UINT8 m_zcen;
45   UINT8 m_gten;
46   UINT8 m_firqtimer;
2647public:
2748   DECLARE_DRIVER_INIT(wico);
2849};
2950
30
51// housekeeping cpu
3152static 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)
3470   AM_RANGE(0xf000, 0xffff) AM_ROM
3571ADDRESS_MAP_END
3672
73// command cpu
3774static 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
4193   AM_RANGE(0x8000, 0x9fff) AM_ROM
4294   AM_RANGE(0xe000, 0xffff) AM_ROM
4395ADDRESS_MAP_END
r18214r18215
4799
48100void wico_state::machine_reset()
49101{
102   m_zcen = 0;
103   m_gten = 0;
50104}
51105
52106DRIVER_INIT_MEMBER(wico_state,wico)
53107{
54108}
55109
110WRITE8_MEMBER( wico_state::zcres_w )
111{
112   m_zcen = 1;
113}
114
115
116TIMER_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
122TIMER_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
141static const sn76496_config psg_intf =
142{
143   DEVCB_NULL
144};
145
56146static MACHINE_CONFIG_START( wico, wico_state )
57147   /* basic machine hardware */
58148   MCFG_CPU_ADD("maincpu", M6809, 10000000 / 8)
59149   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
60152   MCFG_CPU_ADD("cpu2", M6809, 10000000 / 8)
61153   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)
62164MACHINE_CONFIG_END
63165
64166/*-------------------------------------------------------------------
r18214r18215
77179/ Big Top  (1977)
78180/-------------------------------------------------------------------*/
79181
80GAME(1984,  aftor,  0,  wico,  wico, wico_state,  wico,  ROT0,  "Wico",    "Af-Tor",    GAME_IS_SKELETON_MECHANICAL)
182GAME(1984,  aftor,  0,  wico,  wico, wico_state,  wico,  ROT0,  "Wico", "Af-Tor", GAME_IS_SKELETON_MECHANICAL)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team