diff options
Diffstat (limited to 'subx/examples')
-rw-r--r-- | subx/examples/ex1.subx | 1 | ||||
-rw-r--r-- | subx/examples/ex11.subx | 2 | ||||
-rw-r--r-- | subx/examples/ex12.subx | 1 | ||||
-rw-r--r-- | subx/examples/ex2.subx | 1 | ||||
-rw-r--r-- | subx/examples/ex3.subx | 1 | ||||
-rw-r--r-- | subx/examples/ex4.subx | 2 | ||||
-rw-r--r-- | subx/examples/ex6.subx | 1 | ||||
-rw-r--r-- | subx/examples/ex7.subx | 1 | ||||
-rw-r--r-- | subx/examples/ex8.subx | 1 | ||||
-rw-r--r-- | subx/examples/ex9.subx | 1 |
10 files changed, 11 insertions, 1 deletions
diff --git a/subx/examples/ex1.subx b/subx/examples/ex1.subx index 8839fb6b..f956f974 100644 --- a/subx/examples/ex1.subx +++ b/subx/examples/ex1.subx @@ -9,6 +9,7 @@ # 42 == code + bb/copy-to-EBX 2a/imm32 # exit(EBX) b8/copy-to-EAX 1/imm32 diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx index dc804ebe..28eb2a8a 100644 --- a/subx/examples/ex11.subx +++ b/subx/examples/ex11.subx @@ -15,7 +15,6 @@ # would cause tests to not run, rather than to fail as we'd like.) == code - # instruction effective address operand displacement immediate # op subop mod rm32 base index scale r32 # 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes @@ -335,6 +334,7 @@ write-stderr: # s : (address array byte) -> <void> c3/return == data + Newline: # size 01 00 00 00 diff --git a/subx/examples/ex12.subx b/subx/examples/ex12.subx index da752988..83943e1d 100644 --- a/subx/examples/ex12.subx +++ b/subx/examples/ex12.subx @@ -25,6 +25,7 @@ cd/syscall 0x80/imm8 == data + # various constants used here were found in the Linux sources (search for file mman-common.h) Mmap-new-segment: # type mmap_arg_struct # addr diff --git a/subx/examples/ex2.subx b/subx/examples/ex2.subx index e44d5ea8..09fe4414 100644 --- a/subx/examples/ex2.subx +++ b/subx/examples/ex2.subx @@ -8,6 +8,7 @@ # 2 == code + bb/copy-to-EBX 1/imm32 43/inc-EBX # exit(EBX) diff --git a/subx/examples/ex3.subx b/subx/examples/ex3.subx index 8496b9c2..e5dad9e4 100644 --- a/subx/examples/ex3.subx +++ b/subx/examples/ex3.subx @@ -11,6 +11,7 @@ # instruction effective address operand displacement immediate # op subop mod rm32 base index scale r32 # 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + # result: EBX = 0 bb/copy-to-EBX 0/imm32 # counter: ECX = 1 diff --git a/subx/examples/ex4.subx b/subx/examples/ex4.subx index f053d3fe..17dae120 100644 --- a/subx/examples/ex4.subx +++ b/subx/examples/ex4.subx @@ -5,6 +5,7 @@ # $ subx run examples/ex4 == code + # syscall(read, stdin, X, 1) # fd = 0 (stdin) bb/copy-to-EBX 0/imm32 @@ -32,6 +33,7 @@ b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 == data + X: 00 00 00 00 # space for read() to write to diff --git a/subx/examples/ex6.subx b/subx/examples/ex6.subx index b96ee77f..dfec4bf9 100644 --- a/subx/examples/ex6.subx +++ b/subx/examples/ex6.subx @@ -26,6 +26,7 @@ cd/syscall 0x80/imm8 == data + Size: # size of string 0e 00 00 00 # 14 X: # string to print diff --git a/subx/examples/ex7.subx b/subx/examples/ex7.subx index d678bb0b..fc04ce2d 100644 --- a/subx/examples/ex7.subx +++ b/subx/examples/ex7.subx @@ -91,6 +91,7 @@ cd/syscall 0x80/imm8 == data + Stream: 00 00 00 00 A: diff --git a/subx/examples/ex8.subx b/subx/examples/ex8.subx index 4dc0054f..3f5ebce5 100644 --- a/subx/examples/ex8.subx +++ b/subx/examples/ex8.subx @@ -18,6 +18,7 @@ # instruction effective address operand displacement immediate # op subop mod rm32 base index scale r32 # 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + # prolog 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # call ascii-length(argv[1]) diff --git a/subx/examples/ex9.subx b/subx/examples/ex9.subx index fa2877df..6c6fc04b 100644 --- a/subx/examples/ex9.subx +++ b/subx/examples/ex9.subx @@ -20,6 +20,7 @@ # instruction effective address operand displacement immediate # op subop mod rm32 base index scale r32 # 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + # prolog 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # call ascii-difference(argv[1], argv[2]) |