diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-10-25 05:54:06 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-10-25 06:10:36 -0700 |
commit | f0b7e327c5e612ea2f72f2e41c046a2105076654 (patch) | |
tree | b598dfdfb31a748634302b6f336aebd356fe372d /064write-byte.subx | |
parent | 76599bb813970f09ddd27d476f5b62be9bf97d4d (diff) | |
download | mu-f0b7e327c5e612ea2f72f2e41c046a2105076654.tar.gz |
5714
Replace calculations of constants with labels.
Diffstat (limited to '064write-byte.subx')
-rw-r--r-- | 064write-byte.subx | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/064write-byte.subx b/064write-byte.subx index c8a6f800..3b96bbd6 100644 --- a/064write-byte.subx +++ b/064write-byte.subx @@ -10,13 +10,15 @@ Stdout: # file descriptor or (address stream) 1/imm32 # standard output - # current write index +Stdout->buffer: + # inlined fields for a stream + # current write index 0/imm32 - # current read index + # current read index 0/imm32 - # length + # length 8/imm32 - # data + # data 00 00 00 00 00 00 00 00 # 8 bytes # TODO: 8 bytes is too small. We'll need to grow the buffer for efficiency. But @@ -113,11 +115,9 @@ test-write-byte-buffered-single: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . clear-stream(_test-buffered-file+4) + # . clear-stream(_test-buffered-file->buffer) # . . push args - b8/copy-to-eax _test-buffered-file/imm32 - 05/add-to-eax 4/imm32 - 50/push-eax + 68/push _test-buffered-file->buffer/imm32 # . . call e8/call clear-stream/disp32 # . . discard args @@ -159,22 +159,18 @@ test-write-byte-buffered-multiple-flushes: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . clear-stream(_test-buffered-file+4) + # . clear-stream(_test-buffered-file->buffer) # . . push args - b8/copy-to-eax _test-buffered-file/imm32 - 05/add-to-eax 4/imm32 - 50/push-eax + 68/push _test-buffered-file->buffer/imm32 # . . call e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # fill up the buffer for _test-buffered-file - # . write(_test-buffered-file+4, "abcdef") + # . write(_test-buffered-file->buffer, "abcdef") # . . push args 68/push "abcdef"/imm32 - b8/copy-to-eax _test-buffered-file/imm32 - 05/add-to-eax 4/imm32 - 50/push-eax + 68/push _test-buffered-file->buffer/imm32 # . . call e8/call write/disp32 # . . discard args @@ -332,6 +328,7 @@ _test-output-stream: _test-output-buffered-file: # file descriptor or (address stream) _test-output-stream/imm32 +_test-output-buffered-file->buffer: # current write index 0/imm32 # current read index @@ -362,6 +359,7 @@ _test-error-stream: _test-error-buffered-file: # file descriptor or (address stream) _test-error-stream/imm32 +_test-error-buffered-file->buffer: # current write index 0/imm32 # current read index |