diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-01-16 18:31:12 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-01-16 18:31:12 -0800 |
commit | 6070c23e5e1c60d3bb169e43bddfa59b1d322427 (patch) | |
tree | 9a70e378c33c15e4779cf94abda8f37c35a5d1da /apps/hex.subx | |
parent | 5a6601aba973ba1d1ef30b7b64438c25623b89c5 (diff) | |
download | mu-6070c23e5e1c60d3bb169e43bddfa59b1d322427.tar.gz |
5897 - rename comparison instructions
Signed and unsigned don't quite capture the essence of what the different combinations of x86 flags are doing for SubX. The crucial distinction is that one set of comparison operators is for integers and the second is for addresses.
Diffstat (limited to 'apps/hex.subx')
-rw-r--r-- | apps/hex.subx | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/apps/hex.subx b/apps/hex.subx index 4dd725e8..21fd1939 100644 --- a/apps/hex.subx +++ b/apps/hex.subx @@ -34,7 +34,7 @@ Entry: # run tests if necessary, convert stdin if not # - if argc > 1 and argv[1] == "test", then return run_tests() # if (argc <= 1) goto interactive 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0/disp8 1/imm32 # compare *ebp - 7e/jump-if-lesser-or-equal $subx-hex-main:interactive/disp8 + 7e/jump-if-<= $subx-hex-main:interactive/disp8 # if (!kernel-string-equal?(argv[1], "test")) goto interactive # . eax = kernel-string-equal?(argv[1], "test") # . . push args @@ -46,7 +46,7 @@ Entry: # run tests if necessary, convert stdin if not 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . if (eax == false) goto interactive 3d/compare-eax-and 0/imm32/false - 74/jump-if-equal $subx-hex-main:interactive/disp8 + 74/jump-if-= $subx-hex-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 # syscall(exit, *Num-test-failures) @@ -102,7 +102,7 @@ $subx-hex:loop: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # if (eax == Eof) break 3d/compare-eax-and 0xffffffff/imm32/Eof - 74/jump-if-equal $subx-hex:loop-end/disp8 + 74/jump-if-= $subx-hex:loop-end/disp8 # write-byte-buffered(out, AL) # . . push args 50/push-eax @@ -162,7 +162,7 @@ convert-next-octet: # in : (addr buffered-file), err : (addr buffered-file), ed 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # if (eax == Eof) return 3d/compare-eax-and 0xffffffff/imm32/Eof - 74/jump-if-equal $convert-next-octet:end/disp8 + 74/jump-if-= $convert-next-octet:end/disp8 # eax = from-hex-char(eax) e8/call from-hex-char/disp32 # ecx = eax @@ -178,7 +178,7 @@ convert-next-octet: # in : (addr buffered-file), err : (addr buffered-file), ed 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # if (eax == Eof) error(ed, err, "partial byte found.") 3d/compare-eax-and 0xffffffff/imm32/Eof - 75/jump-if-not-equal $convert-next-octet:convert/disp8 + 75/jump-if-!= $convert-next-octet:convert/disp8 # . error-byte(ed, err, msg, '.') # reusing error-byte to avoid creating _yet_ another helper # . . push args 68/push 0x2e/imm32/period/dummy @@ -284,7 +284,7 @@ test-convert-next-octet: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-convert-next-octet:end/disp8 + 75/jump-if-!= $test-convert-next-octet:end/disp8 # check-ints-equal(eax, 0xab, msg) # . . push args 68/push "F - test-convert-next-octet"/imm32 @@ -374,7 +374,7 @@ test-convert-next-octet-handles-Eof: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-convert-next-octet-handles-Eof:end/disp8 + 75/jump-if-!= $test-convert-next-octet-handles-Eof:end/disp8 # check-ints-equal(eax, Eof, msg) # . . push args 68/push "F - test-convert-next-octet-handles-Eof"/imm32 @@ -505,7 +505,7 @@ $scan-next-byte:loop: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # if (eax == Eof) return eax 3d/compare-with-eax 0xffffffff/imm32/Eof - 74/jump-if-equal $scan-next-byte:end/disp8 + 74/jump-if-= $scan-next-byte:end/disp8 # if (is-hex-digit?(eax)) return eax # . save eax for now 50/push-eax @@ -521,21 +521,21 @@ $scan-next-byte:loop: # . restore eax (does not affect flags) 58/pop-to-eax # . check whether to return - 75/jump-if-not-equal $scan-next-byte:end/disp8 + 75/jump-if-!= $scan-next-byte:end/disp8 $scan-next-byte:check1: # if (eax == ' ') continue 3d/compare-eax-and 0x20/imm32/space - 74/jump-if-equal $scan-next-byte:loop/disp8 + 74/jump-if-= $scan-next-byte:loop/disp8 # if (eax == '\t') continue 3d/compare-eax-and 9/imm32/tab - 74/jump-if-equal $scan-next-byte:loop/disp8 + 74/jump-if-= $scan-next-byte:loop/disp8 # if (eax == '\n') continue 3d/compare-eax-and 0xa/imm32/newline - 74/jump-if-equal $scan-next-byte:loop/disp8 + 74/jump-if-= $scan-next-byte:loop/disp8 $scan-next-byte:check2: # if (eax == '#') skip-until-newline(in) 3d/compare-with-eax 0x23/imm32 - 75/jump-if-not-equal $scan-next-byte:check3/disp8 + 75/jump-if-!= $scan-next-byte:check3/disp8 # . skip-until-newline(in) # . . push args ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) @@ -641,7 +641,7 @@ test-scan-next-byte: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-scan-next-byte:end/disp8 + 75/jump-if-!= $test-scan-next-byte:end/disp8 # check-ints-equal(eax, 0x61/a, msg) # . . push args 68/push "F - test-scan-next-byte"/imm32 @@ -739,7 +739,7 @@ test-scan-next-byte-skips-whitespace: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-scan-next-byte-skips-whitespace:end/disp8 + 75/jump-if-!= $test-scan-next-byte-skips-whitespace:end/disp8 # check-ints-equal(eax, 0x61/a, msg) # . . push args 68/push "F - test-scan-next-byte-skips-whitespace"/imm32 @@ -845,7 +845,7 @@ test-scan-next-byte-skips-comment: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-scan-next-byte-skips-comment:end/disp8 + 75/jump-if-!= $test-scan-next-byte-skips-comment:end/disp8 # check-ints-equal(eax, 0x61/a, msg) # . . push args 68/push "F - test-scan-next-byte-skips-comment"/imm32 @@ -951,7 +951,7 @@ test-scan-next-byte-skips-comment-and-whitespace: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-scan-next-byte-skips-comment-and-whitespace:end/disp8 + 75/jump-if-!= $test-scan-next-byte-skips-comment-and-whitespace:end/disp8 # check-ints-equal(eax, 0x61/a, msg) # . . push args 68/push "F - test-scan-next-byte-skips-comment-and-whitespace"/imm32 @@ -1059,7 +1059,7 @@ test-scan-next-byte-skips-whitespace-and-comment: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-scan-next-byte-skips-whitespace-and-comment:end/disp8 + 75/jump-if-!= $test-scan-next-byte-skips-whitespace-and-comment:end/disp8 # check-ints-equal(eax, 0x61/a, msg) # . . push args 68/push "F - test-scan-next-byte-skips-whitespace-and-comment"/imm32 @@ -1157,7 +1157,7 @@ test-scan-next-byte-reads-final-byte: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-scan-next-byte-reads-final-byte:end/disp8 + 75/jump-if-!= $test-scan-next-byte-reads-final-byte:end/disp8 # check-ints-equal(eax, 0x61/a, msg) # . . push args 68/push "F - test-scan-next-byte-reads-final-byte"/imm32 @@ -1247,7 +1247,7 @@ test-scan-next-byte-handles-Eof: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # return if abort 81 7/subop/compare 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 0/imm32 # compare *(ecx+4) - 75/jump-if-not-equal $test-scan-next-byte-handles-Eof:end/disp8 + 75/jump-if-!= $test-scan-next-byte-handles-Eof:end/disp8 # check-ints-equal(eax, Eof, msg) # . . push args 68/push "F - test-scan-next-byte-handles-Eof"/imm32 @@ -1373,10 +1373,10 @@ $skip-until-newline:loop: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # . if (eax == Eof) break 3d/compare-eax-and 0xffffffff/imm32/Eof - 74/jump-if-equal $skip-until-newline:end/disp8 + 74/jump-if-= $skip-until-newline:end/disp8 # . if (eax != 0xa/newline) loop 3d/compare-eax-and 0xa/imm32/newline - 75/jump-if-not-equal $skip-until-newline:loop/disp8 + 75/jump-if-!= $skip-until-newline:loop/disp8 $skip-until-newline:end: # . restore registers 58/pop-to-eax |