UINT16 crtc6845_get_ma(int which) { crtc6845_state *chip = &crtc6845; UINT16 ret; if (chip->has_valid_parameters) { /* get the current raster positions and clamp them to the visible region */ int y = video_screen_get_vpos(0); int x = video_screen_get_hpos(0); /* since the MA counter stops in the blanking regions, if we are in a VBLANK, both X and Y are at their max */ if ((y > chip->last_max_y) || (x > chip->last_max_x)) x = chip->last_max_x; if (y > chip->last_max_y) y = chip->last_max_y; ret = (chip->start_addr + (y / (chip->max_ras_addr + 1)) * chip->horiz_disp + (x / chip->intf->hpixels_per_column)) & 0x3fff; } else ret = 0; return ret; }
static int is_display_enabled(crtc6845_state *chip) { UINT16 y = video_screen_get_vpos(chip->intf->scrnum); UINT16 x = video_screen_get_hpos(chip->intf->scrnum); return (y <= chip->last_max_y) && (x <= chip->last_max_x); }
int video_screen_get_hblank(int scrnum) { int hpos = video_screen_get_hpos(scrnum); return (hpos < Machine->screen[scrnum].visarea.min_x || hpos > Machine->screen[scrnum].visarea.max_x); }
static TIMER_CALLBACK( vblank_interrupt_callback ) { const device_config *upd4990a = devtag_get_device(machine, "upd4990a"); if (LOG_VIDEO_SYSTEM) logerror("+++ VBLANK @ %d,%d\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); /* add a timer tick to the pd4990a */ upd4990a_addretrace(upd4990a); vblank_interrupt_pending = 1; update_interrupts(machine); /* set timer for next screen */ timer_adjust_oneshot(vblank_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, NEOGEO_VBSTART, 0), 0); }
static TIMER_CALLBACK( display_position_interrupt_callback ) { if (LOG_VIDEO_SYSTEM) logerror("--- Scanline @ %d,%d\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); if (display_position_interrupt_control & IRQ2CTRL_ENABLE) { if (LOG_VIDEO_SYSTEM) logerror("*** Scanline interrupt (IRQ2) *** y: %02x x: %02x\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); display_position_interrupt_pending = 1; update_interrupts(machine); } if (display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_REPEAT) { if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_REPEAT "); adjust_display_position_interrupt_timer(machine); } }
static void adjust_display_position_interrupt_timer(running_machine *machine) { if ((display_counter + 1) != 0) { attotime period = attotime_mul(ATTOTIME_IN_HZ(NEOGEO_PIXEL_CLOCK), display_counter + 1); if (LOG_VIDEO_SYSTEM) logerror("adjust_display_position_interrupt_timer current y: %02x current x: %02x target y: %x target x: %x\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen), (display_counter + 1) / NEOGEO_HTOTAL, (display_counter + 1) % NEOGEO_HTOTAL); timer_adjust_oneshot(display_position_interrupt_timer, period, 0); } }