Misc cleanups (nw)

This commit is contained in:
Ivan Vangelista 2014-10-16 12:14:59 +00:00
parent b3d3d02cef
commit b5d1824468
17 changed files with 195 additions and 201 deletions

View File

@ -312,7 +312,7 @@ void atarigt_state::tmek_protection_r(address_space &space, offs_t offset, UINT1
/* status register; the code spins on this waiting for the high bit to be set */
case 0xdb8700:
case 0xdb87c0:
// if (state->m_protmode != 0)
// if (m_protmode != 0)
{
*data = -1;//0x8000;
}

View File

@ -181,6 +181,10 @@ class cybertnk_state : public driver_device
public:
cybertnk_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_spr_ram(*this, "spr_ram"),
m_tilemap0_vram(*this, "tilemap0_vram"),
m_tilemap1_vram(*this, "tilemap1_vram"),
@ -188,20 +192,12 @@ public:
m_tilemap0scroll(*this, "tilemap1_scroll"),
m_tilemap1scroll(*this, "tilemap1_scroll"),
m_tilemap2scroll(*this, "tilemap2_scroll"),
m_roadram(*this, "roadram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
tilemap_t *m_tilemap0_tilemap;
tilemap_t *m_tilemap1_tilemap;
tilemap_t *m_tilemap2_tilemap;
DECLARE_WRITE16_MEMBER(tilemap0_vram_w);
DECLARE_WRITE16_MEMBER(tilemap1_vram_w);
DECLARE_WRITE16_MEMBER(tilemap2_vram_w);
m_roadram(*this, "roadram") { }
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT16> m_spr_ram;
required_shared_ptr<UINT16> m_tilemap0_vram;
@ -211,6 +207,14 @@ public:
required_shared_ptr<UINT16> m_tilemap1scroll;
required_shared_ptr<UINT16> m_tilemap2scroll;
required_shared_ptr<UINT16> m_roadram;
tilemap_t *m_tilemap0_tilemap;
tilemap_t *m_tilemap1_tilemap;
tilemap_t *m_tilemap2_tilemap;
DECLARE_WRITE16_MEMBER(tilemap0_vram_w);
DECLARE_WRITE16_MEMBER(tilemap1_vram_w);
DECLARE_WRITE16_MEMBER(tilemap2_vram_w);
UINT8 m_mux_data;
DECLARE_WRITE8_MEMBER(cybertnk_sound_cmd_w);
@ -224,12 +228,11 @@ public:
TILE_GET_INFO_MEMBER(get_tilemap1_tile_info);
TILE_GET_INFO_MEMBER(get_tilemap2_tile_info);
virtual void video_start();
void draw_road(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift, int pri);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift);
UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift);
UINT32 screen_update_cybertnk_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_cybertnk_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
};
/* tile format
@ -293,18 +296,16 @@ void cybertnk_state::video_start()
static void draw_road(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift, int pri)
void cybertnk_state::draw_road(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift, int pri)
{
cybertnk_state *state = screen.machine().driver_data<cybertnk_state>();
int i;
gfx_element *gfx = state->m_gfxdecode->gfx(3);
gfx_element *gfx = m_gfxdecode->gfx(3);
for (i=0;i<0x1000/4;i+=4)
for (int i = 0; i < 0x1000/4; i+=4)
{
UINT16 param1 = state->m_roadram[i+2];
UINT16 param2 = state->m_roadram[i+1];
UINT16 param3 = state->m_roadram[i+0];
UINT16 param1 = m_roadram[i+2];
UINT16 param2 = m_roadram[i+1];
UINT16 param3 = m_roadram[i+0];
int col = (param2 & 0x3f);
@ -319,11 +320,10 @@ static void draw_road(screen_device &screen, bitmap_ind16 &bitmap, const rectang
}
// check if these are similar / the same as weclemans
static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift)
void cybertnk_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift)
{
cybertnk_state *state = screen.machine().driver_data<cybertnk_state>();
const UINT32 *sprrom = (UINT32*)screen.memregion(":spr_gfx")->base();
const pen_t *paldata = state->m_palette->pens();
const UINT32 *sprrom = (UINT32*)memregion("spr_gfx")->base();
const pen_t *paldata = m_palette->pens();
int miny = cliprect.min_y;
int maxy = cliprect.max_y;
@ -355,24 +355,24 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
for(int offs=0;offs<0x1000/2;offs+=8)
{
if ((state->m_spr_ram[offs+0x0] & 8) == 0)
if ((m_spr_ram[offs+0x0] & 8) == 0)
continue;
int x = (state->m_spr_ram[offs+0x5] & 0x3ff);
int x = (m_spr_ram[offs+0x5] & 0x3ff);
if (x&0x200) x-=0x400;
int y = (state->m_spr_ram[offs+0x2] & 0x1ff);
int y = (m_spr_ram[offs+0x2] & 0x1ff);
if (y&0x100) y-=0x200;
UINT32 spr_offs = (((state->m_spr_ram[offs+0x0] & 7) << 16) | (state->m_spr_ram[offs+0x1]));
int xsize = ((state->m_spr_ram[offs+0x6] & 0x000f)+1) << 3;
int ysize = (state->m_spr_ram[offs+0x4] & 0x00ff)+1;
int fx = (state->m_spr_ram[offs+0x5] & 0x8000) >> 15;
int zoom = (state->m_spr_ram[offs+0x6] & 0xff00) >> 8;
UINT32 spr_offs = (((m_spr_ram[offs+0x0] & 7) << 16) | (m_spr_ram[offs+0x1]));
int xsize = ((m_spr_ram[offs+0x6] & 0x000f)+1) << 3;
int ysize = (m_spr_ram[offs+0x4] & 0x00ff)+1;
int fx = (m_spr_ram[offs+0x5] & 0x8000) >> 15;
int zoom = (m_spr_ram[offs+0x6] & 0xff00) >> 8;
int col_bank = (state->m_spr_ram[offs+0x0] & 0xff00) >> 8;
int col_bank = (m_spr_ram[offs+0x0] & 0xff00) >> 8;
int xf = 0;
int yf = 0;
@ -472,35 +472,33 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
}
static UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift)
UINT32 cybertnk_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift)
{
cybertnk_state *state = screen.machine().driver_data<cybertnk_state>();
m_tilemap0_tilemap->set_scrolldx(screen_shift, screen_shift);
m_tilemap1_tilemap->set_scrolldx(screen_shift, screen_shift);
m_tilemap2_tilemap->set_scrolldx(screen_shift, screen_shift);
state->m_tilemap0_tilemap->set_scrolldx(screen_shift, screen_shift);
state->m_tilemap1_tilemap->set_scrolldx(screen_shift, screen_shift);
state->m_tilemap2_tilemap->set_scrolldx(screen_shift, screen_shift);
m_tilemap1_tilemap->set_scrolly(m_tilemap1scroll[2]);
m_tilemap2_tilemap->set_scrolly(m_tilemap2scroll[2]);
state->m_tilemap1_tilemap->set_scrolly(state->m_tilemap1scroll[2]);
state->m_tilemap2_tilemap->set_scrolly(state->m_tilemap2scroll[2]);
state->m_tilemap1_tilemap->set_scrollx(state->m_tilemap1scroll[0]);
state->m_tilemap2_tilemap->set_scrollx(state->m_tilemap2scroll[0]);
m_tilemap1_tilemap->set_scrollx(m_tilemap1scroll[0]);
m_tilemap2_tilemap->set_scrollx(m_tilemap2scroll[0]);
bitmap.fill(state->m_palette->black_pen(), cliprect);
bitmap.fill(m_palette->black_pen(), cliprect);
draw_road(screen,bitmap,cliprect,screen_shift, 0x00);
state->m_tilemap2_tilemap->draw(screen, bitmap, cliprect, 0,0);
state->m_tilemap1_tilemap->draw(screen, bitmap, cliprect, 0,0);
m_tilemap2_tilemap->draw(screen, bitmap, cliprect, 0,0);
m_tilemap1_tilemap->draw(screen, bitmap, cliprect, 0,0);
draw_road(screen,bitmap,cliprect,screen_shift, 0x80);
draw_sprites(screen,bitmap,cliprect,screen_shift);
state->m_tilemap0_tilemap->draw(screen, bitmap, cliprect, 0,0);
m_tilemap0_tilemap->draw(screen, bitmap, cliprect, 0,0);
return 0;

View File

@ -195,7 +195,7 @@ WRITE32_MEMBER(djmain_state::v_ctrl_w)
mem_mask >>= 16;
COMBINE_DATA(&m_v_ctrl);
if (m_pending_vb_int && !(!(m_v_ctrl & 0x8000))) // #define DISABLE_VB_INT (!(state->m_v_ctrl & 0x8000))
if (m_pending_vb_int && !(!(m_v_ctrl & 0x8000))) // #define DISABLE_VB_INT (!(m_v_ctrl & 0x8000))
{
m_pending_vb_int = 0;
m_maincpu->set_input_line(M68K_IRQ_4, HOLD_LINE);

View File

@ -568,21 +568,19 @@ READ32_MEMBER(hng64_state::hng64_sysregs_r)
}
/* preliminary dma code, dma is used to copy program code -> ram */
static void hng64_do_dma(address_space &space)
void hng64_state::do_dma(address_space &space)
{
hng64_state *state = space.machine().driver_data<hng64_state>();
//printf("Performing DMA Start %08x Len %08x Dst %08x\n", m_dma_start, m_dma_len, m_dma_dst);
//printf("Performing DMA Start %08x Len %08x Dst %08x\n", state->m_dma_start, state->m_dma_len, state->m_dma_dst);
while (state->m_dma_len >= 0)
while (m_dma_len >= 0)
{
UINT32 dat;
dat = space.read_dword(state->m_dma_start);
space.write_dword(state->m_dma_dst, dat);
state->m_dma_start += 4;
state->m_dma_dst += 4;
state->m_dma_len--;
dat = space.read_dword(m_dma_start);
space.write_dword(m_dma_dst, dat);
m_dma_start += 4;
m_dma_dst += 4;
m_dma_len--;
}
}
@ -626,7 +624,7 @@ WRITE32_MEMBER(hng64_state::hng64_sysregs_w)
case 0x1214: m_dma_dst = m_sysregs[offset]; break;
case 0x1224:
m_dma_len = m_sysregs[offset];
hng64_do_dma(space);
do_dma(space);
break;
//default:
// printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], space.device().safe_pc());

View File

@ -263,7 +263,7 @@ TODO: check this register,doesn't seem to be 100% correct.
*/
/*63 at post test,6d all the time.*/
#define SCC_CSR_VREG (state->m_pcab_vregs[0x00/2] & 0xffff)
#define SCC_CSR_VREG (m_pcab_vregs[0x00/2] & 0xffff)
#define SCC_CG_VREG ((SCC_CSR_VREG & 0x10)>>4)
/*

View File

@ -247,7 +247,7 @@ UINT32 model2_state::copro_fifoout_pop(address_space &space,UINT32 offset, UINT3
m_copro_fifoout_num--;
// logerror("COPRO FIFOOUT POP %08X, %f, %d\n", r, *(float*)&r,state->m_copro_fifoout_num);
// logerror("COPRO FIFOOUT POP %08X, %f, %d\n", r, *(float*)&r,m_copro_fifoout_num);
// set SHARC flag 1: 0 if space available, 1 if FIFO full
if (m_dsp_type == DSP_TYPE_SHARC)
@ -272,7 +272,7 @@ void model2_state::copro_fifoout_push(device_t *device, UINT32 data,UINT32 offse
fatalerror("Copro FIFOOUT overflow (at %08X)\n", device->safe_pc());
}
// logerror("COPRO FIFOOUT PUSH %08X, %f, %d\n", data, *(float*)&data,state->m_copro_fifoout_num);
// logerror("COPRO FIFOOUT PUSH %08X, %f, %d\n", data, *(float*)&data,m_copro_fifoout_num);
m_copro_fifoout_data[m_copro_fifoout_wpos++] = data;
if (m_copro_fifoout_wpos == COPRO_FIFOOUT_SIZE)

View File

@ -367,10 +367,10 @@ master-slave algorithm
-executes a wai (i.e. halt) opcode then expects to receive another irq...
*/
#define MAIN_Z80_RUN if(offset == 2) state->m_z80_latch = 0x00
#define MAIN_Z80_HALT if(offset == 2) state->m_z80_latch = 0x80
//#define SUB_NCS_RUN state->m_ncs_latch = 0x00
//#define SUB_NCS_HALT state->m_ncs_latch = 0x80
#define MAIN_Z80_RUN if(offset == 2) m_z80_latch = 0x00
#define MAIN_Z80_HALT if(offset == 2) m_z80_latch = 0x80
//#define SUB_NCS_RUN m_ncs_latch = 0x00
//#define SUB_NCS_HALT m_ncs_latch = 0x80
#ifdef UNUSED_CODE
WRITE8_MEMBER(nightgal_state::nsc_latch_w)
{

View File

@ -283,17 +283,29 @@ class sfbonus_state : public driver_device
public:
sfbonus_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_nvram(*this, "nvram"),
m_1800_regs(*this, "1800_regs"),
m_vregs(*this, "vregs"),
m_2801_regs(*this, "2801_regs"),
m_2c01_regs(*this, "2c01_regs"),
m_3000_regs(*this, "3000_regs"),
m_3800_regs(*this, "3800_regs"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_3800_regs(*this, "3800_regs") { }
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_nvram;
required_shared_ptr<UINT8> m_1800_regs;
required_shared_ptr<UINT8> m_vregs;
required_shared_ptr<UINT8> m_2801_regs;
required_shared_ptr<UINT8> m_2c01_regs;
required_shared_ptr<UINT8> m_3000_regs;
required_shared_ptr<UINT8> m_3800_regs;
bitmap_ind16 *m_temp_reel_bitmap;
tilemap_t *m_tilemap;
tilemap_t *m_reel_tilemap;
@ -306,13 +318,7 @@ public:
UINT8 *m_reel3_ram;
UINT8 *m_reel4_ram;
UINT8* m_videoram;
required_shared_ptr<UINT8> m_nvram;
required_shared_ptr<UINT8> m_1800_regs;
required_shared_ptr<UINT8> m_vregs;
required_shared_ptr<UINT8> m_2801_regs;
required_shared_ptr<UINT8> m_2c01_regs;
required_shared_ptr<UINT8> m_3000_regs;
required_shared_ptr<UINT8> m_3800_regs;
DECLARE_WRITE8_MEMBER(sfbonus_videoram_w);
DECLARE_WRITE8_MEMBER(sfbonus_bank_w);
DECLARE_READ8_MEMBER(sfbonus_2800_r);
@ -456,10 +462,8 @@ public:
TILE_GET_INFO_MEMBER(get_sfbonus_reel4_tile_info);
virtual void machine_reset();
virtual void video_start();
void draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int catagory);
UINT32 screen_update_sfbonus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
};
@ -925,18 +929,17 @@ void sfbonus_state::video_start()
}
static void sfbonus_draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int catagory)
void sfbonus_state::draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int catagory)
{
sfbonus_state *state = screen.machine().driver_data<sfbonus_state>();
int zz;
int i;
int startclipmin;
const rectangle &visarea = screen.visible_area();
UINT8* selectbase = &state->m_videoram[0x600];
UINT8* bg_scroll = &state->m_videoram[0x000];
UINT8* reels_rowscroll = &state->m_videoram[0x400];
int globalyscrollreels = (state->m_vregs[6] | state->m_vregs[7]<<8);
int globalxscrollreels = (state->m_vregs[4] | state->m_vregs[5]<<8);
UINT8* selectbase = &m_videoram[0x600];
UINT8* bg_scroll = &m_videoram[0x000];
UINT8* reels_rowscroll = &m_videoram[0x400];
int globalyscrollreels = (m_vregs[6] | m_vregs[7]<<8);
int globalxscrollreels = (m_vregs[4] | m_vregs[5]<<8);
globalyscrollreels += 8;
globalxscrollreels += 8;
@ -946,16 +949,16 @@ static void sfbonus_draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap,
{
int scroll;
scroll = bg_scroll[(i*2)+0x000] | (bg_scroll[(i*2)+0x001]<<8);
state->m_reel_tilemap->set_scrolly(i, scroll + globalyscrollreels );
m_reel_tilemap->set_scrolly(i, scroll + globalyscrollreels );
scroll = bg_scroll[(i*2)+0x080] | (bg_scroll[(i*2)+0x081]<<8);
state->m_reel2_tilemap->set_scrolly(i, scroll + globalyscrollreels);
m_reel2_tilemap->set_scrolly(i, scroll + globalyscrollreels);
scroll = bg_scroll[(i*2)+0x100] | (bg_scroll[(i*2)+0x101]<<8);
state->m_reel3_tilemap->set_scrolly(i, scroll + globalyscrollreels);
m_reel3_tilemap->set_scrolly(i, scroll + globalyscrollreels);
scroll = bg_scroll[(i*2)+0x180] | (bg_scroll[(i*2)+0x181]<<8);
state->m_reel4_tilemap->set_scrolly(i, scroll + globalyscrollreels);
m_reel4_tilemap->set_scrolly(i, scroll + globalyscrollreels);
}
// printf("------------\n");
@ -983,73 +986,73 @@ static void sfbonus_draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap,
{
rowscroll = reels_rowscroll[((line/8)*2)+0x000] | (reels_rowscroll[((line/8)*2)+0x001]<<8);
xxxscroll = globalxscrollreels + rowscroll;
state->m_reel_tilemap->set_scrollx(0, xxxscroll );
state->m_reel2_tilemap->set_scrollx(0, xxxscroll );
state->m_reel3_tilemap->set_scrollx(0, xxxscroll );
state->m_reel4_tilemap->set_scrollx(0, xxxscroll );
m_reel_tilemap->set_scrollx(0, xxxscroll );
m_reel2_tilemap->set_scrollx(0, xxxscroll );
m_reel3_tilemap->set_scrollx(0, xxxscroll );
m_reel4_tilemap->set_scrollx(0, xxxscroll );
}
else if (rowenable==0x1)
{
rowscroll = reels_rowscroll[((line/8)*2)+0x080] | (reels_rowscroll[((line/8)*2)+0x081]<<8);
xxxscroll = globalxscrollreels + rowscroll;
state->m_reel_tilemap->set_scrollx(0, xxxscroll );
state->m_reel2_tilemap->set_scrollx(0, xxxscroll );
state->m_reel3_tilemap->set_scrollx(0, xxxscroll );
state->m_reel4_tilemap->set_scrollx(0, xxxscroll );
m_reel_tilemap->set_scrollx(0, xxxscroll );
m_reel2_tilemap->set_scrollx(0, xxxscroll );
m_reel3_tilemap->set_scrollx(0, xxxscroll );
m_reel4_tilemap->set_scrollx(0, xxxscroll );
}
else if (rowenable==0x2)
{
rowscroll = reels_rowscroll[((line/8)*2)+0x100] | (reels_rowscroll[((line/8)*2)+0x101]<<8);
xxxscroll = globalxscrollreels + rowscroll;
state->m_reel_tilemap->set_scrollx(0, xxxscroll );
state->m_reel2_tilemap->set_scrollx(0, xxxscroll );
state->m_reel3_tilemap->set_scrollx(0, xxxscroll );
state->m_reel4_tilemap->set_scrollx(0, xxxscroll );
m_reel_tilemap->set_scrollx(0, xxxscroll );
m_reel2_tilemap->set_scrollx(0, xxxscroll );
m_reel3_tilemap->set_scrollx(0, xxxscroll );
m_reel4_tilemap->set_scrollx(0, xxxscroll );
}
else if (rowenable==0x3)
{
rowscroll = reels_rowscroll[((line/8)*2)+0x180] | (reels_rowscroll[((line/8)*2)+0x181]<<8);
xxxscroll = globalxscrollreels + rowscroll;
state->m_reel_tilemap->set_scrollx(0, xxxscroll );
state->m_reel2_tilemap->set_scrollx(0, xxxscroll );
state->m_reel3_tilemap->set_scrollx(0, xxxscroll );
state->m_reel4_tilemap->set_scrollx(0, xxxscroll );
m_reel_tilemap->set_scrollx(0, xxxscroll );
m_reel2_tilemap->set_scrollx(0, xxxscroll );
m_reel3_tilemap->set_scrollx(0, xxxscroll );
m_reel4_tilemap->set_scrollx(0, xxxscroll );
}
if (rowenable2==0)
{
state->m_reel_tilemap->draw(screen, *state->m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),3);
m_reel_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),3);
}
if (rowenable==0)
{
state->m_reel_tilemap->draw(screen, *state->m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),3);
m_reel_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),3);
}
if (rowenable2==0x1)
{
state->m_reel2_tilemap->draw(screen, *state->m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),2);
m_reel2_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),2);
}
if (rowenable==0x1)
{
state->m_reel2_tilemap->draw(screen, *state->m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),2);
m_reel2_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),2);
}
if (rowenable2==0x2)
{
state->m_reel3_tilemap->draw(screen, *state->m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),1);
m_reel3_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),1);
}
if (rowenable==0x2)
{
state->m_reel3_tilemap->draw(screen, *state->m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),1);
m_reel3_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),1);
}
if (rowenable2==0x3)
{
state->m_reel4_tilemap->draw(screen, *state->m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),4);
m_reel4_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),4);
}
if (rowenable==0x3)
{
state->m_reel4_tilemap->draw(screen, *state->m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),4);
m_reel4_tilemap->draw(screen, *m_temp_reel_bitmap, clip, TILEMAP_DRAW_CATEGORY(catagory),4);
}
@ -1077,7 +1080,7 @@ UINT32 sfbonus_state::screen_update_sfbonus(screen_device &screen, bitmap_ind16
m_temp_reel_bitmap->fill(m_palette->pen(0), cliprect);
/* render reels to bitmap */
sfbonus_draw_reel_layer(screen,*m_temp_reel_bitmap,cliprect,0);
draw_reel_layer(screen,*m_temp_reel_bitmap,cliprect,0);
{
int y,x;

View File

@ -79,6 +79,8 @@ public:
virtual void machine_reset();
DECLARE_VIDEO_START(exidy440);
DECLARE_VIDEO_START(topsecex);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int scroll_offset, int check_collision);
void update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int scroll_offset, int check_collision);
UINT32 screen_update_exidy440(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_topsecex(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(exidy440_vblank_interrupt);

View File

@ -217,6 +217,7 @@ public:
UINT32 screen_update_hng64(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void screen_eof_hng64(screen_device &screen, bool state);
TIMER_DEVICE_CALLBACK_MEMBER(hng64_irq);
void do_dma(address_space &space);
DECLARE_CUSTOM_INPUT_MEMBER(left_handle_r);

View File

@ -134,4 +134,6 @@ public:
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
void dma_draw(UINT16 command);
void init_generic(int bpp, int sound, int prot_start, int prot_end);
void term2_init_common(write16_delegate hack_w);
};

View File

@ -241,33 +241,32 @@ WRITE8_MEMBER(midyunit_state::cvsd_protection_w)
}
static void init_generic(running_machine &machine, int bpp, int sound, int prot_start, int prot_end)
void midyunit_state::init_generic(int bpp, int sound, int prot_start, int prot_end)
{
midyunit_state *state = machine.driver_data<midyunit_state>();
offs_t gfx_chunk = state->m_gfx_rom.bytes() / 4;
offs_t gfx_chunk = m_gfx_rom.bytes() / 4;
UINT8 d1, d2, d3, d4, d5, d6;
UINT8 *base;
int i;
/* load graphics ROMs */
base = state->memregion("gfx1")->base();
base = memregion("gfx1")->base();
switch (bpp)
{
case 4:
for (i = 0; i < state->m_gfx_rom.bytes(); i += 2)
for (i = 0; i < m_gfx_rom.bytes(); i += 2)
{
d1 = ((base[0 * gfx_chunk + (i + 0) / 4]) >> (2 * ((i + 0) % 4))) & 3;
d2 = ((base[1 * gfx_chunk + (i + 0) / 4]) >> (2 * ((i + 0) % 4))) & 3;
d3 = ((base[0 * gfx_chunk + (i + 1) / 4]) >> (2 * ((i + 1) % 4))) & 3;
d4 = ((base[1 * gfx_chunk + (i + 1) / 4]) >> (2 * ((i + 1) % 4))) & 3;
state->m_gfx_rom[i + 0] = d1 | (d2 << 2);
state->m_gfx_rom[i + 1] = d3 | (d4 << 2);
m_gfx_rom[i + 0] = d1 | (d2 << 2);
m_gfx_rom[i + 1] = d3 | (d4 << 2);
}
break;
case 6:
for (i = 0; i < state->m_gfx_rom.bytes(); i += 2)
for (i = 0; i < m_gfx_rom.bytes(); i += 2)
{
d1 = ((base[0 * gfx_chunk + (i + 0) / 4]) >> (2 * ((i + 0) % 4))) & 3;
d2 = ((base[1 * gfx_chunk + (i + 0) / 4]) >> (2 * ((i + 0) % 4))) & 3;
@ -276,41 +275,41 @@ static void init_generic(running_machine &machine, int bpp, int sound, int prot_
d5 = ((base[1 * gfx_chunk + (i + 1) / 4]) >> (2 * ((i + 1) % 4))) & 3;
d6 = ((base[2 * gfx_chunk + (i + 1) / 4]) >> (2 * ((i + 1) % 4))) & 3;
state->m_gfx_rom[i + 0] = d1 | (d2 << 2) | (d3 << 4);
state->m_gfx_rom[i + 1] = d4 | (d5 << 2) | (d6 << 4);
m_gfx_rom[i + 0] = d1 | (d2 << 2) | (d3 << 4);
m_gfx_rom[i + 1] = d4 | (d5 << 2) | (d6 << 4);
}
break;
case 8:
for (i = 0; i < state->m_gfx_rom.bytes(); i += 4)
for (i = 0; i < m_gfx_rom.bytes(); i += 4)
{
state->m_gfx_rom[i + 0] = base[0 * gfx_chunk + i / 4];
state->m_gfx_rom[i + 1] = base[1 * gfx_chunk + i / 4];
state->m_gfx_rom[i + 2] = base[2 * gfx_chunk + i / 4];
state->m_gfx_rom[i + 3] = base[3 * gfx_chunk + i / 4];
m_gfx_rom[i + 0] = base[0 * gfx_chunk + i / 4];
m_gfx_rom[i + 1] = base[1 * gfx_chunk + i / 4];
m_gfx_rom[i + 2] = base[2 * gfx_chunk + i / 4];
m_gfx_rom[i + 3] = base[3 * gfx_chunk + i / 4];
}
break;
}
/* load sound ROMs and set up sound handlers */
state->m_chip_type = sound;
m_chip_type = sound;
switch (sound)
{
case SOUND_CVSD_SMALL:
machine.device("cvsd:cpu")->memory().space(AS_PROGRAM).install_write_handler(prot_start, prot_end, write8_delegate(FUNC(midyunit_state::cvsd_protection_w),state));
state->m_cvsd_protection_base = machine.root_device().memregion("cvsd:cpu")->base() + 0x10000 + (prot_start - 0x8000);
machine().device("cvsd:cpu")->memory().space(AS_PROGRAM).install_write_handler(prot_start, prot_end, write8_delegate(FUNC(midyunit_state::cvsd_protection_w), this));
m_cvsd_protection_base = memregion("cvsd:cpu")->base() + 0x10000 + (prot_start - 0x8000);
break;
case SOUND_CVSD:
machine.device("cvsd:cpu")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
machine().device("cvsd:cpu")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
break;
case SOUND_ADPCM:
machine.device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
break;
case SOUND_NARC:
machine.device("narcsnd:cpu0")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
machine().device("narcsnd:cpu0")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
break;
case SOUND_YAWDIM:
@ -332,7 +331,7 @@ static void init_generic(running_machine &machine, int bpp, int sound, int prot_
DRIVER_INIT_MEMBER(midyunit_state,narc)
{
/* common init */
init_generic(machine(), 8, SOUND_NARC, 0xcdff, 0xce29);
init_generic(8, SOUND_NARC, 0xcdff, 0xce29);
}
@ -362,7 +361,7 @@ DRIVER_INIT_MEMBER(midyunit_state,trog)
m_prot_data = &trog_protection_data;
/* common init */
init_generic(machine(), 4, SOUND_CVSD_SMALL, 0x9eaf, 0x9ed9);
init_generic(4, SOUND_CVSD_SMALL, 0x9eaf, 0x9ed9);
}
@ -371,7 +370,7 @@ DRIVER_INIT_MEMBER(midyunit_state,trog)
DRIVER_INIT_MEMBER(midyunit_state,smashtv)
{
/* common init */
init_generic(machine(), 6, SOUND_CVSD_SMALL, 0x9cf6, 0x9d21);
init_generic(6, SOUND_CVSD_SMALL, 0x9cf6, 0x9d21);
}
@ -389,7 +388,7 @@ DRIVER_INIT_MEMBER(midyunit_state,hiimpact)
m_prot_data = &hiimpact_protection_data;
/* common init */
init_generic(machine(), 6, SOUND_CVSD, 0x9b79, 0x9ba3);
init_generic(6, SOUND_CVSD, 0x9b79, 0x9ba3);
}
@ -407,7 +406,7 @@ DRIVER_INIT_MEMBER(midyunit_state,shimpact)
m_prot_data = &shimpact_protection_data;
/* common init */
init_generic(machine(), 6, SOUND_CVSD, 0x9c06, 0x9c15);
init_generic(6, SOUND_CVSD, 0x9c06, 0x9c15);
}
@ -423,7 +422,7 @@ DRIVER_INIT_MEMBER(midyunit_state,strkforc)
m_prot_data = &strkforc_protection_data;
/* common init */
init_generic(machine(), 4, SOUND_CVSD_SMALL, 0x9f7d, 0x9fa7);
init_generic(4, SOUND_CVSD_SMALL, 0x9f7d, 0x9fa7);
}
@ -452,13 +451,13 @@ DRIVER_INIT_MEMBER(midyunit_state,mkyunit)
m_prot_data = &mk_protection_data;
/* common init */
init_generic(machine(), 6, SOUND_ADPCM, 0xfb9c, 0xfbc6);
init_generic(6, SOUND_ADPCM, 0xfb9c, 0xfbc6);
}
DRIVER_INIT_MEMBER(midyunit_state,mkyawdim)
{
/* common init */
init_generic(machine(), 6, SOUND_YAWDIM, 0, 0);
init_generic(6, SOUND_YAWDIM, 0, 0);
}
@ -485,33 +484,32 @@ DRIVER_INIT_MEMBER(midyunit_state,mkyturbo)
/********************** Terminator 2 **********************/
static void term2_init_common(running_machine &machine, write16_delegate hack_w)
void midyunit_state::term2_init_common(write16_delegate hack_w)
{
midyunit_state *state = machine.driver_data<midyunit_state>();
/* protection */
static const struct protection_data term2_protection_data =
{
{ 0x0f00, 0x0f00, 0x0f00 },
{ 0x4000, 0xf000, 0xa000 }
};
state->m_prot_data = &term2_protection_data;
m_prot_data = &term2_protection_data;
/* common init */
init_generic(machine, 6, SOUND_ADPCM, 0xfa8d, 0xfa9c);
init_generic(6, SOUND_ADPCM, 0xfa8d, 0xfa9c);
/* special inputs */
state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x01c00000, 0x01c0005f, read16_delegate(FUNC(midyunit_state::term2_input_r),state));
state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x01e00000, 0x01e0001f, write16_delegate(FUNC(midyunit_state::term2_sound_w),state));
m_maincpu->space(AS_PROGRAM).install_read_handler(0x01c00000, 0x01c0005f, read16_delegate(FUNC(midyunit_state::term2_input_r), this));
m_maincpu->space(AS_PROGRAM).install_write_handler(0x01e00000, 0x01e0001f, write16_delegate(FUNC(midyunit_state::term2_sound_w), this));
/* HACK: this prevents the freeze on the movies */
/* until we figure whats causing it, this is better than nothing */
state->m_t2_hack_mem = state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w);
m_t2_hack_mem = m_maincpu->space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w);
}
DRIVER_INIT_MEMBER(midyunit_state,term2) { term2_init_common(machine(), write16_delegate(FUNC(midyunit_state::term2_hack_w),this)); }
DRIVER_INIT_MEMBER(midyunit_state,term2la3) { term2_init_common(machine(), write16_delegate(FUNC(midyunit_state::term2la3_hack_w),this)); }
DRIVER_INIT_MEMBER(midyunit_state,term2la2) { term2_init_common(machine(), write16_delegate(FUNC(midyunit_state::term2la2_hack_w),this)); }
DRIVER_INIT_MEMBER(midyunit_state,term2la1) { term2_init_common(machine(), write16_delegate(FUNC(midyunit_state::term2la1_hack_w),this)); }
DRIVER_INIT_MEMBER(midyunit_state,term2) { term2_init_common(write16_delegate(FUNC(midyunit_state::term2_hack_w),this)); }
DRIVER_INIT_MEMBER(midyunit_state,term2la3) { term2_init_common(write16_delegate(FUNC(midyunit_state::term2la3_hack_w),this)); }
DRIVER_INIT_MEMBER(midyunit_state,term2la2) { term2_init_common(write16_delegate(FUNC(midyunit_state::term2la2_hack_w),this)); }
DRIVER_INIT_MEMBER(midyunit_state,term2la1) { term2_init_common(write16_delegate(FUNC(midyunit_state::term2la1_hack_w),this)); }
@ -529,7 +527,7 @@ DRIVER_INIT_MEMBER(midyunit_state,totcarn)
m_prot_data = &totcarn_protection_data;
/* common init */
init_generic(machine(), 6, SOUND_ADPCM, 0xfc04, 0xfc2e);
init_generic(6, SOUND_ADPCM, 0xfc04, 0xfc2e);
}

View File

@ -2596,7 +2596,7 @@ UINT16 *cps_state::cps2_objbase()
if (m_objram_bank & 1)
baseptr ^= 0x0080;
//popmessage("%04x %d", cps2_port(machine, CPS2_OBJ_BASE), state->m_objram_bank & 1);
//popmessage("%04x %d", cps2_port(machine, CPS2_OBJ_BASE), m_objram_bank & 1);
if (baseptr == 0x7000)
return m_objram1;

View File

@ -284,20 +284,16 @@ TIMER_CALLBACK_MEMBER(exidy440_state::collide_firq_callback)
*
*************************************/
static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect,
int scroll_offset, int check_collision)
void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int scroll_offset, int check_collision)
{
exidy440_state *state = screen.machine().driver_data<exidy440_state>();
int i;
/* get a pointer to the palette to look for collision flags */
UINT8 *palette = &state->m_local_paletteram[state->m_palettebank_vis * 512];
UINT8 *palette = &m_local_paletteram[m_palettebank_vis * 512];
int count = 0;
/* draw the sprite images, checking for collisions along the way */
UINT8 *sprite = state->m_spriteram + (SPRITE_COUNT - 1) * 4;
UINT8 *sprite = m_spriteram + (SPRITE_COUNT - 1) * 4;
for (i = 0; i < SPRITE_COUNT; i++, sprite -= 4)
for (int i = 0; i < SPRITE_COUNT; i++, sprite -= 4)
{
int image = (~sprite[3] & 0x3f);
int xoffs = (~((sprite[1] << 8) | sprite[2]) & 0x1ff);
@ -310,7 +306,7 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
continue;
/* get a pointer to the source image */
src = &state->m_imageram[image * 128];
src = &m_imageram[image * 128];
/* account for large positive offsets meaning small negative values */
if (xoffs >= 0x1ff - 16)
@ -333,7 +329,7 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
/* only draw scanlines that are in this cliprect */
if (yoffs <= cliprect.max_y)
{
UINT8 *old = &state->m_local_videoram[sy * 512 + xoffs];
UINT8 *old = &m_local_videoram[sy * 512 + xoffs];
int currx = xoffs;
/* loop over x */
@ -353,7 +349,7 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
/* check the collisions bit */
if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128))
screen.machine().scheduler().timer_set(screen.time_until_pos(yoffs, currx), timer_expired_delegate(FUNC(exidy440_state::collide_firq_callback),state), currx);
screen.machine().scheduler().timer_set(screen.time_until_pos(yoffs, currx), timer_expired_delegate(FUNC(exidy440_state::collide_firq_callback), this), currx);
}
currx++;
@ -366,7 +362,7 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
/* check the collisions bit */
if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128))
screen.machine().scheduler().timer_set(screen.time_until_pos(yoffs, currx), timer_expired_delegate(FUNC(exidy440_state::collide_firq_callback),state), currx);
screen.machine().scheduler().timer_set(screen.time_until_pos(yoffs, currx), timer_expired_delegate(FUNC(exidy440_state::collide_firq_callback), this), currx);
}
currx++;
}
@ -385,22 +381,18 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
*
*************************************/
static void update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect,
int scroll_offset, int check_collision)
void exidy440_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int scroll_offset, int check_collision)
{
exidy440_state *state = screen.machine().driver_data<exidy440_state>();
int y, sy;
/* draw any dirty scanlines from the VRAM directly */
sy = scroll_offset + cliprect.min_y;
for (y = cliprect.min_y; y <= cliprect.max_y; y++, sy++)
int sy = scroll_offset + cliprect.min_y;
for (int y = cliprect.min_y; y <= cliprect.max_y; y++, sy++)
{
/* wrap at the bottom of the screen */
if (sy >= VBSTART)
sy -= (VBSTART - VBEND);
/* draw line */
draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &state->m_local_videoram[sy * 512], NULL);
draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &m_local_videoram[sy * 512], NULL);
}
/* draw the sprites */

View File

@ -1649,11 +1649,11 @@ WRITE32_MEMBER(konamigx_state::konamigx_palette2_w)
{
int r,g,b;
COMBINE_DATA(&state->m_subpaletteram32[offset]);
COMBINE_DATA(&m_subpaletteram32[offset]);
r = (state->m_subpaletteram32[offset] >>16) & 0xff;
g = (state->m_subpaletteram32[offset] >> 8) & 0xff;
b = (state->m_subpaletteram32[offset] >> 0) & 0xff;
r = (m_subpaletteram32[offset] >>16) & 0xff;
g = (m_subpaletteram32[offset] >> 8) & 0xff;
b = (m_subpaletteram32[offset] >> 0) & 0xff;
offset += (0x8000/4);
@ -1683,8 +1683,8 @@ WRITE32_MEMBER(konamigx_state::konamigx_555_palette_w)
WRITE32_MEMBER(konamigx_state::konamigx_555_palette2_w)
{
UINT32 coldat;
COMBINE_DATA(&state->m_subpaletteram32[offset]);
coldat = state->m_subpaletteram32[offset];
COMBINE_DATA(&m_subpaletteram32[offset]);
coldat = m_subpaletteram32[offset];
offset += (0x4000/4);

View File

@ -181,7 +181,7 @@ void nycaptor_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre
x - no bg/sprite pri.
*/
#define mKEY_MASK(x,y) if (machine.input().code_pressed_once(x)) { state->m_mask |= y; state->m_bg_tilemap->mark_all_dirty(); }
#define mKEY_MASK(x,y) if (machine().input().code_pressed_once(x)) { m_mask |= y; m_bg_tilemap->mark_all_dirty(); }
void nycaptor_state::nycaptor_setmask( )
{
@ -207,7 +207,7 @@ void nycaptor_state::nycaptor_setmask( )
UINT32 nycaptor_state::screen_update_nycaptor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
#if NYCAPTOR_DEBUG
nycaptor_setmask(machine());
nycaptor_setmask();
if (m_mask & 0x1000)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1 | 3, 0);
@ -218,14 +218,14 @@ UINT32 nycaptor_state::screen_update_nycaptor(screen_device &screen, bitmap_ind1
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 1, 0);
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1 | 0, 0);
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 0);
draw_sprites(machine(), bitmap, cliprect, 0);
draw_sprites(machine(), bitmap, cliprect, 1);
draw_sprites(machine(), bitmap, cliprect, 2);
draw_sprites(machine(), bitmap, cliprect, 3);
draw_sprites(machine(), bitmap, cliprect, 4);
draw_sprites(machine(), bitmap, cliprect, 5);
draw_sprites(machine(), bitmap, cliprect, 6);
draw_sprites(machine(), bitmap, cliprect, 7);
draw_sprites(bitmap, cliprect, 0);
draw_sprites(bitmap, cliprect, 1);
draw_sprites(bitmap, cliprect, 2);
draw_sprites(bitmap, cliprect, 3);
draw_sprites(bitmap, cliprect, 4);
draw_sprites(bitmap, cliprect, 5);
draw_sprites(bitmap, cliprect, 6);
draw_sprites(bitmap, cliprect, 7);
}
else
#endif

View File

@ -878,7 +878,7 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st
/* configure the layer */
opaque = 0;
//opaque = (state->m_system32_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1;
//opaque = (m_system32_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1;
//if (screen.machine().input().code_pressed(KEYCODE_Z) && bgnum == 0) opaque = 1;
//if (screen.machine().input().code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1;