mirror of
https://github.com/holub/mame
synced 2025-10-07 01:16:22 +03:00
sbrkout.cpp: verified main CPU clock [Guru]
This commit is contained in:
parent
9fa1101ff3
commit
4369fe34f3
@ -61,9 +61,15 @@ public:
|
|||||||
|
|
||||||
void sbrkout(machine_config &config);
|
void sbrkout(machine_config &config);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual DECLARE_READ8_MEMBER(switches_r);
|
||||||
|
virtual void machine_start() override;
|
||||||
|
virtual void machine_reset() override;
|
||||||
|
virtual void video_start() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_WRITE8_MEMBER(irq_ack_w);
|
DECLARE_WRITE8_MEMBER(irq_ack_w);
|
||||||
virtual DECLARE_READ8_MEMBER(switches_r);
|
|
||||||
DECLARE_WRITE_LINE_MEMBER(pot_mask1_w);
|
DECLARE_WRITE_LINE_MEMBER(pot_mask1_w);
|
||||||
DECLARE_WRITE_LINE_MEMBER(pot_mask2_w);
|
DECLARE_WRITE_LINE_MEMBER(pot_mask2_w);
|
||||||
DECLARE_WRITE8_MEMBER(output_latch_w);
|
DECLARE_WRITE8_MEMBER(output_latch_w);
|
||||||
@ -76,9 +82,6 @@ private:
|
|||||||
DECLARE_READ8_MEMBER(sync2_r);
|
DECLARE_READ8_MEMBER(sync2_r);
|
||||||
DECLARE_WRITE8_MEMBER(sbrkout_videoram_w);
|
DECLARE_WRITE8_MEMBER(sbrkout_videoram_w);
|
||||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||||
virtual void machine_start() override;
|
|
||||||
virtual void machine_reset() override;
|
|
||||||
virtual void video_start() override;
|
|
||||||
uint32_t screen_update_sbrkout(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
uint32_t screen_update_sbrkout(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
TIMER_CALLBACK_MEMBER(scanline_callback);
|
TIMER_CALLBACK_MEMBER(scanline_callback);
|
||||||
TIMER_CALLBACK_MEMBER(pot_trigger_callback);
|
TIMER_CALLBACK_MEMBER(pot_trigger_callback);
|
||||||
@ -122,18 +125,6 @@ static constexpr XTAL MAIN_CLOCK = 12.096_MHz_XTAL;
|
|||||||
#define TIME_4V attotime::from_hz(MAIN_CLOCK/2/256/2/4)
|
#define TIME_4V attotime::from_hz(MAIN_CLOCK/2/256/2/4)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
|
||||||
*
|
|
||||||
* Prototypes
|
|
||||||
*
|
|
||||||
*************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
* Machine setup
|
* Machine setup
|
||||||
@ -142,8 +133,7 @@ static constexpr XTAL MAIN_CLOCK = 12.096_MHz_XTAL;
|
|||||||
|
|
||||||
void sbrkout_state::machine_start()
|
void sbrkout_state::machine_start()
|
||||||
{
|
{
|
||||||
uint8_t *videoram = m_videoram;
|
membank("bank1")->set_base(&m_videoram[0x380]);
|
||||||
membank("bank1")->set_base(&videoram[0x380]);
|
|
||||||
m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::scanline_callback),this));
|
m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::scanline_callback),this));
|
||||||
m_pot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::pot_trigger_callback),this));
|
m_pot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::pot_trigger_callback),this));
|
||||||
|
|
||||||
@ -168,7 +158,6 @@ void sbrkout_state::machine_reset()
|
|||||||
|
|
||||||
TIMER_CALLBACK_MEMBER(sbrkout_state::scanline_callback)
|
TIMER_CALLBACK_MEMBER(sbrkout_state::scanline_callback)
|
||||||
{
|
{
|
||||||
uint8_t *videoram = m_videoram;
|
|
||||||
int scanline = param;
|
int scanline = param;
|
||||||
|
|
||||||
/* force a partial update before anything happens */
|
/* force a partial update before anything happens */
|
||||||
@ -179,7 +168,7 @@ TIMER_CALLBACK_MEMBER(sbrkout_state::scanline_callback)
|
|||||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||||
|
|
||||||
/* update the DAC state */
|
/* update the DAC state */
|
||||||
m_dac->write((videoram[0x380 + 0x11] & (scanline >> 2)) != 0);
|
m_dac->write((m_videoram[0x380 + 0x11] & (scanline >> 2)) != 0);
|
||||||
|
|
||||||
/* on the VBLANK, read the pot and schedule an interrupt time for it */
|
/* on the VBLANK, read the pot and schedule an interrupt time for it */
|
||||||
if (scanline == m_screen->visible_area().bottom() + 1)
|
if (scanline == m_screen->visible_area().bottom() + 1)
|
||||||
@ -342,8 +331,7 @@ READ8_MEMBER(sbrkout_state::sync2_r)
|
|||||||
|
|
||||||
TILE_GET_INFO_MEMBER(sbrkout_state::get_bg_tile_info)
|
TILE_GET_INFO_MEMBER(sbrkout_state::get_bg_tile_info)
|
||||||
{
|
{
|
||||||
uint8_t *videoram = m_videoram;
|
int code = (m_videoram[tile_index] & 0x80) ? m_videoram[tile_index] : 0;
|
||||||
int code = (videoram[tile_index] & 0x80) ? videoram[tile_index] : 0;
|
|
||||||
SET_TILE_INFO_MEMBER(0, code, 0, 0);
|
SET_TILE_INFO_MEMBER(0, code, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,8 +344,7 @@ void sbrkout_state::video_start()
|
|||||||
|
|
||||||
WRITE8_MEMBER(sbrkout_state::sbrkout_videoram_w)
|
WRITE8_MEMBER(sbrkout_state::sbrkout_videoram_w)
|
||||||
{
|
{
|
||||||
uint8_t *videoram = m_videoram;
|
m_videoram[offset] = data;
|
||||||
videoram[offset] = data;
|
|
||||||
m_bg_tilemap->mark_tile_dirty(offset);
|
m_bg_tilemap->mark_tile_dirty(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,15 +358,13 @@ WRITE8_MEMBER(sbrkout_state::sbrkout_videoram_w)
|
|||||||
|
|
||||||
uint32_t sbrkout_state::screen_update_sbrkout(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
uint32_t sbrkout_state::screen_update_sbrkout(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||||
{
|
{
|
||||||
uint8_t *videoram = m_videoram;
|
|
||||||
|
|
||||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||||
|
|
||||||
for (int ball = 2; ball >= 0; ball--)
|
for (int ball = 2; ball >= 0; ball--)
|
||||||
{
|
{
|
||||||
int code = ((videoram[0x380 + 0x18 + ball * 2 + 1] & 0x80) >> 7);
|
int code = ((m_videoram[0x380 + 0x18 + ball * 2 + 1] & 0x80) >> 7);
|
||||||
int sx = 31 * 8 - videoram[0x380 + 0x10 + ball * 2];
|
int sx = 31 * 8 - m_videoram[0x380 + 0x10 + ball * 2];
|
||||||
int sy = 30 * 8 - videoram[0x380 + 0x18 + ball * 2];
|
int sy = 30 * 8 - m_videoram[0x380 + 0x18 + ball * 2];
|
||||||
|
|
||||||
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, 0, 0, 0, sx, sy, 0);
|
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, 0, 0, 0, sx, sy, 0);
|
||||||
}
|
}
|
||||||
@ -558,7 +543,7 @@ GFXDECODE_END
|
|||||||
void sbrkout_state::sbrkout(machine_config &config)
|
void sbrkout_state::sbrkout(machine_config &config)
|
||||||
{
|
{
|
||||||
/* basic machine hardware */
|
/* basic machine hardware */
|
||||||
M6502(config, m_maincpu, MAIN_CLOCK/16); // 375 KHz? Should be 750KHz?
|
M6502(config, m_maincpu, MAIN_CLOCK/16); // 756KHz verified
|
||||||
m_maincpu->set_addrmap(AS_PROGRAM, &sbrkout_state::main_map);
|
m_maincpu->set_addrmap(AS_PROGRAM, &sbrkout_state::main_map);
|
||||||
|
|
||||||
F9334(config, m_outlatch); // H8
|
F9334(config, m_outlatch); // H8
|
||||||
|
Loading…
Reference in New Issue
Block a user