Various cleanups.

This commit is contained in:
Vas Crabb 2021-12-02 03:21:21 +11:00
parent b4bc273afd
commit 759c54b27d
38 changed files with 1556 additions and 20094 deletions

View File

@ -1886,7 +1886,7 @@ msgstr "Grafika: neimplementovaná, "
#: src/frontend/mame/ui/simpleselgame.cpp:363
#: src/frontend/mame/ui/selmenu.cpp:733
msgid "Graphics: Imperfect, "
msgstr "Grafika: nedokonalá, "
msgstr "Grafika: nedostatočná, "
#: src/frontend/mame/ui/simpleselgame.cpp:365
#: src/frontend/mame/ui/selmenu.cpp:735

View File

@ -1349,8 +1349,6 @@ files {
MAME_DIR .. "src/mame/audio/sprint2.cpp",
MAME_DIR .. "src/mame/video/sprint2.cpp",
MAME_DIR .. "src/mame/drivers/sprint4.cpp",
MAME_DIR .. "src/mame/includes/sprint4.h",
MAME_DIR .. "src/mame/video/sprint4.cpp",
MAME_DIR .. "src/mame/audio/sprint4.cpp",
MAME_DIR .. "src/mame/audio/sprint4.h",
MAME_DIR .. "src/mame/drivers/sprint8.cpp",
@ -3261,8 +3259,6 @@ files {
MAME_DIR .. "src/mame/drivers/ddealer.cpp",
MAME_DIR .. "src/mame/drivers/jalmah.cpp",
MAME_DIR .. "src/mame/drivers/macrossp.cpp",
MAME_DIR .. "src/mame/includes/macrossp.h",
MAME_DIR .. "src/mame/video/macrossp.cpp",
MAME_DIR .. "src/mame/drivers/nmk16.cpp",
MAME_DIR .. "src/mame/includes/nmk16.h",
MAME_DIR .. "src/mame/machine/nmk004.cpp",

View File

@ -3946,8 +3946,6 @@ files {
createMESSProjects(_target, _subtarget, "teamconc")
files {
MAME_DIR .. "src/mame/drivers/comquest.cpp",
MAME_DIR .. "src/mame/includes/comquest.h",
MAME_DIR .. "src/mame/video/comquest.cpp",
}
createMESSProjects(_target, _subtarget, "tectoy")

View File

@ -82,12 +82,10 @@ void psxmdec_device::device_start()
save_item( NAME( p_n_cos ) );
}
#ifdef UNUSED_FUNCTION
static inline void psxwriteword( uint32_t *p_n_psxram, uint32_t n_address, uint16_t n_data )
[[maybe_unused]] static inline void psxwriteword( uint32_t *p_n_psxram, uint32_t n_address, uint16_t n_data )
{
*( (uint16_t *)( (uint8_t *)p_n_psxram + WORD_XOR_LE( n_address ) ) ) = n_data;
}
#endif
static inline uint16_t psxreadword( uint32_t *p_n_psxram, uint32_t n_address )
{

View File

@ -5332,19 +5332,19 @@ GAME( 1995, plegendsj, plegends, pwrinst2, metmqstr, cave_state, init_pwrinst2j
// The EEPROM determines the region, program roms are the same between sets
GAME( 1995, sailormn, 0, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Europe)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnu, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22B, USA)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnj, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnj, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Bishoujo Senshi Sailor Moon (Ver. 95/03/22B, Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnk, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Korea)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnt, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Taiwan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnh, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22B, Hong Kong)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnn, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22, Europe)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnnu, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22, USA)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnnj, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22, Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnnj, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Bishoujo Senshi Sailor Moon (Ver. 95/03/22, Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnnk, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22, Korea)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnnt, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22, Taiwan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnnh, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/22, Hong Kong)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormno, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/21, Europe)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnou, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/21, USA)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnoj, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/21, Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnoj, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Bishoujo Senshi Sailor Moon (Ver. 95/03/21, Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnok, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/21, Korea)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnot, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/21, Taiwan)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, sailormnoh, sailormn, sailormn, cave, cave_state, init_sailormn, ROT0, "Gazelle (Banpresto license)", "Pretty Soldier Sailor Moon (Ver. 95/03/21, Hong Kong)", MACHINE_SUPPORTS_SAVE )

View File

@ -42,14 +42,46 @@ icq3250a-d
*/
#include "emu.h"
#include "includes/comquest.h"
#include "cpu/m6805/m68hc05.h"
#include "emupal.h"
#include "screen.h"
#ifdef UNUSED_FUNCTION
namespace {
class comquest_state : public driver_device
{
public:
comquest_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
{ }
void comquest(machine_config &config);
protected:
virtual void machine_reset() override;
private:
required_device<cpu_device> m_maincpu;
uint8_t m_data[128][8];
void *m_timer;
int m_line;
int m_dma_activ;
int m_state;
int m_count;
[[maybe_unused]] uint8_t comquest_read(offs_t offset);
[[maybe_unused]] void comquest_write(offs_t offset, uint8_t data);
uint32_t screen_update_comquest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void comquest_mem(address_map &map);
};
uint8_t comquest_state::comquest_read(offs_t offset)
{
uint8_t data=0;
@ -59,9 +91,22 @@ uint8_t comquest_state::comquest_read(offs_t offset)
void comquest_state::comquest_write(offs_t offset, uint8_t data)
{
logerror("comquest read %.4x %.2x\n",offset,data);
logerror("comquest write %.4x %.2x\n",offset,data);
}
uint32_t comquest_state::screen_update_comquest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int y = 0; y < 128; y++) {
for (int x = 0, j = 0; j < 8; j++, x += 8 * 4) {
#if 0
m_gfxdecode->gfx(0)->opaque(bitmap,0, state->m_data[y][j],0,
0,0,x,y);
#endif
}
}
return 0;
}
void comquest_state::comquest_mem(address_map &map)
{
@ -295,6 +340,8 @@ ROM_START(comquest)
ROM_LOAD("comquest.bin", 0x00000, 0x80000, CRC(2bf4b1a8) SHA1(8d1821cbde37cca2055b18df001438f7d138a8c1))
ROM_END
} // anonymous namespace
/***************************************************************************

View File

@ -523,7 +523,6 @@ ROM_START( crshrace2 )
ROM_END
#ifdef UNUSED_FUNCTION
void crshrace_state::patch_code(uint16_t offset)
{
// A hack which shows 3 player mode in code which is disabled
@ -532,21 +531,20 @@ void crshrace_state::patch_code(uint16_t offset)
RAM[(offset + 2)/2] = 0x4e71;
RAM[(offset + 4)/2] = 0x4e71;
}
#endif
void crshrace_state::init_crshrace()
{
#if CRSHRACE_3P_HACK
#if CRSHRACE_3P_HACK
patch_code(0x003778);
#endif
#endif
}
void crshrace_state::init_crshrace2()
{
#if CRSHRACE_3P_HACK
#if CRSHRACE_3P_HACK
patch_code(0x003796);
#endif
#endif
}

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
// copyright-holders:David Haywood,Paul Priest
/*** DRIVER INFO **************************************************************
Macross Plus (c)1996 Banpresto
@ -285,14 +285,588 @@ Notes:
#include "emu.h"
#include "includes/macrossp.h"
#include "cpu/m68000/m68000.h"
#include "machine/gen_latch.h"
#include "sound/es5506.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
#include <algorithm>
namespace {
//#define DEBUG_KEYS 1
class macrossp_state : public driver_device
{
public:
macrossp_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_scra_videoram(*this, "scra_videoram"),
m_scra_linezoom(*this, "scra_linezoom"),
m_scra_videoregs(*this, "scra_videoregs"),
m_scrb_videoram(*this, "scrb_videoram"),
m_scrb_linezoom(*this, "scrb_linezoom"),
m_scrb_videoregs(*this, "scrb_videoregs"),
m_scrc_videoram(*this, "scrc_videoram"),
m_scrc_linezoom(*this, "scrc_linezoom"),
m_scrc_videoregs(*this, "scrc_videoregs"),
m_text_videoram(*this, "text_videoram"),
m_text_linezoom(*this, "text_linezoom"),
m_text_videoregs(*this, "text_videoregs"),
m_mainram(*this, "mainram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_screen(*this, "screen"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch")
{
}
void quizmoon(machine_config &config);
void macrossp(machine_config &config);
void init_quizmoon();
void init_macrossp();
private:
/* memory pointers */
required_shared_ptr<uint32_t> m_spriteram;
required_shared_ptr<uint32_t> m_scra_videoram;
required_shared_ptr<uint32_t> m_scra_linezoom;
required_shared_ptr<uint32_t> m_scra_videoregs;
required_shared_ptr<uint32_t> m_scrb_videoram;
required_shared_ptr<uint32_t> m_scrb_linezoom;
required_shared_ptr<uint32_t> m_scrb_videoregs;
required_shared_ptr<uint32_t> m_scrc_videoram;
required_shared_ptr<uint32_t> m_scrc_linezoom;
required_shared_ptr<uint32_t> m_scrc_videoregs;
required_shared_ptr<uint32_t> m_text_videoram;
required_shared_ptr<uint32_t> m_text_linezoom;
required_shared_ptr<uint32_t> m_text_videoregs;
required_shared_ptr<uint32_t> m_mainram;
std::unique_ptr<uint32_t[]> m_spriteram_old;
std::unique_ptr<uint32_t[]> m_spriteram_old2;
/* video-related */
tilemap_t *m_scra_tilemap;
tilemap_t *m_scrb_tilemap;
tilemap_t *m_scrc_tilemap;
tilemap_t *m_text_tilemap;
/* misc */
int m_sndpending;
int m_snd_toggle;
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<screen_device> m_screen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_16_device> m_soundlatch;
uint32_t macrossp_soundstatus_r();
void macrossp_soundcmd_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
uint16_t macrossp_soundcmd_r();
void palette_fade_w(uint16_t data);
void macrossp_speedup_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
[[maybe_unused]] void quizmoon_speedup_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void macrossp_scra_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void macrossp_scrb_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void macrossp_scrc_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void macrossp_text_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
TILE_GET_INFO_MEMBER(get_macrossp_scra_tile_info);
TILE_GET_INFO_MEMBER(get_macrossp_scrb_tile_info);
TILE_GET_INFO_MEMBER(get_macrossp_scrc_tile_info);
TILE_GET_INFO_MEMBER(get_macrossp_text_tile_info);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
uint32_t screen_update_macrossp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_macrossp);
void draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void draw_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int linem, int pri);
DECLARE_WRITE_LINE_MEMBER(irqhandler);
void macrossp_map(address_map &map);
void macrossp_es5506_bank1_map(address_map &map);
void macrossp_es5506_bank3_map(address_map &map);
void macrossp_sound_map(address_map &map);
};
/*
Sprite list is drawn backwards, and priorities with backgrounds are not transitive
=== Vid Registers ===
[0] - tiles
0x000003ff - global scrollx
0x00000c00 - color mode
0x0000c000 - priority
0x03ff0000 - global scrolly
0x90000000 - enable? Always 0x9
[1] - ???
0xffff0000 - another scrolly register, mainly used when zooming. unused by emulation
0x0000ffff - another scrollx register, mainly used when zooming. unused by emulation
[2] - zoom params
0xf0000000 - zoom enable (== 0xe, not == 0x2). Presumably one bit for x and y enable
0x01ff0000 - incy (0x40 is 1:1, incx is in lineram. might be more bits)
Interesting test cases (macrossp, quizmoon doesn't use tilemap zoom):
1) Title screen logo zoom
2) Second level, as zoom into end of canyon
3) Second level, as doors open to revels tracks/blue background for boss
4) Boss should go under bridge on level 4 when he first appears
*/
/*** SCR A LAYER ***/
void macrossp_state::macrossp_scra_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_scra_videoram[offset]);
m_scra_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_scra_tile_info)
{
uint32_t attr, tileno, color;
attr = m_scra_videoram[tile_index];
tileno = attr & 0x0000ffff;
switch (m_scra_videoregs[0] & 0x00000c00)
{
case 0x00000800:
color = (attr & 0x000e0000) >> 15;
break;
case 0x00000400:
color = (attr & 0x003e0000) >> 17;
break;
default:
color = machine().rand() & 7;
break;
}
tileinfo.set(1, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
}
/*** SCR B LAYER ***/
void macrossp_state::macrossp_scrb_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_scrb_videoram[offset]);
m_scrb_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_scrb_tile_info)
{
uint32_t attr, tileno, color;
attr = m_scrb_videoram[tile_index];
tileno = attr & 0x0000ffff;
switch (m_scrb_videoregs[0] & 0x00000c00)
{
case 0x00000800:
color = (attr & 0x000e0000) >> 15;
break;
case 0x00000400:
color = (attr & 0x003e0000) >> 17;
break;
default:
color = machine().rand() & 7;
break;
}
tileinfo.set(2, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
}
/*** SCR C LAYER ***/
void macrossp_state::macrossp_scrc_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_scrc_videoram[offset]);
m_scrc_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_scrc_tile_info)
{
uint32_t attr, tileno, color;
attr = m_scrc_videoram[tile_index];
tileno = attr & 0x0000ffff;
switch (m_scrc_videoregs[0] & 0x00000c00)
{
case 0x00000800:
color = (attr & 0x000e0000) >> 15;
break;
case 0x00000400:
color = (attr & 0x003e0000) >> 17;
break;
default:
color = machine().rand() & 7;
break;
}
tileinfo.set(3, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
}
/*** TEXT LAYER ***/
void macrossp_state::macrossp_text_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_text_videoram[offset]);
m_text_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_text_tile_info)
{
uint32_t tileno, colour;
tileno = m_text_videoram[tile_index] & 0x0000ffff;
colour = (m_text_videoram[tile_index] & 0x00fe0000) >> 17;
tileinfo.set(4, tileno, colour, 0);
}
/*** VIDEO START / UPDATE ***/
void macrossp_state::video_start()
{
m_spriteram_old = make_unique_clear<uint32_t[]>(m_spriteram.bytes() / 4);
m_spriteram_old2 = make_unique_clear<uint32_t[]>(m_spriteram.bytes() / 4);
m_text_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(macrossp_state::get_macrossp_text_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_scra_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(macrossp_state::get_macrossp_scra_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_scrb_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(macrossp_state::get_macrossp_scrb_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_scrc_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(macrossp_state::get_macrossp_scrc_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_text_tilemap->set_transparent_pen(0);
m_scra_tilemap->set_transparent_pen(0);
m_scrb_tilemap->set_transparent_pen(0);
m_scrc_tilemap->set_transparent_pen(0);
m_gfxdecode->gfx(0)->set_granularity(64);
m_gfxdecode->gfx(1)->set_granularity(64);
m_gfxdecode->gfx(2)->set_granularity(64);
m_gfxdecode->gfx(3)->set_granularity(64);
save_pointer(NAME(m_spriteram_old), m_spriteram.bytes() / 4);
save_pointer(NAME(m_spriteram_old2), m_spriteram.bytes() / 4);
}
void macrossp_state::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
gfx_element *gfx = m_gfxdecode->gfx(0);
// uint32_t *source = m_spriteram;
uint32_t *source = (m_spriteram_old2.get() + m_spriteram.bytes() / 4) - 3; /* buffers by two frames */
uint32_t *finish = m_spriteram_old2.get();
/* reverse order */
while (source >= finish)
{
/*
--hh hhyy yyyy yyyy CCww wwxx xxxx xxxx
---- --zz zzzz zzzz ---- --ZZ ZZZZ ZZZZ
fFa- pp-- cccc c--- tttt tttt tttt tttt
*/
int wide = (source[0] & 0x00003c00) >> 10;
int high = (source[0] & 0x3c000000) >> 26;
int xpos = (source[0] & 0x000003ff) >> 0;
int ypos = (source[0] & 0x03ff0000) >> 16;
int xzoom = (source[1] & 0x000003ff) >> 0; /* 0x100 is zoom factor of 1.0 */
int yzoom = (source[1] & 0x03ff0000) >> 16;
int col;
int tileno = (source[2] & 0x0000ffff) >> 0;
int flipx = (source[2] & 0x40000000) >> 30;
int flipy = (source[2] & 0x80000000) >> 31;
int alpha = (source[2] & 0x20000000)?0x80:0xff; /* alpha blending enable? */
int loopno = 0;
int xcnt, ycnt;
int xoffset, yoffset;
int pri = (source[2] & 0x0c000000) >> 26;
int primask = 0;
if(pri <= 0) primask |= GFX_PMASK_1;
if(pri <= 1) primask |= GFX_PMASK_2;
if(pri <= 2) primask |= GFX_PMASK_4;
if(pri <= 3) primask |= GFX_PMASK_8;
switch (source[0] & 0x0000c000)
{
case 0x00008000:
col = (source[2] & 0x00380000) >> 17;
break;
case 0x00004000:
col = (source[2] & 0x00f80000) >> 19;
break;
default:
col = machine().rand();
break;
}
if (xpos > 0x1ff) xpos -=0x400;
if (ypos > 0x1ff) ypos -=0x400;
/* loop params */
int ymin = 0;
int ymax = high+1;
int yinc = 1;
int yoffst = 0;
if(flipy) {
yoffst = (high * yzoom * 16);
ymin = high;
ymax = -1;
yinc = -1;
}
int xmin = 0;
int xmax = wide+1;
int xinc = 1;
int xoffst = 0;
if(flipx) {
xoffst = (wide * xzoom * 16);
xmin = wide;
xmax = -1;
xinc = -1;
}
yoffset = yoffst;
for (ycnt = ymin; ycnt != ymax; ycnt += yinc)
{
xoffset = xoffst;
for (xcnt = xmin; xcnt != xmax; xcnt += xinc)
{
int fudged_xzoom = xzoom<<8;
int fudged_yzoom = yzoom<<8;
/* cover seams as don't know exactly how many pixels on target will cover, and can't specify fractional offsets to start */
if(xzoom < 0x100) fudged_xzoom += 0x600;
if(yzoom < 0x100) fudged_yzoom += 0x600;
gfx->prio_zoom_alpha(bitmap,cliprect,tileno+loopno,col,
flipx,flipy,xpos+(xoffset>>8),ypos+(yoffset>>8),
fudged_xzoom,fudged_yzoom,
screen.priority(),primask,0,alpha);
xoffset += ((xzoom*16) * xinc);
loopno++;
}
yoffset += ((yzoom*16) * yinc);
}
source -= 3;
}
}
void macrossp_state::draw_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int line, int pri )
{
tilemap_t *tm;
uint32_t *vr;
uint32_t *lr;
switch (layer)
{
case 0:
default:
tm = m_scra_tilemap;
vr = m_scra_videoregs;
lr = m_scra_linezoom;
break;
case 1:
tm = m_scrb_tilemap;
vr = m_scrb_videoregs;
lr = m_scrb_linezoom;
break;
case 2:
tm = m_scrc_tilemap;
vr = m_scrc_videoregs;
lr = m_scrc_linezoom;
break;
}
if ((vr[2] & 0xf0000000) == 0xe0000000) /* zoom enable (guess, surely wrong) */
{
int startx=0, starty=0, incy, incx;
startx = ((vr[0] & 0x000003ff) << 16 );
starty = ((vr[0] & 0x03ff0000) >> 0);
incy = (vr[2] & 0x01ff0000) >> 6;
if (line&1)
incx = (lr[line/2] & 0x0000ffff)>>0;
else
incx = (lr[line/2] & 0xffff0000)>>16;
incx <<= 10;
/* scroll register contain position relative to the center of the screen, so adjust */
startx -= (368/2) * (incx - 0x10000);
starty -= (240/2) * (incy - 0x10000);
// previous logic, which gives mostly comparable results, vr[1] is now unused
// startx = (vr[1] & 0x0000ffff) << 16;
// starty = (vr[1] & 0xffff0000) >> 0;
// startx -= (368/2) * incx;
// starty -= (240/2) * incy;
tm->draw_roz(screen, bitmap, cliprect,
startx,starty,incx,0,0,incy,
1, /* wraparound */
0, 1<<pri);
}
else
{
tm->set_scrollx(0, ((vr[0] & 0x000003ff) >> 0 ) );
tm->set_scrolly(0, ((vr[0] & 0x03ff0000) >> 16) );
tm->draw(screen, bitmap, cliprect, 0, 1<<pri);
}
}
uint32_t macrossp_state::screen_update_macrossp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int layerpri[3];
int sprites = true;
int backgrounds = true;
rectangle clip;
const rectangle &visarea = screen.visible_area();
clip = visarea;
/* 0 <= layerpri <= 2 */
layerpri[0] = (m_scra_videoregs[0] & 0x0000c000) >> 14;
layerpri[1] = (m_scrb_videoregs[0] & 0x0000c000) >> 14;
layerpri[2] = (m_scrc_videoregs[0] & 0x0000c000) >> 14;
screen.priority().fill(0, cliprect);
bitmap.fill(m_palette->black_pen(), cliprect);
#ifdef DEBUG_KEYS
const input_code lay_keys[8] = {KEYCODE_Q, KEYCODE_W, KEYCODE_E, KEYCODE_R, KEYCODE_T};
bool lay_debug = false;
for (int pri = 0; pri <= 4; pri++)
{
if(machine().input().code_pressed(lay_keys[pri]))
lay_debug = true;
}
if (machine().input().code_pressed(KEYCODE_G))
sprites = false;
if (machine().input().code_pressed(KEYCODE_H))
backgrounds = false;
#endif
for(int pri = 0; pri <= 3; pri++)
{
#ifdef DEBUG_KEYS
if (lay_debug && !machine().input().code_pressed(lay_keys[pri]))
continue;
#endif
if (!backgrounds)
continue;
for (int y=0; y<240; y++)
{
clip.min_y = clip.max_y = y;
/* quizmoon map requires that layer 2 be drawn over layer 3 when same pri */
for(int layer = 2; layer >= 0; layer--)
{
if(layerpri[layer] == pri)
draw_layer(screen, bitmap, clip, layer, y, pri);
}
}
}
#ifdef DEBUG_KEYS
if (!lay_debug && !machine().input().code_pressed(lay_keys[4]))
#endif
m_text_tilemap->draw(screen, bitmap, cliprect, 0, 8);
if (sprites)
draw_sprites(screen, bitmap, cliprect);
#if 0
popmessage ("scra - %08x %08x %08x\nscrb - %08x %08x %08x\nscrc - %08x %08x %08x",
m_scra_videoregs[0]&0xffffffff, // yyyyxxxx
m_scra_videoregs[1], // ??? more scrolling?
m_scra_videoregs[2], // 08 - 0b
m_scrb_videoregs[0]&0xffffffff, // 00 - 03
m_scrb_videoregs[1], // 04 - 07
m_scrb_videoregs[2], // 08 - 0b
m_scrc_videoregs[0]&0xffffffff, // 00 - 03
m_scrc_videoregs[1], // 04 - 07
m_scrc_videoregs[2]);// 08 - 0b
#endif
return 0;
}
WRITE_LINE_MEMBER(macrossp_state::screen_vblank_macrossp)
{
// rising edge
if (state)
{
/* looks like sprites are *two* frames ahead, like nmk16 */
memcpy(m_spriteram_old2.get(), m_spriteram_old.get(), m_spriteram.bytes());
memcpy(m_spriteram_old.get(), m_spriteram, m_spriteram.bytes());
}
}
/*** VARIOUS READ / WRITE HANDLERS *******************************************/
@ -709,13 +1283,11 @@ PC :00018110 018110: beq 18104
if (m_maincpu->pc() == 0x001810A) m_maincpu->spin_until_interrupt();
}
#ifdef UNUSED_FUNCTION
void macrossp_state::quizmoon_speedup_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_mainram[0x00020 / 4]);
if (m_maincpu->pc() == 0x1cc) m_maincpu->spin_until_interrupt();
}
#endif
void macrossp_state::init_macrossp()
{
@ -724,10 +1296,13 @@ void macrossp_state::init_macrossp()
void macrossp_state::init_quizmoon()
{
#ifdef UNUSED_FUNCTION
#if 0
m_maincpu->space(AS_PROGRAM).install_write_handler(0xf00020, 0xf00023, write32s_delegate(*this, FUNC(macrossp_state::quizmoon_speedup_w)));
#endif
}
} // anonymous namespace
GAME( 1996, macrossp, 0, macrossp, macrossp, macrossp_state, init_macrossp, ROT270, "MOSS / Banpresto", "Macross Plus", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
GAME( 1997, quizmoon, 0, quizmoon, quizmoon, macrossp_state, init_quizmoon, ROT0, "Banpresto", "Quiz Bisyoujo Senshi Sailor Moon - Chiryoku Tairyoku Toki no Un", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
GAME( 1997, quizmoon, 0, quizmoon, quizmoon, macrossp_state, init_quizmoon, ROT0, "Banpresto", "Quiz Bishoujo Senshi Sailor Moon - Chiryoku Tairyoku Toki no Un", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )

View File

@ -77,16 +77,20 @@ ROMS: All ROM labels say only "PROM" and a number.
*/
#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/74259.h"
#include "machine/gen_latch.h"
#include "sound/ay8910.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
class pturn_state : public driver_device
{
public:
@ -126,6 +130,8 @@ private:
bool m_nmi_sub;
void videoram_w(offs_t offset, uint8_t data);
[[maybe_unused]] uint8_t protection_r();
[[maybe_unused]] uint8_t protection2_r();
DECLARE_WRITE_LINE_MEMBER(nmi_main_enable_w);
void nmi_sub_enable_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
@ -239,7 +245,6 @@ uint32_t pturn_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
return 0;
}
#ifdef UNUSED_FUNCTION
uint8_t pturn_state::protection_r()
{
return 0x66;
@ -249,7 +254,6 @@ uint8_t pturn_state::protection2_r()
{
return 0xfe;
}
#endif
void pturn_state::videoram_w(offs_t offset, uint8_t data)
{
@ -605,4 +609,6 @@ void pturn_state::init_pturn()
*/
}
} // anonymous namespace
GAME( 1984, pturn, 0, pturn, pturn, pturn_state, init_pturn, ROT90, "Jaleco", "Parallel Turn", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE )

View File

@ -7,12 +7,20 @@ Atari Sprint 4 driver
***************************************************************************/
#include "emu.h"
#include "includes/sprint4.h"
#include "audio/sprint4.h"
#include "cpu/m6502/m6502.h"
#include "machine/74259.h"
#include "machine/watchdog.h"
#include "sound/discrete.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
#define MASTER_CLOCK 12096000
@ -21,6 +29,93 @@ Atari Sprint 4 driver
#define PIXEL_CLOCK (MASTER_CLOCK / 2)
class sprint4_state : public driver_device
{
public:
enum
{
TIMER_NMI
};
sprint4_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_watchdog(*this, "watchdog"),
m_discrete(*this, "discrete"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_io_wheel(*this, "WHEEL%u", 1U),
m_io_lever(*this, "LEVER%u", 1U),
m_io_in0(*this, "IN0"),
m_io_analog(*this, "ANALOG"),
m_io_coin(*this, "COIN"),
m_io_collision(*this, "COLLISION"),
m_io_dip(*this, "DIP")
{ }
void sprint4(machine_config &config);
template <int N> DECLARE_READ_LINE_MEMBER(lever_r);
template <int N> DECLARE_READ_LINE_MEMBER(wheel_r);
template <int N> DECLARE_READ_LINE_MEMBER(collision_flipflop_r);
private:
uint8_t wram_r(offs_t offset);
uint8_t analog_r(offs_t offset);
uint8_t coin_r(offs_t offset);
uint8_t collision_r(offs_t offset);
uint8_t options_r(offs_t offset);
void wram_w(offs_t offset, uint8_t data);
void collision_reset_w(offs_t offset, uint8_t data);
void da_latch_w(uint8_t data);
[[maybe_unused]] void lockout_w(offs_t offset, uint8_t data);
void video_ram_w(offs_t offset, uint8_t data);
void bang_w(uint8_t data);
void attract_w(uint8_t data);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
void sprint4_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
TIMER_CALLBACK_MEMBER(nmi_callback);
void sprint4_cpu_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<watchdog_timer_device> m_watchdog;
required_device<discrete_sound_device> m_discrete;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_videoram;
required_ioport_array<4> m_io_wheel;
required_ioport_array<4> m_io_lever;
required_ioport m_io_in0;
required_ioport m_io_analog;
required_ioport m_io_coin;
required_ioport m_io_collision;
required_ioport m_io_dip;
int m_da_latch;
int m_steer_FF1[4];
int m_steer_FF2[4];
int m_gear[4];
uint8_t m_last_wheel[4];
int m_collision[4];
tilemap_t* m_playfield;
bitmap_ind16 m_helper;
emu_timer *m_nmi_timer;
};
template <int N>
READ_LINE_MEMBER(sprint4_state::lever_r)
@ -62,26 +157,12 @@ TIMER_CALLBACK_MEMBER(sprint4_state::nmi_callback)
/* MAME updates controls only once per frame but the game checks them on every NMI */
uint8_t wheel[4] =
{
static_cast<uint8_t>(ioport("WHEEL1")->read()),
static_cast<uint8_t>(ioport("WHEEL2")->read()),
static_cast<uint8_t>(ioport("WHEEL3")->read()),
static_cast<uint8_t>(ioport("WHEEL4")->read())
};
uint8_t lever[4] =
{
static_cast<uint8_t>(ioport("LEVER1")->read()),
static_cast<uint8_t>(ioport("LEVER2")->read()),
static_cast<uint8_t>(ioport("LEVER3")->read()),
static_cast<uint8_t>(ioport("LEVER4")->read())
};
/* emulation of steering wheels isn't very accurate */
for (int i = 0; i < 4; i++)
{
signed char delta = wheel[i] - m_last_wheel[i];
uint8_t wheel = uint8_t(m_io_wheel[i]->read());
signed char delta = wheel - m_last_wheel[i];
if (delta < 0)
{
@ -92,14 +173,15 @@ TIMER_CALLBACK_MEMBER(sprint4_state::nmi_callback)
m_steer_FF2[i] = 1;
}
m_steer_FF1[i] = (wheel[i] >> 4) & 1;
m_steer_FF1[i] = (wheel >> 4) & 1;
if (lever[i] & 1) { m_gear[i] = 1; }
if (lever[i] & 2) { m_gear[i] = 2; }
if (lever[i] & 4) { m_gear[i] = 3; }
if (lever[i] & 8) { m_gear[i] = 4; }
uint8_t lever = uint8_t(m_io_lever[i]->read());
if (lever & 1) m_gear[i] = 1;
if (lever & 2) m_gear[i] = 2;
if (lever & 4) m_gear[i] = 3;
if (lever & 8) m_gear[i] = 4;
m_last_wheel[i] = wheel[i];
m_last_wheel[i] = wheel;
}
scanline += 64;
@ -111,9 +193,9 @@ TIMER_CALLBACK_MEMBER(sprint4_state::nmi_callback)
/* NMI and watchdog are disabled during service mode */
m_watchdog->watchdog_enable(ioport("IN0")->read() & 0x40);
m_watchdog->watchdog_enable(m_io_in0->read() & 0x40);
if (ioport("IN0")->read() & 0x40)
if (m_io_in0->read() & 0x40)
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
m_nmi_timer->adjust(m_screen->time_until_pos(scanline), scanline);
@ -157,21 +239,21 @@ uint8_t sprint4_state::wram_r(offs_t offset)
uint8_t sprint4_state::analog_r(offs_t offset)
{
return (ioport("ANALOG")->read() << (~offset & 7)) & 0x80;
return (m_io_analog->read() << (~offset & 7)) & 0x80;
}
uint8_t sprint4_state::coin_r(offs_t offset)
{
return (ioport("COIN")->read() << (~offset & 7)) & 0x80;
return (m_io_coin->read() << (~offset & 7)) & 0x80;
}
uint8_t sprint4_state::collision_r(offs_t offset)
{
return (ioport("COLLISION")->read() << (~offset & 7)) & 0x80;
return (m_io_collision->read() << (~offset & 7)) & 0x80;
}
uint8_t sprint4_state::options_r(offs_t offset)
{
return (ioport("DIP")->read() >> (2 * (offset & 3))) & 3;
return (m_io_dip->read() >> (2 * (offset & 3))) & 3;
}
@ -194,12 +276,10 @@ void sprint4_state::da_latch_w(uint8_t data)
#ifdef UNUSED_FUNCTION
void sprint4_state::lockout_w(offs_t offset, uint8_t data)
{
machine().bookkeeping().coin_lockout_global_w(~offset & 1);
}
#endif
void sprint4_state::bang_w(uint8_t data)
@ -214,6 +294,132 @@ void sprint4_state::attract_w(uint8_t data)
}
void sprint4_state::sprint4_palette(palette_device &palette) const
{
palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00)); // black
palette.set_indirect_color(1, rgb_t(0xfc, 0xdf, 0x80)); // peach
palette.set_indirect_color(2, rgb_t(0xf0, 0x00, 0xf0)); // violet
palette.set_indirect_color(3, rgb_t(0x00, 0xf0, 0x0f)); // green
palette.set_indirect_color(4, rgb_t(0x30, 0x4f, 0xff)); // blue
palette.set_indirect_color(5, rgb_t(0xff, 0xff, 0xff)); // white
palette.set_pen_indirect(0, 0);
palette.set_pen_indirect(2, 0);
palette.set_pen_indirect(4, 0);
palette.set_pen_indirect(6, 0);
palette.set_pen_indirect(8, 0);
palette.set_pen_indirect(1, 1);
palette.set_pen_indirect(3, 2);
palette.set_pen_indirect(5, 3);
palette.set_pen_indirect(7, 4);
palette.set_pen_indirect(9, 5);
}
TILE_GET_INFO_MEMBER(sprint4_state::tile_info)
{
uint8_t code = m_videoram[tile_index];
if ((code & 0x30) == 0x30)
tileinfo.set(0, code & ~0x40, (code >> 6) ^ 3, 0);
else
tileinfo.set(0, code, 4, 0);
}
void sprint4_state::video_start()
{
m_screen->register_screen_bitmap(m_helper);
m_playfield = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sprint4_state::tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}
uint32_t sprint4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_playfield->draw(screen, bitmap, cliprect, 0, 0);
for (int i = 0; i < 4; i++)
{
int bank = 0;
uint8_t horz = m_videoram[0x390 + 2 * i + 0];
uint8_t attr = m_videoram[0x390 + 2 * i + 1];
uint8_t vert = m_videoram[0x398 + 2 * i + 0];
uint8_t code = m_videoram[0x398 + 2 * i + 1];
if (i & 1)
bank = 32;
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
(code >> 3) | bank,
(attr & 0x80) ? 4 : i,
0, 0,
horz - 15,
vert - 15, 0);
}
return 0;
}
WRITE_LINE_MEMBER(sprint4_state::screen_vblank)
{
// rising edge
if (state)
{
/* check for sprite-playfield collisions */
for (int i = 0; i < 4; i++)
{
int bank = 0;
uint8_t horz = m_videoram[0x390 + 2 * i + 0];
uint8_t vert = m_videoram[0x398 + 2 * i + 0];
uint8_t code = m_videoram[0x398 + 2 * i + 1];
rectangle rect(
horz - 15,
horz - 15 + m_gfxdecode->gfx(1)->width() - 1,
vert - 15,
vert - 15 + m_gfxdecode->gfx(1)->height() - 1);
rect &= m_screen->visible_area();
m_playfield->draw(*m_screen, m_helper, rect, 0, 0);
if (i & 1)
bank = 32;
m_gfxdecode->gfx(1)->transpen(m_helper,rect,
(code >> 3) | bank,
4,
0, 0,
horz - 15,
vert - 15, 1);
for (int y = rect.top(); y <= rect.bottom(); y++)
for (int x = rect.left(); x <= rect.right(); x++)
if (m_palette->pen_indirect(m_helper.pix(y, x)) != 0)
m_collision[i] = 1;
}
/* update sound status */
m_discrete->write(SPRINT4_MOTOR_DATA_1, m_videoram[0x391] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_2, m_videoram[0x393] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_3, m_videoram[0x395] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_4, m_videoram[0x397] & 15);
}
}
void sprint4_state::video_ram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_playfield->mark_tile_dirty(offset);
}
void sprint4_state::sprint4_cpu_map(address_map &map)
{
@ -453,6 +659,8 @@ ROM_START( sprint4a )
ROM_LOAD( "30024-01.p8", 0x0000, 0x0200, CRC(e71d2e22) SHA1(434c3a8237468604cce7feb40e6061d2670013b3) ) /* SYNC */
ROM_END
} // anonymous namespace
GAME( 1977, sprint4, 0, sprint4, sprint4, sprint4_state, empty_init, ROT180, "Atari", "Sprint 4 (set 1)", MACHINE_SUPPORTS_SAVE ) /* large cars */
GAME( 1977, sprint4a, sprint4, sprint4, sprint4, sprint4_state, empty_init, ROT180, "Atari", "Sprint 4 (set 2)", MACHINE_SUPPORTS_SAVE ) /* small cars */

View File

@ -1,35 +0,0 @@
// license:GPL-2.0+
// copyright-holders:Peter Trauner
/*****************************************************************************
*
* includes/comquest.h
*
****************************************************************************/
#ifndef MAME_INCLUDES_COMQUEST_H
#define MAME_INCLUDES_COMQUEST_H
class comquest_state : public driver_device
{
public:
comquest_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
{ }
uint8_t m_data[128][8];
void *m_timer;
int m_line;
int m_dma_activ;
int m_state;
int m_count;
virtual void machine_reset() override;
virtual void video_start() override;
uint32_t screen_update_comquest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
void comquest(machine_config &config);
void comquest_mem(address_map &map);
};
#endif // MAME_INCLUDES_COMQUEST_H

View File

@ -10,9 +10,11 @@
#include "video/bufsprite.h"
#include "video/vsystem_spr.h"
#include "video/k053936.h"
#include "emupal.h"
#include "tilemap.h"
class crshrace_state : public driver_device
{
public:
@ -76,6 +78,8 @@ private:
void main_map(address_map &map);
void sound_io_map(address_map &map);
void sound_map(address_map &map);
[[maybe_unused]] void patch_code(uint16_t offset);
};
#endif // MAME_INCLUDES_CRSHRACE_H

View File

@ -1,122 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
/*************************************************************************
Macross Plus
*************************************************************************/
#ifndef MAME_INCLUDES_MACROSSP_H
#define MAME_INCLUDES_MACROSSP_H
#pragma once
#include "machine/gen_latch.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
class macrossp_state : public driver_device
{
public:
macrossp_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_scra_videoram(*this, "scra_videoram"),
m_scra_linezoom(*this, "scra_linezoom"),
m_scra_videoregs(*this, "scra_videoregs"),
m_scrb_videoram(*this, "scrb_videoram"),
m_scrb_linezoom(*this, "scrb_linezoom"),
m_scrb_videoregs(*this, "scrb_videoregs"),
m_scrc_videoram(*this, "scrc_videoram"),
m_scrc_linezoom(*this, "scrc_linezoom"),
m_scrc_videoregs(*this, "scrc_videoregs"),
m_text_videoram(*this, "text_videoram"),
m_text_linezoom(*this, "text_linezoom"),
m_text_videoregs(*this, "text_videoregs"),
m_mainram(*this, "mainram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_screen(*this, "screen"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch")
{
}
void quizmoon(machine_config &config);
void macrossp(machine_config &config);
void init_quizmoon();
void init_macrossp();
private:
/* memory pointers */
required_shared_ptr<uint32_t> m_spriteram;
required_shared_ptr<uint32_t> m_scra_videoram;
required_shared_ptr<uint32_t> m_scra_linezoom;
required_shared_ptr<uint32_t> m_scra_videoregs;
required_shared_ptr<uint32_t> m_scrb_videoram;
required_shared_ptr<uint32_t> m_scrb_linezoom;
required_shared_ptr<uint32_t> m_scrb_videoregs;
required_shared_ptr<uint32_t> m_scrc_videoram;
required_shared_ptr<uint32_t> m_scrc_linezoom;
required_shared_ptr<uint32_t> m_scrc_videoregs;
required_shared_ptr<uint32_t> m_text_videoram;
required_shared_ptr<uint32_t> m_text_linezoom;
required_shared_ptr<uint32_t> m_text_videoregs;
required_shared_ptr<uint32_t> m_mainram;
std::unique_ptr<uint32_t[]> m_spriteram_old;
std::unique_ptr<uint32_t[]> m_spriteram_old2;
/* video-related */
tilemap_t *m_scra_tilemap;
tilemap_t *m_scrb_tilemap;
tilemap_t *m_scrc_tilemap;
tilemap_t *m_text_tilemap;
/* misc */
int m_sndpending;
int m_snd_toggle;
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<screen_device> m_screen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_16_device> m_soundlatch;
uint32_t macrossp_soundstatus_r();
void macrossp_soundcmd_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
uint16_t macrossp_soundcmd_r();
void palette_fade_w(uint16_t data);
void macrossp_speedup_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void macrossp_scra_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void macrossp_scrb_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void macrossp_scrc_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
void macrossp_text_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
TILE_GET_INFO_MEMBER(get_macrossp_scra_tile_info);
TILE_GET_INFO_MEMBER(get_macrossp_scrb_tile_info);
TILE_GET_INFO_MEMBER(get_macrossp_scrc_tile_info);
TILE_GET_INFO_MEMBER(get_macrossp_text_tile_info);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
uint32_t screen_update_macrossp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_macrossp);
void draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void draw_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int linem, int pri);
DECLARE_WRITE_LINE_MEMBER(irqhandler);
void macrossp_map(address_map &map);
void macrossp_es5506_bank1_map(address_map &map);
void macrossp_es5506_bank3_map(address_map &map);
void macrossp_sound_map(address_map &map);
};
#endif // MAME_INCLUDES_MACROSSP_H

View File

@ -1,85 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Stefan Jokisch
#ifndef MAME_INCLUDES_SPRINT4_H
#define MAME_INCLUDES_SPRINT4_H
#pragma once
#include "machine/watchdog.h"
#include "sound/discrete.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
class sprint4_state : public driver_device
{
public:
enum
{
TIMER_NMI
};
sprint4_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_watchdog(*this, "watchdog"),
m_discrete(*this, "discrete"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram")
{ }
void sprint4(machine_config &config);
template <int N> DECLARE_READ_LINE_MEMBER(lever_r);
template <int N> DECLARE_READ_LINE_MEMBER(wheel_r);
template <int N> DECLARE_READ_LINE_MEMBER(collision_flipflop_r);
private:
uint8_t wram_r(offs_t offset);
uint8_t analog_r(offs_t offset);
uint8_t coin_r(offs_t offset);
uint8_t collision_r(offs_t offset);
uint8_t options_r(offs_t offset);
void wram_w(offs_t offset, uint8_t data);
void collision_reset_w(offs_t offset, uint8_t data);
void da_latch_w(uint8_t data);
void video_ram_w(offs_t offset, uint8_t data);
void bang_w(uint8_t data);
void attract_w(uint8_t data);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
void sprint4_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
TIMER_CALLBACK_MEMBER(nmi_callback);
void sprint4_cpu_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<watchdog_timer_device> m_watchdog;
required_device<discrete_sound_device> m_discrete;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_videoram;
int m_da_latch;
int m_steer_FF1[4];
int m_steer_FF2[4];
int m_gear[4];
uint8_t m_last_wheel[4];
int m_collision[4];
tilemap_t* m_playfield;
bitmap_ind16 m_helper;
emu_timer *m_nmi_timer;
};
#endif // MAME_INCLUDES_SPRINT4_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -796,9 +796,9 @@ uint8_t mpu4_state::pia_ic4_portb_r()
{
m_ic4_input_b |= 0x02; //Pulse the overcurrent line with every read to show the CPU each lamp has lit
}
#ifdef UNUSED_FUNCTION
#if 0
if ( lamp_undercurrent ) m_ic4_input_b |= 0x01;
#endif
#endif
LOG_IC3(("%s: IC4 PIA Read of Port B %x\n",machine().describe_context(),m_ic4_input_b));
return m_ic4_input_b;

View File

@ -1,24 +0,0 @@
// license:GPL-2.0+
// copyright-holders:Peter Trauner
#include "emu.h"
#include "includes/comquest.h"
void comquest_state::video_start()
{
}
uint32_t comquest_state::screen_update_comquest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int x, y, j;
for (y=0; y<128;y++) {
for (x=0, j=0; j<8;j++,x+=8*4) {
#if 0
m_gfxdecode->gfx(0)->opaque(bitmap,0, state->m_data[y][j],0,
0,0,x,y);
#endif
}
}
return 0;
}

View File

@ -209,7 +209,7 @@ void popnrun_state::popnrun_draw_sprites(screen_device &screen, bitmap_ind16 &bi
//if ((m_spriteram[offs+3] & 0xff00)!=0xf00) continue;
pri = 0;
#ifdef UNUSED_FUNCTION
#if 0
switch (m_spriteram[offs+2]&0xc000) {
default:
case 0xc000: pri=0; break; /* Unknown */
@ -217,28 +217,28 @@ void popnrun_state::popnrun_draw_sprites(screen_device &screen, bitmap_ind16 &bi
case 0x4000: pri=0xf0; break; /* Under top playfield */
case 0x0000: pri=0xf0|0xcc; break; /* Under middle playfield */
}
#endif
#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;
#ifdef UNUSED_FUNCTION
#if 0
if (fy) fy=0; else fy=1;
if (m_spriteram[offs+2]&0x100) x=0-(0xff-x);
#endif
#endif
color = (m_spriteram[offs+0]>>12)&0x7;
sprite = m_spriteram[offs+0]&0xfff;
#ifdef UNUSED_FUNCTION
#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
#endif
m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect,
sprite,

View File

@ -1,469 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood,Paul Priest
/* video/macrossp.c */
#include "emu.h"
#include "includes/macrossp.h"
//#define DEBUG_KEYS 1
/*
Sprite list is drawn backwards, and priorities with backgrounds are not transitive
=== Vid Registers ===
[0] - tiles
0x000003ff - global scrollx
0x00000c00 - color mode
0x0000c000 - priority
0x03ff0000 - global scrolly
0x90000000 - enable? Always 0x9
[1] - ???
0xffff0000 - another scrolly register, mainly used when zooming. unused by emulation
0x0000ffff - another scrollx register, mainly used when zooming. unused by emulation
[2] - zoom params
0xf0000000 - zoom enable (== 0xe, not == 0x2). Presumably one bit for x and y enable
0x01ff0000 - incy (0x40 is 1:1, incx is in lineram. might be more bits)
Interesting test cases (macrossp, quizmoon doesn't use tilemap zoom):
1) Title screen logo zoom
2) Second level, as zoom into end of canyon
3) Second level, as doors open to revels tracks/blue background for boss
4) Boss should go under bridge on level 4 when he first appears
*/
/*** SCR A LAYER ***/
void macrossp_state::macrossp_scra_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_scra_videoram[offset]);
m_scra_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_scra_tile_info)
{
uint32_t attr, tileno, color;
attr = m_scra_videoram[tile_index];
tileno = attr & 0x0000ffff;
switch (m_scra_videoregs[0] & 0x00000c00)
{
case 0x00000800:
color = (attr & 0x000e0000) >> 15;
break;
case 0x00000400:
color = (attr & 0x003e0000) >> 17;
break;
default:
color = machine().rand() & 7;
break;
}
tileinfo.set(1, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
}
/*** SCR B LAYER ***/
void macrossp_state::macrossp_scrb_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_scrb_videoram[offset]);
m_scrb_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_scrb_tile_info)
{
uint32_t attr, tileno, color;
attr = m_scrb_videoram[tile_index];
tileno = attr & 0x0000ffff;
switch (m_scrb_videoregs[0] & 0x00000c00)
{
case 0x00000800:
color = (attr & 0x000e0000) >> 15;
break;
case 0x00000400:
color = (attr & 0x003e0000) >> 17;
break;
default:
color = machine().rand() & 7;
break;
}
tileinfo.set(2, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
}
/*** SCR C LAYER ***/
void macrossp_state::macrossp_scrc_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_scrc_videoram[offset]);
m_scrc_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_scrc_tile_info)
{
uint32_t attr, tileno, color;
attr = m_scrc_videoram[tile_index];
tileno = attr & 0x0000ffff;
switch (m_scrc_videoregs[0] & 0x00000c00)
{
case 0x00000800:
color = (attr & 0x000e0000) >> 15;
break;
case 0x00000400:
color = (attr & 0x003e0000) >> 17;
break;
default:
color = machine().rand() & 7;
break;
}
tileinfo.set(3, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
}
/*** TEXT LAYER ***/
void macrossp_state::macrossp_text_videoram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_text_videoram[offset]);
m_text_tilemap->mark_tile_dirty(offset);
}
TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_text_tile_info)
{
uint32_t tileno, colour;
tileno = m_text_videoram[tile_index] & 0x0000ffff;
colour = (m_text_videoram[tile_index] & 0x00fe0000) >> 17;
tileinfo.set(4, tileno, colour, 0);
}
/*** VIDEO START / UPDATE ***/
void macrossp_state::video_start()
{
m_spriteram_old = make_unique_clear<uint32_t[]>(m_spriteram.bytes() / 4);
m_spriteram_old2 = make_unique_clear<uint32_t[]>(m_spriteram.bytes() / 4);
m_text_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(macrossp_state::get_macrossp_text_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_scra_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(macrossp_state::get_macrossp_scra_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_scrb_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(macrossp_state::get_macrossp_scrb_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_scrc_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(macrossp_state::get_macrossp_scrc_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_text_tilemap->set_transparent_pen(0);
m_scra_tilemap->set_transparent_pen(0);
m_scrb_tilemap->set_transparent_pen(0);
m_scrc_tilemap->set_transparent_pen(0);
m_gfxdecode->gfx(0)->set_granularity(64);
m_gfxdecode->gfx(1)->set_granularity(64);
m_gfxdecode->gfx(2)->set_granularity(64);
m_gfxdecode->gfx(3)->set_granularity(64);
save_pointer(NAME(m_spriteram_old), m_spriteram.bytes() / 4);
save_pointer(NAME(m_spriteram_old2), m_spriteram.bytes() / 4);
}
void macrossp_state::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
gfx_element *gfx = m_gfxdecode->gfx(0);
// uint32_t *source = m_spriteram;
uint32_t *source = (m_spriteram_old2.get() + m_spriteram.bytes() / 4) - 3; /* buffers by two frames */
uint32_t *finish = m_spriteram_old2.get();
/* reverse order */
while (source >= finish)
{
/*
--hh hhyy yyyy yyyy CCww wwxx xxxx xxxx
---- --zz zzzz zzzz ---- --ZZ ZZZZ ZZZZ
fFa- pp-- cccc c--- tttt tttt tttt tttt
*/
int wide = (source[0] & 0x00003c00) >> 10;
int high = (source[0] & 0x3c000000) >> 26;
int xpos = (source[0] & 0x000003ff) >> 0;
int ypos = (source[0] & 0x03ff0000) >> 16;
int xzoom = (source[1] & 0x000003ff) >> 0; /* 0x100 is zoom factor of 1.0 */
int yzoom = (source[1] & 0x03ff0000) >> 16;
int col;
int tileno = (source[2] & 0x0000ffff) >> 0;
int flipx = (source[2] & 0x40000000) >> 30;
int flipy = (source[2] & 0x80000000) >> 31;
int alpha = (source[2] & 0x20000000)?0x80:0xff; /* alpha blending enable? */
int loopno = 0;
int xcnt, ycnt;
int xoffset, yoffset;
int pri = (source[2] & 0x0c000000) >> 26;
int primask = 0;
if(pri <= 0) primask |= GFX_PMASK_1;
if(pri <= 1) primask |= GFX_PMASK_2;
if(pri <= 2) primask |= GFX_PMASK_4;
if(pri <= 3) primask |= GFX_PMASK_8;
switch (source[0] & 0x0000c000)
{
case 0x00008000:
col = (source[2] & 0x00380000) >> 17;
break;
case 0x00004000:
col = (source[2] & 0x00f80000) >> 19;
break;
default:
col = machine().rand();
break;
}
if (xpos > 0x1ff) xpos -=0x400;
if (ypos > 0x1ff) ypos -=0x400;
/* loop params */
int ymin = 0;
int ymax = high+1;
int yinc = 1;
int yoffst = 0;
if(flipy) {
yoffst = (high * yzoom * 16);
ymin = high;
ymax = -1;
yinc = -1;
}
int xmin = 0;
int xmax = wide+1;
int xinc = 1;
int xoffst = 0;
if(flipx) {
xoffst = (wide * xzoom * 16);
xmin = wide;
xmax = -1;
xinc = -1;
}
yoffset = yoffst;
for (ycnt = ymin; ycnt != ymax; ycnt += yinc)
{
xoffset = xoffst;
for (xcnt = xmin; xcnt != xmax; xcnt += xinc)
{
int fudged_xzoom = xzoom<<8;
int fudged_yzoom = yzoom<<8;
/* cover seams as don't know exactly how many pixels on target will cover, and can't specify fractional offsets to start */
if(xzoom < 0x100) fudged_xzoom += 0x600;
if(yzoom < 0x100) fudged_yzoom += 0x600;
gfx->prio_zoom_alpha(bitmap,cliprect,tileno+loopno,col,
flipx,flipy,xpos+(xoffset>>8),ypos+(yoffset>>8),
fudged_xzoom,fudged_yzoom,
screen.priority(),primask,0,alpha);
xoffset += ((xzoom*16) * xinc);
loopno++;
}
yoffset += ((yzoom*16) * yinc);
}
source -= 3;
}
}
void macrossp_state::draw_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int line, int pri )
{
tilemap_t *tm;
uint32_t *vr;
uint32_t *lr;
switch (layer)
{
case 0:
default:
tm = m_scra_tilemap;
vr = m_scra_videoregs;
lr = m_scra_linezoom;
break;
case 1:
tm = m_scrb_tilemap;
vr = m_scrb_videoregs;
lr = m_scrb_linezoom;
break;
case 2:
tm = m_scrc_tilemap;
vr = m_scrc_videoregs;
lr = m_scrc_linezoom;
break;
}
if ((vr[2] & 0xf0000000) == 0xe0000000) /* zoom enable (guess, surely wrong) */
{
int startx=0, starty=0, incy, incx;
startx = ((vr[0] & 0x000003ff) << 16 );
starty = ((vr[0] & 0x03ff0000) >> 0);
incy = (vr[2] & 0x01ff0000) >> 6;
if (line&1)
incx = (lr[line/2] & 0x0000ffff)>>0;
else
incx = (lr[line/2] & 0xffff0000)>>16;
incx <<= 10;
/* scroll register contain position relative to the center of the screen, so adjust */
startx -= (368/2) * (incx - 0x10000);
starty -= (240/2) * (incy - 0x10000);
// previous logic, which gives mostly comparable results, vr[1] is now unused
// startx = (vr[1] & 0x0000ffff) << 16;
// starty = (vr[1] & 0xffff0000) >> 0;
// startx -= (368/2) * incx;
// starty -= (240/2) * incy;
tm->draw_roz(screen, bitmap, cliprect,
startx,starty,incx,0,0,incy,
1, /* wraparound */
0, 1<<pri);
}
else
{
tm->set_scrollx(0, ((vr[0] & 0x000003ff) >> 0 ) );
tm->set_scrolly(0, ((vr[0] & 0x03ff0000) >> 16) );
tm->draw(screen, bitmap, cliprect, 0, 1<<pri);
}
}
uint32_t macrossp_state::screen_update_macrossp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int layerpri[3];
int sprites = true;
int backgrounds = true;
rectangle clip;
const rectangle &visarea = screen.visible_area();
clip = visarea;
/* 0 <= layerpri <= 2 */
layerpri[0] = (m_scra_videoregs[0] & 0x0000c000) >> 14;
layerpri[1] = (m_scrb_videoregs[0] & 0x0000c000) >> 14;
layerpri[2] = (m_scrc_videoregs[0] & 0x0000c000) >> 14;
screen.priority().fill(0, cliprect);
bitmap.fill(m_palette->black_pen(), cliprect);
#ifdef DEBUG_KEYS
const input_code lay_keys[8] = {KEYCODE_Q, KEYCODE_W, KEYCODE_E, KEYCODE_R, KEYCODE_T};
bool lay_debug = false;
for (int pri = 0; pri <= 4; pri++)
{
if(machine().input().code_pressed(lay_keys[pri])) {
lay_debug = true;
}
}
if(machine().input().code_pressed(KEYCODE_G)) {
sprites = false;
}
if(machine().input().code_pressed(KEYCODE_H)) {
backgrounds = false;
}
#endif
for(int pri = 0; pri <= 3; pri++) {
#ifdef DEBUG_KEYS
if(lay_debug && !machine().input().code_pressed(lay_keys[pri]))
continue;
#endif
if(!backgrounds)
continue;
for (int y=0; y<240; y++) {
clip.min_y = clip.max_y = y;
/* quizmoon map requires that layer 2 be drawn over layer 3 when same pri */
for(int layer = 2; layer >= 0; layer--) {
if(layerpri[layer] == pri) {
draw_layer(screen, bitmap, clip, layer, y, pri);
}
}
}
}
#ifdef DEBUG_KEYS
if(!lay_debug && !machine().input().code_pressed(lay_keys[4]))
#endif
m_text_tilemap->draw(screen, bitmap, cliprect, 0, 8);
if(sprites) draw_sprites(screen, bitmap, cliprect);
#if 0
popmessage ("scra - %08x %08x %08x\nscrb - %08x %08x %08x\nscrc - %08x %08x %08x",
m_scra_videoregs[0]&0xffffffff, // yyyyxxxx
m_scra_videoregs[1], // ??? more scrolling?
m_scra_videoregs[2], // 08 - 0b
m_scrb_videoregs[0]&0xffffffff, // 00 - 03
m_scrb_videoregs[1], // 04 - 07
m_scrb_videoregs[2], // 08 - 0b
m_scrc_videoregs[0]&0xffffffff, // 00 - 03
m_scrc_videoregs[1], // 04 - 07
m_scrc_videoregs[2]);// 08 - 0b
#endif
return 0;
}
WRITE_LINE_MEMBER(macrossp_state::screen_vblank_macrossp)
{
// rising edge
if (state)
{
/* looks like sprites are *two* frames ahead, like nmk16 */
memcpy(m_spriteram_old2.get(), m_spriteram_old.get(), m_spriteram.bytes());
memcpy(m_spriteram_old.get(), m_spriteram, m_spriteram.bytes());
}
}

View File

@ -1,138 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Stefan Jokisch
/***************************************************************************
Atari Sprint 4 video emulation
***************************************************************************/
#include "emu.h"
#include "includes/sprint4.h"
#include "audio/sprint4.h"
#include "screen.h"
void sprint4_state::sprint4_palette(palette_device &palette) const
{
palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00)); // black
palette.set_indirect_color(1, rgb_t(0xfc, 0xdf, 0x80)); // peach
palette.set_indirect_color(2, rgb_t(0xf0, 0x00, 0xf0)); // violet
palette.set_indirect_color(3, rgb_t(0x00, 0xf0, 0x0f)); // green
palette.set_indirect_color(4, rgb_t(0x30, 0x4f, 0xff)); // blue
palette.set_indirect_color(5, rgb_t(0xff, 0xff, 0xff)); // white
palette.set_pen_indirect(0, 0);
palette.set_pen_indirect(2, 0);
palette.set_pen_indirect(4, 0);
palette.set_pen_indirect(6, 0);
palette.set_pen_indirect(8, 0);
palette.set_pen_indirect(1, 1);
palette.set_pen_indirect(3, 2);
palette.set_pen_indirect(5, 3);
palette.set_pen_indirect(7, 4);
palette.set_pen_indirect(9, 5);
}
TILE_GET_INFO_MEMBER(sprint4_state::tile_info)
{
uint8_t code = m_videoram[tile_index];
if ((code & 0x30) == 0x30)
tileinfo.set(0, code & ~0x40, (code >> 6) ^ 3, 0);
else
tileinfo.set(0, code, 4, 0);
}
void sprint4_state::video_start()
{
m_screen->register_screen_bitmap(m_helper);
m_playfield = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sprint4_state::tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}
uint32_t sprint4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_playfield->draw(screen, bitmap, cliprect, 0, 0);
for (int i = 0; i < 4; i++)
{
int bank = 0;
uint8_t horz = m_videoram[0x390 + 2 * i + 0];
uint8_t attr = m_videoram[0x390 + 2 * i + 1];
uint8_t vert = m_videoram[0x398 + 2 * i + 0];
uint8_t code = m_videoram[0x398 + 2 * i + 1];
if (i & 1)
bank = 32;
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
(code >> 3) | bank,
(attr & 0x80) ? 4 : i,
0, 0,
horz - 15,
vert - 15, 0);
}
return 0;
}
WRITE_LINE_MEMBER(sprint4_state::screen_vblank)
{
// rising edge
if (state)
{
/* check for sprite-playfield collisions */
for (int i = 0; i < 4; i++)
{
int bank = 0;
uint8_t horz = m_videoram[0x390 + 2 * i + 0];
uint8_t vert = m_videoram[0x398 + 2 * i + 0];
uint8_t code = m_videoram[0x398 + 2 * i + 1];
rectangle rect(
horz - 15,
horz - 15 + m_gfxdecode->gfx(1)->width() - 1,
vert - 15,
vert - 15 + m_gfxdecode->gfx(1)->height() - 1);
rect &= m_screen->visible_area();
m_playfield->draw(*m_screen, m_helper, rect, 0, 0);
if (i & 1)
bank = 32;
m_gfxdecode->gfx(1)->transpen(m_helper,rect,
(code >> 3) | bank,
4,
0, 0,
horz - 15,
vert - 15, 1);
for (int y = rect.top(); y <= rect.bottom(); y++)
for (int x = rect.left(); x <= rect.right(); x++)
if (m_palette->pen_indirect(m_helper.pix(y, x)) != 0)
m_collision[i] = 1;
}
/* update sound status */
m_discrete->write(SPRINT4_MOTOR_DATA_1, m_videoram[0x391] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_2, m_videoram[0x393] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_3, m_videoram[0x395] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_4, m_videoram[0x397] & 15);
}
}
void sprint4_state::video_ram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_playfield->mark_tile_dirty(offset);
}