about summary refs log tree commit diff stats
path: root/subx/052kernel_string_equal.subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx/052kernel_string_equal.subx')
-rw-r--r--subx/052kernel_string_equal.subx14
1 files changed, 7 insertions, 7 deletions
diff --git a/subx/052kernel_string_equal.subx b/subx/052kernel_string_equal.subx
index b0b646c5..85aba0c0 100644
--- a/subx/052kernel_string_equal.subx
+++ b/subx/052kernel_string_equal.subx
@@ -24,7 +24,7 @@
   e8/call  run-tests/disp32  # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
   # exit(Num-test-failures)
   8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/EBX   Num-test-failures/disp32          # copy *Num-test-failures to EBX
-  b8/copy                         .               .             .           .             .           .           .               1/imm32           # copy to EAX
+  b8/copy-to-EAX  1/imm32
   cd/syscall  0x80/imm8
 
 # compare a null-terminated ascii string with a more idiomatic length-prefixed byte array
@@ -63,15 +63,15 @@ kernel-string-equal:  # s : null-terminated ascii string, benchmark : length-pre
   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           6/r32/ESI   0xc/disp8       .                 # copy *(EBP+12) to ESI
   81          0/subop/add         3/mod/direct    6/rm32/ESI    .           .             .           .           .               4/imm32           # add to ESI
   # initialize loop counter i into ECX
-  b9/copy                         .               .             .           .             .           .           .               0/imm32/exit      # copy to ECX
+  b9/copy-to-ECX  0/imm32/exit
   # while (i/ECX < n/EDX)
 $kernel-string-equal:loop:
   39/compare                      3/mod/direct    1/rm32/ECX    .           .             .           2/r32/EDX   .               .                 # compare ECX with EDX
   74/jump-if-equal  $kernel-string-equal:break/disp8
     # c1/EAX, c2/EBX = *s, *benchmark
-  b8/copy  0/imm32  # clear EAX
+  b8/copy-to-EAX  0/imm32
   8a/copy                         0/mod/indirect  7/rm32/EDI    .           .             .           0/r32/EAX   .               .                 # copy byte at *EDI to lower byte of EAX
-  bb/copy  0/imm32  # clear EBX
+  bb/copy-to-EBX  0/imm32
   8a/copy                         0/mod/indirect  6/rm32/ESI    .           .             .           3/r32/EBX   .               .                 # copy byte at *ESI to lower byte of EBX
     # if (c1 == 0) return false
   3d/compare-EAX  0/imm32
@@ -87,16 +87,16 @@ $kernel-string-equal:loop:
   eb/jump  $kernel-string-equal:loop/disp8
 $kernel-string-equal:break:
   # if (*s/EDI == 0) return true
-  b8/copy  0/imm32  # clear EAX
+  b8/copy-to-EAX  0/imm32
   8a/copy                         0/mod/indirect  7/rm32/EDI    .           .             .           0/r32/EAX   .               .                 # copy byte at *EDI to lower byte of EAX
   3d/compare-EAX  0/imm32
   75/jump-if-not-equal  $kernel-string-equal:false/disp8
 $kernel-string-equal:true:
-  b8/copy                         .               .             .           .             .           .           .               1/imm32           # copy to EAX
+  b8/copy-to-EAX  1/imm32
   eb/jump  $kernel-string-equal:end/disp8
   # return false
 $kernel-string-equal:false:
-  b8/copy                         .               .             .           .             .           .           .               0/imm32           # copy to EAX
+  b8/copy-to-EAX  0/imm32
 
 $kernel-string-equal:end:
   # restore registers
^
9506fb8e ^
fe179145 ^

fae694a0 ^

fe179145 ^
fae694a0 ^
fe179145 ^
5822dff7 ^
9506fb8e ^
fae694a0 ^
9506fb8e ^
fae694a0 ^
fe179145 ^

fae694a0 ^
fe179145 ^
fae694a0 ^


4c05e43d ^

fae694a0 ^

fe179145 ^

fae694a0 ^




9506fb8e ^
fae694a0 ^
fae694a0 ^
1159f9ec ^



fe179145 ^
5822dff7 ^
9506fb8e ^
fae694a0 ^
fe179145 ^
fae694a0 ^
fe179145 ^

fae694a0 ^

fe179145 ^
fae694a0 ^
9506fb8e ^

f6f26231 ^
4c05e43d ^
f6f26231 ^







9506fb8e ^
fae694a0 ^

f6f26231 ^










4c05e43d ^

fae694a0 ^

fe179145 ^
5822dff7 ^

fe179145 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118