trunk/src/emu/machine/68340sim.c
| r24865 | r24866 | |
| 4 | 4 | #include "68340.h" |
| 5 | 5 | |
| 6 | 6 | |
| 7 | |
| 7 | 8 | READ16_MEMBER( m68340cpu_device::m68340_internal_sim_r ) |
| 8 | 9 | { |
| 9 | 10 | m68340cpu_device *m68k = this; |
| r24865 | r24866 | |
| 164 | 165 | |
| 165 | 166 | case m68340SIM_AVR_RSR: |
| 166 | 167 | 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); |
| 167 | 169 | break; |
| 168 | 170 | |
| 169 | 171 | case m68340SIM_SWIV_SYPCR: |
| r24865 | r24866 | |
| 172 | 174 | |
| 173 | 175 | case m68340SIM_PICR: |
| 174 | 176 | 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); |
| 175 | 178 | break; |
| 176 | 179 | |
| 177 | 180 | case m68340SIM_PITR: |
| 178 | 181 | 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 | |
| 179 | 189 | break; |
| 180 | 190 | |
| 181 | 191 | case m68340SIM_SWSR: |
| r24865 | r24866 | |
| 297 | 307 | |
| 298 | 308 | } |
| 299 | 309 | |
| 310 | void 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; |
| 300 | 315 | |
| 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 | |
| 334 | TIMER_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 | |
| 340 | void 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 | |
| 301 | 345 | void m68340_sim::reset(void) |
| 302 | 346 | { |
| 303 | 347 | } |
trunk/src/mame/drivers/mpu5hw.c
| r24865 | r24866 | |
| 54 | 54 | DECLARE_READ32_MEMBER(mpu5_mem_r); |
| 55 | 55 | DECLARE_WRITE32_MEMBER(mpu5_mem_w); |
| 56 | 56 | |
| 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 | |
| 57 | 62 | protected: |
| 58 | 63 | |
| 59 | 64 | // devices |
| r24865 | r24866 | |
| 61 | 66 | virtual void machine_start(); |
| 62 | 67 | }; |
| 63 | 68 | |
| 69 | READ8_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 | } |
| 64 | 75 | |
| 76 | |
| 77 | READ32_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 | |
| 65 | 87 | READ32_MEMBER(mpu5_state::mpu5_mem_r) |
| 66 | 88 | { |
| 67 | 89 | 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); |
| 69 | 92 | |
| 70 | 93 | switch ( cs ) |
| 71 | 94 | { |
| 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 | |
| 72 | 107 | case 4: |
| 73 | 108 | offset &=0x3fff; |
| 74 | 109 | return (m_mainram[offset]); |
| r24865 | r24866 | |
| 85 | 120 | return 0x0000; |
| 86 | 121 | } |
| 87 | 122 | |
| 123 | |
| 124 | WRITE8_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 | |
| 131 | WRITE32_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 | |
| 88 | 139 | WRITE32_MEMBER(mpu5_state::mpu5_mem_w) |
| 89 | 140 | { |
| 90 | 141 | 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); |
| 92 | 144 | |
| 93 | 145 | switch ( cs ) |
| 94 | 146 | { |
| 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 | |
| 95 | 160 | case 4: |
| 96 | 161 | offset &=0x3fff; |
| 97 | 162 | COMBINE_DATA(&m_mainram[offset]); |
trunk/src/mame/drivers/cupidon.c
| r24865 | r24866 | |
| 1 | | /* Cupidon - Russian Fruit Machines? */ |
| 1 | /* Cupidon - Russian Video Fruit Machines? */ |
| 2 | 2 | |
| 3 | 3 | /* |
| 4 | 4 | seems to be Kupidon in the ROMs? |
| 5 | 5 | |
| 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? |
| 6 | 11 | */ |
| 7 | 12 | |
| 8 | 13 | |
| 9 | 14 | #include "emu.h" |
| 10 | 15 | #include "machine/68340.h" |
| 11 | 16 | |
| 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. |
| 14 | 17 | |
| 18 | |
| 15 | 19 | class cupidon_state : public driver_device |
| 16 | 20 | { |
| 17 | 21 | public: |
| 18 | 22 | cupidon_state(const machine_config &mconfig, device_type type, const char *tag) |
| 19 | 23 | : driver_device(mconfig, type, tag), |
| 20 | | m_maincpu(*this, "maincpu") |
| 24 | m_maincpu(*this, "maincpu"), |
| 25 | m_gfxram(*this, "gfxram") |
| 21 | 26 | { } |
| 22 | 27 | |
| 23 | | protected: |
| 24 | | |
| 25 | 28 | // devices |
| 26 | 29 | required_device<m68340cpu_device> m_maincpu; |
| 27 | | public: |
| 30 | required_shared_ptr<UINT32> m_gfxram; |
| 31 | |
| 32 | UINT32 screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 33 | |
| 28 | 34 | DECLARE_DRIVER_INIT(cupidon); |
| 35 | DECLARE_DRIVER_INIT(funnyfm); |
| 36 | |
| 29 | 37 | DECLARE_READ32_MEMBER( cupidon_return_ffffffff ) |
| 30 | 38 | { |
| 31 | 39 | return -1; // or it hits an illegal opcode (sleep on the 68340?) |
| 32 | 40 | }; |
| 33 | 41 | |
| 42 | protected: |
| 43 | |
| 44 | |
| 34 | 45 | }; |
| 35 | 46 | |
| 47 | UINT32 cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 48 | { |
| 49 | |
| 50 | int count = 0; |
| 36 | 51 | |
| 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... |
| 37 | 81 | static 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 | |
| 39 | 84 | AM_RANGE(0x1000000, 0x100ffff) AM_RAM |
| 40 | 85 | AM_RANGE(0x1800000, 0x1800003) AM_READ(cupidon_return_ffffffff) |
| 41 | 86 | 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? |
| 42 | 97 | ADDRESS_MAP_END |
| 43 | 98 | |
| 44 | 99 | static INPUT_PORTS_START( cupidon ) |
| r24865 | r24866 | |
| 46 | 101 | |
| 47 | 102 | |
| 48 | 103 | static 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? |
| 50 | 105 | MCFG_CPU_PROGRAM_MAP(cupidon_map) |
| 51 | 106 | |
| 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 | |
| 52 | 116 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 53 | | /* unknown sound */ |
| 117 | /* unknown sound, probably DAC driven using 68340 DMA */ |
| 54 | 118 | MACHINE_CONFIG_END |
| 55 | 119 | |
| 56 | 120 | |
| r24865 | r24866 | |
| 103 | 167 | { |
| 104 | 168 | } |
| 105 | 169 | |
| 170 | DRIVER_INIT_MEMBER(cupidon_state,funnyfm) |
| 171 | { |
| 172 | } |
| 173 | |
| 106 | 174 | /* (c) date is from string in ROM, revision date is noted next to sets - Spellings are as found in ROM */ |
| 107 | 175 | GAME( 2004, tsarevna ,0, cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Tsarevna (v1.29)", GAME_IS_SKELETON ) // 12 Oct 2005 |
| 108 | 176 | GAME( 2004, tsarevnaa ,tsarevna, cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Tsarevna (v1.31)", GAME_IS_SKELETON ) // 17 Jan 2007 |
| 109 | 177 | |
| 110 | 178 | GAME( 2004, gangrose ,0, cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Gangster's Roses (v4.70)", GAME_IS_SKELETON ) // 01 Sep 2004 |
| 111 | 179 | |
| 112 | | GAME( 2004, funnyfm ,0, cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Funny Farm (v1.17)", GAME_IS_SKELETON ) // 02 Mar 2005 |
| 180 | GAME( 2004, funnyfm ,0, cupidon, cupidon, cupidon_state, funnyfm, ROT0, "Kupidon","Funny Farm (v1.17)", GAME_IS_SKELETON ) // 02 Mar 2005 |
| 113 | 181 | GAME( 2004, funnyfma ,funnyfm, cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Funny Farm (v1.26)", GAME_IS_SKELETON ) // 08 Aug 2005 |
| 114 | 182 | GAME( 2004, funnyfmb ,funnyfm, cupidon, cupidon, cupidon_state, cupidon, ROT0, "Kupidon","Funny Farm (v1.30)", GAME_IS_SKELETON ) // 16 May 2006 |
| 115 | 183 | |