fix MikroMikko 1 video

This commit is contained in:
kara1001000 2015-10-09 19:20:17 +03:00
parent 986b601324
commit e821f095d5
3 changed files with 42 additions and 22 deletions

View File

@ -373,6 +373,18 @@ inline void upd7220_device::update_blank_timer(int state)
}
//-------------------------------------------------
// static_set_visarea - configuration helper to
// set the visible area of the screen that is
// used by recompute_parameters()
//-------------------------------------------------
void upd7220_device::static_set_visible_area_offsets(device_t &device, INT16 dminx, INT16 dmaxx, INT16 dminy, INT16 dmaxy)
{
downcast<upd7220_device &>(device).m_visarea_offset.set(dminx, dmaxx, dminy, dmaxy);
}
//-------------------------------------------------
// recompute_parameters -
//-------------------------------------------------
@ -399,10 +411,11 @@ inline void upd7220_device::recompute_parameters()
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 = 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
visarea.min_x = m_visarea_offset.min_x; //(m_hs + m_hbp) * 8;
visarea.min_y = m_vbp + m_visarea_offset.min_y; // setting this to m_vbp by default; this works at least for pc9801 software (e.g. Dragon Buster) that uses vbp to offset the slave 7220 start line from the master
visarea.max_x = m_aw * horiz_mult - 1 + m_visarea_offset.max_x; //horiz_pix_total - (m_hfp * 8) - 1;
visarea.max_y = m_al * vert_mult + m_vbp - 1 + m_visarea_offset.max_y; //vert_pix_total - m_vfp - 1;
logerror("*** %d, %d, %d, %d", m_visarea_offset.min_y, m_visarea_offset.max_y, visarea.min_y, visarea.max_y);
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));
@ -416,7 +429,7 @@ inline void upd7220_device::recompute_parameters()
}
else
{
m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh);//KaRa
m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh);
m_hsync_timer->enable(0);
m_vsync_timer->enable(0);
}
@ -629,6 +642,7 @@ upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, d
m_hs(0),
m_hfp(0),
m_hbp(0),
m_visarea_offset(0, 0, 0, 0),
m_dc(0),
m_sc(0),
m_br(0),

View File

@ -64,6 +64,8 @@
#define MCFG_UPD7220_BLANK_CALLBACK(_write) \
devcb = &upd7220_device::set_blank_wr_callback(*device, DEVCB_##_write);
#define MCFG_UPD7220_VISIBLE_AREA_OFFSET(_dminx, _dmaxx, _dminy, _dmaxy) \
upd7220_device::static_set_visible_area_offsets(*device, _dminx, _dmaxx, _dminy, _dmaxy);
//**************************************************************************
@ -86,6 +88,7 @@ public:
static void static_set_display_pixels_callback(device_t &device, upd7220_display_pixels_delegate callback) { downcast<upd7220_device &>(device).m_display_cb = callback; }
static void static_set_draw_text_callback(device_t &device, upd7220_draw_text_delegate callback) { downcast<upd7220_device &>(device).m_draw_text_cb = callback; }
static void static_set_visible_area_offsets(device_t &device, INT16 dminx, INT16 dmaxx, INT16 dminy, INT16 dmaxy);
template<class _Object> static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_drq.set_callback(object); }
template<class _Object> static devcb_base &set_hsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_hsync.set_callback(object); }
@ -194,6 +197,8 @@ private:
int m_hfp; // horizontal front porch width - 1
int m_hbp; // horizontal back porch width - 1
rectangle m_visarea_offset; // device dependend visible area offsets for xmin, ymin, xmax and ymax
int m_dc; // display cursor
int m_sc; // 0 = blinking cursor / 1 = steady cursor
int m_br; // blink rate

View File

@ -10,22 +10,22 @@
I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels )
{
if (y < 360 || x >= HORIZONTAL_CHARACTER_PIXELS) // leftmost char on the 25th row is never displayed on actual MikroMikko 1 HW
UINT8 romdata = m_char_rom->base()[(charcode << 4) | linecount];
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;
int d7 = BIT(romdata, 7); // save MSB (1 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 (y < 360 || x >= HORIZONTAL_CHARACTER_PIXELS || compl_in == 0) // leftmost char on the 25th row is never displayed on actual MikroMikko 1 HW if it's inversed
{
UINT8 romdata = m_char_rom->base()[(charcode << 4) | linecount];
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;
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.
@ -124,8 +124,8 @@ 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, 375 ) //KaRa (25 text rows * 15 vertical pixels / character)
MCFG_SCREEN_VISIBLE_AREA( 0, 800-1, 0, 375-1 ) //KaRa
MCFG_SCREEN_SIZE( 800, 375 ) // (25 text rows * 15 vertical pixels / character)
MCFG_SCREEN_VISIBLE_AREA( 0, 800-1, 0, 375-1 )
//MCFG_SCREEN_RAW_PARAMS(XTAL_18_720MHz, ...)
MCFG_GFXDECODE_ADD("gfxdecode", "palette", mm1)
@ -141,5 +141,6 @@ MACHINE_CONFIG_FRAGMENT( mm1m6_video )
MCFG_DEVICE_ADD(UPD7220_TAG, UPD7220, XTAL_18_720MHz/8)
MCFG_DEVICE_ADDRESS_MAP(AS_0, mm1_upd7220_map)
MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mm1_state, hgdc_display_pixels)
MCFG_UPD7220_VISIBLE_AREA_OFFSET(0, 0, -25, 23) // match the visible area of I8275 output
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
MACHINE_CONFIG_END