Merge pull request #5011 from cam900/alpha68k_args

alpha68k.cpp : Updates
This commit is contained in:
R. Belmont 2019-05-08 10:05:04 -04:00 committed by GitHub
commit c3409e0a03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 443 additions and 486 deletions

File diff suppressed because it is too large Load Diff

View File

@ -66,25 +66,23 @@ public:
void init_sstingry();
private:
DECLARE_WRITE16_MEMBER(tnextspc_coin_counters_w);
DECLARE_WRITE16_MEMBER(tnextspc_unknown_w);
DECLARE_WRITE16_MEMBER(alpha_microcontroller_w);
DECLARE_READ16_MEMBER(kyros_dip_r);
DECLARE_READ16_MEMBER(control_1_r);
DECLARE_READ16_MEMBER(control_2_r);
DECLARE_READ16_MEMBER(control_2_V_r);
DECLARE_READ16_MEMBER(control_3_r);
DECLARE_READ16_MEMBER(control_4_r);
DECLARE_READ16_MEMBER(jongbou_inputs_r);
DECLARE_WRITE8_MEMBER(outlatch_w);
DECLARE_WRITE8_MEMBER(tnextspc_soundlatch_w);
DECLARE_READ16_MEMBER(kyros_alpha_trigger_r);
DECLARE_READ16_MEMBER(alpha_II_trigger_r);
DECLARE_READ16_MEMBER(alpha_V_trigger_r);
DECLARE_READ16_MEMBER(sound_cpu_r);
DECLARE_WRITE8_MEMBER(sound_bank_w);
DECLARE_WRITE8_MEMBER(porta_w);
DECLARE_WRITE16_MEMBER(alpha68k_videoram_w);
void tnextspc_coin_counters_w(offs_t offset, u16 data);
void tnextspc_unknown_w(offs_t offset, u16 data);
void alpha_microcontroller_w(offs_t offset, u16 data, u16 mem_mask);
u16 control_1_r();
u16 control_2_r();
u16 control_3_r();
u16 control_4_r();
u16 jongbou_inputs_r();
void outlatch_w(offs_t offset, u8 data = 0);
void tnextspc_soundlatch_w(u8 data);
u16 kyros_alpha_trigger_r(offs_t offset);
u16 alpha_II_trigger_r(offs_t offset);
u16 alpha_V_trigger_r(offs_t offset);
u16 sound_cpu_r();
void sound_bank_w(u8 data);
void porta_w(u8 data);
void videoram_w(offs_t offset, u16 data);
DECLARE_WRITE_LINE_MEMBER(video_control2_w);
DECLARE_WRITE_LINE_MEMBER(video_control3_w);
@ -98,22 +96,22 @@ private:
DECLARE_VIDEO_START(alpha68k);
DECLARE_MACHINE_START(alpha68k_V);
DECLARE_MACHINE_RESET(alpha68k_V);
uint32_t screen_update_sstingry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_kyros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_alpha68k_I(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_alpha68k_II(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_alpha68k_V(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_alpha68k_V_sb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(alpha68k_sound_nmi);
void alpha68k_flipscreen_w( int flip );
DECLARE_WRITE8_MEMBER(video_bank_w);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e );
void draw_sprites_V( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask );
void draw_sprites_I( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d, int yshift );
void kyros_video_banking(int *bank, int data);
void jongbou_video_banking(int *bank, int data);
void kyros_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d );
void sstingry_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d );
u32 screen_update_sstingry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_kyros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_alpha68k_I(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_alpha68k_II(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_alpha68k_V(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_alpha68k_V_sb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(sound_nmi);
void flipscreen_w(int flip);
void video_bank_w(u8 data);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e);
void draw_sprites_V(bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, u16 fx_mask, u16 fy_mask, u16 sprite_mask);
void draw_sprites_I(bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d, int yshift);
void kyros_video_banking(u8 *bank, int data);
void jongbou_video_banking(u8 *bank, int data);
void kyros_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d);
void sstingry_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d);
void alpha68k_II_map(address_map &map);
void alpha68k_I_map(address_map &map);
void alpha68k_I_s_map(address_map &map);
@ -131,9 +129,9 @@ private:
void tnextspc_sound_portmap(address_map &map);
/* memory pointers */
optional_shared_ptr<uint16_t> m_shared_ram;
required_shared_ptr<uint16_t> m_spriteram;
optional_shared_ptr<uint16_t> m_videoram;
optional_shared_ptr<u16> m_shared_ram;
required_shared_ptr<u16> m_spriteram;
optional_shared_ptr<u16> m_videoram;
/* devices */
required_device<cpu_device> m_audiocpu;
@ -144,13 +142,13 @@ private:
optional_device<ls259_device> m_outlatch;
required_device<generic_latch_8_device> m_soundlatch;
optional_region_ptr<uint8_t> m_color_proms;
optional_region_ptr<u8> m_color_proms;
optional_ioport_array<7> m_in;
optional_memory_bank m_audiobank;
uint8_t m_sound_nmi_mask;
uint8_t m_sound_pa_latch;
u8 m_sound_nmi_mask;
u8 m_sound_pa_latch;
/* video-related */
tilemap_t *m_fix_tilemap;

View File

@ -10,12 +10,12 @@
#include "includes/alpha68k.h"
void alpha68k_state::alpha68k_flipscreen_w( int flip )
void alpha68k_state::flipscreen_w(int flip)
{
m_flipscreen = flip;
}
WRITE8_MEMBER(alpha68k_state::video_bank_w)
void alpha68k_state::video_bank_w(u8 data)
{
if ((m_bank_base ^ data) & 0xf)
{
@ -28,15 +28,13 @@ WRITE8_MEMBER(alpha68k_state::video_bank_w)
TILE_GET_INFO_MEMBER(alpha68k_state::get_tile_info)
{
int tile = m_videoram[2 * tile_index] & 0xff;
int color = m_videoram[2 * tile_index + 1] & 0x0f;
const u32 tile = m_videoram[2 * tile_index] & 0xff;
const u32 color = m_videoram[2 * tile_index + 1] & 0x0f;
tile = tile | (m_bank_base << 8);
SET_TILE_INFO_MEMBER(0, tile, color, 0);
SET_TILE_INFO_MEMBER(0, tile | (m_bank_base << 8), color, 0);
}
WRITE16_MEMBER(alpha68k_state::alpha68k_videoram_w)
void alpha68k_state::videoram_w(offs_t offset, u16 data)
{
/* 8 bit RAM, upper & lower byte writes end up in the same place due to m68k byte smearing */
m_videoram[offset] = data & 0xff;
@ -53,14 +51,12 @@ VIDEO_START_MEMBER(alpha68k_state,alpha68k)
/******************************************************************************/
//AT
void alpha68k_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e )
void alpha68k_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e)
{
int offs, mx, my, color, tile, fx, fy, i;
for (offs = s; offs < e; offs += 0x40)
for (int offs = s; offs < e; offs += 0x40)
{
my = m_spriteram[offs + 3 + (j << 1)];
mx = m_spriteram[offs + 2 + (j << 1)] << 1 | my >> 15;
int my = m_spriteram[offs + 3 + (j << 1)];
int mx = m_spriteram[offs + 2 + (j << 1)] << 1 | my >> 15;
my = -my & 0x1ff;
mx = ((mx + 0x100) & 0x1ff) - 0x100;
if (j == 0 && s == 0x7c0)
@ -72,13 +68,13 @@ void alpha68k_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre
my = 240 - my;
}
for (i = 0; i < 0x40; i += 2)
for (int i = 0; i < 0x40; i += 2)
{
tile = m_spriteram[offs + 1 + i + (0x800 * j) + 0x800];
color = m_spriteram[offs + i + (0x800 * j) + 0x800] & 0x7f;
u16 tile = m_spriteram[offs + 1 + i + (0x800 * j) + 0x800];
const u16 color = m_spriteram[offs + i + (0x800 * j) + 0x800] & 0x7f;
fy = tile & 0x8000;
fx = tile & 0x4000;
int fy = tile & 0x8000;
int fx = tile & 0x4000;
tile &= 0x3fff;
if (m_flipscreen)
@ -104,7 +100,7 @@ void alpha68k_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre
/******************************************************************************/
uint32_t alpha68k_state::screen_update_alpha68k_II(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 alpha68k_state::screen_update_alpha68k_II(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
@ -152,15 +148,13 @@ WRITE_LINE_MEMBER(alpha68k_state::video_control3_w)
/******************************************************************************/
void alpha68k_state::draw_sprites_V( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask )
void alpha68k_state::draw_sprites_V(bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, u16 fx_mask, u16 fy_mask, u16 sprite_mask)
{
int offs, mx, my, color, tile, fx, fy, i;
for (offs = s; offs < e; offs += 0x40)
for (int offs = s; offs < e; offs += 0x40)
{
//AT
my = m_spriteram[offs + 3 + (j << 1)];
mx = m_spriteram[offs + 2 + (j << 1)] << 1 | my >> 15;
int my = m_spriteram[offs + 3 + (j << 1)];
int mx = m_spriteram[offs + 2 + (j << 1)] << 1 | my >> 15;
my = -my & 0x1ff;
mx = ((mx + 0x100) & 0x1ff) - 0x100;
if (j == 0 && s == 0x7c0)
@ -172,13 +166,13 @@ void alpha68k_state::draw_sprites_V( bitmap_ind16 &bitmap, const rectangle &clip
my = 240 - my;
}
for (i = 0; i < 0x40; i += 2)
for (int i = 0; i < 0x40; i += 2)
{
tile = m_spriteram[offs + 1 + i + (0x800 * j) + 0x800];
color = m_spriteram[offs + i + (0x800 * j) + 0x800] & 0xff;
u16 tile = m_spriteram[offs + 1 + i + (0x800 * j) + 0x800];
const u16 color = m_spriteram[offs + i + (0x800 * j) + 0x800] & 0xff;
fx = tile & fx_mask;
fy = tile & fy_mask;
int fx = tile & fx_mask;
int fy = tile & fy_mask;
tile = tile & sprite_mask;
if (tile > 0x4fff)
continue;
@ -204,7 +198,7 @@ void alpha68k_state::draw_sprites_V( bitmap_ind16 &bitmap, const rectangle &clip
}
}
uint32_t alpha68k_state::screen_update_alpha68k_V(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 alpha68k_state::screen_update_alpha68k_V(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
@ -238,7 +232,7 @@ uint32_t alpha68k_state::screen_update_alpha68k_V(screen_device &screen, bitmap_
return 0;
}
uint32_t alpha68k_state::screen_update_alpha68k_V_sb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 alpha68k_state::screen_update_alpha68k_V_sb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
@ -256,23 +250,22 @@ uint32_t alpha68k_state::screen_update_alpha68k_V_sb(screen_device &screen, bitm
/******************************************************************************/
//AT
void alpha68k_state::draw_sprites_I( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d, int yshift )
void alpha68k_state::draw_sprites_I(bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d, int yshift)
{
int data, offs, mx, my, tile, color, fy, i;
gfx_element *gfx = m_gfxdecode->gfx(0);
for (offs = 0; offs < 0x400; offs += 0x20)
for (int offs = 0; offs < 0x400; offs += 0x20)
{
mx = m_spriteram[offs + c];
my = (yshift - (mx >> 8)) & 0xff;
int mx = m_spriteram[offs + c];
int my = (yshift - (mx >> 8)) & 0xff;
mx &= 0xff;
for (i = 0; i < 0x20; i++)
for (int i = 0; i < 0x20; i++)
{
data = m_spriteram[offs + d + i];
tile = data & 0x3fff;
fy = data & 0x4000;
color = m_color_proms[tile << 1 | data >> 15];
const u16 data = m_spriteram[offs + d + i];
const u16 tile = data & 0x3fff;
const bool fy = data & 0x4000;
const u8 color = m_color_proms[tile << 1 | data >> 15];
gfx->transpen(bitmap,cliprect, tile, color, 0, fy, mx, my, 0);
@ -281,7 +274,7 @@ void alpha68k_state::draw_sprites_I( bitmap_ind16 &bitmap, const rectangle &clip
}
}
uint32_t alpha68k_state::screen_update_alpha68k_I(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 alpha68k_state::screen_update_alpha68k_I(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int yshift = (m_microcontroller_id == 0x890a) ? 1 : 0; // The Next Space is 1 pixel off
@ -298,7 +291,7 @@ uint32_t alpha68k_state::screen_update_alpha68k_I(screen_device &screen, bitmap_
void alpha68k_state::kyros_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
const u8 *color_prom = memregion("proms")->base();
/* create a lookup table for the palette */
for (int i = 0; i < 0x100; i++)
@ -315,14 +308,14 @@ void alpha68k_state::kyros_palette(palette_device &palette) const
for (int i = 0; i < 0x100; i++)
{
uint8_t const ctabentry = ((color_prom[i] & 0x0f) << 4) | (color_prom[i + 0x100] & 0x0f);
u8 const ctabentry = ((color_prom[i] & 0x0f) << 4) | (color_prom[i + 0x100] & 0x0f);
palette.set_pen_indirect(i, ctabentry);
}
}
void alpha68k_state::paddlem_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
const u8 *color_prom = memregion("proms")->base();
/* create a lookup table for the palette */
for (int i = 0; i < 0x100; i++)
@ -339,54 +332,52 @@ void alpha68k_state::paddlem_palette(palette_device &palette) const
for (int i = 0; i < 0x400; i++)
{
uint8_t const ctabentry = ((color_prom[i + 0x400] & 0x0f) << 4) | (color_prom[i] & 0x0f);
u8 const ctabentry = ((color_prom[i + 0x400] & 0x0f) << 4) | (color_prom[i] & 0x0f);
palette.set_pen_indirect(i, ctabentry);
}
}
void alpha68k_state::kyros_video_banking(int *bank, int data)
void alpha68k_state::kyros_video_banking(u8 *bank, int data)
{
*bank = (data >> 13 & 4) | (data >> 10 & 3);
}
void alpha68k_state::jongbou_video_banking(int *bank, int data)
void alpha68k_state::jongbou_video_banking(u8 *bank, int data)
{
*bank = (data >> 11 & 4) | (data >> 10 & 3);
}
void alpha68k_state::kyros_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d )
void alpha68k_state::kyros_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d)
{
int offs, mx, my, color, tile, i, bank, fy, fx;
int data;
//AT
for (offs = 0; offs < 0x400; offs += 0x20)
for (int offs = 0; offs < 0x400; offs += 0x20)
{
mx = m_spriteram[offs + c];
my = -(mx >> 8) & 0xff;
int mx = m_spriteram[offs + c];
int my = -(mx >> 8) & 0xff;
mx &= 0xff;
if (m_flipscreen)
my = 249 - my;
for (i = 0; i < 0x20; i++)
for (int i = 0; i < 0x20; i++)
{
data = m_spriteram[offs + d + i];
if (data!=0x20)
const u16 data = m_spriteram[offs + d + i];
if (data != 0x20)
{
color = m_color_proms[(data >> 1 & 0x1000) | (data & 0xffc) | (data >> 14 & 3)];
const u8 color = m_color_proms[(data >> 1 & 0x1000) | (data & 0xffc) | (data >> 14 & 3)];
if (color != 0xff)
{
fy = data & 0x1000;
fx = 0;
int fy = data & 0x1000;
int fx = 0;
if(m_flipscreen)
if (m_flipscreen)
{
if (fy) fy = 0; else fy = 1;
fx = 1;
}
tile = (data >> 3 & 0x400) | (data & 0x3ff);
u8 bank = 0;
const u32 tile = (data >> 3 & 0x400) | (data & 0x3ff);
if (m_game_id == ALPHA68K_KYROS)
kyros_video_banking(&bank, data);
else
@ -404,7 +395,7 @@ void alpha68k_state::kyros_draw_sprites( bitmap_ind16 &bitmap, const rectangle &
}
}
uint32_t alpha68k_state::screen_update_kyros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 alpha68k_state::screen_update_kyros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_palette->set_pen_indirect(0x100, *m_videoram & 0xff);
bitmap.fill(0x100, cliprect); //AT
@ -417,15 +408,13 @@ uint32_t alpha68k_state::screen_update_kyros(screen_device &screen, bitmap_ind16
/******************************************************************************/
void alpha68k_state::sstingry_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d )
void alpha68k_state::sstingry_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d)
{
//AT
int data, offs, mx, my, color, tile, i, bank, fy, fx;
for (offs = 0; offs < 0x400; offs += 0x20)
for (int offs = 0; offs < 0x400; offs += 0x20)
{
mx = m_spriteram[offs + c];
my = -(mx >> 8) & 0xff;
int mx = m_spriteram[offs + c];
int my = -(mx >> 8) & 0xff;
mx &= 0xff;
if (mx > 0xf8)
mx -= 0x100;
@ -433,27 +422,27 @@ void alpha68k_state::sstingry_draw_sprites( bitmap_ind16 &bitmap, const rectangl
if (m_flipscreen)
my = 249 - my;
for (i = 0; i < 0x20; i++)
for (int i = 0; i < 0x20; i++)
{
data = m_spriteram[offs + d + i];
const u16 data = m_spriteram[offs + d + i];
if (data != 0x40)
{
fy = data & 0x1000;
fx = 0;
int fy = data & 0x1000;
int fx = 0;
if(m_flipscreen)
if (m_flipscreen)
{
if (fy) fy = 0; else fy = 1;
fx = 1;
}
color = (data >> 7 & 0x18) | (data >> 13 & 7);
tile = data & 0x3ff;
bank = data >> 10 & 3;
const u16 color = (data >> 7 & 0x18) | (data >> 13 & 7);
const u16 tile = data & 0x3ff;
const u8 bank = data >> 10 & 3;
m_gfxdecode->gfx(bank)->transpen(bitmap,cliprect, tile, color, fx, fy, mx, my, 0);
}
//ZT
if(m_flipscreen)
if (m_flipscreen)
my = (my - 8) & 0xff;
else
my = (my + 8) & 0xff;
@ -461,7 +450,7 @@ void alpha68k_state::sstingry_draw_sprites( bitmap_ind16 &bitmap, const rectangl
}
}
uint32_t alpha68k_state::screen_update_sstingry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 alpha68k_state::screen_update_sstingry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_palette->set_pen_indirect(0x100, *m_videoram & 0xff);
bitmap.fill(0x100, cliprect); //AT