forked from raspberrypi/pico-extras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scanvideo.pio
119 lines (102 loc) · 3.64 KB
/
scanvideo.pio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
;
; Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
;
; SPDX-License-Identifier: BSD-3-Clause
;
; Default scanline program (|| means aligned word boundary, | means hword boundary)
.program video_24mhz_composable_default
.origin 0 ; must load at zero (offsets are hardcoded in instruction stream)
.define extra0 0 ; set later by code based on xscale
.define extra1 0 ; set later by code (1 more than extra0)
; note bpp must be a factor of 32
.define bpp 16
;.define bpp 8
public end_of_scanline_skip_ALIGN: ; || jmp end_of_scanline_skip_ALIGN | ignored ||
; was 16 but we just discard the reset of the OSR
; so as to also support 8 bit grayscale
out null, 32;
public end_of_scanline_ALIGN: ; | jmp end_of_scanline_ALIGN ||
public entry_point:
wait irq, 4 ; todo perhaps change this to out exec, 16... so that we can do multiple things (including setting black pixel)
public nop_raw:
out pc, bpp
public delay_h_0:
public color_run: ; | jmp color_run | color | count-3 |
out pins, bpp
out x, bpp
color_loop:
public delay_a_1:
jmp x-- color_loop [extra1]
public nop_extra1:
public delay_b_1:
out pc, bpp [extra1]
public raw_run: ; | jmp raw_run | color | n | <n + 2 colors> |
public delay_c_0:
out pins, bpp [extra0]
out x, bpp
pixel_loop:
public delay_d_0:
out pins, bpp [extra0]
jmp x-- pixel_loop
.wrap_target
public raw_1p: ; | jmp raw_1p | color |
public delay_e_0:
out pins, bpp [extra0]
out pc, bpp
public raw_2p: ; | jmp raw_2p | color | color |
public delay_f_1:
out pins, bpp [extra1]
.wrap
public raw_1p_skip_ALIGN: ; | jmp raw_1p_skip_ALIGN | color | ignored ||
out pins, 32 ; requires correct out mask
public nop_extra0:
public delay_g_0:
out pc, bpp [extra0] ; note moved extra0 from above line, so we can use this instruction for
; Variant that replaces raw_1p_skip_work_ALIGN with raw1p_2cycle
.program video_24mhz_composable_raw1p_2cycle
.origin 0 ; must load at zero (offsets are hardcoded in instruction stream)
.define extra0 0 ; set later by code based on xscale
.define extra1 0 ; set later by code (1 more than extra0)
; note bpp must be a factor of 32
.define bpp 16
;.define bpp 8
public end_of_scanline_skip_ALIGN: ; || jmp end_of_scanline_skip_ALIGN | ignored ||
; was 16 but we just discard the reset of the OSR
; so as to also support 8 bit grayscale
out null, 32;
public end_of_scanline_ALIGN: ; | jmp end_of_scanline_ALIGN ||
public entry_point:
wait irq, 4 ; todo perhaps change this to out exec, 16... so that we can do multiple things (including setting black pixel)
public nop_raw:
out pc, bpp
public color_run: ; | jmp color_run | color | count-3 |
public delay_h_0:
out pins, bpp
out x, bpp
color_loop:
public delay_a_1:
jmp x-- color_loop [extra1]
public nop_extra1:
public delay_b_1:
out pc, bpp [extra1]
public raw_run: ; | jmp raw_run | color | n | <n + 2 colors> |
public delay_c_0:
out pins, bpp [extra0]
out x, bpp
pixel_loop:
public delay_d_0:
out pins, bpp [extra0]
jmp x-- pixel_loop
.wrap_target
public raw_1p: ; | jmp raw_1p | color |
public delay_e_0:
out pins, bpp [extra0]
out pc, bpp
public raw_2p: ; | jmp raw_2p | color | color |
public delay_f_1:
out pins, bpp [extra1]
.wrap
public raw_1p_2cycle:
public delay_g_0:
out pins, bpp
out pc, bpp