spectrum: Fix sprite flicker and missing graphics in several games. [geecab, R. Belmont]

This commit is contained in:
arbee 2018-03-03 14:57:38 -05:00
parent 6228bbe942
commit 128343eb7c
4 changed files with 63 additions and 13 deletions

View File

@ -38,6 +38,7 @@ public:
DECLARE_READ8_MEMBER(beta_enable_r);
DECLARE_READ8_MEMBER(beta_disable_r);
DECLARE_MACHINE_RESET(pentagon);
DECLARE_VIDEO_START(pentagon);
INTERRUPT_GEN_MEMBER(pentagon_interrupt);
TIMER_CALLBACK_MEMBER(irq_on);
TIMER_CALLBACK_MEMBER(irq_off);
@ -233,6 +234,22 @@ MACHINE_RESET_MEMBER(pentagon_state,pentagon)
pentagon_update_memory();
}
VIDEO_START_MEMBER(pentagon_state,pentagon)
{
m_frame_invert_count = 16;
m_frame_number = 0;
m_flash_invert = 0;
m_previous_border_x = 0;
m_previous_border_y = 0;
machine().first_screen()->register_screen_bitmap(m_border_bitmap);
m_previous_screen_x = 0;
m_previous_screen_y = 0;
machine().first_screen()->register_screen_bitmap(m_screen_bitmap);
m_screen_location = m_ram->pointer() + (5 << 14);
}
/* F4 Character Displayer */
static const gfx_layout spectrum_charlayout =
{
@ -266,6 +283,7 @@ MACHINE_CONFIG_START(pentagon_state::pentagon)
MCFG_SCREEN_MODIFY("screen")
//MCFG_SCREEN_RAW_PARAMS(XTAL(14'000'000) / 2, 448, 0, 352, 320, 0, 304)
MCFG_SCREEN_RAW_PARAMS(XTAL(14'000'000) / 2, 448, 0, 352, 320, 0, 287)
MCFG_VIDEO_START_OVERRIDE(pentagon_state, pentagon )
MCFG_BETA_DISK_ADD(BETA_DISK_TAG)
MCFG_GFXDECODE_MODIFY("gfxdecode", pentagon)

View File

@ -643,13 +643,24 @@ GFXDECODE_END
void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_IRQ_OFF:
m_maincpu->set_input_line(0, CLEAR_LINE);
break;
case TIMER_SCANLINE:
timer_set(m_maincpu->cycles_to_attotime(m_CyclesPerLine), TIMER_SCANLINE);
spectrum_UpdateScreenBitmap();
break;
default:
assert_always(false, "Unknown id in spectrum_state::device_timer");
}
}
INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt)
{
m_maincpu->set_input_line(0, HOLD_LINE);
timer_set(attotime::from_ticks(32, m_maincpu->clock()), 0, 0);
timer_set(attotime::from_ticks(32, m_maincpu->clock()), TIMER_IRQ_OFF, 0);
}
MACHINE_CONFIG_START(spectrum_state::spectrum_common)

View File

@ -21,6 +21,7 @@
#include "machine/ram.h"
#include "machine/upd765.h"
#include "sound/spkrdev.h"
#include "screen.h"
/* Spectrum crystals */
@ -63,10 +64,17 @@ struct EVENT_LIST_ITEM
class spectrum_state : public driver_device
{
public:
enum
{
TIMER_IRQ_ON,
TIMER_IRQ_OFF,
TIMER_SCANLINE
};
spectrum_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_video_ram(*this, "video_ram"),
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
m_cassette(*this, "cassette"),
m_ram(*this, RAM_TAG),
m_speaker(*this, "speaker"),
@ -110,13 +118,17 @@ public:
int m_ROMSelection;
// Build up the screen bitmap line-by-line as the z80 uses CPU cycles.
// Elimiates sprite flicker on various games (E.g. Marauder and
// Stormlord) and makes Firefly playable.
emu_timer *m_scanline_timer;
EVENT_LIST_ITEM *m_pCurrentItem;
int m_NumEvents;
int m_TotalEvents;
char *m_pEventListBuffer;
int m_LastFrameStartTime;
int m_CyclesPerFrame;
int m_CyclesPerLine;
uint8_t *m_ram_0000;
uint8_t m_ram_disabled_by_beta;
@ -183,6 +195,7 @@ public:
DECLARE_QUICKLOAD_LOAD_MEMBER( spectrum );
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
void spectrum_common(machine_config &config);
void spectrum(machine_config &config);

View File

@ -17,8 +17,7 @@
#include "emu.h"
#include "includes/spectrum.h"
#include "screen.h"
#include "includes/spec128.h"
/***************************************************************************
Start the video hardware emulation.
@ -31,12 +30,17 @@ VIDEO_START_MEMBER(spectrum_state,spectrum)
m_previous_border_x = 0;
m_previous_border_y = 0;
machine().first_screen()->register_screen_bitmap(m_border_bitmap);
m_screen->register_screen_bitmap(m_border_bitmap);
m_previous_screen_x = 0;
m_previous_screen_y = 0;
machine().first_screen()->register_screen_bitmap(m_screen_bitmap);
m_screen->register_screen_bitmap(m_screen_bitmap);
m_screen_location = m_video_ram;
m_CyclesPerLine = SPEC_CYCLES_PER_LINE;
m_scanline_timer = timer_alloc(TIMER_SCANLINE);
timer_set(m_maincpu->cycles_to_attotime(m_CyclesPerLine), TIMER_SCANLINE);
}
VIDEO_START_MEMBER(spectrum_state,spectrum_128)
@ -47,12 +51,16 @@ VIDEO_START_MEMBER(spectrum_state,spectrum_128)
m_previous_border_x = 0;
m_previous_border_y = 0;
machine().first_screen()->register_screen_bitmap(m_border_bitmap);
m_screen->register_screen_bitmap(m_border_bitmap);
m_previous_screen_x = 0;
m_previous_screen_y = 0;
machine().first_screen()->register_screen_bitmap(m_screen_bitmap);
m_screen->register_screen_bitmap(m_screen_bitmap);
m_screen_location = m_ram->pointer() + (5 << 14);
m_CyclesPerLine = SPEC128_CYCLES_PER_LINE;
m_scanline_timer = timer_alloc(TIMER_SCANLINE);
timer_set(m_maincpu->cycles_to_attotime(m_CyclesPerLine), TIMER_SCANLINE);
}
@ -202,8 +210,8 @@ PALETTE_INIT_MEMBER(spectrum_state,spectrum)
void spectrum_state::spectrum_UpdateScreenBitmap(bool eof)
{
unsigned int x = machine().first_screen()->hpos();
unsigned int y = machine().first_screen()->vpos();
unsigned int x = m_screen->hpos();
unsigned int y = m_screen->vpos();
int width = m_screen_bitmap.width();
int height = m_screen_bitmap.height();
@ -259,8 +267,8 @@ void spectrum_state::spectrum_UpdateScreenBitmap(bool eof)
void spectrum_state::spectrum_UpdateBorderBitmap()
{
unsigned int x = machine().first_screen()->hpos();
unsigned int y = machine().first_screen()->vpos();
unsigned int x = m_screen->hpos();
unsigned int y = m_screen->vpos();
int width = m_border_bitmap.width();
int height = m_border_bitmap.height();