Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/native/omega/allen/tests/look-night.om # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / omega / allen / tests / look-night.om` 104 lines ยท 1650 bytes Raw Blame History 1 global Tb uchar `4194304` 2 global Tn ulong 1 3 fn tflush to void 4 n = ulong 0 5 while lt n get Tn 0 6 w = write 1 Tb n sub get Tn 0 n 7 if le w 0 8 ret 9 end 10 n = add n ulong w 11 end 12 put Tn 0 0 13 end 14 fn tc c uchar to void 15 if ge get Tn 0 `4194000` 16 tflush 17 end 18 put Tb get Tn 0 c 19 put Tn 0 add get Tn 0 1 20 end 21 fn tu v ulong to void 22 if ge v 10 23 tu div v 10 24 end 25 tc uchar add 48 rem v 10 26 end 27 fn tl v long to void 28 if lt v 0 29 tc 45 30 tu bitcast ulong neg v 31 ret 32 end 33 tu ulong v 34 end 35 fn tnl to void 36 tc 10 37 end 38 note tests/look-night.om: argv W H T [shim voice]; writes Nfrm after ntinit, ntat T, ntbase, ntlights as P6 to fd 1, 39 note ntbase and ntlights microseconds to fd 2. Compare with cref2 oracle W H T 6 (host-only). 40 note Unit: font-data font look-paint look-skydata look-sky look-night + this file. 41 global Dargs uchar 32 42 fn darg i ulong to long 43 n = argread i Dargs 0 32 44 v = long 0 45 for k ulong ulong n 46 v = add mul v 10 long sub get Dargs k 48 47 end 48 ret v 49 end 50 fn dppm to void 51 w = ulong get Lg 0 52 h = ulong get Lg 1 53 tc 80 54 tc 54 55 tnl 56 tu w 57 tc 32 58 tu h 59 tnl 60 tu 255 61 tnl 62 for y ulong h 63 for x ulong w 64 c = ulong get Nfrm add mul y w x 65 tc uchar and shr c 16 255 66 tc uchar and shr c 8 255 67 tc uchar and c 255 68 end 69 end 70 tflush 71 end 72 fn main to int 73 w = darg 1 74 h = darg 2 75 t = ulong darg 3 76 put Lg 0 w 77 put Lg 1 h 78 put Lg 2 pkmin div mul w 256 1920 div mul h 256 1080 79 put Lg 3 div w 2 80 put Lg 4 div mul h 40 100 81 pkinit 82 pkclip 0 0 w h 83 ntinit 84 ntat t 85 t0 = monons 86 ntbase 0 0 w h 87 t1 = monons 88 sh = ulong 0 89 vo = ulong 0 90 if gt argcnt 5 91 sh = ulong darg 4 92 vo = ulong darg 5 93 end 94 ntlights 0 0 w h sh vo 95 t2 = monons 96 dppm 97 put Tn 0 0 98 tu ulong div sub t1 t0 1000 99 tc 32 100 tu ulong div sub t2 t1 1000 101 tnl 102 n = write 2 Tb 0 get Tn 0 103 ret 0 104 end