From 269179aa95dce9867d9e80d8de01bbe5829454d9 Mon Sep 17 00:00:00 2001 From: IanSB Date: Fri, 22 Jan 2021 01:39:53 +0000 Subject: [PATCH 01/14] Increase frame timeout --- src/defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/defs.h b/src/defs.h index 57f45ae2..c383bde9 100644 --- a/src/defs.h +++ b/src/defs.h @@ -280,7 +280,7 @@ typedef struct { #define OTHER_HSYNC_THRESHOLD 9000 #define EQUALISING_THRESHOLD 3400 // equalising pulses are half sync pulse length and must be filtered out #define FRAME_MINIMUM 10000000 // 10ms -#define FRAME_TIMEOUT 24000000 // 24ms which is over a frame / field @ 50Hz (20ms) +#define FRAME_TIMEOUT 30000000 // 30ms which is over a frame / field @ 50Hz (20ms) #define LINE_MINIMUM 20000 // 20uS #define HSYNC_SCROLL_LO (4000 - 224) #define HSYNC_SCROLL_HI (4000 + 224) From 98d62b35ae614aa1153fdae7b3205b5ffda63b17 Mon Sep 17 00:00:00 2001 From: IanSB Date: Fri, 22 Jan 2021 01:41:02 +0000 Subject: [PATCH 02/14] Update profiles --- .../Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_403.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt | 2 +- .../6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt | 3 +++ .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt | 2 +- 7 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt index 79134df8..a438d57e 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,32,640,200,768,240,2,5,0,1,16000000,1016,5000,262,3,1,1 +geometry=184,32,640,200,768,240,2,5,0,1,16000000,1016,5000,264,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_403.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_403.txt index 2fd12095..12c3b825 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_403.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_403.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,45,640,340,768,344,0,0,0,1,16000000,1016,10000,403,3,1,1 +geometry=184,38,640,360,640,400,2,2,0,1,16000000,1016,10000,403,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt index 22a02bf8..d272cada 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=176,19,640,240,768,240,1,2,0,1,16000000,1016,5000,266,3,1,1 +geometry=176,19,640,240,640,240,1,2,0,1,16000000,1016,5000,266,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt index 7e72355b..dd944fca 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,40,640,256,768,320,1,2,0,1,16000000,1024,5000,325,3,1,1 +geometry=124,20,640,256,800,300,1,2,0,1,16000000,1024,5000,325,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt index 63153d46..25cf5325 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,39,640,320,768,320,0,0,0,1,16000000,1024,5600,374,3,1,1 +geometry=184,29,640,340,720,350,2,3,0,1,16000000,1024,5600,374,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt new file mode 100644 index 00000000..4077eab4 --- /dev/null +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt @@ -0,0 +1,3 @@ +sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +geometry=184,29,640,340,720,350,2,3,0,1,16000000,1016,5600,374,3,1,1 +palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt index 1a2b8b30..f419b65e 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt @@ -1,2 +1,2 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=164,37,640,256,768,288,1,2,0,1,16000000,1024,5000,315,3,1,1 +geometry=164,37,640,256,640,256,1,2,0,1,16000000,1024,5000,315,3,1,1 From fb67337591fe3cd60dd3becaa2e3d627272a4ae9 Mon Sep 17 00:00:00 2001 From: IanSB Date: Sat, 23 Jan 2021 04:22:05 +0000 Subject: [PATCH 03/14] Add experimental support for flash floppy OSD overlay --- src/capture_line_fast_simple_16bpp.S | 52 +++++++++++++++++++++++----- src/defs.h | 4 ++- src/rgb_to_fb.S | 29 +++++++++++----- src/rgb_to_hdmi.c | 6 ++-- 4 files changed, 72 insertions(+), 19 deletions(-) diff --git a/src/capture_line_fast_simple_16bpp.S b/src/capture_line_fast_simple_16bpp.S index 682d7262..af59d50d 100644 --- a/src/capture_line_fast_simple_16bpp.S +++ b/src/capture_line_fast_simple_16bpp.S @@ -19,26 +19,62 @@ .global capture_line_default_simple_trailing_both_16bpp .global capture_line_default_simple_leading_both_16bpp +.macro SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO reg + // Pixel in GPIO 13.. 2 -> 15.. 0 + and r9, r8, #0x0f << PIXEL_BASE + eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) + and r12, r8, #0x0f << (PIXEL_BASE + 4) + eor r10, r10, r12, lsl #(3 - PIXEL_BASE) + and r9, r8, #0x0f << (PIXEL_BASE + 8) + eor r12, r10, r9, lsl #(4 - PIXEL_BASE) + and r9, r12, r14 // extract high order bits + tst r3, #BIT_OSD + movne r12, r12, lsr #1 // half intensity for menu (low order bits already 0 + orreq r12, r12, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b + tst r8, #MUX_MASK + orrne r3, #BIT_PROBE + movne r12, #0xff00 + orrne r12, #0x00ff +.endm + +.macro SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI reg + // Pixel in GPIO 13.. 2 -> 31.. 16 + and r9, r8, #0x0f << PIXEL_BASE + mov r10, r9, lsl #(16 - (PIXEL_BASE - 1)) + and r9, r8, #0x0f << (PIXEL_BASE + 4) + eor r10, r10, r9, lsl #(16 + (3 - PIXEL_BASE)) + and r9, r8, #0x0f << (PIXEL_BASE + 8) + eor r10, r10, r9, lsl #(16 + (4 - PIXEL_BASE)) + and r9, r10, r14 // extract high order bits + tst r3, #BIT_OSD + movne r10, r10, lsr #1 // half intensity for menu (low order bits already 0 + orreq r10, r10, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b + tst r8, #MUX_MASK + orrne r10, r10, #(0xff000000) + orrne r10, r10, #(0x00ff0000) + orr \reg, r10, r12 +.endm + .macro COMMON_SIMPLE loop_16bpp_simple\@: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_HI r5 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r5 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_HI r6 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r6 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_HI r7 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r7 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_HI r10 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r10 // input in r8 stmia r0!, {r5, r6, r7, r10} subs r1, r1, #1 diff --git a/src/defs.h b/src/defs.h index c383bde9..f50549b6 100644 --- a/src/defs.h +++ b/src/defs.h @@ -228,7 +228,7 @@ typedef struct { #define VERSION_MASK (1U << VERSION_PIN) #define STROBE_MASK (1U << STROBE_PIN) #define SP_DATA_MASK (1U << SP_DATA_PIN) - +#define MUX_MASK (1U << MUX_PIN) #define GPIO_FLOAT 0x00 #define GPIO_PULLDOWN 0x01 @@ -401,4 +401,6 @@ typedef struct { #define GP_CLK1_DIV (volatile uint32_t *)(PERIPHERAL_BASE + 0x10107C) #define CM_PLLA (volatile uint32_t *)(PERIPHERAL_BASE + 0x101104) +#define CM_BASE (volatile uint32_t *)(PERIPHERAL_BASE + 0x101000) + #endif diff --git a/src/rgb_to_fb.S b/src/rgb_to_fb.S index 1777409e..bffa92c4 100644 --- a/src/rgb_to_fb.S +++ b/src/rgb_to_fb.S @@ -287,6 +287,7 @@ skip_double_check: str r8, frame_countdown bl restore_menu_bits + str r3, flag_state b frame .align 6 // so cache loads align @@ -706,6 +707,7 @@ mod10: ldr r10, vsync_line orr r3, r3, #BIT_NO_SKIP_HSYNC + bic r3, #BIT_PROBE b process_line_loop .align 6 // so cache loads align @@ -739,9 +741,10 @@ process_line_loop: blx r12 // exits with h sync timestamp in r0 // Restore the state used by the outer code - + tst r3, #BIT_PROBE pop {r1-r9, r11, r12} - + biceq r3, r3, #BIT_PROBE + orrne r3, r3, #BIT_PROBE ldr r10, last_hsync_time str r0, last_hsync_time subs r10, r0, r10 @@ -765,6 +768,18 @@ process_line_loop: subs r5, r5, #1 bne process_line_loop + ldr r5, flag_state + and r8, r5, #BIT_PROBE + and r5, r5, #BIT_OSD + + tst r3, #BIT_PROBE + orrne r3, r3, #BIT_OSD + biceq r3, r3, #BIT_OSD + orreq r3, r5 + + bic r3, r3, #BIT_PROBE + orr r3, r3, r8 + tst r3, #BIT_INHIBIT_MODE_DETECT bicne r3, #BIT_MODE7 pop {r11} @@ -1084,6 +1099,8 @@ param_border: param_delay: .word 0 +capture_address: + .word 0 sw1counter: .word 0 @@ -1111,14 +1128,9 @@ buffer_state: .word 0 #endif - - buffer_total: .word 1 -capture_address: - .word 0 - total_lines: .word 0 @@ -1182,7 +1194,8 @@ ntsc_status: sw1_power_up: .word 0 - +flag_state: + .word 0 field_type_threshold: .word 32000 elk_lo_field_sync_threshold: diff --git a/src/rgb_to_hdmi.c b/src/rgb_to_hdmi.c index a75a1a47..bbe2fcb6 100644 --- a/src/rgb_to_hdmi.c +++ b/src/rgb_to_hdmi.c @@ -1412,7 +1412,7 @@ static void init_hardware() { _init_cycle_counter(); RPI_SetGpioPullUpDown(SP_DATA_MASK | SW1_MASK | SW2_MASK | SW3_MASK, GPIO_PULLUP); - RPI_SetGpioPullUpDown(STROBE_MASK | VERSION_MASK, GPIO_PULLDOWN); + RPI_SetGpioPullUpDown(STROBE_MASK | VERSION_MASK | MUX_MASK, GPIO_PULLDOWN); supports8bit = 0; newanalog = 0; @@ -1454,7 +1454,9 @@ static void init_hardware() { if (!version_state) { simple_detected = 1; + RPI_SetGpioPinFunction(MUX_PIN, FS_INPUT); } else { + RPI_SetGpioPinFunction(MUX_PIN, FS_OUTPUT); if (RPI_GetGpioValue(STROBE_PIN) == 1) { // if high then must be V4, if low then could be (V1-3) or V5 newanalog = 1; } else { @@ -1468,7 +1470,7 @@ static void init_hardware() { RPI_SetGpioPinFunction(VERSION_PIN, FS_OUTPUT); RPI_SetGpioPinFunction(MODE7_PIN, FS_OUTPUT); - RPI_SetGpioPinFunction(MUX_PIN, FS_OUTPUT); + RPI_SetGpioPinFunction(SP_CLK_PIN, FS_OUTPUT); RPI_SetGpioPinFunction(LED1_PIN, FS_OUTPUT); From 47b49f09ed1e31029c00593b581eb2cc635e283b Mon Sep 17 00:00:00 2001 From: IanSB Date: Mon, 25 Jan 2021 02:04:27 +0000 Subject: [PATCH 04/14] Update profiles --- .../6-12_BIT_RGB/Commodore_128-80/Big-Text-NTSC_264.txt | 3 --- .../6-12_BIT_RGB/Commodore_128-80/Big-Text-PAL_320.txt | 3 --- .../Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_50Hz.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt | 3 +++ .../Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt | 3 +++ .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt | 2 +- .../Commodore_128-80/{VDC-HFLI_403.txt => VDC-HFLI_426.txt} | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt | 2 +- .../6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt | 3 ++- .../6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_50Hz.txt | 4 ---- .../Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/Default.txt | 1 - .../Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_50Hz.txt | 4 ++++ .../CoCo_3_60Hz.txt => U7_Tandy_CoCo_3_60Hz.txt} | 3 ++- src/scripts/Profiles/CoCo3_50Hz_new.txt | 4 ++++ src/scripts/Profiles/CoCo3_50Hz_new75R.txt | 4 ++++ 19 files changed, 30 insertions(+), 21 deletions(-) delete mode 100644 src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Big-Text-NTSC_264.txt delete mode 100644 src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Big-Text-PAL_320.txt create mode 100644 src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt create mode 100644 src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt rename src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/{VDC-HFLI_403.txt => VDC-HFLI_426.txt} (60%) delete mode 100644 src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_50Hz.txt delete mode 100644 src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/Default.txt create mode 100644 src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_50Hz.txt rename src/scripts/Profiles/6-12_BIT_RGB_Analog/{U7_Tandy_CoCo_3/CoCo_3_60Hz.txt => U7_Tandy_CoCo_3_60Hz.txt} (84%) create mode 100644 src/scripts/Profiles/CoCo3_50Hz_new.txt create mode 100644 src/scripts/Profiles/CoCo3_50Hz_new75R.txt diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Big-Text-NTSC_264.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Big-Text-NTSC_264.txt deleted file mode 100644 index cd9d5e78..00000000 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Big-Text-NTSC_264.txt +++ /dev/null @@ -1,3 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,32,640,200,768,250,2,5,0,1,16000000,1017,5000,264,3,1,1 -palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Big-Text-PAL_320.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Big-Text-PAL_320.txt deleted file mode 100644 index 50e57b42..00000000 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Big-Text-PAL_320.txt +++ /dev/null @@ -1,3 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,31,640,256,768,288,1,2,0,1,16000000,1017,5000,320,3,1,1 -palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_50Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_50Hz.txt index dd870984..74fd3731 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_50Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_50Hz.txt @@ -1,3 +1,3 @@ sampling=1,1,1,1,1,1,1,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,57,640,200,768,286,1,2,0,1,16000000,1024,5000,312,3,1,1 +geometry=184,58,640,200,768,286,1,2,0,1,16000000,1024,5000,312,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt index a438d57e..bff9179c 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,32,640,200,768,240,2,5,0,1,16000000,1016,5000,264,3,1,1 +geometry=176,34,640,200,768,240,2,5,0,1,16000000,1016,5000,264,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt new file mode 100644 index 00000000..9f7ffd70 --- /dev/null +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt @@ -0,0 +1,3 @@ +sampling=0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +geometry=136,33,720,224,768,250,2,5,0,1,16000000,1017,5000,264,3,1,1 +palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt new file mode 100644 index 00000000..e336a295 --- /dev/null +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt @@ -0,0 +1,3 @@ +sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +geometry=132,28,720,274,768,288,1,2,0,1,16000000,1017,5000,320,3,1,1 +palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt index 012d481c..897053c6 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,25,640,256,768,288,1,2,0,1,16000000,1016,5000,295,3,1,1 +geometry=256,27,480,252,768,288,1,2,0,1,16000000,1016,5000,295,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_403.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_426.txt similarity index 60% rename from src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_403.txt rename to src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_426.txt index 12c3b825..567bfa2c 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_403.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_426.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,38,640,360,640,400,2,2,0,1,16000000,1016,10000,403,3,1,1 +geometry=176,29,640,360,640,400,2,2,0,1,16000000,1016,10000,426,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt index d272cada..23bf30fd 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=176,19,640,240,640,240,1,2,0,1,16000000,1016,5000,266,3,1,1 +geometry=176,20,640,240,640,240,1,2,0,1,16000000,1016,5000,266,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt index dd944fca..1751ef09 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=124,20,640,256,800,300,1,2,0,1,16000000,1024,5000,325,3,1,1 +geometry=184,41,640,256,800,300,1,2,0,1,16000000,1024,5000,325,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt index 25cf5325..1d06cfc1 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,29,640,340,720,350,2,3,0,1,16000000,1024,5600,374,3,1,1 +geometry=184,23,640,340,720,350,2,3,0,1,16000000,1024,5600,374,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt index 4077eab4..b0cf3138 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i_V1.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,29,640,340,720,350,2,3,0,1,16000000,1016,5600,374,3,1,1 +geometry=184,23,640,340,720,350,2,3,0,1,16000000,1016,5600,374,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt index f419b65e..a16d4365 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt @@ -1,2 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=164,37,640,256,640,256,1,2,0,1,16000000,1024,5000,315,3,1,1 +geometry=168,37,640,256,640,288,1,2,0,1,16000000,1024,5000,315,3,1,1 +palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_50Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_50Hz.txt deleted file mode 100644 index 53ed1e8f..00000000 --- a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_50Hz.txt +++ /dev/null @@ -1,4 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,7,1,0,119,55,119,55,100,87,87,87 -geometry=100,57,640,200,720,286,2,5,1,1,14237500,912,5000,312,5,0,0 -palette=RrGgBb_(EGA) -palette_control=2 diff --git a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/Default.txt b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/Default.txt deleted file mode 100644 index d2b4e6bf..00000000 --- a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/Default.txt +++ /dev/null @@ -1 +0,0 @@ -auto_switch=1 diff --git a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_50Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_50Hz.txt new file mode 100644 index 00000000..b93dab03 --- /dev/null +++ b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_50Hz.txt @@ -0,0 +1,4 @@ +sampling=3,3,3,3,3,3,3,0,1,0,7,0,0,0,0,0,0,7,0,0,135,66,135,66,129,101,101,101 +geometry=108,55,640,202,768,286,1,2,1,1,14237500,912,5000,314,5,0,0 +palette=RrGgBb_(EGA) +palette_control=3 diff --git a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_60Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_60Hz.txt similarity index 84% rename from src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_60Hz.txt rename to src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_60Hz.txt index 46c41582..5dc259a4 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_60Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_60Hz.txt @@ -1,4 +1,5 @@ sampling=0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,7,1,0,129,65,129,65,100,97,97,97 geometry=100,32,640,200,720,240,2,5,1,1,14318180,912,5000,262,5,0,0 palette=RrGgBb_(EGA) -palette_control=2 +palette_control=3 +ntsc_phase=2 diff --git a/src/scripts/Profiles/CoCo3_50Hz_new.txt b/src/scripts/Profiles/CoCo3_50Hz_new.txt new file mode 100644 index 00000000..b93dab03 --- /dev/null +++ b/src/scripts/Profiles/CoCo3_50Hz_new.txt @@ -0,0 +1,4 @@ +sampling=3,3,3,3,3,3,3,0,1,0,7,0,0,0,0,0,0,7,0,0,135,66,135,66,129,101,101,101 +geometry=108,55,640,202,768,286,1,2,1,1,14237500,912,5000,314,5,0,0 +palette=RrGgBb_(EGA) +palette_control=3 diff --git a/src/scripts/Profiles/CoCo3_50Hz_new75R.txt b/src/scripts/Profiles/CoCo3_50Hz_new75R.txt new file mode 100644 index 00000000..890aa774 --- /dev/null +++ b/src/scripts/Profiles/CoCo3_50Hz_new75R.txt @@ -0,0 +1,4 @@ +sampling=3,3,3,3,3,3,3,0,1,0,7,0,0,0,0,0,0,7,1,0,119,55,119,55,129,87,87,87 +geometry=108,55,640,202,768,286,1,2,1,1,14237500,912,5000,314,5,0,0 +palette=RrGgBb_(EGA) +palette_control=3 From ed6087a129e853aa82bb4de7ec9280f4dc3992cc Mon Sep 17 00:00:00 2001 From: IanSB Date: Mon, 25 Jan 2021 14:52:16 +0000 Subject: [PATCH 05/14] Improve FF OSD overlay --- src/capture_line_fast_simple_16bpp.S | 185 ++++++++++++++++++++++++--- src/rgb_to_fb.S | 13 +- 2 files changed, 179 insertions(+), 19 deletions(-) diff --git a/src/capture_line_fast_simple_16bpp.S b/src/capture_line_fast_simple_16bpp.S index af59d50d..0531598b 100644 --- a/src/capture_line_fast_simple_16bpp.S +++ b/src/capture_line_fast_simple_16bpp.S @@ -20,6 +20,31 @@ .global capture_line_default_simple_leading_both_16bpp .macro SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO reg + // Pixel in GPIO 13.. 2 -> 15.. 0 + and r9, r8, #0x0f << PIXEL_BASE + eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) + and r12, r8, #0x0f << (PIXEL_BASE + 4) + eor r10, r10, r12, lsl #(3 - PIXEL_BASE) + and r9, r8, #0x0f << (PIXEL_BASE + 8) + tst r8, #MUX_MASK + eor r10, r10, r9, lsl #(4 - PIXEL_BASE) + orrne r3, #BIT_PROBE +.endm + +.macro SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI reg + // Pixel in GPIO 13.. 2 -> 31.. 16 + and r9, r8, #0x0f << PIXEL_BASE + eor r10, r10, r9, lsl #(16 - (PIXEL_BASE - 1)) + and r12, r8, #0x0f << (PIXEL_BASE + 4) + eor r10, r10, r12, lsl #(16 + (3 - PIXEL_BASE)) + and r9, r8, #0x0f << (PIXEL_BASE + 8) + eor r10, r10, r9, lsl #(16 + (4 - PIXEL_BASE)) + and r9, r10, r14 // extract high order bits + orr \reg, r10, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b +.endm + + +.macro OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO reg // Pixel in GPIO 13.. 2 -> 15.. 0 and r9, r8, #0x0f << PIXEL_BASE eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) @@ -27,17 +52,17 @@ eor r10, r10, r12, lsl #(3 - PIXEL_BASE) and r9, r8, #0x0f << (PIXEL_BASE + 8) eor r12, r10, r9, lsl #(4 - PIXEL_BASE) - and r9, r12, r14 // extract high order bits tst r3, #BIT_OSD + and r9, r12, r14 // extract high order bits movne r12, r12, lsr #1 // half intensity for menu (low order bits already 0 orreq r12, r12, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b tst r8, #MUX_MASK orrne r3, #BIT_PROBE - movne r12, #0xff00 + orrne r12, #0xff00 orrne r12, #0x00ff .endm -.macro SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI reg +.macro OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI reg // Pixel in GPIO 13.. 2 -> 31.. 16 and r9, r8, #0x0f << PIXEL_BASE mov r10, r9, lsl #(16 - (PIXEL_BASE - 1)) @@ -45,8 +70,8 @@ eor r10, r10, r9, lsl #(16 + (3 - PIXEL_BASE)) and r9, r8, #0x0f << (PIXEL_BASE + 8) eor r10, r10, r9, lsl #(16 + (4 - PIXEL_BASE)) + tst r3, #BIT_OSD and r9, r10, r14 // extract high order bits - tst r3, #BIT_OSD movne r10, r10, lsr #1 // half intensity for menu (low order bits already 0 orreq r10, r10, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b tst r8, #MUX_MASK @@ -82,39 +107,96 @@ loop_16bpp_simple\@: mov r0, r2 pop {pc} +.endm +.macro OSD_COMMON_SIMPLE +loop_16bpp_osd_simple\@: + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r5 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r6 // input in r8 + + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r7 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r10 // input in r8 + stmia r0!, {r5, r6, r7, r10} + + subs r1, r1, #1 + bne loop_16bpp_osd_simple\@ + + mov r0, r2 + pop {pc} .endm + .macro COMMON_DEFAULT push {r2} mov r2, r12 loop_16bpp_default\@: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_HI r5 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r5 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_HI r6 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r6 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_HI r7 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r7 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 - CAPTURE_TWELVE_BITS_16BPP_HI r10 // input in r8 + SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r10 // input in r8 WRITE_R5_R6_R7_R10_16BPP subs r1, r1, #1 bne loop_16bpp_default\@ pop {r0, pc} +.endm +.macro OSD_COMMON_DEFAULT + push {r2} + mov r2, r12 +loop_16bpp_osd_default\@: + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r5 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r6 // input in r8 + + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r7 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 + WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 + OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI r10 // input in r8 + WRITE_R5_R6_R7_R10_16BPP + + subs r1, r1, #1 + bne loop_16bpp_osd_default\@ + + pop {r0, pc} .endm + // The capture line function is provided the following: // r0 = pointer to current line in frame buffer // r1 = number of complete psync cycles to capture (=param_chars_per_line) @@ -138,11 +220,18 @@ capture_line_fast_simple_trailing_pos_16bpp: SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 bic r3, r3, #PSYNC_MASK // only +ve edge (inverted later) + tst r3, #BIT_OSD + bne OSD_capture_line_fast_simple_trailing_pos_16bpp SKIP_PSYNC_SIMPLE_TRAILING_SINGLE_EDGE_FAST COMMON_SIMPLE preload_capture_line_fast_simple_trailing_pos_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_fast_simple_trailing_pos_16bpp +OSD_capture_line_fast_simple_trailing_pos_16bpp: + SKIP_PSYNC_SIMPLE_TRAILING_SINGLE_EDGE_FAST + OSD_COMMON_SIMPLE + + .ltorg .align 6 @@ -153,26 +242,39 @@ capture_line_fast_simple_leading_pos_16bpp: SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 bic r3, r3, #PSYNC_MASK // only +ve edge (inverted later) + tst r3, #BIT_OSD + bne OSD_capture_line_fast_simple_leading_pos_16bpp SKIP_PSYNC_SIMPLE_LEADING_SINGLE_EDGE_FAST COMMON_SIMPLE preload_capture_line_fast_simple_leading_pos_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_fast_simple_leading_pos_16bpp +OSD_capture_line_fast_simple_leading_pos_16bpp: + SKIP_PSYNC_SIMPLE_LEADING_SINGLE_EDGE_FAST + OSD_COMMON_SIMPLE + + .ltorg .align 6 - // *** 16 bit *** + // *** 16 bit *** *** this one used by amiga b preload_capture_line_fast_simple_trailing_neg_16bpp capture_line_fast_simple_trailing_neg_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 orr r3, r3, #PSYNC_MASK // only -ve edge (inverted later) + tst r3, #BIT_OSD + bne OSD_capture_line_fast_simple_trailing_neg_16bpp SKIP_PSYNC_SIMPLE_TRAILING_SINGLE_EDGE_FAST COMMON_SIMPLE preload_capture_line_fast_simple_trailing_neg_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_fast_simple_trailing_neg_16bpp +OSD_capture_line_fast_simple_trailing_neg_16bpp: + SKIP_PSYNC_SIMPLE_TRAILING_SINGLE_EDGE_FAST + OSD_COMMON_SIMPLE + .ltorg .align 6 @@ -183,11 +285,18 @@ capture_line_fast_simple_leading_neg_16bpp: SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 orr r3, r3, #PSYNC_MASK // only -ve edge (inverted later) + tst r3, #BIT_OSD + bne OSD_capture_line_fast_simple_leading_neg_16bpp SKIP_PSYNC_SIMPLE_LEADING_SINGLE_EDGE_FAST COMMON_SIMPLE preload_capture_line_fast_simple_leading_neg_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_fast_simple_leading_neg_16bpp +OSD_capture_line_fast_simple_leading_neg_16bpp: + SKIP_PSYNC_SIMPLE_LEADING_SINGLE_EDGE_FAST + OSD_COMMON_SIMPLE + + .ltorg .align 6 @@ -197,11 +306,17 @@ capture_line_fast_simple_trailing_both_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 + tst r3, #BIT_OSD + bne OSD_capture_line_fast_simple_trailing_both_16bpp SKIP_PSYNC_SIMPLE_TRAILING_FAST COMMON_SIMPLE preload_capture_line_fast_simple_trailing_both_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_fast_simple_trailing_both_16bpp +OSD_capture_line_fast_simple_trailing_both_16bpp: + SKIP_PSYNC_SIMPLE_TRAILING_FAST + OSD_COMMON_SIMPLE + .ltorg .align 6 @@ -211,12 +326,16 @@ capture_line_fast_simple_leading_both_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 + tst r3, #BIT_OSD + bne OSD_capture_line_fast_simple_leading_both_16bpp SKIP_PSYNC_SIMPLE_LEADING_FAST COMMON_SIMPLE preload_capture_line_fast_simple_leading_both_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_fast_simple_leading_both_16bpp - +OSD_capture_line_fast_simple_leading_both_16bpp: + SKIP_PSYNC_SIMPLE_LEADING_FAST + OSD_COMMON_SIMPLE //********************************************* @@ -230,13 +349,19 @@ capture_line_default_simple_trailing_pos_16bpp: SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 bic r3, r3, #PSYNC_MASK // only +ve edge (inverted later) + tst r3, #BIT_OSD + bne OSD_capture_line_default_simple_trailing_pos_16bpp SKIP_PSYNC_SIMPLE_TRAILING_SINGLE_EDGE_FAST COMMON_DEFAULT preload_capture_line_default_simple_trailing_pos_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_default_simple_trailing_pos_16bpp - +OSD_capture_line_default_simple_trailing_pos_16bpp: + SKIP_PSYNC_SIMPLE_TRAILING_SINGLE_EDGE_FAST + OSD_COMMON_DEFAULT .ltorg + + .align 6 // *** 16 bit *** b preload_capture_line_default_simple_leading_pos_16bpp @@ -246,11 +371,16 @@ capture_line_default_simple_leading_pos_16bpp: SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 bic r3, r3, #PSYNC_MASK // only +ve edge (inverted later) + tst r3, #BIT_OSD + bne OSD_capture_line_default_simple_leading_pos_16bpp SKIP_PSYNC_SIMPLE_LEADING_SINGLE_EDGE_FAST COMMON_DEFAULT preload_capture_line_default_simple_leading_pos_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_default_simple_leading_pos_16bpp +OSD_capture_line_default_simple_leading_pos_16bpp: + SKIP_PSYNC_SIMPLE_LEADING_SINGLE_EDGE_FAST + OSD_COMMON_DEFAULT .ltorg .align 6 @@ -262,11 +392,17 @@ capture_line_default_simple_trailing_neg_16bpp: SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 orr r3, r3, #PSYNC_MASK // only -ve edge (inverted later) + tst r3, #BIT_OSD + bne OSD_capture_line_default_simple_trailing_neg_16bpp SKIP_PSYNC_SIMPLE_TRAILING_SINGLE_EDGE_FAST COMMON_DEFAULT preload_capture_line_default_simple_trailing_neg_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_default_simple_trailing_neg_16bpp +OSD_capture_line_default_simple_trailing_neg_16bpp: + SKIP_PSYNC_SIMPLE_TRAILING_SINGLE_EDGE_FAST + OSD_COMMON_DEFAULT + .ltorg .align 6 @@ -278,11 +414,16 @@ capture_line_default_simple_leading_neg_16bpp: SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 orr r3, r3, #PSYNC_MASK // only -ve edge (inverted later) + tst r3, #BIT_OSD + bne OSD_capture_line_default_simple_leading_neg_16bpp SKIP_PSYNC_SIMPLE_LEADING_SINGLE_EDGE_FAST COMMON_DEFAULT preload_capture_line_default_simple_leading_neg_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_default_simple_leading_neg_16bpp +OSD_capture_line_default_simple_leading_neg_16bpp: + SKIP_PSYNC_SIMPLE_LEADING_SINGLE_EDGE_FAST + OSD_COMMON_DEFAULT .ltorg .align 6 @@ -293,11 +434,17 @@ capture_line_default_simple_trailing_both_16bpp: mov r12, r2 SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 + tst r3, #BIT_OSD + bne capture_line_default_simple_trailing_both_16bpp SKIP_PSYNC_SIMPLE_TRAILING_FAST COMMON_DEFAULT preload_capture_line_default_simple_trailing_both_16bpp: SETUP_DUMMY_PARAMETERS b capture_line_default_simple_trailing_both_16bpp +OSD_capture_line_default_simple_trailing_both_16bpp: + SKIP_PSYNC_SIMPLE_TRAILING_FAST + OSD_COMMON_DEFAULT + .ltorg .align 6 @@ -308,8 +455,14 @@ capture_line_default_simple_leading_both_16bpp: mov r12, r2 SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 + tst r3, #BIT_OSD + bne OSD_capture_line_default_simple_leading_both_16bpp SKIP_PSYNC_SIMPLE_LEADING_FAST COMMON_DEFAULT preload_capture_line_default_simple_leading_both_16bpp: SETUP_DUMMY_PARAMETERS - b capture_line_default_simple_leading_both_16bpp \ No newline at end of file + b capture_line_default_simple_leading_both_16bpp +OSD_capture_line_default_simple_leading_both_16bpp: + SKIP_PSYNC_SIMPLE_LEADING_FAST + OSD_COMMON_DEFAULT + diff --git a/src/rgb_to_fb.S b/src/rgb_to_fb.S index bffa92c4..4a3a3b27 100644 --- a/src/rgb_to_fb.S +++ b/src/rgb_to_fb.S @@ -665,14 +665,20 @@ skip_line_loop: skip_line_loop_exit: push {r1-r5, r11} - + push {r3} + orr r3, r3, #BIT_OSD + ldr r12, capture_address + sub r12, r12, #4 + // Call preload capture line function (runs all paths of capture code to preload it into cache - OSD version) + // waits for csync so loses one line + blx r12 + pop {r3} ldr r12, capture_address sub r12, r12, #4 // Call preload capture line function (runs all paths of capture code to preload it into cache) // waits for csync so loses one line blx r12 pop {r1-r5, r11} - mov r6, #0 str r6, total_hsync_period @@ -736,7 +742,8 @@ process_line_loop: // Load the address of the capture_line function into r12 mov r0, r11 - + tst r3, #BIT_OSD + orrne r3, r3, #BIT_NO_SCANLINES //disable scanlines if OSD on // Call capture line function blx r12 // exits with h sync timestamp in r0 From d68d4ddc69d112a94b1ffea595e00e9e6f34ff85 Mon Sep 17 00:00:00 2001 From: IanSB Date: Tue, 26 Jan 2021 02:36:33 +0000 Subject: [PATCH 06/14] Update profiles --- .../6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt | 2 +- .../Profiles/6-12_BIT_RGB/Commodore_128-80/Default.txt | 2 +- .../6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt | 2 +- .../6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt | 2 +- .../6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt | 4 ++-- .../6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_426.txt | 4 ++-- .../6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt | 2 +- .../6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt | 2 +- .../6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt | 4 ++-- .../6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt | 2 +- .../CoCo_3_50Hz.txt} | 3 ++- .../CoCo_3_60Hz.txt} | 2 +- src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_50Hz.txt | 6 ------ src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz.txt | 6 ------ .../Profiles/Simple/Amiga+Aspect/Amiga_60Hz_PAL.txt | 6 ------ .../Simple/Amiga-Scanline0%+Aspect/Amiga_50Hz.txt | 7 ------- .../Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz.txt | 7 ------- .../Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz_PAL.txt | 7 ------- src/scripts/Profiles/Simple/Amiga-Scanline0%/Default.txt | 1 - .../Simple/Amiga-Scanline50%+Aspect/Amiga_50Hz.txt | 8 -------- .../Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz.txt | 8 -------- .../Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz_PAL.txt | 8 -------- .../Profiles/Simple/Amiga-Scanline50%+Aspect/Default.txt | 1 - src/scripts/Profiles/Simple/Amiga-Scanline50%/Default.txt | 1 - .../Amiga_50Hz.txt | 0 .../Amiga_60Hz.txt | 0 .../Amiga_60Hz_PAL.txt | 0 .../{Amiga+Aspect => Amiga_Blk-Scanlines}/Default.txt | 0 .../Amiga_50Hz.txt | 5 ++--- .../Amiga_60Hz.txt | 5 ++--- .../Amiga_60Hz_PAL.txt | 5 ++--- .../Default.txt | 0 32 files changed, 22 insertions(+), 90 deletions(-) rename src/scripts/Profiles/6-12_BIT_RGB_Analog/{U7_Tandy_CoCo_3_50Hz.txt => U7_Tandy_CoCo_3/CoCo_3_50Hz.txt} (61%) rename src/scripts/Profiles/6-12_BIT_RGB_Analog/{U7_Tandy_CoCo_3_60Hz.txt => U7_Tandy_CoCo_3/CoCo_3_60Hz.txt} (67%) delete mode 100644 src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_50Hz.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz_PAL.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_50Hz.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz_PAL.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline0%/Default.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_50Hz.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz_PAL.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Default.txt delete mode 100644 src/scripts/Profiles/Simple/Amiga-Scanline50%/Default.txt rename src/scripts/Profiles/Simple/{Amiga-Scanline0% => Amiga_Blk-Scanlines}/Amiga_50Hz.txt (100%) rename src/scripts/Profiles/Simple/{Amiga-Scanline0% => Amiga_Blk-Scanlines}/Amiga_60Hz.txt (100%) rename src/scripts/Profiles/Simple/{Amiga-Scanline0% => Amiga_Blk-Scanlines}/Amiga_60Hz_PAL.txt (100%) rename src/scripts/Profiles/Simple/{Amiga+Aspect => Amiga_Blk-Scanlines}/Default.txt (100%) rename src/scripts/Profiles/Simple/{Amiga-Scanline50% => Amiga_Var-Scanlines}/Amiga_50Hz.txt (76%) rename src/scripts/Profiles/Simple/{Amiga-Scanline50% => Amiga_Var-Scanlines}/Amiga_60Hz.txt (76%) rename src/scripts/Profiles/Simple/{Amiga-Scanline50% => Amiga_Var-Scanlines}/Amiga_60Hz_PAL.txt (76%) rename src/scripts/Profiles/Simple/{Amiga-Scanline0%+Aspect => Amiga_Var-Scanlines}/Default.txt (100%) diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt index bff9179c..61116761 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Cmd_128_60Hz.txt @@ -1,3 +1,3 @@ -sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +sampling=1,1,1,1,1,1,1,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 geometry=176,34,640,200,768,240,2,5,0,1,16000000,1016,5000,264,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Default.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Default.txt index d2b4e6bf..4cf7d091 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Default.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Default.txt @@ -1 +1 @@ -auto_switch=1 +auto_switch=0 diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt index 9f7ffd70..35edcb42 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-NTSC_264.txt @@ -1,3 +1,3 @@ -sampling=0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +sampling=1,1,1,1,1,1,1,0,0,0,6,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 geometry=136,33,720,224,768,250,2,5,0,1,16000000,1017,5000,264,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt index e336a295..9bc08152 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/Text-PAL_320.txt @@ -1,3 +1,3 @@ -sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +sampling=1,1,1,1,1,1,1,0,0,0,2,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 geometry=132,28,720,274,768,288,1,2,0,1,16000000,1017,5000,320,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt index 897053c6..55e27466 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-FLI_295.txt @@ -1,3 +1,3 @@ -sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=256,27,480,252,768,288,1,2,0,1,16000000,1016,5000,295,3,1,1 +sampling=2,2,2,2,2,2,2,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +geometry=256,27,480,252,480,252,1,2,0,1,16000000,1016,5000,295,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_426.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_426.txt index 567bfa2c..d24fc6fb 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_426.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-HFLI_426.txt @@ -1,3 +1,3 @@ -sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=176,29,640,360,640,400,2,2,0,1,16000000,1016,10000,426,3,1,1 +sampling=2,2,2,2,2,2,2,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +geometry=176,40,640,360,640,400,2,2,0,1,16000000,1016,10000,426,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt index 23bf30fd..edc64511 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IHFLI_266.txt @@ -1,3 +1,3 @@ -sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +sampling=2,2,2,2,2,2,2,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 geometry=176,20,640,240,640,240,1,2,0,1,16000000,1016,5000,266,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt index 1751ef09..5a4da4b6 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IM800_651i.txt @@ -1,3 +1,3 @@ sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,41,640,256,800,300,1,2,0,1,16000000,1024,5000,325,3,1,1 +geometry=104,41,800,270,800,300,1,2,0,1,16000000,1024,5000,325,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt index 1d06cfc1..012d7b86 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-IMONO_749i.txt @@ -1,3 +1,3 @@ -sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 -geometry=184,23,640,340,720,350,2,3,0,1,16000000,1024,5600,374,3,1,1 +sampling=1,1,1,1,1,1,1,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +geometry=144,18,720,350,720,350,2,3,0,1,16000000,1024,5600,374,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt index a16d4365..b1079b46 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Commodore_128-80/VDC-ITFLI_315.txt @@ -1,3 +1,3 @@ -sampling=0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 +sampling=2,2,2,2,2,2,2,0,0,0,5,0,0,0,0,0,0,1,0,0,100,256,100,256,100,256,256,256 geometry=168,37,640,256,640,288,1,2,0,1,16000000,1024,5000,315,3,1,1 palette=RGBI diff --git a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_50Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_50Hz.txt similarity index 61% rename from src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_50Hz.txt rename to src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_50Hz.txt index b93dab03..ce380961 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_50Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_50Hz.txt @@ -1,4 +1,5 @@ sampling=3,3,3,3,3,3,3,0,1,0,7,0,0,0,0,0,0,7,0,0,135,66,135,66,129,101,101,101 -geometry=108,55,640,202,768,286,1,2,1,1,14237500,912,5000,314,5,0,0 +geometry=108,55,640,202,768,286,1,2,1,1,14237500,912,5000,313,5,0,0 palette=RrGgBb_(EGA) palette_control=3 +ntsc_phase=2 diff --git a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_60Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_60Hz.txt similarity index 67% rename from src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_60Hz.txt rename to src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_60Hz.txt index 5dc259a4..cb68f95b 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3_60Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB_Analog/U7_Tandy_CoCo_3/CoCo_3_60Hz.txt @@ -1,5 +1,5 @@ sampling=0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,7,1,0,129,65,129,65,100,97,97,97 -geometry=100,32,640,200,720,240,2,5,1,1,14318180,912,5000,262,5,0,0 +geometry=100,32,640,200,720,240,2,5,1,1,14318180,912,5000,263,5,0,0 palette=RrGgBb_(EGA) palette_control=3 ntsc_phase=2 diff --git a/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_50Hz.txt b/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_50Hz.txt deleted file mode 100644 index 9aa1ab1a..00000000 --- a/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_50Hz.txt +++ /dev/null @@ -1,6 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,256,256,256 -geometry=136,35,640,256,712,270,1,2,0,2,14187580,908,5000,313,4,1,1 -palette=RrGgBb_(EGA) -scanline_level=0 -swap_aspect=1 -overclock_core=50 diff --git a/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz.txt b/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz.txt deleted file mode 100644 index 82ecff4c..00000000 --- a/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz.txt +++ /dev/null @@ -1,6 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,127,127,127 -geometry=136,34,640,200,712,224,2,5,0,2,14318181,910,5000,263,4,1,1 -palette=RrGgBb_(EGA) -scanline_level=0 -swap_aspect=1 -overclock_core=50 diff --git a/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz_PAL.txt b/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz_PAL.txt deleted file mode 100644 index a3aba2a7..00000000 --- a/src/scripts/Profiles/Simple/Amiga+Aspect/Amiga_60Hz_PAL.txt +++ /dev/null @@ -1,6 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,127,127,127 -geometry=136,34,640,200,712,224,2,5,0,2,14187580,910,5000,263,4,1,1 -palette=RrGgBb_(EGA) -scanline_level=0 -swap_aspect=1 -overclock_core=50 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_50Hz.txt b/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_50Hz.txt deleted file mode 100644 index 48aa9576..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_50Hz.txt +++ /dev/null @@ -1,7 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,256,256,256 -geometry=136,35,640,256,712,270,1,2,0,2,14187580,908,5000,313,4,1,1 -palette=RrGgBb_(EGA) -scanlines=1 -scanline_level=0 -swap_aspect=1 -overclock_core=50 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz.txt b/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz.txt deleted file mode 100644 index 5d8b5459..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz.txt +++ /dev/null @@ -1,7 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,127,127,127 -geometry=136,34,640,200,712,224,2,5,0,2,14318181,910,5000,263,4,1,1 -palette=RrGgBb_(EGA) -scanlines=1 -scanline_level=0 -swap_aspect=1 -overclock_core=50 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz_PAL.txt b/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz_PAL.txt deleted file mode 100644 index d45fddc1..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Amiga_60Hz_PAL.txt +++ /dev/null @@ -1,7 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,127,127,127 -geometry=136,34,640,200,712,224,2,5,0,2,14187580,910,5000,263,4,1,1 -palette=RrGgBb_(EGA) -scanlines=1 -scanline_level=0 -swap_aspect=1 -overclock_core=50 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline0%/Default.txt b/src/scripts/Profiles/Simple/Amiga-Scanline0%/Default.txt deleted file mode 100644 index d2b4e6bf..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline0%/Default.txt +++ /dev/null @@ -1 +0,0 @@ -auto_switch=1 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_50Hz.txt b/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_50Hz.txt deleted file mode 100644 index 9de80feb..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_50Hz.txt +++ /dev/null @@ -1,8 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,256,256,256 -geometry=136,35,640,256,712,270,1,2,1,2,14187580,908,5000,313,4,1,1 -palette=RrGgBb_(EGA) -scanlines=1 -scanline_level=8 -swap_aspect=1 -overclock_cpu=60 -overclock_core=160 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz.txt b/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz.txt deleted file mode 100644 index 7cf880aa..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz.txt +++ /dev/null @@ -1,8 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,127,127,127 -geometry=136,34,640,200,712,224,2,5,1,2,14318181,910,5000,263,4,1,1 -palette=RrGgBb_(EGA) -scanlines=1 -scanline_level=8 -swap_aspect=1 -overclock_cpu=60 -overclock_core=160 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz_PAL.txt b/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz_PAL.txt deleted file mode 100644 index df2e04df..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Amiga_60Hz_PAL.txt +++ /dev/null @@ -1,8 +0,0 @@ -sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,127,127,127 -geometry=136,34,640,200,712,224,2,5,1,2,14187580,910,5000,263,4,1,1 -palette=RrGgBb_(EGA) -scanlines=1 -scanline_level=8 -swap_aspect=1 -overclock_cpu=60 -overclock_core=160 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Default.txt b/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Default.txt deleted file mode 100644 index d2b4e6bf..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline50%+Aspect/Default.txt +++ /dev/null @@ -1 +0,0 @@ -auto_switch=1 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline50%/Default.txt b/src/scripts/Profiles/Simple/Amiga-Scanline50%/Default.txt deleted file mode 100644 index d2b4e6bf..00000000 --- a/src/scripts/Profiles/Simple/Amiga-Scanline50%/Default.txt +++ /dev/null @@ -1 +0,0 @@ -auto_switch=1 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline0%/Amiga_50Hz.txt b/src/scripts/Profiles/Simple/Amiga_Blk-Scanlines/Amiga_50Hz.txt similarity index 100% rename from src/scripts/Profiles/Simple/Amiga-Scanline0%/Amiga_50Hz.txt rename to src/scripts/Profiles/Simple/Amiga_Blk-Scanlines/Amiga_50Hz.txt diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline0%/Amiga_60Hz.txt b/src/scripts/Profiles/Simple/Amiga_Blk-Scanlines/Amiga_60Hz.txt similarity index 100% rename from src/scripts/Profiles/Simple/Amiga-Scanline0%/Amiga_60Hz.txt rename to src/scripts/Profiles/Simple/Amiga_Blk-Scanlines/Amiga_60Hz.txt diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline0%/Amiga_60Hz_PAL.txt b/src/scripts/Profiles/Simple/Amiga_Blk-Scanlines/Amiga_60Hz_PAL.txt similarity index 100% rename from src/scripts/Profiles/Simple/Amiga-Scanline0%/Amiga_60Hz_PAL.txt rename to src/scripts/Profiles/Simple/Amiga_Blk-Scanlines/Amiga_60Hz_PAL.txt diff --git a/src/scripts/Profiles/Simple/Amiga+Aspect/Default.txt b/src/scripts/Profiles/Simple/Amiga_Blk-Scanlines/Default.txt similarity index 100% rename from src/scripts/Profiles/Simple/Amiga+Aspect/Default.txt rename to src/scripts/Profiles/Simple/Amiga_Blk-Scanlines/Default.txt diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_50Hz.txt b/src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_50Hz.txt similarity index 76% rename from src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_50Hz.txt rename to src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_50Hz.txt index fedbf600..9513146b 100644 --- a/src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_50Hz.txt +++ b/src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_50Hz.txt @@ -2,6 +2,5 @@ sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,256,256,256 geometry=136,35,640,256,712,270,1,2,1,2,14187580,908,5000,313,4,1,1 palette=RrGgBb_(EGA) scanlines=1 -scanline_level=8 -overclock_cpu=60 -overclock_core=160 +overclock_cpu=40 +overclock_core=140 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_60Hz.txt b/src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_60Hz.txt similarity index 76% rename from src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_60Hz.txt rename to src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_60Hz.txt index 45cdbf24..54ee858d 100644 --- a/src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_60Hz.txt +++ b/src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_60Hz.txt @@ -2,6 +2,5 @@ sampling=0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,127,127,127 geometry=136,34,640,200,712,224,2,5,1,2,14318181,910,5000,263,4,1,1 palette=RrGgBb_(EGA) scanlines=1 -scanline_level=8 -overclock_cpu=60 -overclock_core=160 +overclock_cpu=40 +overclock_core=140 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_60Hz_PAL.txt b/src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_60Hz_PAL.txt similarity index 76% rename from src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_60Hz_PAL.txt rename to src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_60Hz_PAL.txt index b32d06ee..61578d58 100644 --- a/src/scripts/Profiles/Simple/Amiga-Scanline50%/Amiga_60Hz_PAL.txt +++ b/src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Amiga_60Hz_PAL.txt @@ -2,6 +2,5 @@ sampling=0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,3,1,0,55,20,55,20,25,127,127,127 geometry=136,34,640,200,712,224,2,5,1,2,14187580,910,5000,263,4,1,1 palette=RrGgBb_(EGA) scanlines=1 -scanline_level=8 -overclock_cpu=60 -overclock_core=160 +overclock_cpu=40 +overclock_core=140 diff --git a/src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Default.txt b/src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Default.txt similarity index 100% rename from src/scripts/Profiles/Simple/Amiga-Scanline0%+Aspect/Default.txt rename to src/scripts/Profiles/Simple/Amiga_Var-Scanlines/Default.txt From b338d10589337172f5c1255478ce8643abb0826f Mon Sep 17 00:00:00 2001 From: IanSB Date: Tue, 26 Jan 2021 03:20:55 +0000 Subject: [PATCH 07/14] Change 16BPP from RGB:565 to ARGB:4444 with much faster capture loops --- ...pture_line_default_twelvebits_8bpp_16bpp.S | 4 +- ...ine_default_twelvebits_double_8bpp_16bpp.S | 4 +- src/capture_line_fast_simple_16bpp.S | 76 +++----- src/capture_line_fast_twelvebits_8bpp_16bpp.S | 4 +- src/defs.h | 10 +- src/filesystem.c | 12 +- src/macros.S | 171 +++++++---------- src/osd.c | 16 +- src/rgb_to_fb.S | 24 +++ src/rgb_to_fb.h | 2 + src/rgb_to_hdmi.c | 179 +++++++++++------- 11 files changed, 256 insertions(+), 246 deletions(-) diff --git a/src/capture_line_default_twelvebits_8bpp_16bpp.S b/src/capture_line_default_twelvebits_8bpp_16bpp.S index f91683e6..6aa32dfc 100644 --- a/src/capture_line_default_twelvebits_8bpp_16bpp.S +++ b/src/capture_line_default_twelvebits_8bpp_16bpp.S @@ -134,7 +134,7 @@ capture_line_default_ninebitslo_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SKIP_PSYNC_NO_OLD_CPLD - SETUP_NINE_BITS_MASK_R14 + SETUP_NINELO_BITS_MASK_R14 loop_9lobpp: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 CAPTURE_NINELO_BITS_16BPP_LO r11 // input in r8 @@ -175,7 +175,7 @@ capture_line_default_ninebitshi_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SKIP_PSYNC_NO_OLD_CPLD - SETUP_NINE_BITS_MASK_R14 + SETUP_NINEHI_BITS_MASK_R14 loop_9hibpp: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 CAPTURE_NINEHI_BITS_16BPP_LO r11 // input in r8 diff --git a/src/capture_line_default_twelvebits_double_8bpp_16bpp.S b/src/capture_line_default_twelvebits_double_8bpp_16bpp.S index 771cb24f..1b0f5c1a 100644 --- a/src/capture_line_default_twelvebits_double_8bpp_16bpp.S +++ b/src/capture_line_default_twelvebits_double_8bpp_16bpp.S @@ -108,7 +108,7 @@ capture_line_default_ninebitslo_double_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SKIP_PSYNC_NO_OLD_CPLD - SETUP_NINE_BITS_MASK_R14 + SETUP_NINELO_BITS_MASK_R14 loop_16lobpp: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 CAPTURE_NINELO_BITS_DOUBLE_16BPP r11 r5 // input in r8 @@ -140,7 +140,7 @@ capture_line_default_ninebitshi_double_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SKIP_PSYNC_NO_OLD_CPLD - SETUP_NINE_BITS_MASK_R14 + SETUP_NINEHI_BITS_MASK_R14 loop_16hibpp: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 CAPTURE_NINEHI_BITS_DOUBLE_16BPP r11 r5 // input in r8 diff --git a/src/capture_line_fast_simple_16bpp.S b/src/capture_line_fast_simple_16bpp.S index 0531598b..c340082d 100644 --- a/src/capture_line_fast_simple_16bpp.S +++ b/src/capture_line_fast_simple_16bpp.S @@ -21,63 +21,37 @@ .macro SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO reg // Pixel in GPIO 13.. 2 -> 15.. 0 - and r9, r8, #0x0f << PIXEL_BASE - eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) - and r12, r8, #0x0f << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(3 - PIXEL_BASE) - and r9, r8, #0x0f << (PIXEL_BASE + 8) - tst r8, #MUX_MASK - eor r10, r10, r9, lsl #(4 - PIXEL_BASE) - orrne r3, #BIT_PROBE + and r9, r8, r14 + eor r10, \reg, r9, lsr #(PIXEL_BASE) + tst r8, #MUX_MASK + orrne r3, #BIT_PROBE .endm .macro SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI reg // Pixel in GPIO 13.. 2 -> 31.. 16 - and r9, r8, #0x0f << PIXEL_BASE - eor r10, r10, r9, lsl #(16 - (PIXEL_BASE - 1)) - and r12, r8, #0x0f << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(16 + (3 - PIXEL_BASE)) - and r9, r8, #0x0f << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(16 + (4 - PIXEL_BASE)) - and r9, r10, r14 // extract high order bits - orr \reg, r10, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b + and r9, r8, r14 + eor \reg, r10, r9, lsl #(16 - PIXEL_BASE) + tst r8, #MUX_MASK + orrne r3, #BIT_PROBE .endm - .macro OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO reg - // Pixel in GPIO 13.. 2 -> 15.. 0 - and r9, r8, #0x0f << PIXEL_BASE - eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) - and r12, r8, #0x0f << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(3 - PIXEL_BASE) - and r9, r8, #0x0f << (PIXEL_BASE + 8) - eor r12, r10, r9, lsl #(4 - PIXEL_BASE) - tst r3, #BIT_OSD - and r9, r12, r14 // extract high order bits - movne r12, r12, lsr #1 // half intensity for menu (low order bits already 0 - orreq r12, r12, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b + and r9, r8, r14 + eor r10, \reg, r9, lsr #(PIXEL_BASE) tst r8, #MUX_MASK orrne r3, #BIT_PROBE - orrne r12, #0xff00 - orrne r12, #0x00ff + orrne r10, #0xff00 + orrne r10, #0x00ff .endm .macro OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_HI reg // Pixel in GPIO 13.. 2 -> 31.. 16 - and r9, r8, #0x0f << PIXEL_BASE - mov r10, r9, lsl #(16 - (PIXEL_BASE - 1)) - and r9, r8, #0x0f << (PIXEL_BASE + 4) - eor r10, r10, r9, lsl #(16 + (3 - PIXEL_BASE)) - and r9, r8, #0x0f << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(16 + (4 - PIXEL_BASE)) - tst r3, #BIT_OSD - and r9, r10, r14 // extract high order bits - movne r10, r10, lsr #1 // half intensity for menu (low order bits already 0 - orreq r10, r10, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b + and r9, r8, r14 + eor \reg, r10, r9, lsl #(16 - PIXEL_BASE) tst r8, #MUX_MASK - orrne r10, r10, #(0xff000000) - orrne r10, r10, #(0x00ff0000) - orr \reg, r10, r12 + orrne r3, #BIT_PROBE + orrne \reg, \reg, #(0xff000000) + orrne \reg, \reg, #(0x00ff0000) .endm @@ -140,7 +114,7 @@ loop_16bpp_osd_simple\@: .macro COMMON_DEFAULT push {r2} - mov r2, r12 + mov r2, r10 loop_16bpp_default\@: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 @@ -169,7 +143,7 @@ loop_16bpp_default\@: .macro OSD_COMMON_DEFAULT push {r2} - mov r2, r12 + mov r2, r10 loop_16bpp_osd_default\@: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO r11 // input in r8 @@ -345,7 +319,7 @@ OSD_capture_line_fast_simple_leading_both_16bpp: b preload_capture_line_default_simple_trailing_pos_16bpp capture_line_default_simple_trailing_pos_16bpp: push {lr} - mov r12, r2 + mov r10, r2 SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 bic r3, r3, #PSYNC_MASK // only +ve edge (inverted later) @@ -367,7 +341,7 @@ OSD_capture_line_default_simple_trailing_pos_16bpp: b preload_capture_line_default_simple_leading_pos_16bpp capture_line_default_simple_leading_pos_16bpp: push {lr} - mov r12, r2 + mov r10, r2 SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 bic r3, r3, #PSYNC_MASK // only +ve edge (inverted later) @@ -388,7 +362,7 @@ OSD_capture_line_default_simple_leading_pos_16bpp: b preload_capture_line_default_simple_trailing_neg_16bpp capture_line_default_simple_trailing_neg_16bpp: push {lr} - mov r12, r2 + mov r10, r2 SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 orr r3, r3, #PSYNC_MASK // only -ve edge (inverted later) @@ -410,7 +384,7 @@ OSD_capture_line_default_simple_trailing_neg_16bpp: b preload_capture_line_default_simple_leading_neg_16bpp capture_line_default_simple_leading_neg_16bpp: push {lr} - mov r12, r2 + mov r10, r2 SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 orr r3, r3, #PSYNC_MASK // only -ve edge (inverted later) @@ -431,7 +405,7 @@ OSD_capture_line_default_simple_leading_neg_16bpp: b preload_capture_line_default_simple_trailing_both_16bpp capture_line_default_simple_trailing_both_16bpp: push {lr} - mov r12, r2 + mov r10, r2 SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 tst r3, #BIT_OSD @@ -452,7 +426,7 @@ OSD_capture_line_default_simple_trailing_both_16bpp: b preload_capture_line_default_simple_leading_both_16bpp capture_line_default_simple_leading_both_16bpp: push {lr} - mov r12, r2 + mov r10, r2 SETUP_VSYNC_DEBUG_16BPP_R11 SETUP_TWELVE_BITS_MASK_R14 tst r3, #BIT_OSD diff --git a/src/capture_line_fast_twelvebits_8bpp_16bpp.S b/src/capture_line_fast_twelvebits_8bpp_16bpp.S index c55c608f..5e496709 100644 --- a/src/capture_line_fast_twelvebits_8bpp_16bpp.S +++ b/src/capture_line_fast_twelvebits_8bpp_16bpp.S @@ -135,7 +135,7 @@ capture_line_fast_ninebitslo_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SKIP_PSYNC_NO_OLD_CPLD_FAST - SETUP_NINE_BITS_MASK_R14 + SETUP_NINELO_BITS_MASK_R14 loop_16lobpp: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 CAPTURE_NINELO_BITS_16BPP_LO r11 // input in r8 @@ -175,7 +175,7 @@ capture_line_fast_ninebitshi_16bpp: push {lr} SETUP_VSYNC_DEBUG_16BPP_R11 SKIP_PSYNC_NO_OLD_CPLD_FAST - SETUP_NINE_BITS_MASK_R14 + SETUP_NINEHI_BITS_MASK_R14 loop_16hibpp: WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8 CAPTURE_NINEHI_BITS_16BPP_LO r11 // input in r8 diff --git a/src/defs.h b/src/defs.h index f50549b6..f728438d 100644 --- a/src/defs.h +++ b/src/defs.h @@ -150,7 +150,8 @@ #define O_NTSCPHASE 76 #define O_BORDER 80 #define O_DELAY 84 -#define O_CAPTURE_LINE 88 +#define O_INTENSITY 88 +#define O_CAPTURE_LINE 92 #else @@ -177,6 +178,7 @@ typedef struct { int ntscphase; // NTSC artifact colour phase int border; // border logical colour int delay; // delay value from sampling menu & 3 + int intensity; // scanline intensity int (*capture_line)(); // the capture line function to use int px_sampling; // whether to sample normally, sub-sample or pixel double @@ -403,4 +405,10 @@ typedef struct { #define CM_BASE (volatile uint32_t *)(PERIPHERAL_BASE + 0x101000) +#define SCALER_DISPLIST1 (volatile uint32_t *)(PERIPHERAL_BASE + 0x400024) +#define SCALER_DISPLAY_LIST (volatile uint32_t *)(PERIPHERAL_BASE + 0x402000) + +#define PIXEL_FORMAT 1 // RGBA4444 +#define PIXEL_ORDER 3 // ABGR + #endif diff --git a/src/filesystem.c b/src/filesystem.c index 7ed7dc84..86a6559b 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -124,9 +124,15 @@ static int generate_png(capture_info_t *capinfo, uint8_t **png, unsigned int *pn uint8_t single_pixel_lo = *fp++; uint8_t single_pixel_hi = *fp++; int single_pixel = single_pixel_lo | (single_pixel_hi << 8); - uint8_t single_pixel_R = single_pixel >> 12; - uint8_t single_pixel_G = (single_pixel >> 7) & 0x0f; - uint8_t single_pixel_B = (single_pixel >> 1) & 0x0f; + uint8_t single_pixel_A = (single_pixel >> 12) & 0x0f;; + uint8_t single_pixel_R = (single_pixel >> 8) & 0x0f;; + uint8_t single_pixel_G = (single_pixel >> 4) & 0x0f; + uint8_t single_pixel_B = single_pixel & 0x0f; + if (single_pixel_A != 0x0f) { + single_pixel_R = single_pixel_R * single_pixel_A / 15; + single_pixel_G = single_pixel_G * single_pixel_A / 15; + single_pixel_B = single_pixel_B * single_pixel_A / 15; + } single_pixel_R |= (single_pixel_R << 4); single_pixel_G |= (single_pixel_G << 4); single_pixel_B |= (single_pixel_B << 4); diff --git a/src/macros.S b/src/macros.S index e8b07718..bef546dd 100644 --- a/src/macros.S +++ b/src/macros.S @@ -723,144 +723,94 @@ wait_wr\@: .endm -.macro SETUP_NINE_BITS_MASK_R14 - mov r14, #0x00000018 //2 high order bits of blue (0x0018) - orr r14, r14, #0x0000c700 //3 high order bits of green (0x0700) + 2 high order bit of red (0xc000) // - orr r14, r14, r14, lsl #16 //put in both pixels - tst r3, #BIT_OSD - movne r14, #0 - tst r3, #BIT_NO_SCANLINES | BIT_INTERLACED_VIDEO - moveq r14, #0 +.macro SETUP_NINELO_BITS_MASK_R14 + mov r14, #0x77 << PIXEL_BASE + orr r14, r14, #0x700 << PIXEL_BASE .endm .macro CAPTURE_NINELO_BITS_16BPP_LO reg // Pixel in GPIO 13.. 2 -> 15.. 0 - and r9, r8, #0x07 << PIXEL_BASE - eor r10, \reg, r9, lsr #(PIXEL_BASE - 2) - and r12, r8, #0x07 << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(4 - PIXEL_BASE) - and r9, r8, #0x07 << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(5 - PIXEL_BASE) + and r9, r8, r14 + bic r8, r8, r14, lsr #1 + eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) + and r8, r8, r14 + eor r10, r10, r8, lsr #(PIXEL_BASE + 2) .endm .macro CAPTURE_NINELO_BITS_16BPP_HI reg // Pixel in GPIO 13.. 2 -> 31.. 16 - and r9, r8, #0x07 << PIXEL_BASE - eor r10, r10, r9, lsl #(16 - (PIXEL_BASE - 2)) - and r12, r8, #0x07 << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(16 + (4 - PIXEL_BASE)) - and r9, r8, #0x07 << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(16 + (5 - PIXEL_BASE)) - and r9, r10, r14 // extract high order bits - tst r3, #BIT_OSD - orreq \reg, r10, r9, lsr #3 // put high order bits in unused low order bits to ensure full range 5r 6g 5b - movne \reg, r10, lsr #1 // half intensity for menu (low order bits already 0 + and r9, r8, r14 + bic r8, r8, r14, lsr #1 + eor r10, r10, r9, lsl #(16 - (PIXEL_BASE - 1)) + and r8, r8, r14 + eor \reg, r10, r8, lsl #(16 - (PIXEL_BASE + 2)) .endm .macro CAPTURE_NINELO_BITS_DOUBLE_16BPP reg reg2 // Pixel in GPIO 13.. 2 -> 15.. 0 - and r9, r8, #0x07 << PIXEL_BASE - eor r10, \reg, r9, lsr #(PIXEL_BASE - 2) - and r12, r8, #0x07 << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(4 - PIXEL_BASE) - and r9, r8, #0x07 << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(5 - PIXEL_BASE) - // Pixel double - orr r10, r10, r10, lsl #16 - and r9, r10, r14 // extract high order bits - tst r3, #BIT_OSD - orreq \reg2, r10, r9, lsr #3 // put high order bits in unused low order bits to ensure full range 5r 6g 5b - movne \reg2, r10, lsr #1 // half intensity for menu (low order bits already 0 + and r9, r8, r14 + bic r8, r8, r14, lsr #1 + eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) + and r8, r8, r14 + eor r10, r10, r8, lsr #(PIXEL_BASE + 2) + eor \reg2, r10, r10, lsl #16 +.endm + +.macro SETUP_NINEHI_BITS_MASK_R14 + mov r14, #0xee << PIXEL_BASE + orr r14, r14, #0xe00 << PIXEL_BASE .endm .macro CAPTURE_NINEHI_BITS_16BPP_LO reg // Pixel in GPIO 13.. 2 -> 15.. 0 - and r9, r8, #0x0e << PIXEL_BASE - eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) - and r12, r8, #0x0e << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(3 - PIXEL_BASE) - and r9, r8, #0x0e << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(4 - PIXEL_BASE) + and r9, r8, r14 + bic r8, r8, r14, lsr #1 + eor r10, \reg, r9, lsr #PIXEL_BASE + and r8, r8, r14 + eor r10, r10, r8, lsr #(PIXEL_BASE + 3) .endm .macro CAPTURE_NINEHI_BITS_16BPP_HI reg // Pixel in GPIO 13.. 2 -> 31.. 16 - and r9, r8, #0x0e << PIXEL_BASE - eor r10, r10, r9, lsl #(16 - (PIXEL_BASE - 1)) - and r12, r8, #0x0e << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(16 + (3 - PIXEL_BASE)) - and r9, r8, #0x0e << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(16 + (4 - PIXEL_BASE)) - and r9, r10, r14 // extract high order bits - tst r3, #BIT_OSD - orreq \reg, r10, r9, lsr #3 // put high order bits in unused low order bits to ensure full range 5r 6g 5b - movne \reg, r10, lsr #1 // half intensity for menu (low order bits already 0 + and r9, r8, r14 + bic r8, r8, r14, lsr #1 + eor r10, r10, r9, lsl #(16 - PIXEL_BASE) + and r8, r8, r14 + eor \reg, r10, r8, lsl #(16 - (PIXEL_BASE + 3)) .endm .macro CAPTURE_NINEHI_BITS_DOUBLE_16BPP reg reg2 // Pixel in GPIO 13.. 2 -> 15.. 0 - and r9, r8, #0x0e << PIXEL_BASE - eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) - and r12, r8, #0x0e << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(3 - PIXEL_BASE) - and r9, r8, #0x0e << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(4 - PIXEL_BASE) - // Pixel double - orr r10, r10, r10, lsl #16 - and r9, r10, r14 // extract high order bits - tst r3, #BIT_OSD - orreq \reg2, r10, r9, lsr #3 // put high order bits in unused low order bits to ensure full range 5r 6g 5b - movne \reg2, r10, lsr #1 // half intensity for menu (low order bits already 0 + and r9, r8, r14 + bic r8, r8, r14, lsr #1 + eor r10, \reg, r9, lsr #PIXEL_BASE + and r8, r8, r14 + eor r10, r10, r8, lsr #(PIXEL_BASE + 3) + eor \reg2, r10, r10, lsl #16 .endm .macro SETUP_TWELVE_BITS_MASK_R14 - mov r14, #0x00000610 //2 high order bits of green (0x0600) + 1 high order bit of blue (0x0010) - orr r14, r14, #0x00008000 //1 high order bit of red (0x8000) - orr r14, r14, r14, lsl #16 //put in both pixels - tst r3, #BIT_OSD - movne r14, #0 - tst r3, #BIT_NO_SCANLINES | BIT_INTERLACED_VIDEO - moveq r14, #0 + mov r14, #0xff << PIXEL_BASE + orr r14, r14, #0xf00 << PIXEL_BASE .endm .macro CAPTURE_TWELVE_BITS_16BPP_LO reg // Pixel in GPIO 13.. 2 -> 15.. 0 - and r9, r8, #0x0f << PIXEL_BASE - eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) - and r12, r8, #0x0f << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(3 - PIXEL_BASE) - and r9, r8, #0x0f << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(4 - PIXEL_BASE) + and r9, r8, r14 + eor r10, \reg, r9, lsr #(PIXEL_BASE) .endm .macro CAPTURE_TWELVE_BITS_16BPP_HI reg // Pixel in GPIO 13.. 2 -> 31.. 16 - and r9, r8, #0x0f << PIXEL_BASE - eor r10, r10, r9, lsl #(16 - (PIXEL_BASE - 1)) - and r12, r8, #0x0f << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(16 + (3 - PIXEL_BASE)) - and r9, r8, #0x0f << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(16 + (4 - PIXEL_BASE)) - and r9, r10, r14 // extract high order bits - tst r3, #BIT_OSD - orreq \reg, r10, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b - movne \reg, r10, lsr #1 // half intensity for menu (low order bits already 0 + and r9, r8, r14 + eor \reg, r10, r9, lsl #(16 - PIXEL_BASE) .endm .macro CAPTURE_TWELVE_BITS_DOUBLE_16BPP reg reg2 // Pixel in GPIO 13.. 2 -> 15.. 0 - and r9, r8, #0x0f << PIXEL_BASE - eor r10, \reg, r9, lsr #(PIXEL_BASE - 1) - and r12, r8, #0x0f << (PIXEL_BASE + 4) - eor r10, r10, r12, lsl #(3 - PIXEL_BASE) - and r9, r8, #0x0f << (PIXEL_BASE + 8) - eor r10, r10, r9, lsl #(4 - PIXEL_BASE) - // Pixel double - orr r10, r10, r10, lsl #16 - and r9, r10, r14 // extract high order bits - tst r3, #BIT_OSD - orreq \reg2, r10, r9, lsr #4 // put high order bits in unused low order bits to ensure full range 5r 6g 5b - movne \reg2, r10, lsr #1 // half intensity for menu (low order bits already 0 + and r9, r8, r14 + eor r10, \reg, r9, lsr #(PIXEL_BASE) + eor \reg2, r10, r10, lsl #16 .endm .macro CAPTURE_LOW_BITS_TRANSLATE @@ -1074,17 +1024,23 @@ wait_wr\@: .endm .macro SETUP_VSYNC_DEBUG_16BPP_R11 + tst r3, #BIT_OSD + ldreq r11, =#0xf000f000 + ldrne r11, =#0x70007000 tst r3, #BIT_VSYNC_MARKER - ldrne r11, =0xe000e000 - moveq r11, #0 + eorne r11, r11, #0x0f000000 + eorne r11, r11, #0x00000f00 + tst r3, #BIT_NO_SCANLINES | BIT_INTERLACED_VIDEO + ldreq r12, =param_intensity + ldreq r12, [r12] .endm .macro WRITE_R5_R6_IF_LAST_16BPP cmp r1, #1 stmeqia r0, {r5, r6} tsteq r3, #BIT_NO_SCANLINES | BIT_INTERLACED_VIDEO - moveq r5, r5, lsr #1 - moveq r6, r6, lsr #1 + eoreq r5, r5, r12 + eoreq r6, r6, r12 cmp r1, #1 tsteq r3, #BIT_NO_LINE_DOUBLE subeq r0, r0, r2 @@ -1094,10 +1050,11 @@ wait_wr\@: .macro WRITE_R5_R6_R7_R10_16BPP stmia r0, {r5, r6, r7, r10} tst r3, #BIT_NO_SCANLINES | BIT_INTERLACED_VIDEO - moveq r5, r5, lsr #1 - moveq r6, r6, lsr #1 - moveq r7, r7, lsr #1 - moveq r10, r10, lsr #1 + eoreq r5, r5, r12 + eoreq r6, r6, r12 + eoreq r7, r7, r12 + eoreq r10, r10, r12 + tst r3, #BIT_NO_LINE_DOUBLE subeq r0, r0, r2 stmeqia r0, {r5, r6, r7, r10} diff --git a/src/osd.c b/src/osd.c index 723f1028..53510bcf 100644 --- a/src/osd.c +++ b/src/osd.c @@ -379,7 +379,7 @@ static param_t features[] = { { F_COLOUR, "Output Colour", "output_colour", 0, NUM_COLOURS - 1, 1 }, { F_INVERT, "Output Invert", "output_invert", 0, NUM_INVERT - 1, 1 }, { F_SCANLINES, "Scanlines", "scanlines", 0, 1, 1 }, - { F_SCANLINESINT, "Scanline Level", "scanline_level", 0, 15, 1 }, + { F_SCANLINESINT, "Scanline Level", "scanline_level", 0, 14, 1 }, { F_OVERSCAN,"Crop Border (Zoom)", "crop_border", 0, NUM_OVERSCAN - 1, 1 }, { F_CAPSCALE, "ScreenCap Size", "screencap_size", 0, NUM_SCREENCAP - 1, 1 }, { F_FONTSIZE, "Font Size", "font_size", 0, NUM_FONTSIZE - 1, 1 }, @@ -1465,16 +1465,16 @@ static volatile uint32_t *gpioreg = (volatile uint32_t *)(PERIPHERAL_BASE + 0x10 void osd_display_interface(int line) { char osdline[256]; - sprintf(osdline, "Scaling: %s", scaling_names[get_scaling()]); - osd_set(line, 0, osdline); sprintf(osdline, "Interface: %s", get_interface_name()); - osd_set(line + 2, 0, osdline); + osd_set(line, 0, osdline); + sprintf(osdline, "Scaling: %s", scaling_names[get_scaling()]); + osd_set(line + 1, 0, osdline); if (has_sub_profiles[get_profile()]) { sprintf(osdline, "Profile: %s (%s)", profile_names[get_profile()], sub_profile_names[get_subprofile()]); } else { sprintf(osdline, "Profile: %s", profile_names[get_profile()]); } - osd_set(line + 4, 0, osdline); + osd_set(line + 2, 0, osdline); } static void info_system_summary(int line) { @@ -3886,9 +3886,9 @@ void osd_update_palette() { } else { if ((i >= (num_colours >> 1)) && get_feature(F_SCANLINES)) { int scanline_intensity = get_feature(F_SCANLINESINT) ; - r = (r * scanline_intensity)>>4; - g = (g * scanline_intensity)>>4; - b = (b * scanline_intensity)>>4; + r = (r * scanline_intensity) / 15; + g = (g * scanline_intensity) / 15; + b = (b * scanline_intensity) / 15; palette_data[i] = 0xFF000000 | (b << 16) | (g << 8) | r; } else { palette_data[i] = 0xFF000000 | (b << 16) | (g << 8) | r; diff --git a/src/rgb_to_fb.S b/src/rgb_to_fb.S index 4a3a3b27..9296ebe4 100644 --- a/src/rgb_to_fb.S +++ b/src/rgb_to_fb.S @@ -38,6 +38,7 @@ .global param_ntscphase .global ntsc_status .global param_delay +.global param_intensity .global sw1_power_up .global field_type_threshold @@ -54,6 +55,7 @@ .global hsync_scroll .global line_timeout .global vsync_retry_count +.global wait_for_pi_fieldsync #ifdef USE_MULTICORE .global run_core @@ -138,6 +140,12 @@ rgb_to_fb: str r2, param_border ldr r2, [r0, #O_DELAY] str r2, param_delay + ldr r2, [r0, #O_INTENSITY] + and r2, r2, #0x0f + eor r2, r2, #0x0f + mov r2, r2, lsl #12 + orr r2, r2, lsl #16 + str r2, param_intensity ldr r2, [r0, #O_FB_BASE] str r2, param_framebuffer0 @@ -1106,6 +1114,9 @@ param_border: param_delay: .word 0 +param_intensity: + .word 0 + capture_address: .word 0 @@ -2561,6 +2572,19 @@ capture_line_half_even_3bpp_table: // Poll only keys (for when CPLD is unprogrammed) // ====================================================================== +wait_for_pi_fieldsync: + push {r4-r12, lr} + CLEAR_VSYNC + // Poll for the VSYNC interrupt + ldr r0, =INTPEND2 +wait_for_pi_loop: + ldr r1, [r0] + tst r1, #(1<width != last_width || capinfo->height != last_height) { + rpi_mailbox_property_t *mp; + if (capinfo->width != last_width || capinfo->height != last_height) { + //if (last_width != -1 && last_height != -1) { + // clear_full_screen(); + //} // Fill in the frame buffer structure with a small dummy frame buffer first /* Initialise a framebuffer... */ RPI_PropertyInit(); @@ -401,23 +406,25 @@ static int last_height = -1; RPI_PropertyProcess(); - // FIXME: A small delay (like the log) is neccessary here - // or the RPI_PropertyGet seems to return garbage - log_info("Width or Height differ from last FB: Setting dummy 64x64 framebuffer"); - } + + // FIXME: A small delay (like the log) is neccessary here + // or the RPI_PropertyGet seems to return garbage + log_info("Width or Height differ from last FB: Setting dummy 64x64 framebuffer"); + + } int adjusted_width = capinfo->width; - //last_width = capinfo->width; - //last_height = capinfo->height; - /* work out if overscan needed */ + //last_width = capinfo->width; + //last_height = capinfo->height; + /* work out if overscan needed */ - int h_size = get_hdisplay(); - int v_size = get_vdisplay(); + int h_size = get_hdisplay(); + int v_size = get_vdisplay(); - h_overscan = 0; - v_overscan = 0; + h_overscan = 0; + v_overscan = 0; - if (get_gscaling() == GSCALING_INTEGER) { + if (get_gscaling() == GSCALING_INTEGER) { if (!((capinfo->video_type == VIDEO_TELETEXT && get_m7scaling() == SCALING_UNEVEN) ||(capinfo->video_type != VIDEO_TELETEXT && get_normalscaling() == SCALING_UNEVEN))) { int width = adjusted_width >> ((capinfo->sizex2 & 2) >> 1); @@ -427,54 +434,54 @@ static int last_height = -1; int height = capinfo->height >> (capinfo->sizex2 & 1); int vscale = v_size / height; v_overscan = v_size - (vscale * height); - } + } - int adj_h_overscan = h_overscan; - int adj_v_overscan = v_overscan; - if (adj_h_overscan != 0) { // add 1 if non zero to work around scaler issues + int adj_h_overscan = h_overscan; + int adj_v_overscan = v_overscan; + if (adj_h_overscan != 0) { // add 1 if non zero to work around scaler issues adj_h_overscan++; - } - if (adj_v_overscan != 0) { // add 1 if non zero to work around scaler issues + } + if (adj_v_overscan != 0) { // add 1 if non zero to work around scaler issues adj_v_overscan++; - } + } - int left_overscan = adj_h_overscan >> 1; - int right_overscan = left_overscan + (adj_h_overscan & 1); + int left_overscan = adj_h_overscan >> 1; + int right_overscan = left_overscan + (adj_h_overscan & 1); - int top_overscan = adj_v_overscan >> 1; - int bottom_overscan = top_overscan + (adj_v_overscan & 1); + int top_overscan = adj_v_overscan >> 1; + int bottom_overscan = top_overscan + (adj_v_overscan & 1); - left_overscan += config_overscan_left; - right_overscan += config_overscan_right; - top_overscan += config_overscan_top; - bottom_overscan += config_overscan_bottom; + left_overscan += config_overscan_left; + right_overscan += config_overscan_right; + top_overscan += config_overscan_top; + bottom_overscan += config_overscan_bottom; - log_info("Overscan L=%d, R=%d, T=%d, B=%d",left_overscan, right_overscan, top_overscan, bottom_overscan); + log_info("Overscan L=%d, R=%d, T=%d, B=%d",left_overscan, right_overscan, top_overscan, bottom_overscan); - /* Initialise a framebuffer... */ - RPI_PropertyInit(); - RPI_PropertyAddTag(TAG_ALLOCATE_BUFFER, 0x02000000); - RPI_PropertyAddTag(TAG_SET_PHYSICAL_SIZE, adjusted_width, capinfo->height); -#ifdef MULTI_BUFFER - RPI_PropertyAddTag(TAG_SET_VIRTUAL_SIZE, adjusted_width, capinfo->height * NBUFFERS); -#else - RPI_PropertyAddTag(TAG_SET_VIRTUAL_SIZE, adjusted_width, capinfo->height); -#endif - RPI_PropertyAddTag(TAG_SET_DEPTH, capinfo->bpp); - RPI_PropertyAddTag(TAG_SET_OVERSCAN, top_overscan, bottom_overscan, left_overscan, right_overscan); - RPI_PropertyAddTag(TAG_GET_PITCH); - RPI_PropertyAddTag(TAG_GET_PHYSICAL_SIZE); - RPI_PropertyAddTag(TAG_GET_DEPTH); + /* Initialise a framebuffer... */ + RPI_PropertyInit(); + RPI_PropertyAddTag(TAG_ALLOCATE_BUFFER, 0x02000000); + RPI_PropertyAddTag(TAG_SET_PHYSICAL_SIZE, adjusted_width, capinfo->height); + #ifdef MULTI_BUFFER + RPI_PropertyAddTag(TAG_SET_VIRTUAL_SIZE, adjusted_width, capinfo->height * NBUFFERS); + #else + RPI_PropertyAddTag(TAG_SET_VIRTUAL_SIZE, adjusted_width, capinfo->height); + #endif + RPI_PropertyAddTag(TAG_SET_DEPTH, capinfo->bpp); + RPI_PropertyAddTag(TAG_SET_OVERSCAN, top_overscan, bottom_overscan, left_overscan, right_overscan); + RPI_PropertyAddTag(TAG_GET_PITCH); + RPI_PropertyAddTag(TAG_GET_PHYSICAL_SIZE); + RPI_PropertyAddTag(TAG_GET_DEPTH); - RPI_PropertyProcess(); + RPI_PropertyProcess(); - // FIXME: A small delay (like the log) is neccessary here - // or the RPI_PropertyGet seems to return garbage - delay_in_arm_cycles_cpu_adjust(4000000); - log_info("Initialised Framebuffer"); + // FIXME: A small delay (like the log) is neccessary here + // or the RPI_PropertyGet seems to return garbage + delay_in_arm_cycles_cpu_adjust(4000000); + log_info("Initialised Framebuffer"); - if ((mp = RPI_PropertyGet(TAG_GET_PHYSICAL_SIZE))) { + if ((mp = RPI_PropertyGet(TAG_GET_PHYSICAL_SIZE))) { int width = mp->data.buffer_32[0]; int height = mp->data.buffer_32[1]; log_info("Size: %dx%d (requested %dx%d)", width, height, capinfo->width, capinfo->height); @@ -483,25 +490,51 @@ static int last_height = -1; delay_in_arm_cycles_cpu_adjust(1000000000); reboot(); } - } + } - if ((mp = RPI_PropertyGet(TAG_GET_PITCH))) { + if ((mp = RPI_PropertyGet(TAG_GET_PITCH))) { capinfo->pitch = mp->data.buffer_32[0]; //log_info("Pitch: %d bytes", capinfo->pitch); - } + } - if ((mp = RPI_PropertyGet(TAG_ALLOCATE_BUFFER))) { + if ((mp = RPI_PropertyGet(TAG_ALLOCATE_BUFFER))) { capinfo->fb = (unsigned char*)mp->data.buffer_32[0]; log_info("Framebuffer address: %8.8X", (unsigned int)capinfo->fb); - } + } - // On the Pi 2/3 the mailbox returns the address with bits 31..30 set, which is wrong - capinfo->fb = (unsigned char *)(((unsigned int) capinfo->fb) & 0x3fffffff); - //log_info("Framebuffer address masked: %8.8X", (unsigned int)capinfo->fb); - // Initialize the palette - osd_update_palette(); -} + // On the Pi 2/3 the mailbox returns the address with bits 31..30 set, which is wrong + capinfo->fb = (unsigned char *)(((unsigned int) capinfo->fb) & 0x3fffffff); + //log_info("Framebuffer address masked: %8.8X", (unsigned int)capinfo->fb); + //Initialize the palette + osd_update_palette(); + + // modify display list if 16bpp to switch from RGB 565 to ARGB 4444 + if (capinfo->bpp == 16) { + //have to wait for field sync for display list to be updated + wait_for_pi_fieldsync(); + wait_for_pi_fieldsync(); + //delay_in_arm_cycles_cpu_adjust(30000000); // little extra delay + //read the index pointer into the display list RAM + display_list_index = (uint32_t) *SCALER_DISPLIST1; + +/* + volatile uint32_t d; + volatile uint32_t dlist_start; + dlist_start = *SCALER_DISPLIST1; + log_info("SCALER_DISPLIST1 = %08X", dlist_start); + int i = dlist_start; + do { + d = display_list[i++]; + log_info("%08X", d); + } while (d != 0x80000000); +*/ + display_list[display_list_index] = (display_list[display_list_index] & ~0x600f) | (PIXEL_ORDER << 13) | PIXEL_FORMAT; + log_info("Modified display list word at %08X = %08X", display_list_index, display_list[display_list_index]); + + } + +} #else // An alternative way to initialize the framebuffer using mailbox channel 1 @@ -2252,11 +2285,17 @@ int total_N_frames(capture_info_t *capinfo, int n, int mode7, int elk) { #ifdef MULTI_BUFFER void swapBuffer(int buffer) { - RPI_PropertyInit(); - current_display_buffer = buffer; - RPI_PropertyAddTag(TAG_SET_VIRTUAL_OFFSET, 0, capinfo->height * buffer); - // Use version that doesn't wait for the response - RPI_PropertyProcessNoCheck(); + if (capinfo->bpp == 16) { + // directly manipulate the display list in 16BPP mode otherwise display list gets reconstructed + display_list[display_list_index + 5] = ((int)capinfo->fb | 0xc0000000) + (buffer * capinfo->height * capinfo->pitch); + } else { + RPI_PropertyInit(); + current_display_buffer = buffer; + RPI_PropertyAddTag(TAG_SET_VIRTUAL_OFFSET, 0, capinfo->height * buffer); + // Use version that doesn't wait for the response + RPI_PropertyProcessNoCheck(); + } + } #endif @@ -2565,8 +2604,8 @@ void set_scanlines_intensity(int value) { } int get_scanlines_intensity() { - if (capinfo->bpp == 16) { - return (capinfo->sizex2 & 1) * 8; // returns 0 or 8 depending on state of double height + if ((capinfo->sizex2 & 1) == 0) { + return 0; // returns 0 depending on state of double height } else { return scanlines_intensity; } @@ -3108,7 +3147,7 @@ void rgb_to_hdmi_main() { } } } - + capinfo->intensity = scanlines_intensity; log_debug("Entering rgb_to_fb, flags=%08x", flags); result = rgb_to_fb(capinfo, flags); log_debug("Leaving rgb_to_fb, result=%04x", result); From 1b5ecf5568fce37ad5559f540b2cd588d522b3a6 Mon Sep 17 00:00:00 2001 From: IanSB Date: Tue, 26 Jan 2021 03:26:09 +0000 Subject: [PATCH 08/14] Update profiles --- src/scripts/Profiles/CoCo3_50Hz_new.txt | 4 ---- src/scripts/Profiles/CoCo3_50Hz_new75R.txt | 4 ---- 2 files changed, 8 deletions(-) delete mode 100644 src/scripts/Profiles/CoCo3_50Hz_new.txt delete mode 100644 src/scripts/Profiles/CoCo3_50Hz_new75R.txt diff --git a/src/scripts/Profiles/CoCo3_50Hz_new.txt b/src/scripts/Profiles/CoCo3_50Hz_new.txt deleted file mode 100644 index b93dab03..00000000 --- a/src/scripts/Profiles/CoCo3_50Hz_new.txt +++ /dev/null @@ -1,4 +0,0 @@ -sampling=3,3,3,3,3,3,3,0,1,0,7,0,0,0,0,0,0,7,0,0,135,66,135,66,129,101,101,101 -geometry=108,55,640,202,768,286,1,2,1,1,14237500,912,5000,314,5,0,0 -palette=RrGgBb_(EGA) -palette_control=3 diff --git a/src/scripts/Profiles/CoCo3_50Hz_new75R.txt b/src/scripts/Profiles/CoCo3_50Hz_new75R.txt deleted file mode 100644 index 890aa774..00000000 --- a/src/scripts/Profiles/CoCo3_50Hz_new75R.txt +++ /dev/null @@ -1,4 +0,0 @@ -sampling=3,3,3,3,3,3,3,0,1,0,7,0,0,0,0,0,0,7,1,0,119,55,119,55,129,87,87,87 -geometry=108,55,640,202,768,286,1,2,1,1,14237500,912,5000,314,5,0,0 -palette=RrGgBb_(EGA) -palette_control=3 From 0614476b653da88bcc2999fbf256354cf1d842a5 Mon Sep 17 00:00:00 2001 From: IanSB Date: Wed, 27 Jan 2021 20:50:28 +0000 Subject: [PATCH 09/14] update profiles --- .../Atari_ST/{Atari_ST.txt => Atari_ST_50Hz.txt} | 0 src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt | 5 +++++ 2 files changed, 5 insertions(+) rename src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/{Atari_ST.txt => Atari_ST_50Hz.txt} (100%) create mode 100644 src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST.txt b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_50Hz.txt similarity index 100% rename from src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST.txt rename to src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_50Hz.txt diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt new file mode 100644 index 00000000..ebad9f10 --- /dev/null +++ b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt @@ -0,0 +1,5 @@ +sampling=0,0,0,0,0,0,0,0,1,0,5,0,0,0,2,0,0,3,0,0,100,256,100,256,100,256,0,256 +geometry=176,31,640,202,720,270,2,5,0,2,16000000,1016,7500,263,4,0,0 +palette=RrGgBb_(EGA) +scanline_level=0 +overclock_core=100 From d5feb983b8990f424bd2de76b3662315d934a80e Mon Sep 17 00:00:00 2001 From: IanSB Date: Wed, 27 Jan 2021 20:51:22 +0000 Subject: [PATCH 10/14] reduce tests for FFOSD bit --- src/capture_line_fast_simple_16bpp.S | 2 -- src/defs.h | 5 +++++ src/geometry.c | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/capture_line_fast_simple_16bpp.S b/src/capture_line_fast_simple_16bpp.S index c340082d..bbbdccba 100644 --- a/src/capture_line_fast_simple_16bpp.S +++ b/src/capture_line_fast_simple_16bpp.S @@ -31,8 +31,6 @@ // Pixel in GPIO 13.. 2 -> 31.. 16 and r9, r8, r14 eor \reg, r10, r9, lsl #(16 - PIXEL_BASE) - tst r8, #MUX_MASK - orrne r3, #BIT_PROBE .endm .macro OSD_SIMPLE_CAPTURE_TWELVE_BITS_16BPP_LO reg diff --git a/src/defs.h b/src/defs.h index f728438d..c692a698 100644 --- a/src/defs.h +++ b/src/defs.h @@ -122,6 +122,11 @@ #define GPCLR0 (PERIPHERAL_BASE + 0x200028) #define GPLEV0 (PERIPHERAL_BASE + 0x200034) #define GPEDS0 (PERIPHERAL_BASE + 0x200040) +#define GPREN0 (PERIPHERAL_BASE + 0x20004C) +#define GPFEN0 (PERIPHERAL_BASE + 0x200058) +#define GPAREN0 (PERIPHERAL_BASE + 0x20007C) +#define GPAFEN0 (PERIPHERAL_BASE + 0x200088) + #define FIQCTRL (PERIPHERAL_BASE + 0x00B20C) #define INTPEND2 (PERIPHERAL_BASE + 0x00B208) diff --git a/src/geometry.c b/src/geometry.c index 55de621c..0ee7d281 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -62,8 +62,8 @@ static const char *bpp_names[] = { static param_t params[] = { { SETUP_MODE, "Setup Mode", "setup_mode", 0,NUM_SETUP-1, 1 }, - { H_OFFSET, "H Offset", "h_offset", 0, 512, 4 }, - { V_OFFSET, "V Offset", "v_offset", 0, 512, 1 }, + { H_OFFSET, "H Offset", "h_offset", 1, 384, 4 }, + { V_OFFSET, "V Offset", "v_offset", 0, 256, 1 }, { MIN_H_WIDTH, "Min H Width", "min_h_width", 150, 1920, 8 }, {MIN_V_HEIGHT, "Min V Height", "min_v_height", 150, 1200, 2 }, { MAX_H_WIDTH, "Max H Width", "max_h_width", 200, 1920, 8 }, From b82453d27f02972691a87b6b159d25b601c4fe38 Mon Sep 17 00:00:00 2001 From: IanSB Date: Wed, 27 Jan 2021 20:54:51 +0000 Subject: [PATCH 11/14] remove extra semicolons --- src/filesystem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/filesystem.c b/src/filesystem.c index 86a6559b..fd064c21 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -124,8 +124,8 @@ static int generate_png(capture_info_t *capinfo, uint8_t **png, unsigned int *pn uint8_t single_pixel_lo = *fp++; uint8_t single_pixel_hi = *fp++; int single_pixel = single_pixel_lo | (single_pixel_hi << 8); - uint8_t single_pixel_A = (single_pixel >> 12) & 0x0f;; - uint8_t single_pixel_R = (single_pixel >> 8) & 0x0f;; + uint8_t single_pixel_A = (single_pixel >> 12) & 0x0f; + uint8_t single_pixel_R = (single_pixel >> 8) & 0x0f; uint8_t single_pixel_G = (single_pixel >> 4) & 0x0f; uint8_t single_pixel_B = single_pixel & 0x0f; if (single_pixel_A != 0x0f) { @@ -153,8 +153,6 @@ static int generate_png(capture_info_t *capinfo, uint8_t **png, unsigned int *pn } } - - } } unsigned int result = lodepng_encode(png, png_len, png_buffer, (png_width + png_left + png_right), png_height, &state); From b7c2c737bab424ac8880ae011cc377b7bf6d57e6 Mon Sep 17 00:00:00 2001 From: IanSB Date: Sat, 30 Jan 2021 19:47:01 +0000 Subject: [PATCH 12/14] Test for increased pixel width during mode 7 calibration --- src/rgb_to_fb.S | 289 +++++++++++++++++++++++++++++++++++++++++++++- src/rgb_to_fb.h | 2 + src/rgb_to_hdmi.c | 59 +++++++--- 3 files changed, 332 insertions(+), 18 deletions(-) diff --git a/src/rgb_to_fb.S b/src/rgb_to_fb.S index 9296ebe4..a94954d1 100644 --- a/src/rgb_to_fb.S +++ b/src/rgb_to_fb.S @@ -56,6 +56,8 @@ .global line_timeout .global vsync_retry_count .global wait_for_pi_fieldsync +.global scan_for_single_pixels_4bpp +.global scan_for_single_pixels_12bpp #ifdef USE_MULTICORE .global run_core @@ -2568,9 +2570,287 @@ capture_line_half_even_3bpp_table: .word capture_line_half_even_4bpp .word capture_line_half_even_8bpp -// ====================================================================== -// Poll only keys (for when CPLD is unprogrammed) -// ====================================================================== + +.macro COUNT_PIXELS_3BPP reg + // enters with r4,r5,r6 already loaded + mov r7, \reg, lsr #4 //pixel 1 + and r7, r7, #7 + + cmp r5, r6 + cmpeq r4, #0 + cmpeq r7, #0 + bne nocomp1\@ + + cmp r5, #0 + cmpne r5, r4 + cmpne r5, r7 + addne r2, r2, #1 +nocomp1\@: + + and r4, \reg, #7 //pixel 2 + + cmp r6, r7 + cmpeq r4, #0 + cmpeq r5, #0 + bne nocomp2\@ + cmp r6, #0 + cmpne r6, r5 + cmpne r6, r4 + addne r2, r2, #1 +nocomp2\@: + + mov r5, \reg, lsr #12 //pixel 3 + and r5, r5, #7 + + cmp r7, r4 + cmpeq r5, #0 + cmpeq r6, #0 + bne nocomp3\@ + cmp r7, #0 + cmpne r7, r6 + cmpne r7, r5 + addne r2, r2, #1 +nocomp3\@: + + mov r6, \reg, lsr #8 //pixel 4 + and r6, r6, #7 + + cmp r4, r5 + cmpeq r6, #0 + cmpeq r7, #0 + bne nocomp4\@ + cmp r4, #0 + cmpne r4, r7 + cmpne r4, r6 + addne r2, r2, #1 +nocomp4\@: + + mov r7, \reg, lsr #20 //pixel 5 + and r7, r7, #7 + + cmp r5, r6 + cmpeq r4, #0 + cmpeq r7, #0 + bne nocomp5\@ + cmp r5, #0 + cmpne r5, r4 + cmpne r5, r7 + addne r2, r2, #1 +nocomp5\@: + + mov r4, \reg, lsr #16 //pixel 6 + and r4, r4, #7 + + cmp r6, r7 + cmpeq r4, #0 + cmpeq r5, #0 + bne nocomp6\@ + cmp r6, #0 + cmpne r6, r5 + cmpne r6, r4 + addne r2, r2, #1 +nocomp6\@: + + mov r5, \reg, lsr #28 //pixel 7 + and r5, r5, #7 + + cmp r7, r4 + cmpeq r5, #0 + cmpeq r6, #0 + bne nocomp7\@ + cmp r7, #0 + cmpne r7, r6 + cmpne r7, r5 + addne r2, r2, #1 +nocomp7\@: + + mov r6, \reg, lsr #24 //pixel 8 + and r6, r6, #7 + + cmp r4, r5 + cmpeq r6, #0 + cmpeq r7, #0 + bne nocomp8\@ + cmp r4, #0 + cmpne r4, r7 + cmpne r4, r6 + addne r2, r2, #1 +nocomp8\@: +.endm + +.macro COUNT_PIXELS_12BPP + and r7, r8, r3 //pixel 1 + + cmp r5, r6 + cmpeq r4, r12 + cmpeq r7, r12 + tsteq r4, #0x8000 + tsteq r5, #0x8000 + tsteq r6, #0x8000 + tsteq r7, #0x8000 + bne nocomp1b\@ + cmp r5, r12 + cmpne r5, r4 + cmpne r5, r7 + addne r2, r2, #1 +nocomp1b\@: + + mov r4, r8, lsr #16 //pixel 2 + + cmp r6, r7 + cmpeq r4, r12 + cmpeq r5, r12 + tsteq r4, #0x8000 + tsteq r5, #0x8000 + tsteq r6, #0x8000 + tsteq r7, #0x8000 + bne nocomp2b\@ + cmp r6, r12 + cmpne r6, r5 + cmpne r6, r4 + addne r2, r2, #1 +nocomp2b\@: + + and r5, r9, r3 //pixel 3 + + cmp r7, r4 + cmpeq r5, r12 + cmpeq r6, r12 + tsteq r4, #0x8000 + tsteq r5, #0x8000 + tsteq r6, #0x8000 + tsteq r7, #0x8000 + bne nocomp3b\@ + cmp r7, r12 + cmpne r7, r6 + cmpne r7, r5 + addne r2, r2, #1 +nocomp3b\@: + + mov r6, r9, lsr #16 //pixel 4 + + cmp r4, r5 + cmpeq r6, r12 + cmpeq r7, r12 + tsteq r4, #0x8000 + tsteq r5, #0x8000 + tsteq r6, #0x8000 + tsteq r7, #0x8000 + bne nocomp4b\@ + cmp r4, r12 + cmpne r4, r7 + cmpne r4, r6 + addne r2, r2, #1 +nocomp4b\@: + + and r7, r10, r3 //pixel 5 + + cmp r5, r6 + cmpeq r4, r12 + cmpeq r7, r12 + tsteq r4, #0x8000 + tsteq r5, #0x8000 + tsteq r6, #0x8000 + tsteq r7, #0x8000 + bne nocomp5b\@ + cmp r5, r12 + cmpne r5, r4 + cmpne r5, r7 + addne r2, r2, #1 +nocomp5b\@: + + mov r4, r10, lsr #16 //pixel 6 + + cmp r6, r7 + cmpeq r4, r12 + cmpeq r5, r12 + tsteq r4, #0x8000 + tsteq r5, #0x8000 + tsteq r6, #0x8000 + tsteq r7, #0x8000 + bne nocomp6b\@ + cmp r6, r12 + cmpne r6, r5 + cmpne r6, r4 + addne r2, r2, #1 +nocomp6b\@: + + and r5, r11, r3 //pixel 7 + + cmp r7, r4 + cmpeq r5, r12 + cmpeq r6, r12 + tsteq r4, #0x8000 + tsteq r5, #0x8000 + tsteq r6, #0x8000 + tsteq r7, #0x8000 + bne nocomp7b\@ + cmp r7, r12 + cmpne r7, r6 + cmpne r7, r5 + addne r2, r2, #1 +nocomp7b\@: + + mov r6, r11, lsr #16 //pixel 8 + + cmp r4, r5 + cmpeq r6, r12 + cmpeq r7, r12 + tsteq r4, #0x8000 + tsteq r5, #0x8000 + tsteq r6, #0x8000 + tsteq r7, #0x8000 + bne nocomp8b\@ + cmp r4, r12 + cmpne r4, r7 + cmpne r4, r6 + addne r2, r2, #1 +nocomp8b\@: + +.endm + +scan_for_single_pixels_12bpp: + push {r2-r12, lr} + // r0 = pointer to start of memory + add r1, r0, r1 + // r1 = pointer to end of memory + mov r2, #0 + mov r3, #0xff + orr r3, r3, #0xff00 + ldr r12, [r0] + and r12, r12, r3 //first pixel used as background colour reference + mov r4, #0 //pixel 6 + mov r5, #0 //pixel 7 + mov r6, #0 //pixel 8 +scan_loop12: + ldmia r0!, {r8-r11} + COUNT_PIXELS_12BPP + cmp r0, r1 + blt scan_loop12 + mov r0, r2 + //on exit, r0= number of single pixels detected + pop {r2-r12, pc} + +scan_for_single_pixels_4bpp: + push {r2-r12, lr} + // r0 = pointer to start of memory + add r1, r0, r1 + // r1 = pointer to end of memory + mov r2, #0 + mov r4, #0 //pixel 6 + mov r5, #0 //pixel 7 + mov r6, #0 //pixel 8 +scan_loop: + ldmia r0!, {r8-r11} + COUNT_PIXELS_3BPP r8 + COUNT_PIXELS_3BPP r9 + COUNT_PIXELS_3BPP r10 + COUNT_PIXELS_3BPP r11 + cmp r0, r1 + blt scan_loop + mov r0, r2 + //on exit, r0= number of single pixels detected + pop {r2-r12, pc} wait_for_pi_fieldsync: push {r4-r12, lr} @@ -2585,6 +2865,9 @@ wait_for_pi_loop: CLEAR_VSYNC pop {r4-r12, pc} +// ====================================================================== +// Poll only keys (for when CPLD is unprogrammed) +// ====================================================================== poll_keys_only: push {r4-r12, lr} ldr r12, [r0, #O_NCAPTURE] diff --git a/src/rgb_to_fb.h b/src/rgb_to_fb.h index 2e78b4c4..699f7cb8 100644 --- a/src/rgb_to_fb.h +++ b/src/rgb_to_fb.h @@ -97,6 +97,8 @@ void osd_update_palette(); void delay_in_arm_cycles(int delay); void wait_for_pi_fieldsync(); +int scan_for_single_pixels_4bpp(uint32_t * start, int length); +int scan_for_single_pixels_12bpp(uint32_t * start, int length); int benchmarkRAM(int address); diff --git a/src/rgb_to_hdmi.c b/src/rgb_to_hdmi.c index e09f6a87..6eff6c5a 100644 --- a/src/rgb_to_hdmi.c +++ b/src/rgb_to_hdmi.c @@ -1818,25 +1818,25 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) case 4: pix_mask = 0x00000007; osd_mask = 0x77777777; + capinfo->ncapture = (capinfo->video_type != VIDEO_PROGRESSIVE) ? 2 : 1; break; case 8: pix_mask = 0x0000007F; osd_mask = 0x77777777; + capinfo->ncapture = (capinfo->video_type != VIDEO_PROGRESSIVE) ? 2 : 1; break; case 16: default: - pix_mask = 0x0000ffff; + pix_mask = 0x00000fff; osd_mask = 0xffffffff; - if (capinfo->video_type == VIDEO_INTERLACED && capinfo->detected_sync_type & SYNC_BIT_INTERLACED) { - mask_BIT_OSD = ~BIT_OSD; - } + //if (capinfo->video_type == VIDEO_INTERLACED && capinfo->detected_sync_type & SYNC_BIT_INTERLACED) { + // mask_BIT_OSD = ~BIT_OSD; + //} + capinfo->ncapture = 1; break; } //capinfo->video_type == VIDEO_INTERLACED && capinfo->detected_sync_type & SYNC_BIT_INTERLACED geometry_get_fb_params(capinfo); // required as calibration sets delay to 0 and the 2 high bits of that adjust the h offset - // In mode 0..6, capture one field - // In mode 7, capture two fields - capinfo->ncapture = (capinfo->video_type != VIDEO_PROGRESSIVE) ? 2 : 1; #ifdef INSTRUMENT_CAL t = _get_cycle_counter(); @@ -1868,9 +1868,9 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) t_capture += _get_cycle_counter() - t; t = _get_cycle_counter(); #endif - // memcpy((void *)latest, (void *)(capinfo->fb + ((ret >> OFFSET_LAST_BUFFER) & 3) * capinfo->height * capinfo->pitch), capinfo->height * capinfo->pitch); + int single_pixel_count = 0; // Compare the frames uint32_t *fbp = (uint32_t *)(capinfo->fb + ((ret >> OFFSET_LAST_BUFFER) & 3) * capinfo->height * capinfo->pitch + capinfo->v_adjust * capinfo->pitch); uint32_t *lastp = (uint32_t *)last + capinfo->v_adjust * (capinfo->pitch >> 2); @@ -1914,6 +1914,7 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) } } } + if (skip) { // For debugging it's useful to see if the lines being eliminated align with the cursor // for (int x = 0; x < capinfo->pitch; x += 4) { @@ -1924,6 +1925,10 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) } else { switch (bpp) { case 4: + { + if (mode7) { + single_pixel_count += scan_for_single_pixels_4bpp(fbp, capinfo->pitch); + } for (int x = 0; x < capinfo->pitch; x += 4) { uint32_t d = osd_get_equivalence(*fbp++ & osd_mask) ^ osd_get_equivalence(*lastp++ & osd_mask); int index = (x << 1) % NUM_OFFSETS; //2 pixels per byte @@ -1935,7 +1940,9 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) index = (index + 1) % NUM_OFFSETS; } } + break; + } case 8: for (int x = 0; x < capinfo->pitch; x += 4) { uint32_t d = osd_get_equivalence(*fbp++ & osd_mask) ^ osd_get_equivalence(*lastp++ & osd_mask); @@ -1951,18 +1958,27 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) break; case 16: default: - for (int x = 0; x < capinfo->pitch; x += 4) { - uint32_t d = *fbp++ ^ *lastp++; + { + if (mode7) { + single_pixel_count += scan_for_single_pixels_12bpp(fbp, capinfo->pitch); + } + for (int x = 0; x < capinfo->pitch; x += 4) { + uint32_t n = *fbp++; + uint32_t o = *lastp++; + uint32_t d = n ^ o; int index = (x >> 1) % NUM_OFFSETS; //half pixel per byte - while (d) { - if (d & pix_mask) { - diff[index]++; + if ((n & 0x80008000) == 0 && (o & 0x80008000) == 0) { + while (d) { + if (d & pix_mask) { + diff[index]++; + } + d >>= 16; + index = (index + 1) % NUM_OFFSETS; } - d >>= 16; - index = (index + 1) % NUM_OFFSETS; } } break; + } } } } @@ -1980,6 +1996,17 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) // Mutate the result to correctly order the sample points: // Then the downstream algorithms don't have to worry + //log_info("count = %d, %d", mode7, single_pixel_count); + if (mode7 && single_pixel_count == 0) { //generate fake diff errors if thick verticals detected + diff[0] += 1000; + diff[1] += 1000; + diff[2] += 1000; + diff[3] += 1000; + diff[4] += 1000; + diff[5] += 1000; + } + + if (bpp == 4) { // A F C B E D => A B C D E F int f = diff[1]; @@ -2009,6 +2036,8 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) max[j] = diff[j]; } } + + } #if 0 for (int i = 0; i < NUM_OFFSETS; i++) { From 6c0b225d8bc98ed6bd9b95cf30babd7b5ed2f198 Mon Sep 17 00:00:00 2001 From: IanSB Date: Sat, 30 Jan 2021 21:31:52 +0000 Subject: [PATCH 13/14] Update profiles --- src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_12bpp_Mode7.txt | 4 +--- src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_3bpp_Mode7.txt | 4 +--- src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_50Hz.txt | 1 - src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz.txt | 1 - src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz_PAL.txt | 1 - src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_50Hz.txt | 3 +-- src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt | 5 ++--- src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_Mono.txt | 2 +- 8 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_12bpp_Mode7.txt b/src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_12bpp_Mode7.txt index df8a2cd4..a2d94a15 100644 --- a/src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_12bpp_Mode7.txt +++ b/src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_12bpp_Mode7.txt @@ -1,9 +1,7 @@ -sampling7=10,10,10,10,10,10,10,0,3,1,4,0,0,0,0,0,0,5,0,0,100,256,100,256,100,256,256,256 +sampling7=3,3,3,3,3,3,3,0,3,1,3,0,0,0,0,0,0,5,0,0,100,256,100,256,100,256,256,256 geometry7=148,26,480,256,576,288,3,4,1,2,12000000,768,5000,312,4,0,1 sampling=5,5,5,5,5,5,5,0,1,0,6,0,0,0,0,0,0,5,0,0,100,256,100,256,100,256,256,256 geometry=176,29,640,256,720,270,1,2,0,2,16000000,1024,5000,312,4,0,0 auto_switch=2 -scanline_level=0 -hdmi_mode=0 normal_scaling=1 overclock_core=100 diff --git a/src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_3bpp_Mode7.txt b/src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_3bpp_Mode7.txt index 8d61fcdb..952ae113 100644 --- a/src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_3bpp_Mode7.txt +++ b/src/scripts/Profiles/3-12_BIT_BBC/BBC_NuLA_3bpp_Mode7.txt @@ -1,8 +1,6 @@ -sampling7=6,6,6,6,6,6,6,0,1,0,4,0,0,0,0,0,0,0,0,0,100,256,100,256,100,256,256,256 +sampling7=3,3,3,3,3,3,3,0,3,0,3,0,0,0,0,0,0,0,0,0,100,256,100,256,100,256,256,256 geometry7=148,26,480,256,576,288,3,4,1,0,12000000,768,5000,312,4,0,2 sampling=4,4,4,4,4,4,4,0,1,0,6,0,0,0,0,0,0,5,0,0,100,256,100,256,100,256,256,256 geometry=176,29,640,256,720,270,1,2,0,2,16000000,1024,5000,312,4,0,0 auto_switch=2 -scanline_level=0 -hdmi_mode=0 overclock_core=100 diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_50Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_50Hz.txt index b5661dc8..54f0b3fa 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_50Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_50Hz.txt @@ -1,5 +1,4 @@ sampling=3,3,3,3,3,3,3,0,1,0,5,0,0,0,0,0,0,5,1,0,55,20,55,20,25,256,256,256 geometry=136,35,640,256,720,270,1,2,0,2,14187580,908,5000,313,4,1,1 palette=RrGgBb_(EGA) -scanline_level=0 overclock_core=50 diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz.txt index c436434a..b20f753a 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz.txt @@ -1,5 +1,4 @@ sampling=3,3,3,3,3,3,3,0,1,0,2,0,0,0,0,0,0,5,1,0,55,20,55,20,25,127,127,127 geometry=136,34,640,200,712,224,2,5,0,2,14318181,910,5000,263,4,1,1 palette=RrGgBb_(EGA) -scanline_level=0 overclock_core=50 diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz_PAL.txt b/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz_PAL.txt index 10cffb32..199b20d3 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz_PAL.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Amiga/Amiga_60Hz_PAL.txt @@ -1,5 +1,4 @@ sampling=3,3,3,3,3,3,3,0,1,0,2,0,0,0,0,0,0,5,1,0,55,20,55,20,25,127,127,127 geometry=136,34,640,200,712,224,2,5,0,2,14187580,910,5000,263,4,1,1 palette=RrGgBb_(EGA) -scanline_level=0 overclock_core=50 diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_50Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_50Hz.txt index cbd2ef3a..bcd4a05b 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_50Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_50Hz.txt @@ -1,5 +1,4 @@ -sampling=0,0,0,0,0,0,0,0,1,0,5,0,0,0,0,0,0,3,0,0,100,256,100,256,100,256,0,256 +sampling=2,2,2,2,2,2,2,0,1,0,5,0,0,0,0,0,0,3,0,0,100,256,100,256,100,256,0,256 geometry=176,61,640,202,720,270,1,2,0,2,16000000,1024,7500,313,0,0,0 palette=RrGgBb_(EGA) -scanline_level=0 overclock_core=100 diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt index ebad9f10..8fcb62ba 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_60Hz.txt @@ -1,5 +1,4 @@ -sampling=0,0,0,0,0,0,0,0,1,0,5,0,0,0,2,0,0,3,0,0,100,256,100,256,100,256,0,256 -geometry=176,31,640,202,720,270,2,5,0,2,16000000,1016,7500,263,4,0,0 +sampling=2,2,2,2,2,2,2,0,1,0,5,0,0,0,2,0,0,3,0,0,100,256,100,256,100,256,0,256 +geometry=176,31,640,202,720,270,2,5,0,2,16000000,1016,7500,263,0,0,0 palette=RrGgBb_(EGA) -scanline_level=0 overclock_core=100 diff --git a/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_Mono.txt b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_Mono.txt index e98da80d..0b4fb417 100644 --- a/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_Mono.txt +++ b/src/scripts/Profiles/6-12_BIT_RGB/Atari_ST/Atari_ST_Mono.txt @@ -1,2 +1,2 @@ -sampling=2,2,2,2,2,2,2,0,7,0,8,0,0,0,0,0,0,8,0,0,100,256,100,256,100,256,256,256 +sampling=3,3,3,3,3,3,3,0,7,0,8,0,0,0,0,0,0,8,0,0,100,256,100,256,100,256,256,256 geometry=140,34,640,402,672,480,2,2,0,0,32000000,896,7500,501,0,0,0 From 40df32b2cfda681674833313902398a958d99fe3 Mon Sep 17 00:00:00 2001 From: IanSB Date: Sun, 31 Jan 2021 01:16:17 +0000 Subject: [PATCH 14/14] Improve speed of 12bpp diff calculation during calibration --- src/rgb_to_fb.S | 50 +++++++++++++++++++++++++++++++++++++++++++++++ src/rgb_to_fb.h | 1 + src/rgb_to_hdmi.c | 24 ++++++----------------- 3 files changed, 57 insertions(+), 18 deletions(-) diff --git a/src/rgb_to_fb.S b/src/rgb_to_fb.S index a94954d1..ea49c57a 100644 --- a/src/rgb_to_fb.S +++ b/src/rgb_to_fb.S @@ -58,6 +58,7 @@ .global wait_for_pi_fieldsync .global scan_for_single_pixels_4bpp .global scan_for_single_pixels_12bpp +.global scan_for_diffs_12bpp #ifdef USE_MULTICORE .global run_core @@ -2852,6 +2853,55 @@ scan_loop: //on exit, r0= number of single pixels detected pop {r2-r12, pc} +.macro COMPARE_12BPP reg1 reg2 + tst \reg1, #0x00008000 + tsteq \reg2, #0x00008000 + bne osd_pixels1\@ + eor r14, \reg1, \reg2 + movs r14, r14, lsl #16 + ldrne r14, [r3, r4] + addne r14, r14, #1 + strne r14, [r3, r4] +osd_pixels1\@: + add r4, r4, #4 + cmp r4, #6*4 + movge r4, #0 + + tst \reg1, #0x80000000 + tsteq \reg2, #0x80000000 + bne osd_pixels2\@ + eor r14, \reg1, \reg2 + movs r14, r14, lsr #16 + ldrne r14, [r3, r4] + addne r14, r14, #1 + strne r14, [r3, r4] +osd_pixels2\@: + add r4, r4, #4 + cmp r4, #6*4 + movge r4, #0 +.endm + + +scan_for_diffs_12bpp: + //r0 = pointer to new + //r1 = pointer to old + //r2 = length + //r3 = address of diff array + push {r4-r12, lr} + add r2, r0, r2 + mov r4, #0 //index into diff (mod 6) + +diff_loop: + ldmia r0!, {r5-r8} + ldmia r1!, {r9-r12} + COMPARE_12BPP r5, r9 + COMPARE_12BPP r6, r10 + COMPARE_12BPP r7, r11 + COMPARE_12BPP r8, r12 + cmp r0, r2 + blt diff_loop + pop {r4-r12, pc} + wait_for_pi_fieldsync: push {r4-r12, lr} CLEAR_VSYNC diff --git a/src/rgb_to_fb.h b/src/rgb_to_fb.h index 699f7cb8..b7878195 100644 --- a/src/rgb_to_fb.h +++ b/src/rgb_to_fb.h @@ -99,6 +99,7 @@ void delay_in_arm_cycles(int delay); void wait_for_pi_fieldsync(); int scan_for_single_pixels_4bpp(uint32_t * start, int length); int scan_for_single_pixels_12bpp(uint32_t * start, int length); +void scan_for_diffs_12bpp(uint32_t *fbp, uint32_t *lastp, int length, int diff[NUM_OFFSETS]); int benchmarkRAM(int address); diff --git a/src/rgb_to_hdmi.c b/src/rgb_to_hdmi.c index 6eff6c5a..097c7660 100644 --- a/src/rgb_to_hdmi.c +++ b/src/rgb_to_hdmi.c @@ -1920,8 +1920,8 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) // for (int x = 0; x < capinfo->pitch; x += 4) { // *fbp++ = 0x11111111; // } - fbp += capinfo->pitch >> 2; - lastp += capinfo->pitch >> 2; + fbp += (capinfo->pitch >> 2); + lastp += (capinfo->pitch >> 2); } else { switch (bpp) { case 4: @@ -1962,21 +1962,9 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk) if (mode7) { single_pixel_count += scan_for_single_pixels_12bpp(fbp, capinfo->pitch); } - for (int x = 0; x < capinfo->pitch; x += 4) { - uint32_t n = *fbp++; - uint32_t o = *lastp++; - uint32_t d = n ^ o; - int index = (x >> 1) % NUM_OFFSETS; //half pixel per byte - if ((n & 0x80008000) == 0 && (o & 0x80008000) == 0) { - while (d) { - if (d & pix_mask) { - diff[index]++; - } - d >>= 16; - index = (index + 1) % NUM_OFFSETS; - } - } - } + scan_for_diffs_12bpp(fbp, lastp, capinfo->pitch, diff); + fbp += (capinfo->pitch >> 2); + lastp += (capinfo->pitch >> 2); break; } } @@ -2633,7 +2621,7 @@ void set_scanlines_intensity(int value) { } int get_scanlines_intensity() { - if ((capinfo->sizex2 & 1) == 0) { + if ((geometry_get_value(FB_SIZEX2) & 1) == 0) { return 0; // returns 0 depending on state of double height } else { return scanlines_intensity;