diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-04-15 23:09:13 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-04-15 23:09:13 -0700 |
commit | df9c71eff0cc7de3fe4feaa2b46d26dfbeb28be4 (patch) | |
tree | ca3a7e6808ebd006a486e27224ef01714e576bc0 | |
parent | 6392f1fde9a1177085954e42b9517f73acac88fe (diff) | |
download | mu-df9c71eff0cc7de3fe4feaa2b46d26dfbeb28be4.tar.gz |
shell: horline working now
And we give a high-level error when the pixel buffer fills up.
-rw-r--r-- | 500fake-screen.mu | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/500fake-screen.mu b/500fake-screen.mu index 7b2c3177..fce0dc5d 100644 --- a/500fake-screen.mu +++ b/500fake-screen.mu @@ -52,8 +52,10 @@ fn initialize-screen _screen: (addr screen), width: int, height: int { tmp <- multiply width populate data-addr, tmp } - # pixels + # allocate space for 16 pixels per 16x8 character. So one column of pixels + # per character. var pixels-ah/ecx: (addr handle stream pixel) <- get screen, pixels + tmp <- shift-left 4 populate-stream pixels-ah, tmp # screen->cursor-x = 0 dest <- get screen, cursor-x @@ -105,6 +107,12 @@ fn pixel screen: (addr screen), x: int, y: int, color: int { var screen/eax: (addr screen) <- copy screen var dest-stream-ah/eax: (addr handle stream pixel) <- get screen, pixels var dest-stream/eax: (addr stream pixel) <- lookup *dest-stream-ah + { + var full?/eax: boolean <- stream-full? dest-stream + compare full?, 0/false + break-if-= + abort "tried to draw too many pixels on the fake screen; adjust initialize-screen" + } write-to-stream dest-stream, src } |