This commit is contained in:
Kartik K. Agaram 2021-08-28 22:57:22 -07:00
parent 468927ee1c
commit bc859a7ca4
6 changed files with 21 additions and 29 deletions

View File

@ -311,8 +311,7 @@ draw-slice-wrapping-right-then-down-from-cursor-over-full-screen: # screen: (ad
73/jump-if-addr>= break/disp8
# print *curr
8a/byte-> *ecx 0/r32/eax
(draw-grapheme-at-cursor *(ebp+8) %eax *(ebp+0x14) *(ebp+0x18))
(move-cursor-rightward-and-downward *(ebp+8))
(draw-grapheme-at-cursor-over-full-screen *(ebp+8) %eax *(ebp+0x14) *(ebp+0x18))
#
41/increment-ecx
#

View File

@ -81,17 +81,21 @@ fn move-cursor-to-left-margin-of-next-line screen: (addr screen) {
set-cursor-position screen, cursor-x, cursor-y
}
fn draw-grapheme-at-cursor screen: (addr screen), g: grapheme, color: int, background-color: int {
fn draw-grapheme-at-cursor-over-full-screen screen: (addr screen), g: grapheme, color: int, background-color: int {
var cursor-x/eax: int <- copy 0
var cursor-y/ecx: int <- copy 0
cursor-x, cursor-y <- cursor-position screen
draw-grapheme screen, g, cursor-x, cursor-y, color, background-color
var width/eax: int <- copy 0
var dummy/ecx: int <- copy 0
width, dummy <- screen-size screen
move-cursor-rightward-and-downward screen, 0 width
}
# we can't really render non-ASCII yet, but when we do we'll be ready
fn draw-code-point-at-cursor screen: (addr screen), c: code-point, color: int, background-color: int {
fn draw-code-point-at-cursor-over-full-screen screen: (addr screen), c: code-point, color: int, background-color: int {
var g/eax: grapheme <- copy c
draw-grapheme-at-cursor screen, g, color, background-color
draw-grapheme-at-cursor-over-full-screen screen, g, color, background-color
}
# draw a single line of text from x, y to xmax

View File

@ -43,15 +43,13 @@ fn check-screen-row-from _screen: (addr screen), x: int, y: int, expected: (addr
failure-count <- increment
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
draw-grapheme-at-cursor-over-full-screen 0/screen, g, 3/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
move-cursor-to-left-margin-of-next-line 0/screen
}
@ -125,15 +123,13 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
count-test-failure
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
draw-grapheme-at-cursor-over-full-screen 0/screen, g, 3/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
move-cursor-to-left-margin-of-next-line 0/screen
}
@ -149,8 +145,7 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
count-test-failure
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
@ -221,15 +216,13 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
count-test-failure
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
draw-grapheme-at-cursor-over-full-screen 0/screen, g, 3/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
move-cursor-to-left-margin-of-next-line 0/screen
break $check-screen-row-in-background-color-from:compare-graphemes
@ -246,8 +239,7 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
count-test-failure
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg

View File

@ -28,8 +28,7 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk)
var key2/eax: int <- copy key
append-byte in, key2
var g/eax: grapheme <- copy key2
draw-grapheme-at-cursor screen, g, 0xf/fg, 0/bg
move-cursor-right 0
draw-grapheme-at-cursor-over-full-screen screen, g, 0xf/fg, 0/bg
loop
}
clear-screen screen

View File

@ -36,12 +36,11 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk)
var key2/eax: int <- copy key
append-byte in, key2
var g/eax: grapheme <- copy key2
draw-grapheme-at-cursor screen, g, 0xf/fg, 0/bg
move-cursor-right 0
draw-grapheme-at-cursor-over-full-screen screen, g, 0xf/fg, 0/bg
loop
}
# clear cursor
draw-grapheme-at-cursor screen, space, 3/fg/never-used, 0/bg
draw-grapheme-at-cursor-over-full-screen screen, space, 3/fg/never-used, 0/bg
# parse and eval
var out/eax: int <- simplify in
# print

View File

@ -242,8 +242,7 @@ fn render-empty-screen screen: (addr screen), _target-screen: (addr screen), xmi
{
compare x, *width
break-if->=
draw-code-point-at-cursor screen, 0x20/space, 0x18/fg, 0/bg
move-cursor-right screen
draw-code-point-at-cursor-over-full-screen screen, 0x20/space, 0x18/fg, 0/bg
x <- increment
loop
}
@ -387,7 +386,7 @@ fn print-screen-cell-of-fake-screen screen: (addr screen), _target: (addr screen
var src-grapheme/eax: (addr grapheme) <- get src-cell, data
var src-color/ecx: (addr int) <- get src-cell, color
var src-background-color/edx: (addr int) <- get src-cell, background-color
draw-grapheme-at-cursor screen, *src-grapheme, *src-color, *src-background-color
draw-grapheme-at-cursor-over-full-screen screen, *src-grapheme, *src-color, *src-background-color
}
fn render-sandbox-edit-menu screen: (addr screen), _self: (addr sandbox) {