From 0d2550e03328bc60896b43809a55e3721daa9ce0 Mon Sep 17 00:00:00 2001 From: IanSB Date: Thu, 15 Jul 2021 13:44:16 +0100 Subject: [PATCH] Ignore cyan on first couple of pixels in coco artifact mode --- src/capture_line_ntsc_8bpp.S | 36 ++++++++++++++++++++++++++++-------- src/defs.h | 2 +- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/capture_line_ntsc_8bpp.S b/src/capture_line_ntsc_8bpp.S index 187e17bf..da7061ce 100644 --- a/src/capture_line_ntsc_8bpp.S +++ b/src/capture_line_ntsc_8bpp.S @@ -154,14 +154,24 @@ skip_psync_loop_no_old\@: eorne r8, r8, #(0x12 << PIXEL_BASE) eorne r8, r8, #(0x12 << (PIXEL_BASE + 6)) + tst r12, #NTSC_DONE_FIRST + andeq r9, r8, #(0x2d << PIXEL_BASE) + cmpeq r9, #(0x20 << PIXEL_BASE) //cyan + orreq r8, r8, #(0x08 << PIXEL_BASE) //makes it mono + + tst r12, #NTSC_DONE_FIRST + andeq r9, r8, #(0x2d << (PIXEL_BASE + 6)) + cmpeq r9, #(0x20 << (PIXEL_BASE + 6)) //cyan + orreq r8, r8, #(0x08 << (PIXEL_BASE + 6)) //makes it mono + eor r9, r8, r8, lsr #3 and r9, r9, r9, lsr #2 tst r9, #(0x01 << PIXEL_BASE) tstne r9, #(0x01 << (PIXEL_BASE + 6)) orreq r3, r3, #BITDUP_LINE_CONDITION_DETECTED //detect if any U/V content - tst r12, #NTSC_IGNORE_FIRST - bicne r3, r3, #BITDUP_LINE_CONDITION_DETECTED - bicne r12, r12, #NTSC_IGNORE_FIRST + tst r12, #NTSC_DONE_FIRST + biceq r3, r3, #BITDUP_LINE_CONDITION_DETECTED + orreq r12, r12, #NTSC_DONE_FIRST and r9, r8, #(0x12 << PIXEL_BASE) and r14, r8, #(0x12 << (PIXEL_BASE + 6)) @@ -181,14 +191,24 @@ skip_psync_loop_no_old\@: eorne r8, r8, #(0x12 << PIXEL_BASE) eorne r8, r8, #(0x12 << (PIXEL_BASE + 6)) + tst r12, #NTSC_DONE_FIRST + andeq r9, r8, #(0x2d << PIXEL_BASE) + cmpeq r9, #(0x20 << PIXEL_BASE) //cyan + orreq r8, r8, #(0x08 << PIXEL_BASE) //makes it mono + + tst r12, #NTSC_DONE_FIRST + andeq r9, r8, #(0x2d << (PIXEL_BASE + 6)) + cmpeq r9, #(0x20 << (PIXEL_BASE + 6)) //cyan + orreq r8, r8, #(0x08 << (PIXEL_BASE + 6)) //makes it mono + eor r9, r8, r8, lsr #3 and r9, r9, r9, lsr #2 tst r9, #(0x01 << PIXEL_BASE) tstne r9, #(0x01 << (PIXEL_BASE + 6)) orreq r3, r3, #BITDUP_LINE_CONDITION_DETECTED //detect if any U/V content - tst r12, #NTSC_IGNORE_FIRST - bicne r3, r3, #BITDUP_LINE_CONDITION_DETECTED - bicne r12, r12, #NTSC_IGNORE_FIRST + tst r12, #NTSC_DONE_FIRST + biceq r3, r3, #BITDUP_LINE_CONDITION_DETECTED + orreq r12, r12, #NTSC_DONE_FIRST and r9, r8, #(0x3f << PIXEL_BASE) and r14, r8, #(0x3f << (PIXEL_BASE + 6)) @@ -1229,7 +1249,7 @@ capture_line_ntsc_sixbits_double_8bpp_mono: push {lr} ldr r12, =ntsc_status ldr r12, [r12] - orr r12, #NTSC_IGNORE_FIRST + bic r12, #NTSC_DONE_FIRST tst r12, #NTSC_ARTIFACT beq no_ntsc_sixbits_double_8bpp_mono SKIP_PSYNC_NO_OLD_CPLD_NTSC // returns with ntsc_status in r12 @@ -1317,7 +1337,7 @@ capture_line_ntsc_sixbits_double_8bpp_mono_auto: push {lr} ldr r12, =ntsc_status ldr r12, [r12] - orr r12, #NTSC_IGNORE_FIRST + bic r12, #NTSC_DONE_FIRST tst r12, #NTSC_ARTIFACT beq no_ntsc_sixbits_double_8bpp_mono_auto SKIP_PSYNC_NO_OLD_CPLD_NTSC // returns with ntsc_status in r12 diff --git a/src/defs.h b/src/defs.h index c2517efe..02cd4378 100644 --- a/src/defs.h +++ b/src/defs.h @@ -300,7 +300,7 @@ typedef struct { #define NTSC_LAST_IIGS 0x100 //not actually ntsc but uses a spare bit #define NTSC_LAST_IIGS_SHIFT 8 #define NTSC_FFOSD_ENABLE 0x200 //not actually ntsc but uses a spare bit -#define NTSC_IGNORE_FIRST 0x400 +#define NTSC_DONE_FIRST 0x400 #define BBC_VERSION 0x79