diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-08-01 23:41:48 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-08-01 23:41:48 -0700 |
commit | 902b4084af04a7bcf36a6a9971b4661bd97c2139 (patch) | |
tree | 0840c2583ea1f54e19367f086f7da4c3620b2d61 | |
parent | 6b343a82f29b6dea219504504244591c3042df43 (diff) | |
download | mu-902b4084af04a7bcf36a6a9971b4661bd97c2139.tar.gz |
6700 - clear fake screen
One thing I hadn't realized in all my hacking on the mu1 prototype: clear-screen doesn't modify active attributes. It's equivalent to printing spaces all over the screen with the current attributes.
-rw-r--r-- | 404screen.mu | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/404screen.mu b/404screen.mu index 5261679b..4a972d79 100644 --- a/404screen.mu +++ b/404screen.mu @@ -45,6 +45,10 @@ fn initialize-screen screen: (addr screen), nrows: int, ncols: int { # screen->cursor-col = 1 dest <- get screen-addr, cursor-col copy-to *dest, 1 + # screen->curr-attributes->background-color = 7 (simulate light background) + var tmp2/eax: (addr screen-cell) <- get screen-addr, curr-attributes + dest <- get tmp2, background-color + copy-to *dest, 7 } fn screen-size screen: (addr screen) -> nrows/eax: int, ncols/ecx: int { @@ -78,6 +82,26 @@ $clear-screen:body: { { break-if-= # fake screen + move-cursor screen, 1, 1 + var screen-addr/esi: (addr screen) <- copy screen + var i/eax: int <- copy 1 + var nrows/ecx: (addr int) <- get screen-addr, num-rows + { + compare i, *nrows + break-if-> + var j/edx: int <- copy 1 + var ncols/ebx: (addr int) <- get screen-addr, num-cols + { + compare j, *ncols + break-if-> + print-byte screen, 0x20 # space + j <- increment + loop + } + i <- increment + loop + } + move-cursor screen, 1, 1 } } } |