apple2, etc.: Move some line handlers down into video device (nw)

This commit is contained in:
AJR 2019-06-14 09:11:03 -04:00
parent 58ed6c4831
commit 416e1c9124
7 changed files with 92 additions and 155 deletions

View File

@ -169,11 +169,6 @@ public:
DECLARE_READ8_MEMBER(flags_r);
DECLARE_READ8_MEMBER(controller_strobe_r);
DECLARE_WRITE8_MEMBER(controller_strobe_w);
DECLARE_WRITE_LINE_MEMBER(txt_w);
DECLARE_WRITE_LINE_MEMBER(mix_w);
DECLARE_WRITE_LINE_MEMBER(scr_w);
DECLARE_WRITE_LINE_MEMBER(res_w);
DECLARE_WRITE_LINE_MEMBER(an2_w);
DECLARE_READ8_MEMBER(c080_r);
DECLARE_WRITE8_MEMBER(c080_w);
DECLARE_READ8_MEMBER(c100_r);
@ -213,8 +208,6 @@ private:
int m_inh_slot;
int m_cnxx_slot;
bool m_page2;
uint8_t *m_ram_ptr;
int m_ram_size;
@ -345,7 +338,6 @@ void apple2_state::machine_start()
save_item(NAME(m_inh_slot));
save_item(NAME(m_inh_bank));
save_item(NAME(m_cnxx_slot));
save_item(NAME(m_page2));
save_item(NAME(m_anykeydown));
// setup video pointers
@ -359,7 +351,6 @@ void apple2_state::machine_reset()
{
m_inh_slot = 0;
m_cnxx_slot = -1;
m_page2 = false;
m_anykeydown = false;
}
@ -510,43 +501,6 @@ uint32_t apple2_state::screen_update_jp(screen_device &screen, bitmap_ind16 &bit
I/O
***************************************************************************/
WRITE_LINE_MEMBER(apple2_state::txt_w)
{
if (m_video->m_graphics == state) // avoid flickering from II+ refresh polling
{
// select graphics or text mode
m_screen->update_now();
m_video->m_graphics = !state;
}
}
WRITE_LINE_MEMBER(apple2_state::mix_w)
{
// select mixed mode or nomix
m_screen->update_now();
m_video->m_mix = state;
}
WRITE_LINE_MEMBER(apple2_state::scr_w)
{
// select primary or secondary page
m_screen->update_now();
m_page2 = state;
m_video->m_page2 = state;
}
WRITE_LINE_MEMBER(apple2_state::res_w)
{
// select lo-res or hi-res
m_screen->update_now();
m_video->m_hires = state;
}
WRITE_LINE_MEMBER(apple2_state::an2_w)
{
m_video->m_an2 = state;
}
READ8_MEMBER(apple2_state::keyb_data_r)
{
// keyboard latch
@ -837,7 +791,7 @@ uint8_t apple2_state::read_floatingbus()
//
Hires = (m_video->m_hires && m_video->m_graphics) ? 1 : 0;
Mixed = m_video->m_mix ? 1 : 0;
Page2 = m_page2 ? 1 : 0;
Page2 = m_video->m_page2 ? 1 : 0;
_80Store = 0;
// calculate video parameters according to display standard
@ -1325,7 +1279,7 @@ void apple2_state::apple2_common(machine_config &config)
m_scantimer->configure_scanline(FUNC(apple2_state::apple2_interrupt), "screen", 0, 1);
config.m_minimum_quantum = attotime::from_hz(60);
APPLE2_VIDEO(config, m_video, XTAL(14'318'181));
APPLE2_VIDEO(config, m_video, XTAL(14'318'181)).set_screen(m_screen);
APPLE2_COMMON(config, m_a2common, XTAL(14'318'181));
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@ -1342,14 +1296,14 @@ void apple2_state::apple2_common(machine_config &config)
/* soft switches */
F9334(config, m_softlatch); // F14 (labeled 74LS259 on some boards and in the Apple ][ Reference Manual)
m_softlatch->q_out_cb<0>().set(FUNC(apple2_state::txt_w));
m_softlatch->q_out_cb<1>().set(FUNC(apple2_state::mix_w));
m_softlatch->q_out_cb<2>().set(FUNC(apple2_state::scr_w));
m_softlatch->q_out_cb<3>().set(FUNC(apple2_state::res_w));
m_softlatch->q_out_cb<0>().set(m_video, FUNC(a2_video_device::txt_w));
m_softlatch->q_out_cb<1>().set(m_video, FUNC(a2_video_device::mix_w));
m_softlatch->q_out_cb<2>().set(m_video, FUNC(a2_video_device::scr_w));
m_softlatch->q_out_cb<3>().set(m_video, FUNC(a2_video_device::res_w));
m_softlatch->q_out_cb<4>().set(m_gameio, FUNC(apple2_gameio_device::an0_w));
m_softlatch->q_out_cb<5>().set(m_gameio, FUNC(apple2_gameio_device::an1_w));
m_softlatch->q_out_cb<6>().set(m_gameio, FUNC(apple2_gameio_device::an2_w));
m_softlatch->q_out_cb<6>().append(FUNC(apple2_state::an2_w));
m_softlatch->q_out_cb<6>().append(m_video, FUNC(a2_video_device::an2_w));
m_softlatch->q_out_cb<7>().set(m_gameio, FUNC(apple2_gameio_device::an3_w));
APPLE2_GAMEIO(config, m_gameio, apple2_gameio_device::default_options, nullptr);

View File

@ -1469,13 +1469,11 @@ void apple2e_state::do_io(int offset, bool is_iic)
switch (offset)
{
case 0x5e: // SETDHIRES
m_screen->update_now();
m_video->m_dhires = true;
m_video->dhires_w(0);
break;
case 0x5f: // CLRDHIRES
m_screen->update_now();
m_video->m_dhires = false;
m_video->dhires_w(1);
break;
}
}
@ -1543,57 +1541,40 @@ void apple2e_state::do_io(int offset, bool is_iic)
break;
case 0x50: // graphics mode
if (m_video->m_graphics == false) // avoid flickering from II+ refresh polling
{
m_screen->update_now();
m_video->m_graphics = true;
}
m_video->txt_w(0);
break;
case 0x51: // text mode
m_screen->update_now();
m_video->m_graphics = false;
m_video->txt_w(1);
break;
case 0x52: // no mix
m_screen->update_now();
m_video->m_mix = false;
m_video->mix_w(0);
break;
case 0x53: // mixed mode
m_screen->update_now();
m_video->m_mix = true;
m_video->mix_w(1);
break;
case 0x54: // set page 1
if (!m_video->m_80col)
{
m_screen->update_now();
}
m_page2 = false;
m_video->m_page2 = false;
m_video->scr_w(0);
auxbank_update();
break;
case 0x55: // set page 2
if (!m_video->m_80col)
{
m_screen->update_now();
}
m_page2 = true;
m_video->m_page2 = true;
m_video->scr_w(1);
auxbank_update();
break;
case 0x56: // select lo-res
m_screen->update_now();
m_video->m_hires = false;
m_video->res_w(0);
auxbank_update();
break;
case 0x57: // select hi-res
m_screen->update_now();
m_video->m_hires = true;
m_video->res_w(1);
auxbank_update();
break;
@ -4475,7 +4456,7 @@ void apple2e_state::apple2e(machine_config &config)
m_scantimer->configure_scanline(FUNC(apple2e_state::apple2_interrupt), "screen", 0, 1);
config.m_minimum_quantum = attotime::from_hz(60);
APPLE2_VIDEO(config, m_video, XTAL(14'318'181));
APPLE2_VIDEO(config, m_video, XTAL(14'318'181)).set_screen(m_screen);
APPLE2_COMMON(config, m_a2common, XTAL(14'318'181));
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);

View File

@ -1794,11 +1794,11 @@ void apple2gs_state::do_io(address_space &space, int offset)
switch (offset)
{
case 0x5e: // SETDHIRES
m_video->m_dhires = true;
m_video->dhires_w(0);
return;
case 0x5f: // CLRDHIRES
m_video->m_dhires = false;
m_video->dhires_w(1);
return;
}
}
@ -1824,40 +1824,40 @@ void apple2gs_state::do_io(address_space &space, int offset)
break;
case 0x50: // graphics mode
m_video->m_graphics = true;
m_video->txt_w(0);
break;
case 0x51: // text mode
m_video->m_graphics = false;
m_video->txt_w(1);
break;
case 0x52: // no mix
m_video->m_mix = false;
m_video->mix_w(0);
break;
case 0x53: // mixed mode
m_video->m_mix = true;
m_video->mix_w(1);
break;
case 0x54: // set page 1
m_page2 = false;
m_video->m_page2 = false;
m_video->scr_w(0);
auxbank_update();
break;
case 0x55: // set page 2
m_page2 = true;
m_video->m_page2 = true;
m_video->scr_w(1);
auxbank_update();
break;
case 0x56: // select lo-res
m_video->m_hires = false;
m_video->res_w(0);
auxbank_update();
break;
case 0x57: // select hi-res
m_video->m_hires = true;
m_video->res_w(1);
auxbank_update();
break;
@ -4559,7 +4559,7 @@ void apple2gs_state::apple2gs(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
APPLE2_VIDEO(config, m_video, A2GS_14M);
APPLE2_VIDEO(config, m_video, A2GS_14M).set_screen(m_screen);
APPLE2_COMMON(config, m_a2common, A2GS_14M);
m_a2common->set_GS_cputag(m_maincpu);

View File

@ -70,11 +70,6 @@ public:
DECLARE_READ8_MEMBER(speaker_toggle_r);
DECLARE_WRITE8_MEMBER(speaker_toggle_w);
DECLARE_READ8_MEMBER(switches_r);
DECLARE_WRITE_LINE_MEMBER(txt_w);
DECLARE_WRITE_LINE_MEMBER(mix_w);
DECLARE_WRITE_LINE_MEMBER(scr_w);
DECLARE_WRITE_LINE_MEMBER(res_w);
DECLARE_WRITE_LINE_MEMBER(an2_w);
DECLARE_READ8_MEMBER(reset_r);
void kuzmich(machine_config &config);
@ -116,9 +111,6 @@ void superga2_state::machine_reset()
uint8_t *user1 = memregion("maincpu")->base();
memcpy(&m_ram_ptr[0x1100], user1, 0x8000);
mix_w(false);
scr_w(false);
res_w(true);
}
/***************************************************************************
@ -136,42 +128,6 @@ uint32_t superga2_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
I/O
***************************************************************************/
WRITE_LINE_MEMBER(superga2_state::txt_w)
{
if (m_video->m_graphics == state) // avoid flickering from II+ refresh polling
{
// select graphics or text mode
m_screen->update_now();
m_video->m_graphics = !state;
}
}
WRITE_LINE_MEMBER(superga2_state::mix_w)
{
// select mixed mode or nomix
m_screen->update_now();
m_video->m_mix = state;
}
WRITE_LINE_MEMBER(superga2_state::scr_w)
{
// select primary or secondary page
m_screen->update_now();
m_video->m_page2 = state;
}
WRITE_LINE_MEMBER(superga2_state::res_w)
{
// select lo-res or hi-res
m_screen->update_now();
m_video->m_hires = state;
}
WRITE_LINE_MEMBER(superga2_state::an2_w)
{
m_video->m_an2 = state;
}
READ8_MEMBER(superga2_state::speaker_toggle_r)
{
if (!machine().side_effects_disabled())
@ -262,7 +218,7 @@ void superga2_state::kuzmich(machine_config &config)
M6502(config, m_maincpu, 1021800);
m_maincpu->set_addrmap(AS_PROGRAM, &superga2_state::kuzmich_map);
APPLE2_VIDEO(config, m_video, XTAL(14'318'181));
APPLE2_VIDEO(config, m_video, XTAL(14'318'181)).set_screen(m_screen);
APPLE2_COMMON(config, m_a2common, XTAL(14'318'181));
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@ -276,11 +232,10 @@ void superga2_state::kuzmich(machine_config &config)
/* soft switches */
F9334(config, m_softlatch); // F14 (labeled 74LS259 on some boards and in the Apple ][ Reference Manual)
m_softlatch->q_out_cb<0>().set(FUNC(superga2_state::txt_w));
m_softlatch->q_out_cb<1>().set(FUNC(superga2_state::mix_w));
m_softlatch->q_out_cb<2>().set(FUNC(superga2_state::scr_w));
m_softlatch->q_out_cb<3>().set(FUNC(superga2_state::res_w));
m_softlatch->q_out_cb<6>().set(FUNC(superga2_state::an2_w));
m_softlatch->q_out_cb<0>().set(m_video, FUNC(a2_video_device::txt_w));
m_softlatch->q_out_cb<1>().set(m_video, FUNC(a2_video_device::mix_w));
m_softlatch->q_out_cb<2>().set(m_video, FUNC(a2_video_device::scr_w));
m_softlatch->q_out_cb<3>().set(m_video, FUNC(a2_video_device::res_w));
RAM(config, RAM_TAG).set_default_size("48K").set_default_value(0x00);
}

View File

@ -85,8 +85,6 @@ private:
uint8_t m_strobe;
bool m_page2;
uint8_t *m_ram_ptr;
int m_ram_size;
@ -128,7 +126,6 @@ void tk2000_state::machine_start()
save_item(NAME(m_speaker_state));
save_item(NAME(m_cassette_state));
save_item(NAME(m_strobe));
save_item(NAME(m_page2));
// setup video pointers
m_video->m_ram_ptr = m_ram_ptr;
@ -139,7 +136,6 @@ void tk2000_state::machine_start()
void tk2000_state::machine_reset()
{
m_page2 = false;
m_strobe = 0;
}
@ -197,13 +193,11 @@ void tk2000_state::do_io(address_space &space, int offset)
break;
case 0x54: // set page 1
m_page2 = false;
m_video->m_page2 = false;
m_video->scr_w(0);
break;
case 0x55: // set page 2
m_page2 = true;
m_video->m_page2 = true;
m_video->scr_w(1);
break;
case 0x5a: // ROM
@ -337,7 +331,7 @@ uint8_t tk2000_state::read_floatingbus()
//
Hires = 1; //m_video->m_hires ? 1 : 0;
Mixed = 0; //m_video->m_mix ? 1 : 0;
Page2 = m_page2 ? 1 : 0;
Page2 = m_video->m_page2 ? 1 : 0;
_80Store = 0;
// calculate video parameters according to display standard
@ -575,7 +569,7 @@ void tk2000_state::tk2000(machine_config &config)
TIMER(config, "scantimer").configure_scanline(FUNC(tk2000_state::apple2_interrupt), "screen", 0, 1);
config.m_minimum_quantum = attotime::from_hz(60);
APPLE2_VIDEO(config, m_video, XTAL(14'318'181));
APPLE2_VIDEO(config, m_video, XTAL(14'318'181)).set_screen(m_screen);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);

View File

@ -9,6 +9,7 @@
#include "emu.h"
#include "machine/ram.h"
#include "video/apple2.h"
#include "screen.h"
/***************************************************************************/
@ -39,6 +40,7 @@ DEFINE_DEVICE_TYPE(APPLE2_VIDEO, a2_video_device, "a2video", "Apple II video")
a2_video_device::a2_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, APPLE2_VIDEO, tag, owner, clock)
, device_palette_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
{
}
@ -136,6 +138,50 @@ void a2_video_device::device_reset()
m_newvideo = 0x01;
}
WRITE_LINE_MEMBER(a2_video_device::txt_w)
{
if (m_graphics == state) // avoid flickering from II+ refresh polling
{
// select graphics or text mode
screen().update_now();
m_graphics = !state;
}
}
WRITE_LINE_MEMBER(a2_video_device::mix_w)
{
// select mixed mode or nomix
screen().update_now();
m_mix = state;
}
WRITE_LINE_MEMBER(a2_video_device::scr_w)
{
// select primary or secondary page
if (!m_80col)
screen().update_now();
m_page2 = state;
}
WRITE_LINE_MEMBER(a2_video_device::res_w)
{
// select lo-res or hi-res
screen().update_now();
m_hires = state;
}
WRITE_LINE_MEMBER(a2_video_device::dhires_w)
{
// select double hi-res
screen().update_now();
m_dhires = !state;
}
WRITE_LINE_MEMBER(a2_video_device::an2_w)
{
m_an2 = state;
}
void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code,
const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg)
{

View File

@ -15,7 +15,7 @@
#define BORDER_RIGHT (32)
#define BORDER_TOP (16) // (plus bottom)
class a2_video_device : public device_t, public device_palette_interface
class a2_video_device : public device_t, public device_palette_interface, public device_video_interface
{
public:
// construction/destruction
@ -43,6 +43,13 @@ public:
int m_sysconfig;
DECLARE_WRITE_LINE_MEMBER(txt_w);
DECLARE_WRITE_LINE_MEMBER(mix_w);
DECLARE_WRITE_LINE_MEMBER(scr_w);
DECLARE_WRITE_LINE_MEMBER(res_w);
DECLARE_WRITE_LINE_MEMBER(dhires_w);
DECLARE_WRITE_LINE_MEMBER(an2_w);
void text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void text_update_ultr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void text_update_orig(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);