#define SPRBORDER 0
-#define EXTRAHEIGHT_EXTREME 28
-
#define LORES_TO_SHRES_SHIFT 2
#ifdef SERIAL_PORT
int linear_vpos, linear_vpos_vb_start, linear_vpos_vb_end, linear_hpos, linear_vpos_prev[3], linear_hpos_prev[3];
static int linear_vb_offset;
static int linear_vpos_vsync;
-int vsync_start_offset;
int linear_display_vpos;
int current_linear_vpos, current_linear_hpos;
static int current_linear_hblen, current_linear_hblen_temp;
int denisehtotal;
static int maxvpos_total = 511;
-int minfirstline = VBLANK_ENDLINE_PAL;
-int minfirstline_linear = VBLANK_ENDLINE_PAL;
+int minfirstline;
+int minfirstline_linear;
float vblank_hz = VBLANK_HZ_PAL, fake_vblank_hz, vblank_hz_stored, vblank_hz_nom;
float hblank_hz;
static float vblank_hz_lof, vblank_hz_shf, vblank_hz_lace;
int hiddenbottomv = display_vblankend_skip;
int maxv = current_linear_vpos - (hiddentopv + hiddenbottomv) + 1;
linear_vpos_vb_end = current_linear_vpos_vb_end - display_vblankstart_skip - 1;
+ minfirstline = vblines - (display_vblankstart_skip > 0 ? display_vblankstart_skip : 0) - 1;
+ minfirstline_linear = minfirstline - LINES_AFTER_VSYNC;
if (currprefs.gfx_overscanmode >= OVERSCANMODE_ULTRA) {
maxv = current_linear_vpos;
linear_vpos_vb_end = 0;
if (!isntsc) {
maxvpos = MAXVPOS_PAL;
maxhpos = MAXHPOS_PAL;
- minfirstline = VBLANK_STOP_PAL;
+ //minfirstline = VBLANK_STOP_PAL;
vblank_hz_nom = vblank_hz = CHIPSET_CLOCK_PAL / ((float)display_maxvpos * display_maxhpos);
} else {
maxvpos = MAXVPOS_NTSC;
maxhpos = MAXHPOS_NTSC;
- minfirstline = VBLANK_STOP_NTSC;
+ //minfirstline = VBLANK_STOP_NTSC;
vblank_hz_nom = vblank_hz = CHIPSET_CLOCK_NTSC / ((float)display_maxvpos * display_maxhpos);
halfhpos = (beamcon0 & BEAMCON0_LOLDIS) ? 0 : 0.5f;
}
maxhpos_display = hsync_ccks * 2;
display_hstart_cyclewait_start = 0;
display_hstart_cyclewait_end = 0;
- minfirstline = 0;
+ //minfirstline = 0;
}
if (display_hstart_cyclewait_start < 0) {
maxhpos_display += currprefs.gfx_extrawidth;
}
- //if (hsstop_detect < 0) {
- // hsstop_detect = 0;
- //}
- if (minfirstline < 0) {
- minfirstline = 0;
- }
-
int vbstart = linear_vpos_vblank_end;
if (currprefs.cs_hvcsync >= HVSYNC_SYNCPOS) {
vbstart = LINES_AFTER_VSYNC;
- minfirstline = vbstart;
}
- minfirstline_linear = vbstart;
maxvpos_display_vsync = 0;
display_vblankstart_skip = 0;
display_vblankend_skip = 0;
if (currprefs.gfx_overscanmode >= OVERSCANMODE_ULTRA) {
vsync_startline = LINES_AFTER_VSYNC;
- minfirstline = 0;
- minfirstline_linear = 0;
maxvpos_display_vsync = vsync_startline;
display_vblankstart_skip = -3000;
} else if (currprefs.gfx_overscanmode == OVERSCANMODE_EXTREME) {
- minfirstline_linear -= EXTRAHEIGHT_EXTREME / 2;
- minfirstline -= EXTRAHEIGHT_EXTREME / 2;
display_vblankstart_skip = vbstart;
display_vblankend_skip = 3;
maxvpos_display_vsync += 2;
} else if (currprefs.gfx_overscanmode == OVERSCANMODE_BROADCAST) {
- minfirstline_linear -= 0;
maxvpos_display_vsync++;
display_vblankstart_skip = -1;
display_vblankend_skip = 2;
display_vblankstart_skip = -1;
display_vblankend_skip = 2;
}
- if (minfirstline_linear < 0) {
- minfirstline_linear += current_linear_vpos_nom;
- }
+#if 0
if ((beamcon0 & BEAMCON0_VARVBEN) && (beamcon0 & bemcon0_vsync_mask)) {
if (minfirstline < vsync_startline) {
minfirstline = vsync_startline;
}
}
}
+#endif
if (beamcon0 & (BEAMCON0_VARVBEN | bemcon0_vsync_mask)) {
programmedmode = 2;
}
display_hstart_cyclewait_end = 0;
}
- if (minfirstline < vsync_startline) {
- minfirstline = vsync_startline;
- }
-
- if (minfirstline >= vsync_lines) {
- minfirstline = vsync_lines - 1;
- }
-
- if (beamcon0 & bemcon0_vsync_mask) {
- if (minfirstline < vsync_startline) {
- minfirstline = vsync_startline;
- }
- }
+// if (minfirstline < vsync_startline) {
+// minfirstline = vsync_startline;
+// }
+// if (minfirstline >= vsync_lines) {
+// minfirstline = vsync_lines - 1;
+// }
+// if (beamcon0 & bemcon0_vsync_mask) {
+// if (minfirstline < vsync_startline) {
+// minfirstline = vsync_startline;
+// }
+// }
if (beamcon0 & BEAMCON0_VARBEAMEN) {
float half = (beamcon0 & BEAMCON0_PAL) ? 0: ((beamcon0 & BEAMCON0_LOLDIS) ? 0 : 0.5f);
}
vb_end_detect = false;
linear_vpos = 0;
-
int off = currprefs.cs_hvcsync >= HVSYNC_SYNCPOS ? LINES_AFTER_VSYNC : linear_vb_offset;
- vsync_start_offset = -off;
-
+ minfirstline_linear = off;
}
}
static uae_u8 *xlinebuffer2_start, *xlinebuffer2_end;
static uae_u8 *xlinebuffer_genlock_start, *xlinebuffer_genlock_end;
-static int *amiga2aspect_line_map, *native2amiga_line_map;
-static int native2amiga_line_map_height;
static uae_u8 *row_map_genlock_buffer;
static uae_u8 row_tmp8[MAX_PIXELS_PER_LINE * 32 / 8];
static uae_u8 row_tmp8g[MAX_PIXELS_PER_LINE * 32 / 8];
bool direct_rgb;
-static int linedbl, linedbld;
+static int linedbl;
int interlace_seen;
int detected_screen_resolution;
static int linear_denise_frame_hbstrt_sel, linear_denise_frame_hbstop_sel;
static bool denise_blanking_changed;
static int linear_denise_strobe_offset;
+static int denise_strobe_offset, horizontalzerooffset;
static int denise_visible_lines, denise_visible_lines_counted;
static uae_u16 hbstrt_denise_reg, hbstop_denise_reg;
static uae_u16 fmode_denise, denise_bplfmode, denise_sprfmode;
int coord_native_to_amiga_x(int x)
{
- x += visible_left_border;
+ x += horizontalzerooffset / 2;
return x;
}
int coord_native_to_amiga_y(int y)
{
- if (!native2amiga_line_map || y < 0) {
- return 0;
- }
- if (y >= native2amiga_line_map_height) {
- y = native2amiga_line_map_height - 1;
- }
- return native2amiga_line_map[y];
+ y += min_ypos_for_screen;
+ y >>= linedbl;
+ return y;
}
void notice_screen_contents_lost(int monid)
y2 = plflastline_total + 1;
y1 = plffirstline_total;
- if (minfirstline > y1)
- y1 = minfirstline;
+ if (minfirstline_linear > y1)
+ y1 = minfirstline_linear;
h = y2 - y1;
- dy = y1 - minfirstline;
+ dy = y1 - minfirstline_linear;
if (*pw > 0)
w = *pw;
}
}
-static void init_aspect_maps(void)
-{
- struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
- struct vidbuffer *vb = vidinfo->inbuffer;
- int i, maxl, h;
-
- linedbld = linedbl = currprefs.gfx_vresolution;
- if (doublescan > 0 && interlace_seen <= 0) {
- linedbl = 0;
- linedbld = 1;
- }
- maxl = (MAXVPOS + 1) << linedbld;
- min_ypos_for_screen = minfirstline << linedbl;
- max_drawn_amiga_line = -1;
-
- vidinfo->xchange = 1 << (RES_MAX - currprefs.gfx_resolution);
- vidinfo->ychange = linedbl ? 1 : 2;
-
- visible_left_start = 0;
- visible_right_stop = MAX_STOP;
- visible_top_start = 0;
- visible_bottom_stop = MAX_STOP;
-
- h = vb->height_allocated;
- if (h == 0)
- /* Do nothing if the gfx driver hasn't initialized the screen yet */
- return;
-
- if (native2amiga_line_map)
- xfree (native2amiga_line_map);
- if (amiga2aspect_line_map)
- xfree (amiga2aspect_line_map);
-
- /* At least for this array the +1 is necessary. */
- native2amiga_line_map_height = h;
- amiga2aspect_line_map = xmalloc (int, (MAXVPOS + 1) * 2 + 1);
- native2amiga_line_map = xmalloc (int, native2amiga_line_map_height);
-
- for (i = 0; i < maxl; i++) {
- int v = i - min_ypos_for_screen;
- if (v >= h && max_drawn_amiga_line < 0)
- max_drawn_amiga_line = v;
- if (i < min_ypos_for_screen || v >= native2amiga_line_map_height)
- v = -1;
- amiga2aspect_line_map[i] = v;
- }
- if (max_drawn_amiga_line < 0)
- max_drawn_amiga_line = maxl - min_ypos_for_screen;
-
- for (i = 0; i < native2amiga_line_map_height; i++)
- native2amiga_line_map[i] = -1;
-
- for (i = maxl - 1; i >= min_ypos_for_screen; i--) {
- int j;
- if (amiga2aspect_line_map[i] == -1)
- continue;
- for (j = amiga2aspect_line_map[i]; j < native2amiga_line_map_height && native2amiga_line_map[j] == -1; j++)
- native2amiga_line_map[j] = i >> linedbl;
- }
-}
-
void init_row_map(void)
{
struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
oldgenlock = init_genlock_data;
oldburst = row_map_color_burst_buffer ? 1 : 0;
- init_aspect_maps();
+ int linedbld = currprefs.gfx_vresolution;
+ linedbl = linedbld;
+ if (doublescan > 0 && interlace_seen > 0) {
+ linedbl *= 2;
+ }
+ int maxl = (MAXVPOS + 1) << linedbld;
+ max_drawn_amiga_line = -1;
+
+ vidinfo->xchange = 1 << (RES_MAX - currprefs.gfx_resolution);
+ vidinfo->ychange = linedbl ? 1 : 2;
+
+ visible_left_start = 0;
+ visible_right_stop = MAX_STOP;
+ visible_top_start = 0;
+ visible_bottom_stop = MAX_STOP;
}
static bool cancenter(void)
}
vidinfo->inbuffer->xoffset = visible_left_border << (RES_MAX - currprefs.gfx_resolution);
- vidinfo->inbuffer->yoffset = (-vsync_start_offset) << VRES_MAX;
+ vidinfo->inbuffer->yoffset = minfirstline_linear << VRES_MAX;
int linedbl = currprefs.gfx_vresolution;
if (doublescan > 0 && interlace_seen <= 0) {
bool redraw = false;
struct amigadisplay *ad = &adisplays[monid];
struct vidbuf_description *vidinfo = &adisplays[monid].gfxvidinfo;
- if (vidinfo->inbuffer && vidinfo->inbuffer->height_allocated && amiga2aspect_line_map) {
+ if (vidinfo->inbuffer && vidinfo->inbuffer->height_allocated) {
notice_screen_contents_lost(monid);
if (!ad->picasso_on) {
redraw_frame();
}
previous_strobe = rd->rga;
linear_denise_strobe_offset = rd->v * 8;
+ denise_strobe_offset = internal_pixel_cnt;
reset_strlong();
spr_nearest();
}
}
frame_internal_pixel_cnt = internal_pixel_cnt;
+ horizontalzerooffset = internal_pixel_cnt - denise_strobe_offset;
+ horizontalzerooffset += internal_pixel_start_cnt;
// detect horizontal blanking
if (!denise_vblank_active) {