about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-04-16 23:10:39 -0700
committerKartik Agaram <vc@akkartik.com>2019-04-16 23:10:39 -0700
commit48f85a97391508a8337acf38c5dd7e33ad58858c (patch)
tree6966c4e63cbda2939fa43e3947b9fd3a7175bb41 /subx
parenta8c644607d897fbb3c51c44e9bb3b0d6c78da0f0 (diff)
downloadmu-48f85a97391508a8337acf38c5dd7e33ad58858c.tar.gz
5103
Diffstat (limited to 'subx')
-rw-r--r--subx/apps/dquotesbin18002 -> 18270 bytes
-rw-r--r--subx/apps/dquotes.subx149
2 files changed, 88 insertions, 61 deletions
diff --git a/subx/apps/dquotes b/subx/apps/dquotes
index bdf51016..c1df9e13 100644
--- a/subx/apps/dquotes
+++ b/subx/apps/dquotes
Binary files differdiff --git a/subx/apps/dquotes.subx b/subx/apps/dquotes.subx
index 61a1b83b..1618b829 100644
--- a/subx/apps/dquotes.subx
+++ b/subx/apps/dquotes.subx
@@ -290,9 +290,9 @@ test-next-word:
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # setup
-    # . clear-stream(_test-stream)
+    # . clear-stream(_test-input-stream)
     # . . push args
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  clear-stream/disp32
     # . . discard args
@@ -301,43 +301,43 @@ test-next-word:
     68/push  0/imm32/end
     68/push  0/imm32/start
     89/copy                         3/mod/direct    1/rm32/ECX    .           .             .           4/r32/ESP   .               .                 # copy ESP to ECX
-    # write(_test-stream, "  ab")
+    # write(_test-input-stream, "  ab")
     # . . push args
     68/push  "  ab"/imm32
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  write/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # next-word(_test-stream, slice)
+    # next-word(_test-input-stream, slice)
     # . . push args
     51/push-ECX
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  next-word/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # check-ints-equal(slice->start - _test-stream->data, 2, msg)
-    # . check-ints-equal(slice->start - _test-stream, 14, msg)
+    # check-ints-equal(slice->start - _test-input-stream->data, 2, msg)
+    # . check-ints-equal(slice->start - _test-input-stream, 14, msg)
     # . . push args
     68/push  "F - test-next-word: start"/imm32
     68/push  0xe/imm32
-    # . . push slice->start - _test-stream
+    # . . push slice->start - _test-input-stream
     8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy *ECX to EAX
-    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-stream/imm32 # subtract from EAX
+    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-input-stream/imm32 # subtract from EAX
     50/push-EAX
     # . . call
     e8/call  check-ints-equal/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-    # check-ints-equal(slice->end - _test-stream->data, 4, msg)
-    # . check-ints-equal(slice->end - _test-stream, 16, msg)
+    # check-ints-equal(slice->end - _test-input-stream->data, 4, msg)
+    # . check-ints-equal(slice->end - _test-input-stream, 16, msg)
     # . . push args
     68/push  "F - test-next-word: end"/imm32
     68/push  0x10/imm32
-    # . . push slice->end - _test-stream
+    # . . push slice->end - _test-input-stream
     8b/copy                         1/mod/*+disp8   1/rm32/ECX    .           .             .           0/r32/EAX   4/disp8         .                 # copy *(ECX+4) to EAX
-    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-stream/imm32 # subtract from EAX
+    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-input-stream/imm32 # subtract from EAX
     50/push-EAX
     # . . call
     e8/call  check-ints-equal/disp32
@@ -353,9 +353,9 @@ test-next-word-returns-whole-comment:
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # setup
-    # . clear-stream(_test-stream)
+    # . clear-stream(_test-input-stream)
     # . . push args
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  clear-stream/disp32
     # . . discard args
@@ -364,43 +364,43 @@ test-next-word-returns-whole-comment:
     68/push  0/imm32/end
     68/push  0/imm32/start
     89/copy                         3/mod/direct    1/rm32/ECX    .           .             .           4/r32/ESP   .               .                 # copy ESP to ECX
-    # write(_test-stream, "  # a")
+    # write(_test-input-stream, "  # a")
     # . . push args
     68/push  "  # a"/imm32
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  write/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # next-word(_test-stream, slice)
+    # next-word(_test-input-stream, slice)
     # . . push args
     51/push-ECX
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  next-word/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # check-ints-equal(slice->start - _test-stream->data, 2, msg)
-    # . check-ints-equal(slice->start - _test-stream, 14, msg)
+    # check-ints-equal(slice->start - _test-input-stream->data, 2, msg)
+    # . check-ints-equal(slice->start - _test-input-stream, 14, msg)
     # . . push args
     68/push  "F - test-next-word-returns-whole-comment: start"/imm32
     68/push  0xe/imm32
-    # . . push slice->start - _test-stream
+    # . . push slice->start - _test-input-stream
     8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy *ECX to EAX
-    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-stream/imm32 # subtract from EAX
+    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-input-stream/imm32 # subtract from EAX
     50/push-EAX
     # . . call
     e8/call  check-ints-equal/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-    # check-ints-equal(slice->end - _test-stream->data, 5, msg)
-    # . check-ints-equal(slice->end - _test-stream, 17, msg)
+    # check-ints-equal(slice->end - _test-input-stream->data, 5, msg)
+    # . check-ints-equal(slice->end - _test-input-stream, 17, msg)
     # . . push args
     68/push  "F - test-next-word-returns-whole-comment: end"/imm32
     68/push  0x11/imm32
-    # . . push slice->end - _test-stream
+    # . . push slice->end - _test-input-stream
     8b/copy                         1/mod/*+disp8   1/rm32/ECX    .           .             .           0/r32/EAX   4/disp8         .                 # copy *(ECX+4) to EAX
-    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-stream/imm32 # subtract from EAX
+    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-input-stream/imm32 # subtract from EAX
     50/push-EAX
     # . . call
     e8/call  check-ints-equal/disp32
@@ -416,9 +416,9 @@ test-next-word-returns-empty-string-on-eof:
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # setup
-    # . clear-stream(_test-stream)
+    # . clear-stream(_test-input-stream)
     # . . push args
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  clear-stream/disp32
     # . . discard args
@@ -427,11 +427,11 @@ test-next-word-returns-empty-string-on-eof:
     68/push  0/imm32/end
     68/push  0/imm32/start
     89/copy                         3/mod/direct    1/rm32/ECX    .           .             .           4/r32/ESP   .               .                 # copy ESP to ECX
-    # write nothing to _test-stream
-    # next-word(_test-stream, slice)
+    # write nothing to _test-input-stream
+    # next-word(_test-input-stream, slice)
     # . . push args
     51/push-ECX
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  next-word/disp32
     # . . discard args
@@ -458,9 +458,9 @@ test-next-word-returns-whole-string:
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # setup
-    # . clear-stream(_test-stream)
+    # . clear-stream(_test-input-stream)
     # . . push args
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  clear-stream/disp32
     # . . discard args
@@ -469,43 +469,43 @@ test-next-word-returns-whole-string:
     68/push  0/imm32/end
     68/push  0/imm32/start
     89/copy                         3/mod/direct    1/rm32/ECX    .           .             .           4/r32/ESP   .               .                 # copy ESP to ECX
-    # write(_test-stream, " \"a b\"")
+    # write(_test-input-stream, " \"a b\"")
     # . . push args
     68/push  " \"a b\""/imm32
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  write/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # next-word(_test-stream, slice)
+    # next-word(_test-input-stream, slice)
     # . . push args
     51/push-ECX
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  next-word/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # check-ints-equal(slice->start - _test-stream->data, 1, msg)
-    # . check-ints-equal(slice->start - _test-stream, 13, msg)
+    # check-ints-equal(slice->start - _test-input-stream->data, 1, msg)
+    # . check-ints-equal(slice->start - _test-input-stream, 13, msg)
     # . . push args
     68/push  "F - test-next-word-returns-whole-string: start"/imm32
     68/push  0xd/imm32
-    # . . push slice->start - _test-stream
+    # . . push slice->start - _test-input-stream
     8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy *ECX to EAX
-    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-stream/imm32 # subtract from EAX
+    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-input-stream/imm32 # subtract from EAX
     50/push-EAX
     # . . call
     e8/call  check-ints-equal/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-    # check-ints-equal(slice->end - _test-stream->data, 6, msg)
-    # . check-ints-equal(slice->end - _test-stream, 18, msg)
+    # check-ints-equal(slice->end - _test-input-stream->data, 6, msg)
+    # . check-ints-equal(slice->end - _test-input-stream, 18, msg)
     # . . push args
     68/push  "F - test-next-word-returns-whole-string: end"/imm32
     68/push  0x12/imm32
-    # . . push slice->end - _test-stream
+    # . . push slice->end - _test-input-stream
     8b/copy                         1/mod/*+disp8   1/rm32/ECX    .           .             .           0/r32/EAX   4/disp8         .                 # copy *(ECX+4) to EAX
-    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-stream/imm32 # subtract from EAX
+    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-input-stream/imm32 # subtract from EAX
     50/push-EAX
     # . . call
     e8/call  check-ints-equal/disp32
@@ -521,9 +521,9 @@ test-next-word-returns-string-with-escapes:
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # setup
-    # . clear-stream(_test-stream)
+    # . clear-stream(_test-input-stream)
     # . . push args
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  clear-stream/disp32
     # . . discard args
@@ -532,43 +532,43 @@ test-next-word-returns-string-with-escapes:
     68/push  0/imm32/end
     68/push  0/imm32/start
     89/copy                         3/mod/direct    1/rm32/ECX    .           .             .           4/r32/ESP   .               .                 # copy ESP to ECX
-    # write(_test-stream, " \"a\\\"b\"")
+    # write(_test-input-stream, " \"a\\\"b\"")
     # . . push args
     68/push  " \"a\\\"b\""/imm32
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  write/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # next-word(_test-stream, slice)
+    # next-word(_test-input-stream, slice)
     # . . push args
     51/push-ECX
-    68/push  _test-stream/imm32
+    68/push  _test-input-stream/imm32
     # . . call
     e8/call  next-word/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # check-ints-equal(slice->start - _test-stream->data, 1, msg)
-    # . check-ints-equal(slice->start - _test-stream, 13, msg)
+    # check-ints-equal(slice->start - _test-input-stream->data, 1, msg)
+    # . check-ints-equal(slice->start - _test-input-stream, 13, msg)
     # . . push args
     68/push  "F - test-next-word-returns-string-with-escapes: start"/imm32
     68/push  0xd/imm32
-    # . . push slice->start - _test-stream
+    # . . push slice->start - _test-input-stream
     8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy *ECX to EAX
-    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-stream/imm32 # subtract from EAX
+    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-input-stream/imm32 # subtract from EAX
     50/push-EAX
     # . . call
     e8/call  check-ints-equal/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-    # check-ints-equal(slice->end - _test-stream->data, 7, msg)
-    # . check-ints-equal(slice->end - _test-stream, 19, msg)
+    # check-ints-equal(slice->end - _test-input-stream->data, 7, msg)
+    # . check-ints-equal(slice->end - _test-input-stream, 19, msg)
     # . . push args
     68/push  "F - test-next-word-returns-string-with-escapes: end"/imm32
     68/push  0x13/imm32
-    # . . push slice->end - _test-stream
+    # . . push slice->end - _test-input-stream
     8b/copy                         1/mod/*+disp8   1/rm32/ECX    .           .             .           0/r32/EAX   4/disp8         .                 # copy *(ECX+4) to EAX
-    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-stream/imm32 # subtract from EAX
+    81          5/subop/subtract    3/mod/direct    0/rm32/EAX    .           .             .           .           .               _test-input-stream/imm32 # subtract from EAX
     50/push-EAX
     # . . call
     e8/call  check-ints-equal/disp32
@@ -579,4 +579,31 @@ test-next-word-returns-string-with-escapes:
     5d/pop-to-EBP
     c3/return
 
+== data
+
+_test-input-stream:
+    # current write index
+    0/imm32
+    # current read index
+    0/imm32
+    # length
+    0x100/imm32  # 256 bytes
+    # data (16 lines x 16 bytes/line)
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+
 # . . vim:nowrap:textwidth=0