From 0192e2031f41b1eabe0c2d764d7710fafe8f4a01 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 15 Apr 2021 20:12:36 -0700 Subject: . --- shell/main.mu | 7 ++----- shell/sandbox.mu | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/shell/main.mu b/shell/main.mu index e0aac0ad..e6df31ee 100644 --- a/shell/main.mu +++ b/shell/main.mu @@ -66,19 +66,16 @@ fn load-state data-disk: (addr disk), _sandbox: (addr sandbox), globals: (addr g # ((globals . ((a . (fn ...)) # ...)) # (sandbox . ...)) -fn store-state data-disk: (addr disk), _sandbox: (addr sandbox), _globals: (addr global-table) { +fn store-state data-disk: (addr disk), sandbox: (addr sandbox), globals: (addr global-table) { compare data-disk, 0/no-disk { break-if-!= return } - var sandbox/eax: (addr sandbox) <- copy _sandbox - var data-ah/eax: (addr handle gap-buffer) <- get sandbox, data - var data/eax: (addr gap-buffer) <- lookup *data-ah var stream-storage: (stream byte 0x200) var stream/edi: (addr stream byte) <- address stream-storage write stream, "((sandbox . " - append-gap-buffer data, stream + write-sandbox stream, sandbox write stream, "))" store-sector data-disk, 0/lba, stream } diff --git a/shell/sandbox.mu b/shell/sandbox.mu index 1a82f52a..69cb511b 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -53,6 +53,13 @@ fn allocate-sandbox-with _out: (addr handle sandbox), s: (addr array byte) { initialize-sandbox-with out-addr, s } +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 + append-gap-buffer data, out +} + ## fn render-sandbox screen: (addr screen), _self: (addr sandbox), xmin: int, ymin: int, xmax: int, ymax: int, globals: (addr global-table) { -- cgit 1.4.1-2-gfad0