https://github.com/akkartik/mu/blob/main/baremetal/101screen.subx
 1 # Primitives for screen control.
 2 #
 3 # We need to do this in machine code because Mu doesn't have global variables
 4 # yet (for the start of video memory).
 5 
 6 == code
 7 
 8 pixel-on-real-screen:  # x: int, y: int, color: int
 9     # . prologue
10     55/push-ebp
11     89/<- %ebp 4/r32/esp
12     # . save registers
13     50/push-eax
14     51/push-ecx
15     # bounds checks
16     8b/-> *(ebp+8) 0/r32/eax
17     3d/compare-eax-and 0/imm32
18     7c/jump-if-< $pixel-on-real-screen:end/disp8
19     3d/compare-eax-and 0x400/imm32/screen-width=1024
20     7d/jump-if->= $pixel-on-real-screen:end/disp8
21     8b/-> *(ebp+0xc) 0/r32/eax
22     3d/compare-eax-and 0/imm32
23     7c/jump-if-< $pixel-on-real-screen:end/disp8
24     3d/compare-eax-and 0x300/imm32/screen-height=768
25     7d/jump-if->= $pixel-on-real-screen:end/disp8
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Gene