about summary refs log tree commit diff stats
path: root/baremetal
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-17 10:49:23 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-17 10:49:23 -0800
commitc5b573cf83b8848657ae86be40ba3b1ec24c6813 (patch)
tree2a21109457d3f32c581d35b7b7d96b6a33d3fcf6 /baremetal
parent851959ccc6d728b9a6fa02ff42d170cbebd272bb (diff)
downloadmu-c5b573cf83b8848657ae86be40ba3b1ec24c6813.tar.gz
7535
Diffstat (limited to 'baremetal')
-rw-r--r--baremetal/101screen.subx4
-rw-r--r--baremetal/500text-screen.mu4
-rw-r--r--baremetal/504test-screen.mu10
-rw-r--r--baremetal/ex2.mu4
-rw-r--r--baremetal/ex3.mu2
-rw-r--r--baremetal/ex6.mu4
6 files changed, 14 insertions, 14 deletions
diff --git a/baremetal/101screen.subx b/baremetal/101screen.subx
index 5a26a86a..cac9593e 100644
--- a/baremetal/101screen.subx
+++ b/baremetal/101screen.subx
@@ -16,12 +16,12 @@ pixel-on-real-screen:  # x: int, y: int, color: int
     8b/-> *(ebp+8) 0/r32/eax
     3d/compare-eax-and 0/imm32
     7c/jump-if-< $pixel-on-real-screen:end/disp8
-    3d/compare-eax-and 0x400/imm32/1024
+    3d/compare-eax-and 0x400/imm32/screen-width=1024
     7d/jump-if->= $pixel-on-real-screen:end/disp8
     8b/-> *(ebp+0xc) 0/r32/eax
     3d/compare-eax-and 0/imm32
     7c/jump-if-< $pixel-on-real-screen:end/disp8
-    3d/compare-eax-and 0x300/imm32/768
+    3d/compare-eax-and 0x300/imm32/screen-height=768
     7d/jump-if->= $pixel-on-real-screen:end/disp8
     # eax = y*1024 + x
     8b/-> *(ebp+0xc) 0/r32/eax
diff --git a/baremetal/500text-screen.mu b/baremetal/500text-screen.mu
index 4fa7a00e..e6004cad 100644
--- a/baremetal/500text-screen.mu
+++ b/baremetal/500text-screen.mu
@@ -191,11 +191,11 @@ fn clear-screen screen: (addr screen) {
 fn clear-real-screen {
   var y/eax: int <- copy 0
   {
-    compare y, 0x300  # 768
+    compare y, 0x300  # screen-height = 768
     break-if->=
     var x/edx: int <- copy 0
     {
-      compare x, 0x400  # 1024
+      compare x, 0x400  # screen-width = 1024
       break-if->=
       pixel-on-real-screen x, y, 0  # black
       x <- increment
diff --git a/baremetal/504test-screen.mu b/baremetal/504test-screen.mu
index db8f9eea..6de1edee 100644
--- a/baremetal/504test-screen.mu
+++ b/baremetal/504test-screen.mu
@@ -42,14 +42,14 @@ fn check-screen-row-from screen-on-stack: (addr screen), x: int, y: int, expecte
       draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, msg, 3  # 3=cyan
       draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, ": expected '", 3
       draw-grapheme-at-cursor 0, expected-grapheme, 3
-      move-cursor-rightward-and-downward 0, 0, 0x400
+      move-cursor-rightward-and-downward 0, 0, 0x400  # screen-width
       draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "' at (", 3
       draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0, x, 3
       draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, ", ", 3
       draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0, y, 3
       draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, ") but observed '", 3
       draw-grapheme-at-cursor 0, g, 3
-      move-cursor-rightward-and-downward 0, 0, 0x400
+      move-cursor-rightward-and-downward 0, 0, 0x400  # screen-width
       draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "'", 3
     }
     idx <- increment
@@ -108,14 +108,14 @@ fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: in
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, msg, 3  # 3=cyan
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, ": expected '", 3
         draw-grapheme-at-cursor 0, expected-grapheme, 3
-        move-cursor-rightward-and-downward 0, 0, 0x400
+        move-cursor-rightward-and-downward 0, 0, 0x400  # screen-width
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "' at (", 3
         draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0, x, 3
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, ", ", 3
         draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0, y, 3
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, ") but observed '", 3
         draw-grapheme-at-cursor 0, g, 3
-        move-cursor-rightward-and-downward 0, 0, 0x400
+        move-cursor-rightward-and-downward 0, 0, 0x400  # screen-width
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "'", 3
       }
       $check-screen-row-in-color-from:compare-colors: {
@@ -130,7 +130,7 @@ fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: in
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, msg, 3  # 3=cyan
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, ": expected '", 3
         draw-grapheme-at-cursor 0, expected-grapheme, 3
-        move-cursor-rightward-and-downward 0, 0, 0x400
+        move-cursor-rightward-and-downward 0, 0, 0x400  # screen-width
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "' at (", 3
         draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0, x, 3
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, ", ", 3
diff --git a/baremetal/ex2.mu b/baremetal/ex2.mu
index d7a5e0c4..1662fa84 100644
--- a/baremetal/ex2.mu
+++ b/baremetal/ex2.mu
@@ -13,11 +13,11 @@
 fn main {
   var y/eax: int <- copy 0
   {
-    compare y, 0x300  # 768
+    compare y, 0x300  # screen-height = 768
     break-if->=
     var x/edx: int <- copy 0
     {
-      compare x, 0x400  # 1024
+      compare x, 0x400  # screen-width = 1024
       break-if->=
       var color/ecx: int <- copy x
       color <- and 0xff
diff --git a/baremetal/ex3.mu b/baremetal/ex3.mu
index 206e22b3..56e16bd3 100644
--- a/baremetal/ex3.mu
+++ b/baremetal/ex3.mu
@@ -20,7 +20,7 @@ fn main {
     loop-if-=  # busy wait
     pixel-on-real-screen x, y, 0x31  # green
     x <- increment
-    compare x, 0x400
+    compare x, 0x400  # screen-width
     {
       break-if-<
       y <- increment
diff --git a/baremetal/ex6.mu b/baremetal/ex6.mu
index 72d21f2e..304867f6 100644
--- a/baremetal/ex6.mu
+++ b/baremetal/ex6.mu
@@ -24,9 +24,9 @@ fn main {
   draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "def", 0xa
 
   # test drawing near the edge
-  x <- draw-text-rightward 0, "R", 0x3f8, 0x400, 0x100, 0xa
+  x <- draw-text-rightward 0, "R", 0x3f8, 0x400, 0x100, 0xa  # 0x400 = screen-width
   draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "wrapped from R", 0xa
 
-  x <- draw-text-downward 0, "D", 0x100, 0x2f0, 0x300, 0xa
+  x <- draw-text-downward 0, "D", 0x100, 0x2f0, 0x300, 0xa  # 0x300 = screen-height
   draw-text-wrapping-down-then-right-from-cursor-over-full-screen 0, "wrapped from D", 0xa
 }