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 / seed / helix / rung1 / hexB1.b0
| 1 | ; hexB1.b0 -- Rung B1 of Strand B (unlabelled byte-pair stream for seedB0) |
| 2 | 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 02 00 b7 00 01 00 00 00 78 00 50 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 38 00 01 00 00 00 00 00 00 00 ; ELF-64 file header (64B) |
| 3 | 01 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 50 00 00 00 00 00 ; PT_LOAD header part 1 |
| 4 | b4 03 00 00 00 00 00 00 ; p_filesz (auto) = 948 |
| 5 | 00 00 40 00 00 00 00 00 00 10 00 00 00 00 00 00 ; p_memsz & p_align |
| 6 | ff 83 00 d1 ; sub sp, sp, #32 |
| 7 | fc 03 00 91 ; mov x28, sp (name buf) |
| 8 | 13 0c a0 d2 ; x19 = 0x600000 (in_base) |
| 9 | 14 00 80 d2 ; x20 = 0 (in_len) |
| 10 | 17 0e a0 d2 ; x23 = 0x700000 (out_base) |
| 11 | 19 0b a0 d2 ; x25 = 0x580000 (lbl_base) |
| 12 | 1a 00 80 d2 ; x26 = 0 (lbl_cnt) |
| 13 | 1b 00 80 d2 ; x27 = 0 (total_len) |
| 14 | ; :rd_loop @ 0x98 |
| 15 | 02 02 a0 d2 ; x2 = 0x100000 (1 MiB) |
| 16 | 42 00 14 cb ; x2 = avail |
| 17 | 42 18 00 b4 ; if avail==0 -> err 9 -> err_cap (+194) |
| 18 | 00 00 80 d2 ; fd 0 |
| 19 | 61 02 14 8b ; x1 = in_base + in_len |
| 20 | e8 07 80 d2 ; SYS_read |
| 21 | 01 00 00 d4 ; svc #0 |
| 22 | 1f 00 00 f1 ; cmp x0, #0 |
| 23 | 80 00 00 54 ; eof -> rd_done (+4) |
| 24 | 2b 17 00 54 ; read err -> err_rd (+185) |
| 25 | 94 02 00 8b ; in_len += n |
| 26 | f5 ff ff 17 ; loop read -> rd_loop (-11) |
| 27 | ; :rd_done @ 0xc8 |
| 28 | 15 00 80 d2 ; pass = 0 |
| 29 | ; :pass_start @ 0xcc |
| 30 | 16 00 80 d2 ; cursor = 0 |
| 31 | 18 00 80 d2 ; out_pos = 0 |
| 32 | ; :tok_loop @ 0xd4 |
| 33 | df 02 14 eb ; cmp cursor, in_len |
| 34 | 62 0c 00 54 ; if cursor >= in_len -> pass_done (+99) |
| 35 | 60 6a 76 38 ; w0 = in[cursor] |
| 36 | d6 06 00 91 ; cursor++ |
| 37 | 1f 80 00 71 ; cmp ' ' |
| 38 | 60 ff ff 54 ; skip space -> tok_loop (-5) |
| 39 | 1f 28 00 71 ; cmp LF |
| 40 | 20 ff ff 54 ; skip LF -> tok_loop (-7) |
| 41 | 1f 24 00 71 ; cmp TAB |
| 42 | e0 fe ff 54 ; skip TAB -> tok_loop (-9) |
| 43 | 1f 34 00 71 ; cmp CR |
| 44 | a0 fe ff 54 ; skip CR -> tok_loop (-11) |
| 45 | 1f ec 00 71 ; cmp ';' |
| 46 | 01 01 00 54 ; not comment -> not_cmt (+8) |
| 47 | ; :cmt_loop @ 0x10c |
| 48 | df 02 14 eb ; cmp cursor, in_len |
| 49 | a2 0a 00 54 ; eof in cmt -> pass_done (+85) |
| 50 | 60 6a 76 38 ; w0 = in[cursor] |
| 51 | d6 06 00 91 ; cursor++ |
| 52 | 1f 28 00 71 ; cmp LF |
| 53 | 61 ff ff 54 ; until LF -> cmt_loop (-5) |
| 54 | ec ff ff 17 ; done cmt -> tok_loop (-20) |
| 55 | ; :not_cmt @ 0x128 |
| 56 | 1f e8 00 71 ; cmp ':' |
| 57 | 81 01 00 54 ; not : -> not_def (+12) |
| 58 | 6d 00 00 94 ; read label name into [x28] -> rd_name (+109) |
| 59 | 15 fd ff b5 ; pass 1 skips def -> tok_loop (-24) |
| 60 | 41 eb 7b d3 ; x1 = lbl_cnt * 32 |
| 61 | 21 03 01 8b ; x1 = entry addr |
| 62 | 82 03 40 f9 ; name[0..7] |
| 63 | 83 07 40 f9 ; name[8..15] |
| 64 | 22 00 00 f9 ; store name[0..7] |
| 65 | 23 04 00 f9 ; store name[8..15] |
| 66 | 38 08 00 f9 ; store offset = out_pos |
| 67 | 5a 07 00 91 ; lbl_cnt++ |
| 68 | df ff ff 17 ; next -> tok_loop (-33) |
| 69 | ; :not_def @ 0x15c |
| 70 | 1f f4 00 71 ; cmp '=' |
| 71 | 01 02 00 54 ; not = -> not_word (+16) |
| 72 | 09 00 80 d2 ; w9 = acc |
| 73 | 0a 01 80 d2 ; x10 = 8 digits |
| 74 | ; :w_loop @ 0x16c |
| 75 | df 02 14 eb ; cmp cursor, in_len |
| 76 | c2 10 00 54 ; truncated word -> err_hex (+134) |
| 77 | 60 6a 76 38 ; w0 = ch |
| 78 | d6 06 00 91 ; cursor++ |
| 79 | 4c 00 00 94 ; x0 = 0..15 -> hex_val (+76) |
| 80 | 29 6d 1c 53 ; w9 <<= 4 |
| 81 | 29 01 00 2a ; w9 |= w0 |
| 82 | 4a 05 00 f1 ; x10-- |
| 83 | 01 ff ff 54 ; more digits -> w_loop (-8) |
| 84 | 55 00 00 b4 ; pass 0 no write -> w_skip (+2) |
| 85 | e9 6a 38 b8 ; out[out_pos] = w9 |
| 86 | ; :w_skip @ 0x198 |
| 87 | 18 13 00 91 ; out_pos += 4 |
| 88 | ce ff ff 17 ; next -> tok_loop (-50) |
| 89 | ; :not_word @ 0x1a0 |
| 90 | 1f 00 01 71 ; cmp '@' |
| 91 | e1 01 00 54 ; not @ -> not_b19 (+15) |
| 92 | 4f 00 00 94 ; read label -> rd_name (+79) |
| 93 | 55 f9 ff b4 ; pass 0 skip -> tok_loop (-54) |
| 94 | 65 00 00 94 ; x0 = target off -> find_lbl (+101) |
| 95 | 01 13 00 d1 ; x1 = out_pos - 4 |
| 96 | 00 00 01 cb ; x0 = target - pc |
| 97 | 00 fc 42 93 ; x0 >>= 2 |
| 98 | e2 ff 9f d2 ; x2 = 0xffff |
| 99 | e2 00 a0 f2 ; x2 = 0x7ffff |
| 100 | 00 00 02 8a ; x0 &= 0x7ffff |
| 101 | 00 e8 7b d3 ; x0 <<= 5 |
| 102 | e3 6a 61 b8 ; w3 = prev word |
| 103 | 63 00 00 2a ; w3 |= w0 |
| 104 | e3 6a 21 b8 ; store patched word |
| 105 | be ff ff 17 ; next -> tok_loop (-66) |
| 106 | ; :not_b19 @ 0x1e0 |
| 107 | 1f 78 01 71 ; cmp '^' |
| 108 | c1 01 00 54 ; not ^ -> not_b26 (+14) |
| 109 | 3f 00 00 94 ; read label -> rd_name (+63) |
| 110 | 55 f7 ff b4 ; pass 0 skip -> tok_loop (-70) |
| 111 | 55 00 00 94 ; x0 = target off -> find_lbl (+85) |
| 112 | 01 13 00 d1 ; x1 = out_pos - 4 |
| 113 | 00 00 01 cb ; x0 = target - pc |
| 114 | 00 fc 42 93 ; x0 >>= 2 |
| 115 | e2 ff 9f d2 ; x2 = 0xffff |
| 116 | e2 7f a0 f2 ; x2 = 0x3ffffff |
| 117 | 00 00 02 8a ; x0 &= 0x3ffffff |
| 118 | e3 6a 61 b8 ; w3 = prev word |
| 119 | 63 00 00 2a ; w3 |= w0 |
| 120 | e3 6a 21 b8 ; store patched word |
| 121 | af ff ff 17 ; next -> tok_loop (-81) |
| 122 | ; :not_b26 @ 0x21c |
| 123 | 1f 90 00 71 ; cmp '$' |
| 124 | a1 00 00 54 ; not $ -> do_byte (+5) |
| 125 | 55 00 00 b4 ; pass 0 skip -> sz_skip (+2) |
| 126 | fb 6a 38 f8 ; out[out_pos] = total_len |
| 127 | ; :sz_skip @ 0x22c |
| 128 | 18 23 00 91 ; out_pos += 8 |
| 129 | a9 ff ff 17 ; next -> tok_loop (-87) |
| 130 | ; :do_byte @ 0x234 |
| 131 | 1e 00 00 94 ; first nibble -> hex_val (+30) |
| 132 | 09 6c 1c 53 ; w9 = hi << 4 |
| 133 | df 02 14 eb ; cmp cursor, in_len |
| 134 | 42 0a 00 54 ; odd nibble -> err_hex (+82) |
| 135 | 60 6a 76 38 ; w0 = second ch |
| 136 | d6 06 00 91 ; cursor++ |
| 137 | 18 00 00 94 ; second nibble -> hex_val (+24) |
| 138 | 29 01 00 2a ; w9 |= lo |
| 139 | 55 00 00 b4 ; pass 0 skip -> b_skip (+2) |
| 140 | e9 6a 38 38 ; out[out_pos] = w9 |
| 141 | ; :b_skip @ 0x25c |
| 142 | 18 07 00 91 ; out_pos += 1 |
| 143 | 9d ff ff 17 ; next -> tok_loop (-99) |
| 144 | ; :pass_done @ 0x264 |
| 145 | 95 00 00 b5 ; if pass==1 -> write -> write_out (+4) |
| 146 | fb 03 18 aa ; total_len = out_pos |
| 147 | 35 00 80 d2 ; pass = 1 |
| 148 | 97 ff ff 17 ; start pass 1 -> pass_start (-105) |
| 149 | ; :write_out @ 0x274 |
| 150 | 09 00 80 d2 ; written = 0 |
| 151 | ; :wr_loop @ 0x278 |
| 152 | 3f 01 18 eb ; cmp written, out_pos |
| 153 | 42 01 00 54 ; done write -> ok_exit (+10) |
| 154 | 20 00 80 d2 ; fd 1 |
| 155 | e1 02 09 8b ; ptr = out_base + written |
| 156 | 02 03 09 cb ; rem = out_pos - written |
| 157 | 08 08 80 d2 ; SYS_write |
| 158 | 01 00 00 d4 ; svc #0 |
| 159 | 1f 00 00 f1 ; cmp x0, #0 |
| 160 | 0d 08 00 54 ; write err -> err_wr (+64) |
| 161 | 29 01 00 8b ; written += n |
| 162 | f6 ff ff 17 ; loop write -> wr_loop (-10) |
| 163 | ; :ok_exit @ 0x2a4 |
| 164 | 00 00 80 d2 ; exit 0 |
| 165 | 41 00 00 14 ; exit -> do_exit (+65) |
| 166 | ; :hex_val @ 0x2ac |
| 167 | 01 c0 00 71 ; w1 = w0 - '0' |
| 168 | 3f 28 00 71 ; cmp w1, #10 |
| 169 | 43 01 00 54 ; 0-9 -> hv_ok (+10) |
| 170 | 01 84 01 71 ; w1 = w0 - 'a' |
| 171 | 3f 18 00 71 ; cmp w1, #6 |
| 172 | c3 00 00 54 ; a-f -> hv_add10 (+6) |
| 173 | 01 04 01 71 ; w1 = w0 - 'A' |
| 174 | 3f 18 00 71 ; cmp w1, #6 |
| 175 | 63 00 00 54 ; A-F -> hv_add10 (+3) |
| 176 | a0 00 80 d2 ; bad hex -> exit 5 |
| 177 | 36 00 00 14 ; exit -> do_exit (+54) |
| 178 | ; :hv_add10 @ 0x2d8 |
| 179 | 21 28 00 11 ; w1 += 10 |
| 180 | ; :hv_ok @ 0x2dc |
| 181 | e0 03 01 2a ; w0 = w1 |
| 182 | c0 03 5f d6 ; ret |
| 183 | ; :rd_name @ 0x2e4 |
| 184 | 9f 03 00 f9 ; zero name[0..7] |
| 185 | 9f 07 00 f9 ; zero name[8..15] |
| 186 | 01 00 80 d2 ; i = 0 |
| 187 | ; :rn_loop @ 0x2f0 |
| 188 | df 02 14 eb ; cmp cursor, in_len |
| 189 | 42 02 00 54 ; eof -> rn_done (+18) |
| 190 | 60 6a 76 38 ; w0 = ch |
| 191 | 1f 80 00 71 ; cmp ' ' |
| 192 | e0 01 00 54 ; ws -> rn_done (+15) |
| 193 | 1f 28 00 71 ; cmp LF |
| 194 | a0 01 00 54 ; ws -> rn_done (+13) |
| 195 | 1f 24 00 71 ; cmp TAB |
| 196 | 60 01 00 54 ; ws -> rn_done (+11) |
| 197 | 1f 34 00 71 ; cmp CR |
| 198 | 20 01 00 54 ; ws -> rn_done (+9) |
| 199 | 1f ec 00 71 ; cmp ';' |
| 200 | e0 00 00 54 ; cmt -> rn_done (+7) |
| 201 | 3f 40 00 f1 ; cmp i, #16 |
| 202 | 02 03 00 54 ; name > 16 -> err_hex (+24) |
| 203 | 80 6b 21 38 ; name[i] = w0 |
| 204 | 21 04 00 91 ; i++ |
| 205 | d6 06 00 91 ; cursor++ |
| 206 | ee ff ff 17 ; loop -> rn_loop (-18) |
| 207 | ; :rn_done @ 0x33c |
| 208 | 61 02 00 b4 ; empty name -> err_hex (+19) |
| 209 | c0 03 5f d6 ; ret |
| 210 | ; :find_lbl @ 0x344 |
| 211 | 82 03 40 f9 ; want0 |
| 212 | 83 07 40 f9 ; want1 |
| 213 | 01 00 80 d2 ; i = 0 |
| 214 | ; :fl_loop @ 0x350 |
| 215 | 3f 00 1a eb ; cmp i, lbl_cnt |
| 216 | e2 01 00 54 ; not found -> err_lbl (+15) |
| 217 | 24 e8 7b d3 ; x4 = i * 32 |
| 218 | 24 03 04 8b ; x4 = entry |
| 219 | 85 00 40 f9 ; got0 |
| 220 | bf 00 02 eb ; cmp got0, want0 |
| 221 | c1 00 00 54 ; miss0 -> fl_next (+6) |
| 222 | 85 04 40 f9 ; got1 |
| 223 | bf 00 03 eb ; cmp got1, want1 |
| 224 | 61 00 00 54 ; miss1 -> fl_next (+3) |
| 225 | 80 08 40 f9 ; x0 = offset |
| 226 | c0 03 5f d6 ; ret |
| 227 | ; :fl_next @ 0x380 |
| 228 | 21 04 00 91 ; i++ |
| 229 | f3 ff ff 17 ; loop -> fl_loop (-13) |
| 230 | ; :err_hex @ 0x388 |
| 231 | c0 00 80 d2 ; exit 6 |
| 232 | 08 00 00 14 ; exit -> do_exit (+8) |
| 233 | ; :err_lbl @ 0x390 |
| 234 | e0 00 80 d2 ; exit 7 |
| 235 | 06 00 00 14 ; exit -> do_exit (+6) |
| 236 | ; :err_wr @ 0x398 |
| 237 | 00 01 80 d2 ; exit 8 |
| 238 | 04 00 00 14 ; exit -> do_exit (+4) |
| 239 | ; :err_rd @ 0x3a0 |
| 240 | 20 01 80 d2 ; exit 9 |
| 241 | 02 00 00 14 ; exit -> do_exit (+2) |
| 242 | ; :err_cap @ 0x3a8 |
| 243 | 40 01 80 d2 ; exit 10 |
| 244 | ; :do_exit @ 0x3ac |
| 245 | a8 0b 80 d2 ; SYS_exit |
| 246 | 01 00 00 d4 ; svc #0 |