From f8cb5f97c6d89c2a71b0587056b49bc4642f21d4 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 13 Jan 2021 19:50:30 -0800 Subject: [PATCH] 7513 --- baremetal/ex7.mu | 58 +++++++++++++++++----------------- html/baremetal/ex7.mu.html | 64 ++++++++++++++++++-------------------- 2 files changed, 59 insertions(+), 63 deletions(-) diff --git a/baremetal/ex7.mu b/baremetal/ex7.mu index 6beac7aa..50174385 100644 --- a/baremetal/ex7.mu +++ b/baremetal/ex7.mu @@ -11,36 +11,34 @@ # k, l. fn main { + var key/eax: byte <- read-key 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, 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 } diff --git a/html/baremetal/ex7.mu.html b/html/baremetal/ex7.mu.html index b19f6e13..f45d38dc 100644 --- a/html/baremetal/ex7.mu.html +++ b/html/baremetal/ex7.mu.html @@ -69,39 +69,37 @@ if ('onhashchange' in window) { 11 # k, l. 12 13 fn main { -14 { -15 var key/eax: byte <- read-key 0 -16 { -17 compare key, 0x68 # 'h' -18 break-if-!= -19 var g/eax: grapheme <- copy 0x2d # '-' -20 draw-grapheme-at-cursor 0, g, 0x31 -21 cursor-left 0 -22 } -23 { -24 compare key, 0x6a # 'j' -25 break-if-!= -26 var g/eax: grapheme <- copy 0x7c # '|' -27 draw-grapheme-at-cursor 0, g, 0x31 -28 cursor-down 0 -29 } -30 { -31 compare key, 0x6b # 'k' -32 break-if-!= -33 var g/eax: grapheme <- copy 0x7c # '|' -34 draw-grapheme-at-cursor 0, g, 0x31 -35 cursor-up 0 -36 } -37 { -38 compare key, 0x6c # 'l' -39 break-if-!= -40 var g/eax: grapheme <- copy 0x2d # '-' -41 draw-grapheme-at-cursor 0, g, 0x31 -42 cursor-right 0 -43 } -44 loop -45 } -46 } +14 var key/eax: byte <- read-key 0 +15 { +16 compare key, 0x68 # 'h' +17 break-if-!= +18 var g/eax: grapheme <- copy 0x2d # '-' +19 draw-grapheme-at-cursor 0, g, 0x31 +20 cursor-left 0 +21 } +22 { +23 compare key, 0x6a # 'j' +24 break-if-!= +25 var g/eax: grapheme <- copy 0x7c # '|' +26 draw-grapheme-at-cursor 0, g, 0x31 +27 cursor-down 0 +28 } +29 { +30 compare key, 0x6b # 'k' +31 break-if-!= +32 var g/eax: grapheme <- copy 0x7c # '|' +33 draw-grapheme-at-cursor 0, g, 0x31 +34 cursor-up 0 +35 } +36 { +37 compare key, 0x6c # 'l' +38 break-if-!= +39 var g/eax: grapheme <- copy 0x2d # '-' +40 draw-grapheme-at-cursor 0, g, 0x31 +41 cursor-right 0 +42 } +43 loop +44 }