https://github.com/akkartik/mu/blob/master/063error.subx
 1 # Print an error message and exit.
 2 
 3 == code
 4 #   instruction                     effective address                                                   register    displacement    immediate
 5 # . op          subop               mod             rm32          base        index         scale       r32
 6 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 7 
 8 # write(out, "Error: "+msg+"\n") then stop(ed, 1)
 9 error:  # ed : (address exit-descriptor), out : fd or (address stream), msg : (address array byte)
10     # . prologue
11     55/push-ebp
12     89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
13     # write(out, "Error: ")
14     # . . push args
15     68/push  "Error: "/imm32
16     ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
17     # . . call
18     e8/call  write/disp32
19     # . . discard args
20     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
21     # write(out, msg)
22     # . . push args
23     ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x10/disp8      .                 # push *(ebp+16)
24     ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
25     # . . call
26     e8/call  write/disp32
27     # . . discard args
28     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
29     # write(out, "\n")
30     # . . push args
31     68/push  Newline/imm32
32     ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
33     # . . call
34     e8/call  write/disp32
35     # . . discard args
36     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
37     # stop(ed, 1)
38     # . . push args
39     68/push  1/imm32
40     ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           8/disp8         .                 # push *(ebp+8)
41     # . . call
42     e8/call  stop/disp32
43     # should never get past this point
44 $error:dead-end:
45     # . epilogue
46     89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
47     5d/pop-to-ebp
48     c3/return
49 
50 # . . vim:nowrap:textwidth=0