interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / omega / allen / tests / font-render.om

79 lines · 1446 bytes Raw Blame History
1note Actual native 768x384 printable-ASCII specimen; no image generator.
2note Uses the shared bounded RGB surface storage.
3global Fpose long 2
4text Fontppm "P6\n768 384\n255\n"
5fn fblend bg ulong fg ulong a ulong to uchar
6n = mul bg sub ulong 255 a
7n = add n mul fg a
8ret uchar div n 255
9end
10fn fpixel x long y long a uchar to void
11if or lt x 0 ge x 768
12ret
13end
14if or lt y 0 ge y 384
15ret
16end
17at = mul add mul ulong y 768 ulong x 3
18alpha = ulong a
19put Canvas at fblend 6 236 alpha
20put Canvas add at 1 fblend 8 240 alpha
21put Canvas add at 2 fblend 18 252 alpha
22end
23fn frow yy ulong to void
24y = add get Fpose 1 long yy
25at = mul yy get Af 3
26for x ulong get Af 3
27px = add get Fpose 0 long x
28a = get Alpha add at x
29fpixel px y a
30end
31end
32fn fdraw px long py long to void
33put Fpose 0 add px get Ab 0
34put Fpose 1 add py get Ab 1
35for y ulong get Af 4
36frow y
37end
38end
39fn foutput to bool
40p = ulong 0
41while lt p len Fontppm
42n = write 1 Fontppm p sub len Fontppm p
43if le n 0
44ret false
45end
46p = add p ulong n
47end
48p = 0
49while lt p len Canvas
50n = write 1 Canvas p sub len Canvas p
51if le n 0
52ret false
53end
54p = add p ulong n
55end
56ret true
57end
58fn main to int
59if not afinit 30 1250
60ret 1
61end
62for i ulong mul ulong 768 384
63put Canvas mul i 3 6
64put Canvas add mul i 3 1 8
65put Canvas add mul i 3 2 18
66end
67for i ulong 95
68if not afglyph uchar add i 32
69ret 1
70end
71x = long add mul rem i 16 48 8
72y = long add mul div i 16 64 45
73fdraw x y
74end
75if not foutput
76ret 74
77end
78ret 0
79end