diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-01-20 23:19:40 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-01-20 23:20:34 -0800 |
commit | c65dee2d99a7d1a5f0fbc8826b616683713ebef6 (patch) | |
tree | eacba0491629847d25aafd64f57ece2b8a5cc54b /subx/apps | |
parent | 332cbba31f60c3915ba109a14105d4e8f7369a7a (diff) | |
download | mu-c65dee2d99a7d1a5f0fbc8826b616683713ebef6.tar.gz |
4938
Diffstat (limited to 'subx/apps')
-rwxr-xr-x | subx/apps/crenshaw2-1 | bin | 15313 -> 15310 bytes | |||
-rwxr-xr-x | subx/apps/crenshaw2-1b | bin | 15872 -> 15869 bytes | |||
-rwxr-xr-x | subx/apps/factorial | bin | 14231 -> 14228 bytes | |||
-rwxr-xr-x | subx/apps/handle | bin | 15024 -> 15021 bytes | |||
-rwxr-xr-x | subx/apps/hex | bin | 18292 -> 18289 bytes | |||
-rw-r--r-- | subx/apps/pack.subx | 34 |
6 files changed, 26 insertions, 8 deletions
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index 448cc762..c21bdb6b 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 b31edcd3..b8408351 100755 --- a/subx/apps/crenshaw2-1b +++ b/subx/apps/crenshaw2-1b Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial index 2f10831f..83af72ba 100755 --- a/subx/apps/factorial +++ b/subx/apps/factorial Binary files differdiff --git a/subx/apps/handle b/subx/apps/handle index 5069d19d..3d3e555d 100755 --- a/subx/apps/handle +++ b/subx/apps/handle Binary files differdiff --git a/subx/apps/hex b/subx/apps/hex index 10c02bf6..c7460132 100755 --- a/subx/apps/hex +++ b/subx/apps/hex Binary files differdiff --git a/subx/apps/pack.subx b/subx/apps/pack.subx index f09a6b2f..b128b8d3 100644 --- a/subx/apps/pack.subx +++ b/subx/apps/pack.subx @@ -115,14 +115,6 @@ $main:end: # if has metadata 'imm32', emit as 4 bytes # finally, emit line prefixed with a ' # ' -# has-metadata?(word-slice, m): -# next-token2(word-slice, '/') # skip -# while true: -# slice = next-token2(word-slice, '/') -# if empty?(slice) break -# if equal(slice, m) return true -# return false - # simplifications since we perform zero error handling (continuing to rely on the C++ version for that): # missing fields are always 0-filled # bytes never mentioned are silently dropped; if you don't provide /mod, /rm32 or /r32 you don't get a 0 modrm byte. You get *no* modrm byte. @@ -359,6 +351,32 @@ test-next-word-returns-whole-comment: 5d/pop-to-EBP c3/return +has-metadata?: # word : (address slice), s : (address string) -> EAX : boolean + # pseudocode: + # var twig : &slice + # curr = word->start + # while true: + # twig = next-token-from-slice(curr, word->end, '/') + # if twig.empty() break + # if slice-equal?(twig, s) return true + # curr = twig->end + # return false + # . prolog + 55/push-EBP + 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + # . save registers + # ESI = word + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 . # copy *(EBP+8) to ESI + # var twig/EDI : (address slice) = {0, 0} + 68/push 0/imm32/end + 68/push 0/imm32/start + 89/copy 3/mod/direct 7/rm32/EDI . . . 4/r32/ESP . . # copy ESP to EDI + # . restore registers + # . epilog + 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP + 5d/pop-to-EBP + c3/return + # print 'n' in hex in 'width' bytes in lower-endian order, with a space after every byte emit-hex: # out : (address buffered-file), n : int, width : int # . prolog |