diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-09-10 09:22:12 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-09-10 09:22:12 -0700 |
| commit | 2eb637e63a9e5d8f87391beb4af6019963a7c36c (patch) | |
| tree | f27d9d2772bd49475a6af737507a930b424a3a40 /transform.e | |
| parent | 7a0a28f4d8b738d305b826b5464b27255dd7def3 (diff) | |
add provide-hex, which varies its output width to fit the value
and amd64.e uses it for all the immediates, but not for other kinds of numeric parameter, which looks pretty slick and readable Force-Push: yes Change-Id: Ifb630a4dc172d7495b5458316266fe76b75e07af
Diffstat (limited to 'transform.e')
| -rw-r--r-- | transform.e | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/transform.e b/transform.e index 5bec117..b8afb1d 100644 --- a/transform.e +++ b/transform.e @@ -2780,6 +2780,7 @@ allocate-transformation-state s" transformation-state" variable ~ ~ : Do a thing with # and # ? ~ ~ : Do a different #swap # thing to # now. ~ ~ : provide-decimal +~ ~ : provide-hex ~ ~ : provide-hex8 ~ ~ : provide-hex16 ~ ~ : provide-hex32 @@ -3204,14 +3205,15 @@ allocate-transformation-state s" transformation-state" variable : hex-output-metadata-entry-type-raw-string-literal 6 ; : hex-output-metadata-entry-type-alignment 7 ; : hex-output-metadata-entry-type-push-substring-decimal 8 ; -: hex-output-metadata-entry-type-push-substring-hex8 9 ; -: hex-output-metadata-entry-type-push-substring-hex16 10 ; -: hex-output-metadata-entry-type-push-substring-hex32 11 ; -: hex-output-metadata-entry-type-push-substring-hex64 12 ; -: hex-output-metadata-entry-type-push-substring-string 13 ; -: hex-output-metadata-entry-type-drop-substring 14 ; -: hex-output-metadata-entry-type-swap-substrings 15 ; -: hex-output-metadata-entry-type-roll-substrings 16 ; +: hex-output-metadata-entry-type-push-substring-hex 9 ; +: hex-output-metadata-entry-type-push-substring-hex8 10 ; +: hex-output-metadata-entry-type-push-substring-hex16 11 ; +: hex-output-metadata-entry-type-push-substring-hex32 12 ; +: hex-output-metadata-entry-type-push-substring-hex64 13 ; +: hex-output-metadata-entry-type-push-substring-string 14 ; +: hex-output-metadata-entry-type-drop-substring 15 ; +: hex-output-metadata-entry-type-swap-substrings 16 ; +: hex-output-metadata-entry-type-roll-substrings 17 ; ~ Initialize the contents of the output metadata to all zeroes. This is ~ called from hex-transform at its top level, at the very start, to make sure @@ -3263,6 +3265,7 @@ allocate-transformation-state s" transformation-state" variable ~ push-substring entries. hex-output-metadata-entry-type @ dup hex-output-metadata-entry-type-push-substring-decimal = swap + dup hex-output-metadata-entry-type-push-substring-hex = 3roll || swap dup hex-output-metadata-entry-type-push-substring-hex8 = 3roll || swap dup hex-output-metadata-entry-type-push-substring-hex16 = 3roll || swap dup hex-output-metadata-entry-type-push-substring-hex32 = 3roll || swap @@ -3796,6 +3799,12 @@ allocate-transformation-state s" transformation-state" variable } if dup hex-output-metadata-entry-type @ + hex-output-metadata-entry-type-push-substring-hex = { + ." 0x" + dup hex-output-metadata-entry-string @ .hex + } if + + dup hex-output-metadata-entry-type @ hex-output-metadata-entry-type-push-substring-hex8 = { ." 0x" dup hex-output-metadata-entry-string @ .hex8 @@ -4935,6 +4944,13 @@ allocate-transformation-state s" transformation-state" variable add-hex-output-metadata-entry exit } if + dup s" provide-hex" stringcmp 0 = { + ~ Create a new "push substring hex" entry. + drop drop + 2 pick hex-output-metadata-entry-type-push-substring-hex swap + add-hex-output-metadata-entry + exit + } if dup s" provide-hex8" stringcmp 0 = { ~ Create a new "push substring hex8" entry. drop drop |