fix MikroMikko 1 video mismatch between hres and text

This commit is contained in:
kara1001000 2015-10-08 03:45:39 +03:00
parent 842f0606c9
commit 986b601324
2 changed files with 46 additions and 37 deletions

View File

@ -393,36 +393,30 @@ inline void upd7220_device::recompute_parameters()
int horiz_pix_total = (m_hs + m_hbp + m_hfp + m_aw) * horiz_mult;
int vert_pix_total = (m_vs + m_vbp + m_al + m_vfp) * vert_mult;
//printf("%d %d %d %d\n",m_hs,m_hbp,m_aw,m_hfp);
//printf("%d %d\n",m_aw * 8,m_pitch * 8);
if (horiz_pix_total == 0 || vert_pix_total == 0) //bail out if screen params aren't valid
return;
attoseconds_t refresh = HZ_TO_ATTOSECONDS(clock() * 8) * horiz_pix_total * vert_pix_total;
rectangle visarea;
visarea.min_x = 0; //(m_hs + m_hbp) * 8;
visarea.min_y = m_vbp; //m_vs + m_vbp;
visarea.max_x = m_aw * horiz_mult - 1;//horiz_pix_total - (m_hfp * 8) - 1;
visarea.max_y = m_al * vert_mult + m_vbp - 1;//vert_pix_total - m_vfp - 1;
visarea.min_y = 0; //m_vs + m_vbp;
visarea.max_x = m_aw * horiz_mult - 1; //horiz_pix_total - (m_hfp * 8) - 1;
visarea.max_y = m_al * vert_mult + m_vbp + m_vfp - 3; // this matches with (25 text rows * 15 pixels/row - 1) on MikroMikko 1
LOG(("uPD7220 '%s' Screen: %u x %u @ %f Hz\n", tag(), horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh)));
LOG(("Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y));
LOG(("%d %d %d %d %d\n",m_hs,m_hbp,m_aw,m_hfp,m_pitch));
LOG(("%d %d %d %d\n",m_vs,m_vbp,m_al,m_vfp));
LOG(("hs=%d hbp=%d aw=%d hfp=%d pitch=%d hmult=%d htot=%d\n", m_hs, m_hbp, m_aw, m_hfp, m_pitch, horiz_mult, horiz_pix_total));
LOG(("vs=%d vbp=%d al=%d vfp=%d vmult=%d vtot=%d\n", m_vs, m_vbp, m_al, m_vfp, vert_mult, vert_pix_total));
if (m_m)
{
m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh);
update_hsync_timer(0);
update_vsync_timer(0);
}
else
{
m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh);//KaRa
m_hsync_timer->enable(0);
m_vsync_timer->enable(0);
}
@ -1607,11 +1601,8 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip
for (area = 0; area < 4; area++)
{
get_graphics_partition(area, &sad, &len, &im, &wd);
if (im || force_bitmap)
{
//get_graphics_partition(area, &sad, &len, &im, &wd);
if(area >= 3) // TODO: most likely to be correct, Quarth (PC-98xx) definitely draws with area 2. We might see an area 3 someday ...
break;

View File

@ -2,7 +2,7 @@
// copyright-holders:Curt Coder
#include "includes/mikromik.h"
#define HORIZONTAL_CHARACTER_PIXELS 10
//-------------------------------------------------
// i8275 crtc display pixels
@ -10,27 +10,45 @@
I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels )
{
UINT8 romdata = m_char_rom->base()[(charcode << 4) | linecount];
int d0 = BIT(romdata, 0);
int d7 = BIT(romdata, 7);
int gpa0 = BIT(gpa, 0);
int llen = m_llen;
int i;
UINT8 data = (romdata << 1) | (d7 & d0);
for (i = 0; i < 8; i++)
if (y < 360 || x >= HORIZONTAL_CHARACTER_PIXELS) // leftmost char on the 25th row is never displayed on actual MikroMikko 1 HW
{
int qh = BIT(data, i);
int video_in = ((((d7 & llen) | !vsp) & !gpa0) & qh) | lten;
int compl_in = rvv;
int hlt_in = hlgt;
UINT8 romdata = m_char_rom->base()[(charcode << 4) | linecount];
// color 0 = black, 1 = dk green, 2 = lt green; on MikroMikko 1, "highlight" is actually the darker shade of green
int color = (hlt_in ? 1 : 2)*(video_in ^ compl_in);
int gpa0 = BIT(gpa, 0); // general purpose attribute 0
int llen = m_llen; // light enable
int compl_in = rvv; // reverse video
int hlt_in = hlgt; // highlight;
int color; // 0 = black, 1 = dk green, 2 = lt green; on MikroMikko 1, "highlight" is actually the darker shade of green
int i, qh, video_in;
bitmap.pix32(y, x + i) = m_palette->pen(color);
int d7 = BIT(romdata, 7); // save MSB (indicates that this is a Visual Attribute or Special Code instead of a normal display character)
int d6 = BIT(romdata, 6); // save also first and last char bitmap bits before shifting out the MSB
int d0 = BIT(romdata, 0);
UINT8 data = (romdata << 1) | (d7 & d0); // get rid of MSB, duplicate LSB for special characters
if (HORIZONTAL_CHARACTER_PIXELS == 10)
{
// Hack to stretch 8 pixels wide character bitmap to 10 pixels on screen.
// This was needed because high res graphics use 800 pixels wide bitmap but
// 80 chars * 8 pixels is only 640 -> characters would cover only 80% of the screen width.
// Step 1: Instead of 8, set MCFG_I8275_CHARACTER_WIDTH(10) at the end of this file
// Step 2: Make sure i8275_device::recompute_parameters() is called in i8275_device::device_start()
// Step 3: Fill in missing 2 pixels in the screen bitmap by repeating last column of the char bitmap
// (works better with MikroMikko 1 font than duplicating the first and the last column)
qh = d7 & d6; // extend pixels on the right side only if there were two adjacent ones before shifting out the MSB
video_in = ((((d7 & llen) | !vsp) & !gpa0) & qh) | lten;
color = (hlt_in ? 1 : 2)*(video_in ^ compl_in);
bitmap.pix32(y, x + 8) = m_palette->pen(color);
bitmap.pix32(y, x + 9) = m_palette->pen(color);
}
for (i = 0; i < 8; ++i) // ...and now the actual character bitmap bits for this scanline
{
qh = BIT(data, i);
video_in = ((((d7 & llen) | !vsp) & !gpa0) & qh) | lten;
color = (hlt_in ? 1 : 2)*(video_in ^ compl_in);
bitmap.pix32(y, x + i) = m_palette->pen(color);
}
}
}
@ -106,15 +124,15 @@ MACHINE_CONFIG_FRAGMENT( mm1m6_video )
MCFG_SCREEN_ADD( SCREEN_TAG, RASTER )
MCFG_SCREEN_REFRESH_RATE( 50 )
MCFG_SCREEN_UPDATE_DRIVER(mm1_state, screen_update)
MCFG_SCREEN_SIZE( 800, 400 )
MCFG_SCREEN_VISIBLE_AREA( 0, 800-1, 0, 400-1 )
MCFG_SCREEN_SIZE( 800, 375 ) //KaRa (25 text rows * 15 vertical pixels / character)
MCFG_SCREEN_VISIBLE_AREA( 0, 800-1, 0, 375-1 ) //KaRa
//MCFG_SCREEN_RAW_PARAMS(XTAL_18_720MHz, ...)
MCFG_GFXDECODE_ADD("gfxdecode", "palette", mm1)
MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette")
MCFG_DEVICE_ADD(I8275_TAG, I8275, XTAL_18_720MHz/8)
MCFG_I8275_CHARACTER_WIDTH(8)
MCFG_I8275_CHARACTER_WIDTH(HORIZONTAL_CHARACTER_PIXELS)
MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(mm1_state, crtc_display_pixels)
MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w))
MCFG_I8275_VRTC_CALLBACK(DEVWRITELINE(UPD7220_TAG, upd7220_device, ext_sync_w))