omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / examples / semantic-codebook / dispatch-v0.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note SEM-1 research smoke only. 256-bit root from codebook-v0.txt, untrusted caller. |
| 3 | note This source does not validate the canonical program IDs, signatures, or capabilities. |
| 4 | note A 16-bit return is 0x00vv for a successful u8 result, or 0xffNN for refusal. |
| 5 | note First-party executable syntax is seeded Omega .om, not legacy .osc. |
| 6 | |
| 7 | struct Root a ulong b ulong c ulong d ulong end |
| 8 | |
| 9 | fn dispatch root view Root code uchar epoch uchar x uchar p uchar to ushort |
| 10 | if ne get root a 6739245970865574820 |
| 11 | ret 65283 |
| 12 | end |
| 13 | if ne get root b 9146405468906863133 |
| 14 | ret 65283 |
| 15 | end |
| 16 | if ne get root c 2389306260950466872 |
| 17 | ret 65283 |
| 18 | end |
| 19 | if ne get root d 17559557173790906796 |
| 20 | ret 65283 |
| 21 | end |
| 22 | if ne epoch 9 |
| 23 | ret 65281 |
| 24 | end |
| 25 | if gt code 2 |
| 26 | ret 65282 |
| 27 | end |
| 28 | if eq code 0 |
| 29 | ret ushort add x 1 |
| 30 | end |
| 31 | if eq code 1 |
| 32 | ret ushort mul x 2 |
| 33 | end |
| 34 | ret ushort add mul x 2 p |
| 35 | end |
| 36 | |
| 37 | fn main to int |
| 38 | root = new Root 6739245970865574820 9146405468906863133 2389306260950466872 17559557173790906796 |
| 39 | if ne dispatch root 0 9 41 0 42 |
| 40 | ret 1 |
| 41 | end |
| 42 | if ne dispatch root 1 9 21 0 42 |
| 43 | ret 2 |
| 44 | end |
| 45 | if ne dispatch root 2 9 20 2 42 |
| 46 | ret 3 |
| 47 | end |
| 48 | if ne dispatch root 0 9 255 0 0 |
| 49 | ret 4 |
| 50 | end |
| 51 | if ne dispatch root 1 9 128 0 0 |
| 52 | ret 5 |
| 53 | end |
| 54 | if ne dispatch root 2 9 127 2 0 |
| 55 | ret 6 |
| 56 | end |
| 57 | if ne dispatch root 0 8 41 0 65281 |
| 58 | ret 7 |
| 59 | end |
| 60 | if ne dispatch root 3 9 41 0 65282 |
| 61 | ret 8 |
| 62 | end |
| 63 | bad = new Root 6739245970865574820 9146405468906863133 2389306260950466872 17559557173790906797 |
| 64 | if ne dispatch bad 0 9 41 0 65283 |
| 65 | ret 9 |
| 66 | end |
| 67 | ret 0 |
| 68 | end |