diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-06-20 20:36:47 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-06-20 20:36:47 -0700 |
commit | 9d7d99fe6cc5a05960ef52cdfa8acefabf8e40bf (patch) | |
tree | bc1829c1f4c5e3256dfabc552664fbd5e3e9840e /309stream.subx | |
parent | 29795a0db4e1d180217123f81f14b69189b3c12c (diff) | |
download | mu-9d7d99fe6cc5a05960ef52cdfa8acefabf8e40bf.tar.gz |
snapshot
This is going better than expected; just 3 failing tests among the new ones.
Diffstat (limited to '309stream.subx')
-rw-r--r-- | 309stream.subx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/309stream.subx b/309stream.subx index c39a7146..61da00ae 100644 --- a/309stream.subx +++ b/309stream.subx @@ -208,7 +208,7 @@ $stream-final:end: c3/return # compare all the data in two streams (ignoring the read pointer) -streams-data-equal?: # f: (addr stream byte), s: (addr array byte) -> result/eax: boolean +streams-data-equal?: # a: (addr stream byte), b: (addr array byte) -> result/eax: boolean # pseudocode: # awrite = a->write # if (awrite != b->write) return false @@ -295,3 +295,21 @@ $streams-data-equal?:end: 89/<- %esp 5/r32/ebp 5d/pop-to-ebp c3/return + +# helper for tests +check-streams-data-equal: # s: (addr stream _), expected: (addr array _), msg: (addr array byte) + # . prologue + 55/push-ebp + 89/<- %ebp 4/r32/esp + # . save registers + 50/push-eax + # + (streams-data-equal? *(ebp+8) *(ebp+0xc)) # => eax + (check-ints-equal %eax 1 *(ebp+0x10)) +$check-streams-equal:end: + # . restore registers + 58/pop-to-eax + # . epilogue + 89/<- %esp 5/r32/ebp + 5d/pop-to-ebp + c3/return |