about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--baremetal/103grapheme.subx8
-rw-r--r--baremetal/400.mu2
-rw-r--r--baremetal/500text-screen.mu7
3 files changed, 10 insertions, 7 deletions
diff --git a/baremetal/103grapheme.subx b/baremetal/103grapheme.subx
index b17f60a1..f854e03d 100644
--- a/baremetal/103grapheme.subx
+++ b/baremetal/103grapheme.subx
@@ -5,7 +5,7 @@
 
 == code
 
-draw-grapheme-on-real-screen:  # g: grapheme, x: int, y: int, color: int
+draw-grapheme-on-real-screen:  # g: grapheme, x: int, y: int, color: int, background-color: int
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
@@ -45,14 +45,14 @@ draw-grapheme-on-real-screen:  # g: grapheme, x: int, y: int, color: int
         7c/jump-if-< break/disp8
         # shift LSB from row-bitmap into carry flag (CF)
         c1 5/subop/shift-right-logical %ebx 1/imm8
-        # if LSB, draw a pixel
+        # if LSB, draw a pixel in the given color
         {
           73/jump-if-not-CF break/disp8
           (pixel-on-real-screen %eax %edx *(ebp+0x14))
           eb/jump $draw-grapheme-on-real-screen:continue/disp8
         }
-        # otherwise draw a black pixel
-        (pixel-on-real-screen %eax %edx 0)
+        # otherwise use the background color
+        (pixel-on-real-screen %eax %edx *(ebp+0x18))
 $draw-grapheme-on-real-screen:continue:
         # --x
         48/decrement-eax
diff --git a/baremetal/400.mu b/baremetal/400.mu
index 4dfb9951..8db62837 100644
--- a/baremetal/400.mu
+++ b/baremetal/400.mu
@@ -1,6 +1,6 @@
 # screen
 sig pixel-on-real-screen x: int, y: int, color: int
-sig draw-grapheme-on-real-screen g: grapheme, x: int, y: int, color: int
+sig draw-grapheme-on-real-screen g: grapheme, x: int, y: int, color: int, background-color: int
 sig cursor-position-on-real-screen -> _/eax: int, _/ecx: int
 sig set-cursor-position-on-real-screen x: int, y: int
 
diff --git a/baremetal/500text-screen.mu b/baremetal/500text-screen.mu
index e6004cad..96c6644f 100644
--- a/baremetal/500text-screen.mu
+++ b/baremetal/500text-screen.mu
@@ -1,4 +1,5 @@
-# Screen primitives for character-oriented output.
+# Testable primitives for writing text to screen.
+# (Mu doesn't yet have testable primitives for graphics.)
 #
 # Unlike the top-level, this text mode has no scrolling.
 
@@ -61,11 +62,13 @@ fn screen-size screen: (addr screen) -> _/eax: int, _/ecx: int {
   return width, height
 }
 
+# testable screen primitive
+# background color isn't configurable yet
 fn draw-grapheme screen: (addr screen), g: grapheme, x: int, y: int, color: int {
   {
     compare screen, 0
     break-if-!=
-    draw-grapheme-on-real-screen g, x, y, color
+    draw-grapheme-on-real-screen g, x, y, color, 0
     return
   }
   # fake screen