about summary refs log tree commit diff stats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/evaluate.mu6
-rw-r--r--shell/global.mu14
-rw-r--r--shell/main.mu8
-rw-r--r--shell/read.mu2
4 files changed, 21 insertions, 9 deletions
diff --git a/shell/evaluate.mu b/shell/evaluate.mu
index 36662d42..6ecb6047 100644
--- a/shell/evaluate.mu
+++ b/shell/evaluate.mu
@@ -335,7 +335,7 @@ fn push-bindings _params-ah: (addr handle cell), _args-ah: (addr handle cell), o
   # Params can only be symbols or pairs. Args can be anything.
   # trace "pushing bindings from " params " to " args {{{
   {
-    var stream-storage: (stream byte 0x100)
+    var stream-storage: (stream byte 0x200)
     var stream/ecx: (addr stream byte) <- address stream-storage
     write stream, "pushing bindings from "
     print-cell params-ah, stream, 0/no-trace
@@ -394,7 +394,7 @@ fn push-bindings _params-ah: (addr handle cell), _args-ah: (addr handle cell), o
 fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell), globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell) {
   # trace sym
   {
-    var stream-storage: (stream byte 0x200)  # pessimistically sized just for the large alist loaded from disk in `main`
+    var stream-storage: (stream byte 0x800)  # pessimistically sized just for the large alist loaded from disk in `main`
     var stream/ecx: (addr stream byte) <- address stream-storage
     write stream, "look up "
     var sym2/eax: (addr cell) <- copy sym
@@ -481,7 +481,7 @@ fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell)
       var error?/eax: boolean <- has-errors? trace
       compare error?, 0/false
       break-if-!=
-      var stream-storage: (stream byte 0x200)
+      var stream-storage: (stream byte 0x800)
       var stream/ecx: (addr stream byte) <- address stream-storage
       write stream, "=> "
       print-cell out, stream, 0/no-trace
diff --git a/shell/global.mu b/shell/global.mu
index f6f24003..c3df463e 100644
--- a/shell/global.mu
+++ b/shell/global.mu
@@ -48,6 +48,7 @@ fn initialize-globals _self: (addr global-table) {
   # for streams
   append-primitive self, "stream"
   append-primitive self, "write"
+  append-primitive self, "abort"
   # keep sync'd with render-primitives
 }
 
@@ -146,7 +147,7 @@ fn render-globals screen: (addr screen), _self: (addr global-table), xmin: int,
       x, y <- draw-text-wrapping-right-then-down screen, curr-name, xmin, ymin, xmax, ymax, x, y, 0x2a/fg=orange, 0x12/bg=almost-black
       x, y <- draw-text-wrapping-right-then-down screen, " <- ", xmin, ymin, xmax, ymax, x, y, 7/fg=grey, 0x12/bg=almost-black
       var curr-value/edx: (addr handle cell) <- get curr, value
-      var s-storage: (stream byte 0x100)
+      var s-storage: (stream byte 0x400)
       var s/ebx: (addr stream byte) <- address s-storage
       print-cell curr-value, s, 0/no-trace
       x, y <- draw-stream-wrapping-right-then-down screen, s, xmin, ymin, xmax, ymax, x, y, 3/fg=cyan, 0x12/bg=almost-black
@@ -587,6 +588,13 @@ fn apply-primitive _f: (addr cell), args-ah: (addr handle cell), out: (addr hand
     apply-write args-ah, out, trace
     return
   }
+  {
+    var abort?/eax: boolean <- string-equal? f-name, "abort"
+    compare abort?, 0/false
+    break-if-=
+    apply-abort args-ah, out, trace
+    return
+  }
   abort "unknown primitive function"
 }
 
@@ -1624,6 +1632,10 @@ fn apply-lines _args-ah: (addr handle cell), out: (addr handle cell), trace: (ad
   new-float out, result
 }
 
+fn apply-abort _args-ah: (addr handle cell), out: (addr handle cell), trace: (addr trace) {
+  abort "aa"
+}
+
 fn apply-columns _args-ah: (addr handle cell), out: (addr handle cell), trace: (addr trace) {
   trace-text trace, "eval", "apply columns"
   var args-ah/eax: (addr handle cell) <- copy _args-ah
diff --git a/shell/main.mu b/shell/main.mu
index d8fa0963..ca1392d5 100644
--- a/shell/main.mu
+++ b/shell/main.mu
@@ -30,9 +30,9 @@ fn load-state data-disk: (addr disk), _sandbox: (addr sandbox), globals: (addr g
   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 0x400)  # space for 2/sectors
+  var s-storage: (stream byte 0x800)  # space for 4/sectors
   var s/ebx: (addr stream byte) <- address s-storage
-  load-sectors data-disk, 0/lba, 2/sectors, s
+  load-sectors data-disk, 0/lba, 4/sectors, s
 #?   draw-stream-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, s, 7/fg, 0/bg
   # stream -> gap-buffer
   load-gap-buffer-from-stream data, s
@@ -94,11 +94,11 @@ fn store-state data-disk: (addr disk), sandbox: (addr sandbox), globals: (addr g
     break-if-!=
     return
   }
-  var stream-storage: (stream byte 0x400)  # space enough for 2/sectors
+  var stream-storage: (stream byte 0x800)  # space enough for 4/sectors
   var stream/edi: (addr stream byte) <- address stream-storage
   write stream, "(\n"
   write-globals stream, globals
   write-sandbox stream, sandbox
   write stream, ")\n"
-  store-sectors data-disk, 0/lba, 2/sectors, stream
+  store-sectors data-disk, 0/lba, 4/sectors, stream
 }
diff --git a/shell/read.mu b/shell/read.mu
index 96ec8d9f..7f8fd1a7 100644
--- a/shell/read.mu
+++ b/shell/read.mu
@@ -1,5 +1,5 @@
 fn read-cell in: (addr gap-buffer), out: (addr handle cell), trace: (addr trace) {
-  var tokens-storage: (stream cell 0x100)
+  var tokens-storage: (stream cell 0x200)
   var tokens/ecx: (addr stream cell) <- address tokens-storage
   tokenize in, tokens, trace
   var error?/eax: boolean <- has-errors? trace