https://github.com/akkartik/mu/blob/main/linux/tile/value-stack.mu
  1 # support for non-int values is untested
  2 
  3 type value-stack {
  4   data: (handle array value)
  5   top: int
  6 }
  7 
  8 fn initialize-value-stack _self: (addr value-stack), n: int {
  9   var self/esi: (addr value-stack) <- copy _self
 10   var d/edi: (addr handle array value) <- get self, data
 11   populate d, n
 12   var top/eax: (addr int) <- get self, top
 13   copy-to *top, 0
 14 }
 15 
 16 fn clear-value-stack _self: (addr value-stack) {
 17   var self/esi: (addr value-stack) <- copy _self
 18   var top/eax: (addr int) <- get self, top
 19   copy-to *top, 0
 20 }
 21 
 22 fn push-number-to-value-stack _self: (addr value-stack), _val: float {
 23   var self/esi: (addr value-stack) <- copy _self
 24   var top-addr/ecx: (addr int) <- get self, top
 25   var data-ah/edx: (addr handle array value) <- get self, data
 26   var data/eax: (addr array value) <- lookup *data-ah
 27   var top/edx: int <- copy *top-addr
 28   var dest-offset/edx: (offset value) <- compute-offset data, top
 29   var dest-addr/edx: (addr value) <- index data, dest-offset
 30   var dest-addr2/eax: (addr float) <- get dest-addr, number-data
 31   var val/xmm0: float <- copy _val
 32 #?   print-float-decimal-approximate 0, val, 3
 33   copy-to *dest-addr2, val
 34   increment *top-addr
 35   var type-addr/eax: (addr int) <- get dest-addr, type
 36   copy-to *type-addr, 0/number
 37 }
 38 
 39 fn push-string-to-value-stack _self: (addr value-stack), val: (handle array byte) {
 40   <
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 508circle.mu</title>
<meta name="Generator" content="Vim/8.1">
<meta name="plugin-version" content="vim8.1_v1">
<meta name="syntax" content="none">
<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
<meta name="colorscheme" content="minimal-light">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffd7; }
body { font-size:12pt; font-family: monospace; color: #000000; background-color: #ffffd7; }
a { color:inherit; }
* { font-size:12pt; font-size: 1em; }
.PreProc { color: #c000c0; }
.muRegEdx { color: #af5f00; }
.Special { color: #ff6060; }
.LineNr { }
.Constant { color: #008787; }
.muRegEcx { color: #870000; }
.Delimiter { color: #c000c0; }
.muFunction { color: #af5f00; text-decoration: underline; }
.muComment { color: #005faf; }
-->
</style>

<script type='text/javascript'>
<!--

/* function to open any folds containing a jumped-to line before jumping to it */
function JumpToLine()
{
  var lineNum;
  lineNum = window.location.hash;
  lineNum = lineNum.substr(1); /* strip off '#' */

  if (lineNum.indexOf('L') == -1) {
    lineNum = 'L'+lineNum;
  }
  var lineElem = document.getElementById(lineNum);
  /* Always jump to new location even if the line was hidden inside a fold, or
   * we corrected the raw number to a line ID.
   */
  if (lineElem) {
    lineElem.scrollIntoView(true);
  }
  return true;
}
if ('onhashchange' in window) {
  window.onhashchange = JumpToLine;
}

-->
</script>
</head>
<body onload='JumpToLine();'>
<a href='https://github.com/akkartik/mu/blob/main/508circle.mu'>https://github.com/akkartik/mu/blob/main/508circle.mu</a>
<pre id='vimCodeElement'>
<span id="L1"