diff options
-rw-r--r-- | baremetal/501draw-text.mu | 23 | ||||
-rw-r--r-- | baremetal/ex6.mu | 8 |
2 files changed, 11 insertions, 20 deletions
diff --git a/baremetal/501draw-text.mu b/baremetal/501draw-text.mu index fa284d68..be8a06c5 100644 --- a/baremetal/501draw-text.mu +++ b/baremetal/501draw-text.mu @@ -165,7 +165,7 @@ fn draw-text-wrapping-right-then-down-over-full-screen screen: (addr screen), te return cursor-x, cursor-y } -fn draw-text-wrapping-right-then-down-from-cursor screen: (addr screen), text: (addr array byte), xmin: int, ymin: int, xmax: int, ymax: int, color: int -> _/eax: int, _/ecx: int { +fn draw-text-wrapping-right-then-down-from-cursor screen: (addr screen), text: (addr array byte), xmin: int, ymin: int, xmax: int, ymax: int, color: int { var cursor-x/eax: int <- copy 0 var cursor-y/ecx: int <- copy 0 cursor-x, cursor-y <- cursor-position screen @@ -178,14 +178,10 @@ fn draw-text-wrapping-right-then-down-from-cursor screen: (addr screen), text: ( cursor-y <- add 0x10 # font-height } cursor-x, cursor-y <- draw-text-wrapping-right-then-down screen, text, xmin, ymin, xmax, ymax, cursor-x, cursor-y, color - return cursor-x, cursor-y } -fn draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen: (addr screen), text: (addr array byte), color: int -> _/eax: int, _/ecx: int { - var cursor-x/eax: int <- copy 0 - var cursor-y/ecx: int <- copy 0 - cursor-x, cursor-y <- draw-text-wrapping-right-then-down-from-cursor screen, text, 0, 0, 0x400, 0x300, color # 1024, 768 - return cursor-x, cursor-y +fn draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen: (addr screen), text: (addr array byte), color: int { + draw-text-wrapping-right-then-down-from-cursor screen, text, 0, 0, 0x400, 0x300, color # 1024, 768 } ## Text direction: down then right @@ -228,12 +224,11 @@ fn draw-text-downward screen: (addr screen), text: (addr array byte), x: int, y: return ycurr } -fn draw-text-downward-from-cursor screen: (addr screen), text: (addr array byte), ymax: int, color: int -> _/eax: int { +fn draw-text-downward-from-cursor screen: (addr screen), text: (addr array byte), ymax: int, color: int { var cursor-x/eax: int <- copy 0 var cursor-y/ecx: int <- copy 0 cursor-x, cursor-y <- cursor-position screen var result/eax: int <- draw-text-downward screen, text, cursor-x, cursor-y, ymax, color - return result } # draw text down and right in the rectangle from (xmin, ymin) to (xmax, ymax), starting from (x, y), wrapping as necessary @@ -296,7 +291,7 @@ fn draw-text-wrapping-down-then-right-over-full-screen screen: (addr screen), te return cursor-x, cursor-y } -fn draw-text-wrapping-down-then-right-from-cursor screen: (addr screen), text: (addr array byte), xmin: int, ymin: int, xmax: int, ymax: int, color: int -> _/eax: int, _/ecx: int { +fn draw-text-wrapping-down-then-right-from-cursor screen: (addr screen), text: (addr array byte), xmin: int, ymin: int, xmax: int, ymax: int, color: int { var cursor-x/eax: int <- copy 0 var cursor-y/ecx: int <- copy 0 cursor-x, cursor-y <- cursor-position screen @@ -309,12 +304,8 @@ fn draw-text-wrapping-down-then-right-from-cursor screen: (addr screen), text: ( cursor-y <- copy ymin } cursor-x, cursor-y <- draw-text-wrapping-down-then-right screen, text, xmin, ymin, xmax, ymax, cursor-x, cursor-y, color - return cursor-x, cursor-y } -fn draw-text-wrapping-down-then-right-from-cursor-over-full-screen screen: (addr screen), text: (addr array byte), color: int -> _/eax: int, _/ecx: int { - var cursor-x/eax: int <- copy 0 - var cursor-y/ecx: int <- copy 0 - cursor-x, cursor-y <- draw-text-wrapping-down-then-right-from-cursor screen, text, 0, 0, 0x400, 0x300, color # 1024, 768 - return cursor-x, cursor-y +fn draw-text-wrapping-down-then-right-from-cursor-over-full-screen screen: (addr screen), text: (addr array byte), color: int { + draw-text-wrapping-down-then-right-from-cursor screen, text, 0, 0, 0x400, 0x300, color # 1024, 768 } diff --git a/baremetal/ex6.mu b/baremetal/ex6.mu index 587720d5..5e47a57c 100644 --- a/baremetal/ex6.mu +++ b/baremetal/ex6.mu @@ -20,13 +20,13 @@ fn main { x, y <- draw-text-wrapping-right-then-down 0, "Mu!", 0x10, 0x20, 0x78, 0x50, x, y, 0xa # drawing at the cursor in multiple directions - x, y <- draw-text-wrapping-down-then-right-from-cursor-over-full-screen 0, "abc", 0xa - x, y <- draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "def", 0xa + draw-text-wrapping-down-then-right-from-cursor-over-full-screen 0, "abc", 0xa + 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, y <- draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0, "wrapped from R", 0xa + 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, y <- draw-text-wrapping-down-then-right-from-cursor-over-full-screen 0, "wrapped from D", 0xa + draw-text-wrapping-down-then-right-from-cursor-over-full-screen 0, "wrapped from D", 0xa } |