summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2011-05-22 16:23:10 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2011-05-22 16:23:10 +0000
commit70c6ebeff9aa81d4802cf35598d2a44f39def911 (patch)
tree2e8287004c89c18ba5c50b8b588154d36fdd9991 /src
parent56ffe467691c450ef03e1eb44d255eec063c733b (diff)
More movements
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/saturn.c124
-rw-r--r--src/mame/includes/stv.h23
-rw-r--r--src/mame/video/stvvdp1.c8
-rw-r--r--src/mame/video/stvvdp2.c61
4 files changed, 109 insertions, 107 deletions
diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c
index e315aa402f0..e855938aec1 100644
--- a/src/mame/drivers/saturn.c
+++ b/src/mame/drivers/saturn.c
@@ -1336,7 +1336,7 @@ DMA TODO:
static UINT32 scu_add_tmp;
/*For area checking*/
-#define ABUS(_lv_) ((state->m_scu_src[_lv_] & 0x07ffffff) >= 0x02000000) && ((state->m_scu_src[_lv_] & 0x07ffffff) <= 0x04ffffff)
+#define ABUS(_lv_) ((state->m_scu.src[_lv_] & 0x07ffffff) >= 0x02000000) && ((state->m_scu.src[_lv_] & 0x07ffffff) <= 0x04ffffff)
#define BBUS(_lv_) ((scu_##_lv_ & 0x07ffffff) >= 0x05a00000) && ((scu_##_lv_ & 0x07ffffff) <= 0x05ffffff)
#define VDP1_REGS(_lv_) ((scu_##_lv_ & 0x07ffffff) >= 0x05d00000) && ((scu_##_lv_ & 0x07ffffff) <= 0x05dfffff)
#define VDP2(_lv_) ((scu_##_lv_ & 0x07ffffff) >= 0x05e00000) && ((scu_##_lv_ & 0x07ffffff) <= 0x05fdffff)
@@ -1409,15 +1409,15 @@ static WRITE32_HANDLER( saturn_scu_w )
switch(offset)
{
/*LV 0 DMA*/
- case 0: case 8: case 16: state->m_scu_src[DMA_CH] = ((state->m_scu_regs[offset] & 0x07ffffff) >> 0); break;
- case 1: case 9: case 17: state->m_scu_dst[DMA_CH] = ((state->m_scu_regs[offset] & 0x07ffffff) >> 0); break;
- case 2: case 10: case 18: state->m_scu_size[DMA_CH] = ((state->m_scu_regs[offset] & ((offset == 2) ? 0x000fffff : 0x1fff)) >> 0); break;
+ case 0: case 8: case 16: state->m_scu.src[DMA_CH] = ((state->m_scu_regs[offset] & 0x07ffffff) >> 0); break;
+ case 1: case 9: case 17: state->m_scu.dst[DMA_CH] = ((state->m_scu_regs[offset] & 0x07ffffff) >> 0); break;
+ case 2: case 10: case 18: state->m_scu.size[DMA_CH] = ((state->m_scu_regs[offset] & ((offset == 2) ? 0x000fffff : 0x1fff)) >> 0); break;
case 3: case 11: case 19:
/*Read address add value for DMA lv 0*/
- state->m_scu_src_add[DMA_CH] = (state->m_scu_regs[offset] & 0x100) ? 4 : 1;
+ state->m_scu.src_add[DMA_CH] = (state->m_scu_regs[offset] & 0x100) ? 4 : 1;
/*Write address add value for DMA lv 0*/
- state->m_scu_dst_add[DMA_CH] = 2 << (state->m_scu_regs[offset] & 7);
+ state->m_scu.dst_add[DMA_CH] = 2 << (state->m_scu_regs[offset] & 7);
break;
case 4: case 12: case 20:
/*
@@ -1441,7 +1441,7 @@ static WRITE32_HANDLER( saturn_scu_w )
if(INDIRECT_MODE(DMA_CH))
{
if(LOG_SCU) logerror("Indirect Mode DMA lv %d set\n",DMA_CH);
- if(!DWUP(DMA_CH)) state->m_scu_index[DMA_CH] = state->m_scu_dst[DMA_CH];
+ if(!DWUP(DMA_CH)) state->m_scu.index[DMA_CH] = state->m_scu.dst[DMA_CH];
}
/*Start factor enable bits,bit 2,bit 1 and bit 0*/
@@ -1584,22 +1584,22 @@ static void scu_dma_direct(address_space *space, UINT8 dma_ch)
static UINT32 tmp_src,tmp_dst,tmp_size;
if(LOG_SCU) printf("DMA lv %d transfer START\n"
- "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]);
- if(LOG_SCU) printf("Start Add %04x Destination Add %04x\n",state->m_scu_src_add[dma_ch],state->m_scu_dst_add[dma_ch]);
+ "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]);
+ if(LOG_SCU) printf("Start Add %04x Destination Add %04x\n",state->m_scu.src_add[dma_ch],state->m_scu.dst_add[dma_ch]);
DnMV_1(dma_ch);
/* max size */
- if(state->m_scu_size[dma_ch] == 0) { state->m_scu_size[dma_ch] = (dma_ch == 0) ? 0x00100000 : 0x2000; }
+ if(state->m_scu.size[dma_ch] == 0) { state->m_scu.size[dma_ch] = (dma_ch == 0) ? 0x00100000 : 0x2000; }
/*set here the boundaries checks*/
/*...*/
- if((state->m_scu_dst_add[dma_ch] != state->m_scu_src_add[dma_ch]) && (ABUS(dma_ch)))
+ if((state->m_scu.dst_add[dma_ch] != state->m_scu.src_add[dma_ch]) && (ABUS(dma_ch)))
{
logerror("A-Bus invalid transfer,sets to default\n");
- scu_add_tmp = (state->m_scu_dst_add[dma_ch]*0x100) | (state->m_scu_src_add[dma_ch]);
- state->m_scu_dst_add[dma_ch] = state->m_scu_src_add[dma_ch] = 4;
+ scu_add_tmp = (state->m_scu.dst_add[dma_ch]*0x100) | (state->m_scu.src_add[dma_ch]);
+ state->m_scu.dst_add[dma_ch] = state->m_scu.src_add[dma_ch] = 4;
scu_add_tmp |= 0x80000000;
}
@@ -1629,54 +1629,54 @@ static void scu_dma_direct(address_space *space, UINT8 dma_ch)
if(VDP1_REGS(dst_0))
{
logerror("VDP1 register access,must be in word units\n");
- scu_add_tmp = (state->m_scu_dst_add[0]*0x100) | (state->m_scu_src_add[0]);
- state->m_scu_dst_add[0] = state->m_scu_src_add[0] = 2;
+ scu_add_tmp = (state->m_scu.dst_add[0]*0x100) | (state->m_scu.src_add[0]);
+ state->m_scu.dst_add[0] = state->m_scu.src_add[0] = 2;
scu_add_tmp |= 0x80000000;
}
if(DRUP(0))
{
logerror("Data read update = 1,read address add value must be 1 too\n");
- scu_add_tmp = (state->m_scu_dst_add[0]*0x100) | (state->m_scu_src_add[0]);
- state->m_scu_src_add[0] = 4;
+ scu_add_tmp = (state->m_scu.dst_add[0]*0x100) | (state->m_scu.src_add[0]);
+ state->m_scu.src_add[0] = 4;
scu_add_tmp |= 0x80000000;
}
- if (WORK_RAM_H(dst_0) && (state->m_scu_dst_add[0] != 4))
+ if (WORK_RAM_H(dst_0) && (state->m_scu.dst_add[0] != 4))
{
- scu_add_tmp = (state->m_scu_dst_add[0]*0x100) | (state->m_scu_src_add[0]);
- state->m_scu_dst_add[0] = 4;
+ scu_add_tmp = (state->m_scu.dst_add[0]*0x100) | (state->m_scu.src_add[0]);
+ state->m_scu.dst_add[0] = 4;
scu_add_tmp |= 0x80000000;
}
#endif
- tmp_size = state->m_scu_size[dma_ch];
- if(!(DRUP(dma_ch))) tmp_src = state->m_scu_src[dma_ch];
- if(!(DWUP(dma_ch))) tmp_dst = state->m_scu_dst[dma_ch];
+ tmp_size = state->m_scu.size[dma_ch];
+ if(!(DRUP(dma_ch))) tmp_src = state->m_scu.src[dma_ch];
+ if(!(DWUP(dma_ch))) tmp_dst = state->m_scu.dst[dma_ch];
- for (; state->m_scu_size[dma_ch] > 0; state->m_scu_size[dma_ch]-=state->m_scu_dst_add[dma_ch])
+ for (; state->m_scu.size[dma_ch] > 0; state->m_scu.size[dma_ch]-=state->m_scu.dst_add[dma_ch])
{
- if(state->m_scu_dst_add[dma_ch] == 2)
- space->write_word(state->m_scu_dst[dma_ch],space->read_word(state->m_scu_src[dma_ch]));
- else if(state->m_scu_dst_add[dma_ch] == 8)
+ if(state->m_scu.dst_add[dma_ch] == 2)
+ space->write_word(state->m_scu.dst[dma_ch],space->read_word(state->m_scu.src[dma_ch]));
+ else if(state->m_scu.dst_add[dma_ch] == 8)
{
- space->write_word(state->m_scu_dst[dma_ch], space->read_word(state->m_scu_src[dma_ch] ));
- space->write_word(state->m_scu_dst[dma_ch]+2,space->read_word(state->m_scu_src[dma_ch] ));
- space->write_word(state->m_scu_dst[dma_ch]+4,space->read_word(state->m_scu_src[dma_ch]+2));
- space->write_word(state->m_scu_dst[dma_ch]+6,space->read_word(state->m_scu_src[dma_ch]+2));
+ space->write_word(state->m_scu.dst[dma_ch], space->read_word(state->m_scu.src[dma_ch] ));
+ space->write_word(state->m_scu.dst[dma_ch]+2,space->read_word(state->m_scu.src[dma_ch] ));
+ space->write_word(state->m_scu.dst[dma_ch]+4,space->read_word(state->m_scu.src[dma_ch]+2));
+ space->write_word(state->m_scu.dst[dma_ch]+6,space->read_word(state->m_scu.src[dma_ch]+2));
}
else
{
- space->write_word(state->m_scu_dst[dma_ch], space->read_word(state->m_scu_src[dma_ch] ));
- space->write_word(state->m_scu_dst[dma_ch]+2,space->read_word(state->m_scu_src[dma_ch]+2));
+ space->write_word(state->m_scu.dst[dma_ch], space->read_word(state->m_scu.src[dma_ch] ));
+ space->write_word(state->m_scu.dst[dma_ch]+2,space->read_word(state->m_scu.src[dma_ch]+2));
}
- state->m_scu_dst[dma_ch]+=state->m_scu_dst_add[dma_ch];
- state->m_scu_src[dma_ch]+=state->m_scu_src_add[dma_ch];
+ state->m_scu.dst[dma_ch]+=state->m_scu.dst_add[dma_ch];
+ state->m_scu.src[dma_ch]+=state->m_scu.src_add[dma_ch];
}
- state->m_scu_size[dma_ch] = tmp_size;
- if(!(DRUP(dma_ch))) state->m_scu_src[dma_ch] = tmp_src;
- if(!(DWUP(dma_ch))) state->m_scu_dst[dma_ch] = tmp_dst;
+ state->m_scu.size[dma_ch] = tmp_size;
+ if(!(DRUP(dma_ch))) state->m_scu.src[dma_ch] = tmp_src;
+ if(!(DWUP(dma_ch))) state->m_scu.dst[dma_ch] = tmp_dst;
if(dma_ch != 2)
if(LOG_SCU) logerror("DMA transfer END\n");
@@ -1691,8 +1691,8 @@ static void scu_dma_direct(address_space *space, UINT8 dma_ch)
if(scu_add_tmp & 0x80000000)
{
- state->m_scu_dst_add[dma_ch] = (scu_add_tmp & 0xff00) >> 8;
- state->m_scu_src_add[dma_ch] = (scu_add_tmp & 0x00ff) >> 0;
+ state->m_scu.dst_add[dma_ch] = (scu_add_tmp & 0xff00) >> 8;
+ state->m_scu.src_add[dma_ch] = (scu_add_tmp & 0x00ff) >> 0;
scu_add_tmp^=0x80000000;
}
}
@@ -1708,17 +1708,17 @@ static void scu_dma_indirect(address_space *space,UINT8 dma_ch)
DnMV_1(dma_ch);
- if(state->m_scu_index[dma_ch] == 0) { state->m_scu_index[dma_ch] = state->m_scu_dst[0]; }
+ if(state->m_scu.index[dma_ch] == 0) { state->m_scu.index[dma_ch] = state->m_scu.dst[0]; }
do{
- tmp_src = state->m_scu_index[dma_ch];
+ tmp_src = state->m_scu.index[dma_ch];
- state->m_scu_size[dma_ch] = space->read_dword(state->m_scu_index[dma_ch]);
- state->m_scu_src[dma_ch] = space->read_dword(state->m_scu_index[dma_ch]+8);
- state->m_scu_dst[dma_ch] = space->read_dword(state->m_scu_index[dma_ch]+4);
+ state->m_scu.size[dma_ch] = space->read_dword(state->m_scu.index[dma_ch]);
+ state->m_scu.src[dma_ch] = space->read_dword(state->m_scu.index[dma_ch]+8);
+ state->m_scu.dst[dma_ch] = space->read_dword(state->m_scu.index[dma_ch]+4);
/*Indirect Mode end factor*/
- if(state->m_scu_src[dma_ch] & 0x80000000)
+ if(state->m_scu.src[dma_ch] & 0x80000000)
job_done = 1;
#if 0
@@ -1730,20 +1730,20 @@ static void scu_dma_indirect(address_space *space,UINT8 dma_ch)
#endif
if(LOG_SCU) printf("DMA lv %d indirect mode transfer START\n"
- "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]);
- if(LOG_SCU) printf("Start Add %04x Destination Add %04x\n",state->m_scu_src_add[dma_ch],state->m_scu_dst_add[dma_ch]);
+ "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]);
+ if(LOG_SCU) printf("Start Add %04x Destination Add %04x\n",state->m_scu.src_add[dma_ch],state->m_scu.dst_add[dma_ch]);
//guess,but I believe it's right.
- state->m_scu_src[dma_ch] &=0x07ffffff;
- state->m_scu_dst[dma_ch] &=0x07ffffff;
- state->m_scu_size[dma_ch] &= ((dma_ch == 0) ? 0xfffff : 0x1fff);
+ state->m_scu.src[dma_ch] &=0x07ffffff;
+ state->m_scu.dst[dma_ch] &=0x07ffffff;
+ state->m_scu.size[dma_ch] &= ((dma_ch == 0) ? 0xfffff : 0x1fff);
- if(state->m_scu_size[dma_ch] == 0) { state->m_scu_size[dma_ch] = (dma_ch == 0) ? 0x00100000 : 0x2000; }
+ if(state->m_scu.size[dma_ch] == 0) { state->m_scu.size[dma_ch] = (dma_ch == 0) ? 0x00100000 : 0x2000; }
- for (; state->m_scu_size[dma_ch] > 0; state->m_scu_size[dma_ch]-=state->m_scu_dst_add[dma_ch])
+ for (; state->m_scu.size[dma_ch] > 0; state->m_scu.size[dma_ch]-=state->m_scu.dst_add[dma_ch])
{
- if(state->m_scu_dst_add[dma_ch] == 2)
- space->write_word(state->m_scu_dst[dma_ch],space->read_word(state->m_scu_src[dma_ch]));
+ if(state->m_scu.dst_add[dma_ch] == 2)
+ space->write_word(state->m_scu.dst[dma_ch],space->read_word(state->m_scu.src[dma_ch]));
else
{
/* some games, eg columns97 are a bit weird, I'm not sure this is correct
@@ -1751,17 +1751,17 @@ static void scu_dma_indirect(address_space *space,UINT8 dma_ch)
can't access 2 byte boundaries, and the end of the sprite list never gets marked,
the length of the transfer is also set to a 2 byte boundary, maybe the add values
should be different, I don't know */
- space->write_word(state->m_scu_dst[dma_ch],space->read_word(state->m_scu_src[dma_ch]));
- space->write_word(state->m_scu_dst[dma_ch]+2,space->read_word(state->m_scu_src[dma_ch]+2));
+ space->write_word(state->m_scu.dst[dma_ch],space->read_word(state->m_scu.src[dma_ch]));
+ space->write_word(state->m_scu.dst[dma_ch]+2,space->read_word(state->m_scu.src[dma_ch]+2));
}
- state->m_scu_dst[dma_ch]+=state->m_scu_dst_add[dma_ch];
- state->m_scu_src[dma_ch]+=state->m_scu_src_add[dma_ch];
+ state->m_scu.dst[dma_ch]+=state->m_scu.dst_add[dma_ch];
+ state->m_scu.src[dma_ch]+=state->m_scu.src_add[dma_ch];
}
- //if(DRUP(0)) space->write_dword(tmp_src+8,state->m_scu_src[0]|job_done ? 0x80000000 : 0);
- //if(DWUP(0)) space->write_dword(tmp_src+4,state->m_scu_dst[0]);
+ //if(DRUP(0)) space->write_dword(tmp_src+8,state->m_scu.src[0]|job_done ? 0x80000000 : 0);
+ //if(DWUP(0)) space->write_dword(tmp_src+4,state->m_scu.dst[0]);
- state->m_scu_index[dma_ch] = tmp_src+0xc;
+ state->m_scu.index[dma_ch] = tmp_src+0xc;
}while(job_done == 0);
diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h
index b27b4479ce4..5e262954132 100644
--- a/src/mame/includes/stv.h
+++ b/src/mame/includes/stv.h
@@ -18,17 +18,18 @@ public:
UINT32 *m_vdp2_cram;
UINT32 *m_vdp1_vram;
UINT32 *m_vdp1_regs;
- UINT8 *m_vdp1_gfx_decode;
UINT8 m_NMI_reset;
UINT8 m_en_68k;
- UINT32 m_scu_src[3]; /* Source DMA lv n address*/
- UINT32 m_scu_dst[3]; /* Destination DMA lv n address*/
- UINT32 m_scu_src_add[3]; /* Source Addition for DMA lv n*/
- UINT32 m_scu_dst_add[3]; /* Destination Addition for DMA lv n*/
- INT32 m_scu_size[3]; /* Transfer DMA size lv n*/
- UINT32 m_scu_index[3];
+ struct {
+ UINT32 src[3]; /* Source DMA lv n address*/
+ UINT32 dst[3]; /* Destination DMA lv n address*/
+ UINT32 src_add[3]; /* Source Addition for DMA lv n*/
+ UINT32 dst_add[3]; /* Destination Addition for DMA lv n*/
+ INT32 size[3]; /* Transfer DMA size lv n*/
+ UINT32 index[3];
+ }m_scu;
int m_minit_boost;
int m_sinit_boost;
@@ -49,11 +50,19 @@ public:
rectangle user_cliprect;
UINT16 *framebuffer[2];
UINT16 **framebuffer_draw_lines;
+ UINT8 *gfx_decode;
int local_x;
int local_y;
}m_vdp1;
+ struct {
+ int old_vres;
+ int old_hres;
+
+ UINT8 *gfx_decode;
+ bitmap_t *roz_bitmap[2];
+ }m_vdp2;
/* ST-V specific */
UINT8 m_stv_multi_bank;
diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c
index 9710728f176..5dc82c81559 100644
--- a/src/mame/video/stvvdp1.c
+++ b/src/mame/video/stvvdp1.c
@@ -323,7 +323,7 @@ READ32_HANDLER ( saturn_vdp1_vram_r )
WRITE32_HANDLER ( saturn_vdp1_vram_w )
{
saturn_state *state = space->machine().driver_data<saturn_state>();
- UINT8 *vdp1 = state->m_vdp1_gfx_decode;
+ UINT8 *vdp1 = state->m_vdp1.gfx_decode;
COMBINE_DATA (&state->m_vdp1_vram[offset]);
@@ -1037,7 +1037,7 @@ static void stv_vdp1_set_drawpixel(running_machine &machine)
int mesh = stv2_current_sprite.CMDPMOD & 0x100;
int ecd = stv2_current_sprite.CMDPMOD & 0x80;
- gfxdata = state->m_vdp1_gfx_decode;
+ gfxdata = state->m_vdp1.gfx_decode;
if ( mesh || !ecd || ((stv2_current_sprite.CMDPMOD & 0x7) != 0) )
{
@@ -2070,7 +2070,7 @@ void video_update_vdp1(running_machine &machine)
static void stv_vdp1_state_save_postload(running_machine &machine)
{
saturn_state *state = machine.driver_data<saturn_state>();
- UINT8 *vdp1 = state->m_vdp1_gfx_decode;
+ UINT8 *vdp1 = state->m_vdp1.gfx_decode;
int offset;
UINT32 data;
@@ -2095,7 +2095,7 @@ int stv_vdp1_start ( running_machine &machine )
saturn_state *state = machine.driver_data<saturn_state>();
state->m_vdp1_regs = auto_alloc_array_clear(machine, UINT32, 0x040000/4 );
state->m_vdp1_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 );
- state->m_vdp1_gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 );
+ state->m_vdp1.gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 );
stv_vdp1_shading_data = auto_alloc(machine, struct stv_vdp1_poly_scanline_data);
diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c
index db30342f80d..8b6e0ce756d 100644
--- a/src/mame/video/stvvdp2.c
+++ b/src/mame/video/stvvdp2.c
@@ -105,12 +105,6 @@ In other words,the first three types uses the offset and not the color allocated
#include "profiler.h"
#include "includes/stv.h"
-static UINT8* stv_vdp2_gfx_decode;
-
-static int stv_vdp2_render_rbg0;
-static int horz_res,vert_res;
-
-
static void stv_vdp2_dynamic_res_change(running_machine &machine);
static UINT8 get_hblank(running_machine &machine);
static int get_vblank_duration(running_machine &machine);
@@ -122,7 +116,6 @@ static int stv_vdp2_window_process(running_machine &machine,int x,int y);
static int stv_vdp2_apply_window_on_layer(running_machine &machine,rectangle *cliprect);
static void stv_vdp2_get_window0_coordinates(running_machine &machine,UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y);
static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect);
-static bitmap_t *stv_vdp2_roz_bitmap[2];
enum
{
@@ -2723,12 +2716,13 @@ static void stv_vdp2_compute_color_offset_RGB555_UINT16(running_machine &machine
static void stv_vdp2_drawgfx_rgb555( bitmap_t *dest_bmp, const rectangle *clip, running_machine &machine, UINT32 code, int flipx, int flipy,
int sx, int sy, int transparency, int alpha)
{
+ saturn_state *state = machine.driver_data<saturn_state>();
rectangle myclip;
UINT8* gfxdata;
int t_pen;
int sprite_screen_width, sprite_screen_height;
- gfxdata = stv_vdp2_gfx_decode + code * 0x20;
+ gfxdata = state->m_vdp2.gfx_decode + code * 0x20;
sprite_screen_width = sprite_screen_height = 8;
/* KW 991012 -- Added code to force clip to bitmap boundary */
@@ -2857,7 +2851,7 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_t *bitma
int ysize = 0/*, ysizemask = 0*/;
int xlinesize = 0/*, xpixelsize = 0*/;
int xcnt,ycnt;
- UINT8* gfxdata = stv_vdp2_gfx_decode;
+ UINT8* gfxdata = state->m_vdp2.gfx_decode;
static UINT16 *destline;
UINT16 pal_color_offset = 0;
UINT8* gfxdatalow, *gfxdatahigh;
@@ -4896,8 +4890,8 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_t *bi
}
else
{
- if ( stv_vdp2_roz_bitmap[iRP-1] == NULL )
- stv_vdp2_roz_bitmap[iRP-1] = auto_alloc(machine, bitmap_t(4096, 4096, machine.primary_screen->format()));
+ if ( state->m_vdp2.roz_bitmap[iRP-1] == NULL )
+ state->m_vdp2.roz_bitmap[iRP-1] = auto_alloc(machine, bitmap_t(4096, 4096, machine.primary_screen->format()));
roz_clip_rect.min_x = roz_clip_rect.min_y = 0;
if ( (iRP == 1 && STV_VDP2_RAOVR == 3) ||
@@ -4934,8 +4928,8 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_t *bi
if ( (stv_rbg_cache_data.is_cache_dirty & iRP) ||
memcmp(&stv_rbg_cache_data.layer_data[iRP-1],&stv2_current_tilemap,sizeof(stv2_current_tilemap)) != 0 )
{
- bitmap_fill( stv_vdp2_roz_bitmap[iRP-1], &roz_clip_rect , get_black_pen(machine));
- stv_vdp2_check_tilemap(machine, stv_vdp2_roz_bitmap[iRP-1], &roz_clip_rect);
+ bitmap_fill( state->m_vdp2.roz_bitmap[iRP-1], &roz_clip_rect , get_black_pen(machine));
+ stv_vdp2_check_tilemap(machine, state->m_vdp2.roz_bitmap[iRP-1], &roz_clip_rect);
// prepare cache data
stv_rbg_cache_data.watch_vdp2_vram_writes |= iRP;
stv_rbg_cache_data.is_cache_dirty &= ~iRP;
@@ -4970,7 +4964,7 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_t *bi
stv2_current_tilemap.fade_control = fade_control;
g_profiler.start(PROFILER_USER2);
- stv_vdp2_copy_roz_bitmap(bitmap, machine, stv_vdp2_roz_bitmap[iRP-1], &mycliprect, iRP, planesizex, planesizey, planerenderedsizex, planerenderedsizey );
+ stv_vdp2_copy_roz_bitmap(bitmap, machine, state->m_vdp2.roz_bitmap[iRP-1], &mycliprect, iRP, planesizex, planesizey, planerenderedsizex, planerenderedsizey );
g_profiler.stop();
}
@@ -5054,7 +5048,6 @@ static void stv_vdp2_draw_RBG0(running_machine &machine, bitmap_t *bitmap, const
/*Use 0x80 as a normal/rotate switch*/
stv2_current_tilemap.layer_name=0x80;
- if ( !stv_vdp2_render_rbg0 ) return;
if ( !stv2_current_tilemap.enabled ) return;
switch(STV_VDP2_RPMD)
@@ -5081,7 +5074,7 @@ static void stv_vdp2_draw_back(running_machine &machine, bitmap_t *bitmap, const
{
saturn_state *state = machine.driver_data<saturn_state>();
int xcnt,ycnt;
- UINT8* gfxdata = stv_vdp2_gfx_decode;
+ UINT8* gfxdata = state->m_vdp2.gfx_decode;
static UINT16 *destline;
int r,b,g;
UINT16 data;
@@ -5124,7 +5117,7 @@ static void stv_vdp2_draw_back(running_machine &machine, bitmap_t *bitmap, const
WRITE32_HANDLER ( saturn_vdp2_vram_w )
{
saturn_state *state = space->machine().driver_data<saturn_state>();
- UINT8* gfxdata = stv_vdp2_gfx_decode;
+ UINT8* gfxdata = state->m_vdp2.gfx_decode;
COMBINE_DATA(&state->m_vdp2_vram[offset]);
@@ -5407,7 +5400,7 @@ static UINT8 get_odd_bit(running_machine &machine)
static void stv_vdp2_state_save_postload(running_machine &machine)
{
saturn_state *state = machine.driver_data<saturn_state>();
- UINT8 *gfxdata = stv_vdp2_gfx_decode;
+ UINT8 *gfxdata = state->m_vdp2.gfx_decode;
int offset;
UINT32 data;
@@ -5443,7 +5436,8 @@ static void stv_vdp2_state_save_postload(running_machine &machine)
static void stv_vdp2_exit (running_machine &machine)
{
- stv_vdp2_roz_bitmap[0] = stv_vdp2_roz_bitmap[1] = NULL;
+ saturn_state *state = machine.driver_data<saturn_state>();
+ state->m_vdp2.roz_bitmap[0] = state->m_vdp2.roz_bitmap[1] = NULL;
}
static int stv_vdp2_start (running_machine &machine)
@@ -5454,9 +5448,8 @@ static int stv_vdp2_start (running_machine &machine)
state->m_vdp2_regs = auto_alloc_array_clear(machine, UINT32, 0x040000/4 );
state->m_vdp2_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 ); // actually we only need half of it since we don't emulate extra 4mbit ram cart.
state->m_vdp2_cram = auto_alloc_array_clear(machine, UINT32, 0x080000/4 );
- stv_vdp2_gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 );
+ state->m_vdp2.gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 );
- stv_vdp2_render_rbg0 = 1;
// machine.gfx[0]->color_granularity=4;
// machine.gfx[1]->color_granularity=4;
@@ -5476,26 +5469,26 @@ static int stv_vdp2_start (running_machine &machine)
VIDEO_START( stv_vdp2 )
{
saturn_state *state = machine.driver_data<saturn_state>();
- stv_vdp2_roz_bitmap[0] = stv_vdp2_roz_bitmap[1] = NULL;
+ state->m_vdp2.roz_bitmap[0] = state->m_vdp2.roz_bitmap[1] = NULL;
stv_vdp2_start(machine);
stv_vdp1_start(machine);
debug.l_en = 0xff;
debug.error = 0xffffffff;
debug.roz = 0;
- gfx_element_set_source(machine.gfx[0], stv_vdp2_gfx_decode);
- gfx_element_set_source(machine.gfx[1], stv_vdp2_gfx_decode);
- gfx_element_set_source(machine.gfx[2], stv_vdp2_gfx_decode);
- gfx_element_set_source(machine.gfx[3], stv_vdp2_gfx_decode);
- gfx_element_set_source(machine.gfx[4], state->m_vdp1_gfx_decode);
- gfx_element_set_source(machine.gfx[5], state->m_vdp1_gfx_decode);
- gfx_element_set_source(machine.gfx[6], state->m_vdp1_gfx_decode);
- gfx_element_set_source(machine.gfx[7], state->m_vdp1_gfx_decode);
+ gfx_element_set_source(machine.gfx[0], state->m_vdp2.gfx_decode);
+ gfx_element_set_source(machine.gfx[1], state->m_vdp2.gfx_decode);
+ gfx_element_set_source(machine.gfx[2], state->m_vdp2.gfx_decode);
+ gfx_element_set_source(machine.gfx[3], state->m_vdp2.gfx_decode);
+ gfx_element_set_source(machine.gfx[4], state->m_vdp1.gfx_decode);
+ gfx_element_set_source(machine.gfx[5], state->m_vdp1.gfx_decode);
+ gfx_element_set_source(machine.gfx[6], state->m_vdp1.gfx_decode);
+ gfx_element_set_source(machine.gfx[7], state->m_vdp1.gfx_decode);
}
static void stv_vdp2_dynamic_res_change(running_machine &machine)
{
saturn_state *state = machine.driver_data<saturn_state>();
- static UINT8 old_vres = 0,old_hres = 0;
+ int horz_res,vert_res;
switch( STV_VDP2_VRES & 3 )
{
@@ -5526,7 +5519,7 @@ static void stv_vdp2_dynamic_res_change(running_machine &machine)
}
// horz_res+=1;
// vert_res*=2;
- if(old_vres != vert_res || old_hres != horz_res)
+ if(state->m_vdp2.old_vres != vert_res || state->m_vdp2.old_hres != horz_res)
{
int vblank_period,hblank_period;
rectangle visarea = machine.primary_screen->visible_area();
@@ -5541,8 +5534,8 @@ static void stv_vdp2_dynamic_res_change(running_machine &machine)
// hblank_period = get_hblank_duration(machine.primary_screen);
machine.primary_screen->configure((horz_res+hblank_period), (vert_res+vblank_period), visarea, machine.primary_screen->frame_period().attoseconds );
- old_vres = vert_res;
- old_hres = horz_res;
+ state->m_vdp2.old_vres = vert_res;
+ state->m_vdp2.old_hres = horz_res;
}
// machine.primary_screen->set_visible_area(0*8, horz_res-1,0*8, vert_res-1);
//if(LOG_VDP2) popmessage("%04d %04d",horz_res-1,vert-1);