This commit is contained in:
Kartik K. Agaram 2021-04-15 20:56:52 -07:00
parent b2e0ce69ef
commit 0f760bd60c
3 changed files with 17 additions and 5 deletions

View File

@ -45,7 +45,7 @@ fn initialize-globals _self: (addr global-table) {
}
fn write-globals out: (addr stream byte), _self: (addr global-table) {
write out, "()\n"
write out, " (globals . ())\n"
}
fn render-globals screen: (addr screen), _self: (addr global-table), xmin: int, ymin: int, xmax: int, ymax: int {

View File

@ -56,6 +56,12 @@ fn load-state data-disk: (addr disk), _sandbox: (addr sandbox), globals: (addr g
var sandbox-cell-storage: (handle cell)
var sandbox-cell-ah/edx: (addr handle cell) <- address sandbox-cell-storage
lookup-symbol sandbox-literal, sandbox-cell-ah, *initial-root, 0/no-globals, 0/no-trace, 0/no-screen, 0/no-keyboard
var sandbox-cell/eax: (addr cell) <- lookup *sandbox-cell-ah
compare sandbox-cell, 0
{
break-if-!=
return
}
# print: cell -> stream
print-cell sandbox-cell-ah, s, 0/no-trace
# stream -> gap-buffer
@ -74,11 +80,9 @@ fn store-state data-disk: (addr disk), sandbox: (addr sandbox), globals: (addr g
}
var stream-storage: (stream byte 0x200)
var stream/edi: (addr stream byte) <- address stream-storage
write stream, "((globals . "
write stream, "(\n"
write-globals stream, globals
write stream, " )\n"
write stream, " (sandbox . "
write-sandbox stream, sandbox
write stream, "))"
write stream, ")\n"
store-sector data-disk, 0/lba, stream
}

View File

@ -57,7 +57,15 @@ fn write-sandbox out: (addr stream byte), _self: (addr sandbox) {
var self/eax: (addr sandbox) <- copy _self
var data-ah/eax: (addr handle gap-buffer) <- get self, data
var data/eax: (addr gap-buffer) <- lookup *data-ah
{
var len/eax: int <- gap-buffer-length data
compare len, 0
break-if-!=
return
}
write out, " (sandbox . "
append-gap-buffer data, out
write out, ")\n"
}
##