about summary refs log tree commit diff stats
path: root/subx/apps/dquotes.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-05-10 16:54:05 -0700
committerGitHub <noreply@github.com>2019-05-10 16:54:05 -0700
commit1ebb7614921a2b426ed84c4c51b100176e2a4187 (patch)
tree12de1a20312a788d07ef6564084b7ca81aa15ba1 /subx/apps/dquotes.subx
parent3ae1fd0048cb0745f570df0263a828a30315a00b (diff)
parentc88b9e31259d433c7e63fcb19d430daf9b1c723c (diff)
downloadmu-1ebb7614921a2b426ed84c4c51b100176e2a4187.tar.gz
Merge pull request #28 from akkartik/allocate-using-mmap
Build `allocate` out of `mmap`
Diffstat (limited to 'subx/apps/dquotes.subx')
-rw-r--r--subx/apps/dquotes.subx24
1 files changed, 24 insertions, 0 deletions
diff --git a/subx/apps/dquotes.subx b/subx/apps/dquotes.subx
index b236ac2f..fcac2698 100644
--- a/subx/apps/dquotes.subx
+++ b/subx/apps/dquotes.subx
@@ -22,12 +22,30 @@
 Entry:  # run tests if necessary, convert stdin if not
 
     # for debugging: run a single test
+#?     # . Heap = new-segment(4096)
+#?     # . . push args
+#?     68/push  Heap/imm32
+#?     68/push  0x1000/imm32
+#?     # . . call
+#?     e8/call  new-segment/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . test()
 #?     e8/call test-next-word-returns-string-with-escapes/disp32
 #?     8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/EBX   Num-test-failures/disp32          # copy *Num-test-failures to EBX
 #?     eb/jump  $main:end/disp8
 
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # initialize heap
+    # . Heap = new-segment(4096)
+    # . . push args
+    68/push  Heap/imm32
+    68/push  0x1000/imm32
+    # . . call
+    e8/call  new-segment/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
     # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
@@ -1054,4 +1072,10 @@ Segment-size:
 Next-string-literal:  # tracks the next auto-generated variable name
   1/imm32
 
+Heap:
+  # curr
+  0/imm32
+  # limit
+  0/imm32
+
 # . . vim:nowrap:textwidth=0