about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-15 23:09:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-15 23:09:13 -0700
commitdf9c71eff0cc7de3fe4feaa2b46d26dfbeb28be4 (patch)
treeca3a7e6808ebd006a486e27224ef01714e576bc0
parent6392f1fde9a1177085954e42b9517f73acac88fe (diff)
downloadmu-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.mu10
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
 }
 
href='#n162'>162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235