diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-07-07 22:49:04 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-07-07 22:49:04 -0700 |
commit | c38b36e2605afd6ce11545d981f9471e0bc8a7c0 (patch) | |
tree | c780595490287bdf29018e2a5f03df3af59f34cc /subx/apps | |
parent | c0a904382ba1b224275d0ac65eec9469d70e7b36 (diff) | |
download | mu-c38b36e2605afd6ce11545d981f9471e0bc8a7c0.tar.gz |
move `is-label?` to `subx-common`
Diffstat (limited to 'subx/apps')
-rwxr-xr-x | subx/apps/assort | bin | 28463 -> 28699 bytes | |||
-rwxr-xr-x | subx/apps/crenshaw2-1 | bin | 23307 -> 23337 bytes | |||
-rwxr-xr-x | subx/apps/crenshaw2-1b | bin | 23866 -> 23896 bytes | |||
-rwxr-xr-x | subx/apps/dquotes | bin | 34772 -> 35008 bytes | |||
-rwxr-xr-x | subx/apps/factorial | bin | 22223 -> 22253 bytes | |||
-rwxr-xr-x | subx/apps/handle | bin | 23082 -> 23112 bytes | |||
-rwxr-xr-x | subx/apps/hex | bin | 26316 -> 26346 bytes | |||
-rwxr-xr-x | subx/apps/pack | bin | 43377 -> 43613 bytes | |||
-rw-r--r-- | subx/apps/subx-common.subx | 83 | ||||
-rwxr-xr-x | subx/apps/survey | bin | 32924 -> 32117 bytes | |||
-rw-r--r-- | subx/apps/survey.subx | 83 |
11 files changed, 83 insertions, 83 deletions
diff --git a/subx/apps/assort b/subx/apps/assort index 9d27fd9a..95ffad2e 100755 --- a/subx/apps/assort +++ b/subx/apps/assort Binary files differdiff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index 159ed81a..f25d054c 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 f4e02da6..720eef0d 100755 --- a/subx/apps/crenshaw2-1b +++ b/subx/apps/crenshaw2-1b Binary files differdiff --git a/subx/apps/dquotes b/subx/apps/dquotes index 6774b8df..8e373c03 100755 --- a/subx/apps/dquotes +++ b/subx/apps/dquotes Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial index 0f913091..dc637731 100755 --- a/subx/apps/factorial +++ b/subx/apps/factorial Binary files differdiff --git a/subx/apps/handle b/subx/apps/handle index c7110e42..16041394 100755 --- a/subx/apps/handle +++ b/subx/apps/handle Binary files differdiff --git a/subx/apps/hex b/subx/apps/hex index 5d663c6d..db95f583 100755 --- a/subx/apps/hex +++ b/subx/apps/hex Binary files differdiff --git a/subx/apps/pack b/subx/apps/pack index ad55fb75..9d492d15 100755 --- a/subx/apps/pack +++ b/subx/apps/pack Binary files differdiff --git a/subx/apps/subx-common.subx b/subx/apps/subx-common.subx index 1dac1c31..8088733f 100644 --- a/subx/apps/subx-common.subx +++ b/subx/apps/subx-common.subx @@ -1322,6 +1322,81 @@ $test-compute-width:no-metadata: 5d/pop-to-EBP c3/return +is-label?: # word : (address slice) -> EAX : boolean + # . prolog + 55/push-EBP + 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + # . save registers + 51/push-ECX + # ECX = word + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 8/disp8 . # copy *(EBP+8) to ECX + # ECX = word->end + 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 1/r32/ECX 4/disp8 . # copy *(ECX+4) to ECX + # *(word->end - 1) == ':' + # . EAX = 0 + 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . . # clear EAX + # . EAX = *((char *) word->end - 1) + 8a/copy-byte 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/AL -1/disp8 . # copy byte at *(ECX-1) to AL + # . (word->end - 1)/EAX == ':' + 3d/compare-EAX-and 3A/imm32/colon + b8/copy-to-EAX 1/imm32/true + 74/jump-if-equal $is-label?:end/disp8 + b8/copy-to-EAX 0/imm32/false +$is-label?:end: + # . restore registers + 59/pop-to-ECX + # . epilog + 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP + 5d/pop-to-EBP + c3/return + +test-is-label?: + # . prolog + 55/push-EBP + 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP +$test-is-label?:true: + # var slice/ECX = slice("AAA:") + 68/push _test-label-slice-end1/imm32 + 68/push _test-label-slice-start/imm32 + 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX + # is-label?(slice/ECX) + 51/push-ECX + e8/call is-label?/disp32 + # . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP + # check-ints-equal(EAX, 1, msg) + # . . push args + 68/push "F - test-is-label?:true"/imm32 + 68/push 1/imm32 + 50/push-EAX + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +$test-is-label?:false: + # var slice/ECX = slice("AAA") + 68/push _test-label-slice-end2/imm32 + 68/push _test-label-slice-start/imm32 + 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX + # is-label?(slice/ECX) + 51/push-ECX + e8/call is-label?/disp32 + # . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP + # check-ints-equal(EAX, 0, msg) + # . . push args + 68/push "F - test-is-label?:false"/imm32 + 68/push 0/imm32 + 50/push-EAX + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP + # . epilog + 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP + 5d/pop-to-EBP + c3/return + == data _test-input-stream: @@ -1408,4 +1483,12 @@ _test-data-segment: 64/d 61/a 74/t 61/a _test-data-segment-end: +_test-label-slice-start: + 41/A + 41/A + 41/A +_test-label-slice-end2: + 3A/: +_test-label-slice-end1: + # . . vim:nowrap:textwidth=0 diff --git a/subx/apps/survey b/subx/apps/survey index 01107cf8..03dcb50e 100755 --- a/subx/apps/survey +++ b/subx/apps/survey Binary files differdiff --git a/subx/apps/survey.subx b/subx/apps/survey.subx index cdc55995..5af21261 100644 --- a/subx/apps/survey.subx +++ b/subx/apps/survey.subx @@ -317,81 +317,6 @@ test-convert-computes-addresses: 5d/pop-to-EBP c3/return -is-label?: # word : (address slice) -> EAX : boolean - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # . save registers - 51/push-ECX - # ECX = word - 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 8/disp8 . # copy *(EBP+8) to ECX - # ECX = word->end - 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 1/r32/ECX 4/disp8 . # copy *(ECX+4) to ECX - # *(word->end - 1) == ':' - # . EAX = 0 - 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . . # clear EAX - # . EAX = *((char *) word->end - 1) - 8a/copy-byte 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/AL -1/disp8 . # copy byte at *(ECX-1) to AL - # . (word->end - 1)/EAX == ':' - 3d/compare-EAX-and 3A/imm32/colon - b8/copy-to-EAX 1/imm32/true - 74/jump-if-equal $is-label?:end/disp8 - b8/copy-to-EAX 0/imm32/false -$is-label?:end: - # . restore registers - 59/pop-to-ECX - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - -test-is-label?: - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -$test-is-label?:true: - # var slice/ECX = slice("AAA:") - 68/push _test-label-slice-end1/imm32 - 68/push _test-label-slice-start/imm32 - 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX - # is-label?(slice/ECX) - 51/push-ECX - e8/call is-label?/disp32 - # . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # check-ints-equal(EAX, 1, msg) - # . . push args - 68/push "F - test-is-label?:true"/imm32 - 68/push 1/imm32 - 50/push-EAX - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP -$test-is-label?:false: - # var slice/ECX = slice("AAA") - 68/push _test-label-slice-end2/imm32 - 68/push _test-label-slice-start/imm32 - 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX - # is-label?(slice/ECX) - 51/push-ECX - e8/call is-label?/disp32 - # . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # check-ints-equal(EAX, 0, msg) - # . . push args - 68/push "F - test-is-label?:false"/imm32 - 68/push 0/imm32 - 50/push-EAX - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - compute-offsets: # in : (address buffered-file), segments : (address stream {string, segment-info}), labels : (address stream {string, label-info}) # pseudocode: # var curr-segment-name = 0 @@ -2279,12 +2204,4 @@ compute-offsets:word-slice:end: 0/imm32/end compute-offsets:heap: 0/imm32/start compute-offsets:heap:end: 0/imm32/end -_test-label-slice-start: - 41/A - 41/A - 41/A -_test-label-slice-end2: - 3A/: -_test-label-slice-end1: - # . . vim:nowrap:textwidth=0 |