diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-04-14 21:49:43 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-04-14 21:52:57 -0700 |
commit | 8db35826e6d96c3248d62a40c2b5137e5bdc0f1e (patch) | |
tree | c254909fcd12d9a12e6ba18979a783624970f952 | |
parent | 5a46430e0e56912b0ccf7fca64e4a2d4b76e172f (diff) | |
download | mu-8db35826e6d96c3248d62a40c2b5137e5bdc0f1e.tar.gz |
shell: starting to work on persistent globals
-rw-r--r-- | shell/main.mu | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/shell/main.mu b/shell/main.mu index b1292131..0aa034e5 100644 --- a/shell/main.mu +++ b/shell/main.mu @@ -26,10 +26,15 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) # Read a null-terminated sequence of keys from disk and load them into # sandbox. fn load-sandbox data-disk: (addr disk), _self: (addr sandbox) { - var self/esi: (addr sandbox) <- copy _self + 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 data/esi: (addr gap-buffer) <- copy _data + # data-disk -> stream var s-storage: (stream byte 0x200) var s/ebx: (addr stream byte) <- address s-storage load-sector data-disk, 0/lba, s + # stream -> gap-buffer { var done?/eax: boolean <- stream-empty? s compare done?, 0/false @@ -37,7 +42,8 @@ fn load-sandbox data-disk: (addr disk), _self: (addr sandbox) { var key/eax: byte <- read-byte s compare key, 0/null break-if-= - edit-sandbox self, key, 0/no-globals, 0/no-screen, 0/no-keyboard, 0/no-disk + var g/eax: grapheme <- copy key + edit-gap-buffer data, g loop } } |