-rw-r--r-- | subx/058stream# Read a character from stdin, save it to a local on the stack, write it to stdout.
#
# To run:
# $ ./subx translate examples/ex5.subx -o examples/ex5
# $ ./subx run examples/ex5
== code
# instruction effective address register displacement immediate
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
Entry:
# allocate x on the stack
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # subtract from esp
# read(stdin, x, 1)
# . fd = 0 (stdin)
bb/copy-to-ebx 0/imm32
# . data = x (location to write result to)
8d/copy-address 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none 1/r32/ecx 4/disp8 . # copy esp+4 to ecx
# . size = 1 character
ba/copy-to-edx 1/imm32
# . syscall
e8/call syscall_read/disp32
# syscall(write, stdout, x, 1)
# . fd = 1 (stdout)
bb/copy-to-ebx 1/imm32
# . data = x (location to read from)
8d/copy-address 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none 1/r32/ecx 4/disp8 . # copy esp+4 to ecx
# . size = 1 character
ba/copy-to-edx 1/imm32
# . syscall
b8/copy-to-eax 4/imm32/write
cd/syscall 0x80/imm8
# exit(ebx)
e8/call syscall_exit/disp32
# . . vim:nowrap:textwidth=0
94e311d4db73fe82d1217ec62dc'>subx/058stream-equal.subx
+++ b/subx/058stream-equal.subx
@@ -294,7 +294,7 @@ $next-stream-line-equal?:loop:
# AL = *(f->data + f->read)
8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 . # copy byte at *(ESI+ECX+12) to AL
# if (EAX == '\n') break
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xa/imm32/newline # compare EAX
+ 3d/compare-EAX-and 0xa/imm32/newline
74/jump-if-equal $next-stream-line-equal?:break/disp8
# if (currs >= s->length) return false
3b/compare 0/mod/indirect 7/rm32/EDI . . . 2/r32/EDX . . # compare EDX with *EDI
diff --git a/subx/061read-byte.subx b/subx/061read-byte.subx
index cb068869..7503818f 100644
--- a/subx/061read-byte.subx
+++ b/subx/061read-byte.subx
@@ -74,7 +74,7 @@ read-byte: # f : (address buffered-file) -> byte-or-Eof/EAX
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# if (EAX == 0) return 0xffffffff
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
75/jump-if-not-equal $read-byte:from-stream/disp8
b8/copy-to-EAX 0xffffffff/imm32/Eof
eb/jump $read-byte:end/disp8
diff --git a/subx/065hex.subx b/subx/065hex.subx
index eb1e88d4..8ea76ba5 100644
--- a/subx/065hex.subx
+++ b/subx/065hex.subx
@@ -339,7 +339,7 @@ $parse-hex-int:negative:
# . if (*curr == '-') negate = true
31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . . # clear EAX
8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . . # copy byte at *ECX to AL
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0x2d/imm32/- # compare EAX
+ 3d/compare-EAX-and 0x2d/imm32/-
75/jump-if-not-equal $parse-hex-int:initial-0/disp8
# . ++curr
41/increment-ECX
@@ -349,7 +349,7 @@ $parse-hex-int:initial-0:
# skip past leading '0x'
# . if (*curr != '0') jump to loop
8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . . # copy byte at *ECX to AL
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0x30/imm32/0 # compare EAX
+ 3d/compare-EAX-and 0x30/imm32/0
75/jump-if-not-equal $parse-hex-int:loop/disp8
# . ++curr
41/increment-ECX
@@ -360,7 +360,7 @@ $parse-hex-int:initial-0x:
# . if (*curr != 'x') jump to loop # the previous '0' is still valid so doesn't need to be checked again
31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . . # clear EAX
8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . . # copy byte at *ECX to AL
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0x78/imm32/x # compare EAX
+ 3d/compare-EAX-and 0x78/imm32/x
75/jump-if-not-equal $parse-hex-int:loop/disp8
# . ++curr
41/increment-ECX
diff --git a/subx/069allocate.subx b/subx/069allocate.subx
index fe471ed9..402467fe 100644
--- a/subx/069allocate.subx
+++ b/subx/069allocate.subx
@@ -158,7 +158,7 @@ allocate-region: # ad : (address allocation-descriptor), n : int -> new-ad : (a
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# if (EAX == 0) abort
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $allocate-region:abort/disp8
# earmark 8 bytes at the start for a new allocation descriptor
# . *EAX = EAX + 8
diff --git a/subx/071read-line.subx b/subx/071read-line.subx
index c0d01e7d..6c53ba33 100644
--- a/subx/071read-line.subx
+++ b/subx/071read-line.subx
@@ -69,7 +69,7 @@ $read-line:loop:
# if (f->write == 0) break
# since f->read was initially 0, EAX is the same as f->write
# . if (EAX == 0) return true
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $read-line:end/disp8
$read-line:from-stream:
# AL = f->data[f->read]
@@ -82,7 +82,7 @@ $read-line:from-stream:
# ++s->write
42/increment-EDX
# if (AL == '\n') return
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xa/imm32 # compare EAX
+ 3d/compare-EAX-and 0xa/imm32
75/jump-if-not-equal $read-line:loop/disp8
$read-line:end:
# save f->read
diff --git a/subx/072slice.subx b/subx/072slice.subx
index 3829ecd6..8e151ecf 100644
--- a/subx/072slice.subx
+++ b/subx/072slice.subx
@@ -819,7 +819,7 @@ slice-to-string: # ad : (address allocation-descriptor), in : (address slice) -
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# if (EAX == 0) abort
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $slice-to-string:abort/disp8
# *out = size-4
89/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy ECX to *EAX
diff --git a/subx/apps/assort.subx b/subx/apps/assort.subx
index a6457bd7..bf919c45 100644
--- a/subx/apps/assort.subx
+++ b/subx/apps/assort.subx
@@ -717,7 +717,7 @@ $read-segments:check-for-segment-header:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto check3
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
0f 84/jump-if-equal $read-segments:check3/disp32
# . next-word(line, segment-name)
# . . push args
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index fe3894ec..70bcfcb4 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b
index 431ec834..c27795ad 100755
--- a/subx/apps/crenshaw2-1b
+++ b/subx/apps/crenshaw2-1b
Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial
index 5c2a50b9..ba22ec90 100755
--- a/subx/apps/factorial
+++ b/subx/apps/factorial
Binary files differdiff --git a/subx/apps/handle b/subx/apps/handle
index eee59220..0b23d254 100755
--- a/subx/apps/handle
+++ b/subx/apps/handle
Binary files differdiff --git a/subx/apps/handle.subx b/subx/apps/handle.subx
index 8f82759a..f866ea59 100644
--- a/subx/apps/handle.subx
+++ b/subx/apps/handle.subx
@@ -51,7 +51,7 @@ new: # ad : (address allocation-descriptor), n : int, out : (address handle)
# out->address = EAX
89/copy 1/mod/*+disp8 2/rm32/EDX . . . 0/r32/EAX 4/disp8 . # copy EAX to *(EDX+4)
# if (EAX == 0) out->alloc_id = 0, return
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
75/jump-if-not-equal $new:continue/disp8
c7 0/subop/copy 0/mod/indirect 2/rm32/EDX . . . . . 0/imm32 # copy to *EDX
eb/jump $new:end/disp8
diff --git a/subx/apps/hex b/subx/apps/hex
index 1bf03e5a..ddcdf7a9 100755
--- a/subx/apps/hex
+++ b/subx/apps/hex
Binary files differdiff --git a/subx/apps/hex.subx b/subx/apps/hex.subx
index a52ff219..88dc19fd 100644
--- a/subx/apps/hex.subx
+++ b/subx/apps/hex.subx
@@ -94,7 +94,7 @@ $convert:loop:
# . . discard first 2 args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP
# if (EAX == Eof) break
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xffffffff/imm32/Eof # compare EAX
+ 3d/compare-EAX-and 0xffffffff/imm32/Eof
74/jump-if-equal $convert:loop-end/disp8
# write-byte(out, AL)
# . . push args
@@ -154,7 +154,7 @@ convert-next-octet: # in : (address buffered-file), err : (address buffered-fil
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP
# if (EAX == Eof) return
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xffffffff/imm32/Eof # compare EAX
+ 3d/compare-EAX-and 0xffffffff/imm32/Eof
74/jump-if-equal $convert-next-octet:end/disp8
# EAX = from-hex-char(EAX)
e8/call from-hex-char/disp32
@@ -170,7 +170,7 @@ convert-next-octet: # in : (address buffered-file), err : (address buffered-fil
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP
# if (EAX == Eof) error(ed, err, "partial byte found.")
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xffffffff/imm32/Eof # compare EAX
+ 3d/compare-EAX-and 0xffffffff/imm32/Eof
75/jump-if-not-equal $convert-next-octet:convert/disp8
# . error-byte(ed, err, msg, '.') # reusing error-byte to avoid creating _yet_ another helper
# . . push args
@@ -529,13 +529,13 @@ $scan-next-byte:loop:
75/jump-if-not-equal $scan-next-byte:end/disp8
$scan-next-byte:check1:
# if (EAX == ' ') continue
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0x20/imm32 # compare EAX
+ 3d/compare-EAX-and 0x20/imm32/space
74/jump-if-equal $scan-next-byte:loop/disp8
# if (EAX == '\t') continue
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0x9/imm32 # compare EAX
+ 3d/compare-EAX-and 9/imm32/tab
74/jump-if-equal $scan-next-byte:loop/disp8
# if (EAX == '\n') continue
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xa/imm32 # compare EAX
+ 3d/compare-EAX-and 0xa/imm32/newline
74/jump-if-equal $scan-next-byte:loop/disp8
$scan-next-byte:check2:
# if (EAX == '#') skip-until-newline(in)
@@ -1431,10 +1431,10 @@ $skip-until-newline:loop:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# . if (EAX == Eof) break
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xffffffff/imm32/Eof # compare EAX
+ 3d/compare-EAX-and 0xffffffff/imm32/Eof
74/jump-if-equal $skip-until-newline:end/disp8
# . if (EAX != 0xa/newline) loop
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xa/imm32 # compare EAX
+ 3d/compare-EAX-and 0xa/imm32/newline
75/jump-if-not-equal $skip-until-newline:loop/disp8
$skip-until-newline:end:
# . restore registers
diff --git a/subx/apps/pack b/subx/apps/pack
index e75a5447..0ba26e29 100755
--- a/subx/apps/pack
+++ b/subx/apps/pack
Binary files differdiff --git a/subx/apps/pack.subx b/subx/apps/pack.subx
index 583ee218..b623d3b2 100644
--- a/subx/apps/pack.subx
+++ b/subx/apps/pack.subx
@@ -272,7 +272,7 @@ $convert:check2:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto check3
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
0f 84/jump-if-equal $convert:check3/disp32
# . next-word(line, word-slice)
# . . push args
@@ -1222,7 +1222,7 @@ $convert-data:check-for-imm32:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) process as a single byte
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $convert-data:single-byte/disp8
$convert-data:imm32:
# emit(out, word-slice, 4)
@@ -2250,7 +2250,7 @@ $emit-opcodes:op1:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX != 0) goto op2
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
75/jump-if-not-equal $emit-opcodes:op2/disp8
# if (slice-equal?(op1, "f2")) goto op2
# . EAX = slice-equal?(op1, "f2")
@@ -2262,7 +2262,7 @@ $emit-opcodes:op1:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX != 0) goto op2
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
75/jump-if-not-equal $emit-opcodes:op2/disp8
# if (slice-equal?(op1, "f3")) goto op2
# . EAX = slice-equal?(op1, "f3")
@@ -2274,7 +2274,7 @@ $emit-opcodes:op1:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX != 0) goto op2
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
75/jump-if-not-equal $emit-opcodes:op2/disp8
# otherwise return
e9/jump $emit-opcodes:end/disp32
@@ -2343,7 +2343,7 @@ $emit-opcodes:op2:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX != 0) return
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
0f 85/jump-if-not-equal $emit-opcodes:end/disp32
# if (!slice-equal?(op2, "0f")) return
# . EAX = slice-equal?(op2, "0f")
@@ -2355,7 +2355,7 @@ $emit-opcodes:op2:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) return
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
0f 84/jump-if-equal $emit-opcodes:end/disp32
$emit-opcodes:op3:
# next-word(line, op3) # reuse op2/EDX
@@ -2610,7 +2610,7 @@ $emit-modrm:check-for-mod:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-modrm:check-for-rm32/disp8
$emit-modrm:mod:
# mod = parse-hex-int(next-token-from-slice(word-slice->start, word-slice->end, '/'))
@@ -2638,7 +2638,7 @@ $emit-modrm:check-for-rm32:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-modrm:check-for-r32/disp8
$emit-modrm:rm32:
# rm32 = parse-hex-int(next-token-from-slice(word-slice->start, word-slice->end, '/'))
@@ -2666,7 +2666,7 @@ $emit-modrm:check-for-r32:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-modrm:check-for-subop/disp8
$emit-modrm:r32:
# r32 = parse-hex-int(next-token-from-slice(word-slice->start, word-slice->end, '/'))
@@ -2694,7 +2694,7 @@ $emit-modrm:check-for-subop:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) loop
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
0f 84/jump-if-equal $emit-modrm:loop/disp32
$emit-modrm:subop:
# r32 = parse-hex-int(next-token-from-slice(word-slice->start, word-slice->end, '/'))
@@ -2937,7 +2937,7 @@ $emit-sib:check-for-scale:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-sib:check-for-base/disp8
$emit-sib:scale:
# scale = parse-hex-int(next-token-from-slice(word-slice->start, word-slice->end, '/'))
@@ -2965,7 +2965,7 @@ $emit-sib:check-for-base:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-sib:check-for-index/disp8
$emit-sib:base:
# base = parse-hex-int(next-token-from-slice(word-slice->start, word-slice->end, '/'))
@@ -2993,7 +2993,7 @@ $emit-sib:check-for-index:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) loop
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
0f 84/jump-if-equal $emit-sib:loop/disp32
$emit-sib:index:
# index = parse-hex-int(next-token-from-slice(word-slice->start, word-slice->end, '/'))
@@ -3214,7 +3214,7 @@ $emit-disp:check-for-disp32:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-disp:check-for-disp16/disp8
$emit-disp:disp32:
# emit(out, word-slice, 4)
@@ -3239,7 +3239,7 @@ $emit-disp:check-for-disp16:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-disp:check-for-disp8/disp8
$emit-disp:disp16:
# emit(out, word-slice, 2)
@@ -3264,7 +3264,7 @@ $emit-disp:check-for-disp8:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) loop
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
0f 84/jump-if-equal $emit-disp:loop/disp32
$emit-disp:disp8:
# emit(out, word-slice, 1)
@@ -3451,7 +3451,7 @@ $emit-imm:check-for-imm32:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-imm:check-for-imm16/disp8
$emit-imm:imm32:
# emit(out, word-slice, 4)
@@ -3476,7 +3476,7 @@ $emit-imm:check-for-imm16:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) goto next check
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit-imm:check-for-imm8/disp8
$emit-imm:imm16:
# emit(out, word-slice, 2)
@@ -3501,7 +3501,7 @@ $emit-imm:check-for-imm8:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX == 0) loop
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
0f 84/jump-if-equal $emit-imm:loop/disp32
$emit-imm:imm8:
# emit(out, word-slice, 1)
@@ -6298,7 +6298,7 @@ $has-metadata?:loop:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# . if (EAX != 0) return false
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
75/jump-if-not-equal $has-metadata?:false/disp8
# if (slice-equal?(twig, s)) return true
# . EAX = slice-equal?(twig, s)
@@ -6310,7 +6310,7 @@ $has-metadata?:loop:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . if (EAX != 0) return true
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
75/jump-if-not-equal $has-metadata?:true/disp8
# curr = twig->end
8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 . # copy *(EDI+4) to ECX
@@ -6545,7 +6545,7 @@ emit: # out : (address buffered-file), word : (address slice), width : int -> <
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# . if (EAX != 0)
- 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32 # compare EAX
+ 3d/compare-EAX-and 0/imm32
74/jump-if-equal $emit:hex-int/disp8
$emit:name:
# . write-slice(out, word)
|