nx_world_snap.nx source
↩ module page · 737 lines · 43394 B
1// nx_world_snap.nx -- THE WORLD-ART CAPTURE INSTRUMENT (operator 2026-08-12: "make sure you are
2// running the tools to evaluate the art and realism and quality"). The W1b style overlay applies
3// in the BROWSER page only, so no estate instrument had ever SEEN a styled world -- this organ
4// renders any (identity, seed, style-rows) world NATIVELY through the same engine source the wasm
5// is compiled from (nx_wasm_craft as a lib; its 54-tooth gate is the native-behavior proof), and
6// writes the frame as PNG for the judge battery (nx_uiq_visual analyze / nx_frame_score / eye).
7// The style poke here is semantically what the page's NXSP loop does: sp[idx]=val post-init,
8// idx bounded 7..58 (same belt as the page).
9// usage: nx_world_snap <out.png> [v] [seed] [style idx:val,...] [ticks]
10// exit: 0 written+read-back | 2 usage | 5 png-write-fail. license_tier: ORIGINAL
11// No hw writes (Rule 26).
12import "nx_wasm_craft.nx"
13import "nx_genp_allow_lib.nx" // THE ONE gen-time allowlist (2026-09-04): the g8 chain below was a mirrored copy and it is now the same ruler the engine reads
14import "nx_png_write.nx"
15import "_hdl_build/nx_nxfh_lib.nx"
16const K_MAGIC_20260728: i64 = 20260728
17const K_MAGIC_4096: i64 = 4096
18const K_MAGIC_65536: i64 = 65536
19const K_MODE_RW: i64 = 420 // 0644 -- the .d16 raw depth plane, same mode nx_png_write uses
20// ★RESOLUTION POLICY CONSTANTS. None of these is a tuning number.
21// wc_rw(base) = W/q and wc_rh(base) = H/q, so q=1 IS one ray per pixel -- the engine's OWN definition
22// of native. The ceiling W x H is itself derived (nx_wasm_craft's const W: the page's min(98vw,1920px)
23// display cap), so no resolution literal below is chosen by hand.
24const WS_Q_NATIVE: i64 = 1
25const WS_CH_Q: i64 = 113 // ASCII 'q' -- first byte of the `q=<n>` reduction keyword
26const WS_CH_EQ: i64 = 61 // ASCII '='
27const WS_PERMIL: i64 = 1000 // permil base for the announced resolution fraction
28// The `q=` keyword is exactly the two named bytes above, so its length is a property of the keyword
29// rather than a number to remember: the scan resumes at the first byte AFTER them.
30const WS_QKW_LEN: i64 = 2
31const WS_CURSOR_BYTES: i64 = 16 // one i64 cursor cell, page-rounded by mmap
32// THE PERCEPT ANCHOR GEOMETRY. nx_percept's entire anchor corpus declares NXFH1 400 240 -- all twelve
33// of them -- so a 1920x1200 capture is scoreable by nx_frame_score and comparable to NOTHING in the
34// perceptual corpus. These two numbers are that corpus's shape, not a taste: they are the size the
35// consumer already publishes, and the downsample factor below is DERIVED from them against the
36// engine's own native ceiling rather than chosen.
37const WS_PERCEPT_W: i64 = 400
38const WS_PERCEPT_H: i64 = 240
39// The PORTRAIT SUBJECT'S GENOME is DERIVED FROM THE SEED, never chosen: every other appearance in
40// this organ is a deterministic function of (identity, seed), and a hand-picked genome would make
41// one girl's look a property of the instrument rather than of the world being judged. The genome
42// WIDTH is the engine's own (WATER_MAGIC_1048576, the modulus genmobs itself uses), read from the
43// engine rather than restated here, so the two can never disagree about how wide a genome is.
44// ★NAMED FOR THEIR PURPOSE, NOT THEIR VALUE (rule 11). Both were inline literals that predate this
45// lane: the magic ratchet reported magic=5 against a banked baseline of 0, so NO build of this organ
46// could ship until they were named -- a permanently-refusing gate on the estate's world-capture
47// instrument, and the refusal correctly named literals whose author was long gone. Fixed rather than
48// bypassed: a ratchet is only worth having if its author fixes what it finds.
49// The .d16 ground-truth plane stores each depth sample as a little-endian UNSIGNED 16-BIT word, so
50// its saturation value is a property of the format, not a tuning choice.
51const WS_D16_MAX: i64 = 65535
52// The normal channel normalises an integer gradient by binary-searching isqrt(m2). m2 is a sum of
53// three squares of clamped gradient terms, so bounding `hi` at 2^32 keeps mid*mid inside i64 for
54// every input the loop can be handed -- an OVERFLOW bound, not a magnitude guess.
55const WS_ISQRT_HI_BOUND: i64 = 4294967296
56// The engine's native ceiling, read through FUNCTION scope on purpose: main() later declares its own
57// `let W` for the RENDERED extent, and a single-pass compiler resolving one name to two different
58// things inside one body is exactly how a measurement silently reports the wrong subject.
59func ws2_natw() -> i64 { return W }
60func ws2_nath() -> i64 { return H }
61
62func ws2_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
63func ws2_puts(s: *u8) -> i64 { sys_write(1, s, ws2_slen(s)); return 0 }
64func ws2_pn(v: i64) -> i64 {
65 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 }
66 var m: i64 = v
67 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m }
68 let t: *u8 = sys_mmap(32)
69 var k: i64 = 0
70 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
71 let o: *u8 = sys_mmap(32)
72 var i: i64 = 0
73 while i < k { o[i] = t[k - 1 - i]; i = i + 1 }
74 sys_write(1, o, k)
75 return 0
76}
77func ws2_int(s: *u8) -> i64 {
78 var v: i64 = 0
79 var i: i64 = 0
80 while s[i] != (0 as u8) {
81 let c: i64 = s[i] as i64
82 if c >= 48 { if c <= 57 { v = v*10 + (c - 48) } }
83 i = i + 1
84 }
85 return v
86}
87func ws2_num_at(s: *u8, pos: *i64) -> i64 {
88 var v: i64 = 0
89 var i: i64 = pos[0]
90 var run: i64 = 1
91 while run == 1 {
92 let c: i64 = s[i] as i64
93 if c >= 48 { if c <= 57 { v = v*10 + (c-48); i = i + 1 } else { run = 0 } } else { run = 0 }
94 }
95 pos[0] = i
96 return v
97}
98
99func ws2_streq(a: *u8, b: *u8) -> i64 {
100 var i: i64 = 0
101 while a[i] != (0 as u8) {
102 if a[i] != b[i] { return 0 }
103 i = i + 1
104 }
105 if b[i] != (0 as u8) { return 0 }
106 return 1
107}
108
109func main(argc: i64, argv: *i64) -> i64 {
110 // ★THE `char` VERB SHIFTS EVERY LATER ARGUMENT BY ONE AND CHANGES NOTHING ELSE ON THE WORLD PATH
111 // (ao=0 there, so its argv indices are literally unchanged -- proven by behaveprobe IDENTICAL before
112 // promote, which is also the experiment that caught the ARENA-0 extent defect this organ carried:
113 // the first landing of this verb crashed, a full revert STILL crashed at the same address, and that
114 // is what proved the fault was ww()/hh() reading a foreign arena rather than this change).
115 // "char" cannot collide with the world path's first argument because that argument is an output PATH.
116 var ao: i64 = 0
117 var charmode: i64 = 0
118 if argc > 1 { if ws2_streq(argv[1] as *u8, "char" as *u8) == 1 { charmode = 1; ao = 1 } }
119 // ws_groundtruth_emit -- THE DATASET-FACTORY VERB (/compare/graphics contract row, 2026-08-18):
120 // gt renders the identical world path with the engine's zero-cost depth plane KEPT (S_GT_KEEP), and
121 // emits three ALIGNED channels beside the RGB: <out>.depth.png (16-bit gray, near = bright, the
122 // engine's own 24-bit ray depth clamped to 16) and <out>.normal.png (screen-space normal from the
123 // depth gradient, encoded 0..255 -- DERIVED from depth and labeled so; a G-buffer normal is the next
124 // rung). Same argv shape as the world path after the verb. Infinigen's annotation pipeline is why its
125 // datasets exist; this is that lane through OUR renderer, deterministic under the seed.
126 var gtmode: i64 = 0
127 if argc > 1 { if ws2_streq(argv[1] as *u8, "gt" as *u8) == 1 { gtmode = 1; ao = 1 } }
128 if argc < 2 + ao {
129 ws2_puts("usage: nx_world_snap <out.png> [v] [seed] [style idx:val,...] [ticks]\n" as *u8)
130 ws2_puts(" nx_world_snap char <out.png> [v] [seed] [style idx:val,...] [ticks] -- frame a girl (T59's placement)\n" as *u8)
131 ws2_puts(" nx_world_snap gt <out.png> [v] [seed] [style idx:val,...] [ticks] -- ground truth: +<out>.depth.png +<out>.normal.png\n" as *u8)
132 return 2
133 }
134 let outp: *u8 = argv[1 + ao] as *u8
135 var v: i64 = 0
136 if argc > 2 + ao { v = ws2_int(argv[2 + ao] as *u8) }
137 var seed: i64 = K_MAGIC_20260728
138 if argc > 3 + ao { seed = ws2_int(argv[3 + ao] as *u8) }
139 var ticks: i64 = 30
140 if argc > 5 + ao { ticks = ws2_int(argv[5 + ao] as *u8) }
141 let base: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
142 // W1c: gen rows (0..6, 59, 60) in the SAME spec string are written into GENP *BEFORE* init --
143 // without this a snap of a gen-row world renders the bare identity's terrain, i.e. the judge
144 // measures the WRONG SUBJECT (debt 1786644871). The engine enforces the allowlist; the count
145 // it actually applied is world truth (S_GENP) and is announced below.
146 if argc > 4 + ao {
147 let sp8: *u8 = argv[4 + ao] as *u8
148 let gp8: *i64 = wgp(base)
149 let pos8: *i64 = sys_mmap(16) as *i64
150 pos8[0] = 0
151 var gk8: i64 = 0
152 var run8: i64 = 1
153 while run8 == 1 {
154 let iv8: i64 = ws2_num_at(sp8, pos8)
155 if sp8[pos8[0]] != (58 as u8) { run8 = 0 } else {
156 pos8[0] = pos8[0] + 1
157 let vv8: i64 = ws2_num_at(sp8, pos8)
158 // THE ONE ALLOWLIST (nx_genp_allow_lib, 2026-09-04): the engine's own ruler, read here instead of mirrored.
159 let g8: i64 = genp_gen_ok(iv8)
160 // 2026-09-01 this filter mirrored init_impl_v's chain index-for-index and named itself a DUPLICATE RULER
161 // (debt 1788294505); 2026-09-04 the root fix landed -- nx_genp_allow_lib is the one list the engine, this
162 // instrument and the page emitter all read, so an index admitted to the engine is seen here by construction.
163 if g8 == 1 { if gk8 < GENP_MAXP {
164 gp8[2 + gk8*2] = iv8
165 gp8[3 + gk8*2] = vv8
166 gk8 = gk8 + 1
167 } }
168 if sp8[pos8[0]] == (44 as u8) { pos8[0] = pos8[0] + 1 } else { run8 = 0 }
169 }
170 }
171 if gk8 > 0 { gp8[0] = GENP_MAGIC; gp8[1] = gk8 }
172 }
173 init_impl_v(base, v, seed)
174 // ---- style poke: the page's NXSP loop, natively; applied count ANNOUNCED ----
175 var applied: i64 = 0
176 if argc > 4 + ao {
177 let sp7: *u8 = argv[4 + ao] as *u8
178 let sp: *i64 = wsp(base)
179 let pos: *i64 = sys_mmap(16) as *i64
180 pos[0] = 0
181 var run: i64 = 1
182 while run == 1 {
183 let iv: i64 = ws2_num_at(sp7, pos)
184 if sp7[pos[0]] != (58 as u8) { run = 0 } else {
185 pos[0] = pos[0] + 1
186 let vv: i64 = ws2_num_at(sp7, pos)
187 if iv >= 7 { if iv <= 58 { sp[iv] = vv; applied = applied + 1 } }
188 if sp7[pos[0]] == (44 as u8) { pos[0] = pos[0] + 1 } else { run = 0 }
189 }
190 }
191 }
192 var t: i64 = 0
193 while t < ticks { tick_impl(base, 16); t = t + 1 }
194 // ★FULL RESOLUTION IS THE DEFAULT ON EVERY PATH, NOT ONLY ON `char` (operator 2026-08-28: "when you
195 // screenshot it needs to be full resolution not this bullshit sampled tiny stuff make sure this is
196 // true everywhere, we are fine with the cost to make sure the product is the best it can be").
197 // The `char` verb ALREADY set q=1 and derived exactly why (its comment is below, unchanged). The
198 // WORLD path and the `gt` DATASET-FACTORY path did NOT, so they rendered at whatever the browser's
199 // adaptive frame-time controller happened to land on during the tick loop above.
200 // MEASURED 2026-08-28 on the bare default invocation: w=240 h=150 -- q=8, i.e. 36,000 of the
201 // engine's 2,304,000 native pixels (15 permil of the product's own resolution). Two things follow
202 // and both are defects: the published product frame (nx_world_emit -> /world/emit_craft.png) shipped
203 // at 240x150, and every art verdict taken from this instrument was a verdict about 1/64 of the
204 // picture. ★A CAPTURE WHOSE RESOLUTION IS SET BY A LOAD-SENSITIVE GOVERNOR MAKES EVERY VERDICT A
205 // FUNCTION OF BOX LOAD RATHER THAN OF THE SUBJECT -- and it fails toward LESS evidence exactly when
206 // the estate is busiest, which is when nobody has time to notice.
207 // A REDUCTION IS STILL AVAILABLE AND MUST BE ASKED FOR BY NAME: `q=<n>` anywhere in argv. It is a
208 // KEYWORD, never a positional, because every positional index here is load-bearing (nx_world_emit
209 // forks this organ on a fixed 5-arg contract) and a new slot would silently reinterpret an existing
210 // caller's arguments. The chosen q and the resulting fraction of native are ANNOUNCED below, so a
211 // reduced capture can never pass itself off as a full one.
212 let wsq: *i64 = wst(base)
213 var qsel: i64 = WS_Q_NATIVE
214 var qk: i64 = 1
215 while qk < argc {
216 let av: *u8 = argv[qk] as *u8
217 if av[0] == (WS_CH_Q as u8) { if av[1] == (WS_CH_EQ as u8) {
218 let qp: *i64 = sys_mmap(WS_CURSOR_BYTES) as *i64
219 qp[0] = WS_QKW_LEN
220 let qv: i64 = ws2_num_at(av, qp)
221 if qv >= WS_Q_NATIVE { qsel = qv }
222 } }
223 qk = qk + 1
224 }
225 // clamp to the ENGINE's own declared range instead of declaring a second one: two guards for one
226 // invariant is the duplicate-ruler defect, and the engine is the owner of what q may be.
227 if qsel > Q_MAX { qsel = Q_MAX }
228 wsq[S_Q] = qsel
229 // THE `percept` KEYWORD, scanned anywhere in argv for exactly the reason `q=` is: every positional
230 // index in this organ is load-bearing (nx_world_emit forks it on a fixed 5-arg contract) and a new
231 // slot would silently reinterpret an existing caller's arguments. Put it LAST, after ticks.
232 var perceptmode: i64 = 0
233 var pck: i64 = 1
234 while pck < argc {
235 if ws2_streq(argv[pck] as *u8, "percept" as *u8) == 1 { perceptmode = 1 }
236 pck = pck + 1
237 }
238 // ★CHARACTER FRAMING. The world snapshot renders whatever the spawn camera happens to face, and
239 // MEASURED 2026-08-15 that frames no girl at all: judging craft before and after a genome-shading
240 // change returned BYTE-IDENTICAL axes -- composition 246, palette 343, contour 933,
241 // palette_buckets 176, edge_total 10761 -- because the subject was never in the picture. A referee
242 // is only as good as the frame it is handed, and a capture that cannot see a character cannot grade
243 // character work no matter how good the judge is.
244 // The placement recipe is T59's (stand her along the camera forward axis, on the ground, camera at
245 // eye height) -- but the DISTANCE diverged from the tooth's on 2026-08-16, deliberately and declared
246 // on the board BEFORE it moved: T59 proves VISIBILITY at gameplay distance (4 blocks), while this
247 // instrument takes a PORTRAIT for the figure judge, and the two subjects earn different framings.
248 // The portrait distance is DERIVED, not tasted: composition needs shaded regions wider than the
249 // judge's 16px cell, so the torso (diameter 2*chest radius = 44 q8) must span >= 2 cells (32px);
250 // at q=1 (foc = 600) that requires vz <= 44*600/32 = 825 q8, and TWO BLOCKS (512) gives a 51px
251 // torso -- about 3 cells with margin -- while her 308px height still fits the 750px frame.
252 // ⚠CALIBRATION BREAK: crop numbers before/after this change are NOT comparable; the flat-vs-lit
253 // delta was completed at the old distance first, precisely so this break costs no history.
254 // Every other girl is parked far away so the judge's numbers are attributable to HER, not a crowd --
255 // the same reason T59 moves them all for its negative control.
256 var framed: i64 = 0
257 var framed_gy: i64 = 0 - 1
258 // DENOMINATOR FOR THE FRAMING CLAIM. framed=1 used to mean only "a ground cell was found and
259 // en_nth(mc,0) returned a positive handle" -- and en_nth over an EMPTY store still hands back a
260 // positive-looking handle, so an empty cast framed=1 with nothing in the picture to frame.
261 // MEASURED 2026-09-01 on the beach: CHAR-FRAME framed=1 ground_y=11 followed immediately by
262 // CHAR-CROP pixels=0, because genmobs only places a girl on a cell whose block is GRASS
263 // (vget == 1) below the snow line -- a sand world spawns no cast at all, and the framing tooth
264 // could not tell "she is standing there" from "there is nobody in this world".
265 var framed_mobs: i64 = 0 - 1
266 var framed_spawned: i64 = 0
267 if charmode == 1 {
268 let sc: *i64 = wst(base)
269 let mc: *i64 = mobp(base)
270 sc[S_PITCH] = 0
271 // ★NATIVE CAPTURE AFFORDS FULL RESOLUTION. The browser's adaptive controller trades rays for
272 // frame time; this instrument runs once, offline, so it renders at q=1. At the adaptive default
273 // the girl is ~180px of a 36,000px frame -- below the judge's 16px cell statistics -- and a
274 // subject crop of that is a handful of cells. At q=1 she is thousands of pixels: a real subject
275 // image. Announced in the WORLD-SNAP line via w=/h=, so a capture that silently fell back to the
276 // small frame is visible.
277 // ★THE SETTER MOVED OUT OF THIS BRANCH ON 2026-08-28 AND NOW SERVES EVERY PATH (see the block
278 // after the tick loop). It was correct here and absent from its two siblings -- the world path
279 // and the `gt` dataset factory -- which is a third of a fix, and the two left undone were the
280 // art-verdict path and the training-data factory. The literal "1200x750" this comment used to
281 // quote was ALSO stale: the engine ceiling has been 1920x1200 since the render cap was derived
282 // from the page's own display cap, so the number that justified the rule had drifted from the
283 // rule. Nothing is set here now, deliberately: one owner of q, not two.
284 let fxc: i64 = it_sin4096(sc[S_YAW])
285 let fzc: i64 = it_cos4096(sc[S_YAW])
286 let txc: i64 = sc[S_CX] + fxc*2*256/K_MAGIC_4096
287 let tzc: i64 = sc[S_CZ] + fzc*2*256/K_MAGIC_4096
288 let gyc: i64 = mob_ground(base, txc/256, WY-1, tzc/256)
289 framed_mobs = en_count(mc)
290 // THE PORTRAIT VERB OWNS ITS SUBJECT. If the world's own generator placed no cast, this
291 // instrument spawns exactly one and says so -- so a portrait of an EMPTY world can never be
292 // mistaken for a portrait of an inhabited one, and the figure judge is never handed scenery
293 // and asked to grade a character. A world that already has a cast is untouched: this branch
294 // cannot run there, so the behaviour of every existing caller is unchanged by construction.
295 if framed_mobs == 0 { if gyc >= 0 {
296 let hn0: i64 = en_spawn(mc)
297 if hn0 > 0 {
298 en_set(mc, hn0, MC_KIND, 0)
299 en_set(mc, hn0, MC_PH, 0)
300 en_set(mc, hn0, MC_DISG, 0)
301 en_set(mc, hn0, MC_GENE, seed % WATER_MAGIC_1048576)
302 framed_spawned = 1
303 framed_mobs = en_count(mc)
304 }
305 } }
306 // BIND THE HANDLE TO THE COUNT: over an empty store en_nth answers a handle that looks valid,
307 // which is exactly how framed=1 was published for a world with nobody in it.
308 var hc: i64 = 0
309 if framed_mobs > 0 { hc = en_nth(mc, 0) }
310 framed_gy = gyc
311 if gyc >= 0 { if hc > 0 {
312 var kc: i64 = 1
313 while kc < en_count(mc) {
314 let hk: i64 = en_nth(mc, kc)
315 if hk > 0 { en_set(mc, hk, MC_X, 256); en_set(mc, hk, MC_Z, 256) }
316 kc = kc + 1
317 }
318 en_set(mc, hc, MC_X, txc)
319 en_set(mc, hc, MC_Z, tzc)
320 en_set(mc, hc, MC_Y, (gyc+1)*256)
321 // SEAT THE CAMERA ON THE HIGHER OF THE TWO COLUMNS, NEVER BLINDLY ON THE SUBJECT'S.
322 // This line used to read `sc[S_CY] = (gyc+1)*256 + 128` -- the camera was re-seated onto the
323 // ground height of a column TWO BLOCKS AWAY. Where that column is LOWER than the one the
324 // camera stands on, the camera is planted inside its own column's top block and the subject
325 // is occluded by the terrain between them. MEASURED 2026-09-01, and it is the WHOLE of the
326 // CHAR-CROP pixels=0 defect: on craft (cam_ground 20 == subj_ground 20) the crop measures
327 // 1866 subject pixels and on vale (29 == 29) 1990, while on beach and isle -- the only two
328 // shipped worlds where the two DIFFER (12 vs 11) -- it measured exactly 0, at every q from
329 // 1 to 8. Taking the MAXIMUM is BYTE-NEUTRAL wherever they are equal, which is every world
330 // that already worked, so the fix cannot regress a capture that was already correct.
331 var seat_gy: i64 = gyc
332 let cam_gy0: i64 = mob_ground(base, sc[S_CX]/256, WY-1, sc[S_CZ]/256)
333 if cam_gy0 > seat_gy { seat_gy = cam_gy0 }
334 sc[S_CY] = (seat_gy+1)*256 + 128
335 framed = 1
336 // ATTRIBUTION FOR AN EMPTY CROP. CHAR-CROP pixels=0 says only "the two renders agree"; it
337 // cannot say WHICH conjunct of "a subject is in this picture" failed, and a bare 0 reads as
338 // "the crop is broken" when it may equally mean "she was placed somewhere the camera cannot
339 // see". These four numbers separate those: cam_ground vs subj_ground says whether the camera
340 // was re-seated onto a column two blocks away that is LOWER than the one it stands on (which
341 // buries it inside the spawn column), and subj_vz_q8 is her view-space depth in the SAME q8
342 // units mob_draw's own visibility window uses. The window itself is deliberately NOT restated
343 // here: a second copy of the engine's bounds is a duplicate ruler that drifts silently. Pitch
344 // is zero on this path by construction three lines above, so forward reduces to (sin, 0, cos).
345 let cam_gy: i64 = mob_ground(base, sc[S_CX]/256, WY-1, sc[S_CZ]/256)
346 let dqx: i64 = txc - sc[S_CX]
347 let dqz: i64 = tzc - sc[S_CZ]
348 let fvx: i64 = it_sin4096(sc[S_YAW])
349 let fvz: i64 = it_cos4096(sc[S_YAW])
350 let vzq: i64 = (dqx*fvx + dqz*fvz)/K_MAGIC_4096
351 ws2_puts("CHAR-GEOM cam_ground=" as *u8); ws2_pn(cam_gy)
352 ws2_puts(" subj_ground=" as *u8); ws2_pn(gyc)
353 ws2_puts(" cam_y_q8=" as *u8); ws2_pn(sc[S_CY])
354 ws2_puts(" subj_y_q8=" as *u8); ws2_pn((gyc+1)*256)
355 ws2_puts(" subj_vz_q8=" as *u8); ws2_pn(vzq)
356 ws2_puts("\n" as *u8)
357 } }
358 }
359 // ★BIND THE POINTER, THEN INDEX IT. `wst(base)[S_GT_KEEP] = 1` does not parse as an assignment
360 // target in this dialect -- the parser closes the expression after the postfix index and then meets
361 // a bare `=` (token kind=45, "an operator starts this expression"). MEASURED 2026-08-28: this line
362 // failed EVERY build of this organ, so the `gt` ground-truth verb could not be compiled at all and
363 // the served binary predates it. The compiler's own remedy is the one taken here, and it is the
364 // idiom this file already uses three lines up (`let sc: *i64 = wst(base)`).
365 if gtmode == 1 {
366 let gts: *i64 = wst(base)
367 gts[S_GT_KEEP] = 1
368 }
369 render_impl(base)
370 // ANNOUNCE THE FRAMING so its ABSENCE is visible in normal output -- a capture that silently fell
371 // back to the world view is exactly how a null measurement gets read as a real one.
372 if charmode == 1 {
373 ws2_puts("CHAR-FRAME framed=" as *u8); ws2_pn(framed)
374 ws2_puts(" ground_y=" as *u8); ws2_pn(framed_gy)
375 ws2_puts(" mobs=" as *u8); ws2_pn(framed_mobs)
376 ws2_puts(" spawned=" as *u8); ws2_pn(framed_spawned)
377 ws2_puts("\n" as *u8)
378 }
379 // ★SUBJECT CROP: THE DIFF *IS* THE GIRL. T63's proven recipe promoted into the capture instrument:
380 // bank the framed render, park her, render the SAME scene without her, and every differing pixel is
381 // attributable to HER -- so the crop rectangle is MEASURED, never guessed, and the frame-level judge
382 // can finally be pointed at the subject instead of at 36,000 pixels of scenery it already scored.
383 // The margin is CHJ-cell-derived at the call site (the judge's own 16px composition cell), not a
384 // taste constant. A framed=1 run with ZERO differing pixels announces pixels=0 and writes NO crop --
385 // a capture that silently fell back to scenery is exactly how a null measurement reads as a real one.
386 if charmode == 1 { if framed == 1 {
387 let cw3: i64 = wc_rw(base)
388 let ch3: i64 = wc_rh(base)
389 let np3: i64 = cw3*ch3
390 let fbm: *i64 = wfb(base)
391 let s1: *i64 = sys_mmap(np3*8) as *i64
392 var c1: i64 = 0
393 while c1 < np3 { s1[c1] = fbm[c1]; c1 = c1 + 1 }
394 // park the subject, re-render the identical scene
395 let mc2: *i64 = mobp(base)
396 let hc2: i64 = en_nth(mc2, 0)
397 en_set(mc2, hc2, MC_X, 256)
398 en_set(mc2, hc2, MC_Z, 256)
399 render_impl(base)
400 var cnt3: i64 = 0
401 var bx0: i64 = cw3
402 var bx1: i64 = 0 - 1
403 var by0: i64 = ch3
404 var by1: i64 = 0 - 1
405 var d3: i64 = 0
406 while d3 < np3 {
407 if s1[d3] != fbm[d3] {
408 cnt3 = cnt3 + 1
409 let qx: i64 = d3 % cw3
410 let qy: i64 = d3 / cw3
411 if qx < bx0 { bx0 = qx }
412 if qx > bx1 { bx1 = qx }
413 if qy < by0 { by0 = qy }
414 if qy > by1 { by1 = qy }
415 }
416 d3 = d3 + 1
417 }
418 // restore the FRAMED image into the fb so the main PNG below is the picture with her in it
419 c1 = 0
420 while c1 < np3 { fbm[c1] = s1[c1]; c1 = c1 + 1 }
421 sys_munmap(s1 as *u8, np3*8)
422 ws2_puts("CHAR-CROP pixels=" as *u8); ws2_pn(cnt3)
423 if cnt3 > 0 { if bx1 >= bx0 { if by1 >= by0 {
424 // margin = one judge composition cell (16px) of surrounding context on every side, clamped:
425 // derived from the consumer's own cell size, so the crop always hands the judge at least one
426 // ring of non-subject cells to hold composition against
427 var mx0: i64 = bx0 - 16
428 var my0: i64 = by0 - 16
429 var mx1: i64 = bx1 + 16
430 var my1: i64 = by1 + 16
431 if mx0 < 0 { mx0 = 0 }
432 if my0 < 0 { my0 = 0 }
433 if mx1 > cw3-1 { mx1 = cw3-1 }
434 if my1 > ch3-1 { my1 = ch3-1 }
435 let ww4: i64 = mx1 - mx0 + 1
436 let hh4: i64 = my1 - my0 + 1
437 let fillb: i64 = (bx1-bx0+1)*(by1-by0+1)
438 var fillp3: i64 = 0
439 if fillb > 0 { fillp3 = cnt3*1000/fillb }
440 ws2_puts(" bbox=" as *u8); ws2_pn(bx0); ws2_puts("," as *u8); ws2_pn(by0)
441 ws2_puts("," as *u8); ws2_pn(bx1); ws2_puts("," as *u8); ws2_pn(by1)
442 ws2_puts(" fill_permil=" as *u8); ws2_pn(fillp3)
443 // crop path = <out>.crop.png -- a derived sibling, so one capture yields the pair the two
444 // judges need: the frame for scene teeth, the crop for FIGURE quality
445 let cpath: *u8 = sys_mmap(512)
446 var co: i64 = 0
447 while outp[co] != (0 as u8) { cpath[co] = outp[co]; co = co + 1 }
448 let csfx: *u8 = ".crop.png" as *u8
449 var cs2: i64 = 0
450 while csfx[cs2] != (0 as u8) { cpath[co+cs2] = csfx[cs2]; cs2 = cs2 + 1 }
451 cpath[co+cs2] = 0 as u8
452 let crgb: *u8 = sys_mmap(ww4*hh4*3 + 16)
453 var ry: i64 = 0
454 while ry < hh4 {
455 var rx2: i64 = 0
456 while rx2 < ww4 {
457 let spx: i64 = fbm[(my0+ry)*cw3 + mx0+rx2]
458 let di: i64 = (ry*ww4 + rx2)*3
459 crgb[di] = (spx % 256) as u8
460 crgb[di+1] = ((spx/256) % 256) as u8
461 crgb[di+2] = ((spx/K_MAGIC_65536) % 256) as u8
462 rx2 = rx2 + 1
463 }
464 ry = ry + 1
465 }
466 nx_png_write_rgb(cpath, crgb, ww4, hh4)
467 sys_munmap(crgb, ww4*hh4*3 + 16)
468 ws2_puts(" crop=" as *u8); ws2_pn(ww4); ws2_puts("x" as *u8); ws2_pn(hh4)
469 ws2_puts(" wrote=" as *u8); ws2_puts(cpath)
470 } } }
471 ws2_puts("\n" as *u8)
472 } }
473 // ★READ THE EXTENT OF THE ARENA THIS ORGAN ACTUALLY RENDERED, NOT ARENA 0. ww()/hh() are the wasm
474 // export surface and are hardwired to arena 0 -- wc_rw(0)/wc_rh(0) -- while every render above goes
475 // into `base`, a fresh mmap this organ never registered as arena 0. The two agreed by luck; when they
476 // stopped agreeing the RGB loop below walked W*H words over a framebuffer of a different size and the
477 // process took SIGSEGV at an address ~1.15 MB out of range. MEASURED 2026-08-15: a full revert of this
478 // organ did NOT fix it, which is what proved the fault was the ARENA MISMATCH and not the change on
479 // top of it -- an unrelated edit to the craft module shifted arena 0's contents and turned a latent
480 // wrong-subject read into a fatal one.
481 // wc_rw/wc_rh take the base precisely so this cannot happen; the gate's own T58 already measures the
482 // written extent that way.
483 let W: i64 = wc_rw(base)
484 let H: i64 = wc_rh(base)
485 let fb: *i64 = wfb(base)
486 let rgb: *u8 = sys_mmap(W*H*3 + 16)
487 var p: i64 = 0
488 while p < W*H {
489 let px: i64 = fb[p]
490 rgb[p*3] = (px % 256) as u8
491 rgb[p*3+1] = ((px/256) % 256) as u8
492 rgb[p*3+2] = ((px/K_MAGIC_65536) % 256) as u8
493 p = p + 1
494 }
495 nx_png_write_rgb(outp, rgb, W, H)
496 if gtmode == 1 {
497 // DEPTH CHANNEL: bits 32..55 of every framebuffer word (FB_DEPTH_SHIFT/FB_DEPTH_MAX are the
498 // engine's own names). Sky/miss rays carry FB_DEPTH_MAX. Two artifacts per channel: a PNG for eyes
499 // (8-bit gray = depth >> 16, near bright) and a raw little-endian u16 plane (.d16) with the exact
500 // 24->16 clamped values, W*H*2 bytes, no header -- the dataset consumer reads W,H from the announce.
501 let dp: *i64 = sys_mmap(W*H*8 + 16) as *i64
502 var gq: i64 = 0
503 var gmin: i64 = FB_DEPTH_MAX
504 var gmax: i64 = 0
505 var ghit: i64 = 0
506 while gq < W*H {
507 let d24: i64 = (fb[gq] / (K_MAGIC_65536*K_MAGIC_65536)) & FB_DEPTH_MAX
508 dp[gq] = d24
509 if d24 < FB_DEPTH_MAX { ghit = ghit + 1; if d24 < gmin { gmin = d24 } if d24 > gmax { gmax = d24 } }
510 gq = gq + 1
511 }
512 // depth PNG (gray) + raw u16
513 let dpng: *u8 = sys_mmap(W*H*3 + 16)
514 let d16: *u8 = sys_mmap(W*H*2 + 16)
515 gq = 0
516 while gq < W*H {
517 var d16v: i64 = dp[gq] / 256
518 if d16v > WS_D16_MAX { d16v = WS_D16_MAX }
519 let inv: i64 = WS_D16_MAX - d16v
520 let g8: i64 = inv / 256
521 dpng[gq*3] = g8 as u8; dpng[gq*3+1] = g8 as u8; dpng[gq*3+2] = g8 as u8
522 d16[gq*2] = (d16v % 256) as u8; d16[gq*2+1] = (d16v / 256) as u8
523 gq = gq + 1
524 }
525 let dpp: *u8 = sys_mmap(512)
526 var dq: i64 = 0
527 while outp[dq] != (0 as u8) { dpp[dq] = outp[dq]; dq = dq + 1 }
528 var dsx: *u8 = ".depth.png" as *u8
529 var dq2: i64 = 0
530 while dsx[dq2] != (0 as u8) { dpp[dq+dq2] = dsx[dq2]; dq2 = dq2 + 1 }
531 dpp[dq+dq2] = 0 as u8
532 nx_png_write_rgb(dpp, dpng, W, H)
533 ws2_puts("GT-DEPTH wrote=" as *u8); ws2_puts(dpp)
534 ws2_puts(" hits=" as *u8); ws2_pn(ghit); ws2_puts(" of=" as *u8); ws2_pn(W*H)
535 ws2_puts(" dmin=" as *u8); ws2_pn(gmin); ws2_puts(" dmax=" as *u8); ws2_pn(gmax); ws2_puts("\n" as *u8)
536 dsx = ".d16" as *u8
537 dq2 = 0
538 while dsx[dq2] != (0 as u8) { dpp[dq+dq2] = dsx[dq2]; dq2 = dq2 + 1 }
539 dpp[dq+dq2] = 0 as u8
540 let dfd: i64 = sys_openat_wr(dpp, K_MODE_RW)
541 if dfd >= 0 { sys_write(dfd, d16, W*H*2); sys_close(dfd); ws2_puts("GT-D16 wrote=" as *u8); ws2_puts(dpp); ws2_puts(" bytes=" as *u8); ws2_pn(W*H*2); ws2_puts(" w=" as *u8); ws2_pn(W); ws2_puts(" h=" as *u8); ws2_pn(H); ws2_puts("\n" as *u8) }
542 // NORMAL CHANNEL, DERIVED FROM DEPTH: central differences on the depth plane, n = normalize(-dx, -dy, k),
543 // integer, encoded (n+1)*127. Miss rays get the flat (128,128,255). Labeled DERIVED in the announce.
544 let npng: *u8 = sys_mmap(W*H*3 + 16)
545 var ny: i64 = 0
546 while ny < H {
547 var nx: i64 = 0
548 while nx < W {
549 let ci: i64 = ny*W + nx
550 var r8: i64 = 128
551 var g8b: i64 = 128
552 var b8: i64 = 255
553 if dp[ci] < FB_DEPTH_MAX {
554 var xl: i64 = nx - 1
555 var xr: i64 = nx + 1
556 var yu: i64 = ny - 1
557 var yd: i64 = ny + 1
558 if xl < 0 { xl = 0 }
559 if xr >= W { xr = W - 1 }
560 if yu < 0 { yu = 0 }
561 if yd >= H { yd = H - 1 }
562 var dxv: i64 = dp[ny*W + xr] - dp[ny*W + xl]
563 var dyv: i64 = dp[yd*W + nx] - dp[yu*W + nx]
564 // a miss neighbour would inject a cliff; clamp gradient at the object edge
565 if dp[ny*W + xr] >= FB_DEPTH_MAX { dxv = 0 }
566 if dp[ny*W + xl] >= FB_DEPTH_MAX { dxv = 0 }
567 if dp[yd*W + nx] >= FB_DEPTH_MAX { dyv = 0 }
568 if dp[yu*W + nx] >= FB_DEPTH_MAX { dyv = 0 }
569 // scale: depth units per pixel step -- k = 2 pixel-steps in depth units at this
570 // resolution; derived from the frame width so it does not drift with q
571 let kz: i64 = 2 * (FB_DEPTH_MAX / (W * 4))
572 var ax: i64 = 0 - dxv
573 var ay: i64 = 0 - dyv
574 var az: i64 = kz
575 // integer normalize via isqrt
576 let m2: i64 = ax*ax + ay*ay + az*az
577 var m: i64 = 1
578 if m2 > 1 { var lo: i64 = 1; var hi: i64 = m2; if hi > WS_ISQRT_HI_BOUND { hi = WS_ISQRT_HI_BOUND } while lo < hi { let mid: i64 = (lo + hi + 1) / 2; if mid*mid <= m2 { lo = mid } else { hi = mid - 1 } } m = lo }
579 if m < 1 { m = 1 }
580 r8 = 128 + ax*127/m
581 g8b = 128 + ay*127/m
582 b8 = 128 + az*127/m
583 if r8 < 0 { r8 = 0 } if r8 > 255 { r8 = 255 }
584 if g8b < 0 { g8b = 0 } if g8b > 255 { g8b = 255 }
585 if b8 < 0 { b8 = 0 } if b8 > 255 { b8 = 255 }
586 }
587 npng[ci*3] = r8 as u8; npng[ci*3+1] = g8b as u8; npng[ci*3+2] = b8 as u8
588 nx = nx + 1
589 }
590 ny = ny + 1
591 }
592 dsx = ".normal.png" as *u8
593 dq2 = 0
594 while dsx[dq2] != (0 as u8) { dpp[dq+dq2] = dsx[dq2]; dq2 = dq2 + 1 }
595 dpp[dq+dq2] = 0 as u8
596 nx_png_write_rgb(dpp, npng, W, H)
597 ws2_puts("GT-NORMAL wrote=" as *u8); ws2_puts(dpp); ws2_puts(" derived=from-depth-gradient\n" as *u8)
598 }
599 // ALSO emit NXFH1 text-hex beside the PNG so nx_frame_score (the game-frame art critic)
600 // can judge the same frame -- one capture, two judges (debt 1786578438 second opinion)
601 let fhp: *u8 = sys_mmap(512)
602 var fq: i64 = 0
603 let a1: *u8 = outp
604 while a1[fq] != (0 as u8) { fhp[fq] = a1[fq]; fq = fq + 1 }
605 let sfx: *u8 = ".nxfh" as *u8
606 var fq2: i64 = 0
607 while sfx[fq2] != (0 as u8) { fhp[fq+fq2] = sfx[fq2]; fq2 = fq2 + 1 }
608 fhp[fq+fq2] = 0 as u8
609 // COMPOSE THE CODEC, DO NOT RE-TYPE IT. This block used to be a hand-rolled NXFH1 writer -- header,
610 // decimal width/height, a 16-byte hex table and the row-end newline -- sitting beside
611 // _hdl_build/nx_nxfh_lib.nx's nxl_dump(path, fb, w, h), which is the estate's ONE owner of that
612 // format and does exactly this. Two writers for one format is the duplicate-ruler defect: the day
613 // the format gains a field, one of them gets it. The fb layout already matched (packed
614 // r | g<<8 | b<<16, compact at stride w), so the swap is a pure composition, and NEUTRALITY IS
615 // PROVEN RATHER THAN ASSERTED -- the emitted .nxfh is byte-identical before and after, hashed both
616 // sides. The writer's return is ANNOUNCED so a failed open is visible in normal output instead of
617 // being swallowed by an `if fd >= 0` with no else.
618 let fhn: i64 = nxl_dump(fhp, fb, W, H)
619 ws2_puts("SNAP-NXFH bytes=" as *u8); ws2_pn(fhn)
620 ws2_puts(" wrote=" as *u8); ws2_puts(fhp); ws2_puts("\n" as *u8)
621 // PERCEPT ANCHOR CAPTURE -- the second consumer this instrument could not reach. nx_frame_score
622 // eats any size; nx_percept compares against a corpus that is 400x240 in every anchor, so a native
623 // capture was scoreable but NOT COMPARABLE. This emits the same frame at the anchor geometry.
624 // THE FACTOR IS DERIVED, NOT RESAMPLED: pk is the largest integer with 400*pk <= W and 240*pk <= H
625 // (here 4, because 5 would need 2000 columns of a 1920-column frame), so the reduction is an exact
626 // pk x pk BOX AVERAGE over a centred 400*pk x 240*pk crop. Two consequences, both deliberate:
627 // there is no interpolation kernel to choose, and the ASPECT IS NEVER SQUASHED -- the crop is taken
628 // at the anchor's own aspect first. A straight rescale of 8:5 into 5:3 would distort every contour
629 // the perceptual judge measures, which is the measure-the-wrong-subject defect wearing a resize.
630 // The crop rectangle and the factor are ANNOUNCED so a reader can tell what was thrown away.
631 if perceptmode == 1 {
632 var pcpk: i64 = W/WS_PERCEPT_W
633 if H/WS_PERCEPT_H < pcpk { pcpk = H/WS_PERCEPT_H }
634 if pcpk < 1 {
635 // A NAMED ABSENCE, NEVER A SILENT SKIP: a frame smaller than the anchor cannot be reduced
636 // to it without inventing pixels, and inventing them would hand the judge a fabrication.
637 ws2_puts("PERCEPT REFUSED render=" as *u8); ws2_pn(W); ws2_puts("x" as *u8); ws2_pn(H)
638 ws2_puts(" anchor=" as *u8); ws2_pn(WS_PERCEPT_W); ws2_puts("x" as *u8); ws2_pn(WS_PERCEPT_H)
639 ws2_puts(" -- the render is smaller than the anchor; upscaling would invent pixels\n" as *u8)
640 } else {
641 let pccw: i64 = WS_PERCEPT_W*pcpk
642 let pcch: i64 = WS_PERCEPT_H*pcpk
643 let pcox: i64 = (W - pccw)/2
644 let pcoy: i64 = (H - pcch)/2
645 let pcn: i64 = pcpk*pcpk
646 let pcfb: *i64 = sys_mmap(WS_PERCEPT_W*WS_PERCEPT_H*8) as *i64
647 let pcrgb: *u8 = sys_mmap(WS_PERCEPT_W*WS_PERCEPT_H*3 + 16)
648 var pcy: i64 = 0
649 while pcy < WS_PERCEPT_H {
650 var pcx: i64 = 0
651 while pcx < WS_PERCEPT_W {
652 var pcsr: i64 = 0
653 var pcsg: i64 = 0
654 var pcsb: i64 = 0
655 var pcby: i64 = 0
656 while pcby < pcpk {
657 var pcbx: i64 = 0
658 while pcbx < pcpk {
659 let pcsi: i64 = ((pcoy + pcy*pcpk + pcby)*W + pcox + pcx*pcpk + pcbx)*3
660 pcsr = pcsr + (rgb[pcsi] as i64)
661 pcsg = pcsg + (rgb[pcsi+1] as i64)
662 pcsb = pcsb + (rgb[pcsi+2] as i64)
663 pcbx = pcbx + 1
664 }
665 pcby = pcby + 1
666 }
667 let pcr: i64 = pcsr/pcn
668 let pcg: i64 = pcsg/pcn
669 let pcb: i64 = pcsb/pcn
670 let pcdi: i64 = (pcy*WS_PERCEPT_W + pcx)*3
671 pcrgb[pcdi] = pcr as u8
672 pcrgb[pcdi+1] = pcg as u8
673 pcrgb[pcdi+2] = pcb as u8
674 pcfb[pcy*WS_PERCEPT_W + pcx] = pcr + pcg*256 + pcb*K_MAGIC_65536
675 pcx = pcx + 1
676 }
677 pcy = pcy + 1
678 }
679 let pcpp: *u8 = sys_mmap(512)
680 var pcq: i64 = 0
681 while outp[pcq] != (0 as u8) { pcpp[pcq] = outp[pcq]; pcq = pcq + 1 }
682 let pcsx: *u8 = ".percept.png" as *u8
683 var pcq2: i64 = 0
684 while pcsx[pcq2] != (0 as u8) { pcpp[pcq+pcq2] = pcsx[pcq2]; pcq2 = pcq2 + 1 }
685 pcpp[pcq+pcq2] = 0 as u8
686 nx_png_write_rgb(pcpp, pcrgb, WS_PERCEPT_W, WS_PERCEPT_H)
687 let pcnp: *u8 = sys_mmap(512)
688 pcq = 0
689 while outp[pcq] != (0 as u8) { pcnp[pcq] = outp[pcq]; pcq = pcq + 1 }
690 let pcnx: *u8 = ".percept.nxfh" as *u8
691 pcq2 = 0
692 while pcnx[pcq2] != (0 as u8) { pcnp[pcq+pcq2] = pcnx[pcq2]; pcq2 = pcq2 + 1 }
693 pcnp[pcq+pcq2] = 0 as u8
694 let pcnb: i64 = nxl_dump(pcnp, pcfb, WS_PERCEPT_W, WS_PERCEPT_H)
695 ws2_puts("PERCEPT anchor=" as *u8); ws2_pn(WS_PERCEPT_W); ws2_puts("x" as *u8); ws2_pn(WS_PERCEPT_H)
696 ws2_puts(" factor=" as *u8); ws2_pn(pcpk)
697 ws2_puts(" crop=" as *u8); ws2_pn(pccw); ws2_puts("x" as *u8); ws2_pn(pcch)
698 ws2_puts("+" as *u8); ws2_pn(pcox); ws2_puts("+" as *u8); ws2_pn(pcoy)
699 ws2_puts(" nxfh_bytes=" as *u8); ws2_pn(pcnb)
700 ws2_puts(" wrote=" as *u8); ws2_puts(pcpp); ws2_puts(" " as *u8); ws2_puts(pcnp)
701 ws2_puts("\n" as *u8)
702 }
703 }
704 // readback: the FILE is the claim, never the writer's return
705 let lp: *i64 = sys_mmap(16) as *i64
706 let rb: *u8 = sys_read_file(outp, lp)
707 if (rb as i64) == 0 { ws2_puts("SNAP-FAIL: png not written\n" as *u8); return 5 }
708 ws2_puts("WORLD-SNAP v=" as *u8); ws2_pn(v)
709 ws2_puts(" seed=" as *u8); ws2_pn(seed)
710 ws2_puts(" ticks=" as *u8); ws2_pn(ticks)
711 ws2_puts(" style_applied=" as *u8); ws2_pn(applied)
712 ws2_puts(" gen_applied=" as *u8); ws2_pn(wst(base)[S_GENP])
713 ws2_puts(" w=" as *u8); ws2_pn(W)
714 ws2_puts(" h=" as *u8); ws2_pn(H)
715 // ★EVERY CAPTURE DECLARES ITS RESOLUTION AS A FRACTION OF THE PRODUCT'S OWN NATIVE RESOLUTION.
716 // w=/h= alone cannot answer "is this full resolution?" -- that question needs the ceiling beside the
717 // measurement, and the ceiling lives in the engine, not in the reader's head. res_permil is DERIVED
718 // from the two extents at emit time and res_class is derived from res_permil, so neither can agree
719 // with a flag while disagreeing with the pixels. This is the field the capture-resolution gate reads:
720 // a verdict built on a capture below the declared product resolution is refusable BECAUSE the
721 // capture said so itself.
722 ws2_puts(" q=" as *u8); ws2_pn(qsel)
723 ws2_puts(" native_w=" as *u8); ws2_pn(ws2_natw())
724 ws2_puts(" native_h=" as *u8); ws2_pn(ws2_nath())
725 let ws_natpx: i64 = ws2_natw()*ws2_nath()
726 var ws_permil: i64 = 0
727 if ws_natpx > 0 { ws_permil = W*H*WS_PERMIL/ws_natpx }
728 ws2_puts(" res_permil=" as *u8); ws2_pn(ws_permil)
729 ws2_puts(" res_class=" as *u8)
730 if ws_permil >= WS_PERMIL { ws2_puts("FULL" as *u8) } else { ws2_puts("REDUCED" as *u8) }
731 ws2_puts(" skytop_rgb=" as *u8); ws2_pn(fb[0] % 256)
732 ws2_puts("," as *u8); ws2_pn((fb[0]/256) % 256)
733 ws2_puts("," as *u8); ws2_pn((fb[0]/K_MAGIC_65536) % 256)
734 ws2_puts(" png_bytes=" as *u8); ws2_pn(lp[0])
735 ws2_puts("\n" as *u8)
736 return 0
737}