diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-05-29 15:56:24 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-05-29 15:56:24 -0700 |
commit | ff2ee758185781080490851ae7d9e87ec17d851e (patch) | |
tree | 78e9099dffa81ee57e1997d6f24bf1f58c3f17ae | |
parent | 2fb656b4f466f85437c268da9e05b270d020b964 (diff) | |
download | mu-ff2ee758185781080490851ae7d9e87ec17d851e.tar.gz |
6433 - render newlines correctly
There were three confounding issues to get past before this seemed to be working right: - row/col count from 1 rather than 0 - I was thinking in decimal rather than hex - print-byte buffers to stdout, but print-string does not. I didn't think this mattered, but it does matter to flush the current line before moving cursor again. Only one of these issues was a bug in the code. The first two were bugs in my mental model that necessitated no changes to code to be corrected.
-rw-r--r-- | 103screen.subx | 1 | ||||
-rw-r--r-- | apps/browse.mu | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/103screen.subx b/103screen.subx index 7011eb0f..328b1151 100644 --- a/103screen.subx +++ b/103screen.subx @@ -91,6 +91,7 @@ $clear-screen:end: 5d/pop-to-ebp c3/return +# row and col count from the top-left as (1, 1) move-cursor: # row: int, column: int # . prologue 55/push-ebp diff --git a/apps/browse.mu b/apps/browse.mu index bb3c1a1c..222ac5cd 100644 --- a/apps/browse.mu +++ b/apps/browse.mu @@ -33,10 +33,13 @@ $line-loop: { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= $line-loop + compare c, 0xa # newline + break-if-= # no need to print newlines print-byte c col <- increment loop } + flush-stdout row <- increment loop } |