From 6b343a82f29b6dea219504504244591c3042df43 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 1 Aug 2020 23:06:41 -0700 Subject: [PATCH] 6699 - start building out fake screen We now have all existing apps and prototypes going through the dependency-injected wrapper, even though it doesn't actually implement the fake screen yet. --- 304screen.subx | 58 ++-- 400.mu | 32 +-- 404screen.mu | 263 ++++++++++++++++++ apps/arith.mu | 10 +- apps/browse.mu | 22 +- apps/parse-int.mu | 2 +- apps/print-file.mu | 4 +- apps/tui.mu | 32 +-- prototypes/browse/1-print-file.mu | 2 +- prototypes/browse/10.mu | 22 +- prototypes/browse/11.mu | 26 +- prototypes/browse/12.mu | 30 +- prototypes/browse/13.mu | 30 +- prototypes/browse/14.mu | 30 +- prototypes/browse/15-headers-broken.mu | 34 +-- prototypes/browse/16-screen-state-broken.mu | 8 +- .../browse/17-file-state-broken/file-state.mu | 2 +- .../browse/17-file-state-broken/main.mu | 6 +- prototypes/browse/18/file-state.mu | 2 +- prototypes/browse/18/main.mu | 2 +- prototypes/browse/19/file-state.mu | 2 +- prototypes/browse/19/screen-position-state.mu | 6 +- prototypes/browse/2.mu | 2 +- prototypes/browse/20/file-state.mu | 2 +- prototypes/browse/20/screen-position-state.mu | 6 +- prototypes/browse/21/file-state.mu | 2 +- prototypes/browse/21/screen-position-state.mu | 6 +- prototypes/browse/22/file-state.mu | 2 +- prototypes/browse/22/screen-position-state.mu | 6 +- .../browse/23-multiple-pages/file-state.mu | 2 +- .../screen-position-state.mu | 8 +- prototypes/browse/24-bold/file-state.mu | 2 +- prototypes/browse/24-bold/main.mu | 14 +- .../browse/24-bold/screen-position-state.mu | 8 +- .../browse/25-soft-newlines/file-state.mu | 2 +- prototypes/browse/25-soft-newlines/main.mu | 14 +- .../25-soft-newlines/screen-position-state.mu | 8 +- prototypes/browse/26-headers/file-state.mu | 2 +- prototypes/browse/26-headers/main.mu | 26 +- .../26-headers/screen-position-state.mu | 8 +- prototypes/browse/27/file-state.mu | 2 +- prototypes/browse/27/main.mu | 26 +- prototypes/browse/27/screen-position-state.mu | 8 +- prototypes/browse/28/file-state.mu | 2 +- prototypes/browse/28/main.mu | 26 +- prototypes/browse/28/screen-position-state.mu | 8 +- prototypes/browse/29/file-state.mu | 2 +- prototypes/browse/29/main.mu | 26 +- prototypes/browse/29/screen-position-state.mu | 8 +- prototypes/browse/3.mu | 2 +- prototypes/browse/4-render-page.mu | 10 +- prototypes/browse/5.mu | 10 +- prototypes/browse/6.mu | 10 +- prototypes/browse/7.mu | 12 +- prototypes/browse/8-multiple-pages.mu | 12 +- prototypes/browse/9-bold.mu | 18 +- prototypes/tile/1.mu | 16 +- prototypes/tile/10.mu | 28 +- prototypes/tile/2.mu | 14 +- prototypes/tile/3.mu | 22 +- prototypes/tile/4.mu | 14 +- prototypes/tile/5.mu | 12 +- prototypes/tile/6.mu | 30 +- prototypes/tile/7.mu | 28 +- prototypes/tile/8.mu | 28 +- prototypes/tile/9.mu | 28 +- 66 files changed, 705 insertions(+), 442 deletions(-) create mode 100644 404screen.mu diff --git a/304screen.subx b/304screen.subx index 60feee32..340f3623 100644 --- a/304screen.subx +++ b/304screen.subx @@ -14,7 +14,7 @@ enable-screen-grid-mode: (write 2 Esc) (write 2 "[?1049h") # - (clear-screen) + (clear-real-screen) $enable-screen-grid-mode:end: # . epilogue 89/<- %esp 5/r32/ebp @@ -34,7 +34,7 @@ $enable-screen-type-mode:end: 5d/pop-to-ebp c3/return -screen-size: # -> nrows/eax: int, ncols/ecx: int +real-screen-size: # -> nrows/eax: int, ncols/ecx: int # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -59,7 +59,7 @@ screen-size: # -> nrows/eax: int, ncols/ecx: int 81 4/subop/and %eax 0xffff/imm32 8b/-> *esi 1/r32/ecx c1/shift 5/subop/logical-right %ecx 0x10/imm8 -$screen-size:end: +$real-screen-size:end: # . reclaim locals 81 0/subop/add %esp 0x40/imm32 # . restore registers @@ -72,7 +72,7 @@ $screen-size:end: 5d/pop-to-ebp c3/return -clear-screen: +clear-real-screen: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -81,14 +81,14 @@ clear-screen: (write 2 "[H") (write 2 Esc) (write 2 "[2J") -$clear-screen:end: +$clear-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return # row and col count from the top-left as (1, 1) -move-cursor-on-screen: # row: int, column: int +move-cursor-on-real-screen: # row: int, column: int # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -109,7 +109,7 @@ move-cursor-on-screen: # row: int, column: int (write %ecx "H") # flush (write-stream 2 %ecx) -$move-cursor-on-screen:end: +$move-cursor-on-real-screen:end: # . reclaim locals 81 0/subop/add %esp 0x2c/imm32 # . restore registers @@ -119,19 +119,19 @@ $move-cursor-on-screen:end: 5d/pop-to-ebp c3/return -print-string-to-screen: # s: (addr array byte) +print-string-to-real-screen: # s: (addr array byte) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # (write 2 *(ebp+8)) -$print-string-to-screen:end: +$print-string-to-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return -print-byte-to-screen: # c: byte +print-byte-to-real-screen: # c: byte # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -142,7 +142,7 @@ print-byte-to-screen: # c: byte 68/push 4/imm32/size 89/<- %ecx 4/r32/esp (write 2 %ecx) -$print-byte-to-screen:end: +$print-byte-to-real-screen:end: # . reclaim locals 81 0/subop/add %esp 8/imm32 # . restore registers @@ -152,20 +152,20 @@ $print-byte-to-screen:end: 5d/pop-to-ebp c3/return -print-int32-hex-to-screen: # n: int +print-int32-hex-to-real-screen: # n: int # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # (write-int32-hex-buffered Stdout *(ebp+8)) (flush Stdout) -$print-int32-hex-to-screen:end: +$print-int32-hex-to-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return -reset-formatting-on-screen: +reset-formatting-on-real-screen: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -174,13 +174,13 @@ reset-formatting-on-screen: (write 2 "(B") (write 2 Esc) (write 2 "[m") -$reset-formatting-on-screen:end: +$reset-formatting-on-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return -start-color-on-screen: # fg: int, bg: int +start-color-on-real-screen: # fg: int, bg: int # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -205,7 +205,7 @@ start-color-on-screen: # fg: int, bg: int (write %ecx "m") # flush (write-stream 2 %ecx) -$start-color-on-screen:end: +$start-color-on-real-screen:end: # . reclaim locals 81 0/subop/add %esp 0x2c/imm32 # . restore registers @@ -215,73 +215,73 @@ $start-color-on-screen:end: 5d/pop-to-ebp c3/return -start-bold-on-screen: +start-bold-on-real-screen: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # (write 2 Esc) (write 2 "[1m") -$start-bold-on-screen:end: +$start-bold-on-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return -start-underline-on-screen: +start-underline-on-real-screen: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # (write 2 Esc) (write 2 "[4m") -$start-underline-on-screen:end: +$start-underline-on-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return -start-reverse-video-on-screen: +start-reverse-video-on-real-screen: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # (write 2 Esc) (write 2 "[7m") -$start-reverse-video-on-screen:end: +$start-reverse-video-on-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return # might require enabling blinking in your terminal program -start-blinking-on-screen: +start-blinking-on-real-screen: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # (write 2 Esc) (write 2 "[5m") -$start-blinking-on-screen:end: +$start-blinking-on-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return -hide-cursor-on-screen: +hide-cursor-on-real-screen: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # (write 2 Esc) (write 2 "[?25l") -$hide-cursor-on-screen:end: +$hide-cursor-on-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return -show-cursor-on-screen: +show-cursor-on-real-screen: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -290,7 +290,7 @@ show-cursor-on-screen: (write 2 "[?12l") (write 2 Esc) (write 2 "[?25h") -$show-cursor-on-screen:end: +$show-cursor-on-real-screen:end: # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp diff --git a/400.mu b/400.mu index bf63e87c..9e8c4bc7 100644 --- a/400.mu +++ b/400.mu @@ -116,8 +116,8 @@ sig emit out: (addr buffered-file), word: (addr slice), width: int #sig get-or-insert table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T) #sig get-or-insert-handle table: (addr stream {(handle array byte), T}), key: (handle array byte), row-size: int -> result/eax: (addr T) #sig get-or-insert-slice table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T) -#sig get-or-stop table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, -#sig get-slice-or-stop table: (addr stream {(handle array byte), _}), key: (addr slice), row-size: int, +#sig get-or-stop table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int +#sig get-slice-or-stop table: (addr stream {(handle array byte), _}), key: (addr slice), row-size: int #sig maybe-get table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int -> result/eax: (addr T) #sig maybe-get-slice table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int -> result/eax: (addr T) sig slurp f: (addr buffered-file), s: (addr stream byte) @@ -138,20 +138,20 @@ sig kernel-string-to-string ad: (addr allocation-descriptor), in: (addr kernel-s sig kernel-string-length in: (addr kernel-string) -> result/eax: int sig enable-screen-grid-mode sig enable-screen-type-mode -sig screen-size -> nrows/eax: int, ncols/ecx: int -sig clear-screen -sig move-cursor-on-screen row: int, column: int -sig print-string-to-screen s: (addr array byte) -sig print-byte-to-screen c: byte -sig print-int32-hex-to-screen n: int -sig reset-formatting-on-screen -sig start-color-on-screen fg: int, bg: int -sig start-bold-on-screen -sig start-underline-on-screen -sig start-reverse-video-on-screen -sig start-blinking-on-screen -sig hide-cursor-on-screen -sig show-cursor-on-screen +sig real-screen-size -> nrows/eax: int, ncols/ecx: int +sig clear-real-screen +sig move-cursor-on-real-screen row: int, column: int +sig print-string-to-real-screen s: (addr array byte) +sig print-byte-to-real-screen c: byte +sig print-int32-hex-to-real-screen n: int +sig reset-formatting-on-real-screen +sig start-color-on-real-screen fg: int, bg: int +sig start-bold-on-real-screen +sig start-underline-on-real-screen +sig start-reverse-video-on-real-screen +sig start-blinking-on-real-screen +sig hide-cursor-on-real-screen +sig show-cursor-on-real-screen sig enable-keyboard-immediate-mode sig enable-keyboard-type-mode sig read-key -> result/eax: byte diff --git a/404screen.mu b/404screen.mu new file mode 100644 index 00000000..5261679b --- /dev/null +++ b/404screen.mu @@ -0,0 +1,263 @@ +# Wrappers for real screen primitives that can be passed in a fake screen. + +type screen { + num-rows: int + num-cols: int + data: (handle array screen-cell) + pending-scroll?: boolean + top-index: int + cursor-row: int + cursor-col: int + cursor-hide?: boolean + curr-attributes: screen-cell +} + +type screen-cell { + color: int + background-color: int + bold?: boolean + underline?: boolean + reverse?: boolean + blink?: boolean +} + +fn initialize-screen screen: (addr screen), nrows: int, ncols: int { + var screen-addr/esi: (addr screen) <- copy screen + var tmp/eax: int <- copy 0 + var dest/edi: (addr int) <- copy 0 + # screen->num-rows = nrows + dest <- get screen-addr, num-rows + tmp <- copy nrows + copy-to *dest, tmp + # screen->num-cols = ncols + dest <- get screen-addr, num-cols + tmp <- copy ncols + copy-to *dest, tmp + # screen->data = new screen-cell[nrows*ncols] + { + var data-addr/edi: (addr handle array screen-cell) <- get screen-addr, data + tmp <- multiply nrows + populate data-addr, tmp + } + # screen->cursor-row = 1 + dest <- get screen-addr, cursor-row + copy-to *dest, 1 + # screen->cursor-col = 1 + dest <- get screen-addr, cursor-col + copy-to *dest, 1 +} + +fn screen-size screen: (addr screen) -> nrows/eax: int, ncols/ecx: int { +$screen-size:body: { + compare screen, 0 + { + break-if-!= + nrows, ncols <- real-screen-size + break $screen-size:body + } + { + break-if-= + # fake screen + var screen-addr/esi: (addr screen) <- copy screen + var tmp/edx: (addr int) <- get screen-addr, num-rows + nrows <- copy *tmp + tmp <- get screen-addr, num-cols + ncols <- copy *tmp + } +} +} + +fn clear-screen screen: (addr screen) { +$clear-screen:body: { + compare screen, 0 + { + break-if-!= + clear-real-screen + break $clear-screen:body + } + { + break-if-= + # fake screen + } +} +} + +fn move-cursor screen: (addr screen), row: int, column: int { +$move-cursor:body: { + compare screen, 0 + { + break-if-!= + move-cursor-on-real-screen row, column + break $move-cursor:body + } + { + break-if-= + # fake screen + } +} +} + +fn print-string screen: (addr screen), s: (addr array byte) { +$print-string:body: { + compare screen, 0 + { + break-if-!= + print-string-to-real-screen s + break $print-string:body + } + { + break-if-= + # fake screen + } +} +} + +fn print-byte screen: (addr screen), c: byte { +$print-byte:body: { + compare screen, 0 + { + break-if-!= + print-byte-to-real-screen c + break $print-byte:body + } + { + break-if-= + # fake screen + } +} +} + +fn print-int32-hex screen: (addr screen), n: int { +$print-int32-hex:body: { + compare screen, 0 + { + break-if-!= + print-int32-hex-to-real-screen n + break $print-int32-hex:body + } + { + break-if-= + # fake screen + } +} +} + +fn reset-formatting screen: (addr screen) { +$reset-formatting:body: { + compare screen, 0 + { + break-if-!= + reset-formatting-on-real-screen + break $reset-formatting:body + } + { + break-if-= + # fake screen + } +} +} + +fn start-color screen: (addr screen), fg: int, bg: int { +$start-color:body: { + compare screen, 0 + { + break-if-!= + start-color-on-real-screen fg, bg + break $start-color:body + } + { + break-if-= + # fake screen + } +} +} + +fn start-bold screen: (addr screen) { +$start-bold:body: { + compare screen, 0 + { + break-if-!= + start-bold-on-real-screen + break $start-bold:body + } + { + break-if-= + # fake screen + } +} +} + +fn start-underline screen: (addr screen) { +$start-underline:body: { + compare screen, 0 + { + break-if-!= + start-underline-on-real-screen + break $start-underline:body + } + { + break-if-= + # fake screen + } +} +} + +fn start-reverse-video screen: (addr screen) { +$start-reverse-video:body: { + compare screen, 0 + { + break-if-!= + start-reverse-video-on-real-screen + break $start-reverse-video:body + } + { + break-if-= + # fake screen + } +} +} + +fn start-blinking screen: (addr screen) { +$start-blinking:body: { + compare screen, 0 + { + break-if-!= + start-blinking-on-real-screen + break $start-blinking:body + } + { + break-if-= + # fake screen + } +} +} + +fn hide-cursor screen: (addr screen) { +$hide-cursor:body: { + compare screen, 0 + { + break-if-!= + hide-cursor-on-real-screen + break $hide-cursor:body + } + { + break-if-= + # fake screen + } +} +} + +fn show-cursor screen: (addr screen) { +$show-cursor:body: { + compare screen, 0 + { + break-if-!= + show-cursor-on-real-screen + break $show-cursor:body + } + { + break-if-= + # fake screen + } +} +} diff --git a/apps/arith.mu b/apps/arith.mu index 5f7ec492..ebc9850c 100644 --- a/apps/arith.mu +++ b/apps/arith.mu @@ -35,19 +35,19 @@ fn main -> exit-status/ebx: int { var look/esi: byte <- copy 0 # lookahead var n/eax: int <- copy 0 # result of each expression - print-string-to-screen "press ctrl-c or ctrl-d to exit\n" + print-string 0, "press ctrl-c or ctrl-d to exit\n" # read-eval-print loop { # print prompt - print-string-to-screen "> " + print-string 0, "> " # read and eval n, look <- simplify # we explicitly thread 'look' everywhere # if (look == 0) break compare look, 0 break-if-= # print - print-int32-hex-to-screen n - print-string-to-screen "\n" + print-int32-hex 0, n + print-string 0, "\n" # loop } @@ -249,7 +249,7 @@ fn get-char -> look/esi: byte { compare look, 0 { break-if-!= - print-string-to-screen "^D\n" + print-string 0, "^D\n" syscall_exit } } diff --git a/apps/browse.mu b/apps/browse.mu index 70c9ca86..77ff999c 100644 --- a/apps/browse.mu +++ b/apps/browse.mu @@ -30,7 +30,7 @@ fn main args-on-stack: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -65,7 +65,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int { var leftcol/edx: int <- copy 5 # page-margin var rightcol/ebx: int <- copy leftcol rightcol <- add 0x40 # page-width = 64 characters - start-color-on-screen 0xec, 7 # 236 = darkish gray + start-color 0, 0xec, 7 # 236 = darkish gray { compare rightcol, ncols break-if->= @@ -86,7 +86,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= @@ -96,7 +96,7 @@ $line-loop: { update-attributes c, r compare c, 0xa # newline break-if-= # no need to print newlines - print-byte-to-screen c + print-byte 0, c col <- increment loop } @@ -116,7 +116,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 0 && c == '*' - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $update-attributes:check-state } @@ -124,7 +124,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 0 && c == '_' - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $update-attributes:check-state } @@ -136,7 +136,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 1 && c == '*' - reset-formatting-on-screen + reset-formatting 0 copy-to *state, 0 break $update-attributes:check-state } @@ -144,7 +144,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 1 && c == '_' - reset-formatting-on-screen + reset-formatting 0 copy-to *state, 0 break $update-attributes:check-state } @@ -159,11 +159,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -176,6 +176,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/apps/parse-int.mu b/apps/parse-int.mu index d8ae87e0..8ad6074f 100644 --- a/apps/parse-int.mu +++ b/apps/parse-int.mu @@ -14,7 +14,7 @@ $main-body: { compare n, 1 { break-if-> - print-string-to-screen "usage: parse-int \n" + print-string 0, "usage: parse-int \n" exit-status <- copy 1 break $main-body } diff --git a/apps/print-file.mu b/apps/print-file.mu index 0fb21132..aed4579d 100644 --- a/apps/print-file.mu +++ b/apps/print-file.mu @@ -14,7 +14,7 @@ $main-body: { compare n, 1 { break-if-> - print-string-to-screen "usage: cat \n" + print-string 0, "usage: cat \n" break $main-body } { @@ -31,7 +31,7 @@ $main-body: { var c/eax: byte <- read-byte-buffered in-addr compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } } diff --git a/apps/tui.mu b/apps/tui.mu index d65e3518..9a2a3bc1 100644 --- a/apps/tui.mu +++ b/apps/tui.mu @@ -7,28 +7,28 @@ fn main -> exit-status/ebx: int { var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-screen-grid-mode - move-cursor-on-screen 5, 0x22 - start-color-on-screen 1, 0x7a - start-blinking-on-screen - print-string-to-screen "Hello world!" - reset-formatting-on-screen - move-cursor-on-screen 6, 0x22 - print-string-to-screen "tty dimensions: " - print-int32-hex-to-screen nrows - print-string-to-screen " rows, " - print-int32-hex-to-screen ncols - print-string-to-screen " rows\n" + move-cursor 0, 5, 0x22 + start-color 0, 1, 0x7a + start-blinking 0 + print-string 0, "Hello world!" + reset-formatting 0 + move-cursor 0, 6, 0x22 + print-string 0, "tty dimensions: " + print-int32-hex 0, nrows + print-string 0, " rows, " + print-int32-hex 0, ncols + print-string 0, " rows\n" - print-string-to-screen "press a key to see its code: " + print-string 0, "press a key to see its code: " enable-keyboard-immediate-mode var x/eax: byte <- read-key enable-keyboard-type-mode enable-screen-type-mode - print-string-to-screen "You pressed " + print-string 0, "You pressed " var x-int/eax: int <- copy x - print-int32-hex-to-screen x-int - print-string-to-screen "\n" + print-int32-hex 0, x-int + print-string 0, "\n" exit-status <- copy 0 } diff --git a/prototypes/browse/1-print-file.mu b/prototypes/browse/1-print-file.mu index 58e65171..e89f1cec 100644 --- a/prototypes/browse/1-print-file.mu +++ b/prototypes/browse/1-print-file.mu @@ -26,7 +26,7 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } } diff --git a/prototypes/browse/10.mu b/prototypes/browse/10.mu index cd0f748b..834fec90 100644 --- a/prototypes/browse/10.mu +++ b/prototypes/browse/10.mu @@ -9,7 +9,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -44,7 +44,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int { var leftcol/edx: int <- copy 5 # page-margin var rightcol/ebx: int <- copy leftcol rightcol <- add 0x40 # page-width = 64 characters - start-color-on-screen 0xec, 7 # 236 = darkish gray + start-color 0, 0xec, 7 # 236 = darkish gray { compare rightcol, ncols break-if->= @@ -64,7 +64,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= @@ -75,7 +75,7 @@ $line-loop: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -95,7 +95,7 @@ $check-state: { { break-if-!= # r->current-state == 0 && c == '*' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $check-state } @@ -103,7 +103,7 @@ $check-state: { { break-if-!= # r->current-state == 0 && c == '_' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $check-state } @@ -115,7 +115,7 @@ $check-state: { { break-if-!= # r->current-state == 1 && c == '*' => normal text - reset-formatting-on-screen + reset-formatting 0 copy-to *state, 0 break $check-state } @@ -123,7 +123,7 @@ $check-state: { { break-if-!= # r->current-state == 1 && c == '_' => normal text - reset-formatting-on-screen + reset-formatting 0 copy-to *state, 0 break $check-state } @@ -138,11 +138,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -171,6 +171,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/11.mu b/prototypes/browse/11.mu index b4fa36ce..73e1b21e 100644 --- a/prototypes/browse/11.mu +++ b/prototypes/browse/11.mu @@ -7,7 +7,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -42,7 +42,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int { var leftcol/edx: int <- copy 5 # page-margin var rightcol/ebx: int <- copy leftcol rightcol <- add 0x40 # page-width = 64 characters - start-color-on-screen 0xec, 7 # 236 = darkish gray + start-color 0, 0xec, 7 # 236 = darkish gray { compare rightcol, ncols break-if->= @@ -64,7 +64,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col $char-loop: { compare col, rightcol break-if->= @@ -79,7 +79,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 0 && c == '*' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $update-attributes:check-state } @@ -87,7 +87,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 0 && c == '_' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $update-attributes:check-state } @@ -99,8 +99,8 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 1 && c == '*' => normal text - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 break $update-attributes:check-state } @@ -108,8 +108,8 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 1 && c == '_' => normal text - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 break $update-attributes:check-state } @@ -119,7 +119,7 @@ $update-attributes:check-state: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -134,11 +134,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -167,6 +167,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/12.mu b/prototypes/browse/12.mu index a8ba3f99..ec93564c 100644 --- a/prototypes/browse/12.mu +++ b/prototypes/browse/12.mu @@ -6,7 +6,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -41,7 +41,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int { var leftcol/edx: int <- copy 5 # page-margin var rightcol/ebx: int <- copy leftcol rightcol <- add 0x40 # page-width = 64 characters - start-color-on-screen 0xec, 7 # 236 = darkish gray + start-color 0, 0xec, 7 # 236 = darkish gray { compare rightcol, ncols break-if->= @@ -63,7 +63,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col $char-loop: { compare col, rightcol break-if->= @@ -78,7 +78,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 0 && c == '*' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $update-attributes:check-state } @@ -86,7 +86,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 0 && c == '_' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $update-attributes:check-state } @@ -98,10 +98,10 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 1 && c == '*' => print c, then normal text - print-byte-to-screen c + print-byte 0, c col <- increment - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 loop $char-loop } @@ -109,10 +109,10 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 1 && c == '_' => print c, then normal text - print-byte-to-screen c + print-byte 0, c col <- increment - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 loop $char-loop } @@ -122,7 +122,7 @@ $update-attributes:check-state: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -137,11 +137,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -170,6 +170,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/13.mu b/prototypes/browse/13.mu index 48e9c112..c0371954 100644 --- a/prototypes/browse/13.mu +++ b/prototypes/browse/13.mu @@ -6,7 +6,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -41,7 +41,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int { var leftcol/edx: int <- copy 5 # page-margin var rightcol/ebx: int <- copy leftcol rightcol <- add 0x40 # page-width = 64 characters - start-color-on-screen 0xec, 7 # 236 = darkish gray + start-color 0, 0xec, 7 # 236 = darkish gray { compare rightcol, ncols break-if->= @@ -63,7 +63,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col $char-loop: { compare col, rightcol break-if->= @@ -78,7 +78,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 0 && c == '*' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $update-attributes:check-state } @@ -86,7 +86,7 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 0 && c == '_' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $update-attributes:check-state } @@ -99,10 +99,10 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 1 && c == '*' => print c, then normal text - print-byte-to-screen c + print-byte 0, c col <- increment - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 loop $char-loop } @@ -110,10 +110,10 @@ $update-attributes:check-state: { { break-if-!= # r->current-state == 1 && c == '_' => print c, then normal text - print-byte-to-screen c + print-byte 0, c col <- increment - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 loop $char-loop } @@ -123,7 +123,7 @@ $update-attributes:check-state: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -138,11 +138,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -171,6 +171,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/14.mu b/prototypes/browse/14.mu index 9bcc3751..0ad5d5c3 100644 --- a/prototypes/browse/14.mu +++ b/prototypes/browse/14.mu @@ -4,7 +4,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -39,7 +39,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int { var leftcol/edx: int <- copy 5 # page-margin var rightcol/ebx: int <- copy leftcol rightcol <- add 0x40 # page-width = 64 characters - start-color-on-screen 0xec, 7 # 236 = darkish gray + start-color 0, 0xec, 7 # 236 = darkish gray { compare rightcol, ncols break-if->= @@ -61,7 +61,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col $char-loop: { compare col, rightcol break-if->= @@ -76,7 +76,7 @@ $change-state: { { break-if-!= # r->current-state == 0 && c == '*' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $change-state } @@ -84,7 +84,7 @@ $change-state: { { break-if-!= # r->current-state == 0 && c == '_' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $change-state } @@ -97,10 +97,10 @@ $change-state: { { break-if-!= # r->current-state == 1 && c == '*' => print c, then normal text - print-byte-to-screen c + print-byte 0, c col <- increment - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 loop $char-loop } @@ -108,10 +108,10 @@ $change-state: { { break-if-!= # r->current-state == 1 && c == '_' => print c, then normal text - print-byte-to-screen c + print-byte 0, c col <- increment - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 loop $char-loop } @@ -121,7 +121,7 @@ $change-state: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -136,11 +136,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -169,6 +169,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/15-headers-broken.mu b/prototypes/browse/15-headers-broken.mu index 59566e56..c9c722e4 100644 --- a/prototypes/browse/15-headers-broken.mu +++ b/prototypes/browse/15-headers-broken.mu @@ -9,7 +9,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -49,7 +49,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int { var leftcol/edx: int <- copy 5 # page-margin var rightcol/ebx: int <- copy leftcol rightcol <- add 0x40 # page-width = 64 characters - start-color-on-screen 0xec, 7 # 236 = darkish gray + start-color 0, 0xec, 7 # 236 = darkish gray { compare rightcol, ncols break-if->= @@ -71,7 +71,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col $char-loop: { compare col, rightcol break-if->= @@ -86,7 +86,7 @@ $change-state: { { break-if-!= # r->current-state == 0 && c == '*' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $change-state } @@ -94,7 +94,7 @@ $change-state: { { break-if-!= # r->current-state == 0 && c == '_' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 break $change-state } @@ -121,10 +121,10 @@ $change-state: { { break-if-!= # r->current-state == 1 && c == '*' => print c, then normal text - print-byte-to-screen c + print-byte 0, c col <- increment - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 loop $char-loop } @@ -132,10 +132,10 @@ $change-state: { { break-if-!= # r->current-state == 1 && c == '_' => print c, then normal text - print-byte-to-screen c + print-byte 0, c col <- increment - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray copy-to *state, 0 loop $char-loop } @@ -150,8 +150,8 @@ $change-state: { var s/eax: (addr boolean) <- get r, start-of-line? copy-to *s, 1 # true # switch to normal text - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray # no need to print newlines break $char-loop } @@ -163,7 +163,7 @@ $change-state: { copy-to *s, 0 # false } # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } @@ -178,11 +178,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -211,6 +211,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/16-screen-state-broken.mu b/prototypes/browse/16-screen-state-broken.mu index d0817bdf..3ea359f2 100644 --- a/prototypes/browse/16-screen-state-broken.mu +++ b/prototypes/browse/16-screen-state-broken.mu @@ -26,7 +26,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-keyboard-immediate-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 var screen-position-state-storage: screen-position-state var screen-position-state: (addr screen-position-state) init-screen-position-state screen-position-state, nrows, ncols @@ -68,8 +68,8 @@ fn render-normal in: (addr buffered-file), state: (addr screen-position-state) { # if (c == EOF) break compare c, 0xffffffff # EOF marker break-if-= - # if (c == '*') start-bold-on-screen, render-until-asterisk(in, state), reset - # else if (c == '_') start-bold-on-screen, render-until-underscore(in, state), reset + # if (c == '*') start-bold 0,, render-until-asterisk(in, state), reset + # else if (c == '_') start-bold 0,, render-until-underscore(in, state), reset # else if (c == '#') compute-color, start color, render-header-line(in, state), reset # else add-char(state, c) } @@ -183,6 +183,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/17-file-state-broken/file-state.mu b/prototypes/browse/17-file-state-broken/file-state.mu index 66b8c6c4..cf39e9d8 100644 --- a/prototypes/browse/17-file-state-broken/file-state.mu +++ b/prototypes/browse/17-file-state-broken/file-state.mu @@ -28,6 +28,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/17-file-state-broken/main.mu b/prototypes/browse/17-file-state-broken/main.mu index 44eccc2e..a273c0fe 100644 --- a/prototypes/browse/17-file-state-broken/main.mu +++ b/prototypes/browse/17-file-state-broken/main.mu @@ -10,7 +10,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { # initialize screen state from screen size var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 var screen-position-state-storage: screen-position-state var screen-position-state: (addr screen-position-state) init-screen-position-state screen-position-state, nrows, ncols @@ -44,8 +44,8 @@ fn render-normal fs: (addr file-state), state: (addr screen-position-state) { # if (c == EOF) break compare c, 0xffffffff # EOF marker break-if-= - # if (c == '*') start-bold-on-screen, render-until-asterisk(fs, state), reset - # else if (c == '_') start-bold-on-screen, render-until-underscore(fs, state), reset + # if (c == '*') start-bold 0,, render-until-asterisk(fs, state), reset + # else if (c == '_') start-bold 0,, render-until-underscore(fs, state), reset # else if (c == '#' and fs is at start of line) compute-color, start color, render-header-line(fs, state), reset # else add-char(state, c) } diff --git a/prototypes/browse/18/file-state.mu b/prototypes/browse/18/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/18/file-state.mu +++ b/prototypes/browse/18/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/18/main.mu b/prototypes/browse/18/main.mu index 21e3f0c7..4320a460 100644 --- a/prototypes/browse/18/main.mu +++ b/prototypes/browse/18/main.mu @@ -19,7 +19,7 @@ fn render-normal fs: (addr file-state) { compare c, 0xffffffff # EOF marker break-if-= # - print-byte-to-screen c + print-byte 0, c # loop } diff --git a/prototypes/browse/19/file-state.mu b/prototypes/browse/19/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/19/file-state.mu +++ b/prototypes/browse/19/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/19/screen-position-state.mu b/prototypes/browse/19/screen-position-state.mu index 99d51a4a..543f1871 100644 --- a/prototypes/browse/19/screen-position-state.mu +++ b/prototypes/browse/19/screen-position-state.mu @@ -18,7 +18,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -63,7 +63,7 @@ fn start-drawing _self: (addr screen-position-state) { fn add-char _self: (addr screen-position-state), c: byte { var self/esi: (addr screen-position-state) <- copy _self # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -131,5 +131,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/2.mu b/prototypes/browse/2.mu index 0c31e82a..52245b6c 100644 --- a/prototypes/browse/2.mu +++ b/prototypes/browse/2.mu @@ -25,7 +25,7 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } } diff --git a/prototypes/browse/20/file-state.mu b/prototypes/browse/20/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/20/file-state.mu +++ b/prototypes/browse/20/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/20/screen-position-state.mu b/prototypes/browse/20/screen-position-state.mu index 187b81b6..41ad2705 100644 --- a/prototypes/browse/20/screen-position-state.mu +++ b/prototypes/browse/20/screen-position-state.mu @@ -18,7 +18,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -71,7 +71,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -140,5 +140,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/21/file-state.mu b/prototypes/browse/21/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/21/file-state.mu +++ b/prototypes/browse/21/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/21/screen-position-state.mu b/prototypes/browse/21/screen-position-state.mu index 841b70d8..2316d3ae 100644 --- a/prototypes/browse/21/screen-position-state.mu +++ b/prototypes/browse/21/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -70,7 +70,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -139,5 +139,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/22/file-state.mu b/prototypes/browse/22/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/22/file-state.mu +++ b/prototypes/browse/22/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/22/screen-position-state.mu b/prototypes/browse/22/screen-position-state.mu index 2201e019..245f834e 100644 --- a/prototypes/browse/22/screen-position-state.mu +++ b/prototypes/browse/22/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -70,7 +70,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -159,5 +159,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/23-multiple-pages/file-state.mu b/prototypes/browse/23-multiple-pages/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/23-multiple-pages/file-state.mu +++ b/prototypes/browse/23-multiple-pages/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/23-multiple-pages/screen-position-state.mu b/prototypes/browse/23-multiple-pages/screen-position-state.mu index a8faf9fd..6fe1ad93 100644 --- a/prototypes/browse/23-multiple-pages/screen-position-state.mu +++ b/prototypes/browse/23-multiple-pages/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var tmp/eax: (addr int) <- copy 0 var tmp2/ecx: int <- copy 0 - clear-screen + clear-screen 0 # self->leftcol = page-margin tmp <- get self, leftcol copy-to *tmp, 5 # left-margin @@ -71,7 +71,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -160,5 +160,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/24-bold/file-state.mu b/prototypes/browse/24-bold/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/24-bold/file-state.mu +++ b/prototypes/browse/24-bold/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/24-bold/main.mu b/prototypes/browse/24-bold/main.mu index 2362e695..393eb29f 100644 --- a/prototypes/browse/24-bold/main.mu +++ b/prototypes/browse/24-bold/main.mu @@ -43,7 +43,7 @@ $render-normal:body: { compare c, 0x2a # '*' { break-if-!= - start-bold-on-screen + start-bold 0 render-until-asterisk fs, state normal-text loop $render-normal:body @@ -52,11 +52,11 @@ $render-normal:body: { compare c, 0x5f # '_' { break-if-!= - start-color-on-screen 0xec, 7 # 236 = darkish gray - start-bold-on-screen + start-color 0, 0xec, 7 # 236 = darkish gray + start-bold 0 render-until-underscore fs, state - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray loop $render-normal:body } # @@ -115,6 +115,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr } fn normal-text { - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray } diff --git a/prototypes/browse/24-bold/screen-position-state.mu b/prototypes/browse/24-bold/screen-position-state.mu index a8faf9fd..6fe1ad93 100644 --- a/prototypes/browse/24-bold/screen-position-state.mu +++ b/prototypes/browse/24-bold/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var tmp/eax: (addr int) <- copy 0 var tmp2/ecx: int <- copy 0 - clear-screen + clear-screen 0 # self->leftcol = page-margin tmp <- get self, leftcol copy-to *tmp, 5 # left-margin @@ -71,7 +71,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -160,5 +160,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/25-soft-newlines/file-state.mu b/prototypes/browse/25-soft-newlines/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/25-soft-newlines/file-state.mu +++ b/prototypes/browse/25-soft-newlines/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/25-soft-newlines/main.mu b/prototypes/browse/25-soft-newlines/main.mu index ef1a898f..af19faa2 100644 --- a/prototypes/browse/25-soft-newlines/main.mu +++ b/prototypes/browse/25-soft-newlines/main.mu @@ -87,7 +87,7 @@ $render-normal:flush-buffered-newline: { compare c, 0x2a # '*' { break-if-!= - start-bold-on-screen + start-bold 0 render-until-asterisk fs, state normal-text loop $render-normal:loop @@ -96,11 +96,11 @@ $render-normal:flush-buffered-newline: { compare c, 0x5f # '_' { break-if-!= - start-color-on-screen 0xec, 7 # 236 = darkish gray - start-bold-on-screen + start-color 0, 0xec, 7 # 236 = darkish gray + start-bold 0 render-until-underscore fs, state - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray loop $render-normal:loop } # @@ -159,6 +159,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr } fn normal-text { - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray } diff --git a/prototypes/browse/25-soft-newlines/screen-position-state.mu b/prototypes/browse/25-soft-newlines/screen-position-state.mu index afaf713e..dec8b502 100644 --- a/prototypes/browse/25-soft-newlines/screen-position-state.mu +++ b/prototypes/browse/25-soft-newlines/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0xa var ncols/ecx: int <- copy 0x20 - nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. + nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var tmp/eax: (addr int) <- copy 0 var tmp2/ecx: int <- copy 0 - clear-screen + clear-screen 0 # self->leftcol = page-margin tmp <- get self, leftcol copy-to *tmp, 5 # left-margin @@ -72,7 +72,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/26-headers/file-state.mu b/prototypes/browse/26-headers/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/26-headers/file-state.mu +++ b/prototypes/browse/26-headers/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/26-headers/main.mu b/prototypes/browse/26-headers/main.mu index 68b662bf..b87f1416 100644 --- a/prototypes/browse/26-headers/main.mu +++ b/prototypes/browse/26-headers/main.mu @@ -96,7 +96,7 @@ $render-normal:flush-buffered-newline: { compare c, 0x2a # '*' { break-if-!= - start-bold-on-screen + start-bold 0 render-until-asterisk fs, state normal-text loop $render-normal:loop @@ -105,11 +105,11 @@ $render-normal:flush-buffered-newline: { compare c, 0x5f # '_' { break-if-!= - start-color-on-screen 0xec, 7 # 236 = darkish gray - start-bold-on-screen + start-color 0, 0xec, 7 # 236 = darkish gray + start-bold 0 render-until-underscore fs, state - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray loop $render-normal:loop } # @@ -169,32 +169,32 @@ $render-header-line:body: { # colors for a light background, going from bright to dark (meeting up with bold-text) fn start-heading header-level: int { $start-heading:body: { - start-bold-on-screen + start-bold 0 compare header-level, 1 { break-if-!= - start-color-on-screen 0xa0, 7 + start-color 0, 0xa0, 7 break $start-heading:body } compare header-level, 2 { break-if-!= - start-color-on-screen 0x7c, 7 + start-color 0, 0x7c, 7 break $start-heading:body } compare header-level, 3 { break-if-!= - start-color-on-screen 0x58, 7 + start-color 0, 0x58, 7 break $start-heading:body } compare header-level, 4 { break-if-!= - start-color-on-screen 0x34, 7 + start-color 0, 0x34, 7 break $start-heading:body } - start-color-on-screen 0xe8, 7 + start-color 0, 0xe8, 7 } } @@ -247,6 +247,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr } fn normal-text { - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray } diff --git a/prototypes/browse/26-headers/screen-position-state.mu b/prototypes/browse/26-headers/screen-position-state.mu index afaf713e..dec8b502 100644 --- a/prototypes/browse/26-headers/screen-position-state.mu +++ b/prototypes/browse/26-headers/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0xa var ncols/ecx: int <- copy 0x20 - nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. + nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var tmp/eax: (addr int) <- copy 0 var tmp2/ecx: int <- copy 0 - clear-screen + clear-screen 0 # self->leftcol = page-margin tmp <- get self, leftcol copy-to *tmp, 5 # left-margin @@ -72,7 +72,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/27/file-state.mu b/prototypes/browse/27/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/27/file-state.mu +++ b/prototypes/browse/27/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/27/main.mu b/prototypes/browse/27/main.mu index 8f698454..9d578ccc 100644 --- a/prototypes/browse/27/main.mu +++ b/prototypes/browse/27/main.mu @@ -103,7 +103,7 @@ $render-normal:flush-buffered-newline: { compare c, 0x2a # '*' { break-if-!= - start-bold-on-screen + start-bold 0 render-until-asterisk fs, state normal-text loop $render-normal:loop @@ -112,11 +112,11 @@ $render-normal:flush-buffered-newline: { compare c, 0x5f # '_' { break-if-!= - start-color-on-screen 0xec, 7 # 236 = darkish gray - start-bold-on-screen + start-color 0, 0xec, 7 # 236 = darkish gray + start-bold 0 render-until-underscore fs, state - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray loop $render-normal:loop } # @@ -176,32 +176,32 @@ $render-header-line:body: { # colors for a light background, going from bright to dark (meeting up with bold-text) fn start-heading header-level: int { $start-heading:body: { - start-bold-on-screen + start-bold 0 compare header-level, 1 { break-if-!= - start-color-on-screen 0xa0, 7 + start-color 0, 0xa0, 7 break $start-heading:body } compare header-level, 2 { break-if-!= - start-color-on-screen 0x7c, 7 + start-color 0, 0x7c, 7 break $start-heading:body } compare header-level, 3 { break-if-!= - start-color-on-screen 0x58, 7 + start-color 0, 0x58, 7 break $start-heading:body } compare header-level, 4 { break-if-!= - start-color-on-screen 0x34, 7 + start-color 0, 0x34, 7 break $start-heading:body } - start-color-on-screen 0xe8, 7 + start-color 0, 0xe8, 7 } } @@ -254,6 +254,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr } fn normal-text { - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray } diff --git a/prototypes/browse/27/screen-position-state.mu b/prototypes/browse/27/screen-position-state.mu index afaf713e..dec8b502 100644 --- a/prototypes/browse/27/screen-position-state.mu +++ b/prototypes/browse/27/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0xa var ncols/ecx: int <- copy 0x20 - nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. + nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var tmp/eax: (addr int) <- copy 0 var tmp2/ecx: int <- copy 0 - clear-screen + clear-screen 0 # self->leftcol = page-margin tmp <- get self, leftcol copy-to *tmp, 5 # left-margin @@ -72,7 +72,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/28/file-state.mu b/prototypes/browse/28/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/28/file-state.mu +++ b/prototypes/browse/28/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/28/main.mu b/prototypes/browse/28/main.mu index f61e80f9..a3e207d2 100644 --- a/prototypes/browse/28/main.mu +++ b/prototypes/browse/28/main.mu @@ -104,7 +104,7 @@ $render-normal:flush-buffered-newline: { compare c, 0x2a # '*' { break-if-!= - start-bold-on-screen + start-bold 0 render-until-asterisk fs, state normal-text break $render-normal:loop-body @@ -113,11 +113,11 @@ $render-normal:flush-buffered-newline: { compare c, 0x5f # '_' { break-if-!= - start-color-on-screen 0xec, 7 # 236 = darkish gray - start-bold-on-screen + start-color 0, 0xec, 7 # 236 = darkish gray + start-bold 0 render-until-underscore fs, state - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray break $render-normal:loop-body } # @@ -178,32 +178,32 @@ $render-header-line:body: { # colors for a light background, going from bright to dark (meeting up with bold-text) fn start-heading header-level: int { $start-heading:body: { - start-bold-on-screen + start-bold 0 compare header-level, 1 { break-if-!= - start-color-on-screen 0xa0, 7 + start-color 0, 0xa0, 7 break $start-heading:body } compare header-level, 2 { break-if-!= - start-color-on-screen 0x7c, 7 + start-color 0, 0x7c, 7 break $start-heading:body } compare header-level, 3 { break-if-!= - start-color-on-screen 0x58, 7 + start-color 0, 0x58, 7 break $start-heading:body } compare header-level, 4 { break-if-!= - start-color-on-screen 0x34, 7 + start-color 0, 0x34, 7 break $start-heading:body } - start-color-on-screen 0xe8, 7 + start-color 0, 0xe8, 7 } } @@ -256,6 +256,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr } fn normal-text { - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray } diff --git a/prototypes/browse/28/screen-position-state.mu b/prototypes/browse/28/screen-position-state.mu index afaf713e..dec8b502 100644 --- a/prototypes/browse/28/screen-position-state.mu +++ b/prototypes/browse/28/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0xa var ncols/ecx: int <- copy 0x20 - nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. + nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var tmp/eax: (addr int) <- copy 0 var tmp2/ecx: int <- copy 0 - clear-screen + clear-screen 0 # self->leftcol = page-margin tmp <- get self, leftcol copy-to *tmp, 5 # left-margin @@ -72,7 +72,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/29/file-state.mu b/prototypes/browse/29/file-state.mu index 0047b2c0..544c7832 100644 --- a/prototypes/browse/29/file-state.mu +++ b/prototypes/browse/29/file-state.mu @@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/29/main.mu b/prototypes/browse/29/main.mu index 067e21ff..748bdaed 100644 --- a/prototypes/browse/29/main.mu +++ b/prototypes/browse/29/main.mu @@ -113,7 +113,7 @@ $render-normal:whitespace-separated-regions: { compare c, 0x2a # '*' { break-if-!= - start-bold-on-screen + start-bold 0 render-until-asterisk fs, state normal-text break $render-normal:loop-body @@ -122,11 +122,11 @@ $render-normal:whitespace-separated-regions: { compare c, 0x5f # '_' { break-if-!= - start-color-on-screen 0xec, 7 # 236 = darkish gray - start-bold-on-screen + start-color 0, 0xec, 7 # 236 = darkish gray + start-bold 0 render-until-underscore fs, state - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray break $render-normal:loop-body } } @@ -188,32 +188,32 @@ $render-header-line:body: { # colors for a light background, going from bright to dark (meeting up with bold-text) fn start-heading header-level: int { $start-heading:body: { - start-bold-on-screen + start-bold 0 compare header-level, 1 { break-if-!= - start-color-on-screen 0xa0, 7 + start-color 0, 0xa0, 7 break $start-heading:body } compare header-level, 2 { break-if-!= - start-color-on-screen 0x7c, 7 + start-color 0, 0x7c, 7 break $start-heading:body } compare header-level, 3 { break-if-!= - start-color-on-screen 0x58, 7 + start-color 0, 0x58, 7 break $start-heading:body } compare header-level, 4 { break-if-!= - start-color-on-screen 0x34, 7 + start-color 0, 0x34, 7 break $start-heading:body } - start-color-on-screen 0xe8, 7 + start-color 0, 0xe8, 7 } } @@ -266,6 +266,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr } fn normal-text { - reset-formatting-on-screen - start-color-on-screen 0xec, 7 # 236 = darkish gray + reset-formatting 0 + start-color 0, 0xec, 7 # 236 = darkish gray } diff --git a/prototypes/browse/29/screen-position-state.mu b/prototypes/browse/29/screen-position-state.mu index afaf713e..dec8b502 100644 --- a/prototypes/browse/29/screen-position-state.mu +++ b/prototypes/browse/29/screen-position-state.mu @@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var nrows/eax: int <- copy 0xa var ncols/ecx: int <- copy 0x20 - nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. + nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below. var dest/edx: (addr int) <- copy 0 # self->nrows = nrows dest <- get self, nrows @@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var tmp/eax: (addr int) <- copy 0 var tmp2/ecx: int <- copy 0 - clear-screen + clear-screen 0 # self->leftcol = page-margin tmp <- get self, leftcol copy-to *tmp, 5 # left-margin @@ -72,7 +72,7 @@ $add-char:body: { break $add-char:body } # print c - print-byte-to-screen c + print-byte 0, c # self->col++ var tmp/eax: (addr int) <- get self, col increment *tmp @@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) { var self/esi: (addr screen-position-state) <- copy _self var r/eax: (addr int) <- get self, row var c/ecx: (addr int) <- get self, col - move-cursor-on-screen *r *c + move-cursor 0, *r *c } diff --git a/prototypes/browse/3.mu b/prototypes/browse/3.mu index b3b731de..297ce470 100644 --- a/prototypes/browse/3.mu +++ b/prototypes/browse/3.mu @@ -24,6 +24,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/4-render-page.mu b/prototypes/browse/4-render-page.mu index 57f6063b..130f17e5 100644 --- a/prototypes/browse/4-render-page.mu +++ b/prototypes/browse/4-render-page.mu @@ -21,7 +21,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= @@ -29,7 +29,7 @@ $line-loop: { compare c, 0xffffffff # EOF marker break-if-= $line-loop # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -44,11 +44,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -76,6 +76,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/5.mu b/prototypes/browse/5.mu index 118325e0..24a323a8 100644 --- a/prototypes/browse/5.mu +++ b/prototypes/browse/5.mu @@ -21,7 +21,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= @@ -31,7 +31,7 @@ $line-loop: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -46,11 +46,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -78,6 +78,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/6.mu b/prototypes/browse/6.mu index 4e1f33db..cb7e55ee 100644 --- a/prototypes/browse/6.mu +++ b/prototypes/browse/6.mu @@ -32,7 +32,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= @@ -42,7 +42,7 @@ $line-loop: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -57,11 +57,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -89,6 +89,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/7.mu b/prototypes/browse/7.mu index 4012eef5..0ea581a4 100644 --- a/prototypes/browse/7.mu +++ b/prototypes/browse/7.mu @@ -4,7 +4,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -36,7 +36,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= @@ -46,7 +46,7 @@ $line-loop: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -61,11 +61,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -94,6 +94,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/8-multiple-pages.mu b/prototypes/browse/8-multiple-pages.mu index c6453d48..e049fd37 100644 --- a/prototypes/browse/8-multiple-pages.mu +++ b/prototypes/browse/8-multiple-pages.mu @@ -4,7 +4,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -52,7 +52,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= @@ -62,7 +62,7 @@ $line-loop: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -77,11 +77,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -110,6 +110,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/browse/9-bold.mu b/prototypes/browse/9-bold.mu index aec805c8..2d7312aa 100644 --- a/prototypes/browse/9-bold.mu +++ b/prototypes/browse/9-bold.mu @@ -4,7 +4,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { enable-screen-grid-mode var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 - nrows, ncols <- screen-size + nrows, ncols <- screen-size 0 enable-keyboard-immediate-mode { render file, nrows, ncols @@ -39,7 +39,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int { var leftcol/edx: int <- copy 5 # page-margin var rightcol/ebx: int <- copy leftcol rightcol <- add 0x40 # page-width = 64 characters - start-color-on-screen 0xec, 7 # 236 = darkish gray + start-color 0, 0xec, 7 # 236 = darkish gray { compare rightcol, ncols break-if->= @@ -59,7 +59,7 @@ $line-loop: { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= @@ -70,7 +70,7 @@ $line-loop: { compare c, 0xa # newline break-if-= # no need to print newlines # print c - print-byte-to-screen c + print-byte 0, c col <- increment loop } # $char-loop @@ -90,7 +90,7 @@ $check-state: { { break-if-!= # r->current-state == 0 && c == '*' => bold text - start-bold-on-screen + start-bold 0 copy-to *state, 1 } break $check-state @@ -101,7 +101,7 @@ $check-state: { { break-if-!= # r->current-state == 1 && c == '*' => normal text - reset-formatting-on-screen + reset-formatting 0 copy-to *state, 0 } } @@ -114,11 +114,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int { compare row, botrow break-if->= var col/edx: int <- copy leftcol - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, rightcol break-if->= - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -147,6 +147,6 @@ fn dump in: (addr buffered-file) { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= - print-byte-to-screen c + print-byte 0, c loop } diff --git a/prototypes/tile/1.mu b/prototypes/tile/1.mu index 42c1f08b..4c0f8a6d 100644 --- a/prototypes/tile/1.mu +++ b/prototypes/tile/1.mu @@ -10,9 +10,9 @@ # https://archive.org/details/akkartik-2min-2020-07-01 fn main -> exit-status/ebx: int { - clear-screen - move-cursor-on-screen 5, 5 - print-string-to-screen "_________" + clear-screen 0 + move-cursor 0, 5, 5 + print-string 0, "_________" enable-keyboard-immediate-mode var dummy/eax: byte <- read-key var row/eax: int <- copy 5 @@ -26,7 +26,7 @@ fn main -> exit-status/ebx: int { } var dummy/eax: byte <- read-key enable-keyboard-type-mode - clear-screen + clear-screen 0 exit-status <- copy 0 } @@ -35,11 +35,11 @@ fn animate row: int { { compare col, 0xe break-if-= - move-cursor-on-screen row, col - print-string-to-screen " " + move-cursor 0, row, col + print-string 0, " " increment row - move-cursor-on-screen row, col - print-string-to-screen "_" + move-cursor 0, row, col + print-string 0, "_" decrement row col <- increment loop diff --git a/prototypes/tile/10.mu b/prototypes/tile/10.mu index a20e50ef..a9a4c85c 100644 --- a/prototypes/tile/10.mu +++ b/prototypes/tile/10.mu @@ -75,7 +75,7 @@ $main:loop: { render root-addr, cursor-addr loop } - clear-screen + clear-screen 0 enable-keyboard-type-mode exit-status <- copy 0 } @@ -199,7 +199,7 @@ fn create-child node: (handle cell) { ####################################################### fn render root: (addr cell), cursor: (addr cell) { - clear-screen + clear-screen 0 var depth/eax: int <- tree-depth root var viewport-width/ecx: int <- copy 0x65 # col2 viewport-width <- subtract 5 # col1 @@ -318,11 +318,11 @@ fn draw-hatching row1: int, col1: int, row2: int, col2: int { fn draw-horizontal-line row: int, col1: int, col2: int { var col/eax: int <- copy col1 - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, col2 break-if->= - print-string-to-screen "-" + print-string 0, "-" col <- increment loop } @@ -333,8 +333,8 @@ fn draw-vertical-line row1: int, row2: int, col: int { { compare row, row2 break-if->= - move-cursor-on-screen row, col - print-string-to-screen "|" + move-cursor 0, row, col + print-string 0, "|" row <- increment loop } @@ -346,8 +346,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # x = next power-of-2 multiple of _dr after _nr var x/ecx: int <- copy 1 { -#? print-int32-hex-to-screen x -#? print-string-to-screen "\n" +#? print-int32-hex 0, x +#? print-string 0, "\n" var tmp/edx: int <- copy _dr tmp <- multiply x compare tmp, _nr @@ -355,7 +355,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { x <- shift-left 1 loop } -#? print-string-to-screen "--\n" +#? print-string 0, "--\n" # min, max = x/2, x var max/ecx: int <- copy x var min/edx: int <- copy max @@ -363,8 +363,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # narrow down result between min and max var i/eax: int <- copy min { -#? print-int32-hex-to-screen i -#? print-string-to-screen "\n" +#? print-int32-hex 0, i +#? print-string 0, "\n" var foo/ebx: int <- copy _dr foo <- multiply i compare foo, _nr @@ -374,9 +374,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { } result <- copy i result <- decrement -#? print-string-to-screen "=> " -#? print-int32-hex-to-screen result -#? print-string-to-screen "\n" +#? print-string 0, "=> " +#? print-int32-hex 0, result +#? print-string 0, "\n" } fn test-try-divide-1 { diff --git a/prototypes/tile/2.mu b/prototypes/tile/2.mu index aa0cd05e..c6daa971 100644 --- a/prototypes/tile/2.mu +++ b/prototypes/tile/2.mu @@ -9,7 +9,7 @@ fn main -> exit-status/ebx: int { var num-lines/ecx: int <- copy 0x10 - clear-screen + clear-screen 0 # open a file var f: (addr buffered-file) { @@ -36,7 +36,7 @@ fn main -> exit-status/ebx: int { enable-keyboard-type-mode } # clean up - clear-screen + clear-screen 0 exit-status <- copy 0 } @@ -48,11 +48,11 @@ $render:clear-loop: { break-if-<= decrement start-row var col/eax: int <- copy 1 - move-cursor-on-screen start-row, col + move-cursor 0, start-row, col { compare col, num-cols break-if-> - print-string-to-screen " " + print-string 0, " " col <- increment loop } @@ -61,7 +61,7 @@ $render:clear-loop: { # render rest of screen below var row/edx: int <- copy start-row var col/ebx: int <- copy 1 - move-cursor-on-screen row, col + move-cursor 0, row, col $render:render-loop: { compare row, num-rows break-if->= @@ -73,10 +73,10 @@ $render:render-loop: { break-if-!= row <- increment col <- copy 0 - move-cursor-on-screen row, col + move-cursor 0, row, col loop $render:render-loop } - print-byte-to-screen c + print-byte 0, c col <- increment loop } diff --git a/prototypes/tile/3.mu b/prototypes/tile/3.mu index 3ee274de..8f234f21 100644 --- a/prototypes/tile/3.mu +++ b/prototypes/tile/3.mu @@ -7,7 +7,7 @@ fn main -> exit-status/ebx: int { var num-lines/ecx: int <- copy 0x64 # 100 - clear-screen + clear-screen 0 # open a file var f: (addr buffered-file) { @@ -36,14 +36,14 @@ fn main -> exit-status/ebx: int { var t3/esi: int <- copy t2 t3 <- subtract t1 # clean up - clear-screen + clear-screen 0 # results - print-int32-hex-to-screen t1 - print-string-to-screen "\n" - print-int32-hex-to-screen t2 - print-string-to-screen "\n" - print-int32-hex-to-screen t3 - print-string-to-screen "\n" + print-int32-hex 0, t1 + print-string 0, "\n" + print-int32-hex 0, t2 + print-string 0, "\n" + print-int32-hex 0, t3 + print-string 0, "\n" # exit-status <- copy 0 } @@ -53,7 +53,7 @@ fn render f: (addr buffered-file), num-rows: int { # render screen var row/edx: int <- copy 1 var col/ebx: int <- copy 1 - move-cursor-on-screen row, col + move-cursor 0, row, col $render:render-loop: { compare row, num-rows break-if->= @@ -65,10 +65,10 @@ $render:render-loop: { break-if-!= row <- increment col <- copy 0 - move-cursor-on-screen row, col + move-cursor 0, row, col loop $render:render-loop } - print-byte-to-screen c + print-byte 0, c col <- increment loop } diff --git a/prototypes/tile/4.mu b/prototypes/tile/4.mu index 660dbfbc..bd2bd77c 100644 --- a/prototypes/tile/4.mu +++ b/prototypes/tile/4.mu @@ -7,7 +7,7 @@ # $ ./a.elf fn main -> exit-status/ebx: int { - clear-screen + clear-screen 0 enable-keyboard-immediate-mode var dummy/eax: byte <- read-key draw-box 5, 5, 0x23, 0x23 # 35, 35 @@ -19,12 +19,12 @@ fn main -> exit-status/ebx: int { draw-box 5, 5, 0x23, 0xaf # 35, 175 var dummy/eax: byte <- read-key enable-keyboard-type-mode - clear-screen + clear-screen 0 exit-status <- copy 0 } fn draw-box row1: int, col1: int, row2: int, col2: int { - clear-screen + clear-screen 0 draw-horizontal-line row1, col1, col2 draw-vertical-line row1, row2, col1 draw-horizontal-line row2, col1, col2 @@ -33,11 +33,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int { fn draw-horizontal-line row: int, col1: int, col2: int { var col/eax: int <- copy col1 - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, col2 break-if->= - print-string-to-screen "-" + print-string 0, "-" col <- increment loop } @@ -48,8 +48,8 @@ fn draw-vertical-line row1: int, row2: int, col: int { { compare row, row2 break-if->= - move-cursor-on-screen row, col - print-string-to-screen "|" + move-cursor 0, row, col + print-string 0, "|" row <- increment loop } diff --git a/prototypes/tile/5.mu b/prototypes/tile/5.mu index c7785df6..941f132e 100644 --- a/prototypes/tile/5.mu +++ b/prototypes/tile/5.mu @@ -41,7 +41,7 @@ $main:loop: { render root-addr loop } - clear-screen + clear-screen 0 enable-keyboard-type-mode exit-status <- copy 0 } @@ -67,7 +67,7 @@ fn create-child node: (addr cell) { ####################################################### fn render root: (addr cell) { - clear-screen + clear-screen 0 var depth/eax: int <- tree-depth root var viewport-width/ecx: int <- copy 0x64 # col2 viewport-width <- subtract 5 # col1 @@ -134,11 +134,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int { fn draw-horizontal-line row: int, col1: int, col2: int { var col/eax: int <- copy col1 - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, col2 break-if->= - print-string-to-screen "-" + print-string 0, "-" col <- increment loop } @@ -149,8 +149,8 @@ fn draw-vertical-line row1: int, row2: int, col: int { { compare row, row2 break-if->= - move-cursor-on-screen row, col - print-string-to-screen "|" + move-cursor 0, row, col + print-string 0, "|" row <- increment loop } diff --git a/prototypes/tile/6.mu b/prototypes/tile/6.mu index 4cf1d4c2..ecd22ae4 100644 --- a/prototypes/tile/6.mu +++ b/prototypes/tile/6.mu @@ -68,7 +68,7 @@ $main:loop: { render root-addr loop } - clear-screen + clear-screen 0 enable-keyboard-type-mode exit-status <- copy 0 } @@ -83,7 +83,7 @@ fn process c: byte, root: (addr handle cell), cursor: (addr handle cell) { var c2/eax: (addr cell) <- lookup *c1 var c3/edx: (addr cell) <- copy c2 { - print-string-to-screen "iter\n" + print-string 0, "iter\n" var tmp/ebx: (addr handle cell) <- get c3, first-child var tmp2/eax: (addr cell) <- lookup *tmp compare tmp2, 0 @@ -106,7 +106,7 @@ fn create-child node: (addr cell) { ####################################################### fn render root: (addr cell) { - clear-screen + clear-screen 0 var depth/eax: int <- tree-depth root var viewport-width/ecx: int <- copy 0x64 # col2 viewport-width <- subtract 5 # col1 @@ -161,11 +161,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int { fn draw-horizontal-line row: int, col1: int, col2: int { var col/eax: int <- copy col1 - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, col2 break-if->= - print-string-to-screen "-" + print-string 0, "-" col <- increment loop } @@ -176,8 +176,8 @@ fn draw-vertical-line row1: int, row2: int, col: int { { compare row, row2 break-if->= - move-cursor-on-screen row, col - print-string-to-screen "|" + move-cursor 0, row, col + print-string 0, "|" row <- increment loop } @@ -189,8 +189,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # x = next power-of-2 multiple of _dr after _nr var x/ecx: int <- copy 1 { -#? print-int32-hex-to-screen x -#? print-string-to-screen "\n" +#? print-int32-hex 0, x +#? print-string 0, "\n" var tmp/edx: int <- copy _dr tmp <- multiply x compare tmp, _nr @@ -198,7 +198,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { x <- shift-left 1 loop } -#? print-string-to-screen "--\n" +#? print-string 0, "--\n" # min, max = x/2, x var max/ecx: int <- copy x var min/edx: int <- copy max @@ -206,8 +206,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # narrow down result between min and max var i/eax: int <- copy min { -#? print-int32-hex-to-screen i -#? print-string-to-screen "\n" +#? print-int32-hex 0, i +#? print-string 0, "\n" var foo/ebx: int <- copy _dr foo <- multiply i compare foo, _nr @@ -217,9 +217,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { } result <- copy i result <- decrement -#? print-string-to-screen "=> " -#? print-int32-hex-to-screen result -#? print-string-to-screen "\n" +#? print-string 0, "=> " +#? print-int32-hex 0, result +#? print-string 0, "\n" } fn test-try-divide-1 { diff --git a/prototypes/tile/7.mu b/prototypes/tile/7.mu index 3cec67b6..42182745 100644 --- a/prototypes/tile/7.mu +++ b/prototypes/tile/7.mu @@ -72,7 +72,7 @@ $main:loop: { render root-addr loop } - clear-screen + clear-screen 0 enable-keyboard-type-mode exit-status <- copy 0 } @@ -105,7 +105,7 @@ fn create-child node: (addr cell) { ####################################################### fn render root: (addr cell) { - clear-screen + clear-screen 0 var depth/eax: int <- tree-depth root var viewport-width/ecx: int <- copy 0x64 # col2 viewport-width <- subtract 5 # col1 @@ -175,11 +175,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int { fn draw-horizontal-line row: int, col1: int, col2: int { var col/eax: int <- copy col1 - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, col2 break-if->= - print-string-to-screen "-" + print-string 0, "-" col <- increment loop } @@ -190,8 +190,8 @@ fn draw-vertical-line row1: int, row2: int, col: int { { compare row, row2 break-if->= - move-cursor-on-screen row, col - print-string-to-screen "|" + move-cursor 0, row, col + print-string 0, "|" row <- increment loop } @@ -203,8 +203,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # x = next power-of-2 multiple of _dr after _nr var x/ecx: int <- copy 1 { -#? print-int32-hex-to-screen x -#? print-string-to-screen "\n" +#? print-int32-hex 0, x +#? print-string 0, "\n" var tmp/edx: int <- copy _dr tmp <- multiply x compare tmp, _nr @@ -212,7 +212,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { x <- shift-left 1 loop } -#? print-string-to-screen "--\n" +#? print-string 0, "--\n" # min, max = x/2, x var max/ecx: int <- copy x var min/edx: int <- copy max @@ -220,8 +220,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # narrow down result between min and max var i/eax: int <- copy min { -#? print-int32-hex-to-screen i -#? print-string-to-screen "\n" +#? print-int32-hex 0, i +#? print-string 0, "\n" var foo/ebx: int <- copy _dr foo <- multiply i compare foo, _nr @@ -231,9 +231,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { } result <- copy i result <- decrement -#? print-string-to-screen "=> " -#? print-int32-hex-to-screen result -#? print-string-to-screen "\n" +#? print-string 0, "=> " +#? print-int32-hex 0, result +#? print-string 0, "\n" } fn test-try-divide-1 { diff --git a/prototypes/tile/8.mu b/prototypes/tile/8.mu index 9b7df0f8..d86f3f8e 100644 --- a/prototypes/tile/8.mu +++ b/prototypes/tile/8.mu @@ -72,7 +72,7 @@ $main:loop: { render root-addr loop } - clear-screen + clear-screen 0 enable-keyboard-type-mode exit-status <- copy 0 } @@ -105,7 +105,7 @@ fn create-child node: (addr cell) { ####################################################### fn render root: (addr cell) { - clear-screen + clear-screen 0 var depth/eax: int <- tree-depth root var viewport-width/ecx: int <- copy 0x64 # col2 viewport-width <- subtract 5 # col1 @@ -205,11 +205,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int { fn draw-horizontal-line row: int, col1: int, col2: int { var col/eax: int <- copy col1 - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, col2 break-if->= - print-string-to-screen "-" + print-string 0, "-" col <- increment loop } @@ -220,8 +220,8 @@ fn draw-vertical-line row1: int, row2: int, col: int { { compare row, row2 break-if->= - move-cursor-on-screen row, col - print-string-to-screen "|" + move-cursor 0, row, col + print-string 0, "|" row <- increment loop } @@ -233,8 +233,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # x = next power-of-2 multiple of _dr after _nr var x/ecx: int <- copy 1 { -#? print-int32-hex-to-screen x -#? print-string-to-screen "\n" +#? print-int32-hex 0, x +#? print-string 0, "\n" var tmp/edx: int <- copy _dr tmp <- multiply x compare tmp, _nr @@ -242,7 +242,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { x <- shift-left 1 loop } -#? print-string-to-screen "--\n" +#? print-string 0, "--\n" # min, max = x/2, x var max/ecx: int <- copy x var min/edx: int <- copy max @@ -250,8 +250,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # narrow down result between min and max var i/eax: int <- copy min { -#? print-int32-hex-to-screen i -#? print-string-to-screen "\n" +#? print-int32-hex 0, i +#? print-string 0, "\n" var foo/ebx: int <- copy _dr foo <- multiply i compare foo, _nr @@ -261,9 +261,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { } result <- copy i result <- decrement -#? print-string-to-screen "=> " -#? print-int32-hex-to-screen result -#? print-string-to-screen "\n" +#? print-string 0, "=> " +#? print-int32-hex 0, result +#? print-string 0, "\n" } fn test-try-divide-1 { diff --git a/prototypes/tile/9.mu b/prototypes/tile/9.mu index 91637afb..298db795 100644 --- a/prototypes/tile/9.mu +++ b/prototypes/tile/9.mu @@ -71,7 +71,7 @@ $main:loop: { render root-addr, cursor-addr loop } - clear-screen + clear-screen 0 enable-keyboard-type-mode exit-status <- copy 0 } @@ -183,7 +183,7 @@ fn create-child node: (addr cell) { ####################################################### fn render root: (addr cell), cursor: (addr cell) { - clear-screen + clear-screen 0 var depth/eax: int <- tree-depth root var viewport-width/ecx: int <- copy 0x64 # col2 viewport-width <- subtract 5 # col1 @@ -283,11 +283,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int { fn draw-horizontal-line row: int, col1: int, col2: int { var col/eax: int <- copy col1 - move-cursor-on-screen row, col + move-cursor 0, row, col { compare col, col2 break-if->= - print-string-to-screen "-" + print-string 0, "-" col <- increment loop } @@ -298,8 +298,8 @@ fn draw-vertical-line row1: int, row2: int, col: int { { compare row, row2 break-if->= - move-cursor-on-screen row, col - print-string-to-screen "|" + move-cursor 0, row, col + print-string 0, "|" row <- increment loop } @@ -311,8 +311,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # x = next power-of-2 multiple of _dr after _nr var x/ecx: int <- copy 1 { -#? print-int32-hex-to-screen x -#? print-string-to-screen "\n" +#? print-int32-hex 0, x +#? print-string 0, "\n" var tmp/edx: int <- copy _dr tmp <- multiply x compare tmp, _nr @@ -320,7 +320,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { x <- shift-left 1 loop } -#? print-string-to-screen "--\n" +#? print-string 0, "--\n" # min, max = x/2, x var max/ecx: int <- copy x var min/edx: int <- copy max @@ -328,8 +328,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { # narrow down result between min and max var i/eax: int <- copy min { -#? print-int32-hex-to-screen i -#? print-string-to-screen "\n" +#? print-int32-hex 0, i +#? print-string 0, "\n" var foo/ebx: int <- copy _dr foo <- multiply i compare foo, _nr @@ -339,9 +339,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int { } result <- copy i result <- decrement -#? print-string-to-screen "=> " -#? print-int32-hex-to-screen result -#? print-string-to-screen "\n" +#? print-string 0, "=> " +#? print-int32-hex 0, result +#? print-string 0, "\n" } fn test-try-divide-1 {