a second place with lousy storage management
This commit is contained in:
parent
4b57c101b7
commit
119e661f20
|
@ -164,10 +164,22 @@ fn render-grapheme screen: (addr screen), g: grapheme, xmin: int, ymin: int, xma
|
||||||
# return the next (x, y) coordinate in raster order where drawing stopped
|
# return the next (x, y) coordinate in raster order where drawing stopped
|
||||||
# that way the caller can draw more if given the same min and max bounding-box.
|
# that way the caller can draw more if given the same min and max bounding-box.
|
||||||
# if there isn't enough space, truncate
|
# if there isn't enough space, truncate
|
||||||
fn draw-text-wrapping-right-then-down screen: (addr screen), text: (addr array byte), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, color: int, background-color: int -> _/eax: int, _/ecx: int {
|
fn draw-text-wrapping-right-then-down screen: (addr screen), _text: (addr array byte), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, color: int, background-color: int -> _/eax: int, _/ecx: int {
|
||||||
var stream-storage: (stream byte 0x100)
|
# TODO: obscenely pessimally sized
|
||||||
var stream/esi: (addr stream byte) <- address stream-storage
|
var stream-storage: (stream byte 0x200)
|
||||||
write stream, text
|
var stream/edi: (addr stream byte) <- address stream-storage
|
||||||
|
var text/esi: (addr array byte) <- copy _text
|
||||||
|
var len/eax: int <- length text
|
||||||
|
compare len, 0x200
|
||||||
|
{
|
||||||
|
break-if-<
|
||||||
|
write stream, "ERROR: stream too small in draw-text-wrapping-right-then-down"
|
||||||
|
}
|
||||||
|
compare len, 0x200
|
||||||
|
{
|
||||||
|
break-if->=
|
||||||
|
write stream, text
|
||||||
|
}
|
||||||
var x/eax: int <- copy _x
|
var x/eax: int <- copy _x
|
||||||
var y/ecx: int <- copy _y
|
var y/ecx: int <- copy _y
|
||||||
x, y <- draw-stream-wrapping-right-then-down screen, stream, xmin, ymin, xmax, ymax, x, y, color, background-color
|
x, y <- draw-stream-wrapping-right-then-down screen, stream, xmin, ymin, xmax, ymax, x, y, color, background-color
|
||||||
|
|
|
@ -15,6 +15,7 @@ fn tokenize in: (addr gap-buffer), out: (addr stream cell), trace: (addr trace)
|
||||||
break-if-!=
|
break-if-!=
|
||||||
# initialize token data each iteration to avoid aliasing
|
# initialize token data each iteration to avoid aliasing
|
||||||
var dest-ah/eax: (addr handle stream byte) <- get token, text-data
|
var dest-ah/eax: (addr handle stream byte) <- get token, text-data
|
||||||
|
# TODO: obscenely pessimally sized
|
||||||
# I'm allocating 1KB for every. single. token. Just because a whole definition needs to fit in a string sometimes. Absolutely bonkers.
|
# I'm allocating 1KB for every. single. token. Just because a whole definition needs to fit in a string sometimes. Absolutely bonkers.
|
||||||
populate-stream dest-ah, 0x400/max-definition-size
|
populate-stream dest-ah, 0x400/max-definition-size
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue