From dcf65bad9a9eb8c1380490f733910f98ab227f93 Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 21 Apr 2013 19:50:00 +0000 Subject: [PATCH] Added a temporary way to get to the PSX RAM as a couple of share1 lookups remained. (nw) --- src/emu/cpu/psx/psx.c | 20 ++++++++++++++++++++ src/emu/cpu/psx/psx.h | 3 +++ src/mame/drivers/ksys573.c | 7 ++++--- src/mame/drivers/namcos12.c | 4 ++-- src/mess/drivers/psx.c | 12 +++++------- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/emu/cpu/psx/psx.c b/src/emu/cpu/psx/psx.c index 7c33900fef2..716e7a2135a 100644 --- a/src/emu/cpu/psx/psx.c +++ b/src/emu/cpu/psx/psx.c @@ -1670,6 +1670,26 @@ void psxcpu_device::set_ram_size(device_t &device, UINT32 ram_size) } +//------------------------------------------------- +// ram_size - temporary kludge to allow +// access to the current ram size +//------------------------------------------------- + +UINT32 psxcpu_device::ram_size() +{ + return m_ram_size; +} + +//------------------------------------------------- +// ram - temporary kludge to allow +// access to the current ram +//------------------------------------------------- + +UINT32 *psxcpu_device::ram() +{ + return m_ram; +} + //------------------------------------------------- // device_start - start up the device //------------------------------------------------- diff --git a/src/emu/cpu/psx/psx.h b/src/emu/cpu/psx/psx.h index 8a5c11d58ee..fd13db332c3 100644 --- a/src/emu/cpu/psx/psx.h +++ b/src/emu/cpu/psx/psx.h @@ -173,6 +173,9 @@ public: static psxcpu_device *getcpu( device_t &device, const char *cputag ); + UINT32 ram_size(); + UINT32 *ram(); + protected: psxcpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index ce2a5209b8d..db31f294d4d 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -666,7 +666,7 @@ public: void hyperbbc_lamp_callback( int data ); void mamboagg_output_callback( int offset, int data ); void punchmania_output_callback( int offset, int data ); - required_device m_maincpu; + required_device m_maincpu; }; void ATTR_PRINTF(3,4) ksys573_state::verboselog( int n_level, const char *s_fmt, ... ) @@ -1462,7 +1462,7 @@ void ksys573_state::sys573_vblank(screen_device &screen, bool vblank_state) { /* patch out security-plate error */ - UINT32 *p_n_psxram = (UINT32 *)memshare("share1")->ptr(); + UINT32 *p_n_psxram = m_maincpu->ram(); /* install cd */ @@ -1486,7 +1486,8 @@ void ksys573_state::sys573_vblank(screen_device &screen, bool vblank_state) { /* patch out security-plate error */ - UINT32 *p_n_psxram = (UINT32 *)memshare("share1")->ptr(); + UINT32 *p_n_psxram = m_maincpu->ram(); + /* 8001f850: jal $8003221c */ if( p_n_psxram[ 0x1f850 / 4 ] == 0x0c00c887 ) { diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c index ac430278ec7..4f813cfb0b2 100644 --- a/src/mame/drivers/namcos12.c +++ b/src/mame/drivers/namcos12.c @@ -1101,7 +1101,7 @@ public: void namcos12_rom_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); void namcos12_sub_irq( screen_device &screen, bool vblank_state ); void system11gun_install( ); - required_device m_maincpu; + required_device m_maincpu; }; inline void ATTR_PRINTF(3,4) namcos12_state::verboselog( int n_level, const char *s_fmt, ... ) @@ -1193,7 +1193,7 @@ void namcos12_state::namcos12_rom_read( UINT32 *p_n_psxram, UINT32 n_address, IN INT32 n_ramleft; // TODO: the check for going past the end of ram should be in dma.c - UINT32 m_n_psxramsize = 0x400000; + UINT32 m_n_psxramsize = m_maincpu->ram_size(); if(m_has_tektagt_dma && !m_n_dmaoffset) { diff --git a/src/mess/drivers/psx.c b/src/mess/drivers/psx.c index 454044c2932..307806325d7 100644 --- a/src/mess/drivers/psx.c +++ b/src/mess/drivers/psx.c @@ -51,7 +51,7 @@ public: void cd_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); void cd_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); DECLARE_QUICKLOAD_LOAD_MEMBER( psx_exe_load ); - required_device m_maincpu; + required_device m_maincpu; }; @@ -146,9 +146,8 @@ int psx1_state::load_psxexe( cpu_device *cpu, unsigned char *p_n_file, int n_len logerror( "psx_exe_load: sp %08x\n", psxexe_header->s_addr ); logerror( "psx_exe_load: len %08x\n", psxexe_header->s_size ); - memory_share *share = memshare("share1"); - p_ram = (UINT8 *)share->ptr(); - n_ram = share->bytes(); + p_ram = (UINT8 *)m_maincpu->ram(); + n_ram = m_maincpu->ram_size(); p_psxexe = p_n_file + sizeof( struct PSXEXE_HEADER ); @@ -250,9 +249,8 @@ int psx1_state::load_cpe( cpu_device *cpu, unsigned char *p_n_file, int n_len ) ( (int)p_n_file[ n_offset + 6 ] << 16 ) | ( (int)p_n_file[ n_offset + 7 ] << 24 ); - memory_share *share = memshare("share1"); - UINT8 *p_ram = (UINT8 *)share->ptr(); - UINT32 n_ram = share->bytes(); + UINT8 *p_ram = (UINT8 *)m_maincpu->ram(); + UINT32 n_ram = m_maincpu->ram_size(); n_offset += 8;