about summary refs log tree commit diff stats
path: root/baremetal
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-19 22:17:05 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-19 22:48:49 -0800
commit7363c6dfd3cf2104d7e3a0e814cde2d8b4f4e6ce (patch)
treee0f2114917851fac0107eec5cb6cbdaf0556af5f /baremetal
parent6ce43fce4f288fda97e4034abc512e03d0304177 (diff)
downloadmu-7363c6dfd3cf2104d7e3a0e814cde2d8b4f4e6ce.tar.gz
7537 - baremetal: start of cursor support
Diffstat (limited to 'baremetal')
-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