diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-08-01 23:06:41 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-08-01 23:39:57 -0700 |
commit | 6b343a82f29b6dea219504504244591c3042df43 (patch) | |
tree | 91c63bd3d66d73aeb4e6714f1b6e5792620839b8 /apps | |
parent | 59a2e363f5f818e3870a275efe375737a76009fa (diff) | |
download | mu-6b343a82f29b6dea219504504244591c3042df43.tar.gz |
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.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/arith.mu | 10 | ||||
-rw-r--r-- | apps/browse.mu | 22 | ||||
-rw-r--r-- | apps/parse-int.mu | 2 | ||||
-rw-r--r-- | apps/print-file.mu | 4 | ||||
-rw-r--r-- | apps/tui.mu | 32 |
5 files changed, 35 insertions, 35 deletions
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 <integer>\n" + print-string 0, "usage: parse-int <integer>\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 <filename>\n" + print-string 0, "usage: cat <filename>\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 } |