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/surface-render.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 / surface-render.om` 128 lines ยท 2093 bytes Raw Blame History 1 note Native provider-to-pixels fixture. Reply is a labeled test input, not live inference. 2 note The surface draws into the native frame Nfrm; the frame is 768 x 384 (scale 1) over night. 3 text Cvppm "P6\n768 384\n255\n" 4 text Cvask "hello" 5 text Cvanswer "SAY 1 1/1 note: Hello, Drake. | This text was drawn in Omega." 6 global Svrow uchar 2304 7 fn svnight to void 8 put Lg 0 768 9 put Lg 1 384 10 for i ulong 294912 11 put Nfrm i 395282 12 end 13 end 14 fn svrow y ulong to bool 15 for x ulong 768 16 v = ulong get Nfrm add mul y 768 x 17 put Svrow mul x 3 uchar and shr v 16 255 18 put Svrow add mul x 3 1 uchar and shr v 8 255 19 put Svrow add mul x 3 2 uchar and v 255 20 end 21 p = ulong 0 22 while lt p 2304 23 n = write 1 Svrow p sub 2304 p 24 if le n 0 25 ret false 26 end 27 p = add p ulong n 28 end 29 ret true 30 end 31 fn svword off ulong v ulong to void 32 for i ulong 8 33 put Ph add off i uchar and shr v mul i 8 255 34 end 35 end 36 fn svframe op ulong now ulong arg ulong size ulong to void 37 for i ulong 8 38 put Ph i get Prmagic i 39 end 40 svword 8 op 41 svword 16 now 42 svword 24 arg 43 svword 32 size 44 end 45 fn svsize beg ulong to ulong 46 if ge beg len Dtext 47 ret 0 48 end 49 n = ulong 0 50 while lt add beg n len Dtext 51 if eq get Dtext add beg n 0 52 ret n 53 end 54 n = add n 1 55 end 56 ret 0 57 end 58 fn svout to bool 59 p = ulong 0 60 while lt p len Cvppm 61 n = write 1 Cvppm p sub len Cvppm p 62 if le n 0 63 ret false 64 end 65 p = add p ulong n 66 end 67 for y ulong 384 68 if not svrow y 69 ret false 70 end 71 end 72 ret true 73 end 74 fn main to int 75 svframe 1 0 77 0 76 if not prdo 77 ret 1 78 end 79 for i ulong len Cvask 80 put Pb i get Cvask i 81 end 82 svframe 2 1 0 len Cvask 83 if not prdo 84 ret 2 85 end 86 for i ulong len Cvanswer 87 put In i get Cvanswer i 88 end 89 put Inlen 0 len Cvanswer 90 if not packet 2 get Q 1 1 0 0 91 ret 3 92 end 93 for i ulong get Outlen 0 94 put Pb i get Outb i 95 end 96 svframe 5 2 0 get Outlen 0 97 if not prdo 98 ret 4 99 end 100 if or ne get Dm 0 1 ne get Ds 3 1 101 ret 5 102 end 103 if or ne get Dt 0 1 ne get Dt 6 2 104 ret 6 105 end 106 svnight 107 if not cvinit 768 384 108 ret 7 109 end 110 if not afinit 30 1250 111 ret 8 112 end 113 a = get Dt 7 114 if not cvspan a svsize a 48 166 `15528188` 115 ret 9 116 end 117 if not afinit 18 900 118 ret 10 119 end 120 a = get Dt 8 121 if not cvspan a svsize a 48 210 `13161215` 122 ret 11 123 end 124 if not svout 125 ret 74 126 end 127 ret 0 128 end