about summary refs log tree commit diff stats
path: root/shell/sandbox.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-28 17:49:37 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-28 17:49:55 -0700
commitb9c59a5f5be95b284fe4fbdf5b71c5265f8c52ee (patch)
treece25d3eb16d330da924c11853efdcbd75322ec63 /shell/sandbox.mu
parentef8dc999ca73bc3bcce1cdd1b86290b3fb689f4f (diff)
downloadmu-b9c59a5f5be95b284fe4fbdf5b71c5265f8c52ee.tar.gz
shell: load/store from/to disk with indent
Once I came up with the right approach, this worked on the first try once
I got the types and registers to line up!
Diffstat (limited to 'shell/sandbox.mu')
-rw-r--r--shell/sandbox.mu17
1 files changed, 17 insertions, 0 deletions
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index ed824958..11d109b8 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -730,6 +730,23 @@ fn run _in-ah: (addr handle gap-buffer), out: (addr stream byte), globals: (addr
   mark-lines-dirty trace
 }
 
+fn read-evaluate-and-stash-to-globals _in-ah: (addr handle gap-buffer), globals: (addr global-table) {
+  var in-ah/eax: (addr handle gap-buffer) <- copy _in-ah
+  var in/eax: (addr gap-buffer) <- lookup *in-ah
+  var read-result-h: (handle cell)
+  var read-result-ah/esi: (addr handle cell) <- address read-result-h
+  read-cell in, read-result-ah, 0/no-trace
+  var nil-storage: (handle cell)
+  var nil-ah/eax: (addr handle cell) <- address nil-storage
+  allocate-pair nil-ah
+  var eval-result-storage: (handle cell)
+  var eval-result/edi: (addr handle cell) <- address eval-result-storage
+  debug-print "^", 4/fg, 0/bg
+  evaluate read-result-ah, eval-result, *nil-ah, globals, 0/no-trace, 0/no-screen-cell, 0/no-keyboard-cell, 1/call-number
+  debug-print "$", 4/fg, 0/bg
+  move-gap-buffer-to-global globals, read-result-ah, _in-ah
+}
+
 fn test-run-integer {
   var sandbox-storage: sandbox
   var sandbox/esi: (addr sandbox) <- address sandbox-storage