diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-01-20 22:50:44 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-01-20 22:50:44 -0800 |
commit | 332cbba31f60c3915ba109a14105d4e8f7369a7a (patch) | |
tree | db7d26fc1be0ae8719e8be54ff86d099caab7d68 /subx/apps | |
parent | 1f0f3813034921607771bf9627d973ba40fec9e4 (diff) | |
download | mu-332cbba31f60c3915ba109a14105d4e8f7369a7a.tar.gz |
4937
Diffstat (limited to 'subx/apps')
-rwxr-xr-x | subx/apps/crenshaw2-1 | bin | 14148 -> 15313 bytes | |||
-rwxr-xr-x | subx/apps/crenshaw2-1b | bin | 14707 -> 15872 bytes | |||
-rwxr-xr-x | subx/apps/factorial | bin | 13066 -> 14231 bytes | |||
-rwxr-xr-x | subx/apps/handle | bin | 13859 -> 15024 bytes | |||
-rwxr-xr-x | subx/apps/hex | bin | 17127 -> 18292 bytes | |||
-rw-r--r-- | subx/apps/pack.subx | 25 |
6 files changed, 21 insertions, 4 deletions
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index bcf1415c..448cc762 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 29fcdc94..b31edcd3 100755 --- a/subx/apps/crenshaw2-1b +++ b/subx/apps/crenshaw2-1b Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial index 5062a5a0..2f10831f 100755 --- a/subx/apps/factorial +++ b/subx/apps/factorial Binary files differdiff --git a/subx/apps/handle b/subx/apps/handle index 929e5c5a..5069d19d 100755 --- a/subx/apps/handle +++ b/subx/apps/handle Binary files differdiff --git a/subx/apps/hex b/subx/apps/hex index d854606e..10c02bf6 100755 --- a/subx/apps/hex +++ b/subx/apps/hex Binary files differdiff --git a/subx/apps/pack.subx b/subx/apps/pack.subx index d7052b0b..f09a6b2f 100644 --- a/subx/apps/pack.subx +++ b/subx/apps/pack.subx @@ -86,27 +86,43 @@ $main:end: # read first word as opcode and write-slice # if 0f or f2 or f3 read second opcode and write-slice # if 'f2 0f' or 'f3 0f' read third opcode and write-slice -# scan words +# while true: +# word-slice = next-word +# if empty(word-slice) break # if has metadata 'mod', parse into mod # if has metadata 'rm32', parse into rm32 # if has metadata 'r32', parse into r32 # if has metadata 'subop', parse into r32 # if at least one of the 3 was present, print-byte -# scan words +# while true: +# word-slice = next-word +# if empty(word-slice) break # if has metadata 'base', parse into base # if has metadata 'index', parse into index # if has metadata 'scale', parse into scale # if at least one of the 3 was present, print-byte # parse errors => <abort> -# scan words +# while true: +# word-slice = next-word +# if empty(word-slice) break # if has metadata 'disp8', emit as 1 byte # if has metadata 'disp16', emit as 2 bytes # if has metadata 'disp32', emit as 4 bytes -# scan words +# while true: +# word-slice = next-word +# if empty(word-slice) break # if has metadata 'imm8', emit # 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. @@ -123,6 +139,7 @@ $main:end: # # we won't bother saving the internal structure of lines; reparsing should be cheap using two primitives: # next-token(stream, delim char) -> slice (start, end pointers) +# next-token(stream, slice, delim char) -> slice' # slice-equal?(slice, string) # helpers: |