From f0e146fc7b947bae526657d8c858a95319abf204 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 1 May 2021 23:52:28 -0700 Subject: . --- html/shell/cell.mu.html | 302 +++++++++++++++++++++++++----------------------- 1 file changed, 158 insertions(+), 144 deletions(-) (limited to 'html/shell/cell.mu.html') diff --git a/html/shell/cell.mu.html b/html/shell/cell.mu.html index c5f1bc69..1b15ee5f 100644 --- a/html/shell/cell.mu.html +++ b/html/shell/cell.mu.html @@ -98,155 +98,169 @@ if ('onhashchange' in window) { 40 initialize-symbol out, val 41 } 42 - 43 fn allocate-stream _out: (addr handle cell) { - 44 var out/eax: (addr handle cell) <- copy _out - 45 allocate out - 46 var out-addr/eax: (addr cell) <- lookup *out - 47 var type/ecx: (addr int) <- get out-addr, type - 48 copy-to *type, 3/stream - 49 var dest-ah/eax: (addr handle stream byte) <- get out-addr, text-data - 50 populate-stream dest-ah, 0x40/max-stream-size - 51 } - 52 - 53 fn allocate-number _out: (addr handle cell) { - 54 var out/eax: (addr handle cell) <- copy _out - 55 allocate out - 56 var out-addr/eax: (addr cell) <- lookup *out - 57 var type/ecx: (addr int) <- get out-addr, type - 58 copy-to *type, 1/number - 59 } - 60 - 61 fn initialize-integer _out: (addr handle cell), n: int { - 62 var out/eax: (addr handle cell) <- copy _out - 63 var out-addr/eax: (addr cell) <- lookup *out - 64 var dest-addr/eax: (addr float) <- get out-addr, number-data - 65 var src/xmm0: float <- convert n - 66 copy-to *dest-addr, src - 67 } - 68 - 69 fn new-integer out: (addr handle cell), n: int { - 70 allocate-number out - 71 initialize-integer out, n - 72 } - 73 - 74 fn initialize-float _out: (addr handle cell), n: float { - 75 var out/eax: (addr handle cell) <- copy _out - 76 var out-addr/eax: (addr cell) <- lookup *out - 77 var dest-ah/eax: (addr float) <- get out-addr, number-data - 78 var src/xmm0: float <- copy n - 79 copy-to *dest-ah, src - 80 } - 81 - 82 fn new-float out: (addr handle cell), n: float { - 83 allocate-number out - 84 initialize-float out, n - 85 } - 86 - 87 fn allocate-pair out: (addr handle cell) { - 88 allocate out - 89 # new cells have type pair by default - 90 } - 91 - 92 fn initialize-pair _out: (addr handle cell), left: (handle cell), right: (handle cell) { - 93 var out/eax: (addr handle cell) <- copy _out - 94 var out-addr/eax: (addr cell) <- lookup *out - 95 var dest-ah/ecx: (addr handle cell) <- get out-addr, left - 96 copy-handle left, dest-ah - 97 dest-ah <- get out-addr, right - 98 copy-handle right, dest-ah + 43 fn symbol-equal? _in: (addr cell), name: (addr array byte) -> _/eax: boolean { + 44 var in/esi: (addr cell) <- copy _in + 45 var in-type/eax: (addr int) <- get in, type + 46 compare *in-type, 2/symbol + 47 { + 48 break-if-= + 49 return 0/false + 50 } + 51 var in-data-ah/eax: (addr handle stream byte) <- get in, text-data + 52 var in-data/eax: (addr stream byte) <- lookup *in-data-ah + 53 var result/eax: boolean <- stream-data-equal? in-data, name + 54 return result + 55 } + 56 + 57 fn allocate-stream _out: (addr handle cell) { + 58 var out/eax: (addr handle cell) <- copy _out + 59 allocate out + 60 var out-addr/eax: (addr cell) <- lookup *out + 61 var type/ecx: (addr int) <- get out-addr, type + 62 copy-to *type, 3/stream + 63 var dest-ah/eax: (addr handle stream byte) <- get out-addr, text-data + 64 populate-stream dest-ah, 0x40/max-stream-size + 65 } + 66 + 67 fn allocate-number _out: (addr handle cell) { + 68 var out/eax: (addr handle cell) <- copy _out + 69 allocate out + 70 var out-addr/eax: (addr cell) <- lookup *out + 71 var type/ecx: (addr int) <- get out-addr, type + 72 copy-to *type, 1/number + 73 } + 74 + 75 fn initialize-integer _out: (addr handle cell), n: int { + 76 var out/eax: (addr handle cell) <- copy _out + 77 var out-addr/eax: (addr cell) <- lookup *out + 78 var dest-addr/eax: (addr float) <- get out-addr, number-data + 79 var src/xmm0: float <- convert n + 80 copy-to *dest-addr, src + 81 } + 82 + 83 fn new-integer out: (addr handle cell), n: int { + 84 allocate-number out + 85 initialize-integer out, n + 86 } + 87 + 88 fn initialize-float _out: (addr handle cell), n: float { + 89 var out/eax: (addr handle cell) <- copy _out + 90 var out-addr/eax: (addr cell) <- lookup *out + 91 var dest-ah/eax: (addr float) <- get out-addr, number-data + 92 var src/xmm0: float <- copy n + 93 copy-to *dest-ah, src + 94 } + 95 + 96 fn new-float out: (addr handle cell), n: float { + 97 allocate-number out + 98 initialize-float out, n 99 } 100 -101 fn new-pair out: (addr handle cell), left: (handle cell), right: (handle cell) { -102 allocate-pair out -103 initialize-pair out, left, right +101 fn allocate-pair out: (addr handle cell) { +102 allocate out +103 # new cells have type pair by default 104 } 105 -106 fn nil out: (addr handle cell) { -107 allocate-pair out -108 } -109 -110 fn allocate-primitive-function _out: (addr handle cell) { -111 var out/eax: (addr handle cell) <- copy _out -112 allocate out -113 var out-addr/eax: (addr cell) <- lookup *out -114 var type/ecx: (addr int) <- get out-addr, type -115 copy-to *type, 4/primitive-function -116 } -117 -118 fn initialize-primitive-function _out: (addr handle cell), n: int { -119 var out/eax: (addr handle cell) <- copy _out -120 var out-addr/eax: (addr cell) <- lookup *out -121 var dest-addr/eax: (addr int) <- get out-addr, index-data -122 var src/ecx: int <- copy n -123 copy-to *dest-addr, src -124 } -125 -126 fn new-primitive-function out: (addr handle cell), n: int { -127 allocate-primitive-function out -128 initialize-primitive-function out, n -129 } -130 -131 fn allocate-screen _out: (addr handle cell) { -132 var out/eax: (addr handle cell) <- copy _out -133 allocate out +106 fn initialize-pair _out: (addr handle cell), left: (handle cell), right: (handle cell) { +107 var out/eax: (addr handle cell) <- copy _out +108 var out-addr/eax: (addr cell) <- lookup *out +109 var dest-ah/ecx: (addr handle cell) <- get out-addr, left +110 copy-handle left, dest-ah +111 dest-ah <- get out-addr, right +112 copy-handle right, dest-ah +113 } +114 +115 fn new-pair out: (addr handle cell), left: (handle cell), right: (handle cell) { +116 allocate-pair out +117 initialize-pair out, left, right +118 } +119 +120 fn nil out: (addr handle cell) { +121 allocate-pair out +122 } +123 +124 fn allocate-primitive-function _out: (addr handle cell) { +125 var out/eax: (addr handle cell) <- copy _out +126 allocate out +127 var out-addr/eax: (addr cell) <- lookup *out +128 var type/ecx: (addr int) <- get out-addr, type +129 copy-to *type, 4/primitive-function +130 } +131 +132 fn initialize-primitive-function _out: (addr handle cell), n: int { +133 var out/eax: (addr handle cell) <- copy _out 134 var out-addr/eax: (addr cell) <- lookup *out -135 var type/ecx: (addr int) <- get out-addr, type -136 copy-to *type, 5/screen -137 } -138 -139 fn new-fake-screen _out: (addr handle cell), width: int, height: int, pixel-graphics?: boolean { -140 var out/eax: (addr handle cell) <- copy _out -141 allocate-screen out -142 var out-addr/eax: (addr cell) <- lookup *out -143 var dest-ah/eax: (addr handle screen) <- get out-addr, screen-data -144 allocate dest-ah -145 var dest-addr/eax: (addr screen) <- lookup *dest-ah -146 initialize-screen dest-addr, width, height, pixel-graphics? -147 } -148 -149 fn clear-screen-cell _self-ah: (addr handle cell) { -150 var self-ah/eax: (addr handle cell) <- copy _self-ah -151 var self/eax: (addr cell) <- lookup *self-ah -152 compare self, 0 -153 { -154 break-if-!= -155 return -156 } -157 var screen-ah/eax: (addr handle screen) <- get self, screen-data -158 var screen/eax: (addr screen) <- lookup *screen-ah -159 clear-screen screen -160 } -161 -162 fn allocate-keyboard _out: (addr handle cell) { -163 var out/eax: (addr handle cell) <- copy _out -164 allocate out -165 var out-addr/eax: (addr cell) <- lookup *out -166 var type/ecx: (addr int) <- get out-addr, type -167 copy-to *type, 6/keyboard -168 } -169 -170 fn new-fake-keyboard _out: (addr handle cell), capacity: int { -171 var out/eax: (addr handle cell) <- copy _out -172 allocate-keyboard out -173 var out-addr/eax: (addr cell) <- lookup *out -174 var dest-ah/eax: (addr handle gap-buffer) <- get out-addr, keyboard-data -175 allocate dest-ah -176 var dest-addr/eax: (addr gap-buffer) <- lookup *dest-ah -177 initialize-gap-buffer dest-addr, capacity -178 } -179 -180 fn rewind-keyboard-cell _self-ah: (addr handle cell) { -181 var self-ah/eax: (addr handle cell) <- copy _self-ah -182 var self/eax: (addr cell) <- lookup *self-ah -183 compare self, 0 -184 { -185 break-if-!= -186 return -187 } -188 var keyboard-ah/eax: (addr handle gap-buffer) <- get self, keyboard-data -189 var keyboard/eax: (addr gap-buffer) <- lookup *keyboard-ah -190 rewind-gap-buffer keyboard -191 } +135 var dest-addr/eax: (addr int) <- get out-addr, index-data +136 var src/ecx: int <- copy n +137 copy-to *dest-addr, src +138 } +139 +140 fn new-primitive-function out: (addr handle cell), n: int { +141 allocate-primitive-function out +142 initialize-primitive-function out, n +143 } +144 +145 fn allocate-screen _out: (addr handle cell) { +146 var out/eax: (addr handle cell) <- copy _out +147 allocate out +148 var out-addr/eax: (addr cell) <- lookup *out +149 var type/ecx: (addr int) <- get out-addr, type +150 copy-to *type, 5/screen +151 } +152 +153 fn new-fake-screen _out: (addr handle cell), width: int, height: int, pixel-graphics?: boolean { +154 var out/eax: (addr handle cell) <- copy _out +155 allocate-screen out +156 var out-addr/eax: (addr cell) <- lookup *out +157 var dest-ah/eax: (addr handle screen) <- get out-addr, screen-data +158 allocate dest-ah +159 var dest-addr/eax: (addr screen) <- lookup *dest-ah +160 initialize-screen dest-addr, width, height, pixel-graphics? +161 } +162 +163 fn clear-screen-cell _self-ah: (addr handle cell) { +164 var self-ah/eax: (addr handle cell) <- copy _self-ah +165 var self/eax: (addr cell) <- lookup *self-ah +166 compare self, 0 +167 { +168 break-if-!= +169 return +170 } +171 var screen-ah/eax: (addr handle screen) <- get self, screen-data +172 var screen/eax: (addr screen) <- lookup *screen-ah +173 clear-screen screen +174 } +175 +176 fn allocate-keyboard _out: (addr handle cell) { +177 var out/eax: (addr handle cell) <- copy _out +178 allocate out +179 var out-addr/eax: (addr cell) <- lookup *out +180 var type/ecx: (addr int) <- get out-addr, type +181 copy-to *type, 6/keyboard +182 } +183 +184 fn new-fake-keyboard _out: (addr handle cell), capacity: int { +185 var out/eax: (addr handle cell) <- copy _out +186 allocate-keyboard out +187 var out-addr/eax: (addr cell) <- lookup *out +188 var dest-ah/eax: (addr handle gap-buffer) <- get out-addr, keyboard-data +189 allocate dest-ah +190 var dest-addr/eax: (addr gap-buffer) <- lookup *dest-ah +191 initialize-gap-buffer dest-addr, capacity +192 } +193 +194 fn rewind-keyboard-cell _self-ah: (addr handle cell) { +195 var self-ah/eax: (addr handle cell) <- copy _self-ah +196 var self/eax: (addr cell) <- lookup *self-ah +197 compare self, 0 +198 { +199 break-if-!= +200 return +201 } +202 var keyboard-ah/eax: (addr handle gap-buffer) <- get self, keyboard-data +203 var keyboard/eax: (addr gap-buffer) <- lookup *keyboard-ah +204 rewind-gap-buffer keyboard +205 } -- cgit 1.4.1-2-gfad0