diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-04-14 21:30:39 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-04-14 21:47:59 -0700 |
commit | 5a46430e0e56912b0ccf7fca64e4a2d4b76e172f (patch) | |
tree | 1a1f6c2aed8b3e67bd2f2205ec7e3b28df61414c /shell | |
parent | 98715a829eb49d92b4efe815ad0ceabaf29fc5f1 (diff) | |
download | mu-5a46430e0e56912b0ccf7fca64e4a2d4b76e172f.tar.gz |
.
Diffstat (limited to 'shell')
-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 |