Skip to content

Commit

Permalink
channelf: Correct screen resolution, fixes MT#08012
Browse files Browse the repository at this point in the history
- Pixels are double width, and repeat scanlines 4 times for NTSC, 5 times for PAL.
  • Loading branch information
Pernod70 committed Jun 26, 2021
1 parent a32810d commit c8192c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
28 changes: 8 additions & 20 deletions src/mame/drivers/channelf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,8 @@ void channelf_state::channelf(machine_config &config)

/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
screen.set_size(128, 64);
screen.set_visarea(4, 112 - 7, 4, 64 - 3);
screen.set_screen_update(FUNC(channelf_state::screen_update_channelf));
screen.set_raw(3.579545_MHz_XTAL * 8 / 7, 256, 8, 212, 264, 16, 248);
screen.set_screen_update(FUNC(channelf_state::screen_update_ntsc));
screen.set_palette("palette");

PALETTE(config, "palette", FUNC(channelf_state::channelf_palette), 8);
Expand All @@ -241,11 +238,8 @@ void channelf_state::sabavdpl(machine_config &config)

/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(50);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(4623)); /* approximate */
screen.set_size(128, 64);
screen.set_visarea(4, 112 - 7, 4, 64 - 3);
screen.set_screen_update(FUNC(channelf_state::screen_update_channelf));
screen.set_raw(4_MHz_XTAL, 256, 8, 212, 312, 20, 310);
screen.set_screen_update(FUNC(channelf_state::screen_update_pal));
screen.set_palette("palette");

PALETTE(config, "palette", FUNC(channelf_state::channelf_palette), 8);
Expand All @@ -267,11 +261,8 @@ void channelf_state::channlf2(machine_config &config)

/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
screen.set_size(128, 64);
screen.set_visarea(4, 112 - 7, 4, 64 - 3);
screen.set_screen_update(FUNC(channelf_state::screen_update_channelf));
screen.set_raw(3.579545_MHz_XTAL * 8 / 7, 256, 8, 212, 264, 16, 248);
screen.set_screen_update(FUNC(channelf_state::screen_update_ntsc));
screen.set_palette("palette");

PALETTE(config, "palette", FUNC(channelf_state::channelf_palette), 8);
Expand All @@ -293,11 +284,8 @@ void channelf_state::sabavpl2(machine_config &config)

/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(50);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(4623)); /* approximate */
screen.set_size(128, 64);
screen.set_visarea(4, 112 - 7, 4, 64 - 3);
screen.set_screen_update(FUNC(channelf_state::screen_update_channelf));
screen.set_raw(4_MHz_XTAL, 256, 8, 212, 312, 20, 310);
screen.set_screen_update(FUNC(channelf_state::screen_update_pal));
screen.set_palette("palette");

PALETTE(config, "palette", FUNC(channelf_state::channelf_palette), 8);
Expand Down
4 changes: 3 additions & 1 deletion src/mame/includes/channelf.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class channelf_state : public driver_device
virtual void video_start() override;
virtual void machine_start() override;
void channelf_palette(palette_device &palette) const;
uint32_t screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_ntsc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_pal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_rpt);
required_device<cpu_device> m_maincpu;
required_device<channelf_sound_device> m_custom;
required_device<channelf_cart_slot_device> m_cart;
Expand Down
26 changes: 20 additions & 6 deletions src/mame/video/channelf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,33 @@ int channelf_state::recalc_palette_offset(int reg1, int reg2)
return ((reg2&0x2)|(reg1>>1)) << 2;
}

uint32_t channelf_state::screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t channelf_state::screen_update_ntsc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
return screen_update_channelf(screen, bitmap, cliprect, 4);
}

uint32_t channelf_state::screen_update_pal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
return screen_update_channelf(screen, bitmap, cliprect, 5);
}

uint32_t channelf_state::screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_rpt)
{
uint16_t ma=0;

for (uint8_t y = 0; y < 64; y++ )
for (uint8_t y = 0; y < 64; y++)
{
uint16_t *p = &bitmap.pix(y);
int const palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3);

for (uint16_t x = ma; x < ma + 128; x++)
for (int y_pos = y * y_rpt; y_pos < (y * y_rpt) + y_rpt; y_pos++)
{
uint8_t const col = palette_offset+(m_p_videoram[x|(y<<7)]&3);
*p++ = colormap[col];
uint16_t *p = &bitmap.pix(y_pos);
for (uint16_t x = ma; x < ma + 128; x++)
{
uint8_t const col = palette_offset+(m_p_videoram[x|(y<<7)]&3);
*p++ = colormap[col];
*p++ = colormap[col];
}
}
ma+=128;
}
Expand Down

0 comments on commit c8192c8

Please sign in to comment.