Previous 199869 Revisions Next

r24866 Tuesday 13th August, 2013 at 11:40:48 UTC by David Haywood
make it a bit more obvious cupidon.c is a video based system, not a screenless fruit machine one (nw)
[src/emu/machine]68340.c 68340.h 68340sim.c 68340sim.h
[src/mame/drivers]cupidon.c mpu5hw.c

trunk/src/emu/machine/68340.c
r24865r24866
142142   m68340SERIAL->reset();
143143   m68340TIMER->reset();
144144
145   start_68340_sim();
146
145147   m68340_base = 0x00000000;
146148
147149   internal = &this->space(AS_PROGRAM);
trunk/src/emu/machine/68340.h
r24865r24866
3232
3333   UINT32 m68340_base;
3434
35   UINT16 m_avr;
36   UINT16 m_picr;
37   UINT16 m_pitr;
3538
36
3739   READ32_MEMBER( m68340_internal_base_r );
3840   WRITE32_MEMBER( m68340_internal_base_w );
3941   READ32_MEMBER( m68340_internal_dma_r );
r24865r24866
4951   READ32_MEMBER( m68340_internal_timer_r );
5052   WRITE32_MEMBER( m68340_internal_timer_w );
5153
52
54   emu_timer *m_irq_timer;
55   TIMER_CALLBACK_MEMBER(periodic_interrupt_timer_callback);
56   void start_68340_sim(void);
57   void do_timer_irq(void);
5358protected:
5459
5560   virtual void device_start();
trunk/src/emu/machine/68340sim.c
r24865r24866
44#include "68340.h"
55
66
7
78READ16_MEMBER( m68340cpu_device::m68340_internal_sim_r )
89{
910   m68340cpu_device *m68k = this;
r24865r24866
164165
165166         case m68340SIM_AVR_RSR:
166167            logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (AVR, RSR - Auto Vector Register, Reset Status Register)\n", pc, offset*2,data,mem_mask);
168            COMBINE_DATA(&m_avr);
167169            break;
168170
169171         case m68340SIM_SWIV_SYPCR:
r24865r24866
172174
173175         case m68340SIM_PICR:
174176            logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (PICR - Periodic Interrupt Control Register)\n", pc, offset*2,data,mem_mask);
177            COMBINE_DATA(&m_picr);
175178            break;
176179
177180         case m68340SIM_PITR:
178181            logerror("%08x m68340_internal_sim_w %04x, %04x (%04x) (PITR - Periodic Interrupt Timer Register)\n", pc, offset*2,data,mem_mask);
182            COMBINE_DATA(&m_pitr);
183            if (m_pitr !=0 ) // hack
184            {
185               //logerror("timer set\n");
186               m_irq_timer->adjust(cycles_to_attotime(20000)); // hack
187            }
188
179189            break;
180190
181191         case m68340SIM_SWSR:
r24865r24866
297307
298308}
299309
310void m68340cpu_device::do_timer_irq(void)
311{
312   //logerror("do_timer_irq\n");
313   int timer_irq_level  = (m_picr & 0x0700)>>8;
314   int timer_irq_vector = (m_picr & 0x00ff)>>0;
300315
316   if (timer_irq_level) // 0 is irq disabled
317   {
318      int use_autovector = (m_avr >> timer_irq_level)&1;
319
320      if (use_autovector)
321      {
322         //logerror("irq with autovector\n");
323         set_input_line(timer_irq_level, HOLD_LINE);
324      }
325      else
326      {
327         //logerror("irq without autovector\n");
328         set_input_line_and_vector(timer_irq_level, HOLD_LINE, timer_irq_vector);
329      }
330
331   }
332}
333
334TIMER_CALLBACK_MEMBER(m68340cpu_device::periodic_interrupt_timer_callback)
335{
336   do_timer_irq();
337   m_irq_timer->adjust(cycles_to_attotime(20000)); // hack
338}
339
340void m68340cpu_device::start_68340_sim(void)
341{
342   m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m68340cpu_device::periodic_interrupt_timer_callback),this));
343}
344
301345void m68340_sim::reset(void)
302346{
303347}
trunk/src/emu/machine/68340sim.h
r24865r24866
5454   UINT32 m_am[4];
5555   UINT32 m_ba[4];
5656
57
5857   void reset(void);
5958};
trunk/src/mame/drivers/mpu5hw.c
r24865r24866
5454   DECLARE_READ32_MEMBER(mpu5_mem_r);
5555   DECLARE_WRITE32_MEMBER(mpu5_mem_w);
5656
57   DECLARE_READ32_MEMBER(asic_r32);
58   DECLARE_READ8_MEMBER(asic_r8);
59   DECLARE_WRITE32_MEMBER(asic_w32);
60   DECLARE_WRITE8_MEMBER(asic_w8);
61
5762protected:
5863
5964   // devices
r24865r24866
6166   virtual void machine_start();
6267};
6368
69READ8_MEMBER(mpu5_state::asic_r8)
70{
71   int pc = space.device().safe_pc();
72   logerror("%08x maincpu read from ASIC - offset %01x\n", pc, offset);
73   return 0;
74}
6475
76
77READ32_MEMBER(mpu5_state::asic_r32)
78{
79   UINT32 retdata = 0;
80   if (mem_mask&0xff000000) retdata |= asic_r8(space,(offset*4)+0) <<24;
81   if (mem_mask&0x00ff0000) retdata |= asic_r8(space,(offset*4)+1) <<16;
82   if (mem_mask&0x0000ff00) retdata |= asic_r8(space,(offset*4)+2) <<8;
83   if (mem_mask&0x000000ff) retdata |= asic_r8(space,(offset*4)+3) <<0;
84   return retdata;
85}
86
6587READ32_MEMBER(mpu5_state::mpu5_mem_r)
6688{
6789   int pc = space.device().safe_pc();
68   int cs = m68340_get_cs(m_maincpu, offset * 4);
90   int addr = offset *4;
91   int cs = m68340_get_cs(m_maincpu, addr);
6992
7093   switch ( cs )
7194   {
95
96      case 2:
97         if ((addr & 0xf0) == 0xf0)
98         {
99            return asic_r32(space, offset&3,mem_mask);
100         }
101         else
102         {
103            logerror("%08x maincpu read access offset %08x mem_mask %08x cs %d\n", pc, offset*4, mem_mask, cs);
104         }
105         break;
106
72107      case 4:
73108         offset &=0x3fff;
74109         return (m_mainram[offset]);
r24865r24866
85120   return 0x0000;
86121}
87122
123
124WRITE8_MEMBER(mpu5_state::asic_w8)
125{
126   int pc = space.device().safe_pc();
127   logerror("%08x maincpu write to ASIC - offset %01x data %02x\n", pc, offset, data);
128}
129
130
131WRITE32_MEMBER(mpu5_state::asic_w32)
132{
133   if (mem_mask&0xff000000) asic_w8(space,(offset*4)+0, (data>>24)&0xff);
134   if (mem_mask&0x00ff0000) asic_w8(space,(offset*4)+1, (data>>16)&0xff);
135   if (mem_mask&0x0000ff00) asic_w8(space,(offset*4)+2, (data>>8) &0xff);
136   if (mem_mask&0x000000ff) asic_w8(space,(offset*4)+3, (data>>0) &0xff);
137}
138
88139WRITE32_MEMBER(mpu5_state::mpu5_mem_w)
89140{
90141   int pc = space.device().safe_pc();
91   int cs = m68340_get_cs(m_maincpu, offset * 4);
142   int addr = offset *4;
143   int cs = m68340_get_cs(m_maincpu, addr);
92144
93145   switch ( cs )
94146   {
147
148      case 2:
149         if ((addr & 0xf0) == 0xf0)
150         {
151            asic_w32(space, offset&3,data,mem_mask);
152         }
153         else
154         {
155            logerror("%08x maincpu write access offset %08x data %08x mem_mask %08x cs %d\n", pc, offset*4, data, mem_mask, cs);
156         }
157         break;
158
159
95160      case 4:
96161         offset &=0x3fff;
97162         COMBINE_DATA(&m_mainram[offset]);
trunk/src/mame/drivers/cupidon.c
r24865r24866
1/* Cupidon - Russian Fruit Machines? */
1/* Cupidon - Russian Video Fruit Machines? */
22
33/*
44 seems to be Kupidon in the ROMs?
55
6 these act a bit like the pluto5 ones but with a video system, possibly a variant on that?
7 
8 needs 68340 peripherals (irq controller + timer at least) to be fleshed out.
9
10 video might be vga-like?
611*/
712
813
914#include "emu.h"
1015#include "machine/68340.h"
1116
12// looks similar to the pluto / astra stuff in terms of accesses, but these are much bigger (video based?) roms
13// needs 68340 peripherals (irq controller + timer at least) to be fleshed out.
1417
18
1519class cupidon_state : public driver_device
1620{
1721public:
1822   cupidon_state(const machine_config &mconfig, device_type type, const char *tag)
1923      : driver_device(mconfig, type, tag),
20         m_maincpu(*this, "maincpu")
24         m_maincpu(*this, "maincpu"),
25         m_gfxram(*this, "gfxram")
2126   { }
2227
23protected:
24
2528   // devices
2629   required_device<m68340cpu_device> m_maincpu;
27public:
30   required_shared_ptr<UINT32> m_gfxram;
31
32   UINT32 screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
33
2834   DECLARE_DRIVER_INIT(cupidon);
35   DECLARE_DRIVER_INIT(funnyfm);
36
2937   DECLARE_READ32_MEMBER( cupidon_return_ffffffff )
3038   {
3139      return -1; // or it hits an illegal opcode (sleep on the 68340?)
3240   };
3341
42protected:
43
44
3445};
3546
47UINT32 cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
48{
49   
50   int count = 0;
3651
52   for (int ytile=0;ytile<16;ytile++)
53   {
54     
55
56      for (int xtile=0;xtile<32;xtile++)
57      {
58
59         for (int y=0;y<16;y++)
60         {
61            UINT16* destline = &bitmap.pix16(ytile*16 + y);
62
63            for (int x=0;x<8;x++)
64            {
65               UINT32 gfx = m_gfxram[count];
66
67               destline[(xtile*16)+(x*2)+0] = (gfx >> 16)&0xffff;
68               destline[(xtile*16)+(x*2)+1] = (gfx >> 0)&0xffff;
69
70               count++;
71            }
72         }
73      }
74   }
75
76
77   return 0;
78}
79
80// could be pumped through the get_cs function (if they use the memory protection features we might have to) but that's slow...
3781static ADDRESS_MAP_START( cupidon_map, AS_PROGRAM, 32, cupidon_state )
38   AM_RANGE(0x0000000, 0x07fffff) AM_ROM
82   AM_RANGE(0x0000000, 0x07fffff) AM_ROM AM_MIRROR(0x1000000)                     
83
3984   AM_RANGE(0x1000000, 0x100ffff) AM_RAM
4085   AM_RANGE(0x1800000, 0x1800003) AM_READ(cupidon_return_ffffffff)
4186   AM_RANGE(0x2000074, 0x2000077) AM_RAM // port
87
88//   AM_RANGE(0x2000040, 0x200004f) AM_RAM
89
90
91// might just be 4mb of VRAM
92   AM_RANGE(0x3000000, 0x33bffff) AM_RAM
93   AM_RANGE(0x33c0000, 0x33fffff) AM_RAM AM_SHARE("gfxram") // seems to upload graphics to here, tiles etc. if you skip the loop after the romtest in funnyfm
94//   AM_RANGE(0x3400000, 0x3400fff) AM_RAM
95//   AM_RANGE(0x3F80000, 0x3F80003) AM_RAM
96   AM_RANGE(0x3FF0400, 0x3FF0403) AM_RAM // register? gangrose likes to read this?
4297ADDRESS_MAP_END
4398
4499static INPUT_PORTS_START(  cupidon )
r24865r24866
46101
47102
48103static MACHINE_CONFIG_START( cupidon, cupidon_state )
49   MCFG_CPU_ADD("maincpu", M68340, 16000000)    // The access to 3FF00 at the start would suggest this is a 68340
104   MCFG_CPU_ADD("maincpu", M68340, 16000000)    // The access to 3FF00 at the start would suggest this is a 68340 so probably 16 or 25 mhz?
50105   MCFG_CPU_PROGRAM_MAP(cupidon_map)
51106
107   MCFG_SCREEN_ADD("screen", RASTER)
108   MCFG_SCREEN_REFRESH_RATE(60)
109   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
110   MCFG_SCREEN_SIZE(64*8, 32*8)
111   MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
112   MCFG_SCREEN_UPDATE_DRIVER(cupidon_state, screen_update_cupidon)
113
114   MCFG_PALETTE_LENGTH(0x10000)
115
52116   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
53   /* unknown sound */
117   /* unknown sound, probably DAC driven using 68340 DMA */
54118MACHINE_CONFIG_END
55119
56120
r24865r24866
103167{
104168}
105169
170DRIVER_INIT_MEMBER(cupidon_state,funnyfm)
171{
172}
173
106174/* (c) date is from string in ROM, revision date is noted next to sets - Spellings are as found in ROM */
107175GAME( 2004, tsarevna        ,0,         cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Tsarevna (v1.29)", GAME_IS_SKELETON ) // 12 Oct 2005
108176GAME( 2004, tsarevnaa       ,tsarevna,  cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Tsarevna (v1.31)", GAME_IS_SKELETON ) // 17 Jan 2007
109177
110178GAME( 2004, gangrose        ,0,         cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Gangster's Roses (v4.70)", GAME_IS_SKELETON ) // 01 Sep 2004
111179
112GAME( 2004, funnyfm         ,0,         cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Funny Farm (v1.17)", GAME_IS_SKELETON ) // 02 Mar 2005
180GAME( 2004, funnyfm         ,0,         cupidon, cupidon, cupidon_state, funnyfm, ROT0, "Kupidon","Funny Farm (v1.17)", GAME_IS_SKELETON ) // 02 Mar 2005
113181GAME( 2004, funnyfma        ,funnyfm,   cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Funny Farm (v1.26)", GAME_IS_SKELETON ) // 08 Aug 2005
114182GAME( 2004, funnyfmb        ,funnyfm,   cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Funny Farm (v1.30)", GAME_IS_SKELETON ) // 16 May 2006
115183

Previous 199869 Revisions Next


© 1997-2024 The MAME Team