]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Chipset emulation updates
authorToni Wilen <twilen@winuae.net>
Mon, 10 Mar 2025 18:06:49 +0000 (20:06 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 10 Mar 2025 18:06:49 +0000 (20:06 +0200)
16 files changed:
custom.cpp
drawing.cpp
genlinetoscr.cpp
include/custom.h
include/drawing.h
include/xwin.h
linetoscr_aga_fast.cpp
linetoscr_aga_genlock_fast.cpp
linetoscr_ecs_fast.cpp
linetoscr_ecs_genlock_fast.cpp
newcpu.cpp
od-win32/direct3d.cpp
od-win32/direct3d11.cpp
od-win32/gdirender.cpp
od-win32/win32gfx.cpp
specialmonitors.cpp

index 57a40dcee916c154699509dd017001b699518b44..17c02f80231e6c4c896ee771f8be5ed2dfe3382a 100644 (file)
@@ -1718,24 +1718,10 @@ void compute_framesync(void)
        if (vb->inheight2 < 1)
                vb->inheight2 = 1;
 
-       if (vb->inwidth > vb->width_allocated)
-               vb->inwidth = vb->width_allocated;
-       if (vb->inwidth2 > vb->width_allocated)
-               vb->inwidth2 = vb->width_allocated;
-
-       if (vb->inheight > vb->height_allocated)
-               vb->inheight = vb->height_allocated;
-       if (vb->inheight2 > vb->height_allocated)
-               vb->inheight2 = vb->height_allocated;
-
-       vb->outwidth = vb->inwidth;
-       vb->outheight = vb->inheight;
-
-       if (vb->outwidth > vb->width_allocated)
-               vb->outwidth = vb->width_allocated;
-
-       if (vb->outheight > vb->height_allocated)
-               vb->outheight = vb->height_allocated;
+       if (!vb->hardwiredpositioning) {
+               vb->outwidth = vb->inwidth;
+               vb->outheight = vb->inheight;
+       }
 
        check_nocustom();
 
@@ -1761,12 +1747,29 @@ void compute_framesync(void)
 
        set_config_changed();
 
+       custom_end_drawing();
+
        if (currprefs.monitoremu_mon != 0) {
                target_graphics_buffer_update(currprefs.monitoremu_mon, false);
        }
-       if (target_graphics_buffer_update(0, false)) {
-               reset_drawing();
-       }
+       target_graphics_buffer_update(0, false);
+
+       if (vb->inwidth > vb->width_allocated)
+               vb->inwidth = vb->width_allocated;
+       if (vb->inwidth2 > vb->width_allocated)
+               vb->inwidth2 = vb->width_allocated;
+
+       if (vb->inheight > vb->height_allocated)
+               vb->inheight = vb->height_allocated;
+       if (vb->inheight2 > vb->height_allocated)
+               vb->inheight2 = vb->height_allocated;
+
+       if (vb->outwidth > vb->width_allocated)
+               vb->outwidth = vb->width_allocated;
+
+       if (vb->outheight > vb->height_allocated)
+               vb->outheight = vb->height_allocated;
+
        resetfulllinestate();
 }
 
@@ -6894,6 +6897,10 @@ void custom_reset(bool hardreset, bool keyboardreset)
        resetfulllinestate();
        updateprghpostable();
 
+       if (!has_draw_denise()) {
+               start_draw_denise();
+       }
+
 #ifdef ACTION_REPLAY
        /* Doing this here ensures we can use the 'reset' command from within AR */
        action_replay_reset(hardreset, keyboardreset);
@@ -11063,6 +11070,10 @@ static void draw_line_fast(void)
 
 static void do_draw_line(void)
 {
+       if (!has_draw_denise()) {
+               start_draw_denise();
+       }
+
        if (custom_fastmode_exit) {
                custom_fastmode_exit = 0;
                quick_denise_rga_queue(rga_denise_cycle_line, rga_denise_cycle_start, rga_denise_cycle);
@@ -11297,7 +11308,9 @@ static void custom_trigger_start_nosync(void)
        if (linear_vpos >= maxvpos + lof_store) {
                nosignal_trigger = true;
                linear_vpos = 0;
-               end_draw_denise();
+               if (has_draw_denise()) {
+                       end_draw_denise();
+               }
                if (!custom_disabled) {
                        start_draw_denise();
                }
@@ -11341,7 +11354,9 @@ static void custom_trigger_start(void)
 
        if (vpos == vsync_startline) {
 
-               end_draw_denise();
+               if (has_draw_denise()) {
+                       end_draw_denise();
+               }
 
                linear_vpos_prev[2] = linear_vpos_prev[1];
                linear_vpos_prev[1] = linear_vpos_prev[0];
@@ -12926,3 +12941,12 @@ bool ispal(int *lines)
        }
        return maxvpos_display >= MAXVPOS_NTSC + (MAXVPOS_PAL - MAXVPOS_NTSC) / 2;
 }
+
+void custom_end_drawing(void)
+{
+       draw_denise_line_queue_flush();
+       if (has_draw_denise()) {
+               write_log("flushing denise draw queue\n");
+               end_draw_denise();
+       }
+}
index c215c92062f1926c2e8c9d659f01ef0604e39a53..ef87494c137c55c933b51ef1a64bdde6b1abc67e 100644 (file)
@@ -6,9 +6,9 @@
 *
 * Copyright 1995-2000 Bernd Schmidt
 * Copyright 1995 Alessandro Bissacco
-* Copyright 2000-2024 Toni Wilen
+* Copyright 2000-2025 Toni Wilen
 * 
-* Complete rewrite 2024
+* Complete rewrite 2024-2025
 */
 
 #include "sysconfig.h"
 #include "devices.h"
 #include "gfxboard.h"
 
+#define ENABLE_MULTITHREADED_DENISE 1
 extern int multithread_enabled;
-#define MULTITHREADED_DENISE (multithread_enabled != 0)
+#define MULTITHREADED_DENISE (ENABLE_MULTITHREADED_DENISE && multithread_enabled != 0)
 
 #define BLANK_COLOR 0x000000
 
 #define AUTOSCALE_SPRITES 1
 #define LOL_SHIFT_COLORS 0
 
+#define MAX_RGA_OVERLAPPING_CYCLES 5
 
+uae_u8 *xlinebuffer, *xlinebuffer2;
+uae_u16 *xlinebuffer_genlock;
+
+static int *amiga2aspect_line_map, *native2amiga_line_map;
+static int native2amiga_line_map_height;
+static uae_u8 **row_map;
+static uae_u16 *row_map_genlock_buffer;
+static uae_u8 row_tmp8[MAX_PIXELS_PER_LINE * 32 / 8];
+static uae_u16 row_tmp16[MAX_PIXELS_PER_LINE * 32 / 8];
+static int max_drawn_amiga_line;
+uae_u16 **row_map_genlock;
+uae_u8 *row_map_color_burst_buffer;
 
 static uae_sem_t write_sem, read_sem;
 
 struct denise_rga_queue
 {
        int type;
-       int vpos;
+       int vpos, linear_vpos;
        int gfx_ypos;
        nln_how how;
        uae_u32 linecnt;
@@ -74,6 +88,9 @@ struct denise_rga_queue
 static volatile uae_atomic rga_queue_read, rga_queue_write;
 static int denise_thread_state;
 static struct denise_rga_queue rga_queue[DENISE_RGA_SLOT_CHUNKS];
+static struct denise_rga_queue temp_line;
+static struct denise_rga_queue *this_line;
+static volatile bool thread_debug_lock;
 
 static void quick_denise_rga(int linecnt, int startpos, int endpos)
 {
@@ -90,17 +107,35 @@ static void quick_denise_rga(int linecnt, int startpos, int endpos)
 
 static void denise_handle_quick_strobe(uae_u16 strobe, int offset, int vpos);
 
+static void update_overlapped_cycles(int endpos)
+{
+       for (int i = 0; i <= MAX_RGA_OVERLAPPING_CYCLES; i++) {
+               struct denise_rga *rga = &rga_denise[(endpos - i) & DENISE_RGA_SLOT_MASK];
+               rga->line++;
+       }
+}
+
 static void read_denise_line_queue(void)
 {
        while (rga_queue_read == rga_queue_write) {
                uae_sem_wait(&write_sem);
        }
 
+       if (!thread_debug_lock) {
+               write_log("read_denise_line_queue: queue processed without lock!\n");
+       }
+
        struct denise_rga_queue *q = &rga_queue[rga_queue_read & DENISE_RGA_SLOT_CHUNKS_MASK];
+       this_line = q;
        bool next = false;
 
        //evt_t t1 = read_processor_time();
 
+#if 0
+       sleep_millis(1);
+#endif
+
+
        if (q->type == 0) {
                draw_denise_line(q->gfx_ypos, q->how, q->linecnt, q->startpos, q->total, q->skip, q->skip2, q->dtotal, q->calib_start, q->calib_len, q->lol, q->ls);
                next = true;
@@ -120,11 +155,24 @@ static void read_denise_line_queue(void)
        //write_log("%lld ", (t2 - t1));
 
        if (next) {
-               for (int i = 0; i <= 5; i++) {
-                       struct denise_rga *rga = &rga_denise[(q->endpos - i) & DENISE_RGA_SLOT_MASK];
-                       rga->line++;
-               }
+               update_overlapped_cycles(q->endpos);
+       }
+
+       if (!thread_debug_lock) {
+               write_log("read_denise_line_queue: queue lock was released during draw!\n");
+       }
+
+#if 0
+       struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
+       struct vidbuffer *vb = vidinfo->inbuffer;
+       if (!vb->locked || !vb->bufmem || row_map[0] == NULL) {
+               write_log("read_denise_line_queue: buffer cleared!\n");
+       }
+       for (int i = 0; i < vb->inheight; i++) {
+               uae_u8 *p = row_map[i];
+               *p = 0x12;
        }
+#endif
 
        atomic_inc(&rga_queue_read);
 
@@ -156,13 +204,11 @@ static bool denise_lock(void)
        struct vidbuffer *vb = &vidinfo->drawbuffer;
        struct vidbuffer *vbin = &vidinfo->tempbuffer;
 
-       if (vb->inheight < vbin->inheight || vb->inwidth < vbin->inwidth) {
-               return false;
-       }
-
-       if (!lockscr(vb, false, display_reset > 0)) {
-               notice_screen_contents_lost(monid);
-               return false;
+       if (!vb->locked) {
+               if (!lockscr(vb, false, display_reset > 0)) {
+                       notice_screen_contents_lost(monid);
+                       return false;
+               }
        }
        denise_locked = true;
        return true;
@@ -265,19 +311,6 @@ static uae_u8 *refresh_indicator_buffer;
 static uae_u8 *refresh_indicator_changed, *refresh_indicator_changed_prev;
 static int refresh_indicator_height;
 
-uae_u8 *xlinebuffer, *xlinebuffer2;
-uae_u16 *xlinebuffer_genlock;
-
-static int *amiga2aspect_line_map, *native2amiga_line_map;
-static int native2amiga_line_map_height;
-static uae_u8 **row_map;
-static uae_u16 *row_map_genlock_buffer;
-static uae_u8 row_tmp8[MAX_PIXELS_PER_LINE * 32 / 8];
-static uae_u16 row_tmp16[MAX_PIXELS_PER_LINE * 32 / 8];
-static int max_drawn_amiga_line;
-uae_u16 **row_map_genlock;
-uae_u8 *row_map_color_burst_buffer;
-
 /* Centering variables.  */
 static int min_diwstart, max_diwstop;
 /* The visible window: VISIBLE_LEFT_BORDER contains the left border of the visible
@@ -446,7 +479,7 @@ static int hbstrt_offset, hbstop_offset;
 static int hstrt_offset, hstop_offset;
 static int bpl1dat_trigger_offset;
 static int internal_pixel_cnt, internal_pixel_start_cnt;
-static bool no_denise_lol, denise_strlong_detected;
+static bool no_denise_lol, denise_strlong_seen;
 
 void set_inhibit_frame(int monid, int bit)
 {
@@ -524,7 +557,7 @@ bool isnativevidbuf(int monid)
                return false;
        if (vidinfo->outbuffer == &vidinfo->drawbuffer)
                return true;
-       return vidinfo->outbuffer->nativepositioning;
+       return !vidinfo->outbuffer->hardwiredpositioning;
 }
 
 extern int plffirstline_total, plflastline_total;
@@ -1784,9 +1817,10 @@ static void setspecialmonitorpos(struct vidbuffer *vb)
 
 static void vbcopy(struct vidbuffer *vbout, struct vidbuffer *vbin)
 {
-
-       for (int h = 0; h < vbout->outheight; h++) {
-               memcpy(vbout->bufmem + h * vbout->rowbytes, vbin->bufmem + h * vbin->rowbytes, vbout->outwidth * vbout->pixbytes);
+       if (vbout->locked) {
+               for (int h = 0; h < vbout->height_allocated; h++) {
+                       memcpy(vbout->bufmem + h * vbout->rowbytes, vbin->bufmem + h * vbin->rowbytes, vbout->width_allocated * vbout->pixbytes);
+               }
        }
 }
 
@@ -1828,7 +1862,7 @@ static void finish_drawing_frame(bool drawlines)
                }
                setspecialmonitorpos(m_out);
                if (locked && emulate_specialmonitors(m_in, m_out)) {
-                       if (m_out->nativepositioning) {
+                       if (!m_in->hardwiredpositioning) {
                                setnativeposition(m_out);
                        }
                        if (!ad->specialmonitoron) {
@@ -1840,6 +1874,7 @@ static void finish_drawing_frame(bool drawlines)
                        need_genlock_data = false;
                        if (ad->specialmonitoron) {
                                ad->specialmonitoron = false;
+                               m_in->hardwiredpositioning = false;
                                compute_framesync();
                        }
                        vbcopy(vbout, vbin);
@@ -1863,7 +1898,7 @@ static void finish_drawing_frame(bool drawlines)
                        lts_request = true;
                }
                emulate_genlock(vbin, vbout, aga_genlock_features_zdclken);
-               if (vbout->nativepositioning) {
+               if (!vbout->hardwiredpositioning) {
                        setnativeposition(vbout);
                }
        }
@@ -1891,7 +1926,7 @@ static void finish_drawing_frame(bool drawlines)
                }
                setspecialmonitorpos(vbout);
                emulate_grayscale(vbin, vbout);
-               if (vbout->nativepositioning)
+               if (!vbout->hardwiredpositioning)
                        setnativeposition(vbout);
        }
 
@@ -1992,6 +2027,9 @@ bool vsync_handle_check(void)
        int monid = 0;
        struct amigadisplay *ad = &adisplays[monid];
        int changed = check_prefs_changed_gfx();
+       if (changed) {
+               custom_end_drawing();
+       }
        if (changed > 0) {
                reset_drawing();
                notice_screen_contents_lost(monid);
@@ -2156,17 +2194,20 @@ void allocvidbuffer(int monid, struct vidbuffer *buf, int width, int height, int
        buf->realbufmem = xcalloc(uae_u8, size + 2 * buf->rowbytes);
        buf->bufmem_allocated = buf->bufmem = buf->realbufmem + buf->rowbytes;
        buf->bufmemend = buf->realbufmem + size - buf->rowbytes;
-       buf->bufmem_lockable = true;
 }
 
 void freevidbuffer(int monid, struct vidbuffer *buf)
 {
-       xfree(buf->realbufmem);
-       memset(buf, 0, sizeof (struct vidbuffer));
+       if (!buf->vram_buffer) {
+               xfree(buf->realbufmem);
+               memset(buf, 0, sizeof (struct vidbuffer));
+       }
 }
 
 void reset_drawing(void)
 {
+       custom_end_drawing();
+
        int monid = 0;
        struct amigadisplay *ad = &adisplays[monid];
        struct vidbuf_description *vidinfo = &ad->gfxvidinfo;
@@ -2507,11 +2548,11 @@ static void sprwrite_64(int reg, uae_u64 v)
 #if AUTOSCALE_SPRITES
                /* get upper and lower sprite position if brdsprt enabled */
                if ((s->dataa64 || s->datab64) && bordersprite) {
-                       if (linear_vpos < plffirstline_total) {
-                               plffirstline_total = linear_vpos;
+                       if (this_line->linear_vpos < plffirstline_total) {
+                               plffirstline_total = this_line->linear_vpos;
                        }
-                       if (linear_vpos > plflastline_total) {
-                               plflastline_total = linear_vpos;
+                       if (this_line->linear_vpos > plflastline_total) {
+                               plflastline_total = this_line->linear_vpos;
                        }
                        int x = s->xpos;;
                        if (diwfirstword_total > x && x >= (48 << RES_MAX)) {
@@ -2560,11 +2601,11 @@ static void sprwrite(int reg, uae_u32 v)
 #if AUTOSCALE_SPRITES
                        /* get upper and lower sprite position if brdsprt enabled */
                        if ((s->dataa || s->datab) && bordersprite) {
-                               if (linear_vpos < plffirstline_total) {
-                                       plffirstline_total = linear_vpos;
+                               if (this_line->linear_vpos < plffirstline_total) {
+                                       plffirstline_total = this_line->linear_vpos;
                                }
-                               if (linear_vpos > plflastline_total) {
-                                       plflastline_total = linear_vpos;
+                               if (this_line->linear_vpos > plflastline_total) {
+                                       plflastline_total = this_line->linear_vpos;
                                }
                                int x = s->xpos;;
                                if (diwfirstword_total > x && x >= (48 << RES_MAX)) {
@@ -3172,7 +3213,7 @@ static void expand_clxcon2(uae_u16 v)
 
 static void set_strlong(void)
 {
-       denise_strlong_detected = true;
+       denise_strlong_seen = true;
        if (no_denise_lol) {
                denise_strlong = false;
                denise_strlong_fast = true;
@@ -3206,7 +3247,7 @@ void denise_reset(bool hard)
        static int dummyint = 0;
        static struct dma_rec dummydrec = { 0 };
 
-       draw_denise_line_queue_flush();
+       custom_end_drawing();
        dummyint = 0;
        memset(&dummydrec, 0, sizeof(dummydrec));
        memset(chunky_out, 0, sizeof(chunky_out));
@@ -3507,7 +3548,7 @@ static void bpldat_docopy(void)
        }
 }
 
-static void expand_drga_early2x(struct denise_rgard)
+static void expand_drga_early2x(struct denise_rga *rd)
 {
        switch (rd->rga)
        {
@@ -3517,7 +3558,7 @@ static void expand_drga_early2x(struct denise_rga* rd)
        }
 }
 
-static void expand_drga_early(struct denise_rgard)
+static void expand_drga_early(struct denise_rga *rd)
 {
        if (rd->rga >= 0x180 && rd->rga < 0x180 + 32 * 2) {
                int idx = (rd->rga - 0x180) / 2;
@@ -3650,14 +3691,14 @@ static void handle_strobes(struct denise_rga *rd)
                }
        }
        if (rd->rga == 0x03c && previous_strobe != 0x03c) {
-               linear_denise_vbstrt = linear_vpos;
+               linear_denise_vbstrt = this_line->linear_vpos;
                if (denise_vblank_extra) {
-                       denise_vblank_extra_vbstrt = linear_vpos + denise_vblank_extra;
+                       denise_vblank_extra_vbstrt = this_line->linear_vpos + denise_vblank_extra;
                }
        } else if (rd->rga != 0x03c && previous_strobe == 0x03c) {
-               linear_denise_vbstop = linear_vpos;
+               linear_denise_vbstop = this_line->linear_vpos;
                if (denise_vblank_extra) {
-                       denise_vblank_extra_vbstop = linear_vpos - denise_vblank_extra;
+                       denise_vblank_extra_vbstop = this_line->linear_vpos - denise_vblank_extra;
                }
                denise_visible_lines = 0;
        }
@@ -4898,6 +4939,11 @@ void denise_restore_registers(void)
        expand_fmode(s_fmode);
 }
 
+bool has_draw_denise(void)
+{
+       return thread_debug_lock;
+}
+
 bool start_draw_denise(void)
 {
        struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
@@ -4905,10 +4951,16 @@ bool start_draw_denise(void)
 
        vidinfo->outbuffer = vb;
 
+       if (thread_debug_lock) {
+               write_log("start_draw_denise: thread_debug_lock already set!");
+       }
+
        if (!lockscr(vb, false, display_reset > 0)) {
                return false;
        }
 
+       thread_debug_lock = true;
+
        if (vidinfo->tempbuffer.bufmem) {
                vidinfo->inbuffer = &vidinfo->tempbuffer;
        } else {
@@ -4932,9 +4984,15 @@ void end_draw_denise(void)
        struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
        struct vidbuffer *vb = &vidinfo->drawbuffer;
 
+       if (!thread_debug_lock) {
+               write_log("end_draw_denise: thread_debug_lock not set!\n");
+       }
+
        draw_denise_line_queue_flush();
        denise_mark_last_line();
 
+       thread_debug_lock = false;
+
        unlockscr(vb, denise_y_start, denise_y_end);
 
        if (vidinfo->outbuffer != vidinfo->inbuffer) {
@@ -5016,7 +5074,7 @@ static uint32_t decode_denise_specials_debug(uint32_t v, int inc)
 {
        *buf_d++ = v;
        if (decode_specials_debug > 1) {
-               int t = ((inc >> 1) + linear_vpos + 1) & 3;
+               int t = ((inc >> 1) + this_line->linear_vpos + 1) & 3;
                if (denise_blank_active2) {
                        if (t == 0) {
                                v = 0;
@@ -5148,14 +5206,14 @@ static void get_line(int gfx_ypos, enum nln_how how)
 
        if (gfx_ypos < prevline - 1) {
 
-               if (!denise_strlong_detected && strlong_emulation) {
+               if (!denise_strlong_seen && strlong_emulation) {
                        strlong_emulation = false;
                        write_log("STRLONG strobe emulation deactivated.\n");
                        select_lts();
                        denise_lol_shift_enable = false;
                        denise_lol_shift_prev = 0;
                }
-               denise_strlong_detected = false;
+               denise_strlong_seen = false;
 
                // clear remaining lines if mode height is now smaller than previously
                struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
@@ -5288,7 +5346,7 @@ void draw_denise_line(int gfx_ypos, enum nln_how how, uae_u32 linecnt, int start
        internal_pixel_cnt = 0;
        internal_pixel_start_cnt = 0;
 
-       if (denise_pixtotal_max == -0x7fffffff || ((linear_vpos >= denise_vblank_extra_vbstop || linear_vpos < denise_vblank_extra_vbstrt) && currprefs.gfx_overscanmode < OVERSCANMODE_ULTRA)) {
+       if (denise_pixtotal_max == -0x7fffffff || ((this_line->linear_vpos >= denise_vblank_extra_vbstop || this_line->linear_vpos < denise_vblank_extra_vbstrt) && currprefs.gfx_overscanmode < OVERSCANMODE_ULTRA)) {
 
                // don't draw vertical blanking if not ultra extreme overscan
                while (denise_cck < denise_total) {
@@ -5370,12 +5428,12 @@ void draw_denise_line(int gfx_ypos, enum nln_how how, uae_u32 linecnt, int start
                int rshift = RES_MAX - hresolution;
                int hbstrt_offset2 = (hbstrt_offset - internal_pixel_start_cnt) >> rshift;
                int hbstop_offset2 = (hbstop_offset - internal_pixel_start_cnt) >> rshift;
-               uae_u32 *hbstrt_ptr1 = hbstrt_offset >= 0 ? buf1t + hbstrt_offset2 : NULL;
-               uae_u32 *hbstop_ptr1 = hbstop_offset >= 0 ? buf1t + hbstop_offset2 : NULL;
-               uae_u32 *hbstrt_ptr2 = buf2 && hbstrt_offset >= 0 ? buf2t + hbstrt_offset2 : NULL;
-               uae_u32 *hbstop_ptr2 = buf2 && hbstop_offset >= 0 ? buf2t + hbstop_offset2 : NULL;
+               uae_u32 *hbstrt_ptr1 = hbstrt_offset2 >= 0 ? buf1t + hbstrt_offset2 : NULL;
+               uae_u32 *hbstop_ptr1 = hbstop_offset2 >= 0 ? buf1t + hbstop_offset2 : NULL;
+               uae_u32 *hbstrt_ptr2 = buf2 && hbstrt_offset2 >= 0 ? buf2t + hbstrt_offset2 : NULL;
+               uae_u32 *hbstop_ptr2 = buf2 && hbstop_offset2 >= 0 ? buf2t + hbstop_offset2 : NULL;
                // blank last pixel row if normal overscan mode, it might have NTSC artifacts
-               if (denise_pixtotal_max != -0x7fffffff && hbstrt_ptr1 && currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN && !ecs_denise) {
+               if (denise_strlong_seen && denise_pixtotal_max != -0x7fffffff && hbstrt_ptr1 && currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN && !ecs_denise) {
                        int add = 1 << hresolution;
                        uae_u32 *p1 = hbstrt_ptr1 - denise_lol_shift_prev;
                        uae_u32 *p2 = hbstrt_ptr2 - denise_lol_shift_prev;
@@ -5384,7 +5442,7 @@ void draw_denise_line(int gfx_ypos, enum nln_how how, uae_u32 linecnt, int start
                                *p2++ = BLANK_COLOR;
                        }
                }
-               if (1 && no_denise_lol && denise_pixtotal_max != -0x7fffffff && hbstrt_ptr1 && !lol_fast && denise_strlong_detected) {
+               if (1 && no_denise_lol && denise_pixtotal_max != -0x7fffffff && hbstrt_ptr1 && !lol_fast && denise_strlong_seen) {
                        int add = 1 << hresolution;
                        uae_u32 *p1 = hbstrt_ptr1 - 2 * add;
                        uae_u32 *p2 = hbstrt_ptr2 - 2 * add;
@@ -5401,44 +5459,58 @@ void draw_denise_line(int gfx_ypos, enum nln_how how, uae_u32 linecnt, int start
                        }
                        w <<= hresolution;
                        for (int i = 0; i < 4; i++) {
-                               uae_u32 *ptr, *ptr2;
+                               uae_u32 *ptr, *ptrs, *ptre;
                                int lolshift = 0;
                                switch (i)
                                {
                                        case 0:
                                                ptr = hbstrt_ptr1;
-                                               ptr2 = buf1t;
+                                               ptrs = buf1t;
+                                               ptre = buf1;
                                                lolshift = lol ? -add : 0;
                                                break;
                                        case 1:
                                                ptr = hbstrt_ptr2;
-                                               ptr2 = buf2t;
+                                               ptrs = buf2t;
+                                               ptre = buf2;
                                                lolshift = lol ? -add : 0;
                                                break;
                                        case 2:
                                                ptr = hbstop_ptr1;
-                                               ptr2 = buf1t;
+                                               ptrs = buf1t;
+                                               ptre = buf1;
                                                lolshift = lol ? add : 0;
                                                break;
                                        case 3:
                                                ptr = hbstop_ptr2;
-                                               ptr2 = buf2t;
+                                               ptrs = buf2t;
+                                               ptre = buf2;
                                                lolshift = lol ? add : 0;
                                                break;
                                }
                                if (ptr) {
                                        uae_u32 *p1 = ptr - lolshift;
+                                       int ww = w;
                                        if (i >= 2) {
-                                               memset(p1, 0, w * sizeof(uae_u32));
+                                               if (p1 + ww > ptrs && p1 + ww < ptre) {
+                                                       if (p1 < ptrs) {
+                                                               int wadd = addrdiff(p1, ptrs);
+                                                               ww -= wadd;
+                                                               p1 += add;
+                                                       }
+                                                       memset(p1, 0, ww * sizeof(uae_u32));
+                                                       if (bufg) {
+                                                               uae_u16 *gp1 = (p1 - ptrs) + bufg;
+                                                               memset(gp1, 0, ww * sizeof(uae_u16));
+                                                       }
+                                               }
                                        } else {
-                                               memset(p1 - w, 0, w * sizeof(uae_u32));
-                                       }
-                                       if (bufg) {
-                                               uae_u16 *gp1 = (p1 - ptr2) + bufg;
-                                               if (i >= 2) {
-                                                       memset(gp1, 0, w * sizeof(uae_u16));
-                                               } else {
-                                                       memset(gp1 - w, 0, w * sizeof(uae_u16));
+                                               if (p1 < ptre && p1 - w >= ptrs) {
+                                                       memset(p1 - ww, 0, w * sizeof(uae_u32));
+                                                       if (bufg) {
+                                                               uae_u16 *gp1 = (p1 - ptrs) + bufg;
+                                                               memset(gp1 - ww, 0, w * sizeof(uae_u16));
+                                                       }
                                                }
                                        }
                                }
@@ -6564,6 +6636,20 @@ static void pfield_doline_not_fast_enough_yet(int planecnt, int wordcount, uae_u
 }
 #endif
 
+static void tvadjust(int *hbstrt_offset, int *hbstop_offset)
+{
+       if (currprefs.gfx_overscanmode < OVERSCANMODE_OVERSCAN) {
+               int add = 1 << hresolution;
+               int w = (OVERSCANMODE_OVERSCAN - currprefs.gfx_overscanmode) * 8;
+               if (currprefs.gfx_overscanmode == 0) {
+                       w -= 4;
+               }
+               w <<= hresolution;
+               *hbstrt_offset -= w;
+               *hbstop_offset += w;
+       }
+}
+
 static int r_shift(int v, int shift)
 {
        if (shift >= 0) {
@@ -6607,6 +6693,9 @@ void draw_denise_border_line_fast(int gfx_ypos, enum nln_how how, struct linesta
 
        int hbstrt_offset = ls->hbstrt_offset >> rshift;
        int hbstop_offset = ls->hbstop_offset >> rshift;
+
+       tvadjust(&hbstrt_offset, &hbstop_offset);
+
        int draw_end = ls->internal_pixel_cnt >> rshift;
        int draw_startoffset = ls->internal_pixel_start_cnt >> rshift;
 
@@ -6811,44 +6900,55 @@ void draw_denise_bitplane_line_fast(int gfx_ypos, enum nln_how how, struct lines
 
        int hbstrt_offset = ls->hbstrt_offset >> rshift;
        int hbstop_offset = ls->hbstop_offset >> rshift;
+
+       tvadjust(&hbstrt_offset, &hbstop_offset);
+
        // negative checks are needed to handle always-on HDIW
-       int hstrt_offset = ls->hstrt_offset < 0 || ls->hstop_offset < 0 || ls->hstrt_offset >= ls->hbstrt_offset ? hbstop_offset : ls->hstrt_offset >> rshift;
+       int hstrt_offset = ls->hstrt_offset < 0 || ls->hstop_offset < 0 || (ls->hstrt_offset >> rshift) >= hbstrt_offset ? hbstop_offset : ls->hstrt_offset >> rshift;
        int hstop_offset = ls->hstop_offset < 0 ? hbstrt_offset : ls->hstop_offset >> rshift;
        int bpl1dat_trigger_offset = (ls->bpl1dat_trigger_offset + (1 << RES_MAX)) >> rshift;
        int draw_start = 0;
        int draw_end = ls->internal_pixel_cnt >> rshift;
        int draw_startoffset = ls->internal_pixel_start_cnt >> rshift;
-       
+
        //write_log("%03d %03d %03d %03d %03d %03d %03d\n", vpos, hbstop_offset, hbstrt_offset, hstrt_offset, hstop_offset, bpl1dat_trigger_offset, delayoffset);
 
        uae_u8 bxor = ls->bplcon4 >> 8;
        buf1 = buf1p;
        buf2 = buf2p;
-//     int cpadd = doubling < 0 ? (doubling < -1 ? 4 : 2) : 1;
-//     int bufadd = doubling > 0 ? (doubling > 1 ? 4 : 2) : 1;
 
        int cpadd = doubling < 0 ? (doubling < -1 ? 2 : 1) : 0;
        int bufadd = doubling > 0 ? (doubling > 1 ? 2 : 1) : 0;
 
-
        // subpixel handling
        int subpix = (ls->bplcon1 & 0x0300) >> 8;
        int cpadds[4] = { 0, 0, 0, 0 };
        if (doubling <= 0) {
                cpadds[0] = 1 << cpadd;
+               subpix >>= RES_MAX - hresolution;
+               cp -= subpix;
+               cp2 -= subpix;
        } else if (doubling == 1) {
                if (subpix & 2) {
                        cp--;
-                       cpadds[0] = 1 << cpadd;
+                       cpadds[1] = 1 << cpadd;
                } else {
                        cpadds[1] = 1 << cpadd;
                }
+               if (subpix & 1) {
+                       cpadds[0] = 1 << cpadd;
+                       cpadds[1] = 0;
+               }
        } else {
                if (subpix & 2) {
                        cp--;
-                       cpadds[0] = 1 << cpadd;
+                       cpadds[3] = 1 << cpadd;
                } else {
-                       cpadds[2] = 1 << cpadd;
+                       cpadds[3] = 1 << cpadd;
+               }
+               if (subpix & 1) {
+                       cpadds[1] = 1 << cpadd;
+                       cpadds[3] = 0;
                }
        }
 
@@ -7020,8 +7120,21 @@ uae_u8 *restore_custom_sprite_denise(int num, uae_u8 *src, uae_u16 pos, uae_u16
        return src;
 }
 
+static void updatelinedata(void)
+{
+       this_line = &temp_line;
+       this_line->vpos = vpos;
+       this_line->linear_vpos = linear_vpos;
+}
+
 static bool waitqueue(void)
 {
+       if (!thread_debug_lock) {
+               write_log("Denise queue without lock!\n");
+               return false;
+       }
+
+
        while (((rga_queue_write + 1) & DENISE_RGA_SLOT_CHUNKS_MASK) == (rga_queue_read & DENISE_RGA_SLOT_CHUNKS_MASK)) {
                uae_sem_trywait_delay(&read_sem, 500);
        }
@@ -7048,11 +7161,13 @@ void draw_denise_border_line_fast_queue(int gfx_ypos, enum nln_how how, struct l
                q->ls = ls;
                q->type = 2;
                q->vpos = vpos;
+               q->linear_vpos = linear_vpos;
 
                addtowritequeue();
 
        } else {
        
+               updatelinedata();
                draw_denise_border_line_fast(gfx_ypos, how, ls);
        
        }
@@ -7072,11 +7187,13 @@ void draw_denise_bitplane_line_fast_queue(int gfx_ypos, enum nln_how how, struct
                q->ls = ls;
                q->type = 1;
                q->vpos = vpos;
+               q->linear_vpos = linear_vpos;
 
                addtowritequeue();
 
        } else {
        
+               updatelinedata();
                draw_denise_bitplane_line_fast(gfx_ypos, how, ls);
        
        }
@@ -7096,11 +7213,13 @@ void quick_denise_rga_queue(int linecnt, int startpos, int endpos)
                q->endpos = endpos;
                q->type = 3;
                q->vpos = vpos;
+               q->linear_vpos = linear_vpos;
 
                addtowritequeue();
        
        } else {
 
+               updatelinedata();
                quick_denise_rga(linecnt, startpos, endpos);
        
        }
@@ -7120,17 +7239,19 @@ void denise_handle_quick_strobe_queue(uae_u16 strobe, int strobe_pos, int endpos
                q->endpos = endpos;
                q->type = 4;
                q->vpos = vpos;
+               q->linear_vpos = linear_vpos;
 
                addtowritequeue();
 
        } else {
 
+               updatelinedata();
                denise_handle_quick_strobe(strobe, strobe_pos, endpos);
+               update_overlapped_cycles(endpos);
 
        }
 }
 
-
 void draw_denise_line_queue(int gfx_ypos, nln_how how, uae_u32 linecnt, int startpos, int endpos, int total, int skip, int skip2, int dtotal, int calib_start, int calib_len, bool lol, struct linestate *ls)
 {
        if (MULTITHREADED_DENISE) {
@@ -7155,12 +7276,15 @@ void draw_denise_line_queue(int gfx_ypos, nln_how how, uae_u32 linecnt, int star
                q->lol = lol;
                q->ls = ls;
                q->vpos = vpos;
+               q->linear_vpos = linear_vpos;
 
                addtowritequeue();
 
        } else {
 
+               updatelinedata();
                draw_denise_line(gfx_ypos, how, linecnt, startpos, total, skip, skip2, dtotal, calib_start, calib_len, lol, ls);
+               update_overlapped_cycles(endpos);
 
        }
 }
@@ -7168,11 +7292,13 @@ void draw_denise_line_queue(int gfx_ypos, nln_how how, uae_u32 linecnt, int star
 void draw_denise_line_queue_flush(void)
 {
        if (MULTITHREADED_DENISE) {
+
                for (;;) {
                        if (rga_queue_read == rga_queue_write) {
                                return;
                        }
                        uae_sem_trywait_delay(&read_sem, 500);
                }
+
        }
 }
index af728d8e2683fb910c9f9a1709d6478af007fbee..35703f716d3001c7498cb5371f003e5a2e6da33f 100644 (file)
@@ -958,36 +958,53 @@ static void gen_fastdraw(void)
                outf("uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);");
        }
 
-       outf("int cnt = draw_start;");
-       outf("if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {");
-       outf("  cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;");
-       outf("  if (cnt > hbstop_offset) {");
-       outf("          cnt = hbstop_offset;");
-       outf("  }");
-       outf("}");
        outf("int end = draw_end;");
        outf("if (end > hbstrt_offset) {");
        outf("  end = hbstrt_offset;");
        outf("}");
-       outf("if (cnt < draw_startoffset) {");
-       outf("  int d = (draw_startoffset - cnt) >> bufadd;");
-       outf("  cp += d << cpadd;");
+
+       outf("int cnt = draw_end;");
+       outf("if (cnt > draw_startoffset) {");
        outf("  cnt = draw_startoffset;");
        outf("}");
-
-       outf("  if (cnt < hbstop_offset) {");
-       outf("          int d = (hbstop_offset - cnt) >> bufadd;");
-       outf("          buf1 += d << bufadd;");
-       if (isbuf2) {
-               outf("  buf2 += d << bufadd;");
-       }
+       outf("if (cnt > hbstop_offset) {");
        outf("  cnt = hbstop_offset;");
        outf("}");
-
+       outf("if (cnt > bpl1dat_trigger_offset) {");
+       outf("  cnt = bpl1dat_trigger_offset;");
+       outf("}");
 
        outf("while (cnt < end) {");
        outf("  bool bpl = false;");
        outf("  if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {");
+       outf("          if (cnt >= draw_startoffset) {");
+       outf("          if (cnt < hbstop_offset) {");
+       if (doubling <= 0) {
+               outf("buf1++;");
+               if (isbuf2) {
+                       outf("buf2++;");
+               }
+               if (genlock) {
+                       outf("gbuf++;");
+               }
+       } else if (doubling == 1)  {
+               outf("buf1 += 2;");
+               if (isbuf2) {
+                       outf("buf2 += 2;");
+               }
+               if (genlock) {
+                       outf("gbuf += 2;");
+               }
+       } else if (doubling == 2) {
+               outf("buf1 += 4;");
+               if (isbuf2) {
+                       outf("buf2 += 4;");
+               }
+               if (genlock) {
+                       outf("gbuf += 4;");
+               }
+       }
+       outf("          } else {");
        if (doubling <= 0) {
                outf("*buf1++ = bgcolor;");
                if (isbuf2) {
@@ -1025,6 +1042,8 @@ static void gen_fastdraw(void)
                        outf("*gbuf++ = gpix;");
                }
        }
+       outf("}");
+       outf("  }");
        outf("} else {");
        outf("bpl = true;");
        outf("uae_u8 c;");
index f585db2ac3ebfa0246775f8c9b2734189d17a528..d64c4a3ab98c403f4083edda70578507fc6da8f4 100644 (file)
@@ -324,6 +324,8 @@ struct rgabuf *read_rga(int slot);
 struct rgabuf *write_rga(int slot, int type, uae_u16 v, uae_u32 *p);
 extern uae_u16 clxdat;
 
+void custom_end_drawing(void);
+
 extern int current_linear_vpos, current_linear_hpos;
 extern uae_u8 agnus_hpos;
 
index 5355a1ececbac5541c117e61bec2ce3403f93cf7..0af015b4078bbfcf624dc48ced6c4f2ddbf69380 100644 (file)
@@ -186,6 +186,7 @@ void draw_denise_border_line_fast(int gfx_ypos, enum nln_how how, struct linesta
 void draw_denise_border_line_fast_queue(int gfx_ypos, enum nln_how how, struct linestate *ls);
 bool start_draw_denise(void);
 void end_draw_denise(void);
+bool has_draw_denise(void);
 void denise_update_reg(uae_u16 reg, uae_u16 v);
 void denise_reset(bool);
 bool denise_update_reg_queued(uae_u16 reg, uae_u16 v, uae_u32 cycle);
index 9d52964e5f70ce837f182305cec8fd0bb37d64ab..e6550efd513a12cfe9db3117ea598f47659d307d 100644 (file)
@@ -104,7 +104,7 @@ struct vidbuffer
        uae_u8 *bufmem, *bufmemend;
     uae_u8 *realbufmem;
        uae_u8 *bufmem_allocated;
-       bool bufmem_lockable;
+       bool initialized;
        bool locked;
        bool vram_buffer;
     int rowbytes; /* Bytes per row in the memory pointed at by bufmem. */
@@ -121,8 +121,8 @@ struct vidbuffer
        /* same but doublescan multiplier included */
        int inwidth2;
        int inheight2;
-       /* use drawbuffer instead */
-       bool nativepositioning;
+       /* static, hardwired screen position and size (A2024) */
+       bool hardwiredpositioning;
        /* extra width, chipset hpos extra in right border */
        int extrawidth, extraheight;
 
index 4d4d8f760bc2ca94c14762c3477819d89f8181a4..35e8ed15a3e3d73a64cb5bb7bbc24b19bf458ce9 100644 (file)
@@ -10,31 +10,30 @@ static void lts_aga_n_ilores_dlores_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -57,31 +56,30 @@ static void lts_aga_dpf_ilores_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -110,31 +108,30 @@ static void lts_aga_ehb_ilores_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -162,31 +159,30 @@ static void lts_aga_ham_ilores_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -208,31 +204,30 @@ static void lts_aga_kehb_ilores_dlores_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -255,31 +250,30 @@ static void lts_aga_n_ihires_dlores_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -302,31 +296,30 @@ static void lts_aga_dpf_ihires_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -355,31 +348,30 @@ static void lts_aga_ehb_ihires_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -407,31 +399,30 @@ static void lts_aga_ham_ihires_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -453,31 +444,30 @@ static void lts_aga_kehb_ihires_dlores_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -500,31 +490,30 @@ static void lts_aga_n_ishres_dlores_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -547,31 +536,30 @@ static void lts_aga_dpf_ishres_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -600,31 +588,30 @@ static void lts_aga_ehb_ishres_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -652,31 +639,30 @@ static void lts_aga_ham_ishres_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -698,31 +684,30 @@ static void lts_aga_kehb_ishres_dlores_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -745,32 +730,31 @@ static void lts_aga_n_ilores_dhires_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -798,32 +782,31 @@ static void lts_aga_dpf_ilores_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -863,32 +846,31 @@ static void lts_aga_ehb_ilores_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -926,32 +908,31 @@ static void lts_aga_ham_ilores_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -977,32 +958,31 @@ static void lts_aga_kehb_ilores_dhires_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1030,31 +1010,30 @@ static void lts_aga_n_ihires_dhires_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1077,31 +1056,30 @@ static void lts_aga_dpf_ihires_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1130,31 +1108,30 @@ static void lts_aga_ehb_ihires_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1182,31 +1159,30 @@ static void lts_aga_ham_ihires_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1228,31 +1204,30 @@ static void lts_aga_kehb_ihires_dhires_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1275,31 +1250,30 @@ static void lts_aga_n_ishres_dhires_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1322,31 +1296,30 @@ static void lts_aga_dpf_ishres_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1375,31 +1348,30 @@ static void lts_aga_ehb_ishres_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1427,31 +1399,30 @@ static void lts_aga_ham_ishres_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1473,31 +1444,30 @@ static void lts_aga_kehb_ishres_dhires_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1520,34 +1490,33 @@ static void lts_aga_n_ilores_dshres_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1585,34 +1554,33 @@ static void lts_aga_dpf_ilores_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1674,34 +1642,33 @@ static void lts_aga_ehb_ilores_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1759,34 +1726,33 @@ static void lts_aga_ham_ilores_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1820,34 +1786,33 @@ static void lts_aga_kehb_ilores_dshres_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1885,32 +1850,31 @@ static void lts_aga_n_ihires_dshres_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1938,32 +1902,31 @@ static void lts_aga_dpf_ihires_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2003,32 +1966,31 @@ static void lts_aga_ehb_ihires_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2066,32 +2028,31 @@ static void lts_aga_ham_ihires_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2117,32 +2078,31 @@ static void lts_aga_kehb_ihires_dshres_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2170,31 +2130,30 @@ static void lts_aga_n_ishres_dshres_b1(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2217,31 +2176,30 @@ static void lts_aga_dpf_ishres_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2270,31 +2228,30 @@ static void lts_aga_ehb_ishres_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2322,31 +2279,30 @@ static void lts_aga_ham_ishres_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2368,31 +2324,30 @@ static void lts_aga_kehb_ishres_dshres_b1(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2415,33 +2370,32 @@ static void lts_aga_n_ilores_dlores_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2465,33 +2419,32 @@ static void lts_aga_dpf_ilores_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2521,33 +2474,32 @@ static void lts_aga_ehb_ilores_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2576,33 +2528,32 @@ static void lts_aga_ham_ilores_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2625,33 +2576,32 @@ static void lts_aga_kehb_ilores_dlores_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2675,33 +2625,32 @@ static void lts_aga_n_ihires_dlores_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2725,33 +2674,32 @@ static void lts_aga_dpf_ihires_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2781,33 +2729,32 @@ static void lts_aga_ehb_ihires_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2836,33 +2783,32 @@ static void lts_aga_ham_ihires_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2885,33 +2831,32 @@ static void lts_aga_kehb_ihires_dlores_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2935,33 +2880,32 @@ static void lts_aga_n_ishres_dlores_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2985,33 +2929,32 @@ static void lts_aga_dpf_ishres_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3041,33 +2984,32 @@ static void lts_aga_ehb_ishres_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3096,33 +3038,32 @@ static void lts_aga_ham_ishres_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3145,33 +3086,32 @@ static void lts_aga_kehb_ishres_dlores_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3195,35 +3135,34 @@ static void lts_aga_n_ilores_dhires_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3253,35 +3192,34 @@ static void lts_aga_dpf_ilores_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3323,35 +3261,34 @@ static void lts_aga_ehb_ilores_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3391,35 +3328,34 @@ static void lts_aga_ham_ilores_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3447,35 +3383,34 @@ static void lts_aga_kehb_ilores_dhires_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3505,33 +3440,32 @@ static void lts_aga_n_ihires_dhires_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3555,33 +3489,32 @@ static void lts_aga_dpf_ihires_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3611,33 +3544,32 @@ static void lts_aga_ehb_ihires_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3666,33 +3598,32 @@ static void lts_aga_ham_ihires_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3715,33 +3646,32 @@ static void lts_aga_kehb_ihires_dhires_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3765,33 +3695,32 @@ static void lts_aga_n_ishres_dhires_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3815,33 +3744,32 @@ static void lts_aga_dpf_ishres_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3871,33 +3799,32 @@ static void lts_aga_ehb_ishres_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3926,33 +3853,32 @@ static void lts_aga_ham_ishres_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3975,33 +3901,32 @@ static void lts_aga_kehb_ishres_dhires_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4025,39 +3950,38 @@ static void lts_aga_n_ilores_dshres_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4099,39 +4023,38 @@ static void lts_aga_dpf_ilores_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4197,39 +4120,38 @@ static void lts_aga_ehb_ilores_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4291,39 +4213,38 @@ static void lts_aga_ham_ilores_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4361,39 +4282,38 @@ static void lts_aga_kehb_ilores_dshres_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4435,35 +4355,34 @@ static void lts_aga_n_ihires_dshres_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4493,35 +4412,34 @@ static void lts_aga_dpf_ihires_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4563,35 +4481,34 @@ static void lts_aga_ehb_ihires_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4631,35 +4548,34 @@ static void lts_aga_ham_ihires_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4687,35 +4603,34 @@ static void lts_aga_kehb_ihires_dshres_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4745,33 +4660,32 @@ static void lts_aga_n_ishres_dshres_b2(int draw_start, int draw_end, int draw_st
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4795,33 +4709,32 @@ static void lts_aga_dpf_ishres_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4851,33 +4764,32 @@ static void lts_aga_ehb_ishres_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4906,33 +4818,32 @@ static void lts_aga_ham_ishres_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4955,33 +4866,32 @@ static void lts_aga_kehb_ishres_dshres_b2(int draw_start, int draw_end, int draw
        uae_u8 bxor = ls->bplcon4 >> 8;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
index 562ce33aa05d410d47ff895c605f4d6ff5148488..8a80b8bc77b21fe79c511201d53e2e8b59a4e26a 100644 (file)
@@ -11,32 +11,32 @@ static void lts_aga_n_ilores_dlores_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -62,32 +62,32 @@ static void lts_aga_dpf_ilores_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -119,32 +119,32 @@ static void lts_aga_ehb_ilores_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -175,32 +175,32 @@ static void lts_aga_ham_ilores_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -225,32 +225,32 @@ static void lts_aga_kehb_ilores_dlores_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -276,32 +276,32 @@ static void lts_aga_n_ihires_dlores_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -327,32 +327,32 @@ static void lts_aga_dpf_ihires_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -384,32 +384,32 @@ static void lts_aga_ehb_ihires_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -440,32 +440,32 @@ static void lts_aga_ham_ihires_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -490,32 +490,32 @@ static void lts_aga_kehb_ihires_dlores_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -541,32 +541,32 @@ static void lts_aga_n_ishres_dlores_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -592,32 +592,32 @@ static void lts_aga_dpf_ishres_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -649,32 +649,32 @@ static void lts_aga_ehb_ishres_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -705,32 +705,32 @@ static void lts_aga_ham_ishres_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -755,32 +755,32 @@ static void lts_aga_kehb_ishres_dlores_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -806,34 +806,34 @@ static void lts_aga_n_ilores_dhires_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -866,34 +866,34 @@ static void lts_aga_dpf_ilores_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -938,34 +938,34 @@ static void lts_aga_ehb_ilores_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1008,34 +1008,34 @@ static void lts_aga_ham_ilores_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1066,34 +1066,34 @@ static void lts_aga_kehb_ilores_dhires_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1126,32 +1126,32 @@ static void lts_aga_n_ihires_dhires_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1177,32 +1177,32 @@ static void lts_aga_dpf_ihires_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1234,32 +1234,32 @@ static void lts_aga_ehb_ihires_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1290,32 +1290,32 @@ static void lts_aga_ham_ihires_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1340,32 +1340,32 @@ static void lts_aga_kehb_ihires_dhires_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1391,32 +1391,32 @@ static void lts_aga_n_ishres_dhires_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1442,32 +1442,32 @@ static void lts_aga_dpf_ishres_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1499,32 +1499,32 @@ static void lts_aga_ehb_ishres_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1555,32 +1555,32 @@ static void lts_aga_ham_ishres_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1605,32 +1605,32 @@ static void lts_aga_kehb_ishres_dhires_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1656,38 +1656,38 @@ static void lts_aga_n_ilores_dshres_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1734,38 +1734,38 @@ static void lts_aga_dpf_ilores_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1836,38 +1836,38 @@ static void lts_aga_ehb_ilores_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1934,38 +1934,38 @@ static void lts_aga_ham_ilores_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2008,38 +2008,38 @@ static void lts_aga_kehb_ilores_dshres_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2086,34 +2086,34 @@ static void lts_aga_n_ihires_dshres_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2146,34 +2146,34 @@ static void lts_aga_dpf_ihires_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2218,34 +2218,34 @@ static void lts_aga_ehb_ihires_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2288,34 +2288,34 @@ static void lts_aga_ham_ihires_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2346,34 +2346,34 @@ static void lts_aga_kehb_ihires_dshres_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2406,32 +2406,32 @@ static void lts_aga_n_ishres_dshres_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2457,32 +2457,32 @@ static void lts_aga_dpf_ishres_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2514,32 +2514,32 @@ static void lts_aga_ehb_ishres_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2570,32 +2570,32 @@ static void lts_aga_ham_ishres_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2620,32 +2620,32 @@ static void lts_aga_kehb_ishres_dshres_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2671,34 +2671,34 @@ static void lts_aga_n_ilores_dlores_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2725,34 +2725,34 @@ static void lts_aga_dpf_ilores_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2785,34 +2785,34 @@ static void lts_aga_ehb_ilores_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2844,34 +2844,34 @@ static void lts_aga_ham_ilores_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2897,34 +2897,34 @@ static void lts_aga_kehb_ilores_dlores_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2951,34 +2951,34 @@ static void lts_aga_n_ihires_dlores_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3005,34 +3005,34 @@ static void lts_aga_dpf_ihires_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3065,34 +3065,34 @@ static void lts_aga_ehb_ihires_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3124,34 +3124,34 @@ static void lts_aga_ham_ihires_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3177,34 +3177,34 @@ static void lts_aga_kehb_ihires_dlores_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3231,34 +3231,34 @@ static void lts_aga_n_ishres_dlores_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3285,34 +3285,34 @@ static void lts_aga_dpf_ishres_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3345,34 +3345,34 @@ static void lts_aga_ehb_ishres_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3404,34 +3404,34 @@ static void lts_aga_ham_ishres_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3457,34 +3457,34 @@ static void lts_aga_kehb_ishres_dlores_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3511,37 +3511,37 @@ static void lts_aga_n_ilores_dhires_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3576,37 +3576,37 @@ static void lts_aga_dpf_ilores_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3653,37 +3653,37 @@ static void lts_aga_ehb_ilores_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3728,37 +3728,37 @@ static void lts_aga_ham_ilores_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3791,37 +3791,37 @@ static void lts_aga_kehb_ilores_dhires_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3856,34 +3856,34 @@ static void lts_aga_n_ihires_dhires_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3910,34 +3910,34 @@ static void lts_aga_dpf_ihires_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3970,34 +3970,34 @@ static void lts_aga_ehb_ihires_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4029,34 +4029,34 @@ static void lts_aga_ham_ihires_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4082,34 +4082,34 @@ static void lts_aga_kehb_ihires_dhires_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4136,34 +4136,34 @@ static void lts_aga_n_ishres_dhires_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4190,34 +4190,34 @@ static void lts_aga_dpf_ishres_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4250,34 +4250,34 @@ static void lts_aga_ehb_ishres_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4309,34 +4309,34 @@ static void lts_aga_ham_ishres_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4362,34 +4362,34 @@ static void lts_aga_kehb_ishres_dhires_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4416,43 +4416,43 @@ static void lts_aga_n_ilores_dshres_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4503,43 +4503,43 @@ static void lts_aga_dpf_ilores_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4614,43 +4614,43 @@ static void lts_aga_ehb_ilores_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4721,43 +4721,43 @@ static void lts_aga_ham_ilores_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4804,43 +4804,43 @@ static void lts_aga_kehb_ilores_dshres_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4891,37 +4891,37 @@ static void lts_aga_n_ihires_dshres_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4956,37 +4956,37 @@ static void lts_aga_dpf_ihires_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5033,37 +5033,37 @@ static void lts_aga_ehb_ihires_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5108,37 +5108,37 @@ static void lts_aga_ham_ihires_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5171,37 +5171,37 @@ static void lts_aga_kehb_ihires_dshres_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5236,34 +5236,34 @@ static void lts_aga_n_ishres_dshres_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5290,34 +5290,34 @@ static void lts_aga_dpf_ishres_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5350,34 +5350,34 @@ static void lts_aga_ehb_ishres_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5409,34 +5409,34 @@ static void lts_aga_ham_ishres_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5462,34 +5462,34 @@ static void lts_aga_kehb_ishres_dshres_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
index 98f8773425b6248a0c227396e9740b8be2a17b06..60350644dda18271cd21ac9b3418844ff1ddf0ec 100644 (file)
@@ -9,31 +9,30 @@ static void lts_ecs_n_ilores_dlores_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -54,31 +53,30 @@ static void lts_ecs_dpf_ilores_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -102,31 +100,30 @@ static void lts_ecs_ehb_ilores_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -152,31 +149,30 @@ static void lts_ecs_ham_ilores_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -197,31 +193,30 @@ static void lts_ecs_kehb_ilores_dlores_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -242,31 +237,30 @@ static void lts_ecs_n_ihires_dlores_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -287,31 +281,30 @@ static void lts_ecs_dpf_ihires_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -335,31 +328,30 @@ static void lts_ecs_ehb_ihires_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -385,31 +377,30 @@ static void lts_ecs_ham_ihires_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -430,31 +421,30 @@ static void lts_ecs_kehb_ihires_dlores_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -475,31 +465,30 @@ static void lts_ecs_n_ishres_dlores_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -520,31 +509,30 @@ static void lts_ecs_dpf_ishres_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -568,31 +556,30 @@ static void lts_ecs_ehb_ishres_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -618,31 +605,30 @@ static void lts_ecs_ham_ishres_dlores_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -663,31 +649,30 @@ static void lts_ecs_kehb_ishres_dlores_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -708,32 +693,31 @@ static void lts_ecs_n_ilores_dhires_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -757,32 +741,31 @@ static void lts_ecs_dpf_ilores_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -812,32 +795,31 @@ static void lts_ecs_ehb_ilores_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -871,32 +853,31 @@ static void lts_ecs_ham_ilores_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -920,32 +901,31 @@ static void lts_ecs_kehb_ilores_dhires_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -969,31 +949,30 @@ static void lts_ecs_n_ihires_dhires_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1014,31 +993,30 @@ static void lts_ecs_dpf_ihires_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1062,31 +1040,30 @@ static void lts_ecs_ehb_ihires_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1112,31 +1089,30 @@ static void lts_ecs_ham_ihires_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1157,31 +1133,30 @@ static void lts_ecs_kehb_ihires_dhires_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1202,31 +1177,30 @@ static void lts_ecs_n_ishres_dhires_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1247,31 +1221,30 @@ static void lts_ecs_dpf_ishres_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1295,31 +1268,30 @@ static void lts_ecs_ehb_ishres_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1345,31 +1317,30 @@ static void lts_ecs_ham_ishres_dhires_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1390,31 +1361,30 @@ static void lts_ecs_kehb_ishres_dhires_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1435,34 +1405,33 @@ static void lts_ecs_n_ilores_dshres_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1492,34 +1461,33 @@ static void lts_ecs_dpf_ilores_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1561,34 +1529,33 @@ static void lts_ecs_ehb_ilores_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1638,34 +1605,33 @@ static void lts_ecs_ham_ilores_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1695,34 +1661,33 @@ static void lts_ecs_kehb_ilores_dshres_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1752,32 +1717,31 @@ static void lts_ecs_n_ihires_dshres_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1801,32 +1765,31 @@ static void lts_ecs_dpf_ihires_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1856,32 +1819,31 @@ static void lts_ecs_ehb_ihires_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1915,32 +1877,31 @@ static void lts_ecs_ham_ihires_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1964,32 +1925,31 @@ static void lts_ecs_kehb_ihires_dshres_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2013,31 +1973,30 @@ static void lts_ecs_n_ishres_dshres_b1(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2058,31 +2017,30 @@ static void lts_ecs_dpf_ishres_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2106,31 +2064,30 @@ static void lts_ecs_ehb_ishres_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2156,31 +2113,30 @@ static void lts_ecs_ham_ishres_dshres_b1(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2201,31 +2157,30 @@ static void lts_ecs_kehb_ishres_dshres_b1(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2246,33 +2201,32 @@ static void lts_ecs_n_ilores_dlores_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2294,33 +2248,32 @@ static void lts_ecs_dpf_ilores_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2345,33 +2298,32 @@ static void lts_ecs_ehb_ilores_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2398,33 +2350,32 @@ static void lts_ecs_ham_ilores_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2446,33 +2397,32 @@ static void lts_ecs_kehb_ilores_dlores_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2494,33 +2444,32 @@ static void lts_ecs_n_ihires_dlores_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2542,33 +2491,32 @@ static void lts_ecs_dpf_ihires_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2593,33 +2541,32 @@ static void lts_ecs_ehb_ihires_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2646,33 +2593,32 @@ static void lts_ecs_ham_ihires_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2694,33 +2640,32 @@ static void lts_ecs_kehb_ihires_dlores_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2742,33 +2687,32 @@ static void lts_ecs_n_ishres_dlores_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2790,33 +2734,32 @@ static void lts_ecs_dpf_ishres_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2841,33 +2784,32 @@ static void lts_ecs_ehb_ishres_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2894,33 +2836,32 @@ static void lts_ecs_ham_ishres_dlores_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2942,33 +2883,32 @@ static void lts_ecs_kehb_ishres_dlores_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2990,35 +2930,34 @@ static void lts_ecs_n_ilores_dhires_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3044,35 +2983,34 @@ static void lts_ecs_dpf_ilores_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3104,35 +3042,34 @@ static void lts_ecs_ehb_ilores_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3168,35 +3105,34 @@ static void lts_ecs_ham_ilores_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3222,35 +3158,34 @@ static void lts_ecs_kehb_ilores_dhires_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3276,33 +3211,32 @@ static void lts_ecs_n_ihires_dhires_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3324,33 +3258,32 @@ static void lts_ecs_dpf_ihires_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3375,33 +3308,32 @@ static void lts_ecs_ehb_ihires_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3428,33 +3360,32 @@ static void lts_ecs_ham_ihires_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3476,33 +3407,32 @@ static void lts_ecs_kehb_ihires_dhires_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3524,33 +3454,32 @@ static void lts_ecs_n_ishres_dhires_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3572,33 +3501,32 @@ static void lts_ecs_dpf_ishres_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3623,33 +3551,32 @@ static void lts_ecs_ehb_ishres_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3676,33 +3603,32 @@ static void lts_ecs_ham_ishres_dhires_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3724,33 +3650,32 @@ static void lts_ecs_kehb_ishres_dhires_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3772,39 +3697,38 @@ static void lts_ecs_n_ilores_dshres_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3838,39 +3762,38 @@ static void lts_ecs_dpf_ilores_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3916,39 +3839,38 @@ static void lts_ecs_ehb_ilores_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4002,39 +3924,38 @@ static void lts_ecs_ham_ilores_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4068,39 +3989,38 @@ static void lts_ecs_kehb_ilores_dshres_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4134,35 +4054,34 @@ static void lts_ecs_n_ihires_dshres_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4188,35 +4107,34 @@ static void lts_ecs_dpf_ihires_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4248,35 +4166,34 @@ static void lts_ecs_ehb_ihires_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4312,35 +4229,34 @@ static void lts_ecs_ham_ihires_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4366,35 +4282,34 @@ static void lts_ecs_kehb_ihires_dshres_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4420,33 +4335,32 @@ static void lts_ecs_n_ishres_dshres_b2(int draw_start, int draw_end, int draw_st
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4468,33 +4382,32 @@ static void lts_ecs_dpf_ishres_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4519,33 +4432,32 @@ static void lts_ecs_ehb_ishres_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4572,33 +4484,32 @@ static void lts_ecs_ham_ishres_dshres_b2(int draw_start, int draw_end, int draw_
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4620,33 +4531,32 @@ static void lts_ecs_kehb_ishres_dshres_b2(int draw_start, int draw_end, int draw
        uae_u16 *colors_ocs = (uae_u16*)ls->linecolorstate;
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
index 2c388c6667ee13ad497e904d24ff9d2d7d9eee9a..2a2393c9f50c0954c3447f66e5760547437a202b 100644 (file)
@@ -10,32 +10,32 @@ static void lts_ecs_n_ilores_dlores_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -59,32 +59,32 @@ static void lts_ecs_dpf_ilores_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -111,32 +111,32 @@ static void lts_ecs_ehb_ilores_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -165,32 +165,32 @@ static void lts_ecs_ham_ilores_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -214,32 +214,32 @@ static void lts_ecs_kehb_ilores_dlores_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -263,32 +263,32 @@ static void lts_ecs_n_ihires_dlores_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -312,32 +312,32 @@ static void lts_ecs_dpf_ihires_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -364,32 +364,32 @@ static void lts_ecs_ehb_ihires_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -418,32 +418,32 @@ static void lts_ecs_ham_ihires_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -467,32 +467,32 @@ static void lts_ecs_kehb_ihires_dlores_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -516,32 +516,32 @@ static void lts_ecs_n_ishres_dlores_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -565,32 +565,32 @@ static void lts_ecs_dpf_ishres_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -617,32 +617,32 @@ static void lts_ecs_ehb_ishres_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -671,32 +671,32 @@ static void lts_ecs_ham_ishres_dlores_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -720,32 +720,32 @@ static void lts_ecs_kehb_ishres_dlores_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -769,34 +769,34 @@ static void lts_ecs_n_ilores_dhires_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -825,34 +825,34 @@ static void lts_ecs_dpf_ilores_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -887,34 +887,34 @@ static void lts_ecs_ehb_ilores_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -953,34 +953,34 @@ static void lts_ecs_ham_ilores_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1009,34 +1009,34 @@ static void lts_ecs_kehb_ilores_dhires_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1065,32 +1065,32 @@ static void lts_ecs_n_ihires_dhires_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1114,32 +1114,32 @@ static void lts_ecs_dpf_ihires_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1166,32 +1166,32 @@ static void lts_ecs_ehb_ihires_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1220,32 +1220,32 @@ static void lts_ecs_ham_ihires_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1269,32 +1269,32 @@ static void lts_ecs_kehb_ihires_dhires_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1318,32 +1318,32 @@ static void lts_ecs_n_ishres_dhires_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1367,32 +1367,32 @@ static void lts_ecs_dpf_ishres_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1419,32 +1419,32 @@ static void lts_ecs_ehb_ishres_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1473,32 +1473,32 @@ static void lts_ecs_ham_ishres_dhires_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1522,32 +1522,32 @@ static void lts_ecs_kehb_ishres_dhires_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1571,38 +1571,38 @@ static void lts_ecs_n_ilores_dshres_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1641,38 +1641,38 @@ static void lts_ecs_dpf_ilores_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1723,38 +1723,38 @@ static void lts_ecs_ehb_ilores_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1813,38 +1813,38 @@ static void lts_ecs_ham_ilores_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1883,38 +1883,38 @@ static void lts_ecs_kehb_ilores_dshres_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -1953,34 +1953,34 @@ static void lts_ecs_n_ihires_dshres_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2009,34 +2009,34 @@ static void lts_ecs_dpf_ihires_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2071,34 +2071,34 @@ static void lts_ecs_ehb_ihires_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2137,34 +2137,34 @@ static void lts_ecs_ham_ihires_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2193,34 +2193,34 @@ static void lts_ecs_kehb_ihires_dshres_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2249,32 +2249,32 @@ static void lts_ecs_n_ishres_dshres_b1_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2298,32 +2298,32 @@ static void lts_ecs_dpf_ishres_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2350,32 +2350,32 @@ static void lts_ecs_ehb_ishres_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2404,32 +2404,32 @@ static void lts_ecs_ham_ishres_dshres_b1_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2453,32 +2453,32 @@ static void lts_ecs_kehb_ishres_dshres_b1_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2502,34 +2502,34 @@ static void lts_ecs_n_ilores_dlores_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2554,34 +2554,34 @@ static void lts_ecs_dpf_ilores_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2609,34 +2609,34 @@ static void lts_ecs_ehb_ilores_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2666,34 +2666,34 @@ static void lts_ecs_ham_ilores_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2718,34 +2718,34 @@ static void lts_ecs_kehb_ilores_dlores_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2770,34 +2770,34 @@ static void lts_ecs_n_ihires_dlores_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2822,34 +2822,34 @@ static void lts_ecs_dpf_ihires_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2877,34 +2877,34 @@ static void lts_ecs_ehb_ihires_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2934,34 +2934,34 @@ static void lts_ecs_ham_ihires_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -2986,34 +2986,34 @@ static void lts_ecs_kehb_ihires_dlores_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3038,34 +3038,34 @@ static void lts_ecs_n_ishres_dlores_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3090,34 +3090,34 @@ static void lts_ecs_dpf_ishres_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3145,34 +3145,34 @@ static void lts_ecs_ehb_ishres_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3202,34 +3202,34 @@ static void lts_ecs_ham_ishres_dlores_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3254,34 +3254,34 @@ static void lts_ecs_kehb_ishres_dlores_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3306,37 +3306,37 @@ static void lts_ecs_n_ilores_dhires_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3367,37 +3367,37 @@ static void lts_ecs_dpf_ilores_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3434,37 +3434,37 @@ static void lts_ecs_ehb_ilores_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3505,37 +3505,37 @@ static void lts_ecs_ham_ilores_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3566,37 +3566,37 @@ static void lts_ecs_kehb_ilores_dhires_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3627,34 +3627,34 @@ static void lts_ecs_n_ihires_dhires_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3679,34 +3679,34 @@ static void lts_ecs_dpf_ihires_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3734,34 +3734,34 @@ static void lts_ecs_ehb_ihires_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3791,34 +3791,34 @@ static void lts_ecs_ham_ihires_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3843,34 +3843,34 @@ static void lts_ecs_kehb_ihires_dhires_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3895,34 +3895,34 @@ static void lts_ecs_n_ishres_dhires_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -3947,34 +3947,34 @@ static void lts_ecs_dpf_ishres_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4002,34 +4002,34 @@ static void lts_ecs_ehb_ishres_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4059,34 +4059,34 @@ static void lts_ecs_ham_ishres_dhires_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4111,34 +4111,34 @@ static void lts_ecs_kehb_ishres_dhires_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4163,43 +4163,43 @@ static void lts_ecs_n_ilores_dshres_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4242,43 +4242,43 @@ static void lts_ecs_dpf_ilores_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4333,43 +4333,43 @@ static void lts_ecs_ehb_ilores_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4432,43 +4432,43 @@ static void lts_ecs_ham_ilores_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4511,43 +4511,43 @@ static void lts_ecs_kehb_ilores_dshres_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 4;
+                                       buf2 += 4;
+                                       gbuf += 4;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4590,37 +4590,37 @@ static void lts_ecs_n_ihires_dshres_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4651,37 +4651,37 @@ static void lts_ecs_dpf_ihires_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4718,37 +4718,37 @@ static void lts_ecs_ehb_ihires_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4789,37 +4789,37 @@ static void lts_ecs_ham_ihires_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4850,37 +4850,37 @@ static void lts_ecs_kehb_ihires_dshres_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1 += 2;
+                                       buf2 += 2;
+                                       gbuf += 2;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4911,34 +4911,34 @@ static void lts_ecs_n_ishres_dshres_b2_genlock(int draw_start, int draw_end, int
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -4963,34 +4963,34 @@ static void lts_ecs_dpf_ishres_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5018,34 +5018,34 @@ static void lts_ecs_ehb_ishres_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5075,34 +5075,34 @@ static void lts_ecs_ham_ishres_dshres_b2_genlock(int draw_start, int draw_end, i
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
@@ -5127,34 +5127,34 @@ static void lts_ecs_kehb_ishres_dshres_b2_genlock(int draw_start, int draw_end,
        int bufaddv = 1 << bufadd;
        int cpaddv = 1 << cpadd;
        uae_u16 gpix = get_genlock_transparency_border_fast(ls->bplcon3);
-       int cnt = draw_start;
-       if (draw_startoffset > cnt && bpl1dat_trigger_offset > cnt) {
-               cnt = draw_startoffset > bpl1dat_trigger_offset ? bpl1dat_trigger_offset : draw_startoffset;
-               if (cnt > hbstop_offset) {
-                       cnt = hbstop_offset;
-               }
-       }
        int end = draw_end;
        if (end > hbstrt_offset) {
                end = hbstrt_offset;
        }
-       if (cnt < draw_startoffset) {
-               int d = (draw_startoffset - cnt) >> bufadd;
-               cp += d << cpadd;
+       int cnt = draw_end;
+       if (cnt > draw_startoffset) {
                cnt = draw_startoffset;
        }
-       if (cnt < hbstop_offset) {
-               int d = (hbstop_offset - cnt) >> bufadd;
-               buf1 += d << bufadd;
-               buf2 += d << bufadd;
+       if (cnt > hbstop_offset) {
                cnt = hbstop_offset;
        }
+       if (cnt > bpl1dat_trigger_offset) {
+               cnt = bpl1dat_trigger_offset;
+       }
        while (cnt < end) {
                bool bpl = false;
                if (cnt < bpl1dat_trigger_offset || cnt < hstrt_offset || cnt >= hstop_offset) {
-                       *buf1++ = bgcolor;
-                       *buf2++ = bgcolor;
-                       *gbuf++ = gpix;
+                       if (cnt >= draw_startoffset) {
+                               if (cnt < hbstop_offset) {
+                                       buf1++;
+                                       buf2++;
+                                       gbuf++;
+                               } else {
+                                       *buf1++ = bgcolor;
+                                       *buf2++ = bgcolor;
+                                       *gbuf++ = gpix;
+                               }
+                       }
                } else {
                        bpl = true;
                        uae_u8 c;
index 515d9fa0b197c27dc910063535ff882bef44941d..a9d3beb1fa56902469a5979cb757e39b7438870c 100644 (file)
@@ -6722,6 +6722,8 @@ void m68k_go (int may_quit)
 #endif
                run_func();
 
+               custom_end_drawing();
+
                if (quit_program < 0) {
                        quit_program = -quit_program;
                }
index 370a1bb959ffaefd6ec7c19db88ce6f96785a9bf..83ffb3fdb89e6f578f802da6c995ed3785a12f42 100644 (file)
@@ -3854,7 +3854,7 @@ static void xD3D_unlocktexture(int monid, int y_start, int y_end)
                if (currprefs.leds_on_screen & (STATUSLINE_CHIPSET | STATUSLINE_RTG))
                        updateleds(d3d);
                hr = tex->UnlockRect(0);
-               if (y_start >= 0 && !d3d->turbo_skip)
+               if (y_start >= 0 && y_end >= 0 && !d3d->turbo_skip)
                        xD3D_flushtexture(monid, y_start, y_end);
        }
        d3d->locked = 0;
index 2132e3c8aaa8a81f5fa58bb9e1f4ff1efa93f7aa..6c3bacc769b3a8c5d956d80f9c980f70221cc470 100644 (file)
@@ -4102,6 +4102,10 @@ static void xD3D11_free(int monid, bool immediate)
 
        //freethread(d3d);
 
+       if (d3d->texturelocked) {
+               D3D_unlocktexture(monid, -1, -1);
+       }
+
        freed3d(d3d);
 
        if (d3d->m_swapChain) {
@@ -5062,6 +5066,10 @@ static bool xD3D11_alloctexture(int monid, int w, int h)
                return false;
        }
 
+       if (d3d->texturelocked) {
+               D3D_unlocktexture(monid, -1, -1);
+       }
+
        recheck(d3d, monid);
 
        if (d3d->invalidmode || !d3d->m_device) {
@@ -5101,6 +5109,16 @@ static uae_u8 *xD3D11_locktexture(int monid, int *pitch, int *width, int *height
 
        // texture allocation must not cause side-effects
 
+       if (height)
+               *height = d3d->m_bitmapHeight;
+       if (width)
+               *width = d3d->m_bitmapWidth;
+
+       if (d3d->texturelocked) {
+               write_log("D3D11_locktexture: already locked!\n");
+               return NULL;
+       }
+
        if (d3d->invalidmode || !d3d->texture2d)
                return NULL;
 
@@ -5112,10 +5130,6 @@ static uae_u8 *xD3D11_locktexture(int monid, int *pitch, int *width, int *height
                return NULL;
        }
        *pitch = map.RowPitch;
-       if (height)
-               *height = d3d->m_bitmapHeight;
-       if (width)
-               *width = d3d->m_bitmapWidth;
        d3d->texturelocked++;
        return (uae_u8*)map.pData;
 }
@@ -5125,8 +5139,10 @@ static void xD3D11_unlocktexture(int monid, int y_start, int y_end)
        struct AmigaMonitor *mon = &AMonitors[monid];
        struct d3d11struct *d3d = &d3d11data[monid];
 
-       if (!d3d->texturelocked || d3d->invalidmode)
+       if (!d3d->texturelocked || d3d->invalidmode || !d3d->texture2dstaging) {
+               d3d->texturelocked = 0;
                return;
+       }
        d3d->texturelocked--;
 
        d3d->m_deviceContext->Unmap(d3d->texture2dstaging, 0);
@@ -5146,7 +5162,7 @@ static void xD3D11_unlocktexture(int monid, int y_start, int y_end)
        } else {
                d3d->osd.enabled = false;
        }
-       if (y_start < 0) {
+       if (y_start < 0 || y_end < 0) {
                d3d->m_deviceContext->CopyResource(d3d->texture2d, d3d->texture2dstaging);
        } else {
                D3D11_BOX box = { 0 };
index 31e4d5b26875ca5d632c2a0eccc4198c0b452b33..b1166a43718c35c81a30dd391e0e93e962c94ec9 100644 (file)
@@ -452,7 +452,7 @@ static const TCHAR *gdi_init(HWND ahwnd, int monid, int w_w, int w_h, int depth,
                *errp = 2;
                return _T("GDI fullscreen not supported");
        }
-
+       gdi_free(monid, true);
        gdi->hwnd = ahwnd;
        gdi->depth = depth;
        gdi->wwidth = w_w;
index 7766d80b119b96f88d9461c9e14af9808c4315d6..a3bf11e6a7a535e4191afc4d6ea7f3b046c67b3a 100644 (file)
@@ -1473,13 +1473,10 @@ int lockscr(struct vidbuffer *vb, bool fullupdate, bool skip)
        }
        gfx_lock();
        if (vb->vram_buffer) {
-               D3D_unlocktexture(vb->monitor_id, -1, -1);
-               vb->bufmem = D3D_locktexture(vb->monitor_id, &vb->rowbytes, NULL, NULL, skip ? -1 : (fullupdate ? 1 : 0));
+               vb->bufmem = D3D_locktexture(vb->monitor_id, &vb->rowbytes, &vb->width_allocated, &vb->height_allocated, skip ? -1 : (fullupdate ? 1 : 0));
                if (vb->bufmem) {
                        ret = 1;
                }
-               vb->width_allocated = mon->currentmode.native_width;
-               vb->height_allocated = mon->currentmode.native_height;
        } else {
                ret = 1;
        }
@@ -1494,11 +1491,11 @@ void unlockscr(struct vidbuffer *vb, int y_start, int y_end)
 {
        struct AmigaMonitor *mon = &AMonitors[vb->monitor_id];
        gfx_lock();
+       vb->locked = false;
        if (vb->vram_buffer) {
                vb->bufmem = NULL;
                D3D_unlocktexture(vb->monitor_id, y_start, y_end);
        }
-       vb->locked = false;
        gfx_unlock();
 }
 
@@ -2929,8 +2926,6 @@ static int modeswitchneeded(struct AmigaMonitor *mon, struct winuae_currentmode
                                mon->currentmode.current_height != wc->current_height ||
                                mon->currentmode.current_depth != wc->current_depth)
                                return -1;
-                       if (!avidinfo->outbuffer->bufmem_lockable)
-                               return -1;
                }
        } else if (isfullscreen () == 0) {
                /* windowed to windowed */
@@ -3850,10 +3845,16 @@ static void allocsoftbuffer(int monid, const TCHAR *name, struct vidbuffer *buf,
 {
        struct vidbuf_description *vidinfo = &adisplays[monid].gfxvidinfo;
 
+       if (buf->initialized && buf->vram_buffer) {
+               return;
+       }
+
        buf->monitor_id = monid;
        buf->pixbytes = (depth + 7) / 8;
        buf->width_allocated = (width + 7) & ~7;
        buf->height_allocated = height;
+       buf->initialized = true;
+       buf->hardwiredpositioning = false;
 
        if (buf == &vidinfo->drawbuffer) {
 
@@ -3861,13 +3862,13 @@ static void allocsoftbuffer(int monid, const TCHAR *name, struct vidbuffer *buf,
                buf->bufmemend = NULL;
                buf->realbufmem = NULL;
                buf->bufmem_allocated = NULL;
-               buf->bufmem_lockable = true;
                buf->vram_buffer = true;
 
                write_log(_T("Mon %d reserved %s draw buffer (%d*%d*%d)\n"), monid, name, width, height, depth);
 
        } else {
 
+               xfree(buf->realbufmem);
                int w = buf->width_allocated;
                int h = buf->height_allocated;
                int size = (w * 2) * (h * 2) * buf->pixbytes;
@@ -3875,10 +3876,9 @@ static void allocsoftbuffer(int monid, const TCHAR *name, struct vidbuffer *buf,
                buf->realbufmem = xcalloc(uae_u8, size);
                buf->bufmem_allocated = buf->bufmem = buf->realbufmem + (h / 2) * buf->rowbytes + (w / 2) * buf->pixbytes;
                buf->bufmemend = buf->realbufmem + size - buf->rowbytes;
-               buf->bufmem_lockable = true;
 
                write_log(_T("Mon %d allocated %s temp buffer (%d*%d*%d) = %p\n"), monid, name, width, height, depth, buf->realbufmem);
-               return;
+
        }
 
 }
@@ -3902,8 +3902,8 @@ retry:
                regqueryint(NULL, wasfsname[1], &wasfs[1]);
 
        gfxmode_reset(mon->monitor_id);
-       freevidbuffer(mon->monitor_id, &avidinfo->drawbuffer);
-       freevidbuffer(mon->monitor_id, &avidinfo->tempbuffer);
+       //freevidbuffer(mon->monitor_id, &avidinfo->drawbuffer);
+       //freevidbuffer(mon->monitor_id, &avidinfo->tempbuffer);
 
        for (;;) {
                updatemodes(mon);
@@ -4101,6 +4101,9 @@ bool target_graphics_buffer_update(int monid, bool force)
        struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
        struct vidbuf_description *avidinfo = &adisplays[monid].gfxvidinfo;
        struct picasso96_state_struct *state = &picasso96_state[monid];
+       struct vidbuffer *vb = NULL, *vbout = NULL;
+
+       gfx_lock();
 
        static bool     graphicsbuffer_retry;
        int w, h;
@@ -4110,34 +4113,47 @@ bool target_graphics_buffer_update(int monid, bool force)
                w = state->Width;
                h = state->Height;
        } else {
-               struct vidbuffer *vb = avidinfo->inbuffer;
+               vb = avidinfo->inbuffer;
+               vbout = avidinfo->outbuffer;
                if (!vb) {
+                       gfx_unlock();
                        return false;
                }
                w = vb->outwidth;
                h = vb->outheight;
        }
        
-       if (!force && oldtex_w[monid] == w && oldtex_h[monid] == h && oldtex_rtg[monid] == mon->screen_is_picasso && D3D_alloctexture(mon->monitor_id, -w, -h)) {
-               osk_setup(monid, -2);
-               return false;
+       if (!force && oldtex_w[monid] == w && oldtex_h[monid] == h && oldtex_rtg[monid] == mon->screen_is_picasso) {
+               if (D3D_alloctexture(mon->monitor_id, -w, -h)) {
+                       osk_setup(monid, -2);
+                       if (vbout) {
+                               vbout->width_allocated = w;
+                               vbout->height_allocated = h;
+                       }
+                       gfx_unlock();
+                       return false;
+               }
        }
 
        if (!w || !h) {
                oldtex_w[monid] = w;
                oldtex_h[monid] = h;
                oldtex_rtg[monid] = mon->screen_is_picasso;
+               gfx_unlock();
                return false;
        }
 
-#if 0
-       S2X_free(mon->monitor_id);
-#endif
        if (!D3D_alloctexture(mon->monitor_id, w, h)) {
                graphicsbuffer_retry = true;
+               gfx_unlock();
                return false;
        }
 
+       if (vbout) {
+               vbout->width_allocated = w;
+               vbout->height_allocated = h;
+       }
+
        if (avidinfo->inbuffer != avidinfo->outbuffer) {
                avidinfo->outbuffer->inwidth = w;
                avidinfo->outbuffer->inheight = h;
@@ -4152,12 +4168,8 @@ bool target_graphics_buffer_update(int monid, bool force)
 
        write_log (_T("Buffer %d size (%d*%d) %s\n"), monid, w, h, mon->screen_is_picasso ? _T("RTG") : _T("Native"));
 
-#if 0
-       if ((mon->currentmode.flags & DM_SWSCALE) && !mon->screen_is_picasso) {
-               if (!S2X_init(mon->monitor_id, mon->currentmode.native_width, mon->currentmode.native_height, mon->currentmode.native_depth))
-                       return false;
-       }
-#endif
+       gfx_unlock();
+
        return true;
 }
 
index e05f417be52c6751d7c6d7082b59508224a8b431..2b66323cf99cf797f0e6ae935cb7ec7334a87dca 100755 (executable)
@@ -78,6 +78,36 @@ static int spm_left_border;
 
 static uae_u8 graffiti_palette[256 * 4];
 
+static bool specialmonitor_setresolution(struct vidbuffer *src, struct vidbuffer *dst, int width, int height, bool nativeposition)
+{
+       src->outwidth = width;
+       src->outheight = height;
+       dst->outwidth = width;
+       dst->outheight = height;
+       dst->inwidth = width;
+       dst->inheight = height;
+       dst->inwidth2 = width;
+       dst->inheight2 = height;
+       src->hardwiredpositioning = !nativeposition;
+       dst->hardwiredpositioning = !nativeposition;
+
+       if (dst->width_allocated != width || dst->height_allocated != height) {
+               bool locked = dst->locked;
+               if (dst->locked) {
+                       unlockscr(dst, false, false);
+               }
+               if (!target_graphics_buffer_update(dst->monitor_id, false)) {
+                       return false;
+               }
+               if (locked) {
+                       if (!lockscr(dst, false, false)) {
+                               return false;
+                       }
+               }
+       }
+       return true;
+}
+
 STATIC_INLINE bool is_transparent(uae_u16 v)
 {
        return v == 0;
@@ -645,7 +675,6 @@ static bool dctv(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines,
        }
 
        if (dctv_enabled) {
-               dst->nativepositioning = true;
                if (monitor != MONITOREMU_DCTV) {
                        monitor = MONITOREMU_DCTV;
                        write_log(_T("DCTV mode\n"));
@@ -834,7 +863,6 @@ static bool firecracker24(struct vidbuffer *src, struct vidbuffer *dst, bool dou
                fc24_y += 2;
        }
 
-       dst->nativepositioning = true;
        if (monitor != MONITOREMU_FIRECRACKER24) {
                monitor = MONITOREMU_FIRECRACKER24;
                write_log(_T("FireCracker mode\n"));
@@ -1419,7 +1447,6 @@ static bool avideo(struct vidbuffer *src, struct vidbuffer *dst, bool doubleline
                }
        }
 
-       dst->nativepositioning = true;
        if (monitor != MONITOREMU_AVIDEO12 && monitor != MONITOREMU_AVIDEO24) {
                monitor = av24 ? MONITOREMU_AVIDEO24 : MONITOREMU_AVIDEO12;
                write_log (_T("AVIDEO%d mode\n"), av24 ? 24 : 12);
@@ -1581,7 +1608,6 @@ static bool videodac18(struct vidbuffer *src, struct vidbuffer *dst, bool double
                }
        }
 
-       dst->nativepositioning = true;
        if (monitor != MONITOREMU_VIDEODAC18) {
                monitor = MONITOREMU_VIDEODAC18;
                write_log (_T("Video DAC 18 mode\n"));
@@ -1806,7 +1832,6 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines
        }
 
        if (was_active) {
-               dst->nativepositioning = true;
                if (monitor != MONITOREMU_HAM_E) {
                        monitor = MONITOREMU_HAM_E;
                        write_log (_T("HAM-E mode, %s\n"), was_active == ham_e_magic_cookie_reg ? _T("REG") : _T("HAM"));
@@ -1995,8 +2020,6 @@ static bool graffiti(struct vidbuffer *src, struct vidbuffer *dst)
                        waitline--;
        }
 
-       dst->nativepositioning = true;
-
        if (monitor != MONITOREMU_GRAFFITI) {
                monitor = MONITOREMU_GRAFFITI;
                write_log (_T("GRAFFITI %s mode\n"), hires ? _T("hires") : _T("lores"));
@@ -2134,6 +2157,10 @@ static bool a2024(struct vidbuffer *src, struct vidbuffer *dst)
        }
        total_height = panel_height * dbl;
        
+       if (!specialmonitor_setresolution(src, dst, (total_width / 2) << currprefs.gfx_resolution, total_height, false)) {
+               return false;
+       }
+
        srcbuf = src->bufmem + (((44 << VRES_MAX) - src->yoffset) / avidinfo->ychange) * src->rowbytes + (((srcxoffset << RES_MAX) - src->xoffset) / avidinfo->xchange) * src->pixbytes;
        dstbuf = dst->bufmem + py * (panel_height / avidinfo->ychange) * dst->rowbytes + px * ((panel_width * 2) / avidinfo->xchange) * dst->pixbytes;
 
@@ -2189,17 +2216,6 @@ static bool a2024(struct vidbuffer *src, struct vidbuffer *dst)
                dstbuf += dst->rowbytes * dbl;
        }
 
-       total_width /= 2;
-       total_width <<= currprefs.gfx_resolution;
-
-       dst->outwidth = total_width;
-       dst->outheight = total_height;
-       dst->inwidth = total_width;
-       dst->inheight = total_height;
-       dst->inwidth2 = total_width;
-       dst->inheight2 = total_height;
-       dst->nativepositioning = false;
-
        if (monitor != MONITOREMU_A2024) {
                monitor = MONITOREMU_A2024;
                write_log (_T("A2024 %dHz %s mode\n"), hires ? 15 : 10, ntsc ? _T("NTSC") : _T("PAL"));
@@ -2650,7 +2666,6 @@ skip:
                genlock_infotext(firstdstline, dst);
        }
 
-       dst->nativepositioning = true;
        return true;
 }
 
@@ -2728,7 +2743,6 @@ static bool do_grayscale(struct vidbuffer *src, struct vidbuffer *dst, bool doub
                }
        }
 
-       dst->nativepositioning = true;
        return true;
 }
 
@@ -3549,7 +3563,6 @@ static bool opalvision(struct vidbuffer *src, struct vidbuffer *dst, bool double
                monitor = MONITOREMU_COLORBURST;
                write_log(_T("Colorburst control line detected\n"));
        }
-       dst->nativepositioning = true;
 
        return true;
 }