diff options
Diffstat (limited to 'subx/examples')
-rwxr-xr-x | subx/examples/ex10 | bin | 163 -> 195 bytes | |||
-rw-r--r-- | subx/examples/ex10.subx | 2 | ||||
-rw-r--r-- | subx/examples/ex12.subx | 1 | ||||
-rwxr-xr-x | subx/examples/ex2 | bin | 97 -> 129 bytes | |||
-rw-r--r-- | subx/examples/ex2.subx | 3 | ||||
-rwxr-xr-x | subx/examples/ex3 | bin | 114 -> 146 bytes | |||
-rw-r--r-- | subx/examples/ex3.subx | 3 | ||||
-rw-r--r-- | subx/examples/ex4.subx | 1 | ||||
-rwxr-xr-x | subx/examples/ex5 | bin | 139 -> 171 bytes | |||
-rw-r--r-- | subx/examples/ex5.subx | 2 | ||||
-rw-r--r-- | subx/examples/ex6.subx | 1 | ||||
-rw-r--r-- | subx/examples/ex7.subx | 1 | ||||
-rwxr-xr-x | subx/examples/ex8 | bin | 133 -> 165 bytes | |||
-rw-r--r-- | subx/examples/ex8.subx | 3 | ||||
-rwxr-xr-x | subx/examples/ex9 | bin | 127 -> 159 bytes | |||
-rw-r--r-- | subx/examples/ex9.subx | 3 |
16 files changed, 20 insertions, 0 deletions
diff --git a/subx/examples/ex10 b/subx/examples/ex10 index 9cdfb983..d8ad528e 100755 --- a/subx/examples/ex10 +++ b/subx/examples/ex10 Binary files differdiff --git a/subx/examples/ex10.subx b/subx/examples/ex10.subx index fd2ccc08..51cc0a8c 100644 --- a/subx/examples/ex10.subx +++ b/subx/examples/ex10.subx @@ -67,4 +67,6 @@ $argv-equal:false: b8/copy-to-EAX 0/imm32 c3/return +== data 0x0a000000 + # . . vim:nowrap:textwidth=0 diff --git a/subx/examples/ex12.subx b/subx/examples/ex12.subx index 4d43b033..358da1d3 100644 --- a/subx/examples/ex12.subx +++ b/subx/examples/ex12.subx @@ -11,6 +11,7 @@ # . 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 +Entry: # syscall(mmap, 0x1000) bb/copy-to-EBX Mmap-new-segment/imm32 b8/copy-to-EAX 0x5a/imm32/mmap diff --git a/subx/examples/ex2 b/subx/examples/ex2 index f7ddb783..55a87a3f 100755 --- a/subx/examples/ex2 +++ b/subx/examples/ex2 Binary files differdiff --git a/subx/examples/ex2.subx b/subx/examples/ex2.subx index 3605fcc8..025eb0fa 100644 --- a/subx/examples/ex2.subx +++ b/subx/examples/ex2.subx @@ -9,6 +9,7 @@ == code 0x09000000 +Entry: # EBX = 1 bb/copy-to-EBX 1/imm32 # increment EBX @@ -17,4 +18,6 @@ bb/copy-to-EBX 1/imm32 b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 +== data 0x0a000000 + # . . vim:nowrap:textwidth=0 diff --git a/subx/examples/ex3 b/subx/examples/ex3 index 884da188..d85aba8e 100755 --- a/subx/examples/ex3 +++ b/subx/examples/ex3 Binary files differdiff --git a/subx/examples/ex3.subx b/subx/examples/ex3.subx index c9ad3e38..1d52e87f 100644 --- a/subx/examples/ex3.subx +++ b/subx/examples/ex3.subx @@ -12,6 +12,7 @@ # . 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 +Entry: # result: EBX = 0 bb/copy-to-EBX 0/imm32 # counter: ECX = 1 @@ -33,4 +34,6 @@ $exit: b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 +== data 0x0a000000 + # . . vim:nowrap:textwidth=0 diff --git a/subx/examples/ex4.subx b/subx/examples/ex4.subx index a1f042ed..31c1c10c 100644 --- a/subx/examples/ex4.subx +++ b/subx/examples/ex4.subx @@ -12,6 +12,7 @@ X: == code 0x09000000 +Entry: # syscall(read, stdin, X, 1) # . fd = 0 (stdin) bb/copy-to-EBX 0/imm32 diff --git a/subx/examples/ex5 b/subx/examples/ex5 index 090e1f60..37689c98 100755 --- a/subx/examples/ex5 +++ b/subx/examples/ex5 Binary files differdiff --git a/subx/examples/ex5.subx b/subx/examples/ex5.subx index f051a91f..6f5b1d90 100644 --- a/subx/examples/ex5.subx +++ b/subx/examples/ex5.subx @@ -40,4 +40,6 @@ Entry: b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 +== data 0x0a000000 + # . . vim:nowrap:textwidth=0 diff --git a/subx/examples/ex6.subx b/subx/examples/ex6.subx index c5999033..a90f11df 100644 --- a/subx/examples/ex6.subx +++ b/subx/examples/ex6.subx @@ -10,6 +10,7 @@ # . 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 +Entry: # syscall(write, stdout, X, Size) # . fd = 1 (stdout) bb/copy-to-EBX 1/imm32 diff --git a/subx/examples/ex7.subx b/subx/examples/ex7.subx index ee043c86..d3b33f23 100644 --- a/subx/examples/ex7.subx +++ b/subx/examples/ex7.subx @@ -16,6 +16,7 @@ # . 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 +Entry: # syscall(creat, Filename) bb/copy-to-EBX Filename/imm32 b9/copy-to-ECX 0x180/imm32/fixed-perms diff --git a/subx/examples/ex8 b/subx/examples/ex8 index fcbf4fcf..5be0e1e6 100755 --- a/subx/examples/ex8 +++ b/subx/examples/ex8 Binary files differdiff --git a/subx/examples/ex8.subx b/subx/examples/ex8.subx index 85fe1568..9d7255e1 100644 --- a/subx/examples/ex8.subx +++ b/subx/examples/ex8.subx @@ -19,6 +19,7 @@ # . 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 +Entry: # . prolog 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # EAX = ascii-length(argv[1]) @@ -55,4 +56,6 @@ $ascii-length:end: # return EAX c3/return +== data 0x0a000000 + # . . vim:nowrap:textwidth=0 diff --git a/subx/examples/ex9 b/subx/examples/ex9 index ffbea21b..fce7629c 100755 --- a/subx/examples/ex9 +++ b/subx/examples/ex9 Binary files differdiff --git a/subx/examples/ex9.subx b/subx/examples/ex9.subx index 344c62ae..e3318b05 100644 --- a/subx/examples/ex9.subx +++ b/subx/examples/ex9.subx @@ -22,6 +22,7 @@ # . 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 +Entry: # . prolog 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # ascii-difference(argv[1], argv[2]) @@ -49,4 +50,6 @@ ascii-difference: # (s1, s2) : null-terminated ascii strings 29/subtract 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . . # subtract ECX from EAX c3/return +== data 0x0a000000 + # . . vim:nowrap:textwidth=0 |