From 833152354e906bee0721e02995f186c1948d72f1 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 14 Feb 2019 16:49:10 -0800 Subject: 4963 --- subx/examples/ex10.subx | 4 ++-- subx/examples/ex11.subx | 6 +++--- subx/examples/ex8.subx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'subx/examples') diff --git a/subx/examples/ex10.subx b/subx/examples/ex10.subx index 07b5b4bb..7e37a54b 100644 --- a/subx/examples/ex10.subx +++ b/subx/examples/ex10.subx @@ -41,9 +41,9 @@ argv-equal: # (s1, s2) : null-terminated ascii strings -> EAX : boolean $argv-equal:loop: # c1/EAX, c2/EBX = *s1, *s2 b8/copy-to-EAX 0/imm32 - 8a/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . . # copy byte at *ECX to lower byte of EAX + 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . . # copy byte at *ECX to AL bb/copy-to-EBX 0/imm32 - 8a/copy 0/mod/indirect 2/rm32/EDX . . . 3/r32/EBX . . # copy byte at *EDX to lower byte of EBX + 8a/copy-byte 0/mod/indirect 2/rm32/EDX . . . 3/r32/BL . . # copy byte at *EDX to BL # if (c1 == 0) break 3d/compare-EAX 0/imm32 74/jump-if-equal $argv-equal:break/disp8 diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx index 49e0c753..bb3c8e23 100644 --- a/subx/examples/ex11.subx +++ b/subx/examples/ex11.subx @@ -76,9 +76,9 @@ $kernel-string-equal?:loop: 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . . # compare ECX with EDX 7d/jump-if-greater-or-equal $kernel-string-equal?:break/disp8 # c1 = *s1 - 8a/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . . # copy byte at *EDI to lower byte of EAX + 8a/copy-byte 0/mod/indirect 7/rm32/EDI . . . 0/r32/AL . . # copy byte at *EDI to AL # c2 = *s2 - 8a/copy 0/mod/indirect 6/rm32/ESI . . . 3/r32/EBX . . # copy byte at *ESI to lower byte of EBX + 8a/copy-byte 0/mod/indirect 6/rm32/ESI . . . 3/r32/BL . . # copy byte at *ESI to BL # if (c1 == 0) return false 3d/compare-EAX 0/imm32 74/jump-if-equal $kernel-string-equal?:false/disp8 @@ -94,7 +94,7 @@ $kernel-string-equal?:loop: eb/jump $kernel-string-equal?:loop/disp8 $kernel-string-equal?:break: # return *s1 == 0 - 8a/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . . # copy byte at *EDI to lower byte of EAX + 8a/copy-byte 0/mod/indirect 7/rm32/EDI . . . 0/r32/AL . . # copy byte at *EDI to AL 3d/compare-EAX 0/imm32 75/jump-if-not-equal $kernel-string-equal?:false/disp8 $kernel-string-equal?:true: diff --git a/subx/examples/ex8.subx b/subx/examples/ex8.subx index f45813ec..c7c51c91 100644 --- a/subx/examples/ex8.subx +++ b/subx/examples/ex8.subx @@ -41,7 +41,7 @@ ascii-length: # s : (address array byte) -> n/EAX b8/copy-to-EAX 0/imm32 $ascii-length-loop: # var c/ECX = *s - 8a/copy 0/mod/* 2/rm32/EDX . . . 1/r32/ECX . . # copy byte at *EDX to lower byte of ECX + 8a/copy-byte 0/mod/* 2/rm32/EDX . . . 1/r32/CL . . # copy byte at *EDX to CL # if (c == '\0') break 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0/imm32 # compare ECX 74/jump-if-equal $ascii-length-ret/disp8 -- cgit 1.4.1-2-gfad0