diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-26 17:06:00 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-26 17:06:00 -0700 |
commit | 16a31669e3ef87e518935c2f122a22beffd2bd2d (patch) | |
tree | c1d95d5b47dcc076aad0792a62ae22a3c3919209 /apps/tile | |
parent | 7c9b650d27358a47ef7bcfd9a293f21e0dcb8a5f (diff) | |
download | mu-16a31669e3ef87e518935c2f122a22beffd2bd2d.tar.gz |
7111
Diffstat (limited to 'apps/tile')
-rw-r--r-- | apps/tile/environment.mu | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 757e62b9..69de9c71 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -1358,42 +1358,8 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi var data/eax: (addr array value) <- lookup *data-ah var top/edx: int <- copy *top-addr var dest-offset/edx: (offset value) <- compute-offset data, top - var val-addr/eax: (addr value) <- index data, dest-offset - $render-column:render-value: { - var val-type/ecx: (addr int) <- get val-addr, type - # per-type rendering logic goes here - { - compare *val-type, 1 # string - break-if-!= - var val-ah/eax: (addr handle array byte) <- get val-addr, text-data - var val/eax: (addr array byte) <- lookup *val-ah - start-color screen, 0, 7 - print-grapheme screen, 0x20 # space - print-string screen, val - break $render-column:render-value - } - { - compare *val-type, 2 # array - break-if-!= - var val-ah/eax: (addr handle array int) <- get val-addr, array-data - var val/eax: (addr array int) <- lookup *val-ah - render-array screen, val - break $render-column:render-value - } - { - compare *val-type, 3 # file - break-if-!= - var val-ah/eax: (addr handle buffered-file) <- get val-addr, file-data - var val/eax: (addr buffered-file) <- lookup *val-ah - start-color screen, 0, 7 - # TODO - print-string screen, " FILE " - break $render-column:render-value - } - # render ints by default for now - var val-addr2/eax: (addr int) <- get val-addr, int-data - render-integer screen, *val-addr2, max-width - } + var val/eax: (addr value) <- index data, dest-offset + render-value screen, val, max-width } curr-row <- increment loop @@ -1423,6 +1389,45 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi #? print-string 0, "\n" } +fn render-value screen: (addr screen), _val: (addr value), max-width: int { +$render-value:body: { + var val/esi: (addr value) <- copy _val + var val-type/ecx: (addr int) <- get val, type + # per-type rendering logic goes here + compare *val-type, 1 # string + { + break-if-!= + var val-ah/eax: (addr handle array byte) <- get val, text-data + var val-string/eax: (addr array byte) <- lookup *val-ah + start-color screen, 0, 7 + print-grapheme screen, 0x20 # space + print-string screen, val-string + break $render-value:body + } + compare *val-type, 2 # array + { + break-if-!= + var val-ah/eax: (addr handle array int) <- get val, array-data + var val-array/eax: (addr array int) <- lookup *val-ah + render-array screen, val-array + break $render-value:body + } + compare *val-type, 3 # file + { + break-if-!= + var val-ah/eax: (addr handle buffered-file) <- get val, file-data + var val-file/eax: (addr buffered-file) <- lookup *val-ah + start-color screen, 0, 7 + # TODO + print-string screen, " FILE " + break $render-value:body + } + # render ints by default for now + var val-int/eax: (addr int) <- get val, int-data + render-integer screen, *val-int, max-width +} +} + # synaesthesia fn render-integer screen: (addr screen), val: int, max-width: int { var bg/eax: int <- hash-color val |