mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
converted PlayStation GPU to a device [smf]
This commit is contained in:
parent
e932699a97
commit
2c8245a4c7
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1294,6 +1294,8 @@ src/emu/video/pc_video.c svneol=native#text/plain
|
||||
src/emu/video/pc_video.h svneol=native#text/plain
|
||||
src/emu/video/poly.c svneol=native#text/plain
|
||||
src/emu/video/poly.h svneol=native#text/plain
|
||||
src/emu/video/psx.c svneol=native#text/plain
|
||||
src/emu/video/psx.h svneol=native#text/plain
|
||||
src/emu/video/resnet.c svneol=native#text/plain
|
||||
src/emu/video/resnet.h svneol=native#text/plain
|
||||
src/emu/video/rgbgen.h svneol=native#text/plain
|
||||
@ -4411,7 +4413,6 @@ src/mame/video/prehisle.c svneol=native#text/plain
|
||||
src/mame/video/psikyo.c svneol=native#text/plain
|
||||
src/mame/video/psikyo4.c svneol=native#text/plain
|
||||
src/mame/video/psikyosh.c svneol=native#text/plain
|
||||
src/mame/video/psx.c svneol=native#text/plain
|
||||
src/mame/video/psychic5.c svneol=native#text/plain
|
||||
src/mame/video/punchout.c svneol=native#text/plain
|
||||
src/mame/video/pushman.c svneol=native#text/plain
|
||||
|
@ -266,6 +266,7 @@ EMUVIDEOOBJS = \
|
||||
$(EMUVIDEO)/pc_vga.o \
|
||||
$(EMUVIDEO)/pc_video.o \
|
||||
$(EMUVIDEO)/poly.o \
|
||||
$(EMUVIDEO)/psx.o \
|
||||
$(EMUVIDEO)/resnet.o \
|
||||
$(EMUVIDEO)/rgbutil.o \
|
||||
$(EMUVIDEO)/s2636.o \
|
||||
|
3754
src/emu/video/psx.c
Normal file
3754
src/emu/video/psx.c
Normal file
File diff suppressed because it is too large
Load Diff
316
src/emu/video/psx.h
Normal file
316
src/emu/video/psx.h
Normal file
@ -0,0 +1,316 @@
|
||||
/*
|
||||
* PlayStation GPU emulator
|
||||
*
|
||||
* Copyright 2003-2011 smf
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __PSXGPU_H__
|
||||
#define __PSXGPU_H__
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
extern const device_type CXD8514Q;
|
||||
extern const device_type CXD8538Q;
|
||||
extern const device_type CXD8561Q;
|
||||
extern const device_type CXD8561BQ;
|
||||
extern const device_type CXD8561CQ;
|
||||
extern const device_type CXD8654Q;
|
||||
|
||||
#define STOP_ON_ERROR ( 0 )
|
||||
|
||||
#define VERBOSE_LEVEL ( 0 )
|
||||
|
||||
#define MAX_LEVEL ( 32 )
|
||||
#define MID_LEVEL ( ( MAX_LEVEL / 2 ) << 8 )
|
||||
#define MAX_SHADE ( 0x100 )
|
||||
#define MID_SHADE ( 0x80 )
|
||||
|
||||
#define DEBUG_COORDS ( 10 )
|
||||
#define DEBUG_MAX ( 512 )
|
||||
|
||||
typedef struct _psx_gpu_debug psx_gpu_debug;
|
||||
struct _psx_gpu_debug
|
||||
{
|
||||
bitmap_t *mesh;
|
||||
int b_clear;
|
||||
int b_mesh;
|
||||
int n_skip;
|
||||
int b_texture;
|
||||
int n_interleave;
|
||||
int n_coord;
|
||||
int n_coordx[ DEBUG_COORDS ];
|
||||
int n_coordy[ DEBUG_COORDS ];
|
||||
};
|
||||
|
||||
struct FLATVERTEX
|
||||
{
|
||||
PAIR n_coord;
|
||||
};
|
||||
|
||||
struct GOURAUDVERTEX
|
||||
{
|
||||
PAIR n_bgr;
|
||||
PAIR n_coord;
|
||||
};
|
||||
|
||||
struct FLATTEXTUREDVERTEX
|
||||
{
|
||||
PAIR n_coord;
|
||||
PAIR n_texture;
|
||||
};
|
||||
|
||||
struct GOURAUDTEXTUREDVERTEX
|
||||
{
|
||||
PAIR n_bgr;
|
||||
PAIR n_coord;
|
||||
PAIR n_texture;
|
||||
};
|
||||
|
||||
union PACKET
|
||||
{
|
||||
UINT32 n_entry[ 16 ];
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_cmd;
|
||||
struct FLATVERTEX vertex[ 2 ];
|
||||
PAIR n_size;
|
||||
} MoveImage;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
PAIR n_coord;
|
||||
PAIR n_size;
|
||||
} FlatRectangle;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
PAIR n_coord;
|
||||
} FlatRectangle8x8;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
PAIR n_coord;
|
||||
} FlatRectangle16x16;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
PAIR n_coord;
|
||||
PAIR n_texture;
|
||||
} Sprite8x8;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
PAIR n_coord;
|
||||
PAIR n_texture;
|
||||
} Sprite16x16;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
PAIR n_coord;
|
||||
PAIR n_texture;
|
||||
PAIR n_size;
|
||||
} FlatTexturedRectangle;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
struct FLATVERTEX vertex[ 4 ];
|
||||
} FlatPolygon;
|
||||
|
||||
struct
|
||||
{
|
||||
struct GOURAUDVERTEX vertex[ 4 ];
|
||||
} GouraudPolygon;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
struct FLATVERTEX vertex[ 2 ];
|
||||
} MonochromeLine;
|
||||
|
||||
struct
|
||||
{
|
||||
struct GOURAUDVERTEX vertex[ 2 ];
|
||||
} GouraudLine;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
struct FLATTEXTUREDVERTEX vertex[ 4 ];
|
||||
} FlatTexturedPolygon;
|
||||
|
||||
struct
|
||||
{
|
||||
struct GOURAUDTEXTUREDVERTEX vertex[ 4 ];
|
||||
} GouraudTexturedPolygon;
|
||||
|
||||
struct
|
||||
{
|
||||
PAIR n_bgr;
|
||||
struct FLATVERTEX vertex;
|
||||
} Dot;
|
||||
};
|
||||
|
||||
class psxgpu_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
psxgpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
void update_screen(bitmap_t *bitmap, const rectangle *cliprect);
|
||||
WRITE32_MEMBER( write );
|
||||
READ32_MEMBER( read );
|
||||
void dma_read( UINT32 *p_ram, INT32 n_size );
|
||||
void dma_write( UINT32 *p_ram, INT32 n_size );
|
||||
void lightgun_set( int, int );
|
||||
void vblank( void );
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
|
||||
void updatevisiblearea();
|
||||
void decode_tpage( UINT32 tpage );
|
||||
void FlatPolygon( int n_points );
|
||||
void FlatTexturedPolygon( int n_points );
|
||||
void GouraudPolygon( int n_points );
|
||||
void GouraudTexturedPolygon( int n_points );
|
||||
void MonochromeLine( void );
|
||||
void GouraudLine( void );
|
||||
void FrameBufferRectangleDraw( void );
|
||||
void FlatRectangle( void );
|
||||
void FlatRectangle8x8( void );
|
||||
void FlatRectangle16x16( void );
|
||||
void FlatTexturedRectangle( void );
|
||||
void Sprite8x8( void );
|
||||
void Sprite16x16( void );
|
||||
void Dot( void );
|
||||
void MoveImage( void );
|
||||
void psx_gpu_init( int n_gputype );
|
||||
void gpu_reset();
|
||||
|
||||
INT32 m_n_tx;
|
||||
INT32 m_n_ty;
|
||||
INT32 n_abr;
|
||||
INT32 n_tp;
|
||||
INT32 n_ix;
|
||||
INT32 n_iy;
|
||||
INT32 n_ti;
|
||||
|
||||
UINT16 *p_vram;
|
||||
UINT32 n_vram_size;
|
||||
UINT32 n_vramx;
|
||||
UINT32 n_vramy;
|
||||
UINT32 n_twy;
|
||||
UINT32 n_twx;
|
||||
UINT32 n_twh;
|
||||
UINT32 n_tww;
|
||||
UINT32 n_drawarea_x1;
|
||||
UINT32 n_drawarea_y1;
|
||||
UINT32 n_drawarea_x2;
|
||||
UINT32 n_drawarea_y2;
|
||||
UINT32 n_horiz_disstart;
|
||||
UINT32 n_horiz_disend;
|
||||
UINT32 n_vert_disstart;
|
||||
UINT32 n_vert_disend;
|
||||
UINT32 b_reverseflag;
|
||||
INT32 n_drawoffset_x;
|
||||
INT32 n_drawoffset_y;
|
||||
UINT32 m_n_displaystartx;
|
||||
UINT32 n_displaystarty;
|
||||
int n_gputype;
|
||||
UINT32 n_gpustatus;
|
||||
UINT32 n_gpuinfo;
|
||||
UINT32 n_gpu_buffer_offset;
|
||||
UINT32 n_lightgun_x;
|
||||
UINT32 n_lightgun_y;
|
||||
UINT32 n_screenwidth;
|
||||
UINT32 n_screenheight;
|
||||
|
||||
PACKET m_packet;
|
||||
|
||||
psx_gpu_debug m_debug;
|
||||
|
||||
UINT16 *p_p_vram[ 1024 ];
|
||||
|
||||
UINT16 p_n_redshade[ MAX_LEVEL * MAX_SHADE ];
|
||||
UINT16 p_n_greenshade[ MAX_LEVEL * MAX_SHADE ];
|
||||
UINT16 p_n_blueshade[ MAX_LEVEL * MAX_SHADE ];
|
||||
UINT16 p_n_redlevel[ 0x10000 ];
|
||||
UINT16 p_n_greenlevel[ 0x10000 ];
|
||||
UINT16 p_n_bluelevel[ 0x10000 ];
|
||||
|
||||
UINT16 p_n_f025[ MAX_LEVEL * MAX_SHADE ];
|
||||
UINT16 p_n_f05[ MAX_LEVEL * MAX_SHADE ];
|
||||
UINT16 p_n_f1[ MAX_LEVEL * MAX_SHADE ];
|
||||
UINT16 p_n_redb05[ 0x10000 ];
|
||||
UINT16 p_n_greenb05[ 0x10000 ];
|
||||
UINT16 p_n_blueb05[ 0x10000 ];
|
||||
UINT16 p_n_redb1[ 0x10000 ];
|
||||
UINT16 p_n_greenb1[ 0x10000 ];
|
||||
UINT16 p_n_blueb1[ 0x10000 ];
|
||||
UINT16 p_n_redaddtrans[ MAX_LEVEL * MAX_LEVEL ];
|
||||
UINT16 p_n_greenaddtrans[ MAX_LEVEL * MAX_LEVEL ];
|
||||
UINT16 p_n_blueaddtrans[ MAX_LEVEL * MAX_LEVEL ];
|
||||
UINT16 p_n_redsubtrans[ MAX_LEVEL * MAX_LEVEL ];
|
||||
UINT16 p_n_greensubtrans[ MAX_LEVEL * MAX_LEVEL ];
|
||||
UINT16 p_n_bluesubtrans[ MAX_LEVEL * MAX_LEVEL ];
|
||||
|
||||
UINT16 p_n_g0r0[ 0x10000 ];
|
||||
UINT16 p_n_b0[ 0x10000 ];
|
||||
UINT16 p_n_r1[ 0x10000 ];
|
||||
UINT16 p_n_b1g1[ 0x10000 ];
|
||||
};
|
||||
|
||||
class cxd8514q_device : public psxgpu_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
cxd8514q_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class cxd8538q_device : public psxgpu_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
cxd8538q_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class cxd8561q_device : public psxgpu_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
cxd8561q_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class cxd8561bq_device : public psxgpu_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
cxd8561bq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class cxd8561cq_device : public psxgpu_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
cxd8561cq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
class cxd8654q_device : public psxgpu_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
cxd8654q_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
#endif
|
@ -48,6 +48,7 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
#include "includes/konamigx.h"
|
||||
#include "machine/eeprom.h"
|
||||
@ -358,7 +359,6 @@ static MACHINE_START( konamigq )
|
||||
|
||||
static MACHINE_RESET( konamigq )
|
||||
{
|
||||
psx_machine_init(machine);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( konamigq, konamigq_state )
|
||||
@ -391,7 +391,7 @@ static MACHINE_CONFIG_START( konamigq, konamigq_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type1 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8538Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -120,6 +120,7 @@ Notes:
|
||||
#include "emu.h"
|
||||
#include "cdrom.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
#include "machine/eeprom.h"
|
||||
#include "machine/intelfsh.h"
|
||||
@ -311,8 +312,6 @@ static MACHINE_START( konamigv )
|
||||
|
||||
static MACHINE_RESET( konamigv )
|
||||
{
|
||||
psx_machine_init(machine);
|
||||
|
||||
/* also hook up CDDA audio to the CD-ROM drive */
|
||||
cdda_set_cdrom(machine.device("cdda"), am53cf96_get_device(SCSI_ID_4));
|
||||
}
|
||||
@ -351,7 +350,7 @@ static MACHINE_CONFIG_START( konamigv, konamigv_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8514Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -335,6 +335,7 @@ G: gun mania only, drives air soft gun (this game uses real BB bullet)
|
||||
#include "emu.h"
|
||||
#include "cdrom.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
#include "machine/intelfsh.h"
|
||||
#include "machine/cr589.h"
|
||||
@ -1273,8 +1274,6 @@ static MACHINE_RESET( konami573 )
|
||||
{
|
||||
ksys573_state *state = machine.driver_data<ksys573_state>();
|
||||
|
||||
psx_machine_init(machine);
|
||||
|
||||
if( state->machine().device<device_secure_serial_flash>("install_eeprom") )
|
||||
{
|
||||
/* security cart */
|
||||
@ -2989,7 +2988,7 @@ static MACHINE_CONFIG_START( konami573, ksys573_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -266,6 +266,7 @@ Utyuu Daisakusen Chocovader Contactee CVC1 Ver.A KC022A
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
|
||||
WRITE32_HANDLER( namcos10_bank_w )
|
||||
@ -468,7 +469,6 @@ static DRIVER_INIT( panikuru )
|
||||
|
||||
static MACHINE_RESET( namcos10 )
|
||||
{
|
||||
psx_machine_init(machine);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( namcos10, namcos10_state )
|
||||
@ -491,7 +491,7 @@ static MACHINE_CONFIG_START( namcos10, namcos10_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8561CQ, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -269,6 +269,7 @@ Notes:
|
||||
#include "deprecat.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "cpu/m37710/m37710.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
#include "machine/at28c16.h"
|
||||
#include "sound/c352.h"
|
||||
@ -978,7 +979,6 @@ static MACHINE_RESET( namcos11 )
|
||||
namcos11_state *state = machine.driver_data<namcos11_state>();
|
||||
|
||||
memset( state->m_keycus, 0, state->m_keycus_size );
|
||||
psx_machine_init(machine);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( coh100, namcos11_state )
|
||||
@ -1006,7 +1006,7 @@ static MACHINE_CONFIG_START( coh100, namcos11_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type1 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8538Q, 0 )
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
MCFG_SOUND_ADD("c352", C352, 16384000)
|
||||
@ -1023,7 +1023,7 @@ static MACHINE_CONFIG_DERIVED( coh110, coh100 )
|
||||
MCFG_CPU_PROGRAM_MAP( namcos11_map )
|
||||
MCFG_CPU_VBLANK_INT("screen", namcos11_vblank)
|
||||
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_REPLACE( "gpu", CXD8561Q, 0 )
|
||||
|
||||
MCFG_SCREEN_MODIFY("screen")
|
||||
MCFG_SCREEN_REFRESH_RATE( 30 )
|
||||
|
@ -1031,6 +1031,7 @@ Notes:
|
||||
#include "emu.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "cpu/h83002/h8.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
#include "machine/at28c16.h"
|
||||
#include "sound/c352.h"
|
||||
@ -1359,7 +1360,6 @@ static MACHINE_RESET( namcos12 )
|
||||
{
|
||||
namcos12_state *state = machine.driver_data<namcos12_state>();
|
||||
address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
|
||||
psx_machine_init(machine);
|
||||
bankoffset_w(space,0,0,0xffffffff);
|
||||
state->m_has_tektagt_dma = 0;
|
||||
|
||||
@ -1670,7 +1670,7 @@ static MACHINE_CONFIG_START( coh700, namcos12_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8654Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -319,6 +319,7 @@ Type 3 (PCMCIA Compact Flash Adaptor + Compact Flash card, sealed together with
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
#include "machine/at28c16.h"
|
||||
#include "machine/intelfsh.h"
|
||||
@ -907,7 +908,6 @@ static MACHINE_RESET( coh3002t )
|
||||
state->m_locked = 0x1ff;
|
||||
install_handlers(machine, 0);
|
||||
state->m_control = 0;
|
||||
psx_machine_init(machine);
|
||||
devtag_reset(machine, "card");
|
||||
ide_set_gnet_readlock(machine.device("card"), 1);
|
||||
|
||||
@ -975,7 +975,7 @@ static MACHINE_CONFIG_START( coh3002t, taitogn_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8654Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -227,6 +227,7 @@ Notes:
|
||||
#include "emu.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
#include "machine/am53cf96.h"
|
||||
#include "machine/rtc65271.h"
|
||||
@ -856,8 +857,6 @@ static DRIVER_INIT( twinkle )
|
||||
|
||||
static MACHINE_RESET( twinkle )
|
||||
{
|
||||
psx_machine_init(machine);
|
||||
|
||||
/* also hook up CDDA audio to the CD-ROM drive */
|
||||
cdda_set_cdrom(machine.device("cdda"), am53cf96_get_device(SCSI_ID_4));
|
||||
}
|
||||
@ -907,7 +906,7 @@ static MACHINE_CONFIG_START( twinkle, twinkle_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("speakerleft", "speakerright")
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
#include "machine/at28c16.h"
|
||||
#include "machine/nvram.h"
|
||||
@ -481,7 +482,6 @@ static void zn_machine_init( running_machine &machine )
|
||||
|
||||
state->m_n_dip_bit = 0;
|
||||
state->m_b_lastclock = 1;
|
||||
psx_machine_init(machine);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( zn1_1mb_vram, zn_state )
|
||||
@ -502,7 +502,7 @@ static MACHINE_CONFIG_START( zn1_1mb_vram, zn_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
@ -538,7 +538,7 @@ static MACHINE_CONFIG_START( zn2, zn_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_VIDEO_START( psx_type2 )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8654Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -20,10 +20,9 @@ struct _psx_machine
|
||||
size_t n_psxramsize;
|
||||
|
||||
UINT32 n_com_delay;
|
||||
int b_need_sianniv_vblank_hack;
|
||||
};
|
||||
|
||||
typedef struct _psx_gpu psx_gpu;
|
||||
|
||||
class psx_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -31,14 +30,13 @@ public:
|
||||
: driver_device(mconfig, type, tag) { }
|
||||
|
||||
psx_machine *m_p_psx;
|
||||
psx_gpu *m_p_psxgpu;
|
||||
|
||||
UINT32 *m_p_n_psxram;
|
||||
size_t m_n_psxramsize;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/psx.c -----------*/
|
||||
/*----------- defined in machine/psx.c -----------*/
|
||||
|
||||
PALETTE_INIT( psx );
|
||||
VIDEO_START( psx_type1 );
|
||||
@ -52,8 +50,6 @@ READ32_HANDLER( psx_gpu_r );
|
||||
WRITE32_HANDLER( psx_gpu_w );
|
||||
extern void psx_lightgun_set( running_machine &, int, int );
|
||||
|
||||
/*----------- defined in machine/psx.c -----------*/
|
||||
|
||||
WRITE32_HANDLER( psx_com_delay_w );
|
||||
READ32_HANDLER( psx_com_delay_r );
|
||||
extern void psx_irq_set( running_machine &, UINT32 );
|
||||
@ -64,7 +60,6 @@ READ32_HANDLER( psx_counter_r );
|
||||
extern void psx_sio_install_handler( running_machine &, int, psx_sio_handler );
|
||||
extern void psx_sio_input( running_machine &, int, int, int );
|
||||
|
||||
extern void psx_machine_init( running_machine &machine );
|
||||
extern void psx_driver_init( running_machine &machine );
|
||||
|
||||
#define PSX_H ( 1 )
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/psx/psx.h"
|
||||
#include "video/psx.h"
|
||||
#include "includes/psx.h"
|
||||
|
||||
#define VERBOSE_LEVEL ( 0 )
|
||||
@ -39,6 +40,21 @@ READ32_HANDLER( psx_com_delay_r )
|
||||
return p_psx->n_com_delay;
|
||||
}
|
||||
|
||||
INTERRUPT_GEN( psx_vblank )
|
||||
{
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( device->machine().device("gpu") );
|
||||
psx_machine *p_psx = device->machine().driver_data<psx_state>()->m_p_psx;
|
||||
|
||||
if(p_psx->b_need_sianniv_vblank_hack)
|
||||
{
|
||||
UINT32 pc = cpu_get_pc(device);
|
||||
if((pc >= 0x80010018 && pc <= 0x80010028) || pc == 0x8002a4f0)
|
||||
return;
|
||||
}
|
||||
|
||||
gpu->vblank();
|
||||
}
|
||||
|
||||
/* IRQ */
|
||||
|
||||
void psx_irq_set( running_machine &machine, UINT32 data )
|
||||
@ -71,22 +87,19 @@ void psx_sio_input( running_machine &machine, int n_port, int n_mask, int n_data
|
||||
static void gpu_read( psx_state *state, UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psx_machine *p_psx = state->m_p_psx;
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( p_psx->machine().device("gpu") );
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
|
||||
psx_gpu_read( state->machine(), &p_n_psxram[ n_address / 4 ], n_size );
|
||||
gpu->dma_read( &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
static void gpu_write( psx_state *state, UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psx_machine *p_psx = state->m_p_psx;
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( p_psx->machine().device("gpu") );
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
|
||||
psx_gpu_write( state->machine(), &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
void psx_machine_init( running_machine &machine )
|
||||
{
|
||||
psx_gpu_reset(machine);
|
||||
gpu->dma_write( &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
void psx_driver_init( running_machine &machine )
|
||||
@ -94,6 +107,8 @@ void psx_driver_init( running_machine &machine )
|
||||
psx_state *state = machine.driver_data<psx_state>();
|
||||
psx_machine *p_psx = auto_alloc_clear(machine, psx_machine);
|
||||
|
||||
p_psx->b_need_sianniv_vblank_hack = !strcmp(machine.system().name, "sianniv");
|
||||
|
||||
state->m_p_psx = p_psx;
|
||||
state->m_p_n_psxram = (UINT32 *)memory_get_shared(machine, "share1", state->m_n_psxramsize);
|
||||
|
||||
@ -104,3 +119,28 @@ void psx_driver_init( running_machine &machine )
|
||||
psx_dma_install_read_handler( machine, 2, psx_dma_read_delegate( FUNC( gpu_read ), state ) );
|
||||
psx_dma_install_write_handler( machine, 2, psx_dma_write_delegate( FUNC( gpu_write ), state ) );
|
||||
}
|
||||
|
||||
SCREEN_UPDATE( psx )
|
||||
{
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( screen->machine().device("gpu") );
|
||||
gpu->update_screen( bitmap, cliprect );
|
||||
return 0;
|
||||
}
|
||||
|
||||
READ32_HANDLER( psx_gpu_r )
|
||||
{
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( space->machine().device("gpu") );
|
||||
return gpu->read( *space, offset, mem_mask );
|
||||
}
|
||||
|
||||
WRITE32_HANDLER( psx_gpu_w )
|
||||
{
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( space->machine().device("gpu") );
|
||||
gpu->write( *space, offset, data, mem_mask );
|
||||
}
|
||||
|
||||
void psx_lightgun_set( running_machine &machine, int n_x, int n_y )
|
||||
{
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( machine.device("gpu") );
|
||||
gpu->lightgun_set( n_x, n_y );
|
||||
}
|
||||
|
@ -1287,7 +1287,7 @@ $(MAMEOBJ)/snk.a: \
|
||||
|
||||
$(MAMEOBJ)/sony.a: \
|
||||
$(DRIVERS)/zn.o $(MACHINE)/znsec.o \
|
||||
$(MACHINE)/psx.o $(VIDEO)/psx.o \
|
||||
$(MACHINE)/psx.o
|
||||
|
||||
$(MAMEOBJ)/stern.a: \
|
||||
$(DRIVERS)/astinvad.o \
|
||||
|
3955
src/mame/video/psx.c
3955
src/mame/video/psx.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user