From 5efca3695a1f4261020c793c8474f5d62af0b010 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 9 Jan 2021 08:11:52 -0800 Subject: 7482 --- 407print-int32-decimal-right-justified.mu | 14 ---- 407right-justify.mu | 14 ++++ .../407print-int32-decimal-right-justified.mu.html | 76 ---------------------- html/407right-justify.mu.html | 76 ++++++++++++++++++++++ 4 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 407print-int32-decimal-right-justified.mu create mode 100644 407right-justify.mu delete mode 100644 html/407print-int32-decimal-right-justified.mu.html create mode 100644 html/407right-justify.mu.html diff --git a/407print-int32-decimal-right-justified.mu b/407print-int32-decimal-right-justified.mu deleted file mode 100644 index 5cb9e8d6..00000000 --- a/407print-int32-decimal-right-justified.mu +++ /dev/null @@ -1,14 +0,0 @@ -# print 'n' with enough leading spaces to be right-justified in 'width' -fn print-int32-decimal-right-justified screen: (addr screen), n: int, _width: int { - # tweak things for negative numbers - var n-width/eax: int <- decimal-size n - var width/ecx: int <- copy _width - { - compare n-width, width - break-if->= - print-grapheme screen, 0x20 # space - width <- decrement - loop - } - print-int32-decimal screen, n -} diff --git a/407right-justify.mu b/407right-justify.mu new file mode 100644 index 00000000..5cb9e8d6 --- /dev/null +++ b/407right-justify.mu @@ -0,0 +1,14 @@ +# print 'n' with enough leading spaces to be right-justified in 'width' +fn print-int32-decimal-right-justified screen: (addr screen), n: int, _width: int { + # tweak things for negative numbers + var n-width/eax: int <- decimal-size n + var width/ecx: int <- copy _width + { + compare n-width, width + break-if->= + print-grapheme screen, 0x20 # space + width <- decrement + loop + } + print-int32-decimal screen, n +} diff --git a/html/407print-int32-decimal-right-justified.mu.html b/html/407print-int32-decimal-right-justified.mu.html deleted file mode 100644 index cbba9de9..00000000 --- a/html/407print-int32-decimal-right-justified.mu.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - -Mu - 407print-int32-decimal-right-justified.mu - - - - - - - - - - -https://github.com/akkartik/mu/blob/main/407print-int32-decimal-right-justified.mu -
- 1 # print 'n' with enough leading spaces to be right-justified in 'width'
- 2 fn print-int32-decimal-right-justified screen: (addr screen), n: int, _width: int {
- 3   # tweak things for negative numbers
- 4   var n-width/eax: int <- decimal-size n
- 5   var width/ecx: int <- copy _width
- 6   {
- 7     compare n-width, width
- 8     break-if->=
- 9     print-grapheme screen, 0x20  # space
-10     width <- decrement
-11     loop
-12   }
-13   print-int32-decimal screen, n
-14 }
-
- - - diff --git a/html/407right-justify.mu.html b/html/407right-justify.mu.html new file mode 100644 index 00000000..460f9def --- /dev/null +++ b/html/407right-justify.mu.html @@ -0,0 +1,76 @@ + + + + +Mu - 407right-justify.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/407right-justify.mu +
+ 1 # print 'n' with enough leading spaces to be right-justified in 'width'
+ 2 fn right-justify screen: (addr screen), n: int, _width: int {
+ 3   # tweak things for negative numbers
+ 4   var n-width/eax: int <- decimal-size n
+ 5   var width/ecx: int <- copy _width
+ 6   {
+ 7     compare n-width, width
+ 8     break-if->=
+ 9     print-grapheme screen, 0x20  # space
+10     width <- decrement
+11     loop
+12   }
+13   print-int32-decimal screen, n
+14 }
+
+ + + -- cgit 1.4.1-2-gfad0