Previous 15994 Revisions Next

r11595 Friday 20th May, 2011 at 07:10:03 UTC by Miodrag Milanović
Sync with MAME (r12577) (no whatsnew)
[src/emu/cpu]cpu.mak
[src/emu/cpu/psx]dma.c dma.h
[src/mame]mame.lst mame.mak
[src/mame/drivers]5clown.c albazg.c aristmk4.c arkanoid.c avt.c blitz68k.c buster.c calomega.c carrera.c coinmstr.c fortecar.c funworld.c galdrvr.c goldnpkr.c hitpoker.c jokrwild.c kingdrby.c ksys573.c luckgrln.c madalien.c magicfly.c merit.c miniboy7.c mpu4drvr.c murogem.c namcos12.c nyny.c othello.c peplus.c progolf.c r2dtank.c rgum.c saturn.c slotcarn.c snk6502.c spiders.c ssingles.c stvinit.c twincobr.c twinkle.c usgames.c vcombat.c wardner.c
[src/mame/includes]stv.h
[src/mame/machine]scudsp.c stvprot.c
[src/mame/video]qix.c speedatk.c
[src/osd/sdl]sdl.mak sdlmain.c sound.c
[src/osd/windows]d3dintf.h

src/mame/mame.lst
r11594r11595
335335froggers1      // (c) 1981 Sega
336336froggers2      // 834-0068 (c) 1981 Sega
337337froggermc      // 800-3110 (c) 1981 Sega
338amidar         // GX337 (c) 1981 Konami
338amidar         // GX337 (c) 1982 Konami
339amidar1         // GX337 (c) 1981 Konami
339340amidaru         // GX337 (c) 1982 Konami + Stern license
340341amidaro         // GX337 (c) 1982 Konami + Olympia license
341342amidarb         // bootleg
src/mame/machine/scudsp.c
r11594r11595
5252#include "emu.h"
5353#include "machine/scudsp.h"
5454#include "sound/scsp.h"
55#include "includes/stv.h"
5556
5657/*DSP macros*/
57#define PRF ((stv_scu[32] & 0x04000000) >> 26)
58#define EPF ((stv_scu[32] & 0x02000000) >> 25)
59#define T0F ((stv_scu[32] & 0x00800000) >> 23)
60#define SF  ((stv_scu[32] & 0x00400000) >> 22)
61#define ZF  ((stv_scu[32] & 0x00200000) >> 21)
62#define CF  ((stv_scu[32] & 0x00100000) >> 20)
63#define VF  ((stv_scu[32] & 0x00080000) >> 19)
64#define EF  ((stv_scu[32] & 0x00040000) >> 18)
65#define ESF ((stv_scu[32] & 0x00020000) >> 17)
66#define EXF ((stv_scu[32] & 0x00010000) >> 16)
67#define LEF ((stv_scu[32] & 0x00008000) >> 15)
68#define T0F_1 if(!(stv_scu[32] & 0x00800000)) stv_scu[32]^=0x00800000
69#define T0F_0 if(stv_scu[32] & 0x00800000) stv_scu[32]^=0x00800000
58#define PRF ((state->m_scu_regs[32] & 0x04000000) >> 26)
59#define EPF ((state->m_scu_regs[32] & 0x02000000) >> 25)
60#define T0F ((state->m_scu_regs[32] & 0x00800000) >> 23)
61#define SF  ((state->m_scu_regs[32] & 0x00400000) >> 22)
62#define ZF  ((state->m_scu_regs[32] & 0x00200000) >> 21)
63#define CF  ((state->m_scu_regs[32] & 0x00100000) >> 20)
64#define VF  ((state->m_scu_regs[32] & 0x00080000) >> 19)
65#define EF  ((state->m_scu_regs[32] & 0x00040000) >> 18)
66#define ESF ((state->m_scu_regs[32] & 0x00020000) >> 17)
67#define EXF ((state->m_scu_regs[32] & 0x00010000) >> 16)
68#define LEF ((state->m_scu_regs[32] & 0x00008000) >> 15)
69#define T0F_1 if(!(state->m_scu_regs[32] & 0x00800000)) state->m_scu_regs[32]^=0x00800000
70#define T0F_0 if(state->m_scu_regs[32] & 0x00800000) state->m_scu_regs[32]^=0x00800000
7071
71#define SET_C(_val) (stv_scu[32] = ((stv_scu[32] & ~0x00100000) | ((_val) ? 0x00100000 : 0)))
72#define SET_S(_val) (stv_scu[32] = ((stv_scu[32] & ~0x00400000) | ((_val) ? 0x00400000 : 0)))
73#define SET_Z(_val) (stv_scu[32] = ((stv_scu[32] & ~0x00200000) | ((_val) ? 0x00200000 : 0)))
74#define SET_V(_val) (stv_scu[32] = ((stv_scu[32] & ~0x00080000) | ((_val) ? 0x00080000 : 0)))
72#define SET_C(_val) (state->m_scu_regs[32] = ((state->m_scu_regs[32] & ~0x00100000) | ((_val) ? 0x00100000 : 0)))
73#define SET_S(_val) (state->m_scu_regs[32] = ((state->m_scu_regs[32] & ~0x00400000) | ((_val) ? 0x00400000 : 0)))
74#define SET_Z(_val) (state->m_scu_regs[32] = ((state->m_scu_regs[32] & ~0x00200000) | ((_val) ? 0x00200000 : 0)))
75#define SET_V(_val) (state->m_scu_regs[32] = ((state->m_scu_regs[32] & ~0x00080000) | ((_val) ? 0x00080000 : 0)))
7576
7677typedef union {
7778   INT32  si;
r11594r11595
255256   }
256257}
257258
258static UINT32 dsp_compute_condition( UINT32 condition )
259static UINT32 dsp_compute_condition( address_space *space, UINT32 condition )
259260{
261   saturn_state *state = space->machine().driver_data<saturn_state>();
260262   UINT32 result = 0;
261263
262264   switch( condition & 0xf )
r11594r11595
314316
315317void dsp_prg_ctrl(address_space *space, UINT32 data)
316318{
319   saturn_state *state = space->machine().driver_data<saturn_state>();
317320   if(LEF) dsp_reg.pc = (data & 0xff);
318321   if(EXF) dsp_execute_program(space);
319   if(EF && (!(stv_scu[40] & 0x0020)))
322   if(EF && (!(state->m_scu_regs[40] & 0x0020)))
320323      cputag_set_input_line_and_vector(space->machine(), "maincpu", 0xa, HOLD_LINE , 0x45);
321324}
322325
r11594r11595
366369   return data;
367370}
368371
369static void dsp_operation(void)
372static void dsp_operation(address_space *space)
370373{
374   saturn_state *state = space->machine().driver_data<saturn_state>();
371375   INT64 i1,i2;
372376   INT32 i3;
373377   int update_ct[4] = {0,0,0,0};
r11594r11595
568572
569573}
570574
571static void dsp_move_immediate( void )
575static void dsp_move_immediate( address_space *space )
572576{
573577   UINT32 value;
574578
575579   if ( opcode & 0x2000000 )
576580   {
577      if ( dsp_compute_condition( (opcode & 0x3F80000 ) >> 18 ) )
581      if ( dsp_compute_condition( space, (opcode & 0x3F80000 ) >> 18 ) )
578582      {
579583         value = opcode & 0x7ffff;
580584         if ( value & 0x40000 ) value |= 0xfff80000;
r11594r11595
592596
593597static void dsp_dma( address_space *space )
594598{
599   saturn_state *state = space->machine().driver_data<saturn_state>();
600
595601   UINT8 hold = (opcode &  0x4000) >> 14;
596602   UINT32 add = (opcode & 0x38000) >> 15;
597603   UINT32 dir_from_D0 = (opcode & 0x1000 ) >> 12;
r11594r11595
700706   T0F_0;
701707}
702708
703static void dsp_jump( void )
709static void dsp_jump( address_space *space )
704710{
705711   if ( opcode & 0x3f80000 )
706712   {
707      if ( dsp_compute_condition( (opcode & 0x3f80000) >> 19 ) )
713      if ( dsp_compute_condition( space, (opcode & 0x3f80000) >> 19 ) )
708714      {
709715         dsp_reg.delay = dsp_reg.pc;
710716         dsp_reg.pc = opcode & 0xff;
r11594r11595
717723   }
718724}
719725
720static void dsp_end( void )
726static void dsp_end( address_space *dmaspace )
721727{
728   saturn_state *state = dmaspace->machine().driver_data<saturn_state>();
729
722730   if(opcode & 0x08000000)
723731   {
724732      /*ENDI*/
725      if(!EF) stv_scu[32]^=0x00040000;
726      if(EXF) stv_scu[32]^=0x00100000;
733      if(!EF) state->m_scu_regs[32]^=0x00040000;
734      if(EXF) state->m_scu_regs[32]^=0x00100000;
727735   }
728736   else
729737   {
730738      /*END*/
731      if(EXF) stv_scu[32]^=0x00100000;
739      if(EXF) state->m_scu_regs[32]^=0x00100000;
732740   }
733741
734742}
r11594r11595
824832      switch( (opcode & 0xc0000000) >> 30 )
825833      {
826834      case 0x00: /* 00 */
827         dsp_operation();
835         dsp_operation( dmaspace );
828836         break;
829837      case 0x01: /* 01 */
830838         /* unrecognized opcode */
831839         break;
832840      case 0x02: /* 10 */
833         dsp_move_immediate( );
841         dsp_move_immediate( dmaspace );
834842         break;
835843      case 0x03: /* 11 */
836844         switch( (opcode & 0x30000000) >> 28 )
r11594r11595
839847               dsp_dma(dmaspace);
840848               break;
841849            case 0x01:
842               dsp_jump();
850               dsp_jump(dmaspace);
843851               break;
844852            case 0x02:
845853               dsp_loop();
846854               break;
847855            case 0x03:
848               dsp_end();
856               dsp_end(dmaspace);
849857               cont = 0;
850858               break;
851859         }
src/mame/machine/stvprot.c
r11594r11595
114114
115115static READ32_HANDLER( twcup98_prot_r )
116116{
117   UINT32 *ROM = (UINT32 *)space->machine().region("user1")->base();
117   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
118118
119119   if(a_bus[0] & 0x00010000)//protection calculation is activated
120120   {
r11594r11595
173173
174174static READ32_HANDLER( sss_prot_r )
175175{
176   UINT32 *ROM = (UINT32 *)space->machine().region("user1")->base();
176   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
177177
178178   if(a_bus[0] & 0x00010000)//protection calculation is activated
179179   {
r11594r11595
238238
239239static READ32_HANDLER( rsgun_prot_r )
240240{
241   UINT32 *ROM = (UINT32 *)space->machine().region("user1")->base();
241   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
242242
243243   if(a_bus[0] & 0x00010000)//protection calculation is activated
244244   {
r11594r11595
313313
314314static READ32_HANDLER( elandore_prot_r )
315315{
316   UINT32 *ROM = (UINT32 *)space->machine().region("user1")->base();
316   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
317317
318318   if(a_bus[0] & 0x00010000)//protection calculation is activated
319319   {
r11594r11595
420420
421421static READ32_HANDLER( ffreveng_prot_r )
422422{
423   UINT32 *ROM = (UINT32 *)space->machine().region("user1")->base();
423   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
424424
425425   if(a_bus[0] & 0x00010000)//protection calculation is activated
426426   {
r11594r11595
531531
532532static READ32_HANDLER( decathlt_prot_r )
533533{
534   UINT32 *ROM = (UINT32 *)space->machine().region("user1")->base();
534   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
535535
536536   if (offset==2)
537537   {
src/mame/includes/stv.h
r11594r11595
11/*----------- defined in drivers/stv.c -----------*/
22
3extern UINT32 *stv_workram_h;
4extern UINT32 *stv_workram_l;
3class saturn_state : public driver_device
4{
5public:
6   saturn_state(const machine_config &mconfig, device_type type, const char *tag)
7      : driver_device(mconfig, type, tag) { }
58
6extern int stv_enable_slave_sh2;
9   UINT32 *m_workram_l;
10   UINT32 *m_workram_h;
11   UINT8  *m_smpc_ram;
12   UINT32 *m_backupram;
13   UINT32 *m_scu_regs;
14   UINT8  m_NMI_reset;
15   UINT8  m_en_68k;
16   UINT16 *m_sound_ram;
717
18   UINT32 m_scu_src[3];      /* Source DMA lv n address*/
19   UINT32 m_scu_dst[3];      /* Destination DMA lv n address*/
20   UINT32 m_scu_src_add[3];   /* Source Addition for DMA lv n*/
21   UINT32 m_scu_dst_add[3];   /* Destination Addition for DMA lv n*/
22    INT32  m_scu_size[3];      /* Transfer DMA size lv n*/
23    UINT32 m_scu_index[3];
24   UINT8  m_stv_multi_bank;
25   UINT8  m_prev_bankswitch;
26
27   legacy_cpu_device* m_maincpu;
28   legacy_cpu_device* m_slave;
29   legacy_cpu_device* m_audiocpu;
30};
31
32
833extern int minit_boost,sinit_boost;
934extern attotime minit_boost_timeslice, sinit_boost_timeslice;
1035
11extern cpu_device *stv_maincpu;
12extern cpu_device *stv_slave;
13extern cpu_device *stv_audiocpu;
14
1536DRIVER_INIT ( stv );
1637
1738
src/mame/mame.mak
r11594r11595
12201220   $(VIDEO)/segaic16.o \
12211221   $(VIDEO)/sega16sp.o \
12221222   $(VIDEO)/segaic24.o \
1223   $(VIDEO)/smsvdp.o \
1224   $(MACHINE)/segasms.o \
1225   $(DRIVERS)/segasms.o \
1226   $(DRIVERS)/sg1000.o \
12271223   $(MACHINE)/gdrom.o \
12281224
12291225$(MAMEOBJ)/seibu.a: \
src/mame/video/speedatk.c
r11594r11595
7878   if(offset == 0)
7979   {
8080      state->m_crtc_index = data;
81      mc6845_address_w(space->machine().device("crtc"),0,data);
81      space->machine().device<mc6845_device>("crtc")->address_w(*space,0,data);
8282   }
8383   else
8484   {
8585      state->m_crtc_vreg[state->m_crtc_index] = data;
86      mc6845_register_w(space->machine().device("crtc"),0,data);
86      space->machine().device<mc6845_device>("crtc")->register_w(*space,0,data);
8787   }
8888}
8989
src/mame/video/qix.c
r11594r11595
7070   /* on the rising edge, latch the scanline */
7171   if (state)
7272   {
73      UINT16 ma = mc6845_get_ma(device);
74      UINT8 ra = mc6845_get_ra(device);
73      UINT16 ma = downcast<mc6845_device *>(device)->get_ma();
74      UINT8 ra = downcast<mc6845_device *>(device)->get_ra();
7575
7676      /* RA0-RA2 goes to D0-D2 and MA5-MA9 goes to D3-D7 */
7777      *driver_state->m_scanline_latch = ((ma >> 2) & 0xf8) | (ra & 0x07);
r11594r11595
346346
347347static SCREEN_UPDATE( qix )
348348{
349   device_t *mc6845 = screen->machine().device(MC6845_TAG);
350   mc6845_update(mc6845, bitmap, cliprect);
349   mc6845_device *mc6845 = screen->machine().device<mc6845_device>(MC6845_TAG);
350   mc6845->update(bitmap, cliprect);
351351
352352   return 0;
353353}
r11594r11595
371371   AM_RANGE(0x9400, 0x9400) AM_MIRROR(0x03fc) AM_READWRITE(qix_addresslatch_r, qix_addresslatch_w)
372372   AM_RANGE(0x9402, 0x9403) AM_MIRROR(0x03fc) AM_WRITEONLY AM_BASE_MEMBER(qix_state, m_videoram_address)
373373   AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READONLY AM_BASE_MEMBER(qix_state, m_scanline_latch)
374   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE("vid_u18", mc6845_address_w)
375   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE("vid_u18", mc6845_register_r, mc6845_register_w)
374   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE_MODERN("vid_u18", mc6845_device, address_w)
375   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE_MODERN("vid_u18", mc6845_device, register_r, register_w)
376376   AM_RANGE(0xa000, 0xffff) AM_ROM
377377ADDRESS_MAP_END
378378
r11594r11595
389389   AM_RANGE(0x9400, 0x9400) AM_MIRROR(0x03fc) AM_READWRITE(qix_addresslatch_r, qix_addresslatch_w)
390390   AM_RANGE(0x9402, 0x9403) AM_MIRROR(0x03fc) AM_WRITEONLY AM_BASE_MEMBER(qix_state, m_videoram_address)
391391   AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READONLY AM_BASE_MEMBER(qix_state, m_scanline_latch)
392   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE("vid_u18", mc6845_address_w)
393   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE("vid_u18", mc6845_register_r, mc6845_register_w)
392   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE_MODERN("vid_u18", mc6845_device, address_w)
393   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE_MODERN("vid_u18", mc6845_device, register_r, register_w)
394394   AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank1")
395395   AM_RANGE(0xc000, 0xffff) AM_ROM
396396ADDRESS_MAP_END
r11594r11595
408408   AM_RANGE(0x9401, 0x9401) AM_MIRROR(0x03fc) AM_WRITEONLY AM_BASE_MEMBER(qix_state, m_videoram_mask)
409409   AM_RANGE(0x9402, 0x9403) AM_MIRROR(0x03fc) AM_WRITEONLY AM_BASE_MEMBER(qix_state, m_videoram_address)
410410   AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READONLY AM_BASE_MEMBER(qix_state, m_scanline_latch)
411   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE("vid_u18", mc6845_address_w)
412   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE("vid_u18", mc6845_register_r, mc6845_register_w)
411   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE_MODERN("vid_u18", mc6845_device, address_w)
412   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE_MODERN("vid_u18", mc6845_device, register_r, register_w)
413413   AM_RANGE(0xa000, 0xffff) AM_ROM
414414ADDRESS_MAP_END
415415
src/mame/drivers/coinmstr.c
r11594r11595
220220   AM_RANGE(0x50, 0x53) AM_READNOP
221221   AM_RANGE(0x50, 0x53) AM_WRITENOP
222222   AM_RANGE(0x58, 0x5b) AM_DEVREADWRITE_MODERN("pia2", pia6821_device, read, write)
223   AM_RANGE(0x70, 0x70) AM_DEVWRITE("crtc", mc6845_address_w)
224   AM_RANGE(0x71, 0x71) AM_DEVWRITE("crtc", mc6845_register_w)
223   AM_RANGE(0x70, 0x70) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
224   AM_RANGE(0x71, 0x71) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
225225   AM_RANGE(0xc0, 0xc3) AM_READNOP
226226   AM_RANGE(0xc0, 0xc3) AM_WRITENOP
227227ADDRESS_MAP_END
r11594r11595
230230   ADDRESS_MAP_GLOBAL_MASK(0xff)
231231   AM_RANGE(0x00, 0x00) AM_READ(question_r)
232232   AM_RANGE(0x00, 0x03) AM_WRITE(question_w)
233   AM_RANGE(0x40, 0x40) AM_DEVWRITE("crtc", mc6845_address_w)
234   AM_RANGE(0x41, 0x41) AM_DEVWRITE("crtc", mc6845_register_w)
233   AM_RANGE(0x40, 0x40) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
234   AM_RANGE(0x41, 0x41) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
235235   AM_RANGE(0x48, 0x49) AM_DEVWRITE("aysnd", ay8910_address_data_w)
236236   AM_RANGE(0x49, 0x49) AM_DEVREAD("aysnd", ay8910_r)
237237   AM_RANGE(0x50, 0x53) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write) //?
r11594r11595
248248   AM_RANGE(0x40, 0x41) AM_READNOP
249249   AM_RANGE(0x40, 0x43) AM_WRITENOP
250250   AM_RANGE(0x43, 0x43) AM_READNOP
251   AM_RANGE(0x48, 0x48) AM_DEVWRITE("crtc", mc6845_address_w)
252   AM_RANGE(0x49, 0x49) AM_DEVWRITE("crtc", mc6845_register_w)
251   AM_RANGE(0x48, 0x48) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
252   AM_RANGE(0x49, 0x49) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
253253   AM_RANGE(0x50, 0x51) AM_READNOP
254254   AM_RANGE(0x50, 0x53) AM_WRITENOP
255255   AM_RANGE(0x53, 0x53) AM_READNOP
r11594r11595
264264
265265static ADDRESS_MAP_START( pokeroul_io_map, AS_IO, 8 )
266266   ADDRESS_MAP_GLOBAL_MASK(0xff)
267   AM_RANGE(0x40, 0x40) AM_DEVWRITE("crtc", mc6845_address_w)
268   AM_RANGE(0x41, 0x41) AM_DEVWRITE("crtc", mc6845_register_w)
267   AM_RANGE(0x40, 0x40) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
268   AM_RANGE(0x41, 0x41) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
269269   AM_RANGE(0x48, 0x49) AM_DEVWRITE("aysnd", ay8910_address_data_w)
270270   AM_RANGE(0x49, 0x49) AM_DEVREAD("aysnd", ay8910_r)
271271   AM_RANGE(0x58, 0x5b) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write) /* confirmed */
src/mame/drivers/murogem.c
r11594r11595
111111
112112static ADDRESS_MAP_START( murogem_map, AS_PROGRAM, 8 )
113113   AM_RANGE(0x0000, 0x007f) AM_RAM
114   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE("crtc", mc6845_address_w)
115   AM_RANGE(0x4001, 0x4001) AM_DEVWRITE("crtc", mc6845_register_w)
114   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
115   AM_RANGE(0x4001, 0x4001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
116116   AM_RANGE(0x5000, 0x5000) AM_READ_PORT("IN0")
117117   AM_RANGE(0x5800, 0x5800) AM_READ_PORT("IN1")
118118   AM_RANGE(0x7000, 0x7000) AM_WRITENOP // sound? payout?
src/mame/drivers/5clown.c
r11594r11595
718718
719719static ADDRESS_MAP_START( fclown_map, AS_PROGRAM, 8 )
720720   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
721   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
722   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
721   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
722   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
723723   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
724724   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
725725   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(fclown_videoram_w) AM_BASE_MEMBER(_5clown_state, m_videoram)   /* Init'ed at $2042 */
src/mame/drivers/othello.c
r11594r11595
6969
7070   /* devices */
7171   device_t *m_maincpu;
72   device_t *m_mc6845;
72   mc6845_device *m_mc6845;
7373   device_t *m_n7751;
7474   device_t *m_ay1;
7575   device_t *m_ay2;
r11594r11595
120120{
121121   othello_state *state = screen->machine().driver_data<othello_state>();
122122
123   mc6845_update(state->m_mc6845, bitmap, cliprect);
123   state->m_mc6845->update(bitmap, cliprect);
124124   return 0;
125125}
126126
r11594r11595
181181
182182static ADDRESS_MAP_START( main_portmap, AS_IO, 8 )
183183   ADDRESS_MAP_GLOBAL_MASK(0xff)
184   AM_RANGE(0x08, 0x08) AM_DEVWRITE("crtc", mc6845_address_w)
185   AM_RANGE(0x09, 0x09) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
184   AM_RANGE(0x08, 0x08) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
185   AM_RANGE(0x09, 0x09) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
186186   AM_RANGE(0x80, 0x80) AM_READ_PORT("INP")
187187   AM_RANGE(0x81, 0x81) AM_READ_PORT("SYSTEM")
188188   AM_RANGE(0x83, 0x83) AM_READ_PORT("DSW")
r11594r11595
383383   othello_state *state = machine.driver_data<othello_state>();
384384
385385   state->m_maincpu = machine.device("maincpu");
386   state->m_mc6845 = machine.device("crtc");
386   state->m_mc6845 = machine.device<mc6845_device>("crtc");
387387   state->m_n7751 = machine.device("n7751");
388388   state->m_ay1 = machine.device("ay1");
389389   state->m_ay2 = machine.device("ay2");
src/mame/drivers/namcos12.c
r11594r11595
21272127   ROM_LOAD16_BYTE( "gnb1prg0u.ic11", 0x000001, 0x800000, CRC(697d3279) SHA1(40302780f7494d9413888b2d1da38bd14a9a444f) )
21282128
21292129   ROM_REGION( 0x0080000, "sub", 0 ) /* sound prg */
2130   ROM_LOAD16_WORD_SWAP( "gnb5vera.11s", 0x000000, 0x080000, CRC(d45a53eb) SHA1(01eb4f659b29671d417c5d3684f15a5876f76009) )
2130   ROM_LOAD16_WORD_SWAP( "gnb_vera.11s", 0x000000, 0x080000, CRC(d45a53eb) SHA1(01eb4f659b29671d417c5d3684f15a5876f76009) )
21312131
21322132   ROM_REGION( 0x1000000, "c352", 0 ) /* samples */
21332133   ROM_LOAD( "gnb1waveb.ic2",  0x0000000, 0x400000, CRC(4e19d9d6) SHA1(0a92c987536999a789663a30c787950ab6995128) )
r11594r11595
21442144   ROM_LOAD16_BYTE( "gnb1prg0u.ic11", 0x000001, 0x800000, CRC(697d3279) SHA1(40302780f7494d9413888b2d1da38bd14a9a444f) )
21452145
21462146   ROM_REGION( 0x0080000, "sub", 0 ) /* sound prg */
2147   ROM_LOAD16_WORD_SWAP( "gnb5vera.11s", 0x000000, 0x080000, CRC(d45a53eb) SHA1(01eb4f659b29671d417c5d3684f15a5876f76009) )
2147   ROM_LOAD16_WORD_SWAP( "gnb_vera.11s", 0x000000, 0x080000, CRC(d45a53eb) SHA1(01eb4f659b29671d417c5d3684f15a5876f76009) )
21482148
21492149   ROM_REGION( 0x1000000, "c352", 0 ) /* samples */
21502150   ROM_LOAD( "gnb1waveb.ic2",  0x0000000, 0x400000, CRC(4e19d9d6) SHA1(0a92c987536999a789663a30c787950ab6995128) )
r11594r11595
25922592   ROM_LOAD16_BYTE( "teg2verc1.2j", 0x0000001, 0x200000, CRC(c0476713) SHA1(e51e4f3cd20ad6838fb05aaede0ab288e145e7a2) )
25932593
25942594   ROM_REGION32_LE( 0x3800000, "user2", 0 ) /* main data */
2595   ROM_LOAD32_WORD( "teg2roml0",    0x0000000, 0x400000, CRC(cf984e85) SHA1(4d8296998b5f225b3f20bfdcb092a64b6e1fa76e) )
2596   ROM_LOAD32_WORD( "teg2romh0",    0x0800000, 0x400000, CRC(ea088657) SHA1(fbacca78832f68a310bafd06188d645e3424e0ed) )
2597   ROM_LOAD32_WORD( "teg2ic13",     0x0000002, 0x400000, CRC(927723a5) SHA1(075aaca1700c9134496eb9a73cbe325ddc74eae1) )
2598   ROM_LOAD32_WORD( "teg2romh00",   0x0800002, 0x400000, CRC(a85aa306) SHA1(07318133c7c48cb61590ed0eceb519a8cc1ca781) )
2599   ROM_LOAD32_WORD( "teg2roml1",    0x1000000, 0x400000, CRC(8552f0ef) SHA1(45ed0dacdad94e708260a98b9cd47861543d2b7a) )
2600   ROM_LOAD32_WORD( "teg2romh1",    0x1800000, 0x400000, CRC(86eb5abe) SHA1(66a3807a18d81e8291baf56533694f60e31a6367) )
2601   ROM_LOAD32_WORD( "teg2ic14",     0x1000002, 0x400000, CRC(13eb424b) SHA1(59d6c77136050de1e7250e6627636d5b178bb8a8) )
2602   ROM_LOAD32_WORD( "teg2romh10",   0x1800002, 0x400000, CRC(25131a87) SHA1(77fa236c4879a59323bc2dac26c195b7c47f812c) )
2603   ROM_LOAD32_WORD( "teg2roml2",    0x2000000, 0x400000, CRC(abdfc6ca) SHA1(70033becd29ea15611be2fc099a43712181bcbec) )
2604   ROM_LOAD32_WORD( "teg2romh2",    0x2800000, 0x400000, CRC(8c03b301) SHA1(f395a4685e2deb8f7e9afc18ce15fa0d392b0cfa) )
2605   ROM_LOAD32_WORD( "teg2ic15",     0x2000002, 0x400000, CRC(ed5ec7f7) SHA1(c91085a64ced95ee6618303987de61893e069742) )
2606   ROM_LOAD32_WORD( "teg2romh20",   0x2800002, 0x400000, CRC(c873c362) SHA1(d95451a7477b716c0d75ba04e1d8df3d8a4e10dd) )
2607   ROM_LOAD32_WORD( "teg2rf4",      0x3000000, 0x400000, CRC(612f6a37) SHA1(bd9597ef802e3c46f891f0ef523a3e0b0fe22672) )
2608   ROM_LOAD32_WORD( "teg2rf6",      0x3000002, 0x400000, CRC(0c9292ce) SHA1(664c6ccf18042ed8ebc29b1781ae7454acb05ba1) )
2595   ROM_LOAD32_WORD( "teg2roml0",       0x0000000, 0x400000, CRC(cf984e85) SHA1(4d8296998b5f225b3f20bfdcb092a64b6e1fa76e) )
2596   ROM_LOAD32_WORD( "teg2romh0",       0x0800000, 0x400000, CRC(ea088657) SHA1(fbacca78832f68a310bafd06188d645e3424e0ed) )
2597   ROM_LOAD32_WORD( "teg2roml00.ic13", 0x0000002, 0x400000, CRC(927723a5) SHA1(075aaca1700c9134496eb9a73cbe325ddc74eae1) ) /* located on the opposite side of the ROM PCB */
2598   ROM_LOAD32_WORD( "teg2romh00",      0x0800002, 0x400000, CRC(a85aa306) SHA1(07318133c7c48cb61590ed0eceb519a8cc1ca781) )
2599   ROM_LOAD32_WORD( "teg2roml1",       0x1000000, 0x400000, CRC(8552f0ef) SHA1(45ed0dacdad94e708260a98b9cd47861543d2b7a) )
2600   ROM_LOAD32_WORD( "teg2romh1",       0x1800000, 0x400000, CRC(86eb5abe) SHA1(66a3807a18d81e8291baf56533694f60e31a6367) )
2601   ROM_LOAD32_WORD( "teg2roml10.ic14", 0x1000002, 0x400000, CRC(13eb424b) SHA1(59d6c77136050de1e7250e6627636d5b178bb8a8) ) /* located on the opposite side of the ROM PCB */
2602   ROM_LOAD32_WORD( "teg2romh10",      0x1800002, 0x400000, CRC(25131a87) SHA1(77fa236c4879a59323bc2dac26c195b7c47f812c) )
2603   ROM_LOAD32_WORD( "teg2roml2",       0x2000000, 0x400000, CRC(abdfc6ca) SHA1(70033becd29ea15611be2fc099a43712181bcbec) )
2604   ROM_LOAD32_WORD( "teg2romh2",       0x2800000, 0x400000, CRC(8c03b301) SHA1(f395a4685e2deb8f7e9afc18ce15fa0d392b0cfa) )
2605   ROM_LOAD32_WORD( "teg2roml20.ic15", 0x2000002, 0x400000, CRC(ed5ec7f7) SHA1(c91085a64ced95ee6618303987de61893e069742) ) /* located on the opposite side of the ROM PCB */
2606   ROM_LOAD32_WORD( "teg2romh20",      0x2800002, 0x400000, CRC(c873c362) SHA1(d95451a7477b716c0d75ba04e1d8df3d8a4e10dd) )
2607   ROM_LOAD32_WORD( "teg2rf4",         0x3000000, 0x400000, CRC(612f6a37) SHA1(bd9597ef802e3c46f891f0ef523a3e0b0fe22672) )
2608   ROM_LOAD32_WORD( "teg2rf6",         0x3000002, 0x400000, CRC(0c9292ce) SHA1(664c6ccf18042ed8ebc29b1781ae7454acb05ba1) )
26092609
26102610   ROM_REGION( 0x0080000, "sub", 0 ) /* sound prg */
26112611   ROM_LOAD16_WORD_SWAP( "teg3verb.11s", 0x0000000, 0x080000, CRC(67d0c469) SHA1(da164702fc21b9f46a9e32c89e7b1d36070ddf79) )
26122612
26132613   ROM_REGION( 0x1000000, "c352", 0 ) /* samples */
2614   ROM_LOAD( "teg2ic12",            0x0000000, 0x400000, CRC(1865336f) SHA1(deda6d129daf709b0316f6260e67613fbf849e57) )
2614   ROM_LOAD( "teg2wavel0.ic12",     0x0000000, 0x400000, CRC(1865336f) SHA1(deda6d129daf709b0316f6260e67613fbf849e57) ) /* located on the opposite side of the ROM PCB */
26152615   ROM_LOAD( "teg2wavel1",          0x0400000, 0x400000, CRC(f5ab70e6) SHA1(cdb62d8eb92ca961be684caf768d1961d98ece22) )
26162616   ROM_LOAD( "teg2waveh0",          0x0800000, 0x400000, CRC(bc0325bf) SHA1(77059c300a9d53d0e97bb898a06c58076078d7d2) )
26172617   ROM_LOAD( "teg2waveh1",          0x0c00000, 0x400000, CRC(6c654921) SHA1(3849157b30b4b459956b823511551abda2e4b6e5) )
src/mame/drivers/avt.c
r11594r11595
563563//  AM_RANGE(0x09, 0x09)  AM_READ_PORT("IN3")
564564   AM_RANGE(0x21, 0x21) AM_DEVWRITE("aysnd", ay8910_data_w)      /* AY8910 data */
565565   AM_RANGE(0x23, 0x23) AM_DEVWRITE("aysnd", ay8910_address_w)      /* AY8910 control */
566   AM_RANGE(0x28, 0x28) AM_DEVWRITE("crtc", mc6845_address_w)
567   AM_RANGE(0x29, 0x29) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
566   AM_RANGE(0x28, 0x28) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
567   AM_RANGE(0x29, 0x29) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
568568ADDRESS_MAP_END
569569
570570/* I/O byte R/W
src/mame/drivers/ssingles.c
r11594r11595
256256
257257static SCREEN_UPDATE( ssingles )
258258{
259   device_t *mc6845 = screen->machine().device("crtc");
260   mc6845_update(mc6845, bitmap, cliprect);
259   mc6845_device *mc6845 = screen->machine().device<mc6845_device>("crtc");
260   mc6845->update(bitmap, cliprect);
261261
262262   return 0;
263263}
r11594r11595
335335   AM_RANGE(0x18, 0x18) AM_READ_PORT("DSW1")
336336   AM_RANGE(0x1c, 0x1c) AM_READ_PORT("INPUTS")
337337   AM_RANGE(0x1a, 0x1a) AM_WRITENOP //video/crt related
338   AM_RANGE(0xfe, 0xfe) AM_DEVWRITE("crtc", mc6845_address_w)
339   AM_RANGE(0xff, 0xff) AM_DEVWRITE("crtc", mc6845_register_w)
338   AM_RANGE(0xfe, 0xfe) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
339   AM_RANGE(0xff, 0xff) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
340340
341341ADDRESS_MAP_END
342342
src/mame/drivers/magicfly.c
r11594r11595
575575
576576static ADDRESS_MAP_START( magicfly_map, AS_PROGRAM, 8 )
577577   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")    /* MK48Z02B NVRAM */
578   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
579   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
578   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
579   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
580580   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(magicfly_videoram_w) AM_BASE_MEMBER(magicfly_state, m_videoram)   /* HM6116LP #1 (2K x 8) RAM (only 1st half used) */
581581   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(magicfly_colorram_w) AM_BASE_MEMBER(magicfly_state, m_colorram)   /* HM6116LP #2 (2K x 8) RAM (only 1st half used) */
582582   AM_RANGE(0x2800, 0x2800) AM_READ(mux_port_r)   /* multiplexed input port */
src/mame/drivers/rgum.c
r11594r11595
6161static ADDRESS_MAP_START( rgum_map, AS_PROGRAM, 8 )
6262   AM_RANGE(0x0000, 0x07ff) AM_RAM //not all of it?
6363
64   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
65   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
64   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
65   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
6666
6767   AM_RANGE(0x2000, 0x2000) AM_DEVWRITE("aysnd", ay8910_data_w)
6868   AM_RANGE(0x2002, 0x2002) AM_DEVREADWRITE("aysnd", ay8910_r, ay8910_address_w)
src/mame/drivers/galdrvr.c
r11594r11595
51155115   ROM_LOAD( "turtles.clr",  0x0000, 0x0020, CRC(f3ef02dd) SHA1(09fd795170d7d30f101d579f57553da5ff3800ab) )
51165116ROM_END
51175117
5118/* Amidar (c) Konami 1982. Original Konami pcb.
5119   Soundboard silkscreened: Konami KT-4108-1B
5120   CPU Board Silkscreened: Konami KT4108-2 */
51185121
51195122ROM_START( amidar )
51205123   ROM_REGION( 0x10000, "maincpu", 0 )
5124   ROM_LOAD( "1.2c",  0x0000, 0x1000, CRC(621b74de) SHA1(f064eccfb7da18119ed3088a5f939085eb446c90) )
5125   ROM_LOAD( "2.2e",  0x1000, 0x1000, CRC(38538b98) SHA1(12b2a0c09926d006781bee5d450bc0c391cc1fb5) )
5126   ROM_LOAD( "3.2f",  0x2000, 0x1000, CRC(099ecb24) SHA1(e83f049b25aba481e09606db3158726145ebd656) )
5127   ROM_LOAD( "4.2h",  0x3000, 0x1000, CRC(ba149a93) SHA1(9ef1d27f0780612be0ea2be94c3a2c781a4924c8) )
5128   ROM_LOAD( "5.2j",  0x4000, 0x1000, CRC(eecc1abf) SHA1(1530b374d15e0d05c8eb988cc1cbab48b0be211c) )
5129
5130   ROM_REGION( 0x10000, "audiocpu", 0 )
5131   ROM_LOAD( "s1.5c",  0x0000, 0x1000, CRC(8ca7b750) SHA1(4f4c2915503b85abe141d717fd254ee10c9da99e) )
5132   ROM_LOAD( "s2.5d",  0x1000, 0x1000, CRC(9b5bdc0a) SHA1(84d953618c8bf510d23b42232a856ac55f1baff5) )
5133
5134   ROM_REGION( 0x1000, "gfx1", 0 )
5135   ROM_LOAD( "c2.5f",  0x0000, 0x0800, CRC(2cfe5ede) SHA1(0d86a78008ac8653c17fff5be5ebdf1f0a9d31eb) )
5136   ROM_LOAD( "c2.5d",  0x0800, 0x0800, CRC(57c4fd0d) SHA1(8764deec9fbff4220d61df621b12fc36c3702601) )
5137
5138   ROM_REGION( 0x0020, "proms", 0 )
5139   ROM_LOAD( "amidar.clr",   0x0000, 0x0020, CRC(f940dcc3) SHA1(1015e56f37c244a850a8f4bf0e36668f047fd46d) )
5140ROM_END
5141
5142ROM_START( amidar1 )
5143   ROM_REGION( 0x10000, "maincpu", 0 )
51215144   ROM_LOAD( "amidar.2c",    0x0000, 0x1000, CRC(c294bf27) SHA1(399325bf1559e8cdbddf7cfbf0dc739f9ed72ef0) )
51225145   ROM_LOAD( "amidar.2e",    0x1000, 0x1000, CRC(e6e96826) SHA1(e9c4f8c594640424b456505e676352a98b758c03) )
51235146   ROM_LOAD( "amidar.2f",    0x2000, 0x1000, CRC(3656be6f) SHA1(9d652f66bedcf17a6453c0e0ead30bfd7ea0bd0a) )
r11594r11595
62726295GAME( 1981, turpin,   turtles,  turtles,  turpin,   turtles,  ROT90,  "Konami (Sega license)", "Turpin", GAME_SUPPORTS_SAVE )
62736296GAME( 1981, 600,      turtles,  turtles,  turtles,  turtles,  ROT90,  "Konami", "600", GAME_SUPPORTS_SAVE )
62746297
6275GAME( 1981, amidar,   0,        turtles,  amidar,   turtles,  ROT90,  "Konami", "Amidar", GAME_SUPPORTS_SAVE )
6298GAME( 1982, amidar,   0,        turtles,  amidaru,  turtles,  ROT90,  "Konami", "Amidar", GAME_SUPPORTS_SAVE )
6299GAME( 1981, amidar1,  amidar,   turtles,  amidar,   turtles,  ROT90,  "Konami", "Amidar (older)", GAME_SUPPORTS_SAVE )
62766300GAME( 1982, amidaru,  amidar,   turtles,  amidaru,  turtles,  ROT90,  "Konami (Stern Electronics license)", "Amidar (Stern Electronics)", GAME_SUPPORTS_SAVE )
62776301GAME( 1982, amidaro,  amidar,   turtles,  amidaro,  turtles,  ROT90,  "Konami (Olympia license)", "Amidar (Olympia)", GAME_SUPPORTS_SAVE )
62786302GAME( 1982, amidarb,  amidar,   turtles,  amidaru,  turtles,  ROT90,  "bootleg", "Amidar (bootleg)", GAME_SUPPORTS_SAVE ) /* similar to Amigo bootleg */
src/mame/drivers/hitpoker.c
r11594r11595
248248   AM_RANGE(0xbe0e, 0xbe0e) AM_READ_PORT("IN1")
249249   AM_RANGE(0xbe50, 0xbe51) AM_WRITE(eeprom_w)
250250   AM_RANGE(0xbe53, 0xbe53) AM_READ(eeprom_r)
251   AM_RANGE(0xbe80, 0xbe80) AM_DEVWRITE("crtc", mc6845_address_w)
252   AM_RANGE(0xbe81, 0xbe81) AM_DEVWRITE("crtc", mc6845_register_w)
251   AM_RANGE(0xbe80, 0xbe80) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
252   AM_RANGE(0xbe81, 0xbe81) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
253253   AM_RANGE(0xbe90, 0xbe91) AM_DEVREADWRITE("aysnd", ay8910_r,ay8910_address_data_w)
254254   AM_RANGE(0xbea0, 0xbea0) AM_READ_PORT("VBLANK") //probably other bits as well
255255//  AM_RANGE(0xbe00, 0xbeff) AM_READ(test_r)
src/mame/drivers/wardner.c
r11594r11595
214214
215215static ADDRESS_MAP_START( main_io_map, AS_IO, 8 )
216216   ADDRESS_MAP_GLOBAL_MASK(0xff)
217   AM_RANGE(0x00, 0x00) AM_DEVWRITE("crtc", mc6845_address_w)
218   AM_RANGE(0x02, 0x02) AM_DEVWRITE("crtc", mc6845_register_w)
217   AM_RANGE(0x00, 0x00) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
218   AM_RANGE(0x02, 0x02) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
219219   AM_RANGE(0x10, 0x13) AM_WRITE(wardner_txscroll_w)      /* scroll text layer */
220220   AM_RANGE(0x14, 0x15) AM_WRITE(wardner_txlayer_w)      /* offset in text video RAM */
221221   AM_RANGE(0x20, 0x23) AM_WRITE(wardner_bgscroll_w)      /* scroll bg layer */
src/mame/drivers/buster.c
r11594r11595
6060   AM_RANGE(0x0000, 0x3fff) AM_ROM// AM_BASE_MEMBER(buster_state, m_rom)
6161   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_SHARE("wram")
6262   AM_RANGE(0x5000, 0x5fff) AM_RAM AM_BASE_MEMBER(buster_state, m_vram)
63   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE("crtc", mc6845_address_w)
64   AM_RANGE(0x6001, 0x6001) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
63   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
64   AM_RANGE(0x6001, 0x6001) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
6565   AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN0")
6666   AM_RANGE(0x7c82, 0x7c82) AM_READ_PORT("IN1")
6767   AM_RANGE(0x7c84, 0x7c84) AM_READ_PORT("IN2")
src/mame/drivers/snk6502.c
r11594r11595
329329   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(snk6502_videoram_w) AM_BASE_MEMBER(snk6502_state, m_videoram)
330330   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(snk6502_colorram_w) AM_BASE_MEMBER(snk6502_state, m_colorram)
331331   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(snk6502_charram_w) AM_BASE_MEMBER(snk6502_state, m_charram)
332   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE("crtc", mc6845_address_w)
333   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE("crtc", mc6845_register_w)
332   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
333   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
334334   AM_RANGE(0x4000, 0x8fff) AM_ROM
335335   AM_RANGE(0xb000, 0xb001) AM_WRITE(sasuke_sound_w)
336336   AM_RANGE(0xb002, 0xb002) AM_WRITE(satansat_b002_w)   /* flip screen & irq enable */
r11594r11595
348348   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(snk6502_videoram_w) AM_BASE_MEMBER(snk6502_state, m_videoram)
349349   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(snk6502_colorram_w) AM_BASE_MEMBER(snk6502_state, m_colorram)
350350   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(snk6502_charram_w) AM_BASE_MEMBER(snk6502_state, m_charram)
351   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE("crtc", mc6845_address_w)
352   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE("crtc", mc6845_register_w)
351   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
352   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
353353   AM_RANGE(0x4000, 0x97ff) AM_ROM
354354   AM_RANGE(0xb000, 0xb001) AM_WRITE(satansat_sound_w)
355355   AM_RANGE(0xb002, 0xb002) AM_WRITE(satansat_b002_w)   /* flip screen & irq enable */
r11594r11595
367367   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(snk6502_videoram_w) AM_BASE_MEMBER(snk6502_state, m_videoram)
368368   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(snk6502_colorram_w) AM_BASE_MEMBER(snk6502_state, m_colorram)
369369   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(snk6502_charram_w) AM_BASE_MEMBER(snk6502_state, m_charram)
370   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE("crtc", mc6845_address_w)
371   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE("crtc", mc6845_register_w)
370   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
371   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
372372   AM_RANGE(0x3100, 0x3102) AM_WRITE(vanguard_sound_w)
373373   AM_RANGE(0x3103, 0x3103) AM_WRITE(snk6502_flipscreen_w)
374374   AM_RANGE(0x3104, 0x3104) AM_READ_PORT("IN0")
r11594r11595
388388   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(snk6502_videoram_w) AM_BASE_MEMBER(snk6502_state, m_videoram)
389389   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(snk6502_colorram_w) AM_BASE_MEMBER(snk6502_state, m_colorram)
390390   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(snk6502_charram_w) AM_BASE_MEMBER(snk6502_state, m_charram)
391   AM_RANGE(0x2000, 0x2000) AM_DEVWRITE("crtc", mc6845_address_w)
392   AM_RANGE(0x2001, 0x2001) AM_DEVWRITE("crtc", mc6845_register_w)
391   AM_RANGE(0x2000, 0x2000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
392   AM_RANGE(0x2001, 0x2001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
393393   AM_RANGE(0x2100, 0x2103) AM_WRITE(fantasy_sound_w)
394394   AM_RANGE(0x2104, 0x2104) AM_READ_PORT("IN0")
395395   AM_RANGE(0x2105, 0x2105) AM_READ_PORT("IN1")
r11594r11595
409409   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(snk6502_colorram_w) AM_BASE_MEMBER(snk6502_state, m_colorram)
410410   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(snk6502_charram_w) AM_BASE_MEMBER(snk6502_state, m_charram)
411411   AM_RANGE(0x3000, 0x9fff) AM_ROM
412   AM_RANGE(0xb000, 0xb000) AM_DEVWRITE("crtc", mc6845_address_w)
413   AM_RANGE(0xb001, 0xb001) AM_DEVWRITE("crtc", mc6845_register_w)
412   AM_RANGE(0xb000, 0xb000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
413   AM_RANGE(0xb001, 0xb001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
414414   AM_RANGE(0xb100, 0xb103) AM_WRITE(fantasy_sound_w)
415415   AM_RANGE(0xb104, 0xb104) AM_READ_PORT("IN0")
416416   AM_RANGE(0xb105, 0xb105) AM_READ_PORT("IN1")
src/mame/drivers/r2dtank.c
r11594r11595
399399
400400static SCREEN_UPDATE( r2dtank )
401401{
402   device_t *mc6845 = screen->machine().device("crtc");
403   mc6845_update(mc6845, bitmap, cliprect);
402   mc6845_device *mc6845 = screen->machine().device<mc6845_device>("crtc");
403   mc6845->update(bitmap, cliprect);
404404
405405   return 0;
406406}
r11594r11595
426426   AM_RANGE(0x6000, 0x7fff) AM_RAM
427427   AM_RANGE(0x8000, 0x8003) AM_DEVREAD_MODERN("pia_main", pia6821_device, read) AM_DEVWRITE("pia_main", pia_comp_w)
428428   AM_RANGE(0x8004, 0x8004) AM_READWRITE(audio_answer_r, audio_command_w)
429   AM_RANGE(0xb000, 0xb000) AM_DEVWRITE("crtc", mc6845_address_w)
430   AM_RANGE(0xb001, 0xb001) AM_DEVWRITE("crtc", mc6845_register_w)
429   AM_RANGE(0xb000, 0xb000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
430   AM_RANGE(0xb001, 0xb001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
431431   AM_RANGE(0xc000, 0xc007) AM_RAM AM_SHARE("nvram")
432432   AM_RANGE(0xc800, 0xffff) AM_ROM
433433ADDRESS_MAP_END
src/mame/drivers/aristmk4.c
r11594r11595
791791static ADDRESS_MAP_START( aristmk4_map, AS_PROGRAM, 8 )
792792   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE_MEMBER(aristmk4_state, m_mkiv_vram) // video ram -  chips U49 / U50
793793   AM_RANGE(0x0800, 0x17ff) AM_RAM
794   AM_RANGE(0x1800, 0x1800) AM_DEVREADWRITE("crtc", mc6845_status_r, mc6845_address_w)
795   AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
794   AM_RANGE(0x1800, 0x1800) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, status_r, address_w)
795   AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
796796   AM_RANGE(0x1c00, 0x1cff) AM_WRITE(mk4_printer_w)
797797   AM_RANGE(0x1900, 0x19ff) AM_READ(mk4_printer_r)
798798   AM_RANGE(0x2000, 0x3fff) AM_ROM  // graphics rom map
r11594r11595
831831static ADDRESS_MAP_START( aristmk4_poker_map, AS_PROGRAM, 8 )
832832   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE_MEMBER(aristmk4_state, m_mkiv_vram) // video ram -  chips U49 / U50
833833   AM_RANGE(0x0800, 0x17ff) AM_RAM
834   AM_RANGE(0x1800, 0x1800) AM_DEVREADWRITE("crtc", mc6845_status_r, mc6845_address_w)
835   AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
834   AM_RANGE(0x1800, 0x1800) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, status_r, address_w)
835   AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
836836   AM_RANGE(0x1c00, 0x1cff) AM_WRITE(mk4_printer_w)
837837   AM_RANGE(0x1900, 0x19ff) AM_READ(mk4_printer_r)
838838   AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank1") AM_SHARE("nvram")
src/mame/drivers/kingdrby.c
r11594r11595
391391   AM_RANGE(0x6000, 0x6003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)   /* I/O Ports */
392392   AM_RANGE(0x7000, 0x73ff) AM_RAM AM_SHARE("share1")
393393   AM_RANGE(0x7400, 0x74ff) AM_RAM AM_BASE_MEMBER(kingdrby_state, m_spriteram)
394   AM_RANGE(0x7600, 0x7600) AM_DEVWRITE("crtc", mc6845_address_w)
395   AM_RANGE(0x7601, 0x7601) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
394   AM_RANGE(0x7600, 0x7600) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
395   AM_RANGE(0x7601, 0x7601) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
396396   AM_RANGE(0x7801, 0x780f) AM_WRITE(led_array_w)
397397   AM_RANGE(0x7a00, 0x7a00) AM_RAM //buffer for the key matrix
398398   AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("DSW")
r11594r11595
411411//  AM_RANGE(0x6000, 0x6003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w) /* I/O Ports */
412412   AM_RANGE(0x7000, 0x73ff) AM_RAM AM_SHARE("share1")
413413   AM_RANGE(0x7400, 0x74ff) AM_RAM AM_BASE_MEMBER(kingdrby_state, m_spriteram)
414   AM_RANGE(0x7600, 0x7600) AM_DEVWRITE("crtc", mc6845_address_w)
415   AM_RANGE(0x7601, 0x7601) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
414   AM_RANGE(0x7600, 0x7600) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
415   AM_RANGE(0x7601, 0x7601) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
416416   AM_RANGE(0x7800, 0x7800) AM_READ_PORT("KEY0")
417417    AM_RANGE(0x7801, 0x7801) AM_READ_PORT("KEY1")
418418   AM_RANGE(0x7802, 0x7802) AM_READ_PORT("KEY2")
src/mame/drivers/carrera.c
r11594r11595
6565static ADDRESS_MAP_START( carrera_map, AS_PROGRAM, 8 )
6666   AM_RANGE(0x0000, 0x4fff) AM_ROM
6767   AM_RANGE(0xe000, 0xe7ff) AM_RAM
68   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("crtc", mc6845_address_w)
69   AM_RANGE(0xe801, 0xe801) AM_DEVWRITE("crtc", mc6845_register_w)
68   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
69   AM_RANGE(0xe801, 0xe801) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
7070   AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE_MEMBER(carrera_state, m_tileram)
7171ADDRESS_MAP_END
7272
src/mame/drivers/stvinit.c
r11594r11595
297297
298298static READ32_HANDLER( astrass_hack_r )
299299{
300   saturn_state *state = space->machine().driver_data<saturn_state>();
301
300302   /*PC reads at 0x60011ba if -debug is active?*/
301303   if(cpu_get_pc(&space->device())==0x60011b8 || cpu_get_pc(&space->device()) == 0x60011ba) return 0x00000000;
302304
303   return stv_workram_h[0x000770/4];
305   return state->m_workram_h[0x000770/4];
304306}
305307
306308DRIVER_INIT( astrass )
src/mame/drivers/goldnpkr.c
r11594r11595
10851085static ADDRESS_MAP_START( goldnpkr_map, AS_PROGRAM, 8 )
10861086   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
10871087   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")   /* battery backed RAM */
1088   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
1089   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
1088   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
1089   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
10901090   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
10911091   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
10921092   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, m_videoram)
r11594r11595
10971097static ADDRESS_MAP_START( pottnpkr_map, AS_PROGRAM, 8 )
10981098   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
10991099   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")   /* battery backed RAM */
1100   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
1101   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
1100   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
1101   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
11021102   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
11031103   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
11041104   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, m_videoram)
r11594r11595
11091109static ADDRESS_MAP_START( witchcrd_map, AS_PROGRAM, 8 )
11101110   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
11111111   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")   /* battery backed RAM */
1112   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
1113   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
1112   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
1113   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
11141114   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
11151115   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
11161116   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, m_videoram)
r11594r11595
11401140   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, m_videoram)
11411141   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, m_colorram)
11421142   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2")
1143   AM_RANGE(0x2100, 0x2100) AM_DEVWRITE("crtc", mc6845_address_w)
1144   AM_RANGE(0x2101, 0x2101) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
1143   AM_RANGE(0x2100, 0x2100) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
1144   AM_RANGE(0x2101, 0x2101) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
11451145   AM_RANGE(0x4000, 0x7fff) AM_ROM
11461146ADDRESS_MAP_END
11471147
11481148static ADDRESS_MAP_START( wildcard_map, AS_PROGRAM, 8 )
11491149//  ADDRESS_MAP_GLOBAL_MASK(0x7fff)
11501150   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")   /* battery backed RAM */
1151   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
1152   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
1151   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
1152   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
11531153   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
11541154   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
11551155   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, m_videoram)
r11594r11595
11691169
11701170static ADDRESS_MAP_START( wcrdxtnd_map, AS_PROGRAM, 8 )
11711171   AM_RANGE(0x0000, 0x07ff) AM_RAM //AM_SHARE("nvram") /* battery backed RAM */
1172   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
1173   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
1172   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
1173   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
11741174   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
11751175   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
11761176   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, m_videoram)
r11594r11595
11951195   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, m_videoram)
11961196   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE_MEMBER(goldnpkr_state, m_colorram)
11971197   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2")
1198   AM_RANGE(0x2100, 0x2100) AM_DEVWRITE("crtc", mc6845_address_w)
1199   AM_RANGE(0x2101, 0x2101) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
1198   AM_RANGE(0x2100, 0x2100) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
1199   AM_RANGE(0x2101, 0x2101) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
12001200   AM_RANGE(0x2800, 0x2fff) AM_RAM
12011201   AM_RANGE(0x3000, 0xffff) AM_ROM
12021202ADDRESS_MAP_END
r11594r11595
12231223static ADDRESS_MAP_START( genie_map, AS_PROGRAM, 8 )
12241224   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
12251225   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")   /* battery backed RAM */
1226   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
1227   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
1226   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
1227   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
12281228   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
12291229   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
12301230   AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE_MEMBER(goldnpkr_state, m_videoram)
src/mame/drivers/vcombat.c
r11594r11595
297297static WRITE16_HANDLER( crtc_w )
298298{
299299   vcombat_state *state = space->machine().driver_data<vcombat_state>();
300   device_t *crtc = space->machine().device("crtc");
300   mc6845_device *crtc = space->machine().device<mc6845_device>("crtc");
301301
302302   if (crtc == NULL)
303303      return;
304304
305305   if (state->m_crtc_select == 0)
306      mc6845_address_w(crtc, 0, data >> 8);
306      crtc->address_w(*space, 0, data >> 8);
307307   else
308      mc6845_register_w(crtc, 0, data >> 8);
308      crtc->register_w(*space, 0, data >> 8);
309309
310310   state->m_crtc_select ^= 1;
311311}
src/mame/drivers/fortecar.c
r11594r11595
134134
135135static ADDRESS_MAP_START( fortecar_ports, AS_IO, 8 )
136136   ADDRESS_MAP_GLOBAL_MASK(0xff)
137   AM_RANGE(0x20, 0x20) AM_DEVWRITE("crtc", mc6845_address_w)
138   AM_RANGE(0x21, 0x21) AM_DEVWRITE("crtc", mc6845_register_w)
137   AM_RANGE(0x20, 0x20) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
138   AM_RANGE(0x21, 0x21) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
139139   AM_RANGE(0x40, 0x40) AM_DEVREAD("aysnd", ay8910_r)
140140   AM_RANGE(0x40, 0x41) AM_DEVWRITE("aysnd", ay8910_address_data_w)
141141   AM_RANGE(0x60, 0x63) AM_DEVREADWRITE("fcppi0", ppi8255_r, ppi8255_w)//M5L8255AP
src/mame/drivers/albazg.c
r11594r11595
242242
243243static ADDRESS_MAP_START( port_map, AS_IO, 8 )
244244   ADDRESS_MAP_GLOBAL_MASK(0xff)
245   AM_RANGE(0x00, 0x00) AM_DEVWRITE("crtc", mc6845_address_w)
246   AM_RANGE(0x01, 0x01) AM_DEVWRITE("crtc", mc6845_register_w)
245   AM_RANGE(0x00, 0x00) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
246   AM_RANGE(0x01, 0x01) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
247247   AM_RANGE(0x40, 0x40) AM_DEVREAD("aysnd", ay8910_r)
248248   AM_RANGE(0x40, 0x41) AM_DEVWRITE("aysnd", ay8910_address_data_w)
249249   AM_RANGE(0x80, 0x83) AM_DEVREADWRITE_MODERN("ppi8255_0", i8255_device, read, write)
src/mame/drivers/twinkle.c
r11594r11595
115115      RTC-65271  - Epson Toyocom RTC-65271 real-time clock
116116      D481850GF  - NEC D481850GF-A12 128k x 32Bit x 2 Banks SGRAM (QFP100)
117117      CXD2925Q   - Sony CXD2925Q SPU (QFP100)
118      CXD8561Q   - Sony CXD8561Q GTE (QFP208)
118      CXD8561Q   - Sony CXD8561Q GPU (QFP208)
119119      CXD8530CQ  - Sony CXD8530CQ R3000-based CPU (QFP208)
120120      MC44200FT  - Motorola MC44200FT Triple 8-bit Video DAC (QFP44)
121121      KM48V514   - Samsung Electronics KM48V514BJ-6 512kx8 EDO DRAM (SOJ28)
src/mame/drivers/twincobr.c
r11594r11595
276276   AM_RANGE(0x030000, 0x033fff) AM_RAM      /* 68K and DSP shared RAM */
277277   AM_RANGE(0x040000, 0x040fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
278278   AM_RANGE(0x050000, 0x050dff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
279   AM_RANGE(0x060000, 0x060001) AM_DEVWRITE8("crtc", mc6845_address_w, 0x00ff)
280   AM_RANGE(0x060002, 0x060003) AM_DEVWRITE8("crtc", mc6845_register_w, 0x00ff)
279   AM_RANGE(0x060000, 0x060001) AM_DEVWRITE8_MODERN("crtc", mc6845_device, address_w, 0x00ff)
280   AM_RANGE(0x060002, 0x060003) AM_DEVWRITE8_MODERN("crtc", mc6845_device, register_w, 0x00ff)
281281   AM_RANGE(0x070000, 0x070003) AM_WRITE(twincobr_txscroll_w)   /* text layer scroll */
282282   AM_RANGE(0x070004, 0x070005) AM_WRITE(twincobr_txoffs_w)   /* offset in text video RAM */
283283   AM_RANGE(0x072000, 0x072003) AM_WRITE(twincobr_bgscroll_w)   /* bg layer scroll */
src/mame/drivers/luckgrln.c
r11594r11595
553553   AM_RANGE(0x00a1, 0x00a1) AM_WRITE(palette_offset_high_w)
554554   AM_RANGE(0x00a2, 0x00a2) AM_WRITE(palette_w)
555555
556   AM_RANGE(0x00b0, 0x00b0) AM_DEVWRITE("crtc", mc6845_address_w)
557   AM_RANGE(0x00b1, 0x00b1) AM_DEVWRITE("crtc", mc6845_register_w)
556   AM_RANGE(0x00b0, 0x00b0) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
557   AM_RANGE(0x00b1, 0x00b1) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
558558
559559   AM_RANGE(0x00b8, 0x00b8) AM_READ_PORT("IN0")
560560   AM_RANGE(0x00b9, 0x00b9) AM_READ_PORT("IN1") AM_WRITE(counters_w)
src/mame/drivers/nyny.c
r11594r11595
107107   device_t *m_audiocpu;
108108   device_t *m_audiocpu2;
109109   device_t *m_ic48_1;
110   device_t *m_mc6845;
110   mc6845_device *m_mc6845;
111111   pia6821_device *m_pia1;
112112   pia6821_device *m_pia2;
113113   pen_t m_pens[NUM_PENS];
r11594r11595
431431{
432432   nyny_state *state = screen->machine().driver_data<nyny_state>();
433433
434   mc6845_update(state->m_mc6845, bitmap, cliprect);
434   state->m_mc6845->update(bitmap, cliprect);
435435
436436   return 0;
437437}
r11594r11595
545545   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE_MEMBER(nyny_state, m_colorram2)
546546   AM_RANGE(0x8000, 0x9fff) AM_RAM
547547   AM_RANGE(0xa000, 0xa0ff) AM_RAM AM_SHARE("nvram") /* SRAM (coin counter, shown when holding F2) */
548   AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x00fe) AM_DEVWRITE("crtc", mc6845_address_w)
549   AM_RANGE(0xa101, 0xa101) AM_MIRROR(0x00fe) AM_DEVWRITE("crtc", mc6845_register_w)
548   AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x00fe) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
549   AM_RANGE(0xa101, 0xa101) AM_MIRROR(0x00fe) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
550550   AM_RANGE(0xa200, 0xa20f) AM_MIRROR(0x00f0) AM_READWRITE(nyny_pia_1_2_r, nyny_pia_1_2_w)
551551   AM_RANGE(0xa300, 0xa300) AM_MIRROR(0x00ff) AM_READWRITE(soundlatch3_r, audio_1_command_w)
552552   AM_RANGE(0xa400, 0xa7ff) AM_NOP
r11594r11595
686686   state->m_audiocpu = machine.device("audiocpu");
687687   state->m_audiocpu2 = machine.device("audio2");
688688   state->m_ic48_1 = machine.device("ic48_1");
689   state->m_mc6845 = machine.device("crtc");
689   state->m_mc6845 = machine.device<mc6845_device>("crtc");
690690   state->m_pia1 = machine.device<pia6821_device>("pia1");
691691   state->m_pia2 = machine.device<pia6821_device>("pia2");
692692
src/mame/drivers/calomega.c
r11594r11595
839839   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
840840   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
841841   AM_RANGE(0x0840, 0x0841) AM_DEVWRITE("ay8912", ay8910_address_data_w)
842   AM_RANGE(0x0880, 0x0880) AM_DEVWRITE("crtc", mc6845_address_w)
843   AM_RANGE(0x0881, 0x0881) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
842   AM_RANGE(0x0880, 0x0880) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
843   AM_RANGE(0x0881, 0x0881) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
844844   AM_RANGE(0x08c4, 0x08c7) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
845845   AM_RANGE(0x08c8, 0x08cb) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
846846   AM_RANGE(0x08d0, 0x08d0) AM_DEVREADWRITE_MODERN("acia6850_0", acia6850_device, status_read, control_write)
r11594r11595
854854   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
855855   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
856856   AM_RANGE(0x0840, 0x0841) AM_DEVWRITE("ay8912", ay8910_address_data_w)
857   AM_RANGE(0x0880, 0x0880) AM_DEVWRITE("crtc", mc6845_address_w)
858   AM_RANGE(0x0881, 0x0881) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
857   AM_RANGE(0x0880, 0x0880) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
858   AM_RANGE(0x0881, 0x0881) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
859859   AM_RANGE(0x08c4, 0x08c7) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
860860   AM_RANGE(0x08c8, 0x08cb) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
861861   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(calomega_videoram_w) AM_BASE_MEMBER(calomega_state, m_videoram)
r11594r11595
867867   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
868868   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
869869   AM_RANGE(0x1040, 0x1041) AM_DEVWRITE("ay8912", ay8910_address_data_w)
870   AM_RANGE(0x1080, 0x1080) AM_DEVWRITE("crtc", mc6845_address_w)
871   AM_RANGE(0x1081, 0x1081) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
870   AM_RANGE(0x1080, 0x1080) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
871   AM_RANGE(0x1081, 0x1081) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
872872   AM_RANGE(0x10c4, 0x10c7) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
873873   AM_RANGE(0x10c8, 0x10cb) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
874874   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(calomega_videoram_w) AM_BASE_MEMBER(calomega_state, m_videoram)
r11594r11595
880880   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
881881   AM_RANGE(0x280c, 0x280f) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
882882   AM_RANGE(0x2824, 0x2827) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
883   AM_RANGE(0x2c04, 0x2c04) AM_DEVWRITE("crtc", mc6845_address_w)
884   AM_RANGE(0x2c05, 0x2c05) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
883   AM_RANGE(0x2c04, 0x2c04) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
884   AM_RANGE(0x2c05, 0x2c05) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
885885   AM_RANGE(0x2c08, 0x2c09) AM_DEVREADWRITE("ay8912", ay8910_r, ay8910_address_data_w)
886886   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(calomega_videoram_w) AM_BASE_MEMBER(calomega_state, m_videoram)
887887   AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(calomega_colorram_w) AM_BASE_MEMBER(calomega_state, m_colorram)
src/mame/drivers/blitz68k.c
r11594r11595
730730   AM_RANGE(0x400004, 0x400005) AM_READWRITE8(bankrob_mcu1_r, bankrob_mcu1_w, 0x00ff)
731731   AM_RANGE(0x400006, 0x400007) AM_READWRITE8(bankrob_mcu2_r, bankrob_mcu2_w, 0xff00)
732732
733   AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8("crtc", mc6845_status_r,   mc6845_address_w,  0xff00)   // triggered by MCU?
734   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8("crtc", mc6845_register_r, mc6845_register_w, 0xff00)
733   AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8_MODERN("crtc", mc6845_device, status_r,   address_w,  0xff00)   // triggered by MCU?
734   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8_MODERN("crtc", mc6845_device, register_r, register_w, 0xff00)
735735ADDRESS_MAP_END
736736
737737// bankroba:
r11594r11595
871871}
872872
873873// CRTC
874static READ8_DEVICE_HANDLER( crtc_r )
874static READ8_HANDLER( crtc_r )
875875{
876   mc6845_device *mc6845 = space->machine().device<mc6845_device>("crtc");
876877   if (offset)
877      return mc6845_register_r(device, 0);
878      return mc6845->register_r(*space, 0);
878879   else
879      return mc6845_status_r(device, 0);
880      return mc6845->status_r(*space, 0);
880881}
881882
882static WRITE8_DEVICE_HANDLER( crtc_w )
883static WRITE8_HANDLER( crtc_w )
883884{
885   mc6845_device *mc6845 = space->machine().device<mc6845_device>("crtc");
884886   if (offset)
885      mc6845_register_w(device, 0, data);
887      mc6845->register_w(*space, 0, data);
886888   else
887      mc6845_address_w(device, 0, data);
889      mc6845->address_w(*space, 0, data);
888890}
889891
890892static WRITE16_DEVICE_HANDLER( crtc_lpen_w )
891893{
892894   // 8fe0006: 0->1
893895   if (ACCESSING_BITS_8_15 && (data & 0x0100))
894      mc6845_assert_light_pen_input(device);
896      downcast<mc6845_device *>(device)->assert_light_pen_input();
895897   // 8fe0007: 1->0 (MCU irq?)
896898}
897899
r11594r11595
939941   AM_RANGE(0x8fe004, 0x8fe005) AM_WRITEONLY
940942   AM_RANGE(0x8fe006, 0x8fe007) AM_DEVWRITE("crtc", crtc_lpen_w)   // 0x8fe006: 0->1, 0x8fe007: 1->0
941943
942   AM_RANGE(0xc40000, 0xc40001) AM_DEVREADWRITE8("crtc", crtc_r, crtc_w, 0xffff)
944   AM_RANGE(0xc40000, 0xc40001) AM_READWRITE8(crtc_r, crtc_w, 0xffff)
943945ADDRESS_MAP_END
944946
945947/*************************************************************************************************************
r11594r11595
10381040   AM_RANGE(0x89e004, 0x89e005) AM_WRITEONLY
10391041   AM_RANGE(0x89e006, 0x89e007) AM_DEVWRITE("crtc", crtc_lpen_w)   // 0x89e006: 0->1, 0x89e007: 1->0
10401042
1041   AM_RANGE(0xc00000, 0xc00001) AM_DEVREADWRITE8("crtc", crtc_r, crtc_w, 0xffff)
1043   AM_RANGE(0xc00000, 0xc00001) AM_READWRITE8(crtc_r, crtc_w, 0xffff)
10421044ADDRESS_MAP_END
10431045
10441046/*************************************************************************************************************
r11594r11595
11251127   AM_RANGE(0x400004, 0x400005) AM_READWRITE8(dualgame_mcu1_r, dualgame_mcu1_w, 0x00ff)
11261128   AM_RANGE(0x400006, 0x400007) AM_READWRITE8(dualgame_mcu2_r, dualgame_mcu2_w, 0xff00)
11271129
1128   AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8("crtc", mc6845_status_r,   mc6845_address_w,  0xff00)
1129   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8("crtc", mc6845_register_r, mc6845_register_w, 0xff00)
1130   AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8_MODERN("crtc", mc6845_device, status_r,   address_w,  0xff00)
1131   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8_MODERN("crtc", mc6845_device, register_r, register_w, 0xff00)
11301132ADDRESS_MAP_END
11311133
11321134/*************************************************************************************************************
r11594r11595
12051207   AM_RANGE(0x9f0004, 0x9f0005) AM_WRITEONLY
12061208   AM_RANGE(0x9f0006, 0x9f0007) AM_DEVWRITE("crtc", crtc_lpen_w)   // 0x9f0006: 0->1, 0x9f0007: 1->0
12071209
1208   AM_RANGE(0xb00000, 0xb00001) AM_DEVREADWRITE8("crtc", crtc_r, crtc_w, 0xffff)   // triggered by MCU?
1210   AM_RANGE(0xb00000, 0xb00001) AM_READWRITE8(crtc_r, crtc_w, 0xffff)   // triggered by MCU?
12091211
12101212   AM_RANGE(0xc80000, 0xc80007) AM_WRITE8(blit_hwyxa_draw_w, 0xffff)
12111213ADDRESS_MAP_END
r11594r11595
12621264   AM_RANGE(0x500004, 0x500005) AM_READWRITE8(maxidbl_mcu1_r, maxidbl_mcu1_w, 0x00ff)
12631265   AM_RANGE(0x500006, 0x500007) AM_READWRITE8(maxidbl_mcu2_r, maxidbl_mcu2_w, 0xff00)
12641266
1265   AM_RANGE(0x600000, 0x600001) AM_DEVREADWRITE8("crtc", mc6845_status_r,   mc6845_address_w,  0xff00)   // triggered by MCU?
1266   AM_RANGE(0x600002, 0x600003) AM_DEVREADWRITE8("crtc", mc6845_register_r, mc6845_register_w, 0xff00)
1267   AM_RANGE(0x600000, 0x600001) AM_DEVREADWRITE8_MODERN("crtc", mc6845_device, status_r,   address_w,  0xff00)   // triggered by MCU?
1268   AM_RANGE(0x600002, 0x600003) AM_DEVREADWRITE8_MODERN("crtc", mc6845_device, register_r, register_w, 0xff00)
12671269ADDRESS_MAP_END
12681270
12691271
src/mame/drivers/spiders.c
r11594r11595
523523
524524static SCREEN_UPDATE( spiders )
525525{
526   device_t *mc6845 = screen->machine().device("crtc");
527   mc6845_update(mc6845, bitmap, cliprect);
526   mc6845_device *mc6845 = screen->machine().device<mc6845_device>("crtc");
527   mc6845->update(bitmap, cliprect);
528528
529529   return 0;
530530}
r11594r11595
581581
582582static ADDRESS_MAP_START( spiders_main_map, AS_PROGRAM, 8 )
583583   AM_RANGE(0x0000, 0xbfff) AM_RAM AM_BASE_MEMBER(spiders_state, m_ram)
584   AM_RANGE(0xc000, 0xc000) AM_DEVWRITE("crtc", mc6845_address_w)
585   AM_RANGE(0xc001, 0xc001) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
584   AM_RANGE(0xc000, 0xc000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
585   AM_RANGE(0xc001, 0xc001) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
586586   AM_RANGE(0xc020, 0xc027) AM_RAM AM_SHARE("nvram")
587587   AM_RANGE(0xc044, 0xc047) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
588588   AM_RANGE(0xc048, 0xc04b) AM_DEVREADWRITE_MODERN("pia2", pia6821_device, read_alt, write_alt)
src/mame/drivers/mpu4drvr.c
r11594r11595
21972197static ADDRESS_MAP_START( dealem_memmap, AS_PROGRAM, 8 )
21982198   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
21992199
2200   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_address_w)
2201   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
2200   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
2201   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
22022202
22032203/*  AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) */ //Runs hoppers
22042204
src/mame/drivers/usgames.c
r11594r11595
6666   AM_RANGE(0x2010, 0x2010) AM_READ_PORT("INPUTS")
6767   AM_RANGE(0x2020, 0x2020) AM_WRITE(lamps1_w)
6868   AM_RANGE(0x2030, 0x2030) AM_WRITE(lamps2_w)
69   AM_RANGE(0x2040, 0x2040) AM_DEVWRITE("crtc", mc6845_address_w)
69   AM_RANGE(0x2040, 0x2040) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
7070   AM_RANGE(0x2041, 0x2041) AM_READ_PORT("UNK1")
71   AM_RANGE(0x2041, 0x2041) AM_DEVWRITE("crtc", mc6845_register_w)
71   AM_RANGE(0x2041, 0x2041) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
7272   AM_RANGE(0x2060, 0x2060) AM_WRITE(usgames_rombank_w)
7373   AM_RANGE(0x2070, 0x2070) AM_READ_PORT("UNK2")
7474   AM_RANGE(0x2400, 0x2401) AM_DEVWRITE("aysnd", ay8910_address_data_w)
r11594r11595
8686   AM_RANGE(0x2410, 0x2410) AM_READ_PORT("INPUTS")
8787   AM_RANGE(0x2420, 0x2420) AM_WRITE(lamps1_w)
8888   AM_RANGE(0x2430, 0x2430) AM_WRITE(lamps2_w)
89   AM_RANGE(0x2440, 0x2440) AM_DEVWRITE("crtc", mc6845_address_w)
89   AM_RANGE(0x2440, 0x2440) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
9090   AM_RANGE(0x2441, 0x2441) AM_READ_PORT("UNK1")
91   AM_RANGE(0x2441, 0x2441) AM_DEVWRITE("crtc", mc6845_register_w)
91   AM_RANGE(0x2441, 0x2441) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
9292   AM_RANGE(0x2460, 0x2460) AM_WRITE(usgames_rombank_w)
9393   AM_RANGE(0x2470, 0x2470) AM_READ_PORT("UNK2")
9494   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(usgames_charram_w) AM_BASE_MEMBER(usgames_state, m_charram)
src/mame/drivers/progolf.c
r11594r11595
249249   AM_RANGE(0x9400, 0x9400) AM_READ_PORT("P2") AM_WRITE(progolf_scrollx_lo_w) //p2 inputs
250250   AM_RANGE(0x9600, 0x9600) AM_READ_PORT("IN0") AM_WRITE(progolf_flip_screen_w)   /* VBLANK */
251251   AM_RANGE(0x9800, 0x9800) AM_READ_PORT("DSW1")
252   AM_RANGE(0x9800, 0x9800) AM_DEVWRITE("crtc", mc6845_address_w)
253   AM_RANGE(0x9801, 0x9801) AM_DEVWRITE("crtc", mc6845_register_w)
252   AM_RANGE(0x9800, 0x9800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
253   AM_RANGE(0x9801, 0x9801) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
254254   AM_RANGE(0x9a00, 0x9a00) AM_READ_PORT("DSW2") AM_WRITE(audio_command_w)
255255//  AM_RANGE(0x9e00, 0x9e00) AM_WRITENOP
256256   AM_RANGE(0xb000, 0xffff) AM_ROM
src/mame/drivers/merit.c
r11594r11595
354354   AM_RANGE(0x6000, 0x67ff) AM_RAM
355355   AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
356356   AM_RANGE(0xc000, 0xc003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
357   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_address_w)
358   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_register_w)
357   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
358   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
359359   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
360360   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
361361   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
370370   AM_RANGE(0x7001, 0x7fff) AM_RAM
371371   AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
372372   AM_RANGE(0xc000, 0xc003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
373   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_address_w)
374   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_register_w)
373   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
374   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
375375   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
376376   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
377377   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
382382   AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("nvram")
383383   AM_RANGE(0xc004, 0xc007) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
384384   AM_RANGE(0xc008, 0xc00b) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
385   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_address_w)
386   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_register_w)
385   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
386   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
387387   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
388388   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
389389   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
394394   AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("nvram")
395395   AM_RANGE(0xc004, 0xc007) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
396396   AM_RANGE(0xc008, 0xc00b) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
397   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_address_w)
398   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_register_w)
397   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
398   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
399399   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
400400   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
401401   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
414414   AM_RANGE(0x6000, 0x67ff) AM_RAM
415415   AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x1df0) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
416416   AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1df0) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
417   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_address_w)
418   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_register_w)
417   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
418   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
419419   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
420420   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
421421   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
435435   AM_RANGE(0xce00, 0xceff) AM_READWRITE(questions_r, high_offset_w)
436436   AM_RANGE(0xd600, 0xd6ff) AM_WRITE(low_offset_w)
437437   AM_RANGE(0xda00, 0xdaff) AM_WRITE(med_offset_w)
438   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_address_w)
439   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_register_w)
438   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
439   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
440440   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
441441   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
442442   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
456456   AM_RANGE(0xce00, 0xceff) AM_READWRITE(questions_r, high_offset_w)
457457   AM_RANGE(0xd600, 0xd6ff) AM_WRITE(low_offset_w)
458458   AM_RANGE(0xda00, 0xdaff) AM_WRITE(med_offset_w)
459   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_address_w)
460   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_register_w)
459   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
460   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
461461   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
462462   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
463463   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
477477   AM_RANGE(0xce00, 0xceff) AM_READWRITE(questions_r, high_offset_w)
478478   AM_RANGE(0xd600, 0xd6ff) AM_WRITE(low_offset_w)
479479   AM_RANGE(0xda00, 0xdaff) AM_WRITE(med_offset_w)
480   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_address_w)
481   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_register_w)
480   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
481   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
482482   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
483483   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
484484   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
493493   AM_RANGE(0xce00, 0xceff) AM_READWRITE(questions_r, high_offset_w)
494494   AM_RANGE(0xd600, 0xd6ff) AM_WRITE(low_offset_w)
495495   AM_RANGE(0xda00, 0xdaff) AM_WRITE(med_offset_w)
496   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_address_w)
497   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_register_w)
496   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
497   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
498498   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
499499   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
500500   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
506506   AM_RANGE(0xa000, 0xbfff) AM_RAM AM_BASE_MEMBER(merit_state, m_backup_ram)
507507   AM_RANGE(0xc004, 0xc007) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
508508   AM_RANGE(0xc008, 0xc00b) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
509   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_address_w)
510   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_register_w)
509   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
510   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
511511   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_attr)
512512   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(merit_state, m_ram_video)
513513   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
r11594r11595
11551155
11561156static SCREEN_UPDATE( merit )
11571157{
1158   device_t *mc6845 = screen->machine().device("crtc");
1159   mc6845_update(mc6845, bitmap, cliprect);
1158   mc6845_device *mc6845 = screen->machine().device<mc6845_device>("crtc");
1159   mc6845->update(bitmap, cliprect);
11601160
11611161   return 0;
11621162}
src/mame/drivers/madalien.c
r11594r11595
8585   AM_RANGE(0x6400, 0x67ff) AM_RAM
8686   AM_RANGE(0x6800, 0x7fff) AM_RAM_WRITE(madalien_charram_w) AM_BASE_MEMBER(madalien_state, m_charram)
8787
88   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0ff0) AM_DEVWRITE("crtc", mc6845_address_w)
89   AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ff0) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
88   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0ff0) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
89   AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ff0) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
9090   AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x0ff0) AM_WRITEONLY AM_BASE_MEMBER(madalien_state, m_video_control)
9191   AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x0ff0) AM_WRITE(madalien_output_w)
9292   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x0ff0) AM_READWRITE(soundlatch2_r, madalien_sound_command_w)
src/mame/drivers/ksys573.c
r11594r11595
208208  LA4705    - Sanyo LA4705 15W 2-channel power amplifier (SIP18)
209209  LM358     - National Semiconductor LM358 low power dual operational amplifier (SOIC8, @ 33C)
210210  CXD2925Q  - Sony CXD2925Q SPU (QFP100, @ 15Q)
211  CXD8561Q  - Sony CXD8561Q GTE (QFP208, @ 10M)
211  CXD8561Q  - Sony CXD8561Q GPU (QFP208, @ 10M)
212212  CXD8530CQ - Sony CXD8530CQ R3000-based CPU (QFP208, @ 17M)
213213  9536      - Xilinx XC9536 in-system-programmable CPLD (PLCC44, @ 22J)
214214  3644      - Hitachi H8/3644 HD6473644H microcontroller with 32k ROM & 1k RAM (QFP64, @ 18E,
src/mame/drivers/funworld.c
r11594r11595
799799   AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
800800   AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD("ay8910", ay8910_r)
801801   AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE("ay8910", ay8910_address_data_w)
802   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE("crtc", mc6845_address_w)
803   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
802   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
803   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
804804   AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(funworld_videoram_w) AM_BASE_MEMBER(funworld_state, m_videoram)
805805   AM_RANGE(0x3000, 0x3fff) AM_RAM_WRITE(funworld_colorram_w) AM_BASE_MEMBER(funworld_state, m_colorram)
806806   AM_RANGE(0x4000, 0x4000) AM_READNOP
r11594r11595
833833   AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
834834   AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD("ay8910", ay8910_r)
835835   AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE("ay8910", ay8910_address_data_w)
836   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE("crtc", mc6845_address_w)
837   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
836   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
837   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
838838
839839   AM_RANGE(0x1800, 0x1800) AM_WRITE(question_bank_w)
840840
r11594r11595
851851   AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
852852   AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD("ay8910", ay8910_r)
853853   AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE("ay8910", ay8910_address_data_w)
854   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE("crtc", mc6845_address_w)
855   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
854   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
855   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
856856   AM_RANGE(0x2c00, 0x2cff) AM_RAM   /* range for protection */
857857   AM_RANGE(0x3600, 0x36ff) AM_RAM   /* some games use $3603-05 range for protection */
858858   AM_RANGE(0x3c00, 0x3cff) AM_RAM   /* range for protection */
r11594r11595
867867   AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
868868   AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD("ay8910", ay8910_r)
869869   AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE("ay8910", ay8910_address_data_w)
870   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE("crtc", mc6845_address_w)
871   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
870   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
871   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
872872   AM_RANGE(0x2000, 0x2000) AM_READNOP   /* some unknown reads */
873873   AM_RANGE(0x3e00, 0x3fff) AM_RAM   /* some games use $3e03-05 range for protection */
874874   AM_RANGE(0x6000, 0x6fff) AM_RAM_WRITE(funworld_videoram_w) AM_BASE_MEMBER(funworld_state, m_videoram)
r11594r11595
880880   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
881881   AM_RANGE(0x0800, 0x0800) AM_READ_PORT("IN0")
882882   AM_RANGE(0x0a01, 0x0a01) AM_READ_PORT("IN1")
883   AM_RANGE(0x081c, 0x081c) AM_DEVWRITE("crtc", mc6845_address_w)
884   AM_RANGE(0x081d, 0x081d) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
883   AM_RANGE(0x081c, 0x081c) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
884   AM_RANGE(0x081d, 0x081d) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
885885   AM_RANGE(0x1000, 0x1000) AM_READ_PORT("IN2")
886886   AM_RANGE(0x1800, 0x1800) AM_DEVREAD("ay8910", ay8910_r)
887887   AM_RANGE(0x1800, 0x1801) AM_DEVWRITE("ay8910", ay8910_address_data_w)
r11594r11595
910910   AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write)
911911   AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD("ay8910", ay8910_r)
912912   AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE("ay8910", ay8910_address_data_w)
913   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE("crtc", mc6845_address_w)
914   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
913   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
914   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
915915   AM_RANGE(0x4000, 0x4fff) AM_RAM_WRITE(funworld_videoram_w) AM_BASE_MEMBER(funworld_state, m_videoram)
916916   AM_RANGE(0x5000, 0x5fff) AM_RAM_WRITE(funworld_colorram_w) AM_BASE_MEMBER(funworld_state, m_colorram)
917917   AM_RANGE(0x6000, 0x6000) AM_READ_PORT("DSW2")
src/mame/drivers/peplus.c
r11594r11595
311311
312312static TIMER_CALLBACK(assert_lp_cb)
313313{
314   mc6845_assert_light_pen_input((device_t *) ptr);
314   downcast<mc6845_device *>((device_t*)ptr)->assert_light_pen_input();
315315}
316316
317317static void handle_lightpen( device_t *device )
r11594r11595
333333   handle_lightpen(device);
334334}
335335
336static WRITE8_DEVICE_HANDLER( peplus_crtc_display_w )
336static WRITE8_HANDLER( peplus_crtc_display_w )
337337{
338   peplus_state *state = device->machine().driver_data<peplus_state>();
338   peplus_state *state = space->machine().driver_data<peplus_state>();
339339   UINT8 *videoram = state->m_videoram;
340340   videoram[state->m_vid_address] = data;
341341   state->m_palette_ram[state->m_vid_address] = state->m_io_port[1];
r11594r11595
344344   tilemap_mark_tile_dirty(state->m_bg_tilemap, state->m_vid_address);
345345
346346   /* An access here triggers a device read !*/
347   (void) mc6845_register_r(device, 0);
347   space->machine().device<mc6845_device>("crtc")->register_r(*space, 0);
348348}
349349
350350static WRITE8_HANDLER( peplus_io_w )
r11594r11595
740740
741741   // CRT Controller
742742   AM_RANGE(0x2008, 0x2008) AM_DEVWRITE("crtc", peplus_crtc_mode_w)
743   AM_RANGE(0x2080, 0x2080) AM_DEVREADWRITE("crtc", mc6845_status_r, mc6845_address_w)
744   AM_RANGE(0x2081, 0x2081) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
745   AM_RANGE(0x2083, 0x2083) AM_DEVREADWRITE("crtc", mc6845_register_r, peplus_crtc_display_w)
743   AM_RANGE(0x2080, 0x2080) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, status_r, address_w)
744   AM_RANGE(0x2081, 0x2081) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
745   AM_RANGE(0x2083, 0x2083) AM_DEVREAD_MODERN("crtc", mc6845_device, register_r) AM_WRITE(peplus_crtc_display_w)
746746
747747    // Superboard Data
748748   AM_RANGE(0x3000, 0x3fff) AM_READWRITE(peplus_s3000_r, peplus_s3000_w) AM_BASE_MEMBER(peplus_state, m_s3000_ram)
src/mame/drivers/jokrwild.c
r11594r11595
199199   AM_RANGE(0x4004, 0x4007) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
200200   AM_RANGE(0x4008, 0x400b) AM_DEVREADWRITE_MODERN("pia1", pia6821_device, read, write) //optical sensor is here
201201//  AM_RANGE(0x4010, 0x4010) AM_READNOP /* R ???? */
202   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE("crtc", mc6845_address_w)
203   AM_RANGE(0x6001, 0x6001) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
202   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
203   AM_RANGE(0x6001, 0x6001) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
204204   AM_RANGE(0x6100, 0x6100) AM_READ_PORT("SW1")
205205   AM_RANGE(0x6200, 0x6203) AM_READ(rng_r)//another PIA?
206206   AM_RANGE(0x6300, 0x6300) AM_READ_PORT("SW2")
src/mame/drivers/saturn.c
r11594r11595
162162#include "imagedev/cartslot.h"
163163#include "coreutil.h"
164164
165#define USE_SLAVE 1
166165
167#ifdef MAME_DEBUG
166
168167#define LOG_CDB  0
169#define LOG_SMPC 1
170#define LOG_SCU  1
171#define LOG_IRQ  0
172#define LOG_IOGA 1
173#else
174#define LOG_CDB  0
175168#define LOG_SMPC 0
176169#define LOG_SCU  0
177170#define LOG_IRQ  0
178171#define LOG_IOGA 0
179#endif
180172
173
174
181175#define MASTER_CLOCK_352 57272800
182176#define MASTER_CLOCK_320 53748200
183#define PIXEL_CLOCK 50160000/2/4 /*hand-tuned to match fps ~59.82*/
177#define PIXEL_CLOCK 50160000/2/4 /*TODO: fix me up! */
184178
185179/**************************************************************************************/
186180/*to be added into a stv Header file,remember to remove all the static...*/
187181
188static UINT8 *smpc_ram;
189182//static void stv_dump_ram(void);
190183
191UINT32* stv_workram_l;
192UINT32* stv_workram_h;
193cpu_device *stv_maincpu;
194cpu_device *stv_slave;
195cpu_device *stv_audiocpu;
196static UINT32* stv_backupram;
197184static UINT32* ioga;
198185static UINT16* scsp_regs;
199static UINT16* sound_ram;
200186static int saturn_region;
201187
202int stv_enable_slave_sh2;
203188/*VDP2 stuff*/
204189/*SMPC stuff*/
205static UINT8 NMI_reset;
206static void system_reset(void);
207static UINT8 en_68k;
208190/*SCU stuff*/
191/* TODO: not stated because IRQ system needs to be rewritten anyway ... */
209192static int     timer_0;         /* Counter for Timer 0 irq*/
210193static int    timer_1;          /* Counter for Timer 1 irq*/
211/*Maybe add these in a struct...*/
212static UINT32 scu_src_0,      /* Source DMA lv 0 address*/
213           scu_src_1,      /* lv 1*/
214           scu_src_2,      /* lv 2*/
215           scu_dst_0,      /* Destination DMA lv 0 address*/
216           scu_dst_1,      /* lv 1*/
217           scu_dst_2,      /* lv 2*/
218           scu_src_add_0,   /* Source Addition for DMA lv 0*/
219           scu_src_add_1,   /* lv 1*/
220           scu_src_add_2,   /* lv 2*/
221           scu_dst_add_0,   /* Destination Addition for DMA lv 0*/
222           scu_dst_add_1,   /* lv 1*/
223           scu_dst_add_2;   /* lv 2*/
224static INT32  scu_size_0,      /* Transfer DMA size lv 0*/
225           scu_size_1,      /* lv 1*/
226           scu_size_2;      /* lv 2*/
227194
228195static struct
229196{
r11594r11595
242209   UINT8 abus;
243210}stv_irq;
244211
245static void dma_direct_lv0(address_space *space);   /*DMA level 0 direct transfer function*/
246static void dma_direct_lv1(address_space *space);   /*DMA level 1 direct transfer function*/
247static void dma_direct_lv2(address_space *space);   /*DMA level 2 direct transfer function*/
248static void dma_indirect_lv0(address_space *space); /*DMA level 0 indirect transfer function*/
249static void dma_indirect_lv1(address_space *space); /*DMA level 1 indirect transfer function*/
250static void dma_indirect_lv2(address_space *space); /*DMA level 2 indirect transfer function*/
212static void scu_dma_direct(address_space *space, UINT8 dma_ch);   /*DMA level 0 direct transfer function*/
213static void scu_dma_indirect(address_space *space, UINT8 dma_ch); /*DMA level 0 indirect transfer function*/
251214
252215
253216int minit_boost,sinit_boost;
r11594r11595
262225#define ABUSIRQ(_irq_,_vector_) \
263226   { cputag_set_input_line_and_vector(device->machine(), "maincpu", _irq_, HOLD_LINE , _vector_); }
264227#if 0
265if(stv_scu[42] & 1)//IRQ ACK
228if(state->m_scu_regs[42] & 1)//IRQ ACK
266229{
267230   ABUSIRQ(7,0x50,0x00010000);
268231   ABUSIRQ(7,0x51,0x00020000);
r11594r11595
454417
455418
456419
457static void system_reset()
420static void system_reset(address_space *space)
458421{
422   saturn_state *state = space->machine().driver_data<saturn_state>();
423
459424   /*Only backup ram and SMPC ram are retained after that this command is issued.*/
460   memset(stv_scu      ,0x00,0x000100);
425   memset(state->m_scu_regs ,0x00,0x000100);
461426   memset(scsp_regs    ,0x00,0x001000);
462   memset(sound_ram    ,0x00,0x080000);
463   memset(stv_workram_h,0x00,0x100000);
464   memset(stv_workram_l,0x00,0x100000);
427   memset(state->m_sound_ram  ,0x00,0x080000);
428   memset(state->m_workram_h,0x00,0x100000);
429   memset(state->m_workram_l,0x00,0x100000);
465430   memset(stv_vdp2_regs,0x00,0x040000);
466431   memset(stv_vdp2_vram,0x00,0x100000);
467432   memset(stv_vdp2_cram,0x00,0x080000);
r11594r11595
470435   /*Order is surely wrong but whatever...*/
471436}
472437
473static UINT8 stv_SMPC_r8 (address_space *space, int offset)
438static READ8_HANDLER( stv_SMPC_r8 )
474439{
440   saturn_state *state = space->machine().driver_data<saturn_state>();
475441   int return_data;
476442
443   return_data = state->m_smpc_ram[offset];
477444
478   return_data = smpc_ram[offset];
479
480445   if (offset == 0x61) // ?? many games need this or the controls don't work
481446      return_data = 0x20 ^ 0xff;
482447
r11594r11595
497462   return return_data;
498463}
499464
500static void stv_SMPC_w8 (address_space *space, int offset, UINT8 data)
465static TIMER_CALLBACK( stv_bankswitch_state )
501466{
502   system_time systime;
467   saturn_state *state = machine.driver_data<saturn_state>();
468   static const char *const keynames[] = { "game0", "game1", "game2", "game3" };
469   UINT8* game_region;
503470
471   if(state->m_prev_bankswitch != param)
472   {
473      game_region = machine.region(keynames[param])->base();
474
475      if (game_region)
476         memcpy(machine.region("abus")->base(), game_region, 0x3000000);
477      else
478         memset(machine.region("abus")->base(), 0x00, 0x3000000);
479
480      state->m_prev_bankswitch = param;
481   }
482}
483
484static void stv_select_game(running_machine &machine, int gameno)
485{
486   machine.scheduler().timer_set(attotime::zero, FUNC(stv_bankswitch_state), gameno);
487}
488
489static WRITE8_HANDLER( stv_SMPC_w8 )
490{
491   saturn_state *state = space->machine().driver_data<saturn_state>();
492   system_time systime;
504493   space->machine().base_datetime(systime);
505494
506495//  if(LOG_SMPC) logerror ("8-bit SMPC Write to Offset %02x with Data %02x\n", offset, data);
507   smpc_ram[offset] = data;
496   state->m_smpc_ram[offset] = data;
508497
509498   if(offset == 0x75)
510499   {
r11594r11595
512501      eeprom->set_clock_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
513502      eeprom->write_bit(data & 0x10);
514503      eeprom->set_cs_line((data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
504      state->m_stv_multi_bank = data & 3;
515505
506      stv_select_game(space->machine(), state->m_stv_multi_bank);
516507
517508//      if (data & 0x01)
518509//          if(LOG_SMPC) logerror("bit 0 active\n");
r11594r11595
520511//          if(LOG_SMPC) logerror("bit 1 active\n");
521512//      if (data & 0x10)
522513         //if(LOG_SMPC) logerror("bit 4 active\n");//LOT
523      //if(LOG_SMPC) logerror("SMPC: ram [0x75] = %02x\n",smpc_ram[0x75]);
514      //if(LOG_SMPC) logerror("SMPC: ram [0x75] = %02x\n",state->m_smpc_ram[0x75]);
524515      PDR1 = (data & 0x60);
525516   }
526517
r11594r11595
530521            ACTIVE LOW
531522            bit 4(0x10) - Enable Sound System
532523        */
533      //popmessage("PDR2 = %02x",smpc_ram[0x77]);
534      if(!(smpc_ram[0x77] & 0x10))
535      {
536         if(LOG_SMPC) logerror("SMPC: M68k on\n");
537         cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, CLEAR_LINE);
538         en_68k = 1;
539      }
540      else
541      {
542         if(LOG_SMPC) logerror("SMPC: M68k off\n");
543         cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
544         en_68k = 0;
545      }
546      //if(LOG_SMPC) logerror("SMPC: ram [0x77] = %02x\n",smpc_ram[0x77]);
524      //popmessage("PDR2 = %02x",state->m_smpc_ram[0x77]);
525
526      if(LOG_SMPC) logerror("SMPC: M68k %s\n",(state->m_smpc_ram[0x77] & 0x10) ? "off" : "on");
527      cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, (state->m_smpc_ram[0x77] & 0x10) ? ASSERT_LINE : CLEAR_LINE);
528      state->m_en_68k = ((state->m_smpc_ram[0x77] & 0x10) >> 4) ^ 1;
529
530      //if(LOG_SMPC) logerror("SMPC: ram [0x77] = %02x\n",state->m_smpc_ram[0x77]);
547531      PDR2 = (data & 0x60);
548532   }
549533
550534   if(offset == 0x7d)
551535   {
552      if(smpc_ram[0x7d] & 1)
536      if(state->m_smpc_ram[0x7d] & 1)
553537         SH2_DIRECT_MODE_PORT_1;
554538      else
555539         SMPC_CONTROL_MODE_PORT_1;
556540
557      if(smpc_ram[0x7d] & 2)
541      if(state->m_smpc_ram[0x7d] & 2)
558542         SH2_DIRECT_MODE_PORT_2;
559543      else
560544         SMPC_CONTROL_MODE_PORT_2;
r11594r11595
564548   if(offset == 0x7f)
565549   {
566550      //enable PAD irq & VDP2 external latch for port 1/2
567      EXLE1 = smpc_ram[0x7f] & 1 ? 1 : 0;
568      EXLE2 = smpc_ram[0x7f] & 2 ? 1 : 0;
551      EXLE1 = state->m_smpc_ram[0x7f] & 1 ? 1 : 0;
552      EXLE2 = state->m_smpc_ram[0x7f] & 2 ? 1 : 0;
569553      if(EXLE1 || EXLE2)
570554      {
571555         //if(LOG_SMPC) logerror ("Interrupt: PAD irq at scanline %04x, Vector 0x48 Level 0x08\n",scanline);
r11594r11595
579563      {
580564         case 0x00:
581565            if(LOG_SMPC) logerror ("SMPC: Master ON\n");
582            smpc_ram[0x5f]=0x00;
566            state->m_smpc_ram[0x5f]=0x00;
583567            break;
584568         //in theory 0x01 is for Master OFF,but obviously is not used.
585569         case 0x02:
586570            if(LOG_SMPC) logerror ("SMPC: Slave ON\n");
587            smpc_ram[0x5f]=0x02;
588            #if USE_SLAVE
589            stv_enable_slave_sh2 = 1;
571            state->m_smpc_ram[0x5f]=0x02;
590572            cputag_set_input_line(space->machine(), "slave", INPUT_LINE_RESET, CLEAR_LINE);
591            #endif
592573            break;
593574         case 0x03:
594575            if(LOG_SMPC) logerror ("SMPC: Slave OFF\n");
595            smpc_ram[0x5f]=0x03;
596            stv_enable_slave_sh2 = 0;
576            state->m_smpc_ram[0x5f]=0x03;
597577            space->machine().scheduler().trigger(1000);
598578            cputag_set_input_line(space->machine(), "slave", INPUT_LINE_RESET, ASSERT_LINE);
599579            break;
600580         case 0x06:
601581            if(LOG_SMPC) logerror ("SMPC: Sound ON\n");
602582            /* wrong? */
603            smpc_ram[0x5f]=0x06;
583            state->m_smpc_ram[0x5f]=0x06;
604584            cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, CLEAR_LINE);
605585            break;
606586         case 0x07:
607587            if(LOG_SMPC) logerror ("SMPC: Sound OFF\n");
608            smpc_ram[0x5f]=0x07;
588            state->m_smpc_ram[0x5f]=0x07;
609589            break;
610590         /*CD (SH-1) ON/OFF,guess that this is needed for Sports Fishing games...*/
611591         //case 0x08:
612592         //case 0x09:
613593         case 0x0d:
614594            if(LOG_SMPC) logerror ("SMPC: System Reset\n");
615            smpc_ram[0x5f]=0x0d;
595            state->m_smpc_ram[0x5f]=0x0d;
616596            cputag_set_input_line(space->machine(), "maincpu", INPUT_LINE_RESET, PULSE_LINE);
617            system_reset();
597            system_reset(space);
618598            break;
619599         case 0x0e:
620600            if(LOG_SMPC) logerror ("SMPC: Change Clock to 352\n");
621            smpc_ram[0x5f]=0x0e;
601            state->m_smpc_ram[0x5f]=0x0e;
622602            space->machine().device("maincpu")->set_unscaled_clock(MASTER_CLOCK_352/2);
623603            space->machine().device("slave")->set_unscaled_clock(MASTER_CLOCK_352/2);
624604            space->machine().device("audiocpu")->set_unscaled_clock(MASTER_CLOCK_352/5);
r11594r11595
626606            break;
627607         case 0x0f:
628608            if(LOG_SMPC) logerror ("SMPC: Change Clock to 320\n");
629            smpc_ram[0x5f]=0x0f;
609            state->m_smpc_ram[0x5f]=0x0f;
630610            space->machine().device("maincpu")->set_unscaled_clock(MASTER_CLOCK_320/2);
631611            space->machine().device("slave")->set_unscaled_clock(MASTER_CLOCK_320/2);
632612            space->machine().device("audiocpu")->set_unscaled_clock(MASTER_CLOCK_320/5);
r11594r11595
635615         /*"Interrupt Back"*/
636616         case 0x10:
637617            if(LOG_SMPC) logerror ("SMPC: Status Acquire\n");
638            smpc_ram[0x5f]=0x10;
639            smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
640            //smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
641            //smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
642            //smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month+1);
643            //smpc_ram[0x29] = DectoBCD(systime.local_time.mday);
644            //smpc_ram[0x2b] = DectoBCD(systime.local_time.hour);
645            //smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
646            //smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
618            state->m_smpc_ram[0x5f]=0x10;
619            state->m_smpc_ram[0x21] = (0x80) | ((state->m_NMI_reset & 1) << 6);
620            //state->m_smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
621            //state->m_smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
622            //state->m_smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month+1);
623            //state->m_smpc_ram[0x29] = DectoBCD(systime.local_time.mday);
624            //state->m_smpc_ram[0x2b] = DectoBCD(systime.local_time.hour);
625            //state->m_smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
626            //state->m_smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
647627
648            smpc_ram[0x31]=0x00;  //?
628            state->m_smpc_ram[0x31]=0x00;  //?
649629
650            //smpc_ram[0x33]=input_port_read(space->machine(), "FAKE");
630            //state->m_smpc_ram[0x33]=input_port_read(space->machine(), "FAKE");
651631
652            smpc_ram[0x35]=0x00;
653            smpc_ram[0x37]=0x00;
632            state->m_smpc_ram[0x35]=0x00;
633            state->m_smpc_ram[0x37]=0x00;
654634
655            smpc_ram[0x39]=0xff;
656            smpc_ram[0x3b]=0xff;
657            smpc_ram[0x3d]=0xff;
658            smpc_ram[0x3f]=0xff;
659            smpc_ram[0x41]=0xff;
660            smpc_ram[0x43]=0xff;
661            smpc_ram[0x45]=0xff;
662            smpc_ram[0x47]=0xff;
663            smpc_ram[0x49]=0xff;
664            smpc_ram[0x4b]=0xff;
665            smpc_ram[0x4d]=0xff;
666            smpc_ram[0x4f]=0xff;
667            smpc_ram[0x51]=0xff;
668            smpc_ram[0x53]=0xff;
669            smpc_ram[0x55]=0xff;
670            smpc_ram[0x57]=0xff;
671            smpc_ram[0x59]=0xff;
672            smpc_ram[0x5b]=0xff;
673            smpc_ram[0x5d]=0xff;
635            state->m_smpc_ram[0x39]=0xff;
636            state->m_smpc_ram[0x3b]=0xff;
637            state->m_smpc_ram[0x3d]=0xff;
638            state->m_smpc_ram[0x3f]=0xff;
639            state->m_smpc_ram[0x41]=0xff;
640            state->m_smpc_ram[0x43]=0xff;
641            state->m_smpc_ram[0x45]=0xff;
642            state->m_smpc_ram[0x47]=0xff;
643            state->m_smpc_ram[0x49]=0xff;
644            state->m_smpc_ram[0x4b]=0xff;
645            state->m_smpc_ram[0x4d]=0xff;
646            state->m_smpc_ram[0x4f]=0xff;
647            state->m_smpc_ram[0x51]=0xff;
648            state->m_smpc_ram[0x53]=0xff;
649            state->m_smpc_ram[0x55]=0xff;
650            state->m_smpc_ram[0x57]=0xff;
651            state->m_smpc_ram[0x59]=0xff;
652            state->m_smpc_ram[0x5b]=0xff;
653            state->m_smpc_ram[0x5d]=0xff;
674654
675655         //  /*This is for RTC,cartridge code and similar stuff...*/
676656            /*System Manager(SMPC) irq*/
r11594r11595
682662         /* RTC write*/
683663         case 0x16:
684664            if(LOG_SMPC) logerror("SMPC: RTC write\n");
685            smpc_ram[0x2f] = smpc_ram[0x0d];
686            smpc_ram[0x2d] = smpc_ram[0x0b];
687            smpc_ram[0x2b] = smpc_ram[0x09];
688            smpc_ram[0x29] = smpc_ram[0x07];
689            smpc_ram[0x27] = smpc_ram[0x05];
690            smpc_ram[0x25] = smpc_ram[0x03];
691            smpc_ram[0x23] = smpc_ram[0x01];
692            smpc_ram[0x5f]=0x16;
665            state->m_smpc_ram[0x2f] = state->m_smpc_ram[0x0d];
666            state->m_smpc_ram[0x2d] = state->m_smpc_ram[0x0b];
667            state->m_smpc_ram[0x2b] = state->m_smpc_ram[0x09];
668            state->m_smpc_ram[0x29] = state->m_smpc_ram[0x07];
669            state->m_smpc_ram[0x27] = state->m_smpc_ram[0x05];
670            state->m_smpc_ram[0x25] = state->m_smpc_ram[0x03];
671            state->m_smpc_ram[0x23] = state->m_smpc_ram[0x01];
672            state->m_smpc_ram[0x5f]=0x16;
693673         break;
694674         /* SMPC memory setting*/
695675         case 0x17:
696676            if(LOG_SMPC) logerror ("SMPC: memory setting\n");
697            smpc_ram[0x5f]=0x17;
677            state->m_smpc_ram[0x5f]=0x17;
698678         break;
699679         case 0x18:
700680            if(LOG_SMPC) logerror ("SMPC: NMI request\n");
701            smpc_ram[0x5f]=0x18;
681            state->m_smpc_ram[0x5f]=0x18;
702682            /*NMI is unconditionally requested?*/
703683            cputag_set_input_line(space->machine(), "maincpu", INPUT_LINE_NMI, PULSE_LINE);
704684            break;
705685         case 0x19:
706686            if(LOG_SMPC) logerror ("SMPC: NMI Enable\n");
707            smpc_ram[0x5f]=0x19;
708            NMI_reset = 0;
709            smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
687            state->m_smpc_ram[0x5f]=0x19;
688            state->m_NMI_reset = 0;
689            state->m_smpc_ram[0x21] = (0x80) | ((state->m_NMI_reset & 1) << 6);
710690            break;
711691         case 0x1a:
712692            if(LOG_SMPC) logerror ("SMPC: NMI Disable\n");
713            smpc_ram[0x5f]=0x1a;
714            NMI_reset = 1;
715            smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
693            state->m_smpc_ram[0x5f]=0x1a;
694            state->m_NMI_reset = 1;
695            state->m_smpc_ram[0x21] = (0x80) | ((state->m_NMI_reset & 1) << 6);
716696            break;
717697         default:
718698            if(LOG_SMPC) logerror ("cpu '%s' (PC=%08X) SMPC: undocumented Command %02x\n", space->device().tag(), cpu_get_pc(&space->device()), data);
719699      }
720700
721701      // we've processed the command, clear status flag
722      smpc_ram[0x63] = 0x00;
702      state->m_smpc_ram[0x63] = 0x00;
723703      /*TODO:emulate the timing of each command...*/
724704   }
725705}
r11594r11595
727707
728708static void smpc_intbackhelper(running_machine &machine)
729709{
710   saturn_state *state = machine.driver_data<saturn_state>();
730711   int pad;
731712   static const char *const padnames[] = { "JOY1", "JOY2" };
732713
r11594r11595
739720   pad = input_port_read(machine, padnames[intback_stage-2]);
740721
741722//  if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2);
742   smpc_ram[33] = 0xf1;   // no tap, direct connect
743   smpc_ram[35] = 0x02;   // saturn pad
744   smpc_ram[37] = pad>>8;
745   smpc_ram[39] = pad & 0xff;
723   state->m_smpc_ram[33] = 0xf1;   // no tap, direct connect
724   state->m_smpc_ram[35] = 0x02;   // saturn pad
725   state->m_smpc_ram[37] = pad>>8;
726   state->m_smpc_ram[39] = pad & 0xff;
746727
747728   if (intback_stage == 3)
748729   {
r11594r11595
756737   intback_stage++;
757738}
758739
759static UINT8 saturn_SMPC_r8(address_space *space, int offset)
740static READ8_HANDLER( saturn_SMPC_r8 )
760741{
742   saturn_state *state = space->machine().driver_data<saturn_state>();
761743   int return_data;
762744
763   return_data = smpc_ram[offset];
745   return_data = state->m_smpc_ram[offset];
764746
765747   if ((offset == 0x61))
766748      return_data = smpcSR;
r11594r11595
813795   return return_data;
814796}
815797
816static void saturn_SMPC_w8(address_space *space, int offset, UINT8 data)
798static WRITE8_HANDLER( saturn_SMPC_w8 )
817799{
800   saturn_state *state = space->machine().driver_data<saturn_state>();
818801   system_time systime;
819802   UINT8 last;
820803   running_machine &machine = space->machine();
r11594r11595
822805   /* get the current date/time from the core */
823806   machine.current_datetime(systime);
824807
825  if (LOG_SMPC) logerror ("8-bit SMPC Write to Offset %02x (reg %d) with Data %02x (prev %02x)\n", offset, offset>>1, data, smpc_ram[offset]);
808  if (LOG_SMPC) logerror ("8-bit SMPC Write to Offset %02x (reg %d) with Data %02x (prev %02x)\n", offset, offset>>1, data, state->m_smpc_ram[offset]);
826809
827810//  if (offset == 0x7d) printf("IOSEL2 %d IOSEL1 %d\n", (data>>1)&1, data&1);
828811
829   last = smpc_ram[offset];
812   last = state->m_smpc_ram[offset];
830813
831814   if ((intback_stage > 0) && (offset == 1) && (((data ^ 0x80)&0x80) == (last&0x80)))
832815   {
r11594r11595
845828      intback_stage = 0;
846829   }
847830
848   smpc_ram[offset] = data;
831   state->m_smpc_ram[offset] = data;
849832
850833   if (offset == 0x75)   // PDR1
851834   {
852      PDR1 = (data & smpc_ram[0x79]);
835      PDR1 = (data & state->m_smpc_ram[0x79]);
853836   }
854837
855838   if (offset == 0x77)   // PDR2
856839   {
857      PDR2 = (data & smpc_ram[0x7b]);
840      PDR2 = (data & state->m_smpc_ram[0x7b]);
858841   }
859842
860843   if(offset == 0x7d)
861844   {
862      if(smpc_ram[0x7d] & 1)
845      if(state->m_smpc_ram[0x7d] & 1)
863846         SH2_DIRECT_MODE_PORT_1;
864847      else
865848         SMPC_CONTROL_MODE_PORT_1;
866849
867      if(smpc_ram[0x7d] & 2)
850      if(state->m_smpc_ram[0x7d] & 2)
868851         SH2_DIRECT_MODE_PORT_2;
869852      else
870853         SMPC_CONTROL_MODE_PORT_2;
r11594r11595
873856   if(offset == 0x7f)
874857   {
875858      //enable PAD irq & VDP2 external latch for port 1/2
876      EXLE1 = smpc_ram[0x7f] & 1 ? 1 : 0;
877      EXLE2 = smpc_ram[0x7f] & 2 ? 1 : 0;
859      EXLE1 = state->m_smpc_ram[0x7f] & 1 ? 1 : 0;
860      EXLE2 = state->m_smpc_ram[0x7f] & 2 ? 1 : 0;
878861      if(EXLE1 || EXLE2)
879         if(!(stv_scu[40] & 0x0100)) /*Pad irq*/
862         if(!(state->m_scu_regs[40] & 0x0100)) /*Pad irq*/
880863         {
881864            if(LOG_SMPC) logerror ("Interrupt: PAD irq, Vector 0x48 Level 0x08\n");
882865            cputag_set_input_line_and_vector(machine, "maincpu", 8, HOLD_LINE , 0x48);
r11594r11595
889872      {
890873         case 0x00:
891874            if(LOG_SMPC) logerror ("SMPC: Master ON\n");
892            smpc_ram[0x5f]=0x00;
875            state->m_smpc_ram[0x5f]=0x00;
893876            break;
894877         //in theory 0x01 is for Master OFF,but obviously is not used.
895878         case 0x02:
896879            if(LOG_SMPC) logerror ("SMPC: Slave ON\n");
897            smpc_ram[0x5f]=0x02;
898            stv_enable_slave_sh2 = 1;
880            state->m_smpc_ram[0x5f]=0x02;
899881            cputag_set_input_line(machine, "slave", INPUT_LINE_RESET, CLEAR_LINE);
900882            break;
901883         case 0x03:
902884            if(LOG_SMPC) logerror ("SMPC: Slave OFF\n");
903            smpc_ram[0x5f]=0x03;
904            stv_enable_slave_sh2 = 0;
885            state->m_smpc_ram[0x5f]=0x03;
905886            machine.scheduler().trigger(1000);
906887            cputag_set_input_line(machine, "slave", INPUT_LINE_RESET, ASSERT_LINE);
907888            break;
908889         case 0x06:
909890            if(LOG_SMPC) logerror ("SMPC: Sound ON\n");
910891            /* wrong? */
911            smpc_ram[0x5f]=0x06;
892            state->m_smpc_ram[0x5f]=0x06;
912893            cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, CLEAR_LINE);
913            en_68k = 1;
894            state->m_en_68k = 1;
914895            break;
915896         case 0x07:
916897            if(LOG_SMPC) logerror ("SMPC: Sound OFF\n");
917898            cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
918            en_68k = 0;
919            smpc_ram[0x5f]=0x07;
899            state->m_en_68k = 0;
900            state->m_smpc_ram[0x5f]=0x07;
920901            break;
921902         /*CD (SH-1) ON/OFF,guess that this is needed for Sports Fishing games...*/
922903         //case 0x08:
923904         //case 0x09:
924905         case 0x0d:
925906            if(LOG_SMPC) logerror ("SMPC: System Reset\n");
926            smpc_ram[0x5f]=0x0d;
907            state->m_smpc_ram[0x5f]=0x0d;
927908            cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE);
928            system_reset();
909            system_reset(space);
929910            break;
930911         case 0x0e:
931912            if(LOG_SMPC) logerror ("SMPC: Change Clock to 352\n");
932            smpc_ram[0x5f]=0x0e;
913            state->m_smpc_ram[0x5f]=0x0e;
933914            machine.device("maincpu")->set_unscaled_clock(MASTER_CLOCK_352/2);
934915            machine.device("slave")->set_unscaled_clock(MASTER_CLOCK_352/2);
935916            machine.device("audiocpu")->set_unscaled_clock(MASTER_CLOCK_352/5);
r11594r11595
937918            break;
938919         case 0x0f:
939920            if(LOG_SMPC) logerror ("SMPC: Change Clock to 320\n");
940            smpc_ram[0x5f]=0x0f;
921            state->m_smpc_ram[0x5f]=0x0f;
941922            machine.device("maincpu")->set_unscaled_clock(MASTER_CLOCK_320/2);
942923            machine.device("slave")->set_unscaled_clock(MASTER_CLOCK_320/2);
943924            machine.device("audiocpu")->set_unscaled_clock(MASTER_CLOCK_320/5);
r11594r11595
946927         /*"Interrupt Back"*/
947928         case 0x10:
948929                      if(LOG_SMPC) logerror ("SMPC: Status Acquire (IntBack)\n");
949            smpc_ram[0x5f]=0x10;
950            smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
951            smpc_ram[0x23] = dec_2_bcd(systime.local_time.year / 100);
952                smpc_ram[0x25] = dec_2_bcd(systime.local_time.year % 100);
953                smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month + 1);
954                smpc_ram[0x29] = dec_2_bcd(systime.local_time.mday);
955                smpc_ram[0x2b] = dec_2_bcd(systime.local_time.hour);
956                smpc_ram[0x2d] = dec_2_bcd(systime.local_time.minute);
957                smpc_ram[0x2f] = dec_2_bcd(systime.local_time.second);
930            state->m_smpc_ram[0x5f]=0x10;
931            state->m_smpc_ram[0x21] = (0x80) | ((state->m_NMI_reset & 1) << 6);
932            state->m_smpc_ram[0x23] = dec_2_bcd(systime.local_time.year / 100);
933             state->m_smpc_ram[0x25] = dec_2_bcd(systime.local_time.year % 100);
934             state->m_smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month + 1);
935             state->m_smpc_ram[0x29] = dec_2_bcd(systime.local_time.mday);
936             state->m_smpc_ram[0x2b] = dec_2_bcd(systime.local_time.hour);
937             state->m_smpc_ram[0x2d] = dec_2_bcd(systime.local_time.minute);
938             state->m_smpc_ram[0x2f] = dec_2_bcd(systime.local_time.second);
958939
959            smpc_ram[0x31]=0x00;  //?
940            state->m_smpc_ram[0x31]=0x00;  //?
960941
961942
962            smpc_ram[0x35]=0x00;
963            smpc_ram[0x37]=0x00;
943            state->m_smpc_ram[0x35]=0x00;
944            state->m_smpc_ram[0x37]=0x00;
964945
965            smpc_ram[0x39] = SMEM[0];
966            smpc_ram[0x3b] = SMEM[1];
967            smpc_ram[0x3d] = SMEM[2];
968            smpc_ram[0x3f] = SMEM[3];
946            state->m_smpc_ram[0x39] = SMEM[0];
947            state->m_smpc_ram[0x3b] = SMEM[1];
948            state->m_smpc_ram[0x3d] = SMEM[2];
949            state->m_smpc_ram[0x3f] = SMEM[3];
969950
970            smpc_ram[0x41]=0xff;
971            smpc_ram[0x43]=0xff;
972            smpc_ram[0x45]=0xff;
973            smpc_ram[0x47]=0xff;
974            smpc_ram[0x49]=0xff;
975            smpc_ram[0x4b]=0xff;
976            smpc_ram[0x4d]=0xff;
977            smpc_ram[0x4f]=0xff;
978            smpc_ram[0x51]=0xff;
979            smpc_ram[0x53]=0xff;
980            smpc_ram[0x55]=0xff;
981            smpc_ram[0x57]=0xff;
982            smpc_ram[0x59]=0xff;
983            smpc_ram[0x5b]=0xff;
984            smpc_ram[0x5d]=0xff;
951            state->m_smpc_ram[0x41]=0xff;
952            state->m_smpc_ram[0x43]=0xff;
953            state->m_smpc_ram[0x45]=0xff;
954            state->m_smpc_ram[0x47]=0xff;
955            state->m_smpc_ram[0x49]=0xff;
956            state->m_smpc_ram[0x4b]=0xff;
957            state->m_smpc_ram[0x4d]=0xff;
958            state->m_smpc_ram[0x4f]=0xff;
959            state->m_smpc_ram[0x51]=0xff;
960            state->m_smpc_ram[0x53]=0xff;
961            state->m_smpc_ram[0x55]=0xff;
962            state->m_smpc_ram[0x57]=0xff;
963            state->m_smpc_ram[0x59]=0xff;
964            state->m_smpc_ram[0x5b]=0xff;
965            state->m_smpc_ram[0x5d]=0xff;
985966
986967            smpcSR = 0x60;      // peripheral data ready, no reset, etc.
987            pmode = smpc_ram[1]>>4;
968            pmode = state->m_smpc_ram[1]>>4;
988969
989970            intback_stage = 1;
990971
991972         //  /*This is for RTC,cartridge code and similar stuff...*/
992         //  if(!(stv_scu[40] & 0x0080)) /*System Manager(SMPC) irq*/ /* we can't check this .. breaks controls .. probably issues elsewhere? */
973         //  if(!(state->m_scu_regs[40] & 0x0080)) /*System Manager(SMPC) irq*/ /* we can't check this .. breaks controls .. probably issues elsewhere? */
993974            {
994975//                  if(LOG_SMPC) logerror ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline);
995976               smpc_intbackhelper(machine);
r11594r11595
999980         /* RTC write*/
1000981         case 0x16:
1001982            if(LOG_SMPC) logerror("SMPC: RTC write\n");
1002            smpc_ram[0x2f] = smpc_ram[0x0d];
1003            smpc_ram[0x2d] = smpc_ram[0x0b];
1004            smpc_ram[0x2b] = smpc_ram[0x09];
1005            smpc_ram[0x29] = smpc_ram[0x07];
1006            smpc_ram[0x27] = smpc_ram[0x05];
1007            smpc_ram[0x25] = smpc_ram[0x03];
1008            smpc_ram[0x23] = smpc_ram[0x01];
1009            smpc_ram[0x5f]=0x16;
983            state->m_smpc_ram[0x2f] = state->m_smpc_ram[0x0d];
984            state->m_smpc_ram[0x2d] = state->m_smpc_ram[0x0b];
985            state->m_smpc_ram[0x2b] = state->m_smpc_ram[0x09];
986            state->m_smpc_ram[0x29] = state->m_smpc_ram[0x07];
987            state->m_smpc_ram[0x27] = state->m_smpc_ram[0x05];
988            state->m_smpc_ram[0x25] = state->m_smpc_ram[0x03];
989            state->m_smpc_ram[0x23] = state->m_smpc_ram[0x01];
990            state->m_smpc_ram[0x5f]=0x16;
1010991         break;
1011992         /* SMPC memory setting*/
1012993         case 0x17:
1013994            if(LOG_SMPC) logerror ("SMPC: memory setting\n");
1014                SMEM[0] = smpc_ram[1];
1015                SMEM[1] = smpc_ram[3];
1016                SMEM[2] = smpc_ram[5];
1017                SMEM[3] = smpc_ram[7];
995                SMEM[0] = state->m_smpc_ram[1];
996                SMEM[1] = state->m_smpc_ram[3];
997                SMEM[2] = state->m_smpc_ram[5];
998                SMEM[3] = state->m_smpc_ram[7];
1018999
1019            smpc_ram[0x5f]=0x17;
1000            state->m_smpc_ram[0x5f]=0x17;
10201001         break;
10211002         case 0x18:
10221003            if(LOG_SMPC) logerror ("SMPC: NMI request\n");
1023            smpc_ram[0x5f]=0x18;
1004            state->m_smpc_ram[0x5f]=0x18;
10241005            /*NMI is unconditionally requested?*/
10251006            cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
10261007            break;
10271008         case 0x19:
10281009            if(LOG_SMPC) logerror ("SMPC: NMI Enable\n");
1029            smpc_ram[0x5f]=0x19;
1030            NMI_reset = 0;
1031            smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
1010            state->m_smpc_ram[0x5f]=0x19;
1011            state->m_NMI_reset = 0;
1012            state->m_smpc_ram[0x21] = (0x80) | ((state->m_NMI_reset & 1) << 6);
10321013            break;
10331014         case 0x1a:
10341015            if(LOG_SMPC) logerror ("SMPC: NMI Disable\n");
1035            smpc_ram[0x5f]=0x1a;
1036            NMI_reset = 1;
1037            smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
1016            state->m_smpc_ram[0x5f]=0x1a;
1017            state->m_NMI_reset = 1;
1018            state->m_smpc_ram[0x21] = (0x80) | ((state->m_NMI_reset & 1) << 6);
10381019
10391020            break;
10401021         default:
r11594r11595
10421023      }
10431024
10441025      // we've processed the command, clear status flag
1045      smpc_ram[0x63] = 0x00;
1026      state->m_smpc_ram[0x63] = 0x00;
10461027      /*TODO:emulate the timing of each command...*/
10471028   }
10481029}
10491030
1050
1051
1052static READ32_HANDLER ( stv_SMPC_r32 )
1053{
1054   int byte = 0;
1055   int readdata = 0;
1056   /* registers are all byte accesses, convert here */
1057   offset = offset << 2; // multiply offset by 4
1058
1059   if (ACCESSING_BITS_24_31)   { byte = 0; readdata = stv_SMPC_r8(space, offset+byte) << 24; }
1060   if (ACCESSING_BITS_16_23)   { byte = 1; readdata = stv_SMPC_r8(space, offset+byte) << 16; }
1061   if (ACCESSING_BITS_8_15)   { byte = 2; readdata = stv_SMPC_r8(space, offset+byte) << 8;  }
1062   if (ACCESSING_BITS_0_7)      { byte = 3; readdata = stv_SMPC_r8(space, offset+byte) << 0;  }
1063
1064   return readdata;
1065}
1066
1067
1068static WRITE32_HANDLER ( stv_SMPC_w32 )
1069{
1070   int byte = 0;
1071   int writedata = 0;
1072   /* registers are all byte accesses, convert here so we can use the data more easily later */
1073   offset = offset << 2; // multiply offset by 4
1074
1075   if (ACCESSING_BITS_24_31)   { byte = 0; writedata = data >> 24; }
1076   if (ACCESSING_BITS_16_23)   { byte = 1; writedata = data >> 16; }
1077   if (ACCESSING_BITS_8_15)   { byte = 2; writedata = data >> 8;  }
1078   if (ACCESSING_BITS_0_7)      { byte = 3; writedata = data >> 0;  }
1079
1080   writedata &= 0xff;
1081
1082   offset += byte;
1083
1084   stv_SMPC_w8(space, offset,writedata);
1085}
1086
1087
1088static READ32_HANDLER ( saturn_SMPC_r32 )
1089{
1090   int byte = 0;
1091   int readdata = 0;
1092   /* registers are all byte accesses, convert here */
1093   offset = offset << 2; // multiply offset by 4
1094
1095   if (ACCESSING_BITS_24_31)   { byte = 0; readdata = saturn_SMPC_r8(space, offset+byte) << 24; }
1096   if (ACCESSING_BITS_16_23)   { byte = 1; readdata = saturn_SMPC_r8(space, offset+byte) << 16; }
1097   if (ACCESSING_BITS_8_15)   { byte = 2; readdata = saturn_SMPC_r8(space, offset+byte) << 8;  }
1098   if (ACCESSING_BITS_0_7)      { byte = 3; readdata = saturn_SMPC_r8(space, offset+byte) << 0;  }
1099
1100   return readdata;
1101}
1102
1103
1104static WRITE32_HANDLER ( saturn_SMPC_w32 )
1105{
1106   int byte = 0;
1107   int writedata = 0;
1108   /* registers are all byte accesses, convert here so we can use the data more easily later */
1109   offset = offset << 2; // multiply offset by 4
1110
1111   if (ACCESSING_BITS_24_31)   { byte = 0; writedata = data >> 24; }
1112   if (ACCESSING_BITS_16_23)   { byte = 1; writedata = data >> 16; }
1113   if (ACCESSING_BITS_8_15)   { byte = 2; writedata = data >> 8;  }
1114   if (ACCESSING_BITS_0_7)      { byte = 3; writedata = data >> 0;  }
1115
1116   writedata &= 0xff;
1117
1118   offset += byte;
1119
1120   saturn_SMPC_w8(space, offset,writedata);
1121}
1122
11231031/*
11241032I/O overview:
11251033    PORT-A  1st player inputs
r11594r11595
12441152            //popmessage("(PC=%06x) offs 5 %04x %02x",cpu_get_pc(&space->device()),port_sel,((ioga[5] & 0xff0000) >> 16));
12451153            logerror("(PC=%06x) offs 5 %04x %02x\n",cpu_get_pc(&space->device()),port_sel,((ioga[5] & 0xff0000) >> 16));
12461154
1247            //stv_workram_h[0x8e830/4] = ((ioga[5] & 0xff0000) >> 16) ^ 0x3;
1248            //stv_workram_h[0x8e834/4] = ((ioga[5] & 0xff0000) >> 16) ^ 0x3;
1249            return (ioga[5] & 0xff0000) >> 16;//stv_workram_h[0x8e830/4];//sound board data
1155            //stv_m_workram_h[0x8e830/4] = ((ioga[5] & 0xff0000) >> 16) ^ 0x3;
1156            //stv_m_workram_h[0x8e834/4] = ((ioga[5] & 0xff0000) >> 16) ^ 0x3;
1157            return (ioga[5] & 0xff0000) >> 16;//stv_m_workram_h[0x8e830/4];//sound board data
12501158         }
12511159         default: return 0xffffffff;
12521160      }
r11594r11595
14201328-Set boundaries.
14211329*/
14221330
1423#define DIRECT_MODE(_lv_)         (!(stv_scu[5+(_lv_*8)] & 0x01000000))
1424#define INDIRECT_MODE(_lv_)           (stv_scu[5+(_lv_*8)] & 0x01000000)
1425#define DRUP(_lv_)                 (stv_scu[5+(_lv_*8)] & 0x00010000)
1426#define DWUP(_lv_)                    (stv_scu[5+(_lv_*8)] & 0x00000100)
1331#define DIRECT_MODE(_lv_)         (!(state->m_scu_regs[5+(_lv_*8)] & 0x01000000))
1332#define INDIRECT_MODE(_lv_)           (state->m_scu_regs[5+(_lv_*8)] & 0x01000000)
1333#define DRUP(_lv_)                 (state->m_scu_regs[5+(_lv_*8)] & 0x00010000)
1334#define DWUP(_lv_)                    (state->m_scu_regs[5+(_lv_*8)] & 0x00000100)
14271335
1428#define DMA_STATUS            (stv_scu[31])
1336#define DMA_STATUS            (state->m_scu_regs[31])
14291337/*These macros sets the various DMA status flags.*/
1430#define D0MV_1   if(!(DMA_STATUS & 0x10))    DMA_STATUS^=0x10
1431#define D1MV_1   if(!(DMA_STATUS & 0x100))   DMA_STATUS^=0x100
1432#define D2MV_1   if(!(DMA_STATUS & 0x1000))  DMA_STATUS^=0x1000
1433#define D0MV_0   if(DMA_STATUS & 0x10)       DMA_STATUS^=0x10
1434#define D1MV_0   if(DMA_STATUS & 0x100)       DMA_STATUS^=0x100
1435#define D2MV_0   if(DMA_STATUS & 0x1000)     DMA_STATUS^=0x1000
1338#define D0MV_1   DMA_STATUS|=0x10
1339#define D1MV_1   DMA_STATUS|=0x100
1340#define D2MV_1   DMA_STATUS|=0x1000
1341#define D0MV_0   DMA_STATUS&=~0x10
1342#define D1MV_0   DMA_STATUS&=~0x100
1343#define D2MV_0   DMA_STATUS&=~0x1000
14361344
1437static UINT32 scu_index_0,scu_index_1,scu_index_2;
1438static UINT8 scsp_to_main_irq;
1439
14401345static UINT32 scu_add_tmp;
14411346
14421347/*For area checking*/
1443#define ABUS(_lv_)       ((scu_##_lv_ & 0x07ffffff) >= 0x02000000) && ((scu_##_lv_ & 0x07ffffff) <= 0x04ffffff)
1348#define ABUS(_lv_)       ((state->m_scu_src[_lv_] & 0x07ffffff) >= 0x02000000) && ((state->m_scu_src[_lv_] & 0x07ffffff) <= 0x04ffffff)
14441349#define BBUS(_lv_)       ((scu_##_lv_ & 0x07ffffff) >= 0x05a00000) && ((scu_##_lv_ & 0x07ffffff) <= 0x05ffffff)
14451350#define VDP1_REGS(_lv_)  ((scu_##_lv_ & 0x07ffffff) >= 0x05d00000) && ((scu_##_lv_ & 0x07ffffff) <= 0x05dfffff)
14461351#define VDP2(_lv_)       ((scu_##_lv_ & 0x07ffffff) >= 0x05e00000) && ((scu_##_lv_ & 0x07ffffff) <= 0x05fdffff)
r11594r11595
14481353#define WORK_RAM_H(_lv_) ((scu_##_lv_ & 0x07ffffff) >= 0x06000000) && ((scu_##_lv_ & 0x07ffffff) <= 0x060fffff)
14491354#define SOUND_RAM(_lv_)  ((scu_##_lv_ & 0x07ffffff) >= 0x05a00000) && ((scu_##_lv_ & 0x07ffffff) <= 0x05afffff)
14501355
1451static READ32_HANDLER( stv_scu_r32 )
1356static READ32_HANDLER( saturn_scu_r )
14521357{
1358   saturn_state *state = space->machine().driver_data<saturn_state>();
1359
14531360   /*TODO: write only registers must return 0...*/
14541361   //popmessage("%02x",DMA_STATUS);
14551362   //if (offset == 23)
r11594r11595
14591366   if (offset == 31)
14601367   {
14611368      if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",cpu_get_pc(&space->device()));
1462      return stv_scu[offset];
1369      return state->m_scu_regs[offset];
14631370   }
14641371   else if ( offset == 35 )
14651372   {
1466        if(LOG_SCU) logerror( "DSP mem read at %08X\n", stv_scu[34]);
1373        if(LOG_SCU) logerror( "DSP mem read at %08X\n", state->m_scu_regs[34]);
14671374        return dsp_ram_addr_r();
14681375    }
14691376    else if( offset == 41) /*IRQ reg status read*/
14701377    {
14711378      if(LOG_SCU) logerror("(PC=%08x) IRQ status reg read %08x\n",cpu_get_pc(&space->device()),mem_mask);
14721379
1473      stv_scu[41] = (stv_irq.vblank_in & 1)<<0;
1474      stv_scu[41]|= (stv_irq.vblank_out & 1)<<1;
1475      stv_scu[41]|= (stv_irq.hblank_in & 1)<<2;
1476      stv_scu[41]|= (stv_irq.timer_0 & 1)<<3;
1477      stv_scu[41]|= (stv_irq.timer_1 & 1)<<4;
1478      stv_scu[41]|= (stv_irq.dsp_end & 1)<<5;
1479      stv_scu[41]|= (stv_irq.sound_req & 1)<<6;
1480      stv_scu[41]|= (stv_irq.smpc & 1)<<7;
1481      stv_scu[41]|= (stv_irq.pad & 1)<<8;
1482      stv_scu[41]|= (stv_irq.dma_end[0] & 1)<<9;
1483      stv_scu[41]|= (stv_irq.dma_end[1] & 1)<<10;
1484      stv_scu[41]|= (stv_irq.dma_end[2] & 1)<<11;
1485      stv_scu[41]|= (stv_irq.dma_ill & 1)<<12;
1486      stv_scu[41]|= (stv_irq.vdp1_end & 1)<<13;
1487      stv_scu[41]|= (stv_irq.abus & 1)<<15;
1380      state->m_scu_regs[41] = (stv_irq.vblank_in & 1)<<0;
1381      state->m_scu_regs[41]|= (stv_irq.vblank_out & 1)<<1;
1382      state->m_scu_regs[41]|= (stv_irq.hblank_in & 1)<<2;
1383      state->m_scu_regs[41]|= (stv_irq.timer_0 & 1)<<3;
1384      state->m_scu_regs[41]|= (stv_irq.timer_1 & 1)<<4;
1385      state->m_scu_regs[41]|= (stv_irq.dsp_end & 1)<<5;
1386      state->m_scu_regs[41]|= (stv_irq.sound_req & 1)<<6;
1387      state->m_scu_regs[41]|= (stv_irq.smpc & 1)<<7;
1388      state->m_scu_regs[41]|= (stv_irq.pad & 1)<<8;
1389      state->m_scu_regs[41]|= (stv_irq.dma_end[0] & 1)<<9;
1390      state->m_scu_regs[41]|= (stv_irq.dma_end[1] & 1)<<10;
1391      state->m_scu_regs[41]|= (stv_irq.dma_end[2] & 1)<<11;
1392      state->m_scu_regs[41]|= (stv_irq.dma_ill & 1)<<12;
1393      state->m_scu_regs[41]|= (stv_irq.vdp1_end & 1)<<13;
1394      state->m_scu_regs[41]|= (stv_irq.abus & 1)<<15;
14881395
1489      return stv_scu[41] ^ 0xffffffff;
1396      return state->m_scu_regs[41] ^ 0xffffffff;
14901397   }
14911398   else if( offset == 50 )
14921399   {
r11594r11595
14951402   }
14961403    else
14971404    {
1498       if(LOG_SCU) logerror("(PC=%08x) SCU reg read at %d = %08x\n",cpu_get_pc(&space->device()),offset,stv_scu[offset]);
1499       return stv_scu[offset];
1405       if(LOG_SCU) logerror("(PC=%08x) SCU reg read at %d = %08x\n",cpu_get_pc(&space->device()),offset,state->m_scu_regs[offset]);
1406       return state->m_scu_regs[offset];
15001407   }
15011408}
15021409
1503static WRITE32_HANDLER( stv_scu_w32 )
1410#define DMA_CH ((offset & 0x18) / 8)
1411
1412static WRITE32_HANDLER( saturn_scu_w )
15041413{
1505   COMBINE_DATA(&stv_scu[offset]);
1414   saturn_state *state = space->machine().driver_data<saturn_state>();
15061415
1416   COMBINE_DATA(&state->m_scu_regs[offset]);
1417
15071418   switch(offset)
15081419   {
15091420      /*LV 0 DMA*/
1510      case 0:   scu_src_0  = ((stv_scu[0] & 0x07ffffff) >> 0); break;
1511      case 1:   scu_dst_0  = ((stv_scu[1] & 0x07ffffff) >> 0); break;
1512      case 2: scu_size_0 = ((stv_scu[2] & 0x000fffff) >> 0); break;
1513      case 3:
1421      case 0:   case 8: case 16:  state->m_scu_src[DMA_CH]  = ((state->m_scu_regs[offset] & 0x07ffffff) >> 0); break;
1422      case 1:   case 9: case 17:  state->m_scu_dst[DMA_CH]  = ((state->m_scu_regs[offset] & 0x07ffffff) >> 0); break;
1423      case 2: case 10: case 18: state->m_scu_size[DMA_CH] = ((state->m_scu_regs[offset] & ((offset == 2) ? 0x000fffff : 0x1fff)) >> 0); break;
1424      case 3: case 11: case 19:
15141425         /*Read address add value for DMA lv 0*/
1515         if(stv_scu[3] & 0x100)
1516            scu_src_add_0 = 4;
1517         else
1518            scu_src_add_0 = 1;
1426         state->m_scu_src_add[DMA_CH] = (state->m_scu_regs[offset] & 0x100) ? 4 : 1;
15191427
15201428         /*Write address add value for DMA lv 0*/
1521         switch(stv_scu[3] & 7)
1522         {
1523            case 0: scu_dst_add_0 = 2;   break;
1524            case 1: scu_dst_add_0 = 4;   break;
1525            case 2: scu_dst_add_0 = 8;   break;
1526            case 3: scu_dst_add_0 = 16;  break;
1527            case 4: scu_dst_add_0 = 32;  break;
1528            case 5: scu_dst_add_0 = 64;  break;
1529            case 6: scu_dst_add_0 = 128; break;
1530            case 7: scu_dst_add_0 = 256; break;
1531         }
1429         state->m_scu_dst_add[DMA_CH] = 2 << (state->m_scu_regs[offset] & 7);
15321430         break;
1533      case 4:
1431      case 4: case 12: case 20:
15341432/*
1535-stv_scu[4] bit 0 is DMA starting bit.
1433-state->m_scu_regs[4] bit 0 is DMA starting bit.
15361434    Used when the start factor is 7.Toggle after execution.
1537-stv_scu[4] bit 8 is DMA Enable bit.
1435-state->m_scu_regs[4] bit 8 is DMA Enable bit.
15381436    This is an execution mask flag.
1539-stv_scu[5] bit 0,bit 1 and bit 2 is DMA starting factor.
1437-state->m_scu_regs[5] bit 0,bit 1 and bit 2 is DMA starting factor.
15401438    It must be 7 for this specific condition.
1541-stv_scu[5] bit 24 is Indirect Mode/Direct Mode (0/1).
1439-state->m_scu_regs[5] bit 24 is Indirect Mode/Direct Mode (0/1).
15421440*/
1543      if(stv_scu[4] & 1 && ((stv_scu[5] & 7) == 7) && stv_scu[4] & 0x100)
1441      if(state->m_scu_regs[offset] & 1 && ((state->m_scu_regs[offset+1] & 7) == 7) && state->m_scu_regs[offset] & 0x100)
15441442      {
1545         if(DIRECT_MODE(0)) { dma_direct_lv0(space); }
1546         else            { dma_indirect_lv0(space); }
1443         if(DIRECT_MODE(DMA_CH)) { scu_dma_direct(space,DMA_CH);   }
1444         else                  { scu_dma_indirect(space,DMA_CH); }
15471445
1548         stv_scu[4]^=1;//disable starting bit.
1549
1550         /*Sound IRQ*/
1551         if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1)
1552         {
1553            //cputag_set_input_line_and_vector(space->machine(), "maincpu", 9, HOLD_LINE , 0x46);
1554            logerror("SCSP: Main CPU interrupt\n");
1555            #if 0
1556            if((scu_dst_0 & 0x7ffffff) != 0x05a00000)
1557            {
1558               if(!(stv_scu[40] & 0x1000))
1559               {
1560                  cputag_set_input_line_and_vector(space->machine(), "maincpu", 3, HOLD_LINE, 0x4c);
1561                  logerror("SCU: Illegal DMA interrupt\n");
1562               }
1563            }
1564            #endif
1565         }
1446         state->m_scu_regs[offset]&=~1;//disable starting bit.
15661447      }
15671448      break;
1568      case 5:
1569      if(INDIRECT_MODE(0))
1449      case 5: case 13: case 21:
1450      if(INDIRECT_MODE(DMA_CH))
15701451      {
1571         if(LOG_SCU) logerror("Indirect Mode DMA lv 0 set\n");
1572         if(!DWUP(0)) scu_index_0 = scu_dst_0;
1452         if(LOG_SCU) logerror("Indirect Mode DMA lv %d set\n",DMA_CH);
1453         if(!DWUP(DMA_CH)) state->m_scu_index[DMA_CH] = state->m_scu_dst[DMA_CH];
15731454      }
15741455
15751456      /*Start factor enable bits,bit 2,bit 1 and bit 0*/
1576      if((stv_scu[5] & 7) != 7)
1577         if(LOG_SCU) logerror("Start factor chosen for lv 0 = %d\n",stv_scu[5] & 7);
1457      if((state->m_scu_regs[offset] & 7) != 7)
1458         if(LOG_SCU) logerror("Start factor chosen for lv %d = %d\n",state->m_scu_regs[offset+1] & 7,DMA_CH);
15781459      break;
1579      /*LV 1 DMA*/
1580      case 8:    scu_src_1  = ((stv_scu[8] &  0x07ffffff) >> 0);  break;
1581      case 9:    scu_dst_1  = ((stv_scu[9] &  0x07ffffff) >> 0);  break;
1582      case 10: scu_size_1 = ((stv_scu[10] & 0x00001fff) >> 0);  break;
1583      case 11:
1584      /*Read address add value for DMA lv 1*/
1585      if(stv_scu[11] & 0x100)
1586         scu_src_add_1 = 4;
1587      else
1588         scu_src_add_1 = 1;
15891460
1590      /*Write address add value for DMA lv 1*/
1591      switch(stv_scu[11] & 7)
1592      {
1593         case 0: scu_dst_add_1 = 2;   break;
1594         case 1: scu_dst_add_1 = 4;   break;
1595         case 2: scu_dst_add_1 = 8;   break;
1596         case 3: scu_dst_add_1 = 16;  break;
1597         case 4: scu_dst_add_1 = 32;  break;
1598         case 5: scu_dst_add_1 = 64;  break;
1599         case 6: scu_dst_add_1 = 128; break;
1600         case 7: scu_dst_add_1 = 256; break;
1601      }
1602      break;
1603      case 12:
1604      if(stv_scu[12] & 1 && ((stv_scu[13] & 7) == 7) && stv_scu[12] & 0x100)
1605      {
1606         if(DIRECT_MODE(1)) { dma_direct_lv1(space); }
1607         else            { dma_indirect_lv1(space); }
1608
1609         stv_scu[12]^=1;
1610
1611         /*Sound IRQ*/
1612         if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1)
1613         {
1614            //cputag_set_input_line_and_vector(space->machine(), "maincpu", 9, HOLD_LINE , 0x46);
1615            logerror("SCSP: Main CPU interrupt\n");
1616         }
1617      }
1618      break;
1619      case 13:
1620      if(INDIRECT_MODE(1))
1621      {
1622         if(LOG_SCU) logerror("Indirect Mode DMA lv 1 set\n");
1623         if(!DWUP(1)) scu_index_1 = scu_dst_1;
1624      }
1625
1626      if((stv_scu[13] & 7) != 7)
1627         if(LOG_SCU) logerror("Start factor chosen for lv 1 = %d\n",stv_scu[13] & 7);
1628      break;
1629      /*LV 2 DMA*/
1630      case 16: scu_src_2  = ((stv_scu[16] & 0x07ffffff) >> 0);  break;
1631      case 17: scu_dst_2  = ((stv_scu[17] & 0x07ffffff) >> 0);  break;
1632      case 18: scu_size_2 = ((stv_scu[18] & 0x00001fff) >> 0);  break;
1633      case 19:
1634      /*Read address add value for DMA lv 2*/
1635      if(stv_scu[19] & 0x100)
1636         scu_src_add_2 = 4;
1637      else
1638         scu_src_add_2 = 1;
1639
1640      /*Write address add value for DMA lv 2*/
1641      switch(stv_scu[19] & 7)
1642      {
1643         case 0: scu_dst_add_2 = 2;   break;
1644         case 1: scu_dst_add_2 = 4;   break;
1645         case 2: scu_dst_add_2 = 8;   break;
1646         case 3: scu_dst_add_2 = 16;  break;
1647         case 4: scu_dst_add_2 = 32;  break;
1648         case 5: scu_dst_add_2 = 64;  break;
1649         case 6: scu_dst_add_2 = 128; break;
1650         case 7: scu_dst_add_2 = 256; break;
1651      }
1652      break;
1653      case 20:
1654      if(stv_scu[20] & 1 && ((stv_scu[21] & 7) == 7) && stv_scu[20] & 0x100)
1655      {
1656         if(DIRECT_MODE(2)) { dma_direct_lv2(space); }
1657         else            { dma_indirect_lv2(space); }
1658
1659         stv_scu[20]^=1;
1660
1661         /*Sound IRQ*/
1662         if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1)
1663         {
1664            //cputag_set_input_line_and_vector(space->machine(), "maincpu", 9, HOLD_LINE , 0x46);
1665            logerror("SCSP: Main CPU interrupt\n");
1666         }
1667      }
1668      break;
1669      case 21:
1670      if(INDIRECT_MODE(2))
1671      {
1672         if(LOG_SCU) logerror("Indirect Mode DMA lv 2 set\n");
1673         if(!DWUP(2)) scu_index_2 = scu_dst_2;
1674      }
1675
1676      if((stv_scu[21] & 7) != 7)
1677         if(LOG_SCU) logerror("Start factor chosen for lv 2 = %d\n",stv_scu[21] & 7);
1678      break;
16791461      case 24:
1680      if(LOG_SCU) logerror("DMA Forced Stop Register set = %02x\n",stv_scu[24]);
1462      if(LOG_SCU) logerror("DMA Forced Stop Register set = %02x\n",state->m_scu_regs[24]);
16811463      break;
16821464      case 31: if(LOG_SCU) logerror("Warning: DMA status WRITE! Offset %02x(%d)\n",offset*4,offset); break;
16831465      /*DSP section*/
r11594r11595
16981480      dsp_ram_addr_w(data);
16991481      if(LOG_SCU) logerror("SCU DSP: Data RAM Data Port Access %08x\n",data);
17001482      break;
1701      case 36: if(LOG_SCU) logerror("timer 0 compare data = %03x\n",stv_scu[36]);break;
1702      case 37: if(LOG_SCU) logerror("timer 1 set data = %08x\n",stv_scu[37]); break;
1703      case 38: if(LOG_SCU) logerror("timer 1 mode data = %08x\n",stv_scu[38]); break;
1483      case 36: if(LOG_SCU) logerror("timer 0 compare data = %03x\n",state->m_scu_regs[36]);break;
1484      case 37: if(LOG_SCU) logerror("timer 1 set data = %08x\n",state->m_scu_regs[37]); break;
1485      case 38: if(LOG_SCU) logerror("timer 1 mode data = %08x\n",state->m_scu_regs[38]); break;
17041486      case 40:
17051487      /*An interrupt is masked when his specific bit is 1.*/
17061488      /*Are bit 16-bit 31 for External A-Bus irq mask like the status register?*/
17071489
1708      stv_irq.vblank_in =  (((stv_scu[40] & 0x0001)>>0) ^ 1);
1709      stv_irq.vblank_out = (((stv_scu[40] & 0x0002)>>1) ^ 1);
1710      stv_irq.hblank_in =  (((stv_scu[40] & 0x0004)>>2) ^ 1);
1711      stv_irq.timer_0 =    (((stv_scu[40] & 0x0008)>>3) ^ 1);
1712      stv_irq.timer_1 =    (((stv_scu[40] & 0x0010)>>4) ^ 1);
1713      stv_irq.dsp_end =    (((stv_scu[40] & 0x0020)>>5) ^ 1);
1714      stv_irq.sound_req =  (((stv_scu[40] & 0x0040)>>6) ^ 1);
1715      stv_irq.smpc =       (((stv_scu[40] & 0x0080)>>7)); //NOTE: SCU bug
1716      stv_irq.pad =        (((stv_scu[40] & 0x0100)>>8) ^ 1);
1717      stv_irq.dma_end[2] = (((stv_scu[40] & 0x0200)>>9) ^ 1);
1718      stv_irq.dma_end[1] = (((stv_scu[40] & 0x0400)>>10) ^ 1);
1719      stv_irq.dma_end[0] = (((stv_scu[40] & 0x0800)>>11) ^ 1);
1720      stv_irq.dma_ill =    (((stv_scu[40] & 0x1000)>>12) ^ 1);
1721      stv_irq.vdp1_end =   (((stv_scu[40] & 0x2000)>>13) ^ 1);
1722      stv_irq.abus =       (((stv_scu[40] & 0x8000)>>15) ^ 1);
1490      stv_irq.vblank_in =  (((state->m_scu_regs[40] & 0x0001)>>0) ^ 1);
1491      stv_irq.vblank_out = (((state->m_scu_regs[40] & 0x0002)>>1) ^ 1);
1492      stv_irq.hblank_in =  (((state->m_scu_regs[40] & 0x0004)>>2) ^ 1);
1493      stv_irq.timer_0 =    (((state->m_scu_regs[40] & 0x0008)>>3) ^ 1);
1494      stv_irq.timer_1 =    (((state->m_scu_regs[40] & 0x0010)>>4) ^ 1);
1495      stv_irq.dsp_end =    (((state->m_scu_regs[40] & 0x0020)>>5) ^ 1);
1496      stv_irq.sound_req =  (((state->m_scu_regs[40] & 0x0040)>>6) ^ 1);
1497      stv_irq.smpc =       (((state->m_scu_regs[40] & 0x0080)>>7)); //NOTE: SCU bug
1498      stv_irq.pad =        (((state->m_scu_regs[40] & 0x0100)>>8) ^ 1);
1499      stv_irq.dma_end[2] = (((state->m_scu_regs[40] & 0x0200)>>9) ^ 1);
1500      stv_irq.dma_end[1] = (((state->m_scu_regs[40] & 0x0400)>>10) ^ 1);
1501      stv_irq.dma_end[0] = (((state->m_scu_regs[40] & 0x0800)>>11) ^ 1);
1502      stv_irq.dma_ill =    (((state->m_scu_regs[40] & 0x1000)>>12) ^ 1);
1503      stv_irq.vdp1_end =   (((state->m_scu_regs[40] & 0x2000)>>13) ^ 1);
1504      stv_irq.abus =       (((state->m_scu_regs[40] & 0x8000)>>15) ^ 1);
17231505
17241506      /*Take out the common settings to keep logging quiet.*/
1725      if(stv_scu[40] != 0xfffffffe &&
1726         stv_scu[40] != 0xfffffffc &&
1727         stv_scu[40] != 0xffffffff)
1507      if(state->m_scu_regs[40] != 0xfffffffe &&
1508         state->m_scu_regs[40] != 0xfffffffc &&
1509         state->m_scu_regs[40] != 0xffffffff)
17281510      {
17291511         if(LOG_SCU) logerror("cpu %s (PC=%08X) IRQ mask reg set %08x = %d%d%d%d|%d%d%d%d|%d%d%d%d|%d%d%d%d\n",
17301512         space->device().tag(), cpu_get_pc(&space->device()),
1731         stv_scu[offset],
1732         stv_scu[offset] & 0x8000 ? 1 : 0, /*A-Bus irq*/
1733         stv_scu[offset] & 0x4000 ? 1 : 0, /*<reserved>*/
1734         stv_scu[offset] & 0x2000 ? 1 : 0, /*Sprite draw end irq(VDP1)*/
1735         stv_scu[offset] & 0x1000 ? 1 : 0, /*Illegal DMA irq*/
1736         stv_scu[offset] & 0x0800 ? 1 : 0, /*Lv 0 DMA end irq*/
1737         stv_scu[offset] & 0x0400 ? 1 : 0, /*Lv 1 DMA end irq*/
1738         stv_scu[offset] & 0x0200 ? 1 : 0, /*Lv 2 DMA end irq*/
1739         stv_scu[offset] & 0x0100 ? 1 : 0, /*PAD irq*/
1740         stv_scu[offset] & 0x0080 ? 1 : 0, /*System Manager(SMPC) irq*/
1741         stv_scu[offset] & 0x0040 ? 1 : 0, /*Snd req*/
1742         stv_scu[offset] & 0x0020 ? 1 : 0, /*DSP irq end*/
1743         stv_scu[offset] & 0x0010 ? 1 : 0, /*Timer 1 irq*/
1744         stv_scu[offset] & 0x0008 ? 1 : 0, /*Timer 0 irq*/
1745         stv_scu[offset] & 0x0004 ? 1 : 0, /*HBlank-IN*/
1746         stv_scu[offset] & 0x0002 ? 1 : 0, /*VBlank-OUT*/
1747         stv_scu[offset] & 0x0001 ? 1 : 0);/*VBlank-IN*/
1513         state->m_scu_regs[offset],
1514         state->m_scu_regs[offset] & 0x8000 ? 1 : 0, /*A-Bus irq*/
1515         state->m_scu_regs[offset] & 0x4000 ? 1 : 0, /*<reserved>*/
1516         state->m_scu_regs[offset] & 0x2000 ? 1 : 0, /*Sprite draw end irq(VDP1)*/
1517         state->m_scu_regs[offset] & 0x1000 ? 1 : 0, /*Illegal DMA irq*/
1518         state->m_scu_regs[offset] & 0x0800 ? 1 : 0, /*Lv 0 DMA end irq*/
1519         state->m_scu_regs[offset] & 0x0400 ? 1 : 0, /*Lv 1 DMA end irq*/
1520         state->m_scu_regs[offset] & 0x0200 ? 1 : 0, /*Lv 2 DMA end irq*/
1521         state->m_scu_regs[offset] & 0x0100 ? 1 : 0, /*PAD irq*/
1522         state->m_scu_regs[offset] & 0x0080 ? 1 : 0, /*System Manager(SMPC) irq*/
1523         state->m_scu_regs[offset] & 0x0040 ? 1 : 0, /*Snd req*/
1524         state->m_scu_regs[offset] & 0x0020 ? 1 : 0, /*DSP irq end*/
1525         state->m_scu_regs[offset] & 0x0010 ? 1 : 0, /*Timer 1 irq*/
1526         state->m_scu_regs[offset] & 0x0008 ? 1 : 0, /*Timer 0 irq*/
1527         state->m_scu_regs[offset] & 0x0004 ? 1 : 0, /*HBlank-IN*/
1528         state->m_scu_regs[offset] & 0x0002 ? 1 : 0, /*VBlank-OUT*/
1529         state->m_scu_regs[offset] & 0x0001 ? 1 : 0);/*VBlank-IN*/
17481530      }
17491531      break;
17501532      /*Interrupt Control reg Set*/
17511533      case 41:
17521534      /*This is r/w by introdon...*/
1753      if(LOG_SCU) logerror("IRQ status reg set:%08x %08x\n",stv_scu[41],mem_mask);
1535      if(LOG_SCU) logerror("IRQ status reg set:%08x %08x\n",state->m_scu_regs[41],mem_mask);
17541536
1755      stv_irq.vblank_in =  ((stv_scu[41] & 0x0001)>>0);
1756      stv_irq.vblank_out = ((stv_scu[41] & 0x0002)>>1);
1757      stv_irq.hblank_in =  ((stv_scu[41] & 0x0004)>>2);
1758      stv_irq.timer_0 =    ((stv_scu[41] & 0x0008)>>3);
1759      stv_irq.timer_1 =    ((stv_scu[41] & 0x0010)>>4);
1760      stv_irq.dsp_end =    ((stv_scu[41] & 0x0020)>>5);
1761      stv_irq.sound_req =  ((stv_scu[41] & 0x0040)>>6);
1762      stv_irq.smpc =       ((stv_scu[41] & 0x0080)>>7);
1763      stv_irq.pad =        ((stv_scu[41] & 0x0100)>>8);
1764      stv_irq.dma_end[2] = ((stv_scu[41] & 0x0200)>>9);
1765      stv_irq.dma_end[1] = ((stv_scu[41] & 0x0400)>>10);
1766      stv_irq.dma_end[0] = ((stv_scu[41] & 0x0800)>>11);
1767      stv_irq.dma_ill =    ((stv_scu[41] & 0x1000)>>12);
1768      stv_irq.vdp1_end =   ((stv_scu[41] & 0x2000)>>13);
1769      stv_irq.abus =       ((stv_scu[41] & 0x8000)>>15);
1537      stv_irq.vblank_in =  ((state->m_scu_regs[41] & 0x0001)>>0);
1538      stv_irq.vblank_out = ((state->m_scu_regs[41] & 0x0002)>>1);
1539      stv_irq.hblank_in =  ((state->m_scu_regs[41] & 0x0004)>>2);
1540      stv_irq.timer_0 =    ((state->m_scu_regs[41] & 0x0008)>>3);
1541      stv_irq.timer_1 =    ((state->m_scu_regs[41] & 0x0010)>>4);
1542      stv_irq.dsp_end =    ((state->m_scu_regs[41] & 0x0020)>>5);
1543      stv_irq.sound_req =  ((state->m_scu_regs[41] & 0x0040)>>6);
1544      stv_irq.smpc =       ((state->m_scu_regs[41] & 0x0080)>>7);
1545      stv_irq.pad =        ((state->m_scu_regs[41] & 0x0100)>>8);
1546      stv_irq.dma_end[2] = ((state->m_scu_regs[41] & 0x0200)>>9);
1547      stv_irq.dma_end[1] = ((state->m_scu_regs[41] & 0x0400)>>10);
1548      stv_irq.dma_end[0] = ((state->m_scu_regs[41] & 0x0800)>>11);
1549      stv_irq.dma_ill =    ((state->m_scu_regs[41] & 0x1000)>>12);
1550      stv_irq.vdp1_end =   ((state->m_scu_regs[41] & 0x2000)>>13);
1551      stv_irq.abus =       ((state->m_scu_regs[41] & 0x8000)>>15);
17701552
17711553      break;
1772      case 42: if(LOG_SCU) logerror("A-Bus IRQ ACK %08x\n",stv_scu[42]); break;
1773      case 49: if(LOG_SCU) logerror("SCU SDRAM set: %02x\n",stv_scu[49]); break;
1554      case 42: if(LOG_SCU) logerror("A-Bus IRQ ACK %08x\n",state->m_scu_regs[42]); break;
1555      case 49: if(LOG_SCU) logerror("SCU SDRAM set: %02x\n",state->m_scu_regs[49]); break;
17741556      default: if(LOG_SCU) logerror("Warning: unused SCU reg set %d = %08x\n",offset,data);
17751557   }
17761558}
r11594r11595
17781560/*Lv 0 DMA end irq*/
17791561static TIMER_CALLBACK( dma_lv0_ended )
17801562{
1563   saturn_state *state = machine.driver_data<saturn_state>();
1564
17811565   cputag_set_input_line_and_vector(machine, "maincpu", 5, (stv_irq.dma_end[0]) ? HOLD_LINE : CLEAR_LINE, 0x4b);
17821566
17831567   D0MV_0;
r11594r11595
17861570/*Lv 1 DMA end irq*/
17871571static TIMER_CALLBACK( dma_lv1_ended )
17881572{
1573   saturn_state *state = machine.driver_data<saturn_state>();
1574
17891575   cputag_set_input_line_and_vector(machine, "maincpu", 6, (stv_irq.dma_end[1]) ? HOLD_LINE : CLEAR_LINE, 0x4a);
17901576
17911577   D1MV_0;
r11594r11595
17941580/*Lv 2 DMA end irq*/
17951581static TIMER_CALLBACK( dma_lv2_ended )
17961582{
1583   saturn_state *state = machine.driver_data<saturn_state>();
1584
17971585   cputag_set_input_line_and_vector(machine, "maincpu", 6, (stv_irq.dma_end[2]) ? HOLD_LINE : CLEAR_LINE, 0x49);
17981586
17991587   D2MV_0;
18001588}
18011589
1802static void dma_direct_lv0(address_space *space)
1590static void scu_dma_direct(address_space *space, UINT8 dma_ch)
18031591{
1592   saturn_state *state = space->machine().driver_data<saturn_state>();
18041593   static UINT32 tmp_src,tmp_dst,tmp_size;
18051594   if(LOG_SCU) logerror("DMA lv 0 transfer START\n"
1806                      "Start %08x End %08x Size %04x\n",scu_src_0,scu_dst_0,scu_size_0);
1807   if(LOG_SCU) logerror("Start Add %04x Destination Add %04x\n",scu_src_add_0,scu_dst_add_0);
1595                      "Start %08x End %08x Size %04x\n",state->m_scu_src[0],state->m_scu_dst[0],state->m_scu_size[0]);
1596   if(LOG_SCU) logerror("Start Add %04x Destination Add %04x\n",state->m_scu_src_add[0],state->m_scu_dst_add[0]);
18081597
18091598   D0MV_1;
18101599
1811   if(scu_size_0 == 0) scu_size_0 = 0x00100000;
1600   /* max size */
1601   if(state->m_scu_size[dma_ch] == 0) { state->m_scu_size[dma_ch] = (dma_ch == 0) ? 0x00100000 : 0x2000; }
18121602
1813   scsp_to_main_irq = 0;
1814
18151603   /*set here the boundaries checks*/
18161604   /*...*/
18171605
1606   if((state->m_scu_dst_add[dma_ch] != state->m_scu_src_add[dma_ch]) && (ABUS(dma_ch)))
1607   {
1608      logerror("A-Bus invalid transfer,sets to default\n");
1609      scu_add_tmp = (state->m_scu_dst_add[dma_ch]*0x100) | (state->m_scu_src_add[dma_ch]);
1610      state->m_scu_dst_add[dma_ch] = state->m_scu_src_add[dma_ch] = 4;
1611      scu_add_tmp |= 0x80000000;
1612   }
1613
1614   #if 0
18181615   if(SOUND_RAM(dst_0))
18191616   {
18201617      logerror("Sound RAM DMA write\n");
18211618      scsp_to_main_irq = 1;
18221619   }
18231620
1824   if((scu_dst_add_0 != scu_src_add_0) && (ABUS(src_0)))
1825   {
1826      logerror("A-Bus invalid transfer,sets to default\n");
1827      scu_add_tmp = (scu_dst_add_0*0x100) | (scu_src_add_0);
1828      scu_dst_add_0 = scu_src_add_0 = 4;
1829      scu_add_tmp |= 0x80000000;
1830   }
18311621   /*Let me know if you encounter any of these three*/
18321622   if(ABUS(dst_0))
18331623   {
r11594r11595
18471637   if(VDP1_REGS(dst_0))
18481638   {
18491639      logerror("VDP1 register access,must be in word units\n");
1850      scu_add_tmp = (scu_dst_add_0*0x100) | (scu_src_add_0);
1851      scu_dst_add_0 = scu_src_add_0 = 2;
1640      scu_add_tmp = (state->m_scu_dst_add[0]*0x100) | (state->m_scu_src_add[0]);
1641      state->m_scu_dst_add[0] = state->m_scu_src_add[0] = 2;
18521642      scu_add_tmp |= 0x80000000;
18531643   }
18541644   if(DRUP(0))
18551645   {
18561646      logerror("Data read update = 1,read address add value must be 1 too\n");
1857      scu_add_tmp = (scu_dst_add_0*0x100) | (scu_src_add_0);
1858      scu_src_add_0 = 4;
1647      scu_add_tmp = (state->m_scu_dst_add[0]*0x100) | (state->m_scu_src_add[0]);
1648      state->m_scu_src_add[0] = 4;
18591649      scu_add_tmp |= 0x80000000;
18601650   }
18611651
1862   if (WORK_RAM_H(dst_0) && (scu_dst_add_0 != 4))
1652   if (WORK_RAM_H(dst_0) && (state->m_scu_dst_add[0] != 4))
18631653   {
1864      scu_add_tmp = (scu_dst_add_0*0x100) | (scu_src_add_0);
1865      scu_dst_add_0 = 4;
1654      scu_add_tmp = (state->m_scu_dst_add[0]*0x100) | (state->m_scu_src_add[0]);
1655      state->m_scu_dst_add[0] = 4;
18661656      scu_add_tmp |= 0x80000000;
18671657   }
1658   #endif
18681659
1869   tmp_size = scu_size_0;
1870   if(!(DRUP(0))) tmp_src = scu_src_0;
1871   if(!(DWUP(0))) tmp_dst = scu_dst_0;
1660   tmp_size = state->m_scu_size[dma_ch];
1661   if(!(DRUP(dma_ch))) tmp_src = state->m_scu_src[dma_ch];
1662   if(!(DWUP(dma_ch))) tmp_dst = state->m_scu_dst[dma_ch];
18721663
1873   for (; scu_size_0 > 0; scu_size_0-=scu_dst_add_0)
1664   for (; state->m_scu_size[dma_ch] > 0; state->m_scu_size[dma_ch]-=state->m_scu_dst_add[dma_ch])
18741665   {
1875      if(scu_dst_add_0 == 2)
1876         space->write_word(scu_dst_0,space->read_word(scu_src_0));
1877      else if(scu_dst_add_0 == 8)
1666      if(state->m_scu_dst_add[dma_ch] == 2)
1667         space->write_word(state->m_scu_dst[dma_ch],space->read_word(state->m_scu_src[dma_ch]));
1668      else if(state->m_scu_dst_add[dma_ch] == 8)
18781669      {
1879         space->write_word(scu_dst_0,space->read_word(scu_src_0));
1880         space->write_word(scu_dst_0+2,space->read_word(scu_src_0));
1881         space->write_word(scu_dst_0+4,space->read_word(scu_src_0+2));
1882         space->write_word(scu_dst_0+6,space->read_word(scu_src_0+2));
1670         space->write_word(state->m_scu_dst[dma_ch],  space->read_word(state->m_scu_src[dma_ch]  ));
1671         space->write_word(state->m_scu_dst[dma_ch]+2,space->read_word(state->m_scu_src[dma_ch]  ));
1672         space->write_word(state->m_scu_dst[dma_ch]+4,space->read_word(state->m_scu_src[dma_ch]+2));
1673         space->write_word(state->m_scu_dst[dma_ch]+6,space->read_word(state->m_scu_src[dma_ch]+2));
18831674      }
18841675      else
18851676      {
1886         space->write_word(scu_dst_0,space->read_word(scu_src_0));
1887         space->write_word(scu_dst_0+2,space->read_word(scu_src_0+2));
1677         space->write_word(state->m_scu_dst[dma_ch],  space->read_word(state->m_scu_src[dma_ch]  ));
1678         space->write_word(state->m_scu_dst[dma_ch]+2,space->read_word(state->m_scu_src[dma_ch]+2));
18881679      }
18891680
1890      scu_dst_0+=scu_dst_add_0;
1891      scu_src_0+=scu_src_add_0;
1681      state->m_scu_dst[dma_ch]+=state->m_scu_dst_add[dma_ch];
1682      state->m_scu_src[dma_ch]+=state->m_scu_src_add[dma_ch];
18921683   }
18931684
1894   scu_size_0 = tmp_size;
1895   if(!(DRUP(0))) scu_src_0 = tmp_src;
1896   if(!(DWUP(0))) scu_dst_0 = tmp_dst;
1685   state->m_scu_size[dma_ch] = tmp_size;
1686   if(!(DRUP(dma_ch))) state->m_scu_src[dma_ch] = tmp_src;
1687   if(!(DWUP(dma_ch))) state->m_scu_dst[dma_ch] = tmp_dst;
18971688
18981689   if(LOG_SCU) logerror("DMA transfer END\n");
18991690
1900   /*TODO: timing of this*/
1901   space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv0_ended));
1902
1903   if(scu_add_tmp & 0x80000000)
1691   /*TODO: timing of this, clean up */
1692   switch(dma_ch)
19041693   {
1905      scu_dst_add_0 = (scu_add_tmp & 0xff00) >> 8;
1906      scu_src_add_0 = (scu_add_tmp & 0x00ff) >> 0;
1907      scu_add_tmp^=0x80000000;
1694      case 0: space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv0_ended)); break;
1695      case 1: space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv1_ended)); break;
1696      case 2: space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv2_ended)); break;
19081697   }
1909}
19101698
1911static void dma_direct_lv1(address_space *space)
1912{
1913   static UINT32 tmp_src,tmp_dst,tmp_size;
1914   if(LOG_SCU) logerror("DMA lv 1 transfer START\n"
1915          "Start %08x End %08x Size %04x\n",scu_src_1,scu_dst_1,scu_size_1);
1916   if(LOG_SCU) logerror("Start Add %04x Destination Add %04x\n",scu_src_add_1,scu_dst_add_1);
1917
1918   D1MV_1;
1919
1920   if(scu_size_1 == 0) scu_size_1 = 0x00002000;
1921
1922   scsp_to_main_irq = 0;
1923
1924   /*set here the boundaries checks*/
1925   /*...*/
1926
1927   if(SOUND_RAM(dst_1))
1928   {
1929      logerror("Sound RAM DMA write\n");
1930      scsp_to_main_irq = 1;
1931   }
1932
1933   if((scu_dst_add_1 != scu_src_add_1) && (ABUS(src_1)))
1934   {
1935      logerror("A-Bus invalid transfer,sets to default\n");
1936      scu_add_tmp = (scu_dst_add_1*0x100) | (scu_src_add_1);
1937      scu_dst_add_1 = scu_src_add_1 = 4;
1938      scu_add_tmp |= 0x80000000;
1939   }
1940   /*Let me know if you encounter any of these ones*/
1941   if(ABUS(dst_1))
1942   {
1943      logerror("A-Bus invalid write\n");
1944      /*...*/
1945   }
1946   if(WORK_RAM_L(dst_1))
1947   {
1948      logerror("WorkRam-L invalid write\n");
1949      /*...*/
1950   }
1951   if(VDP1_REGS(dst_1))
1952   {
1953      logerror("VDP1 register access,must be in word units\n");
1954      scu_add_tmp = (scu_dst_add_1*0x100) | (scu_src_add_1);
1955      scu_dst_add_1 = scu_src_add_1 = 2;
1956      scu_add_tmp |= 0x80000000;
1957   }
1958   if(VDP2(src_1))
1959   {
1960      logerror("VDP-2 invalid read\n");
1961      /*...*/
1962   }
1963   if(DRUP(1))
1964   {
1965      logerror("Data read update = 1,read address add value must be 1 too\n");
1966      scu_add_tmp = (scu_dst_add_1*0x100) | (scu_src_add_1);
1967      scu_src_add_1 = 4;
1968      scu_add_tmp |= 0x80000000;
1969   }
1970
1971   if (WORK_RAM_H(dst_1) && (scu_dst_add_1 != 4))
1972   {
1973      scu_add_tmp = (scu_dst_add_1*0x100) | (scu_src_add_1);
1974      scu_src_add_1 = 4;
1975      scu_add_tmp |= 0x80000000;
1976   }
1977
1978   tmp_size = scu_size_1;
1979   if(!(DRUP(1))) tmp_src = scu_src_1;
1980   if(!(DWUP(1))) tmp_dst = scu_dst_1;
1981
1982   for (; scu_size_1 > 0; scu_size_1-=scu_dst_add_1)
1983   {
1984      if(scu_dst_add_1 == 2)
1985         space->write_word(scu_dst_1,space->read_word(scu_src_1));
1986      else
1987      {
1988         space->write_word(scu_dst_1,space->read_word(scu_src_1));
1989         space->write_word(scu_dst_1+2,space->read_word(scu_src_1+2));
1990      }
1991
1992      scu_dst_1+=scu_dst_add_1;
1993      scu_src_1+=scu_src_add_1;
1994   }
1995
1996   scu_size_1 = tmp_size;
1997   if(!(DRUP(1))) scu_src_1 = tmp_src;
1998   if(!(DWUP(1))) scu_dst_1 = tmp_dst;
1999
2000   if(LOG_SCU) logerror("DMA transfer END\n");
2001
2002   space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv1_ended));
2003
20041699   if(scu_add_tmp & 0x80000000)
20051700   {
2006      scu_dst_add_1 = (scu_add_tmp & 0xff00) >> 8;
2007      scu_src_add_1 = (scu_add_tmp & 0x00ff) >> 0;
1701      state->m_scu_dst_add[dma_ch] = (scu_add_tmp & 0xff00) >> 8;
1702      state->m_scu_src_add[dma_ch] = (scu_add_tmp & 0x00ff) >> 0;
20081703      scu_add_tmp^=0x80000000;
20091704   }
20101705}
20111706
2012static void dma_direct_lv2(address_space *space)
1707static void scu_dma_indirect(address_space *space,UINT8 dma_ch)
20131708{
2014   static UINT32 tmp_src,tmp_dst,tmp_size;
2015   if(LOG_SCU) logerror("DMA lv 2 transfer START\n"
2016          "Start %08x End %08x Size %04x\n",scu_src_2,scu_dst_2,scu_size_2);
2017   if(LOG_SCU) logerror("Start Add %04x Destination Add %04x\n",scu_src_add_2,scu_dst_add_2);
1709   saturn_state *state = space->machine().driver_data<saturn_state>();
20181710
2019   D2MV_1;
2020
2021   scsp_to_main_irq = 0;
2022
2023   if(scu_size_2 == 0) scu_size_2 = 0x00002000;
2024
2025   /*set here the boundaries checks*/
2026   /*...*/
2027
2028   if(SOUND_RAM(dst_2))
2029   {
2030      logerror("Sound RAM DMA write\n");
2031      scsp_to_main_irq = 1;
2032   }
2033
2034   if((scu_dst_add_2 != scu_src_add_2) && (ABUS(src_2)))
2035   {
2036      logerror("A-Bus invalid transfer,sets to default\n");
2037      scu_add_tmp = (scu_dst_add_2*0x100) | (scu_src_add_2);
2038      scu_dst_add_2 = scu_src_add_2 = 4;
2039      scu_add_tmp |= 0x80000000;
2040   }
2041   /*Let me know if you encounter any of these ones*/
2042   if(ABUS(dst_2))
2043   {
2044      logerror("A-Bus invalid write\n");
2045      /*...*/
2046   }
2047   if(WORK_RAM_L(dst_2))
2048   {
2049      logerror("WorkRam-L invalid write\n");
2050      /*...*/
2051   }
2052   if(VDP1_REGS(dst_2))
2053   {
2054      logerror("VDP1 register access,must be in word units\n");
2055      scu_add_tmp = (scu_dst_add_2*0x100) | (scu_src_add_2);
2056      scu_dst_add_2 = scu_src_add_2 = 2;
2057      scu_add_tmp |= 0x80000000;
2058   }
2059   if(VDP2(src_2))
2060   {
2061      logerror("VDP-2 invalid read\n");
2062      /*...*/
2063   }
2064   if(DRUP(2))
2065   {
2066      logerror("Data read update = 1,read address add value must be 1 too\n");
2067      scu_add_tmp = (scu_dst_add_2*0x100) | (scu_src_add_2);
2068      scu_src_add_2 = 4;
2069      scu_add_tmp |= 0x80000000;
2070   }
2071
2072   if (WORK_RAM_H(dst_2) && (scu_dst_add_2 != 4))
2073   {
2074      scu_add_tmp = (scu_dst_add_2*0x100) | (scu_src_add_2);
2075      scu_src_add_2 = 4;
2076      scu_add_tmp |= 0x80000000;
2077   }
2078
2079   tmp_size = scu_size_2;
2080   if(!(DRUP(2))) tmp_src = scu_src_2;
2081   if(!(DWUP(2))) tmp_dst = scu_dst_2;
2082
2083   for (; scu_size_2 > 0; scu_size_2-=scu_dst_add_2)
2084   {
2085      if(scu_dst_add_2 == 2)
2086         space->write_word(scu_dst_2,space->read_word(scu_src_2));
2087      else
2088      {
2089         space->write_word(scu_dst_2,space->read_word(scu_src_2));
2090         space->write_word(scu_dst_2+2,space->read_word(scu_src_2+2));
2091      }
2092
2093      scu_dst_2+=scu_dst_add_2;
2094      scu_src_2+=scu_src_add_2;
2095   }
2096
2097   scu_size_2 = tmp_size;
2098   if(!(DRUP(2))) scu_src_2 = tmp_src;
2099   if(!(DWUP(2))) scu_dst_2 = tmp_dst;
2100
2101   if(LOG_SCU) logerror("DMA transfer END\n");
2102
2103   space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv2_ended));
2104
2105   if(scu_add_tmp & 0x80000000)
2106   {
2107      scu_dst_add_2 = (scu_add_tmp & 0xff00) >> 8;
2108      scu_src_add_2 = (scu_add_tmp & 0x00ff) >> 0;
2109      scu_add_tmp^=0x80000000;
2110   }
2111}
2112
2113static void dma_indirect_lv0(address_space *space)
2114{
21151711   /*Helper to get out of the cycle*/
21161712   UINT8 job_done = 0;
21171713   /*temporary storage for the transfer data*/
r11594r11595
21191715
21201716   D0MV_1;
21211717
2122   scsp_to_main_irq = 0;
1718   if(state->m_scu_index[dma_ch] == 0) { state->m_scu_index[dma_ch] = state->m_scu_dst[0]; }
21231719
2124   if(scu_index_0 == 0) { scu_index_0 = scu_dst_0; }
2125
21261720   do{
2127      tmp_src = scu_index_0;
1721      tmp_src = state->m_scu_index[dma_ch];
21281722
2129      /*Thanks for Runik of Saturnin for pointing this out...*/
2130      scu_size_0 = space->read_dword(scu_index_0);
2131      scu_src_0 =  space->read_dword(scu_index_0+8);
2132      scu_dst_0 =  space->read_dword(scu_index_0+4);
1723      state->m_scu_size[dma_ch] = space->read_dword(state->m_scu_index[dma_ch]);
1724      state->m_scu_src[dma_ch]  = space->read_dword(state->m_scu_index[dma_ch]+8);
1725      state->m_scu_dst[dma_ch]  = space->read_dword(state->m_scu_index[dma_ch]+4);
21331726
21341727      /*Indirect Mode end factor*/
2135      if(scu_src_0 & 0x80000000)
1728      if(state->m_scu_src[dma_ch] & 0x80000000)
21361729         job_done = 1;
21371730
1731      #if 0
21381732      if(SOUND_RAM(dst_0))
21391733      {
21401734         logerror("Sound RAM DMA write\n");
21411735         scsp_to_main_irq = 1;
21421736      }
1737      #endif
21431738
2144      if(LOG_SCU) logerror("DMA lv 0 indirect mode transfer START\n"
2145             "Start %08x End %08x Size %04x\n",scu_src_0,scu_dst_0,scu_size_0);
2146      if(LOG_SCU) logerror("Start Add %04x Destination Add %04x\n",scu_src_add_0,scu_dst_add_0);
1739      if(LOG_SCU) logerror("DMA lv %d indirect mode transfer START\n"
1740                         "Start %08x End %08x Size %04x\n",dma_ch,state->m_scu_src[dma_ch],state->m_scu_dst[dma_ch],state->m_scu_size[dma_ch]);
1741      if(LOG_SCU) logerror("Start Add %04x Destination Add %04x\n",state->m_scu_src_add[dma_ch],state->m_scu_dst_add[dma_ch]);
21471742
21481743      //guess,but I believe it's right.
2149      scu_src_0 &=0x07ffffff;
2150      scu_dst_0 &=0x07ffffff;
2151      scu_size_0 &=0xfffff;
1744      state->m_scu_src[dma_ch] &=0x07ffffff;
1745      state->m_scu_dst[dma_ch] &=0x07ffffff;
1746      state->m_scu_size[dma_ch] &= ((dma_ch == 0) ? 0xfffff : 0x1fff);
21521747
2153      for (; scu_size_0 > 0; scu_size_0-=scu_dst_add_0)
1748      if(state->m_scu_size[dma_ch] == 0) { state->m_scu_size[dma_ch] = (dma_ch == 0) ? 0x00100000 : 0x2000; }
1749
1750      for (; state->m_scu_size[dma_ch] > 0; state->m_scu_size[dma_ch]-=state->m_scu_dst_add[dma_ch])
21541751      {
2155         if(scu_dst_add_0 == 2)
2156            space->write_word(scu_dst_0,space->read_word(scu_src_0));
1752         if(state->m_scu_dst_add[dma_ch] == 2)
1753            space->write_word(state->m_scu_dst[dma_ch],space->read_word(state->m_scu_src[dma_ch]));
21571754         else
21581755         {
21591756            /* some games, eg columns97 are a bit weird, I'm not sure this is correct
r11594r11595
21611758                  can't access 2 byte boundaries, and the end of the sprite list never gets marked,
21621759                  the length of the transfer is also set to a 2 byte boundary, maybe the add values
21631760                  should be different, I don't know */
2164            space->write_word(scu_dst_0,space->read_word(scu_src_0));
2165            space->write_word(scu_dst_0+2,space->read_word(scu_src_0+2));
1761            space->write_word(state->m_scu_dst[dma_ch],space->read_word(state->m_scu_src[dma_ch]));
1762            space->write_word(state->m_scu_dst[dma_ch]+2,space->read_word(state->m_scu_src[dma_ch]+2));
21661763         }
2167         scu_dst_0+=scu_dst_add_0;
2168         scu_src_0+=scu_src_add_0;
1764         state->m_scu_dst[dma_ch]+=state->m_scu_dst_add[dma_ch];
1765         state->m_scu_src[dma_ch]+=state->m_scu_src_add[dma_ch];
21691766      }
21701767
2171      //if(DRUP(0))   space->write_dword(tmp_src+8,scu_src_0|job_done ? 0x80000000 : 0);
2172      //if(DWUP(0)) space->write_dword(tmp_src+4,scu_dst_0);
1768      //if(DRUP(0))   space->write_dword(tmp_src+8,state->m_scu_src[0]|job_done ? 0x80000000 : 0);
1769      //if(DWUP(0)) space->write_dword(tmp_src+4,state->m_scu_dst[0]);
21731770
2174      scu_index_0 = tmp_src+0xc;
1771      state->m_scu_index[dma_ch] = tmp_src+0xc;
21751772
21761773   }while(job_done == 0);
21771774
2178   space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv0_ended));
1775   /*TODO: timing of this, clean up */
1776   switch(dma_ch)
1777   {
1778      case 0: space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv0_ended)); break;
1779      case 1: space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv1_ended)); break;
1780      case 2: space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv2_ended)); break;
1781   }
21791782}
21801783
2181static void dma_indirect_lv1(address_space *space)
2182{
2183   /*Helper to get out of the cycle*/
2184   UINT8 job_done = 0;
2185   /*temporary storage for the transfer data*/
2186   UINT32 tmp_src;
21871784
2188   D1MV_1;
1785/**************************************************************************************/
21891786
2190   scsp_to_main_irq = 0;
1787static WRITE16_HANDLER( saturn_soundram_w )
1788{
1789   saturn_state *state = space->machine().driver_data<saturn_state>();
21911790
2192   if(scu_index_1 == 0) { scu_index_1 = scu_dst_1; }
1791   //space->machine().scheduler().synchronize(); // force resync
21931792
2194   do{
2195      tmp_src = scu_index_1;
2196
2197      scu_size_1 = space->read_dword(scu_index_1);
2198      scu_src_1 =  space->read_dword(scu_index_1+8);
2199      scu_dst_1 =  space->read_dword(scu_index_1+4);
2200
2201      /*Indirect Mode end factor*/
2202      if(scu_src_1 & 0x80000000)
2203         job_done = 1;
2204
2205      if(SOUND_RAM(dst_1))
2206      {
2207         logerror("Sound RAM DMA write\n");
2208         scsp_to_main_irq = 1;
2209      }
2210
2211      if(LOG_SCU) logerror("DMA lv 1 indirect mode transfer START\n"
2212             "Start %08x End %08x Size %04x\n",scu_src_1,scu_dst_1,scu_size_1);
2213      if(LOG_SCU) logerror("Start Add %04x Destination Add %04x\n",scu_src_add_1,scu_dst_add_1);
2214
2215      //guess,but I believe it's right.
2216      scu_src_1 &=0x07ffffff;
2217      scu_dst_1 &=0x07ffffff;
2218      scu_size_1 &=0xffff;
2219
2220
2221      for (; scu_size_1 > 0; scu_size_1-=scu_dst_add_1)
2222      {
2223
2224         if(scu_dst_add_1 == 2)
2225            space->write_word(scu_dst_1,space->read_word(scu_src_1));
2226         else
2227         {
2228            /* some games, eg columns97 are a bit weird, I'm not sure this is correct
2229                  they start a dma on a 2 byte boundary in 4 byte add mode, using the dword reads we
2230                  can't access 2 byte boundaries, and the end of the sprite list never gets marked,
2231                  the length of the transfer is also set to a 2 byte boundary, maybe the add values
2232                  should be different, I don't know */
2233            space->write_word(scu_dst_1,space->read_word(scu_src_1));
2234            space->write_word(scu_dst_1+2,space->read_word(scu_src_1+2));
2235         }
2236         scu_dst_1+=scu_dst_add_1;
2237         scu_src_1+=scu_src_add_1;
2238      }
2239
2240      //if(DRUP(1))   space->write_dword(tmp_src+8,scu_src_1|job_done ? 0x80000000 : 0);
2241      //if(DWUP(1)) space->write_dword(tmp_src+4,scu_dst_1);
2242
2243      scu_index_1 = tmp_src+0xc;
2244
2245   }while(job_done == 0);
2246
2247   space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv1_ended));
1793   COMBINE_DATA(&state->m_sound_ram[offset]);
22481794}
22491795
2250static void dma_indirect_lv2(address_space *space)
1796static READ16_HANDLER( saturn_soundram_r )
22511797{
2252   /*Helper to get out of the cycle*/
2253   UINT8 job_done = 0;
2254   /*temporary storage for the transfer data*/
2255   UINT32 tmp_src;
1798   saturn_state *state = space->machine().driver_data<saturn_state>();
22561799
2257   D2MV_1;
1800   //space->machine().scheduler().synchronize(); // force resync
22581801
2259   scsp_to_main_irq = 0;
2260
2261   if(scu_index_2 == 0) { scu_index_2 = scu_dst_2; }
2262
2263   do{
2264      tmp_src = scu_index_2;
2265
2266      scu_size_2 = space->read_dword(scu_index_2);
2267      scu_src_2 =  space->read_dword(scu_index_2+8);
2268      scu_dst_2 =  space->read_dword(scu_index_2+4);
2269
2270      /*Indirect Mode end factor*/
2271      if(scu_src_2 & 0x80000000)
2272         job_done = 1;
2273
2274      if(SOUND_RAM(dst_2))
2275      {
2276         logerror("Sound RAM DMA write\n");
2277         scsp_to_main_irq = 1;
2278      }
2279
2280      if(LOG_SCU) logerror("DMA lv 2 indirect mode transfer START\n"
2281             "Start %08x End %08x Size %04x\n",scu_src_2,scu_dst_2,scu_size_2);
2282      if(LOG_SCU) logerror("Start Add %04x Destination Add %04x\n",scu_src_add_2,scu_dst_add_2);
2283
2284      //guess,but I believe it's right.
2285      scu_src_2 &=0x07ffffff;
2286      scu_dst_2 &=0x07ffffff;
2287      scu_size_2 &=0xffff;
2288
2289      for (; scu_size_2 > 0; scu_size_2-=scu_dst_add_2)
2290      {
2291         if(scu_dst_add_2 == 2)
2292            space->write_word(scu_dst_2,space->read_word(scu_src_2));
2293         else
2294         {
2295            /* some games, eg columns97 are a bit weird, I'm not sure this is correct
2296                  they start a dma on a 2 byte boundary in 4 byte add mode, using the dword reads we
2297                  can't access 2 byte boundaries, and the end of the sprite list never gets marked,
2298                  the length of the transfer is also set to a 2 byte boundary, maybe the add values
2299                  should be different, I don't know */
2300            space->write_word(scu_dst_2,space->read_word(scu_src_2));
2301            space->write_word(scu_dst_2+2,space->read_word(scu_src_2+2));
2302         }
2303
2304         scu_dst_2+=scu_dst_add_2;
2305         scu_src_2+=scu_src_add_2;
2306      }
2307
2308      //if(DRUP(2))   space->write_dword(tmp_src+8,scu_src_2|job_done ? 0x80000000 : 0);
2309      //if(DWUP(2)) space->write_dword(tmp_src+4,scu_dst_2);
2310
2311      scu_index_2 = tmp_src+0xc;
2312
2313   }while(job_done == 0);
2314
2315   space->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dma_lv2_ended));
1802   return state->m_sound_ram[offset];
23161803}
23171804
2318
2319/**************************************************************************************/
2320
2321static WRITE32_HANDLER( stv_sh2_soundram_w )
2322{
2323   COMBINE_DATA(sound_ram+offset*2+1);
2324   data >>= 16;
2325   mem_mask >>= 16;
2326   COMBINE_DATA(sound_ram+offset*2);
2327}
2328
2329static READ32_HANDLER( stv_sh2_soundram_r )
2330{
2331   return (sound_ram[offset*2]<<16)|sound_ram[offset*2+1];
2332}
2333
2334/* communication,SLAVE CPU acquires data from the MASTER CPU and triggers an irq.  *
2335 * Enter into Radiant Silver Gun specific menu for a test...                       */
1805/* communication,SLAVE CPU acquires data from the MASTER CPU and triggers an irq.  */
23361806static WRITE32_HANDLER( minit_w )
23371807{
23381808   logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->device().tag(), cpu_get_pc(&space->device()),data);
r11594r11595
23481818   sh2_set_frt_input(space->machine().device("maincpu"), PULSE_LINE);
23491819}
23501820
2351
2352#ifdef UNUSED_FUNCTION
2353static READ32_HANDLER( stv_sh2_random_r )
1821static READ32_HANDLER(saturn_m_backupram_r)
23541822{
2355   return 0xffffffff;
2356}
2357#endif
1823   saturn_state *state = space->machine().driver_data<saturn_state>();
23581824
2359
2360static UINT32 backup[64*1024/4];
2361
2362static READ32_HANDLER(satram_r)
2363{
2364   return backup[offset] & 0x00ff00ff;   // yes, it makes sure the "holes" are there.
1825   return state->m_backupram[offset] & 0x00ff00ff;   // yes, it makes sure the "holes" are there.
23651826}
23661827
2367static WRITE32_HANDLER(satram_w)
1828static WRITE32_HANDLER(saturn_m_backupram_w)
23681829{
2369   COMBINE_DATA(&backup[offset]);
1830   saturn_state *state = space->machine().driver_data<saturn_state>();
1831
1832   COMBINE_DATA(&state->m_backupram[offset]);
23701833}
23711834
23721835static NVRAM_HANDLER(saturn)
23731836{
1837   saturn_state *state = machine.driver_data<saturn_state>();
1838
23741839   static const UINT32 init[8] =
23751840   {
23761841      0x420061, 0x63006b, 0x550070, 0x520061, 0x6d0020, 0x46006f, 0x72006d, 0x610074,
r11594r11595
23781843   int i;
23791844
23801845   if (read_or_write)
2381      file->write(backup, 64*1024/4);
1846      file->write(state->m_backupram, 64*1024/4);
23821847   else
23831848   {
23841849      if (file)
23851850      {
2386         file->read(backup, 64*1024/4);
1851         file->read(state->m_backupram, 64*1024/4);
23871852      }
23881853      else
23891854      {
2390         memset(backup, 0, 64*1024/4);
1855         memset(state->m_backupram, 0, 64*1024/4);
23911856         for (i = 0; i < 8; i++)
23921857         {
2393            backup[i] = init[i];
2394            backup[i+8] = init[i];
2395            backup[i+16] = init[i];
2396            backup[i+24] = init[i];
1858            state->m_backupram[i] = init[i];
1859            state->m_backupram[i+8] = init[i];
1860            state->m_backupram[i+16] = init[i];
1861            state->m_backupram[i+24] = init[i];
23971862         }
23981863      }
23991864   }
r11594r11595
24011866
24021867static ADDRESS_MAP_START( saturn_mem, AS_PROGRAM, 32 )
24031868   AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_SHARE("share6")  // bios
2404   AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE(saturn_SMPC_r32, saturn_SMPC_w32)
2405   AM_RANGE(0x00180000, 0x0018ffff) AM_READWRITE(satram_r, satram_w)
2406   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x100000) AM_SHARE("share2") AM_BASE(&stv_workram_l)
2407   AM_RANGE(0x01000000, 0x01000003) AM_WRITE(minit_w)
2408   AM_RANGE(0x01406f40, 0x01406f43) AM_WRITE(minit_w) // prikura seems to write here ..
2409   AM_RANGE(0x01800000, 0x01800003) AM_WRITE(sinit_w)
1869   AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE8(saturn_SMPC_r8, saturn_SMPC_w8,0xffffffff)
1870   AM_RANGE(0x00180000, 0x0018ffff) AM_READWRITE(saturn_m_backupram_r, saturn_m_backupram_w) AM_SHARE("share1") AM_BASE_MEMBER(saturn_state,m_backupram)
1871   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x100000) AM_SHARE("share2") AM_BASE_MEMBER(saturn_state,m_workram_l)
1872   AM_RANGE(0x01000000, 0x01000003) AM_MIRROR(0x7ffffc) AM_WRITE(minit_w)
1873   AM_RANGE(0x01800000, 0x01800003) AM_MIRROR(0x7ffffc) AM_WRITE(sinit_w)
24101874   AM_RANGE(0x02000000, 0x023fffff) AM_ROM AM_SHARE("share7") AM_REGION("maincpu", 0x80000)   // cartridge space
24111875   AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE(stvcd_r, stvcd_w)
24121876   /* Sound */
2413   AM_RANGE(0x05a00000, 0x05a7ffff) AM_READWRITE(stv_sh2_soundram_r, stv_sh2_soundram_w)
1877   AM_RANGE(0x05a00000, 0x05a7ffff) AM_READWRITE16(saturn_soundram_r, saturn_soundram_w,0xffffffff)
24141878   AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16("scsp", scsp_r, scsp_w, 0xffffffff)
24151879   /* VDP1 */
24161880   /*0x05c00000-0x05c7ffff VRAM*/
r11594r11595
24231887   AM_RANGE(0x05e00000, 0x05efffff) AM_READWRITE(stv_vdp2_vram_r, stv_vdp2_vram_w)
24241888   AM_RANGE(0x05f00000, 0x05f7ffff) AM_READWRITE(stv_vdp2_cram_r, stv_vdp2_cram_w)
24251889   AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE(stv_vdp2_regs_r, stv_vdp2_regs_w)
2426   AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(stv_scu_r32, stv_scu_w32)
2427   AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x01f00000) AM_SHARE("share3") AM_BASE(&stv_workram_h)
1890   AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(saturn_scu_r, saturn_scu_w)
1891   AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x01f00000) AM_SHARE("share3") AM_BASE_MEMBER(saturn_state,m_workram_h)
24281892   AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE("share6")  // bios mirror
24291893   AM_RANGE(0x22000000, 0x24ffffff) AM_ROM AM_SHARE("share7")  // cart mirror
24301894ADDRESS_MAP_END
24311895
2432
24331896static ADDRESS_MAP_START( stv_mem, AS_PROGRAM, 32 )
24341897   AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_SHARE("share6")  // bios
2435   AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE(stv_SMPC_r32, stv_SMPC_w32)
2436   AM_RANGE(0x00180000, 0x0018ffff) AM_RAM AM_SHARE("share1") AM_BASE(&stv_backupram)
2437   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x100000) AM_SHARE("share2") AM_BASE(&stv_workram_l)
1898   AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE8(stv_SMPC_r8, stv_SMPC_w8,0xffffffff)
1899   AM_RANGE(0x00180000, 0x0018ffff) AM_READWRITE(saturn_m_backupram_r,saturn_m_backupram_w) AM_SHARE("share1") AM_BASE_MEMBER(saturn_state,m_backupram)
1900   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x100000) AM_SHARE("share2") AM_BASE_MEMBER(saturn_state,m_workram_l)
24381901   AM_RANGE(0x00400000, 0x0040001f) AM_READWRITE(stv_io_r32, stv_io_w32) AM_BASE(&ioga) AM_SHARE("share4") AM_MIRROR(0x20)
2439   AM_RANGE(0x01000000, 0x01000003) AM_WRITE(minit_w)
2440   AM_RANGE(0x01406f40, 0x01406f43) AM_WRITE(minit_w) // prikura seems to write here ..
2441//  AM_RANGE(0x01000000, 0x01000003) AM_WRITE(minit_w) AM_MIRROR(0x00080000)
2442   AM_RANGE(0x01800000, 0x01800003) AM_WRITE(sinit_w)
2443   AM_RANGE(0x02000000, 0x04ffffff) AM_ROM AM_SHARE("share7") AM_REGION("user1", 0) // cartridge
1902   AM_RANGE(0x01000000, 0x01000003) AM_MIRROR(0x7ffffc) AM_WRITE(minit_w)
1903   AM_RANGE(0x01800000, 0x01800003) AM_MIRROR(0x7ffffc) AM_WRITE(sinit_w)
1904   AM_RANGE(0x02000000, 0x04ffffff) AM_ROM AM_SHARE("share7") AM_REGION("abus", 0) // cartridge
24441905   AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE(stvcd_r, stvcd_w)
24451906   /* Sound */
2446   AM_RANGE(0x05a00000, 0x05afffff) AM_READWRITE(stv_sh2_soundram_r, stv_sh2_soundram_w)
2447   //AM_RANGE(0x05a80000, 0x05afffff) AM_READ(stv_sh2_random_r)
1907   AM_RANGE(0x05a00000, 0x05afffff) AM_READWRITE16(saturn_soundram_r, saturn_soundram_w,0xffffffff)
24481908   AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16("scsp", scsp_r, scsp_w, 0xffffffff)
24491909   /* VDP1 */
24501910   AM_RANGE(0x05c00000, 0x05c7ffff) AM_READWRITE(stv_vdp1_vram_r, stv_vdp1_vram_w)
r11594r11595
24531913   AM_RANGE(0x05e00000, 0x05efffff) AM_READWRITE(stv_vdp2_vram_r, stv_vdp2_vram_w)
24541914   AM_RANGE(0x05f00000, 0x05f7ffff) AM_READWRITE(stv_vdp2_cram_r, stv_vdp2_cram_w)
24551915   AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE(stv_vdp2_regs_r, stv_vdp2_regs_w)
2456   AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(stv_scu_r32, stv_scu_w32)
2457   AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x01f00000) AM_SHARE("share3") AM_BASE(&stv_workram_h)
1916   AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(saturn_scu_r, saturn_scu_w)
1917   AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x01f00000) AM_SHARE("share3") AM_BASE_MEMBER(saturn_state,m_workram_h)
24581918   AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE("share6")  // bios mirror
24591919   AM_RANGE(0x22000000, 0x24ffffff) AM_ROM AM_SHARE("share7")  // cart mirror
24601920ADDRESS_MAP_END
24611921
24621922static ADDRESS_MAP_START( sound_mem, AS_PROGRAM, 16 )
2463   AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_BASE(&sound_ram)
1923   AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_BASE_MEMBER(saturn_state,m_sound_ram)
24641924   AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE("scsp", scsp_r, scsp_w)
24651925ADDRESS_MAP_END
24661926
r11594r11595
28422302
28432303static WRITE32_HANDLER ( w60ffc44_write )
28442304{
2845   COMBINE_DATA(&stv_workram_h[0xffc44/4]);
2305   saturn_state *state = space->machine().driver_data<saturn_state>();
28462306
2307   COMBINE_DATA(&state->m_workram_h[0xffc44/4]);
2308
28472309   logerror("cpu %s (PC=%08X): 60ffc44_write write = %08X & %08X\n", space->device().tag(), cpu_get_pc(&space->device()), data, mem_mask);
28482310   //sinit_w(offset,data,mem_mask);
28492311}
28502312
28512313static WRITE32_HANDLER ( w60ffc48_write )
28522314{
2853   COMBINE_DATA(&stv_workram_h[0xffc48/4]);
2315   saturn_state *state = space->machine().driver_data<saturn_state>();
28542316
2317   COMBINE_DATA(&state->m_workram_h[0xffc48/4]);
2318
28552319   logerror("cpu %s (PC=%08X): 60ffc48_write write = %08X & %08X\n", space->device().tag(), cpu_get_pc(&space->device()), data, mem_mask);
28562320   //minit_w(offset,data,mem_mask);
28572321}
r11594r11595
28622326
28632327DRIVER_INIT ( stv )
28642328{
2329   saturn_state *state = machine.driver_data<saturn_state>();
28652330   system_time systime;
28662331
28672332   machine.base_datetime(systime);
r11594r11595
28722337   minit_boost_timeslice = attotime::zero;
28732338   sinit_boost_timeslice = attotime::zero;
28742339
2875   smpc_ram = auto_alloc_array(machine, UINT8, 0x80);
2876   stv_scu = auto_alloc_array(machine, UINT32, 0x100/4);
2340   state->m_smpc_ram = auto_alloc_array(machine, UINT8, 0x80);
2341   state->m_scu_regs = auto_alloc_array(machine, UINT32, 0x100/4);
28772342   scsp_regs = auto_alloc_array(machine, UINT16, 0x1000/2);
28782343
28792344   install_stvbios_speedups(machine);
r11594r11595
28902355   machine.device("slave")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x60ffc44, 0x60ffc47, FUNC(w60ffc44_write) );
28912356   machine.device("slave")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x60ffc48, 0x60ffc4b, FUNC(w60ffc48_write) );
28922357
2893    smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??)
2894//  smpc_ram[0x33] = input_port_read(machine, "FAKE");
2895   smpc_ram[0x5f] = 0x10;
2358    state->m_smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??)
2359//  state->m_smpc_ram[0x33] = input_port_read(machine, "FAKE");
2360   state->m_smpc_ram[0x5f] = 0x10;
28962361
28972362   #ifdef MAME_DEBUG
28982363   /*Uncomment this to enable header info*/
r11594r11595
29112376#ifdef UNUSED_FUNCTION
29122377static void print_game_info(void)
29132378{
2914   UINT8 *ROM = machine.region("user1")->base();
2379   UINT8 *ROM = machine.region("game0")->base();
29152380   static FILE *print_file = NULL;
29162381   UINT8 STR[0x100];
29172382   UINT32 src_i,dst_i;
r11594r11595
30182483
30192484static void scsp_irq(device_t *device, int irq)
30202485{
2486   saturn_state *state = device->machine().driver_data<saturn_state>();
2487
30212488   // don't bother the 68k if it's off
3022   if (!en_68k)
2489   if (!state->m_en_68k)
30232490   {
30242491      return;
30252492   }
r11594r11595
30472514
30482515static TIMER_CALLBACK(stv_rtc_increment)
30492516{
2517   saturn_state *state = machine.driver_data<saturn_state>();
30502518   static const UINT8 dpm[12] = { 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31 };
30512519   static int year_num, year_count;
30522520
30532521   /*
3054        smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
3055        smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
3056        smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month+1);
3057        smpc_ram[0x29] = DectoBCD(systime.local_time.mday);
3058        smpc_ram[0x2b] = DectoBCD(systime.local_time.hour);
3059        smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
3060        smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
2522        state->m_smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
2523        state->m_smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
2524        state->m_smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month+1);
2525        state->m_smpc_ram[0x29] = DectoBCD(systime.local_time.mday);
2526        state->m_smpc_ram[0x2b] = DectoBCD(systime.local_time.hour);
2527        state->m_smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
2528        state->m_smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
30612529    */
30622530
3063   smpc_ram[0x2f]++;
2531   state->m_smpc_ram[0x2f]++;
30642532
30652533   /* seconds from 9 -> 10*/
3066   if((smpc_ram[0x2f] & 0x0f) >= 0x0a)          { smpc_ram[0x2f]+=0x10; smpc_ram[0x2f]&=0xf0; }
2534   if((state->m_smpc_ram[0x2f] & 0x0f) >= 0x0a)          { state->m_smpc_ram[0x2f]+=0x10; state->m_smpc_ram[0x2f]&=0xf0; }
30672535   /* seconds from 59 -> 0 */
3068   if((smpc_ram[0x2f] & 0xf0) >= 0x60)          { smpc_ram[0x2d]++;     smpc_ram[0x2f] = 0; }
2536   if((state->m_smpc_ram[0x2f] & 0xf0) >= 0x60)          { state->m_smpc_ram[0x2d]++;     state->m_smpc_ram[0x2f] = 0; }
30692537   /* minutes from 9 -> 10 */
3070   if((smpc_ram[0x2d] & 0x0f) >= 0x0a)          { smpc_ram[0x2d]+=0x10; smpc_ram[0x2d]&=0xf0; }
2538   if((state->m_smpc_ram[0x2d] & 0x0f) >= 0x0a)          { state->m_smpc_ram[0x2d]+=0x10; state->m_smpc_ram[0x2d]&=0xf0; }
30712539   /* minutes from 59 -> 0 */
3072   if((smpc_ram[0x2d] & 0xf0) >= 0x60)          { smpc_ram[0x2b]++;     smpc_ram[0x2d] = 0; }
2540   if((state->m_smpc_ram[0x2d] & 0xf0) >= 0x60)          { state->m_smpc_ram[0x2b]++;     state->m_smpc_ram[0x2d] = 0; }
30732541   /* hours from 9 -> 10 */
3074   if((smpc_ram[0x2b] & 0x0f) >= 0x0a)          { smpc_ram[0x2b]+=0x10; smpc_ram[0x2b]&=0xf0; }
2542   if((state->m_smpc_ram[0x2b] & 0x0f) >= 0x0a)          { state->m_smpc_ram[0x2b]+=0x10; state->m_smpc_ram[0x2b]&=0xf0; }
30752543   /* hours from 23 -> 0 */
3076   if((smpc_ram[0x2b] & 0xff) >= 0x24)            { smpc_ram[0x29]++; smpc_ram[0x27]+=0x10; smpc_ram[0x2b] = 0; }
2544   if((state->m_smpc_ram[0x2b] & 0xff) >= 0x24)            { state->m_smpc_ram[0x29]++; state->m_smpc_ram[0x27]+=0x10; state->m_smpc_ram[0x2b] = 0; }
30772545   /* week day name sunday -> monday */
3078   if((smpc_ram[0x27] & 0xf0) >= 0x70)            { smpc_ram[0x27]&=0x0f; }
2546   if((state->m_smpc_ram[0x27] & 0xf0) >= 0x70)            { state->m_smpc_ram[0x27]&=0x0f; }
30792547   /* day number 9 -> 10 */
3080   if((smpc_ram[0x29] & 0x0f) >= 0x0a)            { smpc_ram[0x29]+=0x10; smpc_ram[0x29]&=0xf0; }
2548   if((state->m_smpc_ram[0x29] & 0x0f) >= 0x0a)            { state->m_smpc_ram[0x29]+=0x10; state->m_smpc_ram[0x29]&=0xf0; }
30812549
30822550   // year BCD to dec conversion (for the leap year stuff)
30832551   {
3084      year_num = (smpc_ram[0x25] & 0xf);
2552      year_num = (state->m_smpc_ram[0x25] & 0xf);
30852553
3086      for(year_count = 0; year_count < (smpc_ram[0x25] & 0xf0); year_count += 0x10)
2554      for(year_count = 0; year_count < (state->m_smpc_ram[0x25] & 0xf0); year_count += 0x10)
30872555         year_num += 0xa;
30882556
3089      year_num += (smpc_ram[0x23] & 0xf)*0x64;
2557      year_num += (state->m_smpc_ram[0x23] & 0xf)*0x64;
30902558
3091      for(year_count = 0; year_count < (smpc_ram[0x23] & 0xf0); year_count += 0x10)
2559      for(year_count = 0; year_count < (state->m_smpc_ram[0x23] & 0xf0); year_count += 0x10)
30922560         year_num += 0x3e8;
30932561   }
30942562
30952563   /* month +1 check */
30962564   /* the RTC have a range of 1980 - 2100, so we don't actually need to support the leap year special conditions */
3097   if(((year_num % 4) == 0) && (smpc_ram[0x27] & 0xf) == 2)
2565   if(((year_num % 4) == 0) && (state->m_smpc_ram[0x27] & 0xf) == 2)
30982566   {
3099      if((smpc_ram[0x29] & 0xff) >= dpm[(smpc_ram[0x27] & 0xf)-1]+1+1)
3100         { smpc_ram[0x27]++; smpc_ram[0x29] = 0x01; }
2567      if((state->m_smpc_ram[0x29] & 0xff) >= dpm[(state->m_smpc_ram[0x27] & 0xf)-1]+1+1)
2568         { state->m_smpc_ram[0x27]++; state->m_smpc_ram[0x29] = 0x01; }
31012569   }
3102   else if((smpc_ram[0x29] & 0xff) >= dpm[(smpc_ram[0x27] & 0xf)-1]+1){ smpc_ram[0x27]++; smpc_ram[0x29] = 0x01; }
2570   else if((state->m_smpc_ram[0x29] & 0xff) >= dpm[(state->m_smpc_ram[0x27] & 0xf)-1]+1){ state->m_smpc_ram[0x27]++; state->m_smpc_ram[0x29] = 0x01; }
31032571   /* year +1 check */
3104   if((smpc_ram[0x27] & 0x0f) > 12)            { smpc_ram[0x25]++;  smpc_ram[0x27] = (smpc_ram[0x27] & 0xf0) | 0x01; }
2572   if((state->m_smpc_ram[0x27] & 0x0f) > 12)            { state->m_smpc_ram[0x25]++;  state->m_smpc_ram[0x27] = (state->m_smpc_ram[0x27] & 0xf0) | 0x01; }
31052573   /* year from 9 -> 10 */
3106   if((smpc_ram[0x25] & 0x0f) >= 0x0a)            { smpc_ram[0x25]+=0x10; smpc_ram[0x25]&=0xf0; }
2574   if((state->m_smpc_ram[0x25] & 0x0f) >= 0x0a)            { state->m_smpc_ram[0x25]+=0x10; state->m_smpc_ram[0x25]&=0xf0; }
31072575   /* year from 99 -> 100 */
3108   if((smpc_ram[0x25] & 0xf0) >= 0xa0)            { smpc_ram[0x23]++; smpc_ram[0x25] = 0; }
2576   if((state->m_smpc_ram[0x25] & 0xf0) >= 0xa0)            { state->m_smpc_ram[0x23]++; state->m_smpc_ram[0x25] = 0; }
31092577
31102578   // probably not SO precise, here just for reference ...
31112579   /* year from 999 -> 1000 */
3112   //if((smpc_ram[0x23] & 0x0f) >= 0x0a)               { smpc_ram[0x23]+=0x10; smpc_ram[0x23]&=0xf0; }
2580   //if((state->m_smpc_ram[0x23] & 0x0f) >= 0x0a)               { state->m_smpc_ram[0x23]+=0x10; state->m_smpc_ram[0x23]&=0xf0; }
31132581   /* year from 9999 -> 0 */
3114   //if((smpc_ram[0x23] & 0xf0) >= 0xa0)               { smpc_ram[0x23] = 0; } //roll over
2582   //if((state->m_smpc_ram[0x23] & 0xf0) >= 0xa0)               { state->m_smpc_ram[0x23] = 0; } //roll over
31152583}
31162584
31172585static MACHINE_START( stv )
31182586{
2587   saturn_state *state = machine.driver_data<saturn_state>();
31192588   system_time systime;
31202589   machine.base_datetime(systime);
31212590
3122   stv_maincpu = machine.device<cpu_device>("maincpu");
3123   stv_slave = machine.device<cpu_device>("slave");
3124   stv_audiocpu = machine.device<cpu_device>("audiocpu");
2591   state->m_maincpu = downcast<legacy_cpu_device*>( machine.device("maincpu") );
2592   state->m_slave = downcast<legacy_cpu_device*>( machine.device("slave") );
2593   state->m_audiocpu = downcast<legacy_cpu_device*>( machine.device("audiocpu") );
31252594
3126   scsp_set_ram_base(machine.device("scsp"), sound_ram);
2595   scsp_set_ram_base(machine.device("scsp"), state->m_sound_ram);
31272596
31282597   // save states
3129   state_save_register_global_pointer(machine, smpc_ram, 0x80);
3130   state_save_register_global_pointer(machine, stv_scu, 0x100/4);
2598   state_save_register_global_pointer(machine, state->m_smpc_ram, 0x80);
2599   state_save_register_global_pointer(machine, state->m_scu_regs, 0x100/4);
31312600   state_save_register_global_pointer(machine, scsp_regs, 0x1000/2);
31322601//  state_save_register_global(machine, stv_vblank);
31332602//  state_save_register_global(machine, stv_hblank);
3134   state_save_register_global(machine, stv_enable_slave_sh2);
3135   state_save_register_global(machine, NMI_reset);
3136   state_save_register_global(machine, en_68k);
2603   state_save_register_global(machine, state->m_NMI_reset);
2604   state_save_register_global(machine, state->m_en_68k);
31372605   state_save_register_global(machine, timer_0);
31382606   state_save_register_global(machine, timer_1);
31392607//  state_save_register_global(machine, scanline);
r11594r11595
31512619
31522620   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(stvcd_exit), &machine));
31532621
3154   smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
3155    smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
3156    smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month+1);
3157    smpc_ram[0x29] = DectoBCD(systime.local_time.mday);
3158    smpc_ram[0x2b] = DectoBCD(systime.local_time.hour);
3159    smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
3160    smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
2622   state->m_smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
2623    state->m_smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
2624    state->m_smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month+1);
2625    state->m_smpc_ram[0x29] = DectoBCD(systime.local_time.mday);
2626    state->m_smpc_ram[0x2b] = DectoBCD(systime.local_time.hour);
2627    state->m_smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
2628    state->m_smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
31612629
31622630   stv_rtc_timer = machine.scheduler().timer_alloc(FUNC(stv_rtc_increment));
31632631}
r11594r11595
31652633
31662634static MACHINE_START( saturn )
31672635{
3168   scsp_set_ram_base(machine.device("scsp"), sound_ram);
2636   saturn_state *state = machine.driver_data<saturn_state>();
2637   scsp_set_ram_base(machine.device("scsp"), state->m_sound_ram);
31692638
31702639   // save states
3171   state_save_register_global_pointer(machine, smpc_ram, 0x80);
3172   state_save_register_global_pointer(machine, stv_scu, 0x100/4);
2640   state_save_register_global_pointer(machine, state->m_smpc_ram, 0x80);
2641   state_save_register_global_pointer(machine, state->m_scu_regs, 0x100/4);
31732642   state_save_register_global_pointer(machine, scsp_regs, 0x1000/2);
31742643   state_save_register_global(machine, stv_vblank);
31752644   state_save_register_global(machine, stv_hblank);
3176   state_save_register_global(machine, stv_enable_slave_sh2);
3177   state_save_register_global(machine, NMI_reset);
3178   state_save_register_global(machine, en_68k);
2645   state_save_register_global(machine, state->m_NMI_reset);
2646   state_save_register_global(machine, state->m_en_68k);
31792647   state_save_register_global(machine, timer_0);
31802648   state_save_register_global(machine, timer_1);
31812649   state_save_register_global(machine, IOSEL1);
r11594r11595
32772745} \
32782746
32792747#define HBLANK_IN_IRQ(m) \
3280timer_1 = stv_scu[37] & 0x1ff; \
2748timer_1 = state->m_scu_regs[37] & 0x1ff; \
32812749{ \
32822750   /*if(LOG_IRQ) logerror ("Interrupt: HBlank-In at scanline %04x, Vector 0x42 Level 0x0d\n",scanline);*/ \
32832751   cputag_set_input_line_and_vector(m, "maincpu", 0xd, (stv_irq.hblank_in) ? HOLD_LINE : CLEAR_LINE, 0x42); \
32842752} \
32852753
32862754#define TIMER_0_IRQ(m) \
3287if(timer_0 == (stv_scu[36] & 0x3ff)) \
2755if(timer_0 == (state->m_scu_regs[36] & 0x3ff)) \
32882756{ \
32892757   /*if(LOG_IRQ) logerror ("Interrupt: Timer 0 at scanline %04x, Vector 0x43 Level 0x0c\n",scanline);*/ \
32902758   cputag_set_input_line_and_vector(m, "maincpu", 0xc, (stv_irq.timer_0) ? HOLD_LINE : CLEAR_LINE, 0x43 ); \
32912759} \
32922760
32932761#define TIMER_1_IRQ(m)   \
3294if((stv_scu[38] & 1)) \
2762if((state->m_scu_regs[38] & 1)) \
32952763{ \
3296   if(!(stv_scu[38] & 0x80)) \
2764   if(!(state->m_scu_regs[38] & 0x80)) \
32972765   { \
32982766      /*if(LOG_IRQ) logerror ("Interrupt: Timer 1 at point %04x, Vector 0x44 Level 0x0b\n",point);*/ \
32992767      cputag_set_input_line_and_vector(m, "maincpu", 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \
33002768   } \
33012769   else \
33022770   { \
3303      if((timer_0) == (stv_scu[36] & 0x3ff)) \
2771      if((timer_0) == (state->m_scu_regs[36] & 0x3ff)) \
33042772      { \
33052773         /*if(LOG_IRQ) logerror ("Interrupt: Timer 1 at point %04x, Vector 0x44 Level 0x0b\n",point);*/ \
33062774         cputag_set_input_line_and_vector(m, "maincpu", 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \
r11594r11595
33152783
33162784static TIMER_DEVICE_CALLBACK( hblank_in_irq )
33172785{
2786   saturn_state *state = timer.machine().driver_data<saturn_state>();
33182787   int scanline = param;
33192788
33202789//  h = timer.machine().primary_screen->height();
r11594r11595
33382807
33392808static TIMER_DEVICE_CALLBACK( timer1_irq )
33402809{
2810   saturn_state *state = timer.machine().driver_data<saturn_state>();
33412811   int scanline = param;
33422812
33432813   TIMER_1_IRQ(timer.machine());
r11594r11595
33822852
33832853static MACHINE_RESET( saturn )
33842854{
2855   saturn_state *state = machine.driver_data<saturn_state>();
33852856   // don't let the slave cpu and the 68k go anywhere
33862857   cputag_set_input_line(machine, "slave", INPUT_LINE_RESET, ASSERT_LINE);
3387   stv_enable_slave_sh2 = 0;
33882858   cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
33892859
33902860   smpcSR = 0x40;   // this bit is always on according to docs
33912861
33922862   timer_0 = 0;
33932863   timer_1 = 0;
3394   en_68k = 0;
3395   NMI_reset = 1;
3396   smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
2864   state->m_en_68k = 0;
2865   state->m_NMI_reset = 1;
2866   state->m_smpc_ram[0x21] = (0x80) | ((state->m_NMI_reset & 1) << 6);
33972867
33982868   DMA_STATUS = 0;
33992869
3400   memset(stv_workram_l, 0, 0x100000);
3401   memset(stv_workram_h, 0, 0x100000);
2870   //memset(stv_m_workram_l, 0, 0x100000);
2871   //memset(stv_m_workram_h, 0, 0x100000);
34022872
34032873   machine.device("maincpu")->set_unscaled_clock(MASTER_CLOCK_320/2);
34042874   machine.device("slave")->set_unscaled_clock(MASTER_CLOCK_320/2);
r11594r11595
34172887
34182888static MACHINE_RESET( stv )
34192889{
2890   saturn_state *state = machine.driver_data<saturn_state>();
2891
34202892   // don't let the slave cpu and the 68k go anywhere
34212893   cputag_set_input_line(machine, "slave", INPUT_LINE_RESET, ASSERT_LINE);
3422   stv_enable_slave_sh2 = 0;
34232894   cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
34242895
34252896   timer_0 = 0;
34262897   timer_1 = 0;
3427   en_68k = 0;
3428   NMI_reset = 1;
3429   smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
2898   state->m_en_68k = 0;
2899   state->m_NMI_reset = 1;
2900   state->m_smpc_ram[0x21] = (0x80) | ((state->m_NMI_reset & 1) << 6);
34302901
34312902   port_sel = mux_data = 0;
34322903   port_i = -1;
r11594r11595
34452916   scan_timer->adjust(machine.primary_screen->time_until_pos(224, 352));
34462917
34472918   stv_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1));
2919   state->m_prev_bankswitch = 0xff;
34482920}
34492921
34502922
r11594r11595
35463018   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
35473019MACHINE_CONFIG_END
35483020
3021struct stv_cart_region
3022{
3023   const char *tag;
3024   int        slot;
3025   const char *region;
3026};
35493027
3028static const struct stv_cart_region stv_cart_table[] =
3029{
3030   { "cart1", 0, "game0" },
3031   { "cart2", 1, "game1" },
3032   { "cart3", 2, "game2" },
3033   { "cart4", 3, "game3" },
3034   { 0 }
3035};
35503036
3037static DEVICE_IMAGE_LOAD( stv_cart )
3038{
3039//   saturn_state *state = image.device().machine().driver_data<saturn_state>();
3040   const struct stv_cart_region *stv_cart = &stv_cart_table[0], *this_cart;
3041   //const char   *pcb_name;
3042
3043   /* First, determine where this cart has to be loaded */
3044   while (stv_cart->tag)
3045   {
3046      if (strcmp(stv_cart->tag, image.device().tag()) == 0)
3047         break;
3048
3049      stv_cart++;
3050   }
3051
3052   this_cart = stv_cart;
3053
3054   if (image.software_entry() == NULL)
3055      return IMAGE_INIT_FAIL;
3056
3057   UINT8 *ROM = image.device().machine().region(this_cart->region)->base();
3058   UINT32 length = image.get_software_region_length("rom");
3059
3060   memcpy(ROM, image.get_software_region("rom"), length);
3061
3062   /* fix endianess */
3063   {
3064      UINT8 j[4];
3065      int i;
3066
3067      for(i=0;i<length;i+=4)
3068      {
3069         j[0] = ROM[i];
3070         j[1] = ROM[i+1];
3071         j[2] = ROM[i+2];
3072         j[3] = ROM[i+3];
3073         ROM[i] = j[3];
3074         ROM[i+1] = j[2];
3075         ROM[i+2] = j[1];
3076         ROM[i+3] = j[0];
3077      }
3078   }
3079
3080   //if ((pcb_name = image.get_feature("pcb_type")) == NULL)
3081   //   return IMAGE_INIT_FAIL;
3082
3083   return IMAGE_INIT_PASS;
3084}
3085
3086
3087#define MCFG_STV_CARTSLOT_ADD(_tag) \
3088   MCFG_CARTSLOT_ADD(_tag) \
3089   MCFG_CARTSLOT_INTERFACE("stv_cart") \
3090   MCFG_CARTSLOT_LOAD(stv_cart)
3091
3092MACHINE_CONFIG_FRAGMENT( stv_cartslot )
3093   MCFG_STV_CARTSLOT_ADD("cart1")
3094   MCFG_STV_CARTSLOT_ADD("cart2")
3095   MCFG_STV_CARTSLOT_ADD("cart3")
3096   MCFG_STV_CARTSLOT_ADD("cart4")
3097
3098   MCFG_SOFTWARE_LIST_ADD("cart_list","stv")
3099MACHINE_CONFIG_END
3100
3101static MACHINE_CONFIG_DERIVED( stv_slot, stv )
3102   MCFG_FRAGMENT_ADD( stv_cartslot )
3103MACHINE_CONFIG_END
3104
3105
35513106static void saturn_init_driver(running_machine &machine, int rgn)
35523107{
3108   saturn_state *state = machine.driver_data<saturn_state>();
35533109   system_time systime;
35543110
35553111   saturn_region = rgn;
r11594r11595
35673123   minit_boost_timeslice = attotime::zero;
35683124   sinit_boost_timeslice = attotime::zero;
35693125
3570   smpc_ram = auto_alloc_array(machine, UINT8, 0x80);
3571   stv_scu = auto_alloc_array(machine, UINT32, 0x100/4);
3126   state->m_smpc_ram = auto_alloc_array(machine, UINT8, 0x80);
3127   state->m_scu_regs = auto_alloc_array(machine, UINT32, 0x100/4);
35723128   scsp_regs = auto_alloc_array(machine, UINT16, 0x1000/2);
35733129
3574   smpc_ram[0x23] = dec_2_bcd(systime.local_time.year / 100);
3575   smpc_ram[0x25] = dec_2_bcd(systime.local_time.year % 100);
3576   smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month + 1);
3577   smpc_ram[0x29] = dec_2_bcd(systime.local_time.mday);
3578   smpc_ram[0x2b] = dec_2_bcd(systime.local_time.hour);
3579   smpc_ram[0x2d] = dec_2_bcd(systime.local_time.minute);
3580   smpc_ram[0x2f] = dec_2_bcd(systime.local_time.second);
3581   smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??)
3582//  smpc_ram[0x33] = input_port_read(machine, "???");
3583   smpc_ram[0x5f] = 0x10;
3130   state->m_smpc_ram[0x23] = dec_2_bcd(systime.local_time.year / 100);
3131   state->m_smpc_ram[0x25] = dec_2_bcd(systime.local_time.year % 100);
3132   state->m_smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month + 1);
3133   state->m_smpc_ram[0x29] = dec_2_bcd(systime.local_time.mday);
3134   state->m_smpc_ram[0x2b] = dec_2_bcd(systime.local_time.hour);
3135   state->m_smpc_ram[0x2d] = dec_2_bcd(systime.local_time.minute);
3136   state->m_smpc_ram[0x2f] = dec_2_bcd(systime.local_time.second);
3137   state->m_smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??)
3138//  state->m_smpc_ram[0x33] = input_port_read(machine, "???");
3139   state->m_smpc_ram[0x5f] = 0x10;
35843140}
35853141
35863142static DRIVER_INIT( saturnus )
r11594r11595
37123268   \
37133269   ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ \
37143270   ROM_COPY( "maincpu",0,0,0x080000) \
3271   \
3272   ROM_REGION32_BE( 0x3000000, "abus", ROMREGION_ERASE00 ) /* SH2 code */ \
37153273
3274
37163275ROM_START( stvbios )
37173276   STV_BIOS
3718   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3277   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 )
3278
3279   ROM_REGION32_BE( 0x3000000, "game1", ROMREGION_ERASE00 )
3280
3281   ROM_REGION32_BE( 0x3000000, "game2", ROMREGION_ERASE00 )
3282
3283   ROM_REGION32_BE( 0x3000000, "game3", ROMREGION_ERASE00 )
37193284ROM_END
37203285
37213286/*
r11594r11595
37503315ROM_START( astrass )
37513316   STV_BIOS
37523317
3753   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3318   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
37543319
37553320   ROM_LOAD16_BYTE( "epr20825.13",                0x0000001, 0x0100000, CRC(94a9ad8f) SHA1(861311c14cfa9f560752aa5b023c147a539cf135) )
37563321
r11594r11595
37723337ROM_START( bakubaku )
37733338   STV_BIOS
37743339
3775   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3340   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
37763341
37773342   ROM_LOAD16_BYTE( "fpr17969.13",               0x0000001, 0x0100000, CRC(bee327e5) SHA1(1d226db72d6ef68fd294f60659df7f882b25def6) )
37783343
r11594r11595
37853350ROM_START( colmns97 )
37863351   STV_BIOS
37873352
3788   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3353   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
37893354
37903355   ROM_LOAD16_BYTE( "fpr19553.13",    0x000001, 0x100000, CRC(d4fb6a5e) SHA1(bd3cfb4f451b6c9612e42af5ddcbffa14f057329) )
37913356
r11594r11595
37963361ROM_START( cotton2 )
37973362   STV_BIOS
37983363
3799   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3364   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
38003365   ROM_LOAD16_WORD_SWAP( "mpr20122.7",    0x0200000, 0x0200000, CRC(d616f78a) SHA1(8039dcdfdafb8327a19a1da46a67c0b3f7eee53a) ) // good
38013366   ROM_LOAD16_WORD_SWAP( "mpr20117.2",    0x0400000, 0x0400000, CRC(893656ea) SHA1(11e3160083ba018fbd588f07061a4e55c1efbebb) ) // good
38023367   ROM_LOAD16_WORD_SWAP( "mpr20118.3",    0x0800000, 0x0400000, CRC(1b6a1d4c) SHA1(6b234d6b2d24df7f6d400a56698c0af2f78ce0e7) ) // good
r11594r11595
38103375ROM_START( cottonbm )
38113376   STV_BIOS
38123377
3813   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3378   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
38143379   ROM_LOAD16_WORD_SWAP( "mpr21075.7",    0x0200000, 0x0200000, CRC(200b58ba) SHA1(6daad6d70a3a41172e8d9402af775c03e191232d) ) // good
38153380   ROM_LOAD16_WORD_SWAP( "mpr21070.2",    0x0400000, 0x0400000, CRC(56c0bf1d) SHA1(c2b564ce536c637bb723ed96683b27596e87ebe7) ) // good
38163381   ROM_LOAD16_WORD_SWAP( "mpr21071.3",    0x0800000, 0x0400000, CRC(2bb18df2) SHA1(e900adb94ad3f48be00a4ce33e915147dc6a8737) ) // good
r11594r11595
38233388ROM_START( decathlt )
38243389   STV_BIOS
38253390
3826   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3391   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
38273392
38283393   ROM_LOAD16_BYTE( "epr18967a.13",               0x0000001, 0x0100000, CRC(ac59c186) SHA1(7d4924d1e4c1b9257b58a690de988b3f6486e86f) )
38293394
r11594r11595
38373402ROM_START( decathlto )
38383403   STV_BIOS
38393404
3840   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3405   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
38413406
38423407   ROM_LOAD16_BYTE( "epr18967.13",               0x0000001, 0x0100000, CRC(c0446674) SHA1(4917089d95613c9d2a936ed9fe3ebd22f461aa4f) )
38433408
r11594r11595
38523417   STV_BIOS
38533418   ROM_DEFAULT_BIOS( "us" )
38543419
3855   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3420   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
38563421
38573422   ROM_LOAD16_BYTE( "fpr19119.13",               0x0000001, 0x0100000, CRC(de5c4f7c) SHA1(35f670a15e9c86edbe2fe718470f5a75b5b096ac) )
38583423
r11594r11595
38653430ROM_START( dnmtdeka )
38663431   STV_BIOS
38673432
3868   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3433   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
38693434
38703435   ROM_LOAD16_BYTE( "fpr19114.13",               0x0000001, 0x0100000, CRC(1fd22a5f) SHA1(c3d9653b12354a73a3e15f23a2ab7992ffb83e46) )
38713436
r11594r11595
38783443ROM_START( ejihon )
38793444   STV_BIOS
38803445
3881   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3446   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
38823447   ROM_LOAD16_BYTE( "epr18137.13",               0x0000001, 0x0080000, CRC(151aa9bc) SHA1(0959c60f31634816825acb57413838dcddb17d31) )
38833448   ROM_RELOAD( 0x100001, 0x0080000 )
38843449
r11594r11595
38923457ROM_START( elandore )
38933458   STV_BIOS
38943459
3895   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3460   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
38963461   ROM_LOAD16_WORD_SWAP( "mpr21307.7",    0x0200000, 0x0200000, CRC(966ad472) SHA1(d6db41d1c40d08eb6bce8a8a2f491e7533daf670) ) // good (was .11s)
38973462   ROM_LOAD16_WORD_SWAP( "mpr21301.2",    0x0400000, 0x0400000, CRC(1a23b0a0) SHA1(f9dbc7ba96dadfb00e5827622b557080449acd83) ) // good (was .12)
38983463   ROM_LOAD16_WORD_SWAP( "mpr21302.3",    0x0800000, 0x0400000, CRC(1c91ca33) SHA1(ae11209088e3bf8fc4a92dca850d7303ce949b29) ) // good (was .13)
r11594r11595
39063471ROM_START( ffreveng )
39073472   STV_BIOS
39083473
3909   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3474   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
39103475   ROM_LOAD16_WORD_SWAP( "opr21872.7",   0x0200000, 0x0200000, CRC(32d36fee) SHA1(441c4254ef2e9301e1006d69462a850ce339314b) ) // good (was .11s)
39113476   ROM_LOAD16_WORD_SWAP( "mpr21873.2",   0x0400000, 0x0400000, CRC(dac5bd98) SHA1(6102035ce9eb2f83d7d9b20f989a151f45087c67) ) // good (was .12)
39123477   ROM_LOAD16_WORD_SWAP( "mpr21874.3",   0x0800000, 0x0400000, CRC(0a7be2f1) SHA1(e2d13f36e54d1e2cb9d584db829c04a6ff65108c) ) // good (was .13)
r11594r11595
39203485ROM_START( fhboxers )
39213486   STV_BIOS
39223487
3923   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3488   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
39243489   ROM_LOAD16_BYTE( "fr18541a.13",               0x0000001, 0x0100000, CRC(8c61a17c) SHA1(a8aef27b53482923a506f7daa4b7a38653b4d8a4) ) //(header is read from here, not ic7 even if both are populated on this board)
39253490
39263491   ROM_LOAD16_WORD_SWAP( "mpr18538.7",    0x0200000, 0x0200000, CRC(7b5230c5) SHA1(70cebc3281580b43adf42c37318e12159c28a13d) ) // good
r11594r11595
39413506ROM_START( findlove )
39423507   STV_BIOS
39433508
3944   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3509   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
39453510   ROM_LOAD16_BYTE( "epr20424.13",               0x0000001, 0x0100000, CRC(4e61fa46) SHA1(e34624d98cbdf2dd04d997167d3c4decd2f208f7) ) //(header is read from here, not ic7 even if both are populated on this board)
39463511
39473512   ROM_LOAD16_WORD_SWAP( "mpr20431.7",    0x0200000, 0x0200000, CRC(ea656ced) SHA1(b2d6286081bd46a89d1284a2757b87d0bca1bbde) ) // good
r11594r11595
39643529ROM_START( finlarch )
39653530   STV_BIOS
39663531
3967   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3532   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
39683533   ROM_LOAD16_BYTE( "finlarch.13",               0x0000001, 0x0100000, CRC(4505fa9e) SHA1(96c6399146cf9c8f1d27a8fb6a265f937258004a) )
39693534   ROM_RELOAD ( 0x0100001, 0x0080000 )
39703535
r11594r11595
39823547ROM_START( gaxeduel )
39833548   STV_BIOS
39843549
3985   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3550   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
39863551   ROM_LOAD16_BYTE( "epr17766.13",               0x0000001, 0x0080000, CRC(a83fcd62) SHA1(4ce77ebaa0e93c6553ad8f7fb87cbdc32433402b) )
39873552   ROM_RELOAD( 0x0100001, 0x0080000 )
39883553
r11594r11595
39973562ROM_START( grdforce )
39983563   STV_BIOS
39993564
4000   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3565   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
40013566   ROM_LOAD16_WORD_SWAP( "mpr20844.7",    0x0200000, 0x0200000, CRC(283e7587) SHA1(477fabc27cfe149ad17757e31f10665dcf8c0860) ) // good
40023567   ROM_LOAD16_WORD_SWAP( "mpr20839.2",    0x0400000, 0x0400000, CRC(facd4dd8) SHA1(2582894c98b31ab719f1865d4623dad6736dc877) ) // good
40033568   ROM_LOAD16_WORD_SWAP( "mpr20840.3",    0x0800000, 0x0400000, CRC(fe0158e6) SHA1(73460effe69fb8f16dd952271542b7803471a599) ) // good
r11594r11595
40093574ROM_START( groovef )
40103575   STV_BIOS
40113576
4012   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3577   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
40133578   ROM_LOAD16_WORD_SWAP( "mpr19820.7",    0x0200000, 0x0100000, CRC(e93c4513) SHA1(f9636529224880c49bd2cc5572bd5bf41dbf911a) ) // good
40143579   ROM_LOAD16_WORD_SWAP( "mpr19815.2",    0x0400000, 0x0400000, CRC(1b9b14e6) SHA1(b1828c520cb108e2927a23273ebd2939dca52304) ) // good
40153580   ROM_LOAD16_WORD_SWAP( "mpr19816.3",    0x0800000, 0x0400000, CRC(83f5731c) SHA1(2f645737f945c59a1a2fabf3b21a761be9e8c8a6) ) // good
r11594r11595
40243589ROM_START( hanagumi )
40253590   STV_BIOS
40263591
4027   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3592   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
40283593   ROM_LOAD16_WORD_SWAP( "mpr20143.7",    0x0200000, 0x0100000, CRC(7bfc38d0) SHA1(66f223e7ff2b5456a6f4185b7ab36f9cd833351a) ) // good
40293594   ROM_LOAD16_WORD_SWAP( "mpr20138.2",    0x0400000, 0x0400000, CRC(fdcf1046) SHA1(cbb1f03879833c17feffdd6f5a4fbff06e1059a2) ) // good
40303595   ROM_LOAD16_WORD_SWAP( "mpr20139.3",    0x0800000, 0x0400000, CRC(7f0140e5) SHA1(f2f7de7620d66a596d552e1af491a0592ebc4e51) ) // good
r11594r11595
40423607ROM_START( introdon )
40433608   STV_BIOS
40443609
4045   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3610   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
40463611   ROM_LOAD16_BYTE( "epr18937.13",               0x0000001, 0x0080000, CRC(1f40d766) SHA1(35d9751c1b23cfbf448f2a9e9cf3b121929368ae) )
40473612   ROM_RELOAD( 0x0100001, 0x0080000)
40483613
r11594r11595
40593624ROM_START( kiwames )
40603625   STV_BIOS
40613626
4062   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3627   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
40633628   ROM_LOAD16_BYTE( "epr18737.13",               0x0000001, 0x0080000, CRC(cfad6c49) SHA1(fc69980a351ed13307706db506c79c774eabeb66) ) // bad
40643629   ROM_RELOAD( 0x0100001, 0x0080000)
40653630
r11594r11595
40743639ROM_START( maruchan )
40753640   STV_BIOS
40763641
4077   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3642   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
40783643   ROM_LOAD16_BYTE( "epr20416.13",               0x0000001, 0x0100000, CRC(8bf0176d) SHA1(5bd468e2ffed042ee84e2ceb8712ff5883a1d824) ) // bad
40793644
40803645   ROM_LOAD16_WORD_SWAP( "mpr20417.2",    0x0400000, 0x0400000, CRC(636c2a08) SHA1(47986b71d68f6a1852e4e2b03ca7b6e48e83718b) ) // good
r11594r11595
40913656ROM_START( myfairld )
40923657   STV_BIOS
40933658
4094   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3659   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
40953660   ROM_LOAD16_WORD_SWAP( "mpr21000.7",    0x0200000, 0x0200000, CRC(2581c560) SHA1(5fb64f0e09583d50dfea7ad613d45aad30b677a5) ) // good
40963661   ROM_LOAD16_WORD_SWAP( "mpr20995.2",    0x0400000, 0x0400000, CRC(1bb73f24) SHA1(8773654810de760c5dffbb561f43e259b074a61b) ) // good
40973662   ROM_LOAD16_WORD_SWAP( "mpr20996.3",    0x0800000, 0x0400000, CRC(993c3859) SHA1(93f95e3e080a08961784482607919c1ab3eeb5e5) ) // good
r11594r11595
41083673ROM_START( othellos )
41093674   STV_BIOS
41103675
4111   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3676   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
41123677   ROM_LOAD16_WORD_SWAP( "mpr20967.7",    0x0200000, 0x0200000, CRC(efc05b97) SHA1(a533366c3aaba90dcac8f3654db9ad902efca258) ) // good
41133678   ROM_LOAD16_WORD_SWAP( "mpr20963.2",    0x0400000, 0x0400000, CRC(2cc4f141) SHA1(8bd1998aff8615b34d119fab3637a08ed6e8e1e4) ) // good
41143679   ROM_LOAD16_WORD_SWAP( "mpr20964.3",    0x0800000, 0x0400000, CRC(5f5cda94) SHA1(616be219a2512e80c875eddf05137c23aedf6f65) ) // good
r11594r11595
41193684ROM_START( pblbeach )
41203685   STV_BIOS
41213686
4122   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3687   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
41233688   ROM_LOAD16_BYTE( "epr18852.13",               0x0000001, 0x0080000, CRC(d12414ec) SHA1(0f42ec9e41983781b6892622b00398a102072aa7) ) // bad
41243689   ROM_RELOAD ( 0x0100001, 0x0080000 )
41253690
r11594r11595
41323697ROM_START( prikura )
41333698   STV_BIOS
41343699
4135   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3700   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
41363701   ROM_LOAD16_WORD_SWAP( "mpr19337.7",    0x0200000, 0x0200000, CRC(76f69ff3) SHA1(5af2e1eb3288d70c2a1c71d0b6370125d65c7757) ) // good
41373702   ROM_LOAD16_WORD_SWAP( "mpr19333.2",    0x0400000, 0x0400000, CRC(eb57a6a6) SHA1(cdacaa7a2fb1a343195e2ac5fd02eabf27f89ccd) ) // good
41383703   ROM_LOAD16_WORD_SWAP( "mpr19334.3",    0x0800000, 0x0400000, CRC(c9979981) SHA1(be491a4ac118d5025d6a6f2d9267a6d52f21d2b6) ) // good
r11594r11595
41433708ROM_START( puyosun )
41443709   STV_BIOS
41453710
4146   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3711   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
41473712   ROM_LOAD16_BYTE( "epr19531.13",               0x0000001, 0x0080000, CRC(ac81024f) SHA1(b22c7c1798fade7ae992ff83b138dd23e6292d3f) ) // bad
41483713   ROM_RELOAD ( 0x0100001, 0x0080000 )
41493714
r11594r11595
41603725ROM_START( rsgun )
41613726   STV_BIOS
41623727
4163   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3728   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
41643729   ROM_LOAD16_WORD_SWAP( "mpr20958.7",   0x0200000, 0x0200000, CRC(cbe5a449) SHA1(b4744ab71ccbadda1921ba43dd1148e57c0f84c5) ) // good (was .11s)
41653730   ROM_LOAD16_WORD_SWAP( "mpr20959.2",   0x0400000, 0x0400000, CRC(a953330b) SHA1(965274a7297cb88e281fcbdd3ec5025c6463cc7b) ) // good (was .12)
41663731   ROM_LOAD16_WORD_SWAP( "mpr20960.3",   0x0800000, 0x0400000, CRC(b5ab9053) SHA1(87c5d077eb1219c35fa65b4e11d5b62e826f5236) ) // good (was .13)
r11594r11595
41733738ROM_START( sandor )
41743739   STV_BIOS
41753740
4176   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3741   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
41773742   ROM_LOAD16_BYTE( "sando-r.13",               0x0000001, 0x0100000, CRC(fe63a239) SHA1(01502d4494f968443581cd2c74f25967d41f775e) )
41783743
41793744   ROM_LOAD16_WORD_SWAP( "mpr18635.8",   0x1c00000, 0x0400000, CRC(441e1368) SHA1(acb2a7e8d44c2203b8d3c7a7b70e20ffb120bebf) ) // good
r11594r11595
42053770ROM_START( thunt )
42063771   STV_BIOS
42073772
4208   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3773   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
42093774   ROM_LOAD16_BYTE( "th-ic7_2.stv",    0x0200000, 0x0080000, CRC(c4e993de) SHA1(7aa433bc2623cb19a09d4ef4c8233a2d29901020) )
42103775   ROM_LOAD16_BYTE( "th-ic7_1.stv",    0x0200001, 0x0080000, CRC(1355cc18) SHA1(a9b731228a807b2b01f933fe0f7dcdbadaf89b7e) )
42113776
r11594r11595
42183783ROM_START( thuntk )
42193784   STV_BIOS
42203785
4221   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3786   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
42223787   ROM_LOAD16_BYTE( "2.ic13_2",    0x0200000, 0x0080000, CRC(6cae2926) SHA1(e8d5745b4228de24672da5017cb3dab58344f59f) )
42233788   ROM_LOAD16_BYTE( "1.ic13_1",    0x0200001, 0x0080000, CRC(460727c8) SHA1(da7171b65734264e10692e3408ac93beb374c65e) )
42243789
r11594r11595
42363801ROM_START( sanjeon )
42373802   STV_BIOS
42383803
4239   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3804   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
42403805   ROM_LOAD16_BYTE( "ic11",               0x0000001, 0x0200000, CRC(9abae8d4) SHA1(ddbe4c8fff8fa59d63e278e95f245145d2da8aeb) )
42413806
42423807   ROM_LOAD( "ic13",    0x0400000, 0x0200000, CRC(f72c1d13) SHA1(a2b168d187034024b83fbbe2f5eec78816285da9) ) // ic2 good
r11594r11595
42563821ROM_START( sasissu )
42573822   STV_BIOS
42583823
4259   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3824   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
42603825   ROM_LOAD16_BYTE( "epr20542.13",               0x0000001, 0x0100000, CRC(0e632db5) SHA1(9bc52794892eec22d381387d13a0388042e30714) )
42613826
42623827   ROM_LOAD16_WORD_SWAP( "mpr20544.2",    0x0400000, 0x0400000, CRC(661fff5e) SHA1(41f4ddda7adf004b52cc9a076606a60f31947d19) ) // good
r11594r11595
42713836ROM_START( seabass )
42723837   STV_BIOS
42733838
4274   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3839   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
42753840   ROM_LOAD16_BYTE( "seabassf.13",               0x0000001, 0x0100000, CRC(6d7c39cc) SHA1(d9d1663134420b75c65ee07d7d547254785f2f83) )
42763841
42773842   ROM_LOAD16_WORD_SWAP( "mpr20551.2",    0x0400000, 0x0400000, CRC(9a0c6dd8) SHA1(26600372cc673ce3678945f4b5dc4e3ab31643a4) ) // good
r11594r11595
42903855ROM_START( shanhigw )
42913856   STV_BIOS
42923857
4293   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3858   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
42943859   ROM_LOAD16_WORD_SWAP( "mpr18341.7",    0x0200000, 0x0200000, CRC(cc5e8646) SHA1(a733616c118140ff3887d30d595533f9a1beae06) ) // good
42953860   ROM_LOAD16_WORD_SWAP( "mpr18340.2",    0x0400000, 0x0200000, CRC(8db23212) SHA1(85d604a5c6ab97188716dbcd77d365af12a238fe) ) // good
42963861ROM_END
r11594r11595
42983863ROM_START( shienryu )
42993864   STV_BIOS
43003865
4301   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3866   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
43023867   ROM_LOAD16_WORD_SWAP( "mpr19631.7",    0x0200000, 0x0200000, CRC(3a4b1abc) SHA1(3b14b7fdebd4817da32ea374c15a38c695ffeff1) ) // good
43033868   ROM_LOAD16_WORD_SWAP( "mpr19632.2",    0x0400000, 0x0400000, CRC(985fae46) SHA1(f953bde91805b97b60d2ab9270f9d2933e064d95) ) // good
43043869   ROM_LOAD16_WORD_SWAP( "mpr19633.3",    0x0800000, 0x0400000, CRC(e2f0b037) SHA1(97861d09e10ce5d2b10bf5559574b3f489e28077) ) // good
r11594r11595
43113876   STV_BIOS
43123877   ROM_DEFAULT_BIOS( "us" )
43133878
4314   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3879   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
43153880   ROM_LOAD16_BYTE( "epr18777.13",               0x0000001, 0x0080000, CRC(8d180866) SHA1(d47ebabab6e06400312d39f68cd818852e496b96) )
43163881   ROM_RELOAD ( 0x0100001, 0x0080000 )
43173882
r11594r11595
43253890ROM_START( sokyugrt )
43263891   STV_BIOS
43273892
4328   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3893   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
43293894   ROM_LOAD16_BYTE( "fpr19188.13",               0x0000001, 0x0100000, CRC(45a27e32) SHA1(96e1bab8bdadf7071afac2a0a6dd8fd8989f12a6) )
43303895
43313896   ROM_LOAD16_WORD_SWAP( "mpr19189.2",    0x0400000, 0x0400000, CRC(0b202a3e) SHA1(6691b5af2cacd6092ec03886b78c2565953fa297) ) // good
r11594r11595
43383903ROM_START( sss )
43393904   STV_BIOS
43403905
4341   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3906   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
43423907   ROM_LOAD16_BYTE( "epr21488.13",               0x0000001, 0x0080000, CRC(71c9def1) SHA1(a544a0b4046307172d2c1bf426ed24845f87d894) )
43433908   ROM_RELOAD ( 0x0100001, 0x0080000 )
43443909
r11594r11595
43553920ROM_START( suikoenb )
43563921   STV_BIOS
43573922
4358   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3923   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
43593924   ROM_LOAD16_BYTE( "fpr17834.13",               0x0000001, 0x0100000, CRC(746ef686) SHA1(e31c317991a687662a8a2a45aed411001e5f1941) )
43603925
43613926   ROM_LOAD16_WORD_SWAP( "mpr17836.2",    0x0400000, 0x0400000, CRC(55e9642d) SHA1(5198291cd1dce0398eb47760db2c19eae99273b0) ) // good
r11594r11595
43713936ROM_START( twcup98 )
43723937   STV_BIOS
43733938
4374   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3939   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
43753940   ROM_LOAD16_BYTE( "epr20819.13",    0x0000001, 0x0100000, CRC(d930dfc8) SHA1(f66cc955181720661a0334fe67fa5750ddf9758b) )
43763941
43773942   ROM_LOAD16_WORD_SWAP( "mpr20821.2",    0x0400000, 0x0400000, CRC(2d930d23) SHA1(5fcaf4257f3639cb3aa407d2936f616499a09d97) ) // ic2 good (was .12)
r11594r11595
43833948ROM_START( vfkids )
43843949   STV_BIOS
43853950
4386   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3951   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
43873952   ROM_LOAD16_BYTE( "fpr18914.13",               0x0000001, 0x0100000, CRC(cd35730a) SHA1(645b52b449766beb740ab8f99957f8f431351ceb) )
43883953
43893954   ROM_LOAD16_WORD_SWAP( "mpr18916.4",    0x0c00000, 0x0400000, CRC(4aae3ddb) SHA1(b75479e73f1bce3f0c27fbd90820fa51eb1914a6) ) // good
r11594r11595
44003965ROM_START( vfremix )
44013966   STV_BIOS
44023967
4403   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3968   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
44043969   ROM_LOAD16_BYTE( "epr17944.13",               0x0000001, 0x0100000, CRC(a5bdc560) SHA1(d3830480a611b7d88760c672ce46a2ea74076487) )
44053970
44063971   ROM_LOAD16_WORD_SWAP( "mpr17946.2",    0x0400000, 0x0400000, CRC(4cb245f7) SHA1(363d9936b27043b5858c956a45736ac05aefc54e) ) // good
r11594r11595
44153980ROM_START( vmahjong )
44163981   STV_BIOS
44173982
4418   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
3983   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
44193984   ROM_LOAD16_WORD_SWAP( "mpr19620.7",    0x0200000, 0x0200000, CRC(c98de7e5) SHA1(5346f884793bcb080aa01967e91b54ced4a9802f) ) // good
44203985   ROM_LOAD16_WORD_SWAP( "mpr19615.2",    0x0400000, 0x0400000, CRC(c62896da) SHA1(52a5b10ca8af31295d2d700349eca038c418b522) ) // good
44213986   ROM_LOAD16_WORD_SWAP( "mpr19616.3",    0x0800000, 0x0400000, CRC(f62207c7) SHA1(87e60183365c6f7e62c7a0667f88df0c7f5457fd) ) // good
r11594r11595
44323997ROM_START( winterht )
44333998   STV_BIOS
44343999
4435   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4000   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
44364001   ROM_LOAD16_BYTE( "fpr20108.13",    0x0000001, 0x0100000, CRC(1ef9ced0) SHA1(abc90ce341cd17bb77349d611d6879389611f0bf) ) // bad
44374002
44384003   ROM_LOAD16_WORD_SWAP( "mpr20110.2",    0x0400000, 0x0400000, CRC(238ef832) SHA1(20fade5730ff8e249a1450c41bfdff6e133f4768) ) // good
r11594r11595
44474012ROM_START( znpwfv )
44484013   STV_BIOS
44494014
4450   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4015   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
44514016   ROM_LOAD16_BYTE( "epr20398.13",    0x0000001, 0x0100000, CRC(3fb56a0b) SHA1(13c2fa2d94b106d39e46f71d15fbce3607a5965a) ) // bad
44524017
44534018   ROM_LOAD16_WORD_SWAP( "mpr20400.2",    0x0400000, 0x0400000, CRC(1edfbe05) SHA1(b0edd3f3d57408101ae6eb0aec742afbb4d289ca) ) // good
r11594r11595
44644029ROM_START( danchih )
44654030   STV_BIOS
44664031
4467   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4032   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
44684033   ROM_LOAD16_WORD_SWAP( "mpr21974.7",    0x0200000, 0x0200000, CRC(e7472793) SHA1(11b7b11cf492eb9cf69b50e7cfac46a5b86849ac) )// good
44694034   ROM_LOAD16_WORD_SWAP( "mpr21970.2",    0x0400000, 0x0400000, CRC(34dd7f4d) SHA1(d5c45da94ec5b6584049caf09516f1ad4ba3adb5) )// good
44704035   ROM_LOAD16_WORD_SWAP( "mpr21971.3",    0x0800000, 0x0400000, CRC(8995158c) SHA1(fbbd171d67eebf43630d6054bc1b9132f6b38183) )// good
r11594r11595
44754040ROM_START( danchiq )
44764041   STV_BIOS
44774042
4478   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4043   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
44794044   ROM_LOAD16_WORD_SWAP( "ic22",    0x0200000, 0x0200000, CRC(e216bfc8) SHA1(7a08fa32281e272dbf5e7daea50a1800cc225c1b) )//ic 7
44804045   ROM_LOAD16_WORD_SWAP( "ic24",    0x0400000, 0x0200000, CRC(b95aa5ac) SHA1(2766c5414643034a0f6d746050557516bd3753df) )//ic 2
44814046   ROM_LOAD16_WORD_SWAP( "ic26",    0x0600000, 0x0200000, CRC(df6ebd48) SHA1(fcccafbee1b8b952b07ed0e7e86219eed9cf4a93) )
r11594r11595
44914056ROM_START( mausuke )
44924057   STV_BIOS
44934058
4494   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4059   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
44954060   ROM_LOAD16_BYTE(             "ic13.bin",      0x0000001, 0x0100000, CRC(b456f4cd) SHA1(91cbe703ec7c1dd45eb3b05bdfeb06e3570599d1) )
44964061   ROM_RELOAD_PLAIN ( 0x0200000, 0x0100000 ) // needs the rom mapped here to appear 'normal'
44974062   ROM_RELOAD_PLAIN ( 0x0300000, 0x0100000 )
r11594r11595
45094074ROM_START( batmanfr )
45104075   STV_BIOS
45114076
4512   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4077   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
45134078   /* Many thanks to Runik to point this out*/
45144079   ROM_LOAD16_BYTE( "350-mpa1.u19",    0x0000000, 0x0100000, CRC(2a5a8c3a) SHA1(374ec55a39ea909cc672e4a629422681d1f2da05) )
45154080   ROM_RELOAD(                         0x0200000, 0x0100000 )
r11594r11595
45544119   STV_BIOS
45554120   ROM_DEFAULT_BIOS( "euro" )
45564121
4557   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4122   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
45584123   ROM_LOAD16_BYTE( "epr-18821.ic13",  0x0000001, 0x0080000, CRC(9a6658e2) SHA1(16dbae3d9ab584713afcb403f89fe71049609245) )
45594124   ROM_RELOAD ( 0x0100001, 0x0080000 )
45604125
r11594r11595
45794144   ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */
45804145   ROM_COPY( "maincpu",0,0,0x080000)
45814146
4582   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4147   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
45834148   ROM_LOAD(             "epr18427.bin",      0x0000000, 0x0100000, CRC(3f25bec8) SHA1(43a5342b882d5aec0f35a8777cb475659f43b1c4) )
45844149   ROM_LOAD16_WORD_SWAP( "mpr18273.ic2",      0x0400000, 0x0200000, NO_DUMP )
45854150   ROM_LOAD16_WORD_SWAP( "mpr18274.ic3",      0x0800000, 0x0200000, NO_DUMP )
r11594r11595
45974162   ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */
45984163   ROM_COPY( "maincpu",0,0,0x080000)
45994164
4600   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4165   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
46014166   ROM_LOAD16_BYTE(             "epr18344.a",      0x0000001, 0x0100000,  CRC(5a7de018) SHA1(88e0c2a9a9d4ebf699878c0aa9737af85f95ccf8) )
46024167
46034168   ROM_LOAD16_WORD_SWAP( "mpr18273.ic2",      0x0400000, 0x0200000, NO_DUMP )
r11594r11595
46114176ROM_START( magzun )
46124177   STV_BIOS
46134178
4614   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4179   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
46154180   ROM_LOAD16_BYTE( "flash.ic13",               0x0000001, 0x0100000, CRC(e6f0aca0) SHA1(251d4d9c5a332d13af3a144c5eb9d8e7836bdd1b) ) // good
46164181
46174182   ROM_LOAD16_WORD_SWAP( "mpr-19354.ic2",    0x0400000, 0x0400000, CRC(a23822e7) SHA1(10ca5d39dcaaf35b80168a08d8a18d77fba1d2ce) ) // good
r11594r11595
46294194ROM_START( stress )
46304195   STV_BIOS
46314196
4632   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4197   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
46334198   ROM_LOAD16_BYTE( "epr-21300a.ic13",    0x0000001, 0x0100000, CRC(899d829e) SHA1(b6c6da92dc108353998b29c0659d288645541519) ) // good
46344199
46354200   ROM_LOAD16_WORD_SWAP( "mpr-21290.ic2",    0x0400000, 0x0400000, CRC(a49d29f3) SHA1(8f6c26fd9e94a9e03dd0029026d205cf481fe151) ) // good
r11594r11595
46484213ROM_START( nclubv3 )
46494214   STV_BIOS
46504215
4651   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4216   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
46524217
46534218   ROM_LOAD16_WORD_SWAP( "ic22",    0x0200000, 0x0200000, CRC(b4008ed0) SHA1(acb3784acad971eb5f4920760dc23a16330e7bad) ) // OK
46544219   ROM_LOAD16_WORD_SWAP( "ic24",    0x0400000, 0x0200000, CRC(4e894850) SHA1(eb7c3399505a45816701197a45062b9f34e5a3e1) ) // OK
r11594r11595
46684233ROM_START( techbowl ) // set to 1p
46694234   STV_BIOS
46704235
4671   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4236   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
46724237
46734238   ROM_LOAD16_WORD_SWAP( "ic22",    0x0200000, 0x0200000, CRC(5058db21) SHA1(eec908bbfb9ec0fdca0002e69f32c1c030086456) ) // OK
46744239   ROM_LOAD16_WORD_SWAP( "ic24",    0x0400000, 0x0200000, CRC(34090f6d) SHA1(b8bc344ab826d5c9584afb01dba1c720b8dbc74d) ) // OK
r11594r11595
46834248ROM_START( micrombc ) // set to 1p
46844249   STV_BIOS
46854250
4686   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4251   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
46874252
46884253   ROM_LOAD16_WORD_SWAP( "ic22",    0x0200000, 0x0200000, CRC(8385bc45) SHA1(0bd60d7560cb2313d68470d0572850a7b8c501fd) ) // OK
46894254   ROM_LOAD16_WORD_SWAP( "ic24",    0x0400000, 0x0200000, CRC(84ecb42f) SHA1(005dee9a0912d4b1b7f5157bc3cde96548c1e348) ) // OK
r11594r11595
47024267   STV_BIOS
47034268   ROM_DEFAULT_BIOS( "us" )
47044269
4705   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4270   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
47064271
47074272   ROM_LOAD16_WORD_SWAP( "ic22",    0x0200000, 0x0200000, CRC(d2ceade7) SHA1(a4300322e582f403d9207290f3900e1a72fcb9b9) ) // OK
47084273   ROM_LOAD16_WORD_SWAP( "ic24",    0x0400000, 0x0200000, CRC(0e968c2d) SHA1(fbcc7533fcb6b87cd8255fc2d307ae618301ea64) ) // OK
r11594r11595
47184283   STV_BIOS
47194284   ROM_DEFAULT_BIOS( "us" )
47204285
4721   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4286   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
47224287
47234288   ROM_LOAD16_WORD_SWAP( "ic22",    0x0200000, 0x0200000, BAD_DUMP CRC(f88347aa) SHA1(3e9ca105edbd6ce11ea4194eb1733785e87f92b2) ) // BAD
47244289   ROM_LOAD16_WORD_SWAP( "ic24",    0x0400000, 0x0200000, CRC(b5871198) SHA1(10d187eebcca5d70c5ae10d1a144685a96491126) ) // OK
r11594r11595
47344299   STV_BIOS
47354300   ROM_DEFAULT_BIOS( "us" )
47364301
4737   ROM_REGION32_BE( 0x3000000, "user1", ROMREGION_ERASE00 ) /* SH2 code */
4302   ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
47384303
47394304   ROM_LOAD16_WORD_SWAP( "ic22",    0x0200000, 0x0200000, CRC(48ab8371) SHA1(1c2124afad6bc1f4de2619e6b915f78e91addf05) ) // OK
47404305   ROM_LOAD16_WORD_SWAP( "ic24",    0x0400000, 0x0200000, CRC(9915faea) SHA1(b96f64a8cbb1b9496bb566d0469975fddb4fbe98) ) // OK
r11594r11595
47694334
47704335static DRIVER_INIT( sanjeon )
47714336{
4772   UINT8 *src    = machine.region       ( "user1" )->base();
4337   UINT8 *src    = machine.region       ( "game0" )->base();
47734338   int x;
47744339
47754340   for (x=0;x<0x3000000;x++)
r11594r11595
47974362CONS( 1995, vsaturn,    saturn, 0,      saturn, saturn, saturnjp,   "JVC",      "V-Saturn",         GAME_NOT_WORKING )
47984363CONS( 1995, hisaturn,   saturn, 0,      saturn, saturn, saturnjp,   "Hitachi",  "HiSaturn",         GAME_NOT_WORKING )
47994364
4800GAME( 1996, stvbios,   0, stv, stv,  stv,       ROT0,   "Sega",                      "ST-V Bios", GAME_IS_BIOS_ROOT )
4365GAME( 1996, stvbios,   0,       stv_slot, stv,      stv,        ROT0,   "Sega",                         "ST-V Bios", GAME_IS_BIOS_ROOT )
48014366
48024367//GAME YEAR, NAME,     PARENT,  MACH, INP, INIT,      MONITOR
48034368/* Playable */
4804GAME( 1998, astrass,   stvbios, stv, stv,      astrass,   ROT0,   "Sunsoft",                 "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4805GAME( 1995, bakubaku,  stvbios, stv, stv,      stv,       ROT0,   "Sega",                    "Baku Baku Animal (J 950407 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
4806GAME( 1996, batmanfr,  stvbios, stv, batmanfr,   batmanfr,   ROT0,   "Acclaim",                 "Batman Forever (JUE 960507 V1.000)", GAME_NO_SOUND )
4807GAME( 1996, colmns97,  stvbios, stv, stv,      colmns97,   ROT0,   "Sega",                   "Columns '97 (JET 961209 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4808GAME( 1997, cotton2,   stvbios, stv, stv,      cotton2,   ROT0,   "Success",                 "Cotton 2 (JUET 970902 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4809GAME( 1998, cottonbm,  stvbios, stv, stv,      cottonbm,   ROT0,   "Success",                 "Cotton Boomerang (JUET 980709 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4810GAME( 1995, critcrsh,  stvbios, stv, critcrsh,   stv,      ROT0,   "Sega",                    "Critter Crusher (EA 951204 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4811GAME( 1999, danchih,   stvbios, stv, stvmp,      danchih,   ROT0,   "Altron (Tecmo license)",      "Danchi de Hanafuda (J 990607 V1.400)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4812GAME( 2000, danchiq,   stvbios, stv, stv,      danchih,   ROT0,   "Altron",                  "Danchi de Quiz Okusan Yontaku Desuyo! (J 001128 V1.200)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4813GAME( 1996, diehard,   stvbios, stv, stv,      diehard,   ROT0,   "Sega",                   "Die Hard Arcade (UET 960515 V1.000)", GAME_IMPERFECT_SOUND  )
4814GAME( 1996, dnmtdeka,  diehard, stv, stv,      dnmtdeka,   ROT0,   "Sega",                   "Dynamite Deka (J 960515 V1.000)", GAME_IMPERFECT_SOUND  )
4815GAME( 1995, ejihon,    stvbios, stv, stv,      stv,       ROT0,   "Sega",                   "Ejihon Tantei Jimusyo (J 950613 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4816GAME( 1995, fhboxers,  stvbios, stv, stv,      fhboxers,   ROT0,   "Sega",                   "Funky Head Boxers (JUETBKAL 951218 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
4817GAME( 1994, gaxeduel,  stvbios, stv, stv,      gaxeduel,   ROT0,   "Sega",                    "Golden Axe - The Duel (JUETL 950117 V1.000)", GAME_IMPERFECT_SOUND )
4818GAME( 1998, grdforce,  stvbios, stv, stv,      grdforce,   ROT0,   "Success",                 "Guardian Force (JUET 980318 V0.105)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4819GAME( 1998, groovef,   stvbios, stv, stv,      groovef,   ROT0,   "Atlus",                   "Groove on Fight - Gouketsuji Ichizoku 3 (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4820GAME( 1997, hanagumi,  stvbios, stv, stv,      hanagumi,   ROT0,   "Sega",                    "Hanagumi Taisen Columns - Sakura Wars (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4821GAME( 1996, introdon,  stvbios, stv, stv,      stv,       ROT0,   "Sunsoft / Success",         "Karaoke Quiz Intro Don Don! (J 960213 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4822GAME( 1995, kiwames,   stvbios, stv, stvmp,      stv,       ROT0,   "Athena",                  "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4823GAME( 1997, maruchan,  stvbios, stv, stv,      maruchan,   ROT0,   "Sega / Toyosuisan",          "Maru-Chan de Goo! (J 971216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4824GAME( 1996, mausuke,   stvbios, stv, stv,      mausuke,   ROT0,   "Data East",               "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4825GAME( 1998, myfairld,  stvbios, stv, stvmp,      stv,       ROT0,   "Micronet",                    "Virtual Mahjong 2 - My Fair Lady (J 980608 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4826GAME( 1998, othellos,  stvbios, stv, stv,      othellos,   ROT0,   "Success",                 "Othello Shiyouyo (J 980423 V1.002)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4827GAME( 1995, pblbeach,  stvbios, stv, stv,      pblbeach,   ROT0,   "T&E Soft",                    "Pebble Beach - The Great Shot (JUE 950913 V0.990)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4828GAME( 1996, prikura,   stvbios, stv, stv,      prikura,   ROT0,   "Atlus",                   "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4829GAME( 1996, puyosun,   stvbios, stv, stv,      puyosun,   ROT0,   "Compile",                 "Puyo Puyo Sun (J 961115 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4830GAME( 1998, rsgun,     stvbios, stv, stv,      rsgun,     ROT0,   "Treasure",                "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4831GAME( 1998, sasissu,   stvbios, stv, stv,      sasissu,   ROT0,   "Sega",                    "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4832GAME( 1999, sanjeon,   sasissu, stv, stv,      sanjeon,   ROT0,   "Sega / Deniam",              "DaeJeon! SanJeon SuJeon (AJTUE 990412 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4833GAME( 1997, seabass,   stvbios, stv, stv,      seabass,   ROT0,   "A wave inc. (Able license)",   "Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4834GAME( 1995, shanhigw,  stvbios, stv, stv,      shanhigw,   ROT0,   "Sunsoft / Activision",       "Shanghai - The Great Wall / Shanghai Triple Threat (JUE 950623 V1.005)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4835GAME( 1997, shienryu,  stvbios, stv, stv,      shienryu,   ROT270, "Warashi",                 "Shienryu (JUET 961226 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4836GAME( 1998, sss,       stvbios, stv, stv,      sss,       ROT0,   "Capcom / Cave / Victor",      "Steep Slope Sliders (JUET 981110 V1.000)", GAME_IMPERFECT_SOUND )
4837GAME( 1995, sandor,    stvbios, stv, stv,      sandor,    ROT0,   "Sega",                    "Puzzle & Action: Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4838GAME( 1997, thunt,     sandor,  stv, stv,      thunt,     ROT0,   "Sega",                         "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4839GAME( 1997, thuntk,    sandor,  stv, stv,      sandor,    ROT0,   "Sega / Deniam",              "Puzzle & Action: BoMulEul Chajara (JUET 970125 V2.00K)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4840GAME( 1996, sokyugrt,  stvbios, stv, stv,      sokyugrt,   ROT0,   "Raizing / Eighting",         "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4841GAME( 1995, suikoenb,  stvbios, stv, stv,      suikoenb,   ROT0,   "Data East",                   "Suikoenbu / Outlaws of the Lost Dynasty (JUETL 950314 V2.001)", GAME_IMPERFECT_SOUND )
4842GAME( 1996, vfkids,    stvbios, stv, stv,      stv,       ROT0,   "Sega",                   "Virtua Fighter Kids (JUET 960319 V0.000)", GAME_IMPERFECT_SOUND )
4843GAME( 1997, winterht,  stvbios, stv, stv,      winterht,   ROT0,   "Sega",                   "Winter Heat (JUET 971012 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4844GAME( 1997, znpwfv,    stvbios, stv, stv,      znpwfv,    ROT0,   "Sega",                    "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4369GAME( 1998, astrass,   stvbios, stv,      stv,      astrass,   ROT0,   "Sunsoft",                 "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4370GAME( 1995, bakubaku,  stvbios, stv,      stv,       stv,       ROT0,   "Sega",                    "Baku Baku Animal (J 950407 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
4371GAME( 1996, batmanfr,  stvbios, stv,      batmanfr,   batmanfr,   ROT0,   "Acclaim",                 "Batman Forever (JUE 960507 V1.000)", GAME_NO_SOUND )
4372GAME( 1996, colmns97,  stvbios, stv,      stv,      colmns97,   ROT0,   "Sega",                   "Columns '97 (JET 961209 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4373GAME( 1997, cotton2,   stvbios, stv,      stv,      cotton2,   ROT0,   "Success",                 "Cotton 2 (JUET 970902 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4374GAME( 1998, cottonbm,  stvbios, stv,      stv,      cottonbm,   ROT0,   "Success",                 "Cotton Boomerang (JUET 980709 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4375GAME( 1995, critcrsh,  stvbios, stv,      critcrsh,   stv,      ROT0,   "Sega",                    "Critter Crusher (EA 951204 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4376GAME( 1999, danchih,   stvbios, stv,      stvmp,   danchih,   ROT0,   "Altron (Tecmo license)",      "Danchi de Hanafuda (J 990607 V1.400)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4377GAME( 2000, danchiq,   stvbios, stv,      stv,      danchih,   ROT0,   "Altron",                  "Danchi de Quiz Okusan Yontaku Desuyo! (J 001128 V1.200)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4378GAME( 1996, diehard,   stvbios, stv,      stv,      diehard,   ROT0,   "Sega",                   "Die Hard Arcade (UET 960515 V1.000)", GAME_IMPERFECT_SOUND  )
4379GAME( 1996, dnmtdeka,  diehard, stv,      stv,      dnmtdeka,   ROT0,   "Sega",                   "Dynamite Deka (J 960515 V1.000)", GAME_IMPERFECT_SOUND  )
4380GAME( 1995, ejihon,    stvbios, stv,      stv,      stv,       ROT0,   "Sega",                   "Ejihon Tantei Jimusyo (J 950613 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4381GAME( 1995, fhboxers,  stvbios, stv,      stv,      fhboxers,   ROT0,   "Sega",                   "Funky Head Boxers (JUETBKAL 951218 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
4382GAME( 1994, gaxeduel,  stvbios, stv,      stv,      gaxeduel,   ROT0,   "Sega",                    "Golden Axe - The Duel (JUETL 950117 V1.000)", GAME_IMPERFECT_SOUND )
4383GAME( 1998, grdforce,  stvbios, stv,      stv,      grdforce,   ROT0,   "Success",                 "Guardian Force (JUET 980318 V0.105)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4384GAME( 1998, groovef,   stvbios, stv,      stv,      groovef,   ROT0,   "Atlus",                   "Groove on Fight - Gouketsuji Ichizoku 3 (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4385GAME( 1997, hanagumi,  stvbios, stv,      stv,      hanagumi,   ROT0,   "Sega",                    "Hanagumi Taisen Columns - Sakura Wars (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4386GAME( 1996, introdon,  stvbios, stv,      stv,      stv,       ROT0,   "Sunsoft / Success",         "Karaoke Quiz Intro Don Don! (J 960213 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4387GAME( 1995, kiwames,   stvbios, stv,      stvmp,   stv,       ROT0,   "Athena",                  "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4388GAME( 1997, maruchan,  stvbios, stv,      stv,      maruchan,   ROT0,   "Sega / Toyosuisan",          "Maru-Chan de Goo! (J 971216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4389GAME( 1996, mausuke,   stvbios, stv,      stv,      mausuke,   ROT0,   "Data East",               "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4390GAME( 1998, myfairld,  stvbios, stv,      stvmp,   stv,       ROT0,   "Micronet",                    "Virtual Mahjong 2 - My Fair Lady (J 980608 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4391GAME( 1998, othellos,  stvbios, stv,      stv,      othellos,   ROT0,   "Success",                 "Othello Shiyouyo (J 980423 V1.002)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4392GAME( 1995, pblbeach,  stvbios, stv,      stv,      pblbeach,   ROT0,   "T&E Soft",                    "Pebble Beach - The Great Shot (JUE 950913 V0.990)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4393GAME( 1996, prikura,   stvbios, stv,      stv,      prikura,   ROT0,   "Atlus",                   "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4394GAME( 1996, puyosun,   stvbios, stv,      stv,      puyosun,   ROT0,   "Compile",                 "Puyo Puyo Sun (J 961115 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4395GAME( 1998, rsgun,     stvbios, stv,      stv,      rsgun,     ROT0,   "Treasure",                "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4396GAME( 1998, sasissu,   stvbios, stv,      stv,      sasissu,   ROT0,   "Sega",                    "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4397GAME( 1999, sanjeon,   sasissu, stv,      stv,      sanjeon,   ROT0,   "Sega / Deniam",              "DaeJeon! SanJeon SuJeon (AJTUE 990412 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4398GAME( 1997, seabass,   stvbios, stv,      stv,      seabass,   ROT0,   "A wave inc. (Able license)",   "Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4399GAME( 1995, shanhigw,  stvbios, stv,      stv,      shanhigw,   ROT0,   "Sunsoft / Activision",       "Shanghai - The Great Wall / Shanghai Triple Threat (JUE 950623 V1.005)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4400GAME( 1997, shienryu,  stvbios, stv,      stv,      shienryu,   ROT270, "Warashi",                 "Shienryu (JUET 961226 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4401GAME( 1998, sss,       stvbios, stv,      stv,      sss,       ROT0,   "Capcom / Cave / Victor",      "Steep Slope Sliders (JUET 981110 V1.000)", GAME_IMPERFECT_SOUND )
4402GAME( 1995, sandor,    stvbios, stv,      stv,      sandor,    ROT0,   "Sega",                    "Puzzle & Action: Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4403GAME( 1997, thunt,     sandor,  stv,      stv,      thunt,     ROT0,   "Sega",                         "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4404GAME( 1997, thuntk,    sandor,  stv,      stv,      sandor,    ROT0,   "Sega / Deniam",              "Puzzle & Action: BoMulEul Chajara (JUET 970125 V2.00K)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4405GAME( 1996, sokyugrt,  stvbios, stv,      stv,      sokyugrt,   ROT0,   "Raizing / Eighting",         "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4406GAME( 1995, suikoenb,  stvbios, stv,      stv,      suikoenb,   ROT0,   "Data East",                   "Suikoenbu / Outlaws of the Lost Dynasty (JUETL 950314 V2.001)", GAME_IMPERFECT_SOUND )
4407GAME( 1996, vfkids,    stvbios, stv,      stv,      stv,       ROT0,   "Sega",                   "Virtua Fighter Kids (JUET 960319 V0.000)", GAME_IMPERFECT_SOUND )
4408GAME( 1997, winterht,  stvbios, stv,      stv,      winterht,   ROT0,   "Sega",                   "Winter Heat (JUET 971012 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4409GAME( 1997, znpwfv,    stvbios, stv,      stv,      znpwfv,    ROT0,   "Sega",                    "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
48454410
48464411/* Almost */
4847GAME( 1997, vmahjong,  stvbios, stv, stvmp,      stv,       ROT0,   "Micronet",                    "Virtual Mahjong (J 961214 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4848GAME( 1998, twcup98,   stvbios, stv, stv,      twcup98,   ROT0,   "Tecmo",                       "Tecmo World Cup '98 (JUET 980410 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // player movement
4849GAME( 1995, smleague,  stvbios, stv, stv,      smleague,   ROT0,   "Sega",                    "Super Major League (U 960108 V1.000)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4850GAME( 1995, finlarch,  smleague,stv, stv,      finlarch,   ROT0,   "Sega",                    "Final Arch (J 950714 V1.001)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4851GAME( 1998, elandore,  stvbios, stv, stv,      elandore,   ROT0,   "Sai-Mate",                "Touryuu Densetsu Elan-Doree / Elan Doree - Legend of Dragoon (JUET 980922 V1.006)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4412GAME( 1997, vmahjong,  stvbios, stv,      stvmp,   stv,       ROT0,   "Micronet",                    "Virtual Mahjong (J 961214 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4413GAME( 1998, twcup98,   stvbios, stv,      stv,      twcup98,   ROT0,   "Tecmo",                       "Tecmo World Cup '98 (JUET 980410 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // player movement
4414GAME( 1995, smleague,  stvbios, stv,      stv,      smleague,   ROT0,   "Sega",                    "Super Major League (U 960108 V1.000)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4415GAME( 1995, finlarch,  smleague,stv,      stv,      finlarch,   ROT0,   "Sega",                    "Final Arch (J 950714 V1.001)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
4416GAME( 1998, elandore,  stvbios, stv,      stv,      elandore,   ROT0,   "Sai-Mate",                "Touryuu Densetsu Elan-Doree / Elan Doree - Legend of Dragoon (JUET 980922 V1.006)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
48524417
48534418/* Unemulated printer device */
4854GAME( 1998, stress,    stvbios, stv, stv,      stv,       ROT0,   "Sega",                    "Stress Busters (J 981020 V1.000)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4855GAME( 1997, nclubv3,   stvbios, stv, stv,      nameclv3,   ROT0,   "Sega",                    "Name Club Ver.3 (J 970723 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
4856GAME( 1997, pclub2,    stvbios, stv, stv,      stv,       ROT0,   "Atlus",                   "Print Club 2 (U 970921 V1.000)", GAME_NOT_WORKING )
4857GAME( 1999, pclub2v3,  pclub2,  stv, stv,      stv,       ROT0,   "Atlus",                   "Print Club 2 Vol. 3 (U 990310 V1.000)", GAME_NOT_WORKING )
4858GAME( 1999, pclubpok,  stvbios, stv, stv,       stv,        ROT0,   "Atlus",                        "Print Club Pokemon B (U 991126 V1.000)", GAME_NOT_WORKING )
4419GAME( 1998, stress,    stvbios, stv,      stv,      stv,       ROT0,   "Sega",                    "Stress Busters (J 981020 V1.000)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4420GAME( 1997, nclubv3,   stvbios, stv,      stv,      nameclv3,   ROT0,   "Sega",                    "Name Club Ver.3 (J 970723 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
4421GAME( 1997, pclub2,    stvbios, stv,      stv,      stv,       ROT0,   "Atlus",                   "Print Club 2 (U 970921 V1.000)", GAME_NOT_WORKING )
4422GAME( 1999, pclub2v3,  pclub2,  stv,      stv,      stv,       ROT0,   "Atlus",                   "Print Club 2 Vol. 3 (U 990310 V1.000)", GAME_NOT_WORKING )
4423GAME( 1999, pclubpok,  stvbios, stv,      stv,      stv,        ROT0,   "Atlus",                        "Print Club Pokemon B (U 991126 V1.000)", GAME_NOT_WORKING )
48594424
48604425/* Doing something.. but not enough yet */
4861GAME( 1995, vfremix,   stvbios, stv, stv,      vfremix,   ROT0,   "Sega",                    "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
4862GAME( 1997, findlove,  stvbios, stv, stv,      stv,      ROT0,   "Daiki / FCF",               "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
4863GAME( 1996, decathlt,  stvbios, stv, stv,      decathlt,   ROT0,   "Sega",                    "Decathlete (JUET 960709 V1.001)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
4864GAME( 1996, decathlto, decathlt,stv, stv,      decathlt,   ROT0,   "Sega",                    "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
4426GAME( 1995, vfremix,   stvbios, stv,      stv,      vfremix,   ROT0,   "Sega",                    "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
4427GAME( 1997, findlove,  stvbios, stv,      stv,      stv,      ROT0,   "Daiki / FCF",               "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
4428GAME( 1996, decathlt,  stvbios, stv,      stv,      decathlt,   ROT0,   "Sega",                    "Decathlete (JUET 960709 V1.001)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
4429GAME( 1996, decathlto, decathlt,stv,      stv,      decathlt,   ROT0,   "Sega",                    "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
48654430
48664431/* Gives I/O errors */
4867GAME( 1996, magzun,    stvbios, stv, stv,      stv,       ROT0,   "Sega",                    "Magical Zunou Power (J 961031 V1.000)", GAME_NOT_WORKING )
4868GAME( 1997, techbowl,  stvbios, stv, stv,      stv,       ROT0,   "Sega",                    "Technical Bowling (J 971212 V1.000)", GAME_NOT_WORKING )
4869GAME( 1999, micrombc,  stvbios, stv, stv,      stv,       ROT0,   "Sega",                    "Microman Battle Charge (J 990326 V1.000)", GAME_NOT_WORKING )
4432GAME( 1996, magzun,    stvbios, stv,      stv,      stv,       ROT0,   "Sega",                    "Magical Zunou Power (J 961031 V1.000)", GAME_NOT_WORKING )
4433GAME( 1997, techbowl,  stvbios, stv,      stv,      stv,       ROT0,   "Sega",                    "Technical Bowling (J 971212 V1.000)", GAME_NOT_WORKING )
4434GAME( 1999, micrombc,  stvbios, stv,      stv,      stv,       ROT0,   "Sega",                    "Microman Battle Charge (J 990326 V1.000)", GAME_NOT_WORKING )
48704435
48714436/* Black screen */
4872GAME( 1999, ffreveng,  stvbios, stv, stv,      ffreveng,   ROT0,   "Capcom",                  "Final Fight Revenge (JUET 990714 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING )
4437GAME( 1999, ffreveng,  stvbios, stv,      stv,      ffreveng,   ROT0,   "Capcom",                  "Final Fight Revenge (JUET 990714 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING )
48734438
48744439/* CD games */
4875GAME( 1995, sfish2,    0,      stv, stv,      stv,      ROT0,   "Sega",                      "Sport Fishing 2 (UET 951106 V1.10e)", GAME_NO_SOUND | GAME_NOT_WORKING )
4876GAME( 1995, sfish2j,   sfish2,   stv, stv,      stv,      ROT0,   "Sega",                      "Sport Fishing 2 (J 951201 V1.100)", GAME_NO_SOUND | GAME_NOT_WORKING )
4440GAME( 1995, sfish2,    0,      stv,      stv,      stv,      ROT0,   "Sega",                      "Sport Fishing 2 (UET 951106 V1.10e)", GAME_NO_SOUND | GAME_NOT_WORKING )
4441GAME( 1995, sfish2j,   sfish2,   stv,      stv,      stv,      ROT0,   "Sega",                      "Sport Fishing 2 (J 951201 V1.100)", GAME_NO_SOUND | GAME_NOT_WORKING )
48774442
48784443/*
48794444This is the known list of undumped ST-V games:
src/mame/drivers/arkanoid.c
r11594r11595
604604   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(arkanoid_videoram_w) AM_BASE_SIZE_MEMBER(arkanoid_state, m_videoram, m_videoram_size)
605605ADDRESS_MAP_END
606606
607static ADDRESS_MAP_START( brixian_map, AS_PROGRAM, 8 )
608   AM_RANGE(0x0000, 0xbfff) AM_ROM
609   AM_RANGE(0xc000, 0xc7ff) AM_RAM
610   AM_RANGE(0xd000, 0xd000) AM_DEVWRITE("aysnd", ay8910_address_w)
611   AM_RANGE(0xd001, 0xd001) AM_DEVREADWRITE("aysnd", ay8910_r, ay8910_data_w)
612   AM_RANGE(0xd008, 0xd008) AM_WRITE(arkanoid_d008_w)   /* gfx bank, flip screen etc. */
613   AM_RANGE(0xd00c, 0xd00c) AM_READ_PORT("SYSTEM")
614   AM_RANGE(0xd010, 0xd010) AM_READ_PORT("BUTTONS") AM_WRITE(watchdog_reset_w)
615   AM_RANGE(0xd018, 0xd018) AM_READ_PORT("MUX") AM_WRITENOP
616   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(arkanoid_videoram_w) AM_BASE_MEMBER(arkanoid_state, m_videoram)
617   AM_RANGE(0xe800, 0xe83f) AM_RAM AM_BASE_SIZE_MEMBER(arkanoid_state, m_spriteram, m_spriteram_size)
618   AM_RANGE(0xe840, 0xefff) AM_RAM
619   AM_RANGE(0xf000, 0xffff) AM_READNOP   /* fixes instant death in final level */
620// Interesting locations:
621// c105=0a @ title displays each piece
622// c110=01 - Title, 02 - Start Game, 04 - Select Stage
623ADDRESS_MAP_END
624
625
607626static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8 )
608627   ADDRESS_MAP_GLOBAL_MASK(0x7ff)
609628   AM_RANGE(0x0000, 0x0000) AM_READWRITE(arkanoid_68705_port_a_r, arkanoid_68705_port_a_w)
r11594r11595
890909   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
891910
892911   PORT_START("DSW")
893   PORT_DIPNAME( 0x0f, 0x01, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:1,2,3,4")
912   PORT_DIPNAME( 0x0f, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
894913   PORT_DIPSETTING(    0x00, "2" )
895914   PORT_DIPSETTING(    0x01, "3" )
896915   PORT_DIPSETTING(    0x03, "4" )
897916   PORT_DIPSETTING(    0x07, "5" )
898917   PORT_DIPSETTING(    0x0f, "6" )
899   PORT_DIPNAME( 0x30, 0x00, "Speed of Elevator" )      PORT_DIPLOCATION("SW1:5,6")
918   PORT_DIPNAME( 0x30, 0x00, "Speed of Elevator" ) PORT_DIPLOCATION("SW1:5,6")
900919   PORT_DIPSETTING(    0x00, "Slow" )
901920   PORT_DIPSETTING(    0x30, "Fast" )
902   PORT_DIPNAME( 0xc0, 0x40, "Time Left" )         PORT_DIPLOCATION("SW1:7,8")
921   PORT_DIPNAME( 0xc0, 0x40, "Time Left" ) PORT_DIPLOCATION("SW1:7,8")
903922   PORT_DIPSETTING(    0x00, "Half" )
904923   PORT_DIPSETTING(    0x40, DEF_STR( Normal ) )
905924   PORT_DIPSETTING(    0xc0, "Double" )
r11594r11595
10931112
10941113   /* basic machine hardware */
10951114   MCFG_CPU_MODIFY("maincpu")
1096   MCFG_CPU_PROGRAM_MAP(bootleg_map)
1115   MCFG_CPU_PROGRAM_MAP(brixian_map)
10971116   MCFG_CPU_VBLANK_INT("screen", irq0_line_hold)
10981117
10991118   MCFG_DEVICE_REMOVE("mcu")
r11594r11595
15041523ROM_START( brixian )
15051524   ROM_REGION( 0x18000, "maincpu", 0 )
15061525   ROM_LOAD( "b1.bin",      0x00000, 0x8000, CRC(3d167d09) SHA1(1d5bd098b655b8d2f956cfcb718213915bee3e41) )
1507   ROM_LOAD( "e7.bin",      0x08000, 0x2000, CRC(9e3707ab) SHA1(a04fb4824239f8ed1ef1de2f3c0f9d749320b2ba) ) // what is this? where does it map?
1526   ROM_LOAD( "e7.bin",      0x08000, 0x2000, CRC(9e3707ab) SHA1(a04fb4824239f8ed1ef1de2f3c0f9d749320b2ba) ) // this is near a 6116 RAM bank, unknown purpose
15081527
15091528   ROM_REGION( 0x18000, "gfx1", 0 )
15101529   ROM_LOAD( "b4.bin",      0x00000, 0x8000, CRC(34a7a693) SHA1(793fa6dd065a158bedcd0fdc494cc8fc793ae8be) )
r11594r11595
15121531   ROM_LOAD( "e4.bin",      0x10000, 0x8000, CRC(9b2e79d6) SHA1(8a40e0ef2a792efc37ea50eec01cf3fb5a3e3215) )
15131532
15141533   ROM_REGION( 0x0600, "proms", 0 )
1515   ROM_LOAD( "r",    0x0000, 0x0200, NO_DUMP )
1516   ROM_LOAD( "g",    0x0200, 0x0200, NO_DUMP )
1517   ROM_LOAD( "b",    0x0400, 0x0200, NO_DUMP )
1534   ROM_LOAD( "n82s131n.6l", 0x0000, 0x0200, CRC(0fa51a5b) SHA1(8c5cb69fbff8a3ba90f945c35f72754f9cc8f18c) )
1535   ROM_LOAD( "n82s131n.6p", 0x0200, 0x0200, CRC(d833ad33) SHA1(a7c17c96a670916e7102afc94dc2f0cb0455f0ce) )
1536   ROM_LOAD( "n82s131n.6m", 0x0400, 0x0200, CRC(05297649) SHA1(35f99cf8dddd66e26e2110619eb46bd6ccff41df) )
15181537
15191538   ROM_REGION( 0x0800, "mcu", 0 )
15201539   ROM_LOAD( "68705p5", 0x0000, 0x0800, NO_DUMP ) // this appears to be providing ~0x200 bytes of code at c600, like most semicom games.
src/mame/drivers/slotcarn.c
r11594r11595
198198
199199   AM_RANGE(0xd800, 0xd81f) AM_RAM // column scroll for reels?
200200
201   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_address_w)
202   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_register_w)
201   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
202   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE_MODERN("crtc", mc6845_device, register_w)
203203
204204   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(slotcarn_state, m_ram_attr)
205205   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE_MEMBER(slotcarn_state, m_ram_video)
r11594r11595
537537
538538static SCREEN_UPDATE( slotcarn )
539539{
540   device_t *mc6845 = screen->machine().device("crtc");
541   mc6845_update(mc6845, bitmap, cliprect);
540   mc6845_device *mc6845 = screen->machine().device<mc6845_device>("crtc");
541   mc6845->update(bitmap, cliprect);
542542
543543   return 0;
544544}
src/mame/drivers/miniboy7.c
r11594r11595
272272   AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(miniboy7_colorram_w) AM_BASE_MEMBER(miniboy7_state, m_colorram)
273273   AM_RANGE(0x1800, 0x25ff) AM_RAM   /* looks like videoram */
274274   AM_RANGE(0x2600, 0x27ff) AM_RAM
275   AM_RANGE(0x2800, 0x2800) AM_DEVWRITE("crtc", mc6845_address_w)
276   AM_RANGE(0x2801, 0x2801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
275   AM_RANGE(0x2800, 0x2800) AM_DEVWRITE_MODERN("crtc", mc6845_device, address_w)
276   AM_RANGE(0x2801, 0x2801) AM_DEVREADWRITE_MODERN("crtc", mc6845_device, register_r, register_w)
277277   AM_RANGE(0x3000, 0x3001) AM_DEVREADWRITE("ay8910", ay8910_r, ay8910_address_data_w)   // FIXME
278278   AM_RANGE(0x3080, 0x3083) AM_DEVREADWRITE_MODERN("pia0", pia6821_device, read, write)
279279   AM_RANGE(0x3800, 0x3800) AM_READNOP   // R (right after each read, another value is loaded to the ACCU, so it lacks of sense)
src/osd/sdl/sdl.mak
r11594r11595
395395# Static linking
396396
397397LDFLAGS += -static-libgcc
398LIBS += -Wl,-Bstatic -lSDL -Wl,-Bdynamic
398LIBS += -lSDL.dll
399399LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi
400400
401401endif   # Win32
src/osd/sdl/sdlmain.c
r11594r11595
189189
190190   // sound options
191191   { NULL,                                   NULL,  OPTION_HEADER,     "SOUND OPTIONS" },
192   { SDLOPTION_AUDIO_LATENCY,                "3",   OPTION_INTEGER,    "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
192   { SDLOPTION_AUDIO_LATENCY,                "2",   OPTION_INTEGER,    "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
193193
194194   // keyboard mapping
195195   { NULL,                                 NULL,  OPTION_HEADER,     "SDL KEYBOARD MAPPING" },
src/osd/sdl/sound.c
r11594r11595
3737static int stream_loop = 0;
3838
3939// maximum audio latency
40#define MAX_AUDIO_LATENCY      10
40#define MAX_AUDIO_LATENCY      5
4141
4242//============================================================
4343//  LOCAL VARIABLES
src/osd/windows/d3dintf.h
r11594r11595
5757
5858
5959#if (DIRECT3D_VERSION >= 0x0900)
60#ifndef __WINE_D3D9TYPES_H
6160// the following used to be TEXTURESTAGESTATES but are now SAMPLERSTATES
62enum
63{
64    D3DTSS_ADDRESSU       = 13,
65    D3DTSS_ADDRESSV       = 14,
66    D3DTSS_BORDERCOLOR    = 15,
67    D3DTSS_MAGFILTER      = 16,
68    D3DTSS_MINFILTER      = 17,
69    D3DTSS_MIPFILTER      = 18,
70    D3DTSS_MIPMAPLODBIAS  = 19,
71    D3DTSS_MAXMIPLEVEL    = 20,
72    D3DTSS_MAXANISOTROPY  = 21
73};
74
61#define D3DTSS_ADDRESSU       13
62#define D3DTSS_ADDRESSV       14
63#define D3DTSS_BORDERCOLOR    15
64#define D3DTSS_MAGFILTER      16
65#define D3DTSS_MINFILTER      17
66#define D3DTSS_MIPFILTER      18
67#define D3DTSS_MIPMAPLODBIAS  19
68#define D3DTSS_MAXMIPLEVEL    20
69#define D3DTSS_MAXANISOTROPY  21
7570#endif
76#endif
7771
7872
7973//============================================================
src/emu/cpu/cpu.mak
r11594r11595
894894         $(CPUSRC)/psx/dma.h \
895895         $(CPUSRC)/psx/gte.h \
896896         $(CPUSRC)/psx/mdec.h \
897         $(CPUSRC)/psx/rcnt.h \
898         $(CPUSRC)/psx/sio.h
897899
898900$(CPUOBJ)/psx/dma.o:   $(CPUSRC)/psx/dma.c \
899901         $(CPUSRC)/psx/dma.h
r11594r11595
902904         $(CPUSRC)/psx/gte.h
903905
904906$(CPUOBJ)/psx/mdec.o:   $(CPUSRC)/psx/mdec.c \
907         $(CPUSRC)/psx/dma.h \
905908         $(CPUSRC)/psx/mdec.h
906909
907910$(CPUOBJ)/psx/sio.o:   $(CPUSRC)/psx/sio.c \
src/emu/cpu/psx/dma.c
r11594r11595
2929psxdma_device::psxdma_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
3030   : device_t(mconfig, PSX_DMA, "PSX DMA", tag, owner, clock)
3131{
32   for( int index = 0; index < 7; index++ )
33   {
34      psx_dma_channel *dma = &channel[ index ];
35
36      dma->read_set = false;
37      dma->write_set = false;
38   }
3932}
4033
4134void psxdma_device::device_reset()
r11594r11595
205198void psxdma_device::install_read_handler( int index, psx_dma_read_delegate p_fn_dma_read )
206199{
207200   channel[ index ].fn_read = p_fn_dma_read;
208   channel[ index ].read_set = true;
209201}
210202
211203void psxdma_device::install_write_handler( int index, psx_dma_read_delegate p_fn_dma_write )
212204{
213205   channel[ index ].fn_write = p_fn_dma_write;
214   channel[ index ].write_set = true;
215206}
216207
217208WRITE32_MEMBER( psxdma_device::write )
r11594r11595
260251            }
261252
262253            if( dma->n_channelcontrol == 0x01000000 &&
263               dma->read_set )
254               !dma->fn_read.isnull() )
264255            {
265256               verboselog( machine(), 1, "dma %d read block %08x %08x\n", index, n_address, n_size );
266257               dma->fn_read( n_address, n_size );
267258               dma_finished( index );
268259            }
269260            else if (dma->n_channelcontrol == 0x11000000 &&   // CD DMA
270               dma->read_set )
261               !dma->fn_read.isnull() )
271262            {
272263               verboselog( machine(), 1, "dma %d read block %08x %08x\n", index, n_address, n_size );
273264
r11594r11595
280271               dma_finished( index );
281272            }
282273            else if( dma->n_channelcontrol == 0x01000200 &&
283               dma->read_set )
274               !dma->fn_read.isnull() )
284275            {
285276               verboselog( machine(), 1, "dma %d read block %08x %08x\n", index, n_address, n_size );
286277               dma->fn_read( n_address, n_size );
r11594r11595
294285               }
295286            }
296287            else if( dma->n_channelcontrol == 0x01000201 &&
297               dma->write_set )
288               !dma->fn_write.isnull() )
298289            {
299290               verboselog( machine(), 1, "dma %d write block %08x %08x\n", index, n_address, n_size );
300291               dma->fn_write( n_address, n_size );
301292               dma_finished( index );
302293            }
303294            else if( dma->n_channelcontrol == 0x11050100 &&
304               dma->write_set )
295               !dma->fn_write.isnull() )
305296            {
306297               /* todo: check this is a write not a read... */
307298               verboselog( machine(), 1, "dma %d write block %08x %08x\n", index, n_address, n_size );
r11594r11595
309300               dma_finished( index );
310301            }
311302            else if( dma->n_channelcontrol == 0x11150100 &&
312               dma->write_set )
303               !dma->fn_write.isnull() )
313304            {
314305               /* todo: check this is a write not a read... */
315306               verboselog( machine(), 1, "dma %d write block %08x %08x\n", index, n_address, n_size );
r11594r11595
318309            }
319310            else if( dma->n_channelcontrol == 0x01000401 &&
320311               index == 2 &&
321               dma->write_set )
312               !dma->fn_write.isnull() )
322313            {
323314               verboselog( machine(), 1, "dma %d write linked list %08x\n",
324315                  index, dma->n_base );
src/emu/cpu/psx/dma.h
r11594r11595
2525   UINT32 n_channelcontrol;
2626   emu_timer *timer;
2727   psx_dma_read_delegate fn_read;
28   bool read_set;
2928   psx_dma_write_delegate fn_write;
30   bool write_set;
3129   UINT32 n_ticks;
3230   UINT32 b_running;
3331};

Previous 15994 Revisions Next


© 1998-2018 The MESS Team