Skip to content

Commit

Permalink
Add NTSC artifact for tandy coco 1 & 2
Browse files Browse the repository at this point in the history
  • Loading branch information
IanSB committed Dec 17, 2020
1 parent 0f8a08b commit c319c67
Show file tree
Hide file tree
Showing 5 changed files with 333 additions and 206 deletions.
108 changes: 108 additions & 0 deletions src/capture_line_ntsc_8bpp.S
Expand Up @@ -417,6 +417,7 @@ loop_8bpp_mono6_auto_noburst\@:
.global capture_line_ntsc_sixbits_8bpp_cga
.global capture_line_ntsc_sixbits_8bpp_mono
.global capture_line_ntsc_sixbits_8bpp_mono_auto
.global capture_line_ntsc_sixbits_double_8bpp


// The capture line function is provided the following:
Expand Down Expand Up @@ -691,3 +692,110 @@ no_ntsc_sixbits_8bpp_mono_auto:
preload_capture_line_ntsc_sixbits_8bpp_mono_auto:
SETUP_DUMMY_PARAMETERS
b capture_line_ntsc_sixbits_8bpp_mono_auto





.macro NTSC_CAPTURE_BITS_DOUBLE_8BPP_WIDE reg reg2
// Pixel 0 in GPIO 7.. 2 -> 7.. 0
// Pixel 1 in GPIO 13.. 8 -> 23..16

and r9, r12, #0xff000000
mov r9, r9, lsr #2
bic r12, r12, #0xff000000
orr r12, r12, r9

ands r9, r8, #(0x12 << PIXEL_BASE) //y mask
orrne r12, r12, #0x40000000
ands r10, r8, #(0x12 << (PIXEL_BASE + 6)) //y mask
orrne r12, r12, #0x80000000

and r9, r11, #(0x2d << (PIXEL_BASE + 12)) //r-y / b-y mask
cmp r9, #(0x28 << (PIXEL_BASE + 12)) //r-y / b-y are 0
and r10, r11, #(0x2d << (PIXEL_BASE + 18)) //r-y / b-y mask
cmpeq r10, #(0x28 << (PIXEL_BASE + 18)) //r-y / b-y are 0
bne no6847artifact\@

tst r12, #4
beq no6847artifact\@

eor r9, r12, r12, lsr #1
tst r9, #0x08000000
beq no6847artifact\@

and r10, r12, #3
tst r12, #0x08000000 // left pixel is black & right pixel is white
eorne r10, r10, #2
mov r10, r10, lsl #3
lsr r10, r14, r10
and r10, r10, #0xff
orr r10, r10, lsl #16

tst r9, #0x20000000
tstne r9, #0x02000000
bne done6847artifact\@

tst r12, #0x08000000 // left pixel is black & right pixel is white

bicne r10, r10, #0x00100000
biceq r10, r10, #0x00000010

b done6847artifact\@
no6847artifact\@:
and r9, r11, #(0x3f << (PIXEL_BASE + 12))
mov r10, r9, lsr #(PIXEL_BASE + 12)
and r9, r11, #(0x3f << (PIXEL_BASE + 18))
eor r10, r10, r9, lsr #(PIXEL_BASE + 18 - 16)
done6847artifact\@:
mov r11, r11, lsr #12
bic r8, r8, #3
orr r11, r11, r8, lsl #(32 - 12 - PIXEL_BASE)

// Pixel double
orr \reg2, r10, r10, lsl #8
.endm

// *** 8 bit ***
.align 6
b preload_capture_line_ntsc_sixbits_double_8bpp
capture_line_ntsc_sixbits_double_8bpp:
push {lr}
tst r3, #BIT_VSYNC_MARKER
ldrne r11, =0x00010001
moveq r11, #0
ldr r12, =ntsc_status
ldr r12, [r12]
SKIP_PSYNC_NO_OLD_CPLD
ldr r14, =0x5953565c //orange / green / blue / purple
WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8
NTSC_CAPTURE_BITS_DOUBLE_8BPP_WIDE r11 r5 // input in r8
WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8
NTSC_CAPTURE_BITS_DOUBLE_8BPP_WIDE r11 r6 // input in r8
loop_8bppnd:
WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8
NTSC_CAPTURE_BITS_DOUBLE_8BPP_WIDE r11 r5 // input in r8
WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8
NTSC_CAPTURE_BITS_DOUBLE_8BPP_WIDE r11 r6 // input in r8

WRITE_R5_R6_IF_LAST
cmp r1, #1
popeq {r0, pc}

WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8
NTSC_CAPTURE_BITS_DOUBLE_8BPP_WIDE r11 r7 // input in r8
WAIT_FOR_PSYNC_EDGE_FAST // expects GPLEV0 in r4, result in r8
NTSC_CAPTURE_BITS_DOUBLE_8BPP_WIDE r11 r10 // input in r8

WRITE_R5_R6_R7_R10

subs r1, r1, #2
bne loop_8bppnd

pop {r0, pc}

preload_capture_line_ntsc_sixbits_double_8bpp:
SETUP_DUMMY_PARAMETERS
b capture_line_ntsc_sixbits_double_8bpp
.ltorg

200 changes: 100 additions & 100 deletions src/cpld_rgb.c
Expand Up @@ -212,106 +212,106 @@ static const char *range_names[] = {
};

static const char *volt_names[] = {
"0 (0.00v)",
"1 (0.01v)",
"2 (0.03v)",
"3 (0.04v)",
"4 (0.05v)",
"5 (0.06v)",
"6 (0.08v)",
"7 (0.09v)",
"8 (0.10v)",
"9 (0.12v)",
"10 (0.13v)",
"11 (0.14v)",
"12 (0.16v)",
"13 (0.17v)",
"14 (0.18v)",
"15 (0.19v)",
"16 (0.21v)",
"17 (0.22v)",
"18 (0.23v)",
"19 (0.25v)",
"20 (0.26v)",
"21 (0.27v)",
"22 (0.28v)",
"23 (0.30v)",
"24 (0.31v)",
"25 (0.32v)",
"26 (0.34v)",
"27 (0.35v)",
"28 (0.36v)",
"29 (0.38v)",
"30 (0.39v)",
"31 (0.40v)",
"32 (0.41v)",
"33 (0.43v)",
"34 (0.44v)",
"35 (0.45v)",
"36 (0.47v)",
"37 (0.48v)",
"38 (0.49v)",
"39 (0.50v)",
"40 (0.52v)",
"41 (0.53v)",
"42 (0.54v)",
"43 (0.56v)",
"44 (0.57v)",
"45 (0.58v)",
"46 (0.60v)",
"47 (0.61v)",
"48 (0.62v)",
"49 (0.63v)",
"50 (0.65v)",
"51 (0.66v)",
"52 (0.67v)",
"53 (0.69v)",
"54 (0.70v)",
"55 (0.71v)",
"56 (0.72v)",
"57 (0.74v)",
"58 (0.75v)",
"59 (0.76v)",
"60 (0.78v)",
"61 (0.79v)",
"62 (0.80v)",
"63 (0.82v)",
"64 (0.83v)",
"65 (0.84v)",
"66 (0.85v)",
"67 (0.87v)",
"68 (0.88v)",
"69 (0.89v)",
"70 (0.91v)",
"71 (0.92v)",
"72 (0.93v)",
"73 (0.94v)",
"74 (0.96v)",
"75 (0.97v)",
"76 (0.98v)",
"77 (1.00v)",
"78 (1.01v)",
"79 (1.02v)",
"80 (1.04v)",
"81 (1.05v)",
"82 (1.06v)",
"83 (1.07v)",
"84 (1.09v)",
"85 (1.10v)",
"86 (1.11v)",
"87 (1.13v)",
"88 (1.14v)",
"89 (1.15v)",
"90 (1.16v)",
"91 (1.18v)",
"92 (1.19v)",
"93 (1.20v)",
"94 (1.22v)",
"95 (1.23v)",
"96 (1.24v)",
"97 (1.26v)",
"98 (1.27v)",
"99 (1.28v)",
"000 (0.00v)",
"001 (0.01v)",
"002 (0.03v)",
"003 (0.04v)",
"004 (0.05v)",
"005 (0.06v)",
"006 (0.08v)",
"007 (0.09v)",
"008 (0.10v)",
"009 (0.12v)",
"010 (0.13v)",
"011 (0.14v)",
"012 (0.16v)",
"013 (0.17v)",
"014 (0.18v)",
"015 (0.19v)",
"016 (0.21v)",
"017 (0.22v)",
"018 (0.23v)",
"019 (0.25v)",
"020 (0.26v)",
"021 (0.27v)",
"022 (0.28v)",
"023 (0.30v)",
"024 (0.31v)",
"025 (0.32v)",
"026 (0.34v)",
"027 (0.35v)",
"028 (0.36v)",
"029 (0.38v)",
"030 (0.39v)",
"031 (0.40v)",
"032 (0.41v)",
"033 (0.43v)",
"034 (0.44v)",
"035 (0.45v)",
"036 (0.47v)",
"037 (0.48v)",
"038 (0.49v)",
"039 (0.50v)",
"040 (0.52v)",
"041 (0.53v)",
"042 (0.54v)",
"043 (0.56v)",
"044 (0.57v)",
"045 (0.58v)",
"046 (0.60v)",
"047 (0.61v)",
"048 (0.62v)",
"049 (0.63v)",
"050 (0.65v)",
"051 (0.66v)",
"052 (0.67v)",
"053 (0.69v)",
"054 (0.70v)",
"055 (0.71v)",
"056 (0.72v)",
"057 (0.74v)",
"058 (0.75v)",
"059 (0.76v)",
"060 (0.78v)",
"061 (0.79v)",
"062 (0.80v)",
"063 (0.82v)",
"064 (0.83v)",
"065 (0.84v)",
"066 (0.85v)",
"067 (0.87v)",
"068 (0.88v)",
"069 (0.89v)",
"070 (0.91v)",
"071 (0.92v)",
"072 (0.93v)",
"073 (0.94v)",
"074 (0.96v)",
"075 (0.97v)",
"076 (0.98v)",
"077 (1.00v)",
"078 (1.01v)",
"079 (1.02v)",
"080 (1.04v)",
"081 (1.05v)",
"082 (1.06v)",
"083 (1.07v)",
"084 (1.09v)",
"085 (1.10v)",
"086 (1.11v)",
"087 (1.13v)",
"088 (1.14v)",
"089 (1.15v)",
"090 (1.16v)",
"091 (1.18v)",
"092 (1.19v)",
"093 (1.20v)",
"094 (1.22v)",
"095 (1.23v)",
"096 (1.24v)",
"097 (1.26v)",
"098 (1.27v)",
"099 (1.28v)",
"100 (1.29v)",
"101 (1.31v)",
"102 (1.32v)",
Expand Down

0 comments on commit c319c67

Please sign in to comment.