MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / hsync_handler

Function hsync_handler

src/custom.cpp:6507–6566  ·  view source on GitHub ↗

executed at start of scanline

Source from the content-addressed store, hash-verified

6505
6506// executed at start of scanline
6507static void hsync_handler(bool vs)
6508{
6509 hsync_handler_pre(vs);
6510 if (vs) {
6511 devices_vsync_pre();
6512 if (savestate_check()) {
6513 uae_reset(0, 0);
6514 return;
6515 }
6516 if (uae_quit_check()) {
6517 return;
6518 }
6519 }
6520 if (vpos == vsync_startline + 1 && !maxvpos_display_vsync_next) {
6521 inputdevice_read_msg(true);
6522 vsync_display_render();
6523 vsync_display_rendered = false;
6524 if ((currprefs.cs_hvcsync == HVSYNC_COMBINED || currprefs.cs_hvcsync == HVSYNC_COMBINED_SYNC) && valid_programmed_mode()) {
6525 if (beamcon0 & (BEAMCON0_VARVSYEN | BEAMCON0_VARCSYEN)) {
6526 lof_display = lof_pdetect;
6527 } else {
6528 lof_display = lof_detect;
6529 }
6530 } else if (currprefs.cs_hvcsync == HVSYNC_HVSYNC || currprefs.cs_hvcsync == HVSYNC_HVSYNC_SYNC) {
6531 if (beamcon0 & BEAMCON0_VARVSYEN) {
6532 lof_display = lof_pdetect;
6533 } else {
6534 lof_display = lof_detect;
6535 }
6536 } else {
6537 if (beamcon0 & BEAMCON0_VARCSYEN) {
6538 lof_display = lof_pdetect;
6539 } else {
6540 lof_display = lof_detect;
6541 }
6542 }
6543 reset_autoscale();
6544 virtual_vsync_check();
6545 last_vsync_evt = get_cycles() + (maxvpos * maxhpos * 3) * CYCLE_UNIT;
6546 display_vsync_counter++;
6547 maxvpos_display_vsync_next = true;
6548 display_hsync_counter = 0;
6549 vsync_start_check();
6550 } else if (vpos != vsync_startline + 1 && maxvpos_display_vsync_next) {
6551 // protect against weird VPOSW writes causing continuous vblanks
6552 maxvpos_display_vsync_next = false;
6553 vsync_start_check();
6554 } else {
6555 display_hsync_counter++;
6556 if (display_hsync_counter > maxvpos) {
6557 display_hsync_counter = 0;
6558 inputdevice_read_msg(true);
6559 vsync_display_render();
6560 vsync_display_rendered = false;
6561 vsync_start_check();
6562 }
6563
6564 }

Callers 2

custom_trigger_startFunction · 0.85
fakehsync_handlerFunction · 0.85

Calls 13

hsync_handler_preFunction · 0.85
devices_vsync_preFunction · 0.85
savestate_checkFunction · 0.85
uae_resetFunction · 0.85
uae_quit_checkFunction · 0.85
inputdevice_read_msgFunction · 0.85
vsync_display_renderFunction · 0.85
valid_programmed_modeFunction · 0.85
reset_autoscaleFunction · 0.85
virtual_vsync_checkFunction · 0.85
get_cyclesFunction · 0.85
vsync_start_checkFunction · 0.85

Tested by

no test coverage detected