interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / aienux / allen / tests / look-night.om

104 lines · 1650 bytes Raw Blame History
1global Tb uchar 4194304
2global Tn ulong 1
3fn tflush to void
4n = ulong 0
5while lt n get Tn 0
6w = write 1 Tb n sub get Tn 0 n
7if le w 0
8ret
9end
10n = add n ulong w
11end
12put Tn 0 0
13end
14fn tc c uchar to void
15if ge get Tn 0 4194000
16tflush
17end
18put Tb get Tn 0 c
19put Tn 0 add get Tn 0 1
20end
21fn tu v ulong to void
22if ge v 10
23tu div v 10
24end
25tc uchar add 48 rem v 10
26end
27fn tl v long to void
28if lt v 0
29tc 45
30tu bitcast ulong neg v
31ret
32end
33tu ulong v
34end
35fn tnl to void
36tc 10
37end
38note tests/look-night.om: argv W H T [shim voice]; writes Nfrm after ntinit, ntat T, ntbase, ntlights as P6 to fd 1,
39note ntbase and ntlights microseconds to fd 2. Compare with cref2 oracle W H T 6 (host-only).
40note Unit: font-data font look-paint look-skydata look-sky look-night + this file.
41global Dargs uchar 32
42fn darg i ulong to long
43n = argread i Dargs 0 32
44v = long 0
45for k ulong ulong n
46v = add mul v 10 long sub get Dargs k 48
47end
48ret v
49end
50fn dppm to void
51w = ulong get Lg 0
52h = ulong get Lg 1
53tc 80
54tc 54
55tnl
56tu w
57tc 32
58tu h
59tnl
60tu 255
61tnl
62for y ulong h
63for x ulong w
64c = ulong get Nfrm add mul y w x
65tc uchar and shr c 16 255
66tc uchar and shr c 8 255
67tc uchar and c 255
68end
69end
70tflush
71end
72fn main to int
73w = darg 1
74h = darg 2
75t = ulong darg 3
76put Lg 0 w
77put Lg 1 h
78put Lg 2 pkmin div mul w 256 1920 div mul h 256 1080
79put Lg 3 div w 2
80put Lg 4 div mul h 40 100
81pkinit
82pkclip 0 0 w h
83ntinit
84ntat t
85t0 = monons
86ntbase 0 0 w h
87t1 = monons
88sh = ulong 0
89vo = ulong 0
90if gt argcnt 5
91sh = ulong darg 4
92vo = ulong darg 5
93end
94ntlights 0 0 w h sh vo
95t2 = monons
96dppm
97put Tn 0 0
98tu ulong div sub t1 t0 1000
99tc 32
100tu ulong div sub t2 t1 1000
101tnl
102n = write 2 Tb 0 get Tn 0
103ret 0
104end