From 328d76e4ef151adbc8d5d8608c0d77d091fc28fd Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 22 Jan 2021 22:16:59 -0800 Subject: 7545 --- baremetal/ex7.mu | 60 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/baremetal/ex7.mu b/baremetal/ex7.mu index 50174385..d604c95a 100644 --- a/baremetal/ex7.mu +++ b/baremetal/ex7.mu @@ -11,34 +11,38 @@ # k, l. fn main { - var key/eax: byte <- read-key 0 + var space/eax: grapheme <- copy 0x20 + set-cursor-position 0, 0, 0, space { - compare key, 0x68 # 'h' - break-if-!= - var g/eax: grapheme <- copy 0x2d # '-' - draw-grapheme-at-cursor 0, g, 0x31 - cursor-left 0 + var key/eax: byte <- read-key 0 + { + compare key, 0x68 # 'h' + break-if-!= + var g/eax: grapheme <- copy 0x2d # '-' + draw-grapheme-at-cursor 0, g, 0x31 + cursor-left 0 + } + { + compare key, 0x6a # 'j' + break-if-!= + var g/eax: grapheme <- copy 0x7c # '|' + draw-grapheme-at-cursor 0, g, 0x31 + cursor-down 0 + } + { + compare key, 0x6b # 'k' + break-if-!= + var g/eax: grapheme <- copy 0x7c # '|' + draw-grapheme-at-cursor 0, g, 0x31 + cursor-up 0 + } + { + compare key, 0x6c # 'l' + break-if-!= + var g/eax: grapheme <- copy 0x2d # '-' + draw-grapheme-at-cursor 0, g, 0x31 + cursor-right 0 + } + loop } - { - compare key, 0x6a # 'j' - break-if-!= - var g/eax: grapheme <- copy 0x7c # '|' - draw-grapheme-at-cursor 0, g, 0x31 - cursor-down 0 - } - { - compare key, 0x6b # 'k' - break-if-!= - var g/eax: grapheme <- copy 0x7c # '|' - draw-grapheme-at-cursor 0, g, 0x31 - cursor-up 0 - } - { - compare key, 0x6c # 'l' - break-if-!= - var g/eax: grapheme <- copy 0x2d # '-' - draw-grapheme-at-cursor 0, g, 0x31 - cursor-right 0 - } - loop } -- cgit 1.4.1-2-gfad0