diff options
-rw-r--r-- | 500fake-screen.mu | 19 | ||||
-rw-r--r-- | 504test-screen.mu | 12 |
2 files changed, 31 insertions, 0 deletions
diff --git a/500fake-screen.mu b/500fake-screen.mu index a2e9ae40..1d13f2cf 100644 --- a/500fake-screen.mu +++ b/500fake-screen.mu @@ -28,6 +28,7 @@ type screen-cell { data: grapheme color: int background-color: int + unused?: boolean } fn initialize-screen _screen: (addr screen), width: int, height: int, pixel-graphics?: boolean { @@ -424,6 +425,24 @@ fn clear-rect-on-real-screen xmin: int, ymin: int, xmax: int, ymax: int, backgro } } +fn screen-cell-unused-at? _screen: (addr screen), x: int, y: int -> _/eax: boolean { + var screen/esi: (addr screen) <- copy _screen + var index/ecx: int <- screen-cell-index screen, x, y + var result/eax: boolean <- screen-cell-unused-at-index? screen, index + return result +} + +fn screen-cell-unused-at-index? _screen: (addr screen), _index: int -> _/eax: boolean { + var screen/esi: (addr screen) <- copy _screen + var data-ah/eax: (addr handle array screen-cell) <- get screen, data + var data/eax: (addr array screen-cell) <- lookup *data-ah + var index/ecx: int <- copy _index + var offset/ecx: (offset screen-cell) <- compute-offset data, index + var cell/eax: (addr screen-cell) <- index data, offset + var src/eax: (addr boolean) <- get cell, unused? + return *src +} + fn screen-grapheme-at _screen: (addr screen), x: int, y: int -> _/eax: grapheme { var screen/esi: (addr screen) <- copy _screen var index/ecx: int <- screen-cell-index screen, x, y diff --git a/504test-screen.mu b/504test-screen.mu index 553c6112..da146fb6 100644 --- a/504test-screen.mu +++ b/504test-screen.mu @@ -21,6 +21,9 @@ fn check-screen-row-from _screen: (addr screen), x: int, y: int, expected: (addr compare done?, 0 break-if-!= { + var unused?/eax: boolean <- screen-cell-unused-at-index? screen, index + compare unused?, 0/false + break-if-!= var _g/eax: grapheme <- screen-grapheme-at-index screen, index var g/ebx: grapheme <- copy _g var expected-grapheme/eax: grapheme <- read-grapheme e-addr @@ -86,6 +89,9 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in compare done?, 0 break-if-!= { + var unused?/eax: boolean <- screen-cell-unused-at-index? screen, index + compare unused?, 0/false + break-if-!= var _g/eax: grapheme <- screen-grapheme-at-index screen, index var g/ebx: grapheme <- copy _g var _expected-grapheme/eax: grapheme <- read-grapheme e-addr @@ -179,6 +185,9 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y: compare done?, 0 break-if-!= { + var unused?/eax: boolean <- screen-cell-unused-at-index? screen, index + compare unused?, 0/false + break-if-!= var _g/eax: grapheme <- screen-grapheme-at-index screen, index var g/ebx: grapheme <- copy _g var _expected-grapheme/eax: grapheme <- read-grapheme e-addr @@ -277,6 +286,9 @@ fn check-background-color-in-screen-row-from _screen: (addr screen), bg: int, y: compare done?, 0 break-if-!= { + var unused?/eax: boolean <- screen-cell-unused-at-index? screen, index + compare unused?, 0/false + break-if-!= var _expected-bit/eax: grapheme <- read-grapheme e-addr var expected-bit/edi: grapheme <- copy _expected-bit $check-background-color-in-screen-row-from:compare-cells: { |