diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-12-29 13:36:06 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-12-29 13:36:06 -0800 |
commit | dd9ba09a7c74455f17afb515c377a217fa8be8bc (patch) | |
tree | bdeba01efd5c56d3ccf4df10750bd99087d1bb24 /subx/examples | |
parent | d762282438f603d47804be04cebf77d6137c2728 (diff) | |
download | mu-dd9ba09a7c74455f17afb515c377a217fa8be8bc.tar.gz |
4888
We only can't use rm32=5 when mod=0. Totally fine when it's mod=1.
Diffstat (limited to 'subx/examples')
-rwxr-xr-x | subx/examples/ex10 | bin | 165 -> 163 bytes | |||
-rw-r--r-- | subx/examples/ex10.subx | 4 | ||||
-rwxr-xr-x | subx/examples/ex11 | bin | 1125 -> 1117 bytes | |||
-rw-r--r-- | subx/examples/ex11.subx | 16 | ||||
-rwxr-xr-x | subx/examples/ex8 | bin | 139 -> 138 bytes | |||
-rw-r--r-- | subx/examples/ex8.subx | 2 | ||||
-rwxr-xr-x | subx/examples/ex9 | bin | 129 -> 127 bytes | |||
-rw-r--r-- | subx/examples/ex9.subx | 4 |
8 files changed, 13 insertions, 13 deletions
diff --git a/subx/examples/ex10 b/subx/examples/ex10 index e6d8b3c4..9cdfb983 100755 --- a/subx/examples/ex10 +++ b/subx/examples/ex10 Binary files differdiff --git a/subx/examples/ex10.subx b/subx/examples/ex10.subx index 9ac6d6cb..0b937fa5 100644 --- a/subx/examples/ex10.subx +++ b/subx/examples/ex10.subx @@ -22,9 +22,9 @@ 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # argv-equal(argv[1], argv[2]) # . . push argv[2] - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) + ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 . # push *(EBP+12) # . . push argv[1] - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) + ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) # . . call e8/call argv-equal/disp32 # syscall(exit, EAX) diff --git a/subx/examples/ex11 b/subx/examples/ex11 index f4329e00..cdabbf0a 100755 --- a/subx/examples/ex11 +++ b/subx/examples/ex11 Binary files differdiff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx index 5acd5bf0..84ef43d9 100644 --- a/subx/examples/ex11.subx +++ b/subx/examples/ex11.subx @@ -53,12 +53,12 @@ kernel-string-equal: # s : null-terminated ascii string, benchmark : length-pre # return false # return *s1 == 0 # initialize s into EDI - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 7/r32/EDI 8/disp8 . # copy *(EBP+8) to EDI + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 8/disp8 . # copy *(EBP+8) to EDI # initialize benchmark length n into EDX - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 2/r32/EDX 0xc/disp8 . # copy *(EBP+12) to EDX + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 2/r32/EDX 0xc/disp8 . # copy *(EBP+12) to EDX 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . . # copy *EDX to EDX # initialize benchmark data into ESI - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 6/r32/ESI 0xc/disp8 . # copy *(EBP+12) to ESI + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 . # copy *(EBP+12) to ESI 81 0/subop/add 3/mod/direct 6/rm32/ESI . . . . . 4/imm32 # add to ESI # initialize loop counter i into ECX b9/copy-to-ECX 0/imm32/exit @@ -261,8 +261,8 @@ check-ints-equal: # (a : int, b : int, msg : (address array byte)) -> boolean 51/push-ECX 53/push-EBX # load args into EAX, EBX and ECX - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 0/r32/EAX 8/disp8 . # copy *(EBP+8) to EAX - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 3/r32/EBX 0xc/disp8 . # copy *(EBP+12) to EBX + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 8/disp8 . # copy *(EBP+8) to EAX + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 3/r32/EBX 0xc/disp8 . # copy *(EBP+12) to EBX # if EAX == b/EBX print('.') and return 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . . # compare EAX and EBX 75/jump-if-unequal $check-ints-equal:else/disp8 @@ -278,7 +278,7 @@ check-ints-equal: # (a : int, b : int, msg : (address array byte)) -> boolean # otherwise print(msg) $check-ints-equal:else: # copy msg into ECX - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 1/r32/ECX 0x10/disp8 . # copy *(EBP+16) to ECX + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 0x10/disp8 . # copy *(EBP+16) to ECX # print(ECX) # . . push args 51/push-ECX @@ -315,10 +315,10 @@ write-stderr: # s : (address array byte) -> <void> # . . fd = 2 (stderr) bb/copy-to-EBX 2/imm32 # . . x = s+4 - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 1/r32/ECX 8/disp8 . # copy *(EBP+8) to ECX + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 8/disp8 . # copy *(EBP+8) to ECX 81 0/subop/add 3/mod/direct 1/rm32/ECX . . . . . 4/imm32 # add to ECX # . . size = *s - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 2/r32/EDX 8/disp8 . # copy *(EBP+8) to EDX + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 2/r32/EDX 8/disp8 . # copy *(EBP+8) to EDX 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . . # copy *EDX to EDX # . . syscall b8/copy-to-EAX 4/imm32/write diff --git a/subx/examples/ex8 b/subx/examples/ex8 index dda61510..9a92bc7d 100755 --- a/subx/examples/ex8 +++ b/subx/examples/ex8 Binary files differdiff --git a/subx/examples/ex8.subx b/subx/examples/ex8.subx index 75a77a50..d9234123 100644 --- a/subx/examples/ex8.subx +++ b/subx/examples/ex8.subx @@ -23,7 +23,7 @@ 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # EAX = ascii-length(argv[1]) # . . push args - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) + ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) # . . call e8/call ascii-length/disp32 # . . discard args diff --git a/subx/examples/ex9 b/subx/examples/ex9 index dc9c0e3c..ffbea21b 100755 --- a/subx/examples/ex9 +++ b/subx/examples/ex9 Binary files differdiff --git a/subx/examples/ex9.subx b/subx/examples/ex9.subx index bc842e4b..b3a125ea 100644 --- a/subx/examples/ex9.subx +++ b/subx/examples/ex9.subx @@ -26,9 +26,9 @@ 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # ascii-difference(argv[1], argv[2]) # . . push argv[2] - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) + ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 . # push *(EBP+12) # . . push argv[1] - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) + ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) # . . call e8/call ascii-difference/disp32 # . . discard args |