From df9c71eff0cc7de3fe4feaa2b46d26dfbeb28be4 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 15 Apr 2021 23:09:13 -0700 Subject: shell: horline working now And we give a high-level error when the pixel buffer fills up. --- 500fake-screen.mu | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 } -- cgit 1.4.1-2-gfad0