From fc9286f3b358f80dfabb1d3e6c7d3f468afa3a19 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 13 Jan 2021 21:00:20 -0800 Subject: 7514 --- baremetal/502manhattan-line.mu | 28 ---------- baremetal/503manhattan-line.mu | 28 ++++++++++ html/baremetal/502manhattan-line.mu.html | 89 -------------------------------- html/baremetal/503manhattan-line.mu.html | 89 ++++++++++++++++++++++++++++++++ html/baremetal/ex6.mu.html | 2 +- 5 files changed, 118 insertions(+), 118 deletions(-) delete mode 100644 baremetal/502manhattan-line.mu create mode 100644 baremetal/503manhattan-line.mu delete mode 100644 html/baremetal/502manhattan-line.mu.html create mode 100644 html/baremetal/503manhattan-line.mu.html diff --git a/baremetal/502manhattan-line.mu b/baremetal/502manhattan-line.mu deleted file mode 100644 index 0351fcb6..00000000 --- a/baremetal/502manhattan-line.mu +++ /dev/null @@ -1,28 +0,0 @@ -fn draw-box screen: (addr screen), x1: int, y1: int, x2: int, y2: int, color: int { - draw-horizontal-line screen, x1, x2, y1, color - draw-vertical-line screen, x1, y1, y2, color - draw-horizontal-line screen, x1, x2, y2, color - draw-vertical-line screen, x2, y1, y2, color -} - -fn draw-horizontal-line screen: (addr screen), x1: int, x2: int, y: int, color: int { - var x/eax: int <- copy x1 - { - compare x, x2 - break-if->= - pixel screen, x, y, color - x <- increment - loop - } -} - -fn draw-vertical-line screen: (addr screen), x: int, y1: int, y2: int, color: int { - var y/eax: int <- copy y1 - { - compare y, y2 - break-if->= - pixel screen, x, y, color - y <- increment - loop - } -} diff --git a/baremetal/503manhattan-line.mu b/baremetal/503manhattan-line.mu new file mode 100644 index 00000000..0351fcb6 --- /dev/null +++ b/baremetal/503manhattan-line.mu @@ -0,0 +1,28 @@ +fn draw-box screen: (addr screen), x1: int, y1: int, x2: int, y2: int, color: int { + draw-horizontal-line screen, x1, x2, y1, color + draw-vertical-line screen, x1, y1, y2, color + draw-horizontal-line screen, x1, x2, y2, color + draw-vertical-line screen, x2, y1, y2, color +} + +fn draw-horizontal-line screen: (addr screen), x1: int, x2: int, y: int, color: int { + var x/eax: int <- copy x1 + { + compare x, x2 + break-if->= + pixel screen, x, y, color + x <- increment + loop + } +} + +fn draw-vertical-line screen: (addr screen), x: int, y1: int, y2: int, color: int { + var y/eax: int <- copy y1 + { + compare y, y2 + break-if->= + pixel screen, x, y, color + y <- increment + loop + } +} diff --git a/html/baremetal/502manhattan-line.mu.html b/html/baremetal/502manhattan-line.mu.html deleted file mode 100644 index fb41ad73..00000000 --- a/html/baremetal/502manhattan-line.mu.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - -Mu - baremetal/502manhattan-line.mu - - - - - - - - - - -https://github.com/akkartik/mu/blob/main/baremetal/502manhattan-line.mu -
- 1 fn draw-box screen: (addr screen), x1: int, y1: int, x2: int, y2: int, color: int {
- 2   draw-horizontal-line screen, x1, x2, y1, color
- 3   draw-vertical-line screen, x1, y1, y2, color
- 4   draw-horizontal-line screen, x1, x2, y2, color
- 5   draw-vertical-line screen, x2, y1, y2, color
- 6 }
- 7 
- 8 fn draw-horizontal-line screen: (addr screen), x1: int, x2: int, y: int, color: int {
- 9   var x/eax: int <- copy x1
-10   {
-11     compare x, x2
-12     break-if->=
-13     pixel screen, x, y, color
-14     x <- increment
-15     loop
-16   }
-17 }
-18 
-19 fn draw-vertical-line screen: (addr screen), x: int, y1: int, y2: int, color: int {
-20   var y/eax: int <- copy y1
-21   {
-22     compare y, y2
-23     break-if->=
-24     pixel screen, x, y, color
-25     y <- increment
-26     loop
-27   }
-28 }
-
- - - diff --git a/html/baremetal/503manhattan-line.mu.html b/html/baremetal/503manhattan-line.mu.html new file mode 100644 index 00000000..bb47dd36 --- /dev/null +++ b/html/baremetal/503manhattan-line.mu.html @@ -0,0 +1,89 @@ + + + + +Mu - baremetal/503manhattan-line.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/baremetal/503manhattan-line.mu +
+ 1 fn draw-box screen: (addr screen), x1: int, y1: int, x2: int, y2: int, color: int {
+ 2   draw-horizontal-line screen, x1, x2, y1, color
+ 3   draw-vertical-line screen, x1, y1, y2, color
+ 4   draw-horizontal-line screen, x1, x2, y2, color
+ 5   draw-vertical-line screen, x2, y1, y2, color
+ 6 }
+ 7 
+ 8 fn draw-horizontal-line screen: (addr screen), x1: int, x2: int, y: int, color: int {
+ 9   var x/eax: int <- copy x1
+10   {
+11     compare x, x2
+12     break-if->=
+13     pixel screen, x, y, color
+14     x <- increment
+15     loop
+16   }
+17 }
+18 
+19 fn draw-vertical-line screen: (addr screen), x: int, y1: int, y2: int, color: int {
+20   var y/eax: int <- copy y1
+21   {
+22     compare y, y2
+23     break-if->=
+24     pixel screen, x, y, color
+25     y <- increment
+26     loop
+27   }
+28 }
+
+ + + diff --git a/html/baremetal/ex6.mu.html b/html/baremetal/ex6.mu.html index 7d63c3fb..5121d218 100644 --- a/html/baremetal/ex6.mu.html +++ b/html/baremetal/ex6.mu.html @@ -69,7 +69,7 @@ if ('onhashchange' in window) { 11 12 fn main { 13 # drawing text within a bounding box -14 draw-box 0, 0xf, 0x1f, 0x79, 0x51, 0x4 +14 draw-box 0, 0xf, 0x1f, 0x79, 0x51, 0x4 15 var x/eax: int <- copy 0x20 16 var y/ecx: int <- copy 0x20 17 x, y <- draw-text-wrapping-right-then-down 0, "hello ", 0x10, 0x20, 0x78, 0x50, x, y, 0xa # (0x10, 0x20) -> (0x78, 0x50) -- cgit 1.4.1-2-gfad0