diff options
-rw-r--r-- | shell/main.mu | 15 | ||||
-rw-r--r-- | shell/sandbox.mu | 13 |
2 files changed, 18 insertions, 10 deletions
diff --git a/shell/main.mu b/shell/main.mu index a19bcead..b1292131 100644 --- a/shell/main.mu +++ b/shell/main.mu @@ -41,3 +41,18 @@ fn load-sandbox data-disk: (addr disk), _self: (addr sandbox) { loop } } + +fn store-sandbox data-disk: (addr disk), _self: (addr sandbox) { + compare data-disk, 0/no-disk + { + break-if-!= + return + } + 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 stream-storage: (stream byte 0x200) + var stream/edi: (addr stream byte) <- address stream-storage + emit-gap-buffer data, stream + store-sector data-disk, 0/lba, stream +} diff --git a/shell/sandbox.mu b/shell/sandbox.mu index b9c5037c..b127b642 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -506,19 +506,12 @@ fn edit-sandbox _self: (addr sandbox), key: byte, globals: (addr global-table), { compare g, 0x13/ctrl-s break-if-!= - # save to disk + # + store-sandbox data-disk, self + # run sandbox var data-ah/eax: (addr handle gap-buffer) <- get self, data var _data/eax: (addr gap-buffer) <- lookup *data-ah var data/ecx: (addr gap-buffer) <- copy _data - { - compare data-disk, 0/no-disk - break-if-= - var stream-storage: (stream byte 0x200) - var stream/esi: (addr stream byte) <- address stream-storage - emit-gap-buffer data, stream - store-sector data-disk, 0/lba, stream - } - # run sandbox var value-ah/eax: (addr handle stream byte) <- get self, value var _value/eax: (addr stream byte) <- lookup *value-ah var value/edx: (addr stream byte) <- copy _value |