UINT32 crtc_ega_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { assert(bitmap.valid()); if (m_has_valid_parameters) { UINT16 y; void *param = NULL; assert(m_update_row != NULL); /* call the set up function if any */ if (m_begin_update != NULL) param = m_begin_update(this, bitmap, cliprect); if (cliprect.min_y == 0) { /* read the start address at the beginning of the frame */ m_current_disp_addr = m_disp_start_addr; } /* for each row in the visible region */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) { /* compute the current raster line */ UINT8 ra = y % (m_max_ras_addr + 1); /* check if the cursor is visible and is on this scanline */ int cursor_visible = m_cursor_state && (ra >= (m_cursor_start_ras & 0x1f)) && ( (ra <= (m_cursor_end_ras & 0x1f)) || ((m_cursor_end_ras & 0x1f) == 0x00 )) && (m_cursor_addr >= m_current_disp_addr) && (m_cursor_addr < (m_current_disp_addr + ( m_horiz_disp + 1 ))); /* compute the cursor X position, or -1 if not visible */ INT8 cursor_x = cursor_visible ? (m_cursor_addr - m_current_disp_addr) : -1; /* call the external system to draw it */ m_update_row(this, bitmap, cliprect, m_current_disp_addr, ra, y, m_horiz_disp + 1, cursor_x, param); /* update MA if the last raster address */ if (ra == m_max_ras_addr) m_current_disp_addr = (m_current_disp_addr + m_horiz_disp + 1) & 0xffff; } /* call the tear down function if any */ if (m_end_update != NULL) m_end_update(this, bitmap, cliprect, param); } else logerror("Invalid crtc_ega screen parameters - display disabled!!!\n"); return 0; }