aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / omega / allen / tests / font-output.om
| 1 | note Native glyph stream for byte comparison with the external legacy oracle. |
| 2 | fn afword v ulong to void |
| 3 | for i ulong 8 |
| 4 | emitb uchar and shr v mul i 8 255 |
| 5 | end |
| 6 | end |
| 7 | fn afsigned v long to void |
| 8 | if lt v 0 |
| 9 | afword xor ulong 18446744073709551615 ulong sub neg v 1 |
| 10 | else |
| 11 | afword ulong v |
| 12 | end |
| 13 | end |
| 14 | fn afhead to bool |
| 15 | p = ulong 0 |
| 16 | while lt p get Outlen 0 |
| 17 | n = write 1 Outb p sub get Outlen 0 p |
| 18 | if le n 0 |
| 19 | ret false |
| 20 | end |
| 21 | p = add p ulong n |
| 22 | end |
| 23 | ret true |
| 24 | end |
| 25 | fn afemit cap ulong wt ulong c uchar to bool |
| 26 | if not afglyph c |
| 27 | ret false |
| 28 | end |
| 29 | outreset |
| 30 | afword cap |
| 31 | afword wt |
| 32 | afword ulong c |
| 33 | afword get Af 3 |
| 34 | afword get Af 4 |
| 35 | afsigned get Ab 0 |
| 36 | afsigned get Ab 1 |
| 37 | afword get Af 5 |
| 38 | if not afhead |
| 39 | ret false |
| 40 | end |
| 41 | size = mul get Af 3 get Af 4 |
| 42 | p = ulong 0 |
| 43 | while lt p size |
| 44 | n = write 1 Alpha p sub size p |
| 45 | if le n 0 |
| 46 | ret false |
| 47 | end |
| 48 | p = add p ulong n |
| 49 | end |
| 50 | ret true |
| 51 | end |
| 52 | fn main to int |
| 53 | for mode ulong 3 |
| 54 | cap = ulong 14 |
| 55 | wt = ulong 900 |
| 56 | if eq mode 1 |
| 57 | cap = 30 |
| 58 | wt = 1250 |
| 59 | end |
| 60 | if eq mode 2 |
| 61 | cap = 64 |
| 62 | wt = 2500 |
| 63 | end |
| 64 | if not afinit cap wt |
| 65 | ret 1 |
| 66 | end |
| 67 | for i ulong 95 |
| 68 | if not afemit cap wt uchar add i 32 |
| 69 | ret 1 |
| 70 | end |
| 71 | end |
| 72 | if not afemit cap wt 0 |
| 73 | ret 1 |
| 74 | end |
| 75 | if not afemit cap wt 127 |
| 76 | ret 1 |
| 77 | end |
| 78 | if not afemit cap wt 255 |
| 79 | ret 1 |
| 80 | end |
| 81 | end |
| 82 | ret 0 |
| 83 | end |