about summary refs log tree commit diff stats
path: root/subx/059read-byte.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-12-04 12:16:17 -0800
committerKartik Agaram <vc@akkartik.com>2018-12-04 12:16:17 -0800
commita94b60b5cc217f08e4fd6c949e6af590c55a176b (patch)
tree6939ccd3c67212a564421876362ab69d1c813c71 /subx/059read-byte.subx
parent707935d0a83446380abee0c6477328166841793e (diff)
downloadmu-a94b60b5cc217f08e4fd6c949e6af590c55a176b.tar.gz
4840
New helper: printing a string to a buffered file.
Diffstat (limited to 'subx/059read-byte.subx')
-rw-r--r--subx/059read-byte.subx9
1 files changed, 5 insertions, 4 deletions
diff --git a/subx/059read-byte.subx b/subx/059read-byte.subx
index e91a3532..ea16c928 100644
--- a/subx/059read-byte.subx
+++ b/subx/059read-byte.subx
@@ -81,7 +81,7 @@ $read-byte:from-stream:
     # read byte from stream
     # AL = f->data[f->read]
     31/xor                          3/mod/direct    0/rm32/EAX    .           .             .           0/r32/EAX   .               .                 # clear EAX
-    8a/copy-byte                    1/mod/*+disp8   4/rm32/sib    6/base/ESI  1/index/ECX   .           0/r32/AL    0x10/disp8      .                 # copy *(ESI+ECX+16) to AL
+    8a/copy-byte                    1/mod/*+disp8   4/rm32/sib    6/base/ESI  1/index/ECX   .           0/r32/AL    0x10/disp8      .                 # copy byte at *(ESI+ECX+16) to AL
     # ++f->read
     ff          0/subop/increment   1/mod/*+disp8   6/rm32/ESI    .           .             .           .           8/disp8         .                 # increment *(ESI+8)
 $read-byte:end:
@@ -234,6 +234,7 @@ test-read-byte-end-of-file:
 
 == data
 
+# a test buffered file for _test-stream
 _test-buffered-file:
     # file descriptor or (address stream)
     _test-stream/imm32
@@ -241,9 +242,9 @@ _test-buffered-file:
     00 00 00 00
     # current read index
     00 00 00 00
-    # length (8)
-    08 00 00 00
+    # length (6)
+    06 00 00 00
     # data
-    00 00 00 00 00 00 00 00  # 8 bytes
+    00 00 00 00 00 00  # 6 bytes
 
 # . . vim:nowrap:textwidth=0