diff options
author | Kartik Agaram <vc@akkartik.com> | 2021-01-11 23:59:17 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2021-01-12 00:00:20 -0800 |
commit | 589eba07e2b1f1f3c6dbb3087b306071a2f9809b (patch) | |
tree | f66b67fbc0ca60193049c35026ca5826f8def60e /baremetal/ex5.mu | |
parent | ebf912eb7a5da220c031d453b64f7a2d90b41dea (diff) | |
download | mu-589eba07e2b1f1f3c6dbb3087b306071a2f9809b.tar.gz |
7500 - baremetal: bounds-check screen space before drawing
Diffstat (limited to 'baremetal/ex5.mu')
-rw-r--r-- | baremetal/ex5.mu | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/baremetal/ex5.mu b/baremetal/ex5.mu index 30e5b69c..ac7a9abe 100644 --- a/baremetal/ex5.mu +++ b/baremetal/ex5.mu @@ -1,4 +1,5 @@ -# Draw an ASCII string using the built-in font (GNU unifont) +# Draw a single line of ASCII text using the built-in font (GNU unifont) +# Also demonstrates bounds-checking _before_ drawing. # # To build a disk image: # ./translate_mu_baremetal baremetal/ex5.mu # emits disk.img @@ -10,5 +11,6 @@ # Expected output: text in green near the top-left corner of screen fn main { - draw-text-rightward 0, "hello from baremetal Mu!", 0x10, 0x10, 0xa + var dummy/eax: int <- draw-text-rightward 0, "hello from baremetal Mu!", 0x10, 0x400, 0x10, 0xa # xmax = end of screen, plenty of space + dummy <- draw-text-rightward 0, "you shouldn't see this", 0x10, 0xa0, 0x30, 0x3 # xmax = 0xa0, which is too narrow } |