static TIMER_CALLBACK( display_enable_changed_timer_cb ) { crtc6845_state *chip = ptr; /* call the callback function -- we know it exists */ chip->intf->display_enable_changed(is_display_enabled(chip)); update_timer(chip); }
static TIMER_CALLBACK( de_changed_timer_cb ) { device_t *device = (device_t *)ptr; crtc_ega_t *crtc_ega = get_safe_token(device); /* call the callback function -- we know it exists */ crtc_ega->intf->on_de_changed(device, is_display_enabled(crtc_ega)); update_de_changed_timer(crtc_ega); }
static void update_timer(crtc6845_state *chip) { INT16 next_y; UINT16 next_x; attotime duration; if (chip->has_valid_parameters && (chip->display_enable_changed_timer != 0)) { if (is_display_enabled(chip)) { /* we are in a display region, get the location of the next blanking start */ /* normally, it's at end the current raster line */ next_y = video_screen_get_vpos(chip->intf->scrnum); next_x = chip->last_max_x + 1; /* but if visible width = horiz_total, then we need to go to the beginning of VBLANK */ if (next_x == chip->last_horiz_total) { next_y = chip->last_max_y + 1; next_x = 0; /* abnormal case, no vertical blanking, either */ if (next_y == chip->last_vert_total) next_y = -1; } } else { /* we are in a blanking region, get the location of the next display start */ next_x = 0; next_y = (video_screen_get_vpos(chip->intf->scrnum) + 1) % chip->last_vert_total; /* if we would now fall in the vertical blanking, we need to go to the top of the screen */ if (next_y > chip->last_max_y) next_y = 0; } if (next_y != -1) duration = video_screen_get_time_until_pos(chip->intf->scrnum, next_y, next_x); else duration = attotime_never; timer_adjust(chip->display_enable_changed_timer, duration, 0, attotime_never); } }
static void update_de_changed_timer(crtc_ega_t *crtc_ega) { if (crtc_ega->has_valid_parameters && (crtc_ega->de_changed_timer != NULL)) { INT16 next_y; UINT16 next_x; attotime duration; /* we are in a display region, get the location of the next blanking start */ if (is_display_enabled(crtc_ega)) { /* normally, it's at end the current raster line */ next_y = crtc_ega->screen->vpos(); next_x = crtc_ega->max_visible_x + 1; /* but if visible width = horiz_pix_total, then we need to go to the beginning of VBLANK */ if (next_x == crtc_ega->horiz_pix_total) { next_y = crtc_ega->max_visible_y + 1; next_x = 0; /* abnormal case, no vertical blanking, either */ if (next_y == crtc_ega->vert_pix_total) next_y = -1; } } /* we are in a blanking region, get the location of the next display start */ else { next_x = 0; next_y = (crtc_ega->screen->vpos() + 1) % crtc_ega->vert_pix_total; /* if we would now fall in the vertical blanking, we need to go to the top of the screen */ if (next_y > crtc_ega->max_visible_y) next_y = 0; } if (next_y != -1) duration = crtc_ega->screen->time_until_pos(next_y, next_x); else duration = attotime::never; crtc_ega->de_changed_timer->adjust(duration); } }