sourceextensions/blender/demos/PcWalk.xtl
1⍝│ PcWalk.xtl -- HEX1000's program counter, a video made with the
2⍝│ explainer kit (Video.xtl): the 64 addresses of a ROM page as cells in
3⍝│ reading order, and the program counter visiting them in the order
4⍝│ its shift register steps -- 0 1 3 7 15 31 63 62 ..., never +1 -- each
5⍝│ cell lit as it is reached, colored by when, the path drawn behind it.
6⍝│ The order is X_eTaL-fpga's Hex1000 library (hx:Order, pinned at
7⍝│ FPGA_COMMIT); the first hops are in slow motion and the rest a
8⍝│ time-lapse (vd:r_etime), behind a title card, with captions, a cue
9⍝│ sheet and subtitles; the same scene fits a YouTube video (1920 by
10⍝│ 1080) or a Short (1080 by 1920). Shared by the demo (demos/hex-pc.xtl)
11⍝│ and its test.
12⍝│ Import: "pw:" u_se< "PcWalk"
13
14"hx:" u̲se< "Hex1000"
15"vd:" u̲se< "Video"
16
17⍝━━ The data
18
19⍝│ order: the addresses the program counter visits from 0, in turn
20⍝│ (X_eTaL-fpga's hx:Order); after the last it is back at 0
21⍝│ >> "pw:" u_se< "PcWalk"
22⍝│ >> 8 t_ake pw:order
23⍝│ 0 1 3 7 15 31 63 62
24ˡorder ← ʰˣOrder
25
26⍝│ n: how many (64, a ROM page)
27ˡn ← t̲ally ˡorder
28
29⍝━━ Time
30
31⍝│ the scene's own seconds: hop k (from 1) at second k - 1, back to 0 at
32⍝│ second n. map: the scene's seconds to the video's -- a title card
33⍝│ first, the first six hops a second each (slow motion), the other 57
34⍝│ in 5.7 seconds (a time-lapse), the hop back to 0 slower
35ˡmap ← 4 2 r̲eshape 0.0 3.5 6.0 9.5 63.0 15.2 64.0 16.2
36
37⍝│ length: the video's seconds
38ˡlength ← 19.5
39
40⍝│ at: the video second of each hop (n), then of the hop back to 0
41⍝│ >> "pw:" u_se< "PcWalk"
42⍝│ >> 7 t_ake pw:at
43⍝│ 3.5 4.5 5.5 6.5 7.5 8.5 9.5
44ˡat ← (ˡmap, (r̲ange ˡn + 1) − 1) ᵛᵈr̲etime 0
45
46⍝━━ Where things are
47
48⍝│ (address, y) pw:p_lace 0: x y z of addresses (n by 3), in reading
49⍝│ order: 8 a row, 0 at the top left, 1.2 m apart, at depth y
50⍝│ >> "pw:" u_se< "PcWalk"
51⍝│ >> (0 9 63, 0.0) pw:p_lace 0
52⍝│ -4.2 0.0 4.2
53⍝│ -3.0 0.0 3.0
54⍝│ 4.2 0.0 -4.2
55ˡp̲lace ← { (a, y) z →
56 k ← t̲ally a
57 x ← 1.2 × (f̲loat a m̲od 8) − 3.5
58 zz ← 1.2 × 3.5 − f̲loat a d̲iv 8
59 2 1 t̲ranspose (3 c̲at k) r̲eshape x c̲at (k r̲eshape y) c̲at zz
60}
61
62⍝│ colors: a color for each hop, by when (deep blue first, orange last:
63⍝│ vd:t_one)
64ˡcolors ← ((r̲ange ˡn) − 1, 0.0, f̲loat ˡn − 1) ᵛᵈt̲one 0
65
66⍝ cells: a box per hop at its address, its color, dark (n by 10)
67ʰcells ← ((ˡorder, 0.0) ˡp̲lace 0) c̲at₂ ((ˡn c̲at 3) r̲eshape 1.0 0.25 1.0) c̲at₂ ˡcolors c̲at₂ (ˡn c̲at 1) r̲eshape 0.0
68
69⍝ the page: every address's place, outlined in gray from the start
70ʰpage ← ((ˡorder, 0.0) ˡp̲lace 0) c̲at₂ (ˡn c̲at 7) r̲eshape 1.04 0.3 1.04 70 76 96 1.0
71
72⍝ the cells' glow, each at times of its own: dark until it is reached,
73⍝ a flash, then lit (n by 4 each)
74ʰglowTimes ← 2 1 t̲ranspose (4 c̲at ˡn) r̲eshape (ˡn r̲eshape 0.0) c̲at (ˡn t̲ake ˡat − 1.0 ÷ 30.0) c̲at (ˡn t̲ake ˡat) c̲at ˡn t̲ake ˡat + 0.35
75ʰglowAmounts ← (ˡn c̲at 4) r̲eshape 0.0 0.0 3.0 1.0
76
77⍝ the marker: where the counter is at each hop, a frame round the cell
78ʰmarkerAt ← (1 c̲at (ˡn + 1) c̲at 6) r̲eshape ((ˡorder c̲at 0, -0.2) ˡp̲lace 0) c̲at₂ ((ˡn + 1) c̲at 3) r̲eshape 1.3 0.4 1.3
79
80⍝ the path: a line from each address to the next, in front of the cells
81ʰpath ← ((ˡorder, -0.3) ˡp̲lace 0) c̲at₂ (((1 d̲rop ˡorder) c̲at 0, -0.3) ˡp̲lace 0) c̲at₂ ˡcolors c̲at₂ (ˡn c̲at 1) r̲eshape 0.05
82
83⍝ each line from the hop it starts to the end
84ʰpathShown ← 2 1 t̲ranspose (2 c̲at ˡn) r̲eshape (ˡn t̲ake ˡat) c̲at ˡn r̲eshape ˡlength
85
86⍝━━ Words
87
88⍝│ the title card's title and subtitle
89ˡtitle ← "HEX1000"
90⍝│ the subtitle
91ˡsubtitle ← "its program counter, one hop at a time"
92
93⍝│ captionTexts: the captions, | between them -- the first hops and
94⍝│ their count from the data
95ˡcaptionTexts ← "slow motion: PC goes " c̲at (f̲ormat 7 t̲ake ˡorder) c̲at "|time-lapse: all " c̲at (f̲ormat ˡn) c̲at " addresses, each once|then back to 0: a ROM page in shift-register order"
96
97⍝│ captionTable: each caption's from and to (video seconds), white
98ˡcaptionTable ← 3 5 r̲eshape 3.6 9.4 255 255 255 9.7 15.1 255 255 255 15.4 19.5 255 255 255
99
100⍝ the card: from, to, the words' color, the card's
101ʰcardTable ← 1 8 r̲eshape 0.0 3.2 255 255 255 18 22 44
102
103⍝│ the cues: the title card's and the captions' texts and their times
104⍝│ (for vd:c_ues and vd:s_rt)
105ˡcueTexts ← ˡtitle c̲at ": " c̲at ˡsubtitle c̲at "|" c̲at ˡcaptionTexts
106⍝│ their from and to (video seconds)
107ˡcueTable ← (2 t̲ake₂ ʰcardTable) c̲at 2 t̲ake₂ ˡcaptionTable
108
109⍝━━ The scene
110
111⍝ the sky: near black
112ʰsky ← 8 10 18
113
114⍝ the camera's keys in the scene's seconds (retimed), eyes from the aim
115ʰcamTimes ← -3.5 6.0 63.0 66.0
116ʰcamFrom ← 4 3 r̲eshape -2.0 -1.12 1.5 -1.0 -1.02 0.5 1.5 -1.02 -0.5 2.0 -1.06 0.0
117
118⍝│ pw:s_cene size: the whole script Blender runs, before its stills or
119⍝│ video: the stage at that size (width height: vd:landscape or
120⍝│ vd:shorts), the page, the cells, the marker and the path keyed by
121⍝│ the data, the camera far enough back for the grid and the captions
122⍝│ to fit (vd:f_it), the title card, the captions
123ˡs̲cene ← { size →
124 w ← 1 s̲elect size
125 h ← 2 s̲elect size
126 d ← (w, h, 35, 11.0, 15.0) ᵛᵈf̲it 0
127 aim ← 0.0 0.0 -1.6
128 eyes ← (4 3 r̲eshape aim) + ʰcamFrom × 4 3 r̲eshape 1.0 c̲at d c̲at 1.0
129 ((ᵛᵈhead c̲at ((w, h, 30, ˡlength, ʰsky, 35) ᵛᵈs̲tage 0)) c̲at
130 ((("page", ʰpage) ᵛᵈo̲utlines 0) c̲at (("cells", ʰcells) ᵛᵈb̲oxes 0) c̲at ("cells", ʰglowTimes, ʰglowAmounts) ᵛᵈg̲lows 0) c̲at
131 ((("pc", 1 10 r̲eshape (6 t̲ake r̲avel ʰmarkerAt) c̲at 255 255 255 2.0) ᵛᵈo̲utlines 0) c̲at ("pc", ˡat, ʰmarkerAt) ᵛᵈm̲oves 0) c̲at
132 ((("path", ʰpath) ᵛᵈl̲ines 0) c̲at ("path", ʰpathShown) ᵛᵈs̲hown 0) c̲at
133 (((ˡmap, ʰcamTimes) ᵛᵈr̲etime 0, eyes, 4 3 r̲eshape aim) ᵛᵈc̲amera 0) c̲at
134 ((ˡtitle, ˡsubtitle, ʰcardTable) ᵛᵈc̲ards 0) c̲at (ˡcaptionTexts, ˡcaptionTable) ᵛᵈc̲aptions 0)
135}