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 / runtime.om

145 lines · 2348 bytes Raw Blame History
1note R: seq, active, kind (1 chat 2 code 3 more), asked, heard, slow,
2note code-visible, prompt length, answer length, history count, session.
3global R ulong 16
4global Prompt uchar 160
5global Answer uchar 160
6global Hist uchar 5120
7global Hlen ulong 32
8text Ack "I need to code that. Let me send it off to the Spark."
9text Ackmore "Let me take that change to the Spark."
10fn textok to bool
11n = get Inlen 0
12if or eq n 0 gt n 159
13ret false
14end
15for i ulong n
16c = get In i
17if or lt c 32 gt c 126
18ret false
19end
20end
21ret true
22end
23fn histadd which ulong to void
24n = get R 9
25if eq n 32
26for i ulong 4960
27put Hist i get Hist add i 160
28end
29for i ulong 31
30put Hlen i get Hlen add i 1
31end
32n = 31
33end
34size = get R add which 7
35for i ulong size
36if eq which 0
37put Hist add mul n 160 i get Prompt i
38else
39put Hist add mul n 160 i get Answer i
40end
41end
42put Hlen n size
43put R 9 add n 1
44end
45fn start kind ulong now ulong to bool
46if or ne get R 1 0 ge get R 0 4294967295
47ret false
48end
49if or lt kind 1 gt kind 3
50ret false
51end
52if and eq kind 3 eq get R 6 0
53ret false
54end
55if not textok
56ret false
57end
58for i ulong get Inlen 0
59put Prompt i get In i
60end
61put R 7 get Inlen 0
62put R 0 add get R 0 1
63put R 1 1
64put R 2 kind
65put R 3 now
66put R 4 now
67put R 5 0
68put R 8 0
69put R 11 0
70put R 13 0
71if eq kind 2
72for i ulong len Ack
73put Answer i get Ack i
74end
75put R 8 len Ack
76end
77if eq kind 3
78for i ulong len Ackmore
79put Answer i get Ackmore i
80end
81put R 8 len Ackmore
82end
83histadd 0
84ret true
85end
86fn answer seq ulong now ulong to bool
87if or eq get R 1 0 ne seq get R 0
88ret false
89end
90if or lt now get R 4 not textok
91ret false
92end
93for i ulong get Inlen 0
94put Answer i get In i
95end
96put R 8 get Inlen 0
97put R 4 now
98put R 1 0
99histadd 1
100ret true
101end
102fn cancel to void
103put R 1 0
104end
105fn heard seq ulong now ulong to bool
106if or eq get R 1 0 ne seq get R 0
107ret false
108end
109if lt now get R 4
110ret false
111end
112put R 4 now
113ret true
114end
115fn tick now ulong to ulong
116if or eq get R 1 0 lt now get R 4
117ret 0
118end
119if ge sub now get R 4 30000
120cancel
121ret 2
122end
123if and eq get R 5 0 ge sub now get R 3 20000
124put R 5 1
125ret 1
126end
127ret 0
128end
129fn reset to void
130for i ulong 9
131put R add i 1 0
132end
133end
134note Restore one externally decoded transcript line. No live job or ID reuse.
135fn restore to bool
136if or ne get R 1 0 not textok
137ret false
138end
139for i ulong get Inlen 0
140put Answer i get In i
141end
142put R 8 get Inlen 0
143histadd 1
144ret true
145end