mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
seibu/deadang.cpp, seibu/kncljoe.cpp, seibu/stfight.cpp, seibu/wiz.cpp: consolidated drivers into single files
This commit is contained in:
parent
72e8b752a2
commit
71588b9c91
File diff suppressed because it is too large
Load Diff
@ -1,121 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Bryan McPhail, David Haywood
|
||||
#ifndef MAME_SEIBU_DEADANG_H
|
||||
#define MAME_SEIBU_DEADANG_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "seibusound.h"
|
||||
|
||||
#include "machine/timer.h"
|
||||
#include "sound/ymopm.h"
|
||||
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "tilemap.h"
|
||||
|
||||
class deadang_state : public driver_device
|
||||
{
|
||||
public:
|
||||
deadang_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_scroll_ram(*this, "scroll_ram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_video_data(*this, "video_data"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette"),
|
||||
m_seibu_sound(*this, "seibu_sound"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_subcpu(*this, "sub"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_adpcm1(*this, "adpcm1"),
|
||||
m_adpcm2(*this, "adpcm2")
|
||||
{ }
|
||||
|
||||
void deadang(machine_config &config);
|
||||
|
||||
void init_deadang();
|
||||
void init_ghunter();
|
||||
|
||||
void foreground_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
|
||||
TILEMAP_MAPPER_MEMBER(bg_scan);
|
||||
TILE_GET_INFO_MEMBER(get_pf1_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_pf3_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_pf2_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_text_tile_info);
|
||||
|
||||
protected:
|
||||
virtual void video_start() override;
|
||||
|
||||
void main_map(address_map &map);
|
||||
|
||||
required_shared_ptr<uint16_t> m_scroll_ram;
|
||||
required_shared_ptr<uint16_t> m_videoram;
|
||||
required_shared_ptr<uint16_t> m_video_data;
|
||||
required_shared_ptr<uint16_t> m_spriteram;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<seibu_sound_device> m_seibu_sound;
|
||||
|
||||
int m_tilebank = 0;
|
||||
int m_oldtilebank = 0;
|
||||
|
||||
tilemap_t *m_pf3_layer = nullptr;
|
||||
tilemap_t *m_pf2_layer = nullptr;
|
||||
tilemap_t *m_pf1_layer = nullptr;
|
||||
tilemap_t *m_text_layer = nullptr;
|
||||
|
||||
void text_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void bank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
|
||||
void sound_decrypted_opcodes_map(address_map &map);
|
||||
void sound_map(address_map &map);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
optional_device<seibu_adpcm_device> m_adpcm1;
|
||||
optional_device<seibu_adpcm_device> m_adpcm2;
|
||||
|
||||
uint16_t ghunter_trackball_low_r();
|
||||
uint16_t ghunter_trackball_high_r();
|
||||
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(main_scanline);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(sub_scanline);
|
||||
void sub_map(address_map &map);
|
||||
};
|
||||
|
||||
class popnrun_state : public deadang_state
|
||||
{
|
||||
public:
|
||||
popnrun_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
deadang_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void popnrun(machine_config &config);
|
||||
|
||||
void init_popnrun();
|
||||
|
||||
protected:
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
TILE_GET_INFO_MEMBER(get_popnrun_text_tile_info);
|
||||
void popnrun_text_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void popnrun_main_map(address_map &map);
|
||||
void popnrun_sub_map(address_map &map);
|
||||
void popnrun_sound_map(address_map &map);
|
||||
|
||||
uint32_t popnrun_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void popnrun_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
||||
#endif // MAME_SEIBU_DEADANG_H
|
@ -1,308 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Bryan McPhail, David Haywood
|
||||
#include "emu.h"
|
||||
#include "deadang.h"
|
||||
#include "screen.h"
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void deadang_state::foreground_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||
{
|
||||
COMBINE_DATA(&m_video_data[offset]);
|
||||
m_pf1_layer->mark_tile_dirty(offset );
|
||||
}
|
||||
|
||||
void deadang_state::text_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||
{
|
||||
COMBINE_DATA(&m_videoram[offset]);
|
||||
m_text_layer->mark_tile_dirty(offset );
|
||||
}
|
||||
|
||||
void popnrun_state::popnrun_text_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||
{
|
||||
COMBINE_DATA(&m_videoram[offset]);
|
||||
m_text_layer->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
void deadang_state::bank_w(offs_t offset, uint16_t data, uint16_t mem_mask)
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
m_tilebank = data&1;
|
||||
if (m_tilebank!=m_oldtilebank)
|
||||
{
|
||||
m_oldtilebank = m_tilebank;
|
||||
m_pf1_layer->mark_all_dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
TILEMAP_MAPPER_MEMBER(deadang_state::bg_scan)
|
||||
{
|
||||
return (col&0xf) | ((row&0xf)<<4) | ((col&0x70)<<4) | ((row&0xf0)<<7);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(deadang_state::get_pf3_tile_info)
|
||||
{
|
||||
const uint16_t *bgMap = (const uint16_t *)memregion("gfx6")->base();
|
||||
int code= bgMap[tile_index];
|
||||
tileinfo.set(4,code&0x7ff,code>>12,0);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(deadang_state::get_pf2_tile_info)
|
||||
{
|
||||
const uint16_t *bgMap = (const uint16_t *)memregion("gfx7")->base();
|
||||
int code= bgMap[tile_index];
|
||||
tileinfo.set(3,code&0x7ff,code>>12,0);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(deadang_state::get_pf1_tile_info)
|
||||
{
|
||||
int tile=m_video_data[tile_index];
|
||||
int color=tile >> 12;
|
||||
tile=tile&0xfff;
|
||||
|
||||
tileinfo.set(2,tile+m_tilebank*0x1000,color,0);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(deadang_state::get_text_tile_info)
|
||||
{
|
||||
int tile=(m_videoram[tile_index] & 0xff) | ((m_videoram[tile_index] >> 6) & 0x300);
|
||||
int color=(m_videoram[tile_index] >> 8)&0xf;
|
||||
|
||||
tileinfo.set(0,tile,color,0);
|
||||
}
|
||||
|
||||
void deadang_state::video_start()
|
||||
{
|
||||
m_pf3_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deadang_state::get_pf3_tile_info)), tilemap_mapper_delegate(*this, FUNC(deadang_state::bg_scan)), 16, 16, 128, 256);
|
||||
m_pf2_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deadang_state::get_pf2_tile_info)), tilemap_mapper_delegate(*this, FUNC(deadang_state::bg_scan)), 16, 16, 128, 256);
|
||||
m_pf1_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deadang_state::get_pf1_tile_info)), TILEMAP_SCAN_COLS, 16, 16, 32, 32);
|
||||
m_text_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deadang_state::get_text_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
|
||||
m_pf2_layer->set_transparent_pen(15);
|
||||
m_pf1_layer->set_transparent_pen(15);
|
||||
m_text_layer->set_transparent_pen(15);
|
||||
|
||||
save_item(NAME(m_tilebank));
|
||||
save_item(NAME(m_oldtilebank));
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(popnrun_state::get_popnrun_text_tile_info)
|
||||
{
|
||||
int tile = (m_videoram[tile_index*2+0] & 0xff) << 1; // | ((m_videoram[tile_index] >> 6) & 0x300);
|
||||
int attr = (m_videoram[tile_index*2+1]);
|
||||
// TODO: not entirely correct (title screen/ranking colors)
|
||||
// might be down to bitplanes too
|
||||
int color = (attr & 3) ^ 1;
|
||||
|
||||
if(attr & 0x40)
|
||||
tile |= 1;
|
||||
|
||||
tileinfo.set(0,tile,color,0);
|
||||
}
|
||||
|
||||
void popnrun_state::video_start()
|
||||
{
|
||||
m_pf3_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deadang_state::get_pf3_tile_info)), tilemap_mapper_delegate(*this, FUNC(deadang_state::bg_scan)), 16, 16, 128, 256);
|
||||
m_pf2_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deadang_state::get_pf2_tile_info)), tilemap_mapper_delegate(*this, FUNC(deadang_state::bg_scan)), 16, 16, 128, 256);
|
||||
m_pf1_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(deadang_state::get_pf1_tile_info)), TILEMAP_SCAN_COLS, 16, 16, 32, 32);
|
||||
m_text_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(popnrun_state::get_popnrun_text_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
|
||||
m_pf2_layer->set_transparent_pen(0);
|
||||
m_pf1_layer->set_transparent_pen(0);
|
||||
m_text_layer->set_transparent_pen(0);
|
||||
|
||||
save_item(NAME(m_tilebank));
|
||||
save_item(NAME(m_oldtilebank));
|
||||
}
|
||||
|
||||
|
||||
void deadang_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int offs,fx,fy,x,y,color,sprite,pri;
|
||||
|
||||
for (offs = 0; offs<0x800/2; offs+=4)
|
||||
{
|
||||
/* Don't draw empty sprite table entries */
|
||||
if ((m_spriteram[offs+3] & 0xff00)!=0xf00) continue;
|
||||
|
||||
switch (m_spriteram[offs+2]&0xc000) {
|
||||
default:
|
||||
case 0xc000: pri=0; break; /* Unknown */
|
||||
case 0x8000: pri=0; break; /* Over all playfields */
|
||||
case 0x4000: pri=0xf0; break; /* Under top playfield */
|
||||
case 0x0000: pri=0xf0|0xcc; break; /* Under middle playfield */
|
||||
}
|
||||
|
||||
fx= m_spriteram[offs+0]&0x2000;
|
||||
fy= m_spriteram[offs+0]&0x4000;
|
||||
y = m_spriteram[offs+0] & 0xff;
|
||||
x = m_spriteram[offs+2] & 0xff;
|
||||
if (fy) fy=0; else fy=1;
|
||||
if (m_spriteram[offs+2]&0x100) x=0-(0xff-x);
|
||||
|
||||
color = (m_spriteram[offs+1]>>12)&0xf;
|
||||
sprite = m_spriteram[offs+1]&0xfff;
|
||||
|
||||
if (flip_screen()) {
|
||||
x=240-x;
|
||||
y=240-y;
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
}
|
||||
|
||||
m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect,
|
||||
sprite,
|
||||
color,fx,fy,x,y,
|
||||
screen.priority(),pri,15);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t deadang_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
/* Setup the tilemaps */
|
||||
m_pf3_layer->set_scrolly(0, ((m_scroll_ram[0x01]&0xf0)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7) );
|
||||
m_pf3_layer->set_scrollx(0, ((m_scroll_ram[0x09]&0xf0)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7) );
|
||||
m_pf1_layer->set_scrolly(0, ((m_scroll_ram[0x11]&0x10)<<4)+((m_scroll_ram[0x12]&0x7f)<<1)+((m_scroll_ram[0x12]&0x80)>>7) );
|
||||
m_pf1_layer->set_scrollx(0, ((m_scroll_ram[0x19]&0x10)<<4)+((m_scroll_ram[0x1a]&0x7f)<<1)+((m_scroll_ram[0x1a]&0x80)>>7) );
|
||||
m_pf2_layer->set_scrolly(0, ((m_scroll_ram[0x21]&0xf0)<<4)+((m_scroll_ram[0x22]&0x7f)<<1)+((m_scroll_ram[0x22]&0x80)>>7) );
|
||||
m_pf2_layer->set_scrollx(0, ((m_scroll_ram[0x29]&0xf0)<<4)+((m_scroll_ram[0x2a]&0x7f)<<1)+((m_scroll_ram[0x2a]&0x80)>>7) );
|
||||
|
||||
/* Control byte:
|
||||
0x01: Background playfield disable
|
||||
0x02: Middle playfield disable
|
||||
0x04: Top playfield disable
|
||||
0x08: ? Toggles at start of game
|
||||
0x10: Sprite disable
|
||||
0x20: Unused?
|
||||
0x40: Flipscreen
|
||||
0x80: Always set?
|
||||
*/
|
||||
m_pf3_layer->enable(!(m_scroll_ram[0x34]&1));
|
||||
m_pf1_layer->enable(!(m_scroll_ram[0x34]&2));
|
||||
m_pf2_layer->enable(!(m_scroll_ram[0x34]&4));
|
||||
flip_screen_set(m_scroll_ram[0x34]&0x40 );
|
||||
|
||||
bitmap.fill(m_palette->black_pen(), cliprect);
|
||||
screen.priority().fill(0, cliprect);
|
||||
m_pf3_layer->draw(screen, bitmap, cliprect, 0,1);
|
||||
m_pf1_layer->draw(screen, bitmap, cliprect, 0,2);
|
||||
m_pf2_layer->draw(screen, bitmap, cliprect, 0,4);
|
||||
if (!(m_scroll_ram[0x34]&0x10)) draw_sprites(screen, bitmap,cliprect);
|
||||
m_text_layer->draw(screen, bitmap, cliprect, 0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void popnrun_state::popnrun_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int offs,fx,fy,x,y,color,sprite,pri;
|
||||
|
||||
// TODO: might have more bits in either 0x3800-0x3bff or 0x3e00-0x3fff
|
||||
for (offs = 0; offs<0x200/2; offs+=2)
|
||||
{
|
||||
/* Don't draw empty sprite table entries */
|
||||
//if ((m_spriteram[offs+3] & 0xff00)!=0xf00) continue;
|
||||
|
||||
pri = 0;
|
||||
#if 0
|
||||
switch (m_spriteram[offs+2]&0xc000) {
|
||||
default:
|
||||
case 0xc000: pri=0; break; /* Unknown */
|
||||
case 0x8000: pri=0; break; /* Over all playfields */
|
||||
case 0x4000: pri=0xf0; break; /* Under top playfield */
|
||||
case 0x0000: pri=0xf0|0xcc; break; /* Under middle playfield */
|
||||
}
|
||||
#endif
|
||||
|
||||
fx = m_spriteram[offs+0]&0x4000;
|
||||
fy = m_spriteram[offs+0]&0x8000;
|
||||
y = m_spriteram[offs+1] & 0xff;
|
||||
x = (m_spriteram[offs+1] >> 8) & 0xff;
|
||||
#if 0
|
||||
if (fy) fy=0; else fy=1;
|
||||
if (m_spriteram[offs+2]&0x100) x=0-(0xff-x);
|
||||
#endif
|
||||
|
||||
color = (m_spriteram[offs+0]>>12)&0x7;
|
||||
sprite = m_spriteram[offs+0]&0xfff;
|
||||
|
||||
#if 0
|
||||
if (flip_screen()) {
|
||||
x=240-x;
|
||||
y=240-y;
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect,
|
||||
sprite,
|
||||
color,fx,fy,x,y,
|
||||
screen.priority(),pri,0);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t popnrun_state::popnrun_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
// TODO: different scroll RAM hookup
|
||||
// 0x18 seems to enable the various layers
|
||||
/* Setup the tilemaps */
|
||||
// m_pf3_layer->set_scrolly(0, ((m_scroll_ram[0x01]&0xf0)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7) );
|
||||
// m_pf3_layer->set_scrollx(0, ((m_scroll_ram[0x09]&0xf0)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7) );
|
||||
// m_pf1_layer->set_scrolly(0, ((m_scroll_ram[0x11]&0x10)<<4)+((m_scroll_ram[0x12]&0x7f)<<1)+((m_scroll_ram[0x12]&0x80)>>7) );
|
||||
// m_pf1_layer->set_scrollx(0, ((m_scroll_ram[0x19]&0x10)<<4)+((m_scroll_ram[0x1a]&0x7f)<<1)+((m_scroll_ram[0x1a]&0x80)>>7) );
|
||||
// m_pf2_layer->set_scrolly(0, ((m_scroll_ram[0x21]&0xf0)<<4)+((m_scroll_ram[0x22]&0x7f)<<1)+((m_scroll_ram[0x22]&0x80)>>7) );
|
||||
// m_pf2_layer->set_scrollx(0, ((m_scroll_ram[0x29]&0xf0)<<4)+((m_scroll_ram[0x2a]&0x7f)<<1)+((m_scroll_ram[0x2a]&0x80)>>7) );
|
||||
|
||||
m_pf3_layer->enable(!(m_scroll_ram[0x34]&1));
|
||||
m_pf1_layer->enable(!(m_scroll_ram[0x34]&2));
|
||||
m_pf2_layer->enable(!(m_scroll_ram[0x34]&4));
|
||||
// flip_screen_set(m_scroll_ram[0x34]&0x40 );
|
||||
|
||||
bitmap.fill(1, cliprect);
|
||||
screen.priority().fill(0, cliprect);
|
||||
// 32 pixels?
|
||||
// int scrollx = (m_scroll_ram[0x4/2] & 0x0f);
|
||||
|
||||
// debug tilemap code
|
||||
// this is likely to be collision data
|
||||
for(int x=0;x<16;x++)
|
||||
{
|
||||
for(int y=0;y<8;y++)
|
||||
{
|
||||
int tile = m_video_data[y+x*8+0xc0] & 0xff;
|
||||
int res_x, res_y;
|
||||
|
||||
if(tile != 0)
|
||||
{
|
||||
res_x = (x*16) & 0xff;
|
||||
res_y = y*32;
|
||||
//if(cliprect.contains(res_x,res_y))
|
||||
bitmap.plot_box(res_x,res_y,16,16,tile+0x10);
|
||||
}
|
||||
|
||||
tile = m_video_data[y+x*8+0xc0] >> 8;
|
||||
|
||||
if(tile != 0)
|
||||
{
|
||||
res_x = (x*16) & 0xff;
|
||||
res_y = y*32+16;
|
||||
//if(cliprect.contains(res_x,res_y))
|
||||
bitmap.plot_box(res_x,res_y,16,16,tile+0x10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//m_pf3_layer->draw(screen, bitmap, cliprect, 0,1);
|
||||
//m_pf1_layer->draw(screen, bitmap, cliprect, 0,2);
|
||||
//m_pf2_layer->draw(screen, bitmap, cliprect, 0,4);
|
||||
if (m_scroll_ram[0x18/2]&0x1)
|
||||
popnrun_draw_sprites(screen, bitmap,cliprect);
|
||||
m_text_layer->draw(screen, bitmap, cliprect, 0,0);
|
||||
return 0;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ernesto Corvi
|
||||
// copyright-holders: Ernesto Corvi
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Knuckle Joe - (c) 1985 Seibu Kaihatsu (Taito license)
|
||||
@ -7,9 +8,10 @@ Knuckle Joe - (c) 1985 Seibu Kaihatsu (Taito license)
|
||||
driver by Ernesto Corvi
|
||||
|
||||
This board seems to be an Irem design.
|
||||
The sound hardware is modified the 6803-based one used by the classic Irem
|
||||
games. There's only one AY 3-8910 chip and no MSM5205. There are also two
|
||||
SN76489 controlled directly by main(!) cpu, and used only for in-game music.
|
||||
The sound hardware is a modified version of the 6803-based one used by the
|
||||
classic Irem games. There's only one AY 3-8910 chip and no MSM5205. There
|
||||
are also two SN76489 controlled directly by main(!) CPU, and used only for
|
||||
in-game music.
|
||||
The video hardware is pretty much like Irem games too. The only
|
||||
strange thing is that the screen is flipped vertically.
|
||||
|
||||
@ -27,12 +29,295 @@ BTANB:
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "kncljoe.h"
|
||||
|
||||
#include "cpu/m6800/m6801.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/sn76496.h"
|
||||
#include "speaker.h"
|
||||
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
#include "tilemap.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class kncljoe_state : public driver_device
|
||||
{
|
||||
public:
|
||||
kncljoe_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_scrollregs(*this, "scrollregs"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_soundcpu(*this, "soundcpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette"),
|
||||
m_ay8910(*this, "aysnd"),
|
||||
m_soundlatch(*this, "soundlatch")
|
||||
{ }
|
||||
|
||||
void kncljoe(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
required_shared_ptr<uint8_t> m_scrollregs;
|
||||
required_shared_ptr<uint8_t> m_spriteram;
|
||||
|
||||
// video-related
|
||||
tilemap_t *m_bg_tilemap = nullptr;
|
||||
uint8_t m_tile_bank = 0U;
|
||||
uint8_t m_sprite_bank = 0U;
|
||||
uint8_t m_flipscreen = 0U;
|
||||
|
||||
// misc
|
||||
uint8_t m_port1 = 0U;
|
||||
uint8_t m_port2 = 0U;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<m6803_cpu_device> m_soundcpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<ay8910_device> m_ay8910;
|
||||
required_device<generic_latch_8_device> m_soundlatch;
|
||||
|
||||
void sound_cmd_w(uint8_t data);
|
||||
void sound_irq_ack_w(uint8_t data);
|
||||
void videoram_w(offs_t offset, uint8_t data);
|
||||
void control_w(uint8_t data);
|
||||
void scroll_w(offs_t offset, uint8_t data);
|
||||
void m6803_port1_w(uint8_t data);
|
||||
void m6803_port2_w(uint8_t data);
|
||||
uint8_t m6803_port1_r();
|
||||
uint8_t m6803_port2_r();
|
||||
void unused_w(uint8_t data);
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
void palette(palette_device &palette) const;
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(sound_nmi);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void main_map(address_map &map);
|
||||
void sound_map(address_map &map);
|
||||
};
|
||||
|
||||
|
||||
// video
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Convert the color PROMs into a more useable format.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void kncljoe_state::palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *color_prom = memregion("proms")->base();
|
||||
|
||||
// create a lookup table for the palette
|
||||
for (int i = 0; i < 0x80; i++)
|
||||
{
|
||||
int const r = pal4bit(color_prom[i + 0x000]);
|
||||
int const g = pal4bit(color_prom[i + 0x100]);
|
||||
int const b = pal4bit(color_prom[i + 0x200]);
|
||||
|
||||
palette.set_indirect_color(i, rgb_t(r, g, b));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
int bit0, bit1, bit2;
|
||||
|
||||
// red component
|
||||
bit0 = 0;
|
||||
bit1 = BIT(color_prom[i + 0x300], 6);
|
||||
bit2 = BIT(color_prom[i + 0x300], 7);
|
||||
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
// green component
|
||||
bit0 = BIT(color_prom[i + 0x300], 3);
|
||||
bit1 = BIT(color_prom[i + 0x300], 4);
|
||||
bit2 = BIT(color_prom[i + 0x300], 5);
|
||||
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
// blue component
|
||||
bit0 = BIT(color_prom[i + 0x300], 0);
|
||||
bit1 = BIT(color_prom[i + 0x300], 1);
|
||||
bit2 = BIT(color_prom[i + 0x300], 2);
|
||||
int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
palette.set_indirect_color(i + 0x80, rgb_t(r, g, b));
|
||||
}
|
||||
|
||||
// color_prom now points to the beginning of the lookup table
|
||||
color_prom += 0x320;
|
||||
|
||||
// chars
|
||||
for (int i = 0; i < 0x80; i++)
|
||||
palette.set_pen_indirect(i, i);
|
||||
|
||||
// sprite lookup table
|
||||
for (int i = 0; i < 0x80; i++)
|
||||
{
|
||||
uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x80;
|
||||
palette.set_pen_indirect(i + 0x80, ctabentry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Callbacks for the TileMap code
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
TILE_GET_INFO_MEMBER(kncljoe_state::get_bg_tile_info)
|
||||
{
|
||||
int const attr = m_videoram[2 * tile_index + 1];
|
||||
int const code = m_videoram[2 * tile_index] + ((attr & 0xc0) << 2) + (m_tile_bank << 10);
|
||||
|
||||
tileinfo.set(0,
|
||||
code,
|
||||
attr & 0xf,
|
||||
TILE_FLIPXY((attr & 0x30) >> 4));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Start the video hardware emulation.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void kncljoe_state::video_start()
|
||||
{
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(kncljoe_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
|
||||
|
||||
m_bg_tilemap->set_scroll_rows(4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Memory handlers
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void kncljoe_state::videoram_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
void kncljoe_state::control_w(uint8_t data)
|
||||
{
|
||||
/*
|
||||
0x01 screen flip
|
||||
0x02 coin counter#1
|
||||
0x04 sprite bank
|
||||
0x10 character bank
|
||||
0x20 coin counter#2
|
||||
|
||||
reset when IN0 - Coin 1 goes low (active)
|
||||
set after IN0 - Coin 1 goes high AND the credit has been added
|
||||
*/
|
||||
m_flipscreen = data & 0x01;
|
||||
machine().tilemap().set_flip_all(m_flipscreen ? TILEMAP_FLIPX : TILEMAP_FLIPY);
|
||||
|
||||
machine().bookkeeping().coin_counter_w(0, data & 0x02);
|
||||
machine().bookkeeping().coin_counter_w(1, data & 0x20);
|
||||
|
||||
if (m_tile_bank != BIT(data, 4))
|
||||
{
|
||||
m_tile_bank = BIT(data, 4);
|
||||
m_bg_tilemap->mark_all_dirty();
|
||||
}
|
||||
|
||||
m_sprite_bank = BIT(data, 2);
|
||||
}
|
||||
|
||||
void kncljoe_state::scroll_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_scrollregs[offset] = data;
|
||||
int const scrollx = m_scrollregs[0] | m_scrollregs[1] << 8;
|
||||
m_bg_tilemap->set_scrollx(0, scrollx);
|
||||
m_bg_tilemap->set_scrollx(1, scrollx);
|
||||
m_bg_tilemap->set_scrollx(2, scrollx);
|
||||
m_bg_tilemap->set_scrollx(3, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Display refresh
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void kncljoe_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
gfx_element *gfx = m_gfxdecode->gfx(1 + m_sprite_bank);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
// clip vertical strip for each layer
|
||||
rectangle clip = cliprect;
|
||||
clip.min_y = m_flipscreen ? (191 - i * 64) : (i * 64 + 1);
|
||||
clip.max_y = clip.min_y + 63;
|
||||
clip &= cliprect;
|
||||
|
||||
for (int j = 0x7c; j >= 0; j -= 4)
|
||||
{
|
||||
int const offs = bitswap<2>(~i, 0, 1) << 7 | j;
|
||||
int sy = m_spriteram[offs] + 1;
|
||||
int sx = m_spriteram[offs + 3];
|
||||
int const attr = m_spriteram[offs + 1];
|
||||
int const code = m_spriteram[offs + 2] | ((attr & 0x10) << 5) | ((attr & 0x20) << 3);
|
||||
int flipx = attr & 0x40;
|
||||
int flipy = !(attr & 0x80);
|
||||
int const color = attr & 0x0f;
|
||||
|
||||
if (m_flipscreen)
|
||||
{
|
||||
flipx = !flipx;
|
||||
flipy = !flipy;
|
||||
sx = 240 - sx;
|
||||
sy = 240 - sy;
|
||||
}
|
||||
|
||||
if (sx >= 256 - 8)
|
||||
sx -= 256;
|
||||
|
||||
gfx->transpen(bitmap, clip,
|
||||
code,
|
||||
color,
|
||||
flipx, flipy,
|
||||
sx, sy, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t kncljoe_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// machine
|
||||
|
||||
void kncljoe_state::sound_cmd_w(uint8_t data)
|
||||
{
|
||||
@ -46,20 +331,20 @@ void kncljoe_state::sound_cmd_w(uint8_t data)
|
||||
void kncljoe_state::main_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0xbfff).rom();
|
||||
map(0xc000, 0xcfff).ram().w(FUNC(kncljoe_state::kncljoe_videoram_w)).share("videoram");
|
||||
map(0xd000, 0xd001).w(FUNC(kncljoe_state::kncljoe_scroll_w)).share("scrollregs");
|
||||
map(0xc000, 0xcfff).ram().w(FUNC(kncljoe_state::videoram_w)).share(m_videoram);
|
||||
map(0xd000, 0xd001).w(FUNC(kncljoe_state::scroll_w)).share(m_scrollregs);
|
||||
map(0xd800, 0xd800).portr("SYSTEM");
|
||||
map(0xd801, 0xd801).portr("P1");
|
||||
map(0xd802, 0xd802).portr("P2");
|
||||
map(0xd803, 0xd803).portr("DSWA");
|
||||
map(0xd804, 0xd804).portr("DSWB");
|
||||
map(0xd800, 0xd800).w(FUNC(kncljoe_state::sound_cmd_w));
|
||||
map(0xd801, 0xd801).w(FUNC(kncljoe_state::kncljoe_control_w));
|
||||
map(0xd801, 0xd801).w(FUNC(kncljoe_state::control_w));
|
||||
map(0xd802, 0xd802).w("sn1", FUNC(sn76489_device::write));
|
||||
map(0xd803, 0xd803).w("sn2", FUNC(sn76489_device::write));
|
||||
map(0xd807, 0xd807).nopr(); /* unknown read */
|
||||
map(0xd817, 0xd817).nopr(); /* unknown read */
|
||||
map(0xe800, 0xefff).ram().share("spriteram");
|
||||
map(0xd807, 0xd807).nopr(); // unknown read
|
||||
map(0xd817, 0xd817).nopr(); // unknown read
|
||||
map(0xe800, 0xefff).ram().share(m_spriteram);
|
||||
map(0xf000, 0xffff).ram();
|
||||
}
|
||||
|
||||
@ -99,7 +384,7 @@ void kncljoe_state::sound_irq_ack_w(uint8_t data)
|
||||
|
||||
void kncljoe_state::unused_w(uint8_t data)
|
||||
{
|
||||
// unused - no MSM on the pcb
|
||||
// unused - no MSM on the PCB
|
||||
}
|
||||
|
||||
void kncljoe_state::sound_map(address_map &map)
|
||||
@ -207,9 +492,9 @@ static const gfx_layout spritelayout =
|
||||
};
|
||||
|
||||
static GFXDECODE_START( gfx_kncljoe )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x3_planar, 0x00, 16 ) /* colors 0x00-0x7f direct mapped */
|
||||
GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0x80, 16 ) /* colors 0x80-0x8f with lookup table */
|
||||
GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0x80, 16 )
|
||||
GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x3_planar, 0x00, 16 ) // colors 0x00-0x7f direct mapped
|
||||
GFXDECODE_ENTRY( "sprites1", 0, spritelayout, 0x80, 16 ) // colors 0x80-0x8f with lookup table
|
||||
GFXDECODE_ENTRY( "sprites2", 0, spritelayout, 0x80, 16 )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
@ -238,12 +523,12 @@ void kncljoe_state::machine_reset()
|
||||
|
||||
void kncljoe_state::kncljoe(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
Z80(config, m_maincpu, XTAL(6'000'000)); /* verified on pcb */
|
||||
// basic machine hardware
|
||||
Z80(config, m_maincpu, XTAL(6'000'000)); // verified on PCB
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &kncljoe_state::main_map);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(kncljoe_state::irq0_line_hold));
|
||||
|
||||
M6803(config, m_soundcpu, XTAL(3'579'545)); /* verified on pcb */
|
||||
M6803(config, m_soundcpu, XTAL(3'579'545)); // verified on PCB
|
||||
m_soundcpu->set_addrmap(AS_PROGRAM, &kncljoe_state::sound_map);
|
||||
m_soundcpu->in_p1_cb().set(FUNC(kncljoe_state::m6803_port1_r));
|
||||
m_soundcpu->out_p1_cb().set(FUNC(kncljoe_state::m6803_port1_w));
|
||||
@ -251,32 +536,32 @@ void kncljoe_state::kncljoe(machine_config &config)
|
||||
m_soundcpu->out_p2_cb().set(FUNC(kncljoe_state::m6803_port2_w));
|
||||
m_soundcpu->set_periodic_int(FUNC(kncljoe_state::sound_nmi), attotime::from_hz(3970)); // measured 3.970 kHz
|
||||
|
||||
/* video hardware */
|
||||
// video hardware
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_video_attributes(VIDEO_UPDATE_AFTER_VBLANK);
|
||||
m_screen->set_refresh_hz(60);
|
||||
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(1500));
|
||||
m_screen->set_size(32*8, 32*8);
|
||||
m_screen->set_visarea(1*8, 31*8-1, 0*8, 32*8-1);
|
||||
m_screen->set_screen_update(FUNC(kncljoe_state::screen_update_kncljoe));
|
||||
m_screen->set_screen_update(FUNC(kncljoe_state::screen_update));
|
||||
m_screen->set_palette(m_palette);
|
||||
|
||||
GFXDECODE(config, m_gfxdecode, m_palette, gfx_kncljoe);
|
||||
PALETTE(config, m_palette, FUNC(kncljoe_state::kncljoe_palette), 16*8+16*8, 128+16);
|
||||
PALETTE(config, m_palette, FUNC(kncljoe_state::palette), 16*8+16*8, 128+16);
|
||||
|
||||
/* sound hardware */
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
|
||||
GENERIC_LATCH_8(config, m_soundlatch);
|
||||
|
||||
AY8910(config, m_ay8910, XTAL(3'579'545)/4); /* verified on pcb */
|
||||
AY8910(config, m_ay8910, XTAL(3'579'545) / 4); // verified on PCB
|
||||
m_ay8910->port_a_read_callback().set(m_soundlatch, FUNC(generic_latch_8_device::read));
|
||||
m_ay8910->port_b_write_callback().set(FUNC(kncljoe_state::unused_w));
|
||||
m_ay8910->add_route(ALL_OUTPUTS, "mono", 0.30);
|
||||
|
||||
SN76489(config, "sn1", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "mono", 0.30); /* verified on pcb */
|
||||
SN76489(config, "sn1", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "mono", 0.30); // verified on PCB
|
||||
|
||||
SN76489(config, "sn2", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "mono", 0.30); /* verified on pcb */
|
||||
SN76489(config, "sn2", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "mono", 0.30); // verified on PCB
|
||||
}
|
||||
|
||||
|
||||
@ -287,30 +572,30 @@ ROM_START( kncljoe )
|
||||
ROM_LOAD( "kj-2.bin", 0x4000, 0x4000, CRC(cb11514b) SHA1(c75d4019d1617493ff074ce8187a81ad70d9b60c) )
|
||||
ROM_LOAD( "kj-3.bin", 0x8000, 0x4000, CRC(0f50697b) SHA1(412c6aba270824299ca2a74e9bea42b83e69797b) )
|
||||
|
||||
ROM_REGION( 0x8000, "soundcpu", 0 ) /* 64k for audio code */
|
||||
ROM_REGION( 0x8000, "soundcpu", 0 )
|
||||
ROM_LOAD( "kj-13.bin",0x6000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) )
|
||||
|
||||
ROM_REGION( 0xc000, "gfx1", 0 ) /* tiles */
|
||||
ROM_REGION( 0xc000, "tiles", 0 )
|
||||
ROM_LOAD( "kj-10.bin", 0x0000, 0x4000, CRC(74d3ba33) SHA1(c7887d690cb7f7a7b24d59d490ffc088fb6cc49c) )
|
||||
ROM_LOAD( "kj-11.bin", 0x4000, 0x4000, CRC(8ea01455) SHA1(b4b42fe373a1019b4f2a4b763a8a7219a5c9987e) )
|
||||
ROM_LOAD( "kj-12.bin", 0x8000, 0x4000, CRC(33367c41) SHA1(e6c56bcad008f3af4bc0f7d7afe8e23c8eb9d943) )
|
||||
|
||||
ROM_REGION( 0x18000, "gfx2", 0 ) /* sprites */
|
||||
ROM_REGION( 0x18000, "sprites1", 0 )
|
||||
ROM_LOAD( "kj-4.bin", 0x00000, 0x8000, CRC(a499ea10) SHA1(cb671cc75b3c6029dd3529e62d83025f78b45271) )
|
||||
ROM_LOAD( "kj-6.bin", 0x08000, 0x8000, CRC(815f5c0a) SHA1(ad0b59eeebb2e57035a3f643ac0ef575569bec0f) )
|
||||
ROM_LOAD( "kj-5.bin", 0x10000, 0x8000, CRC(11111759) SHA1(504c62fc6778a4afa86cba69634652708535bef6) )
|
||||
|
||||
ROM_REGION( 0xc000, "gfx3", 0 ) /* sprites */
|
||||
ROM_REGION( 0xc000, "sprites2", 0 )
|
||||
ROM_LOAD( "kj-7.bin", 0x0000, 0x4000, CRC(121fcccb) SHA1(77f3e7e49787d6a893c5d8c0c3ac612b1180e866) )
|
||||
ROM_LOAD( "kj-9.bin", 0x4000, 0x4000, CRC(affbe3eb) SHA1(056111fc5b04ff14b114b5f724d02789c8e3ee10) )
|
||||
ROM_LOAD( "kj-8.bin", 0x8000, 0x4000, CRC(e057e72a) SHA1(3a85750c72caaa027f302dc6ca4086bdbd49b5ff) )
|
||||
|
||||
ROM_REGION( 0x420, "proms", 0 )
|
||||
ROM_LOAD( "kjclr1.bin", 0x000, 0x100, CRC(c3378ac2) SHA1(264fdc0718b36e02fc1fc1064a9566e349f4bf25) ) /* tile red */
|
||||
ROM_LOAD( "kjclr2.bin", 0x100, 0x100, CRC(2126da97) SHA1(6ca394a5977fab72200a00716a1f25f2a9447896) ) /* tile green */
|
||||
ROM_LOAD( "kjclr3.bin", 0x200, 0x100, CRC(fde62164) SHA1(d0f6b8d0dce63ce592a5f0c9dc8e6260f69a9141) ) /* tile blue */
|
||||
ROM_LOAD( "kjprom5.bin", 0x300, 0x020, CRC(5a81dd9f) SHA1(090ec9135b12e85ed02ab71fca55cc8d1ea8215a) ) /* sprite palette */
|
||||
ROM_LOAD( "kjprom4.bin", 0x320, 0x100, CRC(48dc2066) SHA1(b8007a5115d475b535284965681ae341f819d3db) ) /* sprite clut */
|
||||
ROM_LOAD( "kjclr1.bin", 0x000, 0x100, CRC(c3378ac2) SHA1(264fdc0718b36e02fc1fc1064a9566e349f4bf25) ) // tile red
|
||||
ROM_LOAD( "kjclr2.bin", 0x100, 0x100, CRC(2126da97) SHA1(6ca394a5977fab72200a00716a1f25f2a9447896) ) // tile green
|
||||
ROM_LOAD( "kjclr3.bin", 0x200, 0x100, CRC(fde62164) SHA1(d0f6b8d0dce63ce592a5f0c9dc8e6260f69a9141) ) // tile blue
|
||||
ROM_LOAD( "kjprom5.bin", 0x300, 0x020, CRC(5a81dd9f) SHA1(090ec9135b12e85ed02ab71fca55cc8d1ea8215a) ) // sprite palette
|
||||
ROM_LOAD( "kjprom4.bin", 0x320, 0x100, CRC(48dc2066) SHA1(b8007a5115d475b535284965681ae341f819d3db) ) // sprite clut
|
||||
ROM_END
|
||||
|
||||
ROM_START( kncljoea )
|
||||
@ -319,30 +604,30 @@ ROM_START( kncljoea )
|
||||
ROM_LOAD( "kj-2.bin", 0x4000, 0x4000, CRC(cb11514b) SHA1(c75d4019d1617493ff074ce8187a81ad70d9b60c) )
|
||||
ROM_LOAD( "kj-3.bin", 0x8000, 0x4000, CRC(0f50697b) SHA1(412c6aba270824299ca2a74e9bea42b83e69797b) )
|
||||
|
||||
ROM_REGION( 0x8000, "soundcpu", 0 ) /* 64k for audio code */
|
||||
ROM_REGION( 0x8000, "soundcpu", 0 )
|
||||
ROM_LOAD( "kj-13.bin",0x6000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) )
|
||||
|
||||
ROM_REGION( 0xc000, "gfx1", 0 ) /* tiles */
|
||||
ROM_REGION( 0xc000, "tiles", 0 )
|
||||
ROM_LOAD( "kj-10.bin", 0x0000, 0x4000, CRC(74d3ba33) SHA1(c7887d690cb7f7a7b24d59d490ffc088fb6cc49c) )
|
||||
ROM_LOAD( "kj-11.bin", 0x4000, 0x4000, CRC(8ea01455) SHA1(b4b42fe373a1019b4f2a4b763a8a7219a5c9987e) )
|
||||
ROM_LOAD( "kj-12.bin", 0x8000, 0x4000, CRC(33367c41) SHA1(e6c56bcad008f3af4bc0f7d7afe8e23c8eb9d943) )
|
||||
|
||||
ROM_REGION( 0x18000, "gfx2", 0 ) /* sprites */
|
||||
ROM_REGION( 0x18000, "sprites1", 0 )
|
||||
ROM_LOAD( "kj-4.bin", 0x00000, 0x8000, CRC(a499ea10) SHA1(cb671cc75b3c6029dd3529e62d83025f78b45271) )
|
||||
ROM_LOAD( "kj-6.bin", 0x08000, 0x8000, CRC(815f5c0a) SHA1(ad0b59eeebb2e57035a3f643ac0ef575569bec0f) )
|
||||
ROM_LOAD( "kj-5.bin", 0x10000, 0x8000, CRC(11111759) SHA1(504c62fc6778a4afa86cba69634652708535bef6) )
|
||||
|
||||
ROM_REGION( 0xc000, "gfx3", 0 ) /* sprites */
|
||||
ROM_REGION( 0xc000, "sprites2", 0 )
|
||||
ROM_LOAD( "kj-7.bin", 0x0000, 0x4000, CRC(121fcccb) SHA1(77f3e7e49787d6a893c5d8c0c3ac612b1180e866) )
|
||||
ROM_LOAD( "kj-9.bin", 0x4000, 0x4000, CRC(affbe3eb) SHA1(056111fc5b04ff14b114b5f724d02789c8e3ee10) )
|
||||
ROM_LOAD( "kj-8.bin", 0x8000, 0x4000, CRC(e057e72a) SHA1(3a85750c72caaa027f302dc6ca4086bdbd49b5ff) )
|
||||
|
||||
ROM_REGION( 0x420, "proms", 0 )
|
||||
ROM_LOAD( "kjclr1.bin", 0x000, 0x100, CRC(c3378ac2) SHA1(264fdc0718b36e02fc1fc1064a9566e349f4bf25) ) /* tile red */
|
||||
ROM_LOAD( "kjclr2.bin", 0x100, 0x100, CRC(2126da97) SHA1(6ca394a5977fab72200a00716a1f25f2a9447896) ) /* tile green */
|
||||
ROM_LOAD( "kjclr3.bin", 0x200, 0x100, CRC(fde62164) SHA1(d0f6b8d0dce63ce592a5f0c9dc8e6260f69a9141) ) /* tile blue */
|
||||
ROM_LOAD( "kjprom5.bin", 0x300, 0x020, CRC(5a81dd9f) SHA1(090ec9135b12e85ed02ab71fca55cc8d1ea8215a) ) /* sprite palette */
|
||||
ROM_LOAD( "kjprom4.bin", 0x320, 0x100, CRC(48dc2066) SHA1(b8007a5115d475b535284965681ae341f819d3db) ) /* sprite clut */
|
||||
ROM_LOAD( "kjclr1.bin", 0x000, 0x100, CRC(c3378ac2) SHA1(264fdc0718b36e02fc1fc1064a9566e349f4bf25) ) // tile red
|
||||
ROM_LOAD( "kjclr2.bin", 0x100, 0x100, CRC(2126da97) SHA1(6ca394a5977fab72200a00716a1f25f2a9447896) ) // tile green
|
||||
ROM_LOAD( "kjclr3.bin", 0x200, 0x100, CRC(fde62164) SHA1(d0f6b8d0dce63ce592a5f0c9dc8e6260f69a9141) ) // tile blue
|
||||
ROM_LOAD( "kjprom5.bin", 0x300, 0x020, CRC(5a81dd9f) SHA1(090ec9135b12e85ed02ab71fca55cc8d1ea8215a) ) // sprite palette
|
||||
ROM_LOAD( "kjprom4.bin", 0x320, 0x100, CRC(48dc2066) SHA1(b8007a5115d475b535284965681ae341f819d3db) ) // sprite clut
|
||||
ROM_END
|
||||
|
||||
ROM_START( bcrusher )
|
||||
@ -351,34 +636,35 @@ ROM_START( bcrusher )
|
||||
ROM_LOAD( "bcrush2.bin", 0x4000, 0x4000, CRC(1be4c731) SHA1(11f3a33263d66172902dfb6f3fe2d0ab5cad38d7) )
|
||||
ROM_LOAD( "bcrush3.bin", 0x8000, 0x4000, CRC(0772d993) SHA1(430f0319bd4765add2f1ee197e7217fdf9ae79c8) )
|
||||
|
||||
ROM_REGION( 0x8000, "soundcpu", 0 ) /* 64k for audio code */
|
||||
ROM_REGION( 0x8000, "soundcpu", 0 )
|
||||
ROM_LOAD( "kj-13.bin",0x6000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) )
|
||||
|
||||
ROM_REGION( 0xc000, "gfx1", 0 ) /* tiles */
|
||||
ROM_REGION( 0xc000, "tiles", 0 )
|
||||
ROM_LOAD( "bcrush10.bin", 0x0000, 0x4000, CRC(a62f4572) SHA1(4e38e175e25a955e5f83cac8c935163e2e861e94) )
|
||||
ROM_LOAD( "bcrush11.bin", 0x4000, 0x4000, CRC(79cc5644) SHA1(bc356065a2475d0e0921fc5c84fa46f6629caae7) )
|
||||
ROM_LOAD( "bcrush12.bin", 0x8000, 0x4000, CRC(8f09641d) SHA1(5ccc423b15148d96c0a348d41a3f4fff7bbae7b9) )
|
||||
|
||||
ROM_REGION( 0x18000, "gfx2", 0 ) /* sprites */
|
||||
ROM_REGION( 0x18000, "sprites1", 0 )
|
||||
ROM_LOAD( "kj-4.bin", 0x00000, 0x8000, CRC(a499ea10) SHA1(cb671cc75b3c6029dd3529e62d83025f78b45271) )
|
||||
ROM_LOAD( "kj-6.bin", 0x08000, 0x8000, CRC(815f5c0a) SHA1(ad0b59eeebb2e57035a3f643ac0ef575569bec0f) )
|
||||
ROM_LOAD( "kj-5.bin", 0x10000, 0x8000, CRC(11111759) SHA1(504c62fc6778a4afa86cba69634652708535bef6) )
|
||||
|
||||
ROM_REGION( 0xc000, "gfx3", 0 ) /* sprites */
|
||||
ROM_REGION( 0xc000, "sprites2", 0 )
|
||||
ROM_LOAD( "kj-7.bin", 0x0000, 0x4000, CRC(121fcccb) SHA1(77f3e7e49787d6a893c5d8c0c3ac612b1180e866) )
|
||||
ROM_LOAD( "kj-9.bin", 0x4000, 0x4000, CRC(affbe3eb) SHA1(056111fc5b04ff14b114b5f724d02789c8e3ee10) )
|
||||
ROM_LOAD( "kj-8.bin", 0x8000, 0x4000, CRC(e057e72a) SHA1(3a85750c72caaa027f302dc6ca4086bdbd49b5ff) )
|
||||
|
||||
ROM_REGION( 0x420, "proms", 0 )
|
||||
ROM_LOAD( "kjclr1.bin", 0x000, 0x100, CRC(c3378ac2) SHA1(264fdc0718b36e02fc1fc1064a9566e349f4bf25) ) /* tile red */
|
||||
ROM_LOAD( "kjclr2.bin", 0x100, 0x100, CRC(2126da97) SHA1(6ca394a5977fab72200a00716a1f25f2a9447896) ) /* tile green */
|
||||
ROM_LOAD( "kjclr3.bin", 0x200, 0x100, CRC(fde62164) SHA1(d0f6b8d0dce63ce592a5f0c9dc8e6260f69a9141) ) /* tile blue */
|
||||
ROM_LOAD( "kjprom5.bin", 0x300, 0x020, CRC(5a81dd9f) SHA1(090ec9135b12e85ed02ab71fca55cc8d1ea8215a) ) /* sprite palette */
|
||||
ROM_LOAD( "kjprom4.bin", 0x320, 0x100, CRC(48dc2066) SHA1(b8007a5115d475b535284965681ae341f819d3db) ) /* sprite clut */
|
||||
ROM_LOAD( "kjclr1.bin", 0x000, 0x100, CRC(c3378ac2) SHA1(264fdc0718b36e02fc1fc1064a9566e349f4bf25) ) // tile red
|
||||
ROM_LOAD( "kjclr2.bin", 0x100, 0x100, CRC(2126da97) SHA1(6ca394a5977fab72200a00716a1f25f2a9447896) ) // tile green
|
||||
ROM_LOAD( "kjclr3.bin", 0x200, 0x100, CRC(fde62164) SHA1(d0f6b8d0dce63ce592a5f0c9dc8e6260f69a9141) ) // tile blue
|
||||
ROM_LOAD( "kjprom5.bin", 0x300, 0x020, CRC(5a81dd9f) SHA1(090ec9135b12e85ed02ab71fca55cc8d1ea8215a) ) // sprite palette
|
||||
ROM_LOAD( "kjprom4.bin", 0x320, 0x100, CRC(48dc2066) SHA1(b8007a5115d475b535284965681ae341f819d3db) ) // sprite clut
|
||||
ROM_END
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
GAME( 1985, kncljoe, 0, kncljoe, kncljoe, kncljoe_state, empty_init, ROT0, "Seibu Kaihatsu (Taito license)", "Knuckle Joe (set 1)", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1985, kncljoea, kncljoe, kncljoe, kncljoe, kncljoe_state, empty_init, ROT0, "Seibu Kaihatsu (Taito license)", "Knuckle Joe (set 2)", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1985, bcrusher, kncljoe, kncljoe, kncljoe, kncljoe_state, empty_init, ROT0, "bootleg", "Bone Crusher", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1985, bcrusher, kncljoe, kncljoe, kncljoe, kncljoe_state, empty_init, ROT0, "bootleg", "Bone Crusher", MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -1,88 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ernesto Corvi
|
||||
/*************************************************************************
|
||||
|
||||
Knuckle Joe
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef MAME_SEIBU_KNCLJOE_H
|
||||
#define MAME_SEIBU_KNCLJOE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cpu/m6800/m6801.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "tilemap.h"
|
||||
|
||||
class kncljoe_state : public driver_device
|
||||
{
|
||||
public:
|
||||
kncljoe_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_scrollregs(*this, "scrollregs"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_soundcpu(*this, "soundcpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette"),
|
||||
m_ay8910(*this, "aysnd"),
|
||||
m_soundlatch(*this, "soundlatch")
|
||||
{ }
|
||||
|
||||
void kncljoe(machine_config &config);
|
||||
|
||||
private:
|
||||
/* memory pointers */
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
required_shared_ptr<uint8_t> m_scrollregs;
|
||||
required_shared_ptr<uint8_t> m_spriteram;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *m_bg_tilemap = nullptr;
|
||||
int m_tile_bank = 0;
|
||||
int m_sprite_bank = 0;
|
||||
int m_flipscreen = 0;
|
||||
|
||||
/* misc */
|
||||
uint8_t m_port1 = 0U;
|
||||
uint8_t m_port2 = 0U;
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<m6803_cpu_device> m_soundcpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<ay8910_device> m_ay8910;
|
||||
required_device<generic_latch_8_device> m_soundlatch;
|
||||
|
||||
void sound_cmd_w(uint8_t data);
|
||||
void sound_irq_ack_w(uint8_t data);
|
||||
void kncljoe_videoram_w(offs_t offset, uint8_t data);
|
||||
void kncljoe_control_w(uint8_t data);
|
||||
void kncljoe_scroll_w(offs_t offset, uint8_t data);
|
||||
void m6803_port1_w(uint8_t data);
|
||||
void m6803_port2_w(uint8_t data);
|
||||
uint8_t m6803_port1_r();
|
||||
uint8_t m6803_port2_r();
|
||||
void unused_w(uint8_t data);
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
void kncljoe_palette(palette_device &palette) const;
|
||||
uint32_t screen_update_kncljoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(sound_nmi);
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void main_map(address_map &map);
|
||||
void sound_map(address_map &map);
|
||||
};
|
||||
|
||||
#endif // MAME_SEIBU_KNCLJOE_H
|
@ -1,214 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ernesto Corvi
|
||||
/***************************************************************************
|
||||
|
||||
Knuckle Joe
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "kncljoe.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Convert the color PROMs into a more useable format.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void kncljoe_state::kncljoe_palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *color_prom = memregion("proms")->base();
|
||||
|
||||
// create a lookup table for the palette
|
||||
for (int i = 0; i < 0x80; i++)
|
||||
{
|
||||
int const r = pal4bit(color_prom[i + 0x000]);
|
||||
int const g = pal4bit(color_prom[i + 0x100]);
|
||||
int const b = pal4bit(color_prom[i + 0x200]);
|
||||
|
||||
palette.set_indirect_color(i, rgb_t(r, g, b));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
int bit0, bit1, bit2;
|
||||
|
||||
// red component
|
||||
bit0 = 0;
|
||||
bit1 = BIT(color_prom[i + 0x300], 6);
|
||||
bit2 = BIT(color_prom[i + 0x300], 7);
|
||||
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
// green component
|
||||
bit0 = BIT(color_prom[i + 0x300], 3);
|
||||
bit1 = BIT(color_prom[i + 0x300], 4);
|
||||
bit2 = BIT(color_prom[i + 0x300], 5);
|
||||
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
// blue component
|
||||
bit0 = BIT(color_prom[i + 0x300], 0);
|
||||
bit1 = BIT(color_prom[i + 0x300], 1);
|
||||
bit2 = BIT(color_prom[i + 0x300], 2);
|
||||
int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
palette.set_indirect_color(i + 0x80, rgb_t(r, g, b));
|
||||
}
|
||||
|
||||
// color_prom now points to the beginning of the lookup table
|
||||
color_prom += 0x320;
|
||||
|
||||
// chars
|
||||
for (int i = 0; i < 0x80; i++)
|
||||
palette.set_pen_indirect(i, i);
|
||||
|
||||
// sprite lookup table
|
||||
for (int i = 0; i < 0x80; i++)
|
||||
{
|
||||
uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x80;
|
||||
palette.set_pen_indirect(i + 0x80, ctabentry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Callbacks for the TileMap code
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
TILE_GET_INFO_MEMBER(kncljoe_state::get_bg_tile_info)
|
||||
{
|
||||
int attr = m_videoram[2 * tile_index + 1];
|
||||
int code = m_videoram[2 * tile_index] + ((attr & 0xc0) << 2) + (m_tile_bank << 10);
|
||||
|
||||
tileinfo.set(0,
|
||||
code,
|
||||
attr & 0xf,
|
||||
TILE_FLIPXY((attr & 0x30) >> 4));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Start the video hardware emulation.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void kncljoe_state::video_start()
|
||||
{
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(kncljoe_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
|
||||
|
||||
m_bg_tilemap->set_scroll_rows(4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Memory handlers
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void kncljoe_state::kncljoe_videoram_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
void kncljoe_state::kncljoe_control_w(uint8_t data)
|
||||
{
|
||||
/*
|
||||
0x01 screen flip
|
||||
0x02 coin counter#1
|
||||
0x04 sprite bank
|
||||
0x10 character bank
|
||||
0x20 coin counter#2
|
||||
|
||||
reset when IN0 - Coin 1 goes low (active)
|
||||
set after IN0 - Coin 1 goes high AND the credit has been added
|
||||
*/
|
||||
m_flipscreen = data & 0x01;
|
||||
machine().tilemap().set_flip_all(m_flipscreen ? TILEMAP_FLIPX : TILEMAP_FLIPY);
|
||||
|
||||
machine().bookkeeping().coin_counter_w(0, data & 0x02);
|
||||
machine().bookkeeping().coin_counter_w(1, data & 0x20);
|
||||
|
||||
if (m_tile_bank != BIT(data, 4))
|
||||
{
|
||||
m_tile_bank = BIT(data, 4);
|
||||
m_bg_tilemap->mark_all_dirty();
|
||||
}
|
||||
|
||||
m_sprite_bank = BIT(data, 2);
|
||||
}
|
||||
|
||||
void kncljoe_state::kncljoe_scroll_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_scrollregs[offset] = data;
|
||||
int scrollx = m_scrollregs[0] | m_scrollregs[1] << 8;
|
||||
m_bg_tilemap->set_scrollx(0, scrollx);
|
||||
m_bg_tilemap->set_scrollx(1, scrollx);
|
||||
m_bg_tilemap->set_scrollx(2, scrollx);
|
||||
m_bg_tilemap->set_scrollx(3, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Display refresh
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void kncljoe_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
gfx_element *gfx = m_gfxdecode->gfx(1 + m_sprite_bank);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
// clip vertical strip for each layer
|
||||
rectangle clip = cliprect;
|
||||
clip.min_y = m_flipscreen ? (191 - i * 64) : (i * 64 + 1);
|
||||
clip.max_y = clip.min_y + 63;
|
||||
clip &= cliprect;
|
||||
|
||||
for (int j = 0x7c; j >= 0; j -= 4)
|
||||
{
|
||||
int offs = bitswap<2>(~i, 0, 1) << 7 | j;
|
||||
int sy = m_spriteram[offs] + 1;
|
||||
int sx = m_spriteram[offs + 3];
|
||||
int attr = m_spriteram[offs + 1];
|
||||
int code = m_spriteram[offs + 2] | ((attr & 0x10) << 5) | ((attr & 0x20) << 3);
|
||||
int flipx = attr & 0x40;
|
||||
int flipy = !(attr & 0x80);
|
||||
int color = attr & 0x0f;
|
||||
|
||||
if (m_flipscreen)
|
||||
{
|
||||
flipx = !flipx;
|
||||
flipy = !flipy;
|
||||
sx = 240 - sx;
|
||||
sy = 240 - sy;
|
||||
}
|
||||
|
||||
if (sx >= 256-8)
|
||||
sx -= 256;
|
||||
|
||||
gfx->transpen(bitmap,clip,
|
||||
code,
|
||||
color,
|
||||
flipx,flipy,
|
||||
sx,sy,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t kncljoe_state::screen_update_kncljoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,108 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Mark McDougall
|
||||
#ifndef MAME_SEIBU_STFIGHT_H
|
||||
#define MAME_SEIBU_STFIGHT_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cpu/m6805/m68705.h"
|
||||
#include "sound/ymopn.h"
|
||||
#include "sound/msm5205.h"
|
||||
#include "stfight_dev.h"
|
||||
#include "airraid_dev.h"
|
||||
|
||||
class stfight_state : public driver_device
|
||||
{
|
||||
public:
|
||||
stfight_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_coin_mech(*this, "COIN")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_audiocpu(*this, "audiocpu")
|
||||
, m_mcu(*this, "mcu")
|
||||
, m_msm(*this, "msm")
|
||||
, m_ym(*this, "ym%u", 0)
|
||||
, m_main_bank(*this, "mainbank")
|
||||
, m_samples(*this, "adpcm")
|
||||
, m_decrypted_opcodes(*this, "decrypted_opcodes")
|
||||
, m_coin_state(0)
|
||||
, m_fm_data(0)
|
||||
, m_cpu_to_mcu_empty(true)
|
||||
, m_cpu_to_mcu_data(0x0f)
|
||||
, m_port_a_out(0xff)
|
||||
, m_port_c_out(0xff)
|
||||
, m_vck2(false)
|
||||
, m_adpcm_reset(true)
|
||||
, m_adpcm_data_offs(0x0000)
|
||||
{
|
||||
}
|
||||
|
||||
void stfight_base(machine_config &config);
|
||||
void stfight(machine_config &config);
|
||||
void cshooter(machine_config &config);
|
||||
|
||||
void init_stfight();
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(rst08_tick);
|
||||
|
||||
private:
|
||||
void stfight_adpcm_int(int state);
|
||||
|
||||
void stfight_io_w(uint8_t data);
|
||||
uint8_t stfight_coin_r();
|
||||
void stfight_coin_w(uint8_t data);
|
||||
void stfight_fm_w(uint8_t data);
|
||||
void stfight_mcu_w(uint8_t data);
|
||||
|
||||
void stfight_bank_w(uint8_t data);
|
||||
|
||||
uint8_t stfight_fm_r();
|
||||
|
||||
INTERRUPT_GEN_MEMBER(stfight_vb_interrupt);
|
||||
|
||||
// MCU specifics
|
||||
uint8_t stfight_68705_port_b_r();
|
||||
void stfight_68705_port_a_w(uint8_t data);
|
||||
void stfight_68705_port_b_w(uint8_t data);
|
||||
void stfight_68705_port_c_w(uint8_t data);
|
||||
|
||||
void cpu1_map(address_map &map);
|
||||
void cpu2_map(address_map &map);
|
||||
void cshooter_cpu1_map(address_map &map);
|
||||
void decrypted_opcodes_map(address_map &map);
|
||||
void stfight_cpu1_map(address_map &map);
|
||||
|
||||
required_ioport m_coin_mech;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<m68705p5_device> m_mcu;
|
||||
required_device<msm5205_device> m_msm;
|
||||
required_device_array<ym2203_device, 2> m_ym;
|
||||
|
||||
required_memory_bank m_main_bank;
|
||||
|
||||
required_region_ptr<uint8_t> m_samples;
|
||||
optional_shared_ptr<uint8_t> m_decrypted_opcodes;
|
||||
|
||||
uint8_t m_coin_state = 0;
|
||||
|
||||
uint8_t m_fm_data = 0;
|
||||
|
||||
bool m_cpu_to_mcu_empty = false;
|
||||
uint8_t m_cpu_to_mcu_data = 0;
|
||||
uint8_t m_port_a_out = 0;
|
||||
uint8_t m_port_c_out = 0;
|
||||
|
||||
bool m_vck2 = false;
|
||||
bool m_adpcm_reset = false;
|
||||
uint16_t m_adpcm_data_offs = 0;
|
||||
|
||||
emu_timer *m_int1_timer = nullptr;
|
||||
};
|
||||
|
||||
#endif // MAME_SEIBU_STFIGHT_H
|
@ -1,246 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Mark McDougall
|
||||
/***************************************************************************
|
||||
|
||||
stfight.c
|
||||
|
||||
Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
|
||||
I/O ports)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "stfight.h"
|
||||
|
||||
#include "cpu/m6805/m68705.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/msm5205.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Encryption PAL 16R4 on CPU board
|
||||
|
||||
+---U---+
|
||||
CP --| |-- VCC
|
||||
ROM D1 --| |-- ROM D0 M1 = 0 M1 = 1
|
||||
ROM D3 --| |-- (NC)
|
||||
ROM D4 --| |-- D6 D6 = D1 ^^ D3 D6 = / ( D1 ^^ D0 )
|
||||
ROM D6 --| |-- D4 D4 = / ( D6 ^^ A7 ) D4 = D3 ^^ A0
|
||||
A0 --| |-- D3 D3 = / ( D0 ^^ A1 ) D3 = D4 ^^ A4
|
||||
A1 --| |-- D0 D0 = D1 ^^ D4 D0 = / ( D6 ^^ A0 )
|
||||
A4 --| |-- (NC)
|
||||
A7 --| |-- /M1
|
||||
GND --| |-- /OE
|
||||
+-------+
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void stfight_state::init_stfight()
|
||||
{
|
||||
uint8_t *rom = memregion("maincpu")->base();
|
||||
|
||||
for (uint32_t A = 0; A < 0x8000; ++A)
|
||||
{
|
||||
uint8_t src = rom[A];
|
||||
|
||||
// decode opcode
|
||||
m_decrypted_opcodes[A] =
|
||||
( src & 0xA6 ) |
|
||||
( ( ( ( src << 2 ) ^ src ) << 3 ) & 0x40 ) |
|
||||
( ~( ( src ^ ( A >> 1 ) ) >> 2 ) & 0x10 ) |
|
||||
( ~( ( ( src << 1 ) ^ A ) << 2 ) & 0x08 ) |
|
||||
( ( ( src ^ ( src >> 3 ) ) >> 1 ) & 0x01 );
|
||||
|
||||
// decode operand
|
||||
rom[A] =
|
||||
( src & 0xA6 ) |
|
||||
( ~( ( src ^ ( src << 1 ) ) << 5 ) & 0x40 ) |
|
||||
( ( ( src ^ ( A << 3 ) ) << 1 ) & 0x10 ) |
|
||||
( ( ( src ^ A ) >> 1 ) & 0x08 ) |
|
||||
( ~( ( src >> 6 ) ^ A ) & 0x01 );
|
||||
}
|
||||
|
||||
// Set clock prescaler FM:1/2 PSG:1/1
|
||||
m_ym[0]->write(0, 0x2f);
|
||||
m_ym[1]->write(0, 0x2f);
|
||||
}
|
||||
|
||||
void stfight_state::machine_start()
|
||||
{
|
||||
m_main_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000);
|
||||
m_main_bank->set_entry(0);
|
||||
|
||||
m_int1_timer = timer_alloc(FUNC(stfight_state::rst08_tick), this);
|
||||
|
||||
save_item(NAME(m_coin_state));
|
||||
save_item(NAME(m_fm_data));
|
||||
|
||||
save_item(NAME(m_cpu_to_mcu_empty));
|
||||
save_item(NAME(m_cpu_to_mcu_data));
|
||||
save_item(NAME(m_port_a_out));
|
||||
save_item(NAME(m_port_c_out));
|
||||
|
||||
save_item(NAME(m_vck2));
|
||||
save_item(NAME(m_adpcm_reset));
|
||||
save_item(NAME(m_adpcm_data_offs));
|
||||
}
|
||||
|
||||
|
||||
void stfight_state::machine_reset()
|
||||
{
|
||||
m_fm_data = 0;
|
||||
m_cpu_to_mcu_empty = true;
|
||||
m_adpcm_reset = true;
|
||||
|
||||
// Coin signals are active low
|
||||
m_coin_state = 3;
|
||||
}
|
||||
|
||||
// It's entirely possible that this bank is never switched out
|
||||
// - in fact I don't even know how/where it's switched in!
|
||||
void stfight_state::stfight_bank_w(uint8_t data)
|
||||
{
|
||||
m_main_bank->set_entry(bitswap(data, 7, 2));
|
||||
}
|
||||
|
||||
/*
|
||||
* CPU 1 timed interrupt - 60Hz???
|
||||
*/
|
||||
|
||||
TIMER_CALLBACK_MEMBER(stfight_state::rst08_tick)
|
||||
{
|
||||
m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); // Z80
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(stfight_state::stfight_vb_interrupt)
|
||||
{
|
||||
// Do a RST10
|
||||
device.execute().set_input_line_and_vector(0, HOLD_LINE, 0xcf); // Z80
|
||||
m_int1_timer->adjust(attotime::from_hz(120));
|
||||
}
|
||||
|
||||
/*
|
||||
* Hardware handlers
|
||||
*/
|
||||
|
||||
void stfight_state::stfight_io_w(uint8_t data)
|
||||
{
|
||||
// TODO: What is bit 4?
|
||||
machine().bookkeeping().coin_counter_w(0, data & 1);
|
||||
machine().bookkeeping().coin_counter_w(1, data & 2);
|
||||
}
|
||||
|
||||
uint8_t stfight_state::stfight_coin_r()
|
||||
{
|
||||
return m_coin_state;
|
||||
}
|
||||
|
||||
void stfight_state::stfight_coin_w(uint8_t data)
|
||||
{
|
||||
// Acknowledge coin signals (active low)
|
||||
if (!BIT(data, 0))
|
||||
m_coin_state |= 1;
|
||||
|
||||
if (!BIT(data, 1))
|
||||
m_coin_state |= 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Machine hardware for MSM5205 ADPCM sound control
|
||||
*/
|
||||
|
||||
void stfight_state::stfight_adpcm_int(int state)
|
||||
{
|
||||
if (!state)
|
||||
return;
|
||||
|
||||
// Falling edge triggered interrupt at half the rate of /VCK?
|
||||
m_mcu->set_input_line(M68705_IRQ_LINE, m_vck2 ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_vck2 = !m_vck2;
|
||||
|
||||
if (!m_adpcm_reset)
|
||||
{
|
||||
uint8_t adpcm_data = m_samples[(m_adpcm_data_offs >> 1) & 0x7fff];
|
||||
|
||||
if (!BIT(m_adpcm_data_offs, 0))
|
||||
adpcm_data >>= 4;
|
||||
++m_adpcm_data_offs;
|
||||
|
||||
m_msm->data_w(adpcm_data & 0x0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Machine hardware for YM2303 FM sound control
|
||||
*/
|
||||
|
||||
void stfight_state::stfight_fm_w(uint8_t data)
|
||||
{
|
||||
// The sound cpu ignores any FM data without bit 7 set
|
||||
m_fm_data = 0x80 | data;
|
||||
}
|
||||
|
||||
uint8_t stfight_state::stfight_fm_r()
|
||||
{
|
||||
uint8_t const data = m_fm_data;
|
||||
|
||||
// Acknowledge the command
|
||||
if (!machine().side_effects_disabled())
|
||||
m_fm_data &= ~0x80;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MCU communications
|
||||
*/
|
||||
|
||||
void stfight_state::stfight_mcu_w(uint8_t data)
|
||||
{
|
||||
m_cpu_to_mcu_data = data & 0x0f;
|
||||
m_cpu_to_mcu_empty = false;
|
||||
}
|
||||
|
||||
void stfight_state::stfight_68705_port_a_w(uint8_t data)
|
||||
{
|
||||
m_port_a_out = data;
|
||||
}
|
||||
|
||||
uint8_t stfight_state::stfight_68705_port_b_r()
|
||||
{
|
||||
return
|
||||
(m_coin_mech->read() << 6) |
|
||||
(m_cpu_to_mcu_empty ? 0x10 : 0x00) |
|
||||
(m_cpu_to_mcu_data & 0x0f);
|
||||
}
|
||||
|
||||
void stfight_state::stfight_68705_port_b_w(uint8_t data)
|
||||
{
|
||||
// Acknowledge Z80 command
|
||||
if (!BIT(data, 5))
|
||||
m_cpu_to_mcu_empty = true;
|
||||
}
|
||||
|
||||
void stfight_state::stfight_68705_port_c_w(uint8_t data)
|
||||
{
|
||||
// Signal a valid coin on the falling edge
|
||||
if (BIT(m_port_c_out, 0) && !BIT(data, 0))
|
||||
m_coin_state &= ~1;
|
||||
if (BIT(m_port_c_out, 1) && !BIT(data, 1))
|
||||
m_coin_state &= ~2;
|
||||
|
||||
// Latch ADPCM data address when dropping the reset line
|
||||
m_adpcm_reset = BIT(data, 2);
|
||||
if (!m_adpcm_reset && BIT(m_port_c_out, 2))
|
||||
m_adpcm_data_offs = m_port_a_out << 9;
|
||||
m_msm->reset_w(m_adpcm_reset ? ASSERT_LINE : CLEAR_LINE);
|
||||
|
||||
// Generate NMI on host CPU (used on handshake error or stuck coin)
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, BIT(data, 3) ? CLEAR_LINE : ASSERT_LINE);
|
||||
|
||||
m_port_c_out = data;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,108 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Zsolt Vasvari
|
||||
/***************************************************************************
|
||||
|
||||
Seibu Stinger/Wiz hardware
|
||||
|
||||
***************************************************************************/
|
||||
#ifndef MAME_SEIBU_WIZ_H
|
||||
#define MAME_SEIBU_WIZ_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sound/discrete.h"
|
||||
#include "emupal.h"
|
||||
|
||||
class wiz_state : public driver_device
|
||||
{
|
||||
public:
|
||||
wiz_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_discrete(*this, "discrete"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_videoram2(*this, "videoram2"),
|
||||
m_colorram(*this, "colorram"),
|
||||
m_colorram2(*this, "colorram2"),
|
||||
m_attrram(*this, "attrram"),
|
||||
m_attrram2(*this, "attrram2"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_spriteram2(*this, "spriteram2"),
|
||||
m_decrypted_opcodes(*this, "decrypted_opcodes")
|
||||
{ }
|
||||
|
||||
void wiz(machine_config &config);
|
||||
void kungfut(machine_config &config);
|
||||
void kungfuta(machine_config &config);
|
||||
void scion(machine_config &config);
|
||||
void stinger(machine_config &config);
|
||||
|
||||
void init_stinger();
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
optional_device<discrete_device> m_discrete;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
required_shared_ptr<uint8_t> m_videoram2;
|
||||
required_shared_ptr<uint8_t> m_colorram;
|
||||
required_shared_ptr<uint8_t> m_colorram2;
|
||||
required_shared_ptr<uint8_t> m_attrram;
|
||||
required_shared_ptr<uint8_t> m_attrram2;
|
||||
required_shared_ptr<uint8_t> m_spriteram;
|
||||
required_shared_ptr<uint8_t> m_spriteram2;
|
||||
optional_shared_ptr<uint8_t> m_decrypted_opcodes;
|
||||
|
||||
int32_t m_flipx = 0;
|
||||
int32_t m_flipy = 0;
|
||||
int32_t m_bgcolor = 0;
|
||||
uint8_t m_charbank[2]{};
|
||||
uint8_t m_palbank[2]{};
|
||||
uint8_t m_main_nmi_mask = 0;
|
||||
uint8_t m_sound_nmi_mask = 0;
|
||||
uint8_t m_sprite_bank = 0;
|
||||
|
||||
int m_dsc0 = 0;
|
||||
int m_dsc1 = 0;
|
||||
|
||||
uint8_t wiz_protection_r();
|
||||
uint8_t kungfuta_protection_r();
|
||||
void wiz_coin_counter_w(offs_t offset, uint8_t data);
|
||||
void wiz_main_nmi_mask_w(uint8_t data);
|
||||
void wiz_sound_nmi_mask_w(uint8_t data);
|
||||
void wiz_palette_bank_w(offs_t offset, uint8_t data);
|
||||
void wiz_sprite_bank_w(uint8_t data);
|
||||
void wiz_bgcolor_w(uint8_t data);
|
||||
void wiz_char_bank_w(offs_t offset, uint8_t data);
|
||||
void wiz_flipx_w(uint8_t data);
|
||||
void wiz_flipy_w(uint8_t data);
|
||||
void stinger_explosion_w(uint8_t data);
|
||||
void stinger_shot_w(uint8_t data);
|
||||
|
||||
virtual void machine_reset() override;
|
||||
virtual void machine_start() override;
|
||||
void wiz_palette(palette_device &palette) const;
|
||||
uint32_t screen_update_wiz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_stinger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_kungfut(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(wiz_vblank_interrupt);
|
||||
INTERRUPT_GEN_MEMBER(wiz_sound_interrupt);
|
||||
void draw_tiles(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int charbank, int colortype);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int set, int charbank);
|
||||
|
||||
void decrypted_opcodes_map(address_map &map);
|
||||
void kungfut_main_map(address_map &map);
|
||||
void kungfuta_main_map(address_map &map);
|
||||
void kungfut_sound_map(address_map &map);
|
||||
void stinger_main_map(address_map &map);
|
||||
void stinger_sound_map(address_map &map);
|
||||
void wiz_main_map(address_map &map);
|
||||
};
|
||||
|
||||
#endif // MAME_SEIBU_WIZ_H
|
@ -1,221 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Zsolt Vasvari
|
||||
/***************************************************************************
|
||||
|
||||
Seibu Stinger/Wiz hardware
|
||||
|
||||
Functions to emulate the video hardware of the machine.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "wiz.h"
|
||||
|
||||
#include "video/resnet.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Convert the color PROMs into a more useable format.
|
||||
|
||||
Stinger has three 256x4 palette PROMs (one per gun).
|
||||
The palette PROMs are connected to the RGB output this way:
|
||||
|
||||
bit 3 -- 100 ohm resistor -- RED/GREEN/BLUE
|
||||
-- 220 ohm resistor -- RED/GREEN/BLUE
|
||||
-- 470 ohm resistor -- RED/GREEN/BLUE
|
||||
bit 0 -- 1 kohm resistor -- RED/GREEN/BLUE
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void wiz_state::wiz_palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
static constexpr int resistances[4] = { 1000, 470, 220, 100 };
|
||||
|
||||
// compute the color output resistor weights
|
||||
double rweights[4], gweights[4], bweights[4];
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
4, resistances, rweights, 470, 0,
|
||||
4, resistances, gweights, 470, 0,
|
||||
4, resistances, bweights, 470, 0);
|
||||
|
||||
// initialize the palette with these colors
|
||||
for (int i = 0; i < 0x100; i++)
|
||||
{
|
||||
int bit0, bit1, bit2, bit3;
|
||||
|
||||
// red component
|
||||
bit0 = BIT(color_prom[i + 0x000], 0);
|
||||
bit1 = BIT(color_prom[i + 0x000], 1);
|
||||
bit2 = BIT(color_prom[i + 0x000], 2);
|
||||
bit3 = BIT(color_prom[i + 0x000], 3);
|
||||
int const r = combine_weights(rweights, bit0, bit1, bit2, bit3);
|
||||
|
||||
// green component
|
||||
bit0 = BIT(color_prom[i + 0x100], 0);
|
||||
bit1 = BIT(color_prom[i + 0x100], 1);
|
||||
bit2 = BIT(color_prom[i + 0x100], 2);
|
||||
bit3 = BIT(color_prom[i + 0x100], 3);
|
||||
int const g = combine_weights(gweights, bit0, bit1, bit2, bit3);
|
||||
|
||||
// blue component
|
||||
bit0 = BIT(color_prom[i + 0x200], 0);
|
||||
bit1 = BIT(color_prom[i + 0x200], 1);
|
||||
bit2 = BIT(color_prom[i + 0x200], 2);
|
||||
bit3 = BIT(color_prom[i + 0x200], 3);
|
||||
int const b = combine_weights(bweights, bit0, bit1, bit2, bit3);
|
||||
|
||||
m_palette->set_pen_color(i, rgb_t(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
I/O
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void wiz_state::wiz_palette_bank_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_palbank[offset] = data & 1;
|
||||
}
|
||||
|
||||
void wiz_state::wiz_char_bank_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_charbank[offset] = data & 1;
|
||||
}
|
||||
|
||||
void wiz_state::wiz_sprite_bank_w(uint8_t data)
|
||||
{
|
||||
m_sprite_bank = data & 1;
|
||||
}
|
||||
|
||||
void wiz_state::wiz_bgcolor_w(uint8_t data)
|
||||
{
|
||||
m_bgcolor = data;
|
||||
}
|
||||
|
||||
void wiz_state::wiz_flipx_w(uint8_t data)
|
||||
{
|
||||
m_flipx = data & 1;
|
||||
}
|
||||
|
||||
void wiz_state::wiz_flipy_w(uint8_t data)
|
||||
{
|
||||
m_flipy = data & 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Screen Update
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void wiz_state::draw_tiles(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int charbank, int colortype)
|
||||
{
|
||||
uint8_t *vram = layer ? m_videoram2 : m_videoram;
|
||||
uint8_t *aram = layer ? m_attrram2 : m_attrram;
|
||||
uint8_t *cram = layer ? m_colorram2 : m_colorram;
|
||||
gfx_element *gfx = m_gfxdecode->gfx(charbank);
|
||||
int palbank = m_palbank[1] << 4 | m_palbank[0] << 3;
|
||||
|
||||
/* draw the tiles. They are characters, but draw them as sprites. */
|
||||
for (int offs = 0x400-1; offs >= 0; offs--)
|
||||
{
|
||||
int code = vram[offs];
|
||||
int sx = offs & 0x1f;
|
||||
int sy = offs >> 5;
|
||||
int color = aram[sx << 1 | 1] & 7;
|
||||
|
||||
// wiz/kungfut hw allows more color variety on screen
|
||||
if (colortype)
|
||||
color = layer ? (cram[offs] & 7) : ((color & 4) | (code & 3));
|
||||
|
||||
int scroll = (8*sy + 256 - aram[sx << 1]) & 0xff;
|
||||
if (m_flipy)
|
||||
scroll = (248 - scroll) & 0xff;
|
||||
if (m_flipx)
|
||||
sx = 31 - sx;
|
||||
|
||||
gfx->transpen(bitmap,cliprect,
|
||||
code,
|
||||
palbank | color,
|
||||
m_flipx,m_flipy,
|
||||
8*sx,scroll,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wiz_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int set, int charbank)
|
||||
{
|
||||
uint8_t *sram = set ? m_spriteram2 : m_spriteram;
|
||||
gfx_element *gfx = m_gfxdecode->gfx(charbank);
|
||||
int palbank = m_palbank[1] << 4 | m_palbank[0] << 3;
|
||||
|
||||
for (int offs = 0x20-4; offs >= 0; offs -= 4)
|
||||
{
|
||||
int code = sram[offs + 1];
|
||||
int sx = sram[offs + 3];
|
||||
int sy = sram[offs];
|
||||
int color = sram[offs + 2] & 7; // high bits unused
|
||||
|
||||
if (!sx || !sy) continue;
|
||||
|
||||
// like on galaxian hw, the first three sprites match against y-1 (not on m_spriteram2)
|
||||
if (set == 0 && offs <= 8)
|
||||
sy += (m_flipy) ? 1 : -1;
|
||||
|
||||
if ( m_flipx) sx = 240 - sx;
|
||||
if (!m_flipy) sy = 240 - sy;
|
||||
|
||||
gfx->transpen(bitmap,cliprect,
|
||||
code,
|
||||
palbank | color,
|
||||
m_flipx,m_flipy,
|
||||
sx,sy,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
uint32_t wiz_state::screen_update_kungfut(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(m_bgcolor, cliprect);
|
||||
draw_tiles(bitmap, cliprect, 0, 2 + m_charbank[0], 1);
|
||||
draw_tiles(bitmap, cliprect, 1, m_charbank[1], 1);
|
||||
draw_sprites(bitmap, cliprect, 1, 4);
|
||||
draw_sprites(bitmap, cliprect, 0, 5);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t wiz_state::screen_update_wiz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(m_bgcolor, cliprect);
|
||||
draw_tiles(bitmap, cliprect, 0, 2 + ((m_charbank[0] << 1) | m_charbank[1]), 1);
|
||||
draw_tiles(bitmap, cliprect, 1, m_charbank[1], 1);
|
||||
|
||||
const rectangle spritevisiblearea(2*8, 32*8-1, 2*8, 30*8-1);
|
||||
const rectangle spritevisibleareaflipx(0*8, 30*8-1, 2*8, 30*8-1);
|
||||
const rectangle &visible_area = m_flipx ? spritevisibleareaflipx : spritevisiblearea;
|
||||
|
||||
draw_sprites(bitmap, visible_area, 1, 6);
|
||||
draw_sprites(bitmap, visible_area, 0, 7 + m_sprite_bank);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t wiz_state::screen_update_stinger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(m_bgcolor, cliprect);
|
||||
draw_tiles(bitmap, cliprect, 0, 2 + m_charbank[0], 0);
|
||||
draw_tiles(bitmap, cliprect, 1, m_charbank[1], 0);
|
||||
draw_sprites(bitmap, cliprect, 1, 4);
|
||||
draw_sprites(bitmap, cliprect, 0, 5);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user