From f9294899d0b952072de3dc87b3ea97e98f150ea4 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 5 Nov 2016 20:34:09 -0700 Subject: 3622 - handle fractional coordinates in print --- html/022arithmetic.cc.html | 12 ++++++++++++ html/081print.mu.html | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'html') diff --git a/html/022arithmetic.cc.html b/html/022arithmetic.cc.html index 4d2b454e..b18bc7d2 100644 --- a/html/022arithmetic.cc.html +++ b/html/022arithmetic.cc.html @@ -750,6 +750,18 @@ put(Recipe_ordinal,+mem: storing 12 in location 1 +:(scenario round_halves_toward_zero) +def main [ + 1:num <- round 12.5 +] ++mem: storing 12 in location 1 + +:(scenario round_halves_toward_zero_2) +def main [ + 1:num <- round -12.5 +] ++mem: storing -12 in location 1 + :(before "End Primitive Recipe Declarations") CHARACTER_TO_CODE, :(before "End Primitive Recipe Numbers") diff --git a/html/081print.mu.html b/html/081print.mu.html index 241cf857..5214e80c 100644 --- a/html/081print.mu.html +++ b/html/081print.mu.html @@ -141,11 +141,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color height:num <- get *screen, num-rows:offset # if cursor is out of bounds, silently exit row:num <- get *screen, cursor-row:offset + row <- round row legal?:bool <- greater-or-equal row, 0 return-unless legal? legal? <- lesser-than row, height return-unless legal? column:num <- get *screen, cursor-column:offset + column <- round column legal? <- greater-or-equal column, 0 return-unless legal? legal? <- lesser-than column, width @@ -220,6 +222,25 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] +scenario print-character-at-fractional-coordinate [ + local-scope + fake-screen:&:screen <- new-fake-screen 3/width, 2/height + a:char <- copy 97/a + run [ + move-cursor fake-screen, 0.5, 0 + fake-screen <- print fake-screen, a:char + cell:&:@:screen-cell <- get *fake-screen, data:offset + 1:@:screen-cell/raw <- copy *cell + ] + memory-should-contain [ + 1 <- 6 # width*height + 2 <- 97 # 'a' + 3 <- 7 # white + # rest of screen is empty + 4 <- 0 + ] +] + scenario print-character-in-color [ local-scope fake-screen:&:screen <- new-fake-screen 3/width, 2/height -- cgit 1.4.1-2-gfad0