Skip to content

Commit

Permalink
misc first_screen() removal (nw)
Browse files Browse the repository at this point in the history
  • Loading branch information
Osso13 committed Mar 8, 2018
1 parent aa5f2c5 commit 48ade6a
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 115 deletions.
41 changes: 23 additions & 18 deletions src/mame/drivers/apple1.cpp
Expand Up @@ -96,6 +96,7 @@ class apple1_state : public driver_device
m_maincpu(*this, A1_CPU_TAG),
m_pia(*this, A1_PIA_TAG),
m_ram(*this, RAM_TAG),
m_screen(*this, "screen"),
m_basicram(*this, A1_BASICRAM_TAG),
m_kb0(*this, "KEY0"),
m_kb1(*this, "KEY1"),
Expand All @@ -104,14 +105,33 @@ class apple1_state : public driver_device
m_kbspecial(*this, "KBSPECIAL")
{ }

void apple1(machine_config &config);

protected:
virtual void machine_start() override;
virtual void machine_reset() override;

private:
required_device<cpu_device> m_maincpu;
required_device<pia6821_device> m_pia;
required_device<ram_device> m_ram;
required_device<screen_device> m_screen;
required_shared_ptr<uint8_t> m_basicram;
required_ioport m_kb0, m_kb1, m_kb2, m_kb3, m_kbspecial;

virtual void machine_start() override;
virtual void machine_reset() override;
uint8_t *m_ram_ptr, *m_char_ptr;
int m_ram_size, m_char_size;

uint8_t m_vram[40*24];
int m_cursx, m_cursy;

bool m_reset_down;
bool m_clear_down;

uint8_t m_transchar;
uint16_t m_lastports[4];

emu_timer *m_ready_start_timer, *m_ready_end_timer, *m_kbd_strobe_timer;

DECLARE_PALETTE_INIT(apple2);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
Expand All @@ -126,25 +146,10 @@ class apple1_state : public driver_device
TIMER_CALLBACK_MEMBER(ready_end_cb);
TIMER_CALLBACK_MEMBER(keyboard_strobe_cb);

void apple1(machine_config &config);
void apple1_map(address_map &map);
private:
uint8_t *m_ram_ptr, *m_char_ptr;
int m_ram_size, m_char_size;

uint8_t m_vram[40*24];
int m_cursx, m_cursy;

bool m_reset_down;
bool m_clear_down;

uint8_t m_transchar;
uint16_t m_lastports[4];

void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen);
void poll_keyboard();

emu_timer *m_ready_start_timer, *m_ready_end_timer, *m_kbd_strobe_timer;
};

static const uint8_t apple1_keymap[] =
Expand Down Expand Up @@ -493,7 +498,7 @@ WRITE_LINE_MEMBER(apple1_state::pia_display_gate_w)
// falling edge means start the display timer
if (state == CLEAR_LINE)
{
m_ready_start_timer->adjust(machine().first_screen()->time_until_pos(m_cursy, m_cursx));
m_ready_start_timer->adjust(m_screen->time_until_pos(m_cursy, m_cursx));
}
}

Expand Down
31 changes: 20 additions & 11 deletions src/mame/drivers/casloopy.cpp
Expand Up @@ -167,25 +167,34 @@ class casloopy_state : public driver_device
m_maincpu(*this, "maincpu"),
m_cart(*this, "cartslot"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_palette(*this, "palette"),
m_screen(*this, "screen") { }

void casloopy(machine_config &config);

DECLARE_DRIVER_INIT(casloopy);

protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;

private:
required_shared_ptr<uint32_t> m_bios_rom;
required_shared_ptr<uint32_t> m_vregs;
required_device<cpu_device> m_maincpu;
required_device<generic_slot_device> m_cart;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;

std::unique_ptr<uint16_t[]> m_paletteram;
std::unique_ptr<uint8_t[]> m_vram;
std::unique_ptr<uint8_t[]> m_bitmap_vram;
uint16_t sh7021_regs[0x100];
int m_gfx_index;
DECLARE_DRIVER_INIT(casloopy);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
uint32_t screen_update_casloopy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ16_MEMBER(vregs_r);
DECLARE_WRITE16_MEMBER(vregs_w);
DECLARE_READ16_MEMBER(pal_r);
Expand All @@ -198,7 +207,7 @@ class casloopy_state : public driver_device
DECLARE_READ8_MEMBER(bitmap_r);
DECLARE_WRITE8_MEMBER(bitmap_w);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(loopy_cart);
void casloopy(machine_config &config);

void casloopy_map(address_map &map);
void casloopy_sub_map(address_map &map);
};
Expand Down Expand Up @@ -244,7 +253,7 @@ void casloopy_state::video_start()
m_gfxdecode->set_gfx(m_gfx_index+1, std::make_unique<gfx_element>(m_palette, casloopy_8bpp_layout, m_vram.get(), 0, 1, 0));
}

uint32_t casloopy_state::screen_update_casloopy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
gfx_element *gfx = m_gfxdecode->gfx(m_gfx_index);
int x,y;
Expand Down Expand Up @@ -308,11 +317,11 @@ READ16_MEMBER(casloopy_state::vregs_r)
{
if(offset == 4/2)
{
return (machine().first_screen()->vblank() << 8) | (machine().rand() & 0xff); // vblank + vpos?
return (m_screen->vblank() << 8) | (machine().rand() & 0xff); // vblank + vpos?
}

if(offset == 2/2)
return machine().rand();/*(machine().first_screen()->hblank() << 8) | (machine().first_screen()->hpos() & 0xff);*/ // hblank + hpos?
return machine().rand();/*(m_screen->hblank() << 8) | (m_screen->hpos() & 0xff);*/ // hblank + hpos?

if(offset == 0/2)
return machine().rand(); // pccllect
Expand Down Expand Up @@ -522,7 +531,7 @@ MACHINE_CONFIG_START(casloopy_state::casloopy)
// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
// MCFG_SCREEN_SIZE(444, 263)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(casloopy_state, screen_update_casloopy)
MCFG_SCREEN_UPDATE_DRIVER(casloopy_state, screen_update)
MCFG_SCREEN_PALETTE("palette")

MCFG_PALETTE_ADD("palette", 512)
Expand Down
3 changes: 1 addition & 2 deletions src/mame/drivers/lynx.cpp
Expand Up @@ -13,7 +13,6 @@
#include "audio/lynx.h"

#include "cpu/m6502/m65sc02.h"
#include "screen.h"
#include "softlist.h"
#include "speaker.h"

Expand Down Expand Up @@ -60,7 +59,7 @@ PALETTE_INIT_MEMBER(lynx_state, lynx)

void lynx_state::video_start()
{
machine().first_screen()->register_screen_bitmap(m_bitmap);
m_screen->register_screen_bitmap(m_bitmap);
}

uint32_t lynx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
Expand Down
40 changes: 21 additions & 19 deletions src/mame/drivers/popper.cpp
Expand Up @@ -69,25 +69,8 @@ class popper_state : public driver_device
m_nmi_enable(0), m_back_color(0), m_vram_page(0)
{ }

DECLARE_PALETTE_INIT(popper);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TILE_GET_INFO_MEMBER(layer0_tile_info);
TILE_GET_INFO_MEMBER(layer1_tile_info);

DECLARE_WRITE8_MEMBER(nmi_control_w);
DECLARE_WRITE8_MEMBER(crt_direction_w);
DECLARE_WRITE8_MEMBER(back_color_select_w);
DECLARE_WRITE8_MEMBER(vram_page_select_w);
DECLARE_WRITE8_MEMBER(intcycle_w);
DECLARE_READ8_MEMBER(subcpu_nmi_r);
DECLARE_READ8_MEMBER(subcpu_reset_r);
DECLARE_WRITE8_MEMBER(ay1_w);
DECLARE_READ8_MEMBER(watchdog_clear_r);
DECLARE_READ8_MEMBER(inputs_r);

void popper(machine_config &config);
void main_map(address_map &map);
void sub_map(address_map &map);

protected:
virtual void machine_start() override;
virtual void machine_reset() override;
Expand All @@ -111,6 +94,25 @@ class popper_state : public driver_device
int m_nmi_enable;
int m_back_color;
int m_vram_page;

void main_map(address_map &map);
void sub_map(address_map &map);

DECLARE_PALETTE_INIT(popper);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TILE_GET_INFO_MEMBER(layer0_tile_info);
TILE_GET_INFO_MEMBER(layer1_tile_info);

DECLARE_WRITE8_MEMBER(nmi_control_w);
DECLARE_WRITE8_MEMBER(crt_direction_w);
DECLARE_WRITE8_MEMBER(back_color_select_w);
DECLARE_WRITE8_MEMBER(vram_page_select_w);
DECLARE_WRITE8_MEMBER(intcycle_w);
DECLARE_READ8_MEMBER(subcpu_nmi_r);
DECLARE_READ8_MEMBER(subcpu_reset_r);
DECLARE_WRITE8_MEMBER(ay1_w);
DECLARE_READ8_MEMBER(watchdog_clear_r);
DECLARE_READ8_MEMBER(inputs_r);
};


Expand Down Expand Up @@ -509,7 +511,7 @@ void popper_state::machine_start()

// allocate and start scanline timer
m_scanline_timer = timer_alloc(0);
m_scanline_timer->adjust(machine().first_screen()->time_until_pos(0, 0));
m_scanline_timer->adjust(m_screen->time_until_pos(0, 0));

// register for save states
save_item(NAME(m_nmi_enable));
Expand Down
2 changes: 1 addition & 1 deletion src/mame/drivers/rungun.cpp
Expand Up @@ -69,7 +69,7 @@ READ16_MEMBER(rungun_state::rng_sysregs_r)
bit9 : screen output select
*/
{
uint8_t field_bit = machine().first_screen()->frame_number() & 1;
uint8_t field_bit = m_screen->frame_number() & 1;
if(m_single_screen_mode == true)
field_bit = 1;
return (ioport("SYSTEM")->read() & 0xfdff) | (field_bit << 9);
Expand Down
39 changes: 22 additions & 17 deletions src/mame/drivers/tk2000.cpp
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:R. Belmont
/***************************************************************************
tk2000.c - Microdigital TK2000
tk2000.cpp - Microdigital TK2000
Driver by R. Belmont
Expand Down Expand Up @@ -45,6 +45,7 @@ class tk2000_state : public driver_device
: driver_device(mconfig, type, tag),
m_maincpu(*this, A2_CPU_TAG),
m_ram(*this, RAM_TAG),
m_screen(*this, "screen"),
m_video(*this, A2_VIDEO_TAG),
m_row0(*this, "ROW0"),
m_row1(*this, "ROW1"),
Expand All @@ -59,10 +60,18 @@ class tk2000_state : public driver_device
m_speaker(*this, A2_SPEAKER_TAG),
m_cassette(*this, A2_CASSETTE_TAG),
m_upperbank(*this, A2_UPPERBANK_TAG)
{ }
{ }

void tk2000(machine_config &config);

protected:
virtual void machine_start() override;
virtual void machine_reset() override;

private:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
required_device<screen_device> m_screen;
required_device<a2_video_device> m_video;
required_ioport m_row0, m_row1, m_row2, m_row3, m_row4, m_row5, m_row6, m_row7;
required_ioport m_kbspecial;
Expand All @@ -71,10 +80,17 @@ class tk2000_state : public driver_device
required_device<cassette_image_device> m_cassette;
required_device<address_map_bank_device> m_upperbank;

TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt);
int m_speaker_state;
int m_cassette_state;

virtual void machine_start() override;
virtual void machine_reset() override;
uint8_t m_strobe;

bool m_page2;

uint8_t *m_ram_ptr;
int m_ram_size;

TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt);

DECLARE_PALETTE_INIT(tk2000);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
Expand All @@ -88,19 +104,8 @@ class tk2000_state : public driver_device
DECLARE_READ8_MEMBER(c100_r);
DECLARE_WRITE8_MEMBER(c100_w);

void tk2000(machine_config &config);
void apple2_map(address_map &map);
void inhbank_map(address_map &map);
private:
int m_speaker_state;
int m_cassette_state;

uint8_t m_strobe;

bool m_page2;

uint8_t *m_ram_ptr;
int m_ram_size;

void do_io(address_space &space, int offset);
uint8_t read_floatingbus();
Expand Down Expand Up @@ -148,7 +153,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(tk2000_state::apple2_interrupt)
int scanline = param;

if((scanline % 8) == 0)
machine().first_screen()->update_partial(machine().first_screen()->vpos());
m_screen->update_partial(m_screen->vpos());

// update the video system's shadow copy of the system config at the end of the frame
if (scanline == 192)
Expand Down

0 comments on commit 48ade6a

Please sign in to comment.