File tree 12 files changed +324
-0
lines changed
Linux/share/sasm/Projects
12 files changed +324
-0
lines changed Original file line number Diff line number Diff line change
1
+ form at ELF
2
+
3
+ section '.data' writeable
4
+ a dd 0
5
+ b dd 0
6
+ inputForm at db "%d%d" , 0
7
+ outputForm at db "%d" , 0
8
+
9
+ section '.text' executable
10
+ public main
11
+ extrn scanf
12
+ extrn printf
13
+ main:
14
+ mov ebp , esp ; for correct debugging
15
+ push b
16
+ push a
17
+ push inputForm at
18
+ call scanf
19
+ mov eax , dword [ a ]
20
+ add eax , dword [ b ]
21
+ push eax
22
+ push outputForm at
23
+ call printf
24
+ mov esp , ebp
25
+ xor eax , eax
26
+ ret
27
+
Original file line number Diff line number Diff line change
1
+ form at ELF64
2
+
3
+ section '.data' writeable
4
+ a dq 0
5
+ b dq 0
6
+ inputForm at db "%lld%lld" , 0
7
+ outputForm at db "%lld" , 0
8
+
9
+ section '.text' executable
10
+ public main
11
+ extrn scanf
12
+ extrn printf
13
+ main:
14
+ mov rbp , rsp ; for correct debugging
15
+ sub rsp , 32
16
+ and rsp , - 16
17
+ mov rcx , inputForm at
18
+ mov rdx , a
19
+ mov r8 , b
20
+ call scanf
21
+ mov rdx , qword [ a ]
22
+ add rdx , qword [ b ]
23
+ mov rcx , outputForm at
24
+ call printf
25
+ mov rsp , rbp
26
+ xor rax , rax
27
+ ret
28
+
Original file line number Diff line number Diff line change
1
+ .data
2
+ a: .long 0
3
+ b: .long 0
4
+ inputForm at : .asciz "%d%d"
5
+ outputForm at : .asciz "%d"
6
+
7
+ . extern printf
8
+ . extern scanf
9
+ .text
10
+ . global main
11
+ main:
12
+ movl % esp , % ebp # for correct debugging
13
+ pushl $ b
14
+ pushl $ a
15
+ pushl $ inputFormat
16
+ call scanf
17
+ movl a , % eax
18
+ addl b , % eax
19
+ pushl % eax
20
+ pushl $ outputFormat
21
+ call printf
22
+ movl % ebp , % esp
23
+ xorl % eax , % eax
24
+ ret
25
+
26
+
Original file line number Diff line number Diff line change
1
+ .data
2
+ a: .quad 0
3
+ b: .quad 0
4
+ inputForm at : .asciz "%lld%lld"
5
+ outputForm at : .asciz "%lld"
6
+
7
+ . extern printf
8
+ . extern scanf
9
+ .text
10
+ . global main
11
+ main:
12
+ movq % rsp , % rbp # for correct debugging
13
+ subq $ 32 , % rsp
14
+ andq $ - 16 , % rsp
15
+ movq $ inputFormat , % rcx
16
+ movq $ a , % rdx
17
+ movq $ b , % r8
18
+ call scanf
19
+ movq (a) , % rdx
20
+ addq (b) , % rdx
21
+ movq $ outputFormat , % rcx
22
+ call printf
23
+ movq % rbp , % rsp
24
+ xorq % rax , % rax
25
+ ret
26
+
27
+
Original file line number Diff line number Diff line change
1
+ form at ELF
2
+
3
+ section '.data' writeable
4
+ a dd 0
5
+ b dd 0
6
+ inputForm at db "%d%d" , 0
7
+ outputForm at db "%d" , 0
8
+
9
+ section '.text' executable
10
+ public main
11
+ extrn scanf
12
+ extrn printf
13
+ main:
14
+ mov ebp , esp ; for correct debugging
15
+ push b
16
+ push a
17
+ push inputForm at
18
+ call scanf
19
+ mov eax , dword [ a ]
20
+ add eax , dword [ b ]
21
+ push eax
22
+ push outputForm at
23
+ call printf
24
+ mov esp , ebp
25
+ xor eax , eax
26
+ ret
27
+
Original file line number Diff line number Diff line change
1
+ form at ELF64
2
+
3
+ section '.data' writeable
4
+ a dq 0
5
+ b dq 0
6
+ inputForm at db "%lld%lld" , 0
7
+ outputForm at db "%lld" , 0
8
+
9
+ section '.text' executable
10
+ public main
11
+ extrn scanf
12
+ extrn printf
13
+ main:
14
+ mov rbp , rsp ; for correct debugging
15
+ sub rsp , 32
16
+ and rsp , - 16
17
+ mov rcx , inputForm at
18
+ mov rdx , a
19
+ mov r8 , b
20
+ call scanf
21
+ mov rdx , qword [ a ]
22
+ add rdx , qword [ b ]
23
+ mov rcx , outputForm at
24
+ call printf
25
+ mov rsp , rbp
26
+ xor rax , rax
27
+ ret
28
+
Original file line number Diff line number Diff line change
1
+ .data
2
+ a: .long 0
3
+ b: .long 0
4
+ inputForm at : .asciz "%d%d"
5
+ outputForm at : .asciz "%d"
6
+
7
+ . extern printf
8
+ . extern scanf
9
+ .text
10
+ . global main
11
+ main:
12
+ movl % esp , % ebp # for correct debugging
13
+ pushl $ b
14
+ pushl $ a
15
+ pushl $ inputFormat
16
+ call scanf
17
+ movl a , % eax
18
+ addl b , % eax
19
+ pushl % eax
20
+ pushl $ outputFormat
21
+ call printf
22
+ movl % ebp , % esp
23
+ xorl % eax , % eax
24
+ ret
25
+
26
+
Original file line number Diff line number Diff line change
1
+ .data
2
+ a: .quad 0
3
+ b: .quad 0
4
+ inputForm at : .asciz "%lld%lld"
5
+ outputForm at : .asciz "%lld"
6
+
7
+ . extern printf
8
+ . extern scanf
9
+ .text
10
+ . global main
11
+ main:
12
+ movq % rsp , % rbp # for correct debugging
13
+ subq $ 32 , % rsp
14
+ andq $ - 16 , % rsp
15
+ movq $ inputFormat , % rcx
16
+ movq $ a , % rdx
17
+ movq $ b , % r8
18
+ call scanf
19
+ movq (a) , % rdx
20
+ addq (b) , % rdx
21
+ movq $ outputFormat , % rcx
22
+ call printf
23
+ movq % rbp , % rsp
24
+ xorq % rax , % rax
25
+ ret
26
+
27
+
Original file line number Diff line number Diff line change
1
+ form at ELF
2
+
3
+ section '.data' writeable
4
+ a dd 0
5
+ b dd 0
6
+ inputForm at db "%d%d" , 0
7
+ outputForm at db "%d" , 0
8
+
9
+ section '.text' executable
10
+ public _main
11
+ extrn _scanf
12
+ extrn _printf
13
+ _main:
14
+ mov ebp , esp ; for correct debugging
15
+ push b
16
+ push a
17
+ push inputForm at
18
+ call _scanf
19
+ mov eax , dword [ a ]
20
+ add eax , dword [ b ]
21
+ push eax
22
+ push outputForm at
23
+ call _printf
24
+ mov esp , ebp
25
+ xor eax , eax
26
+ ret
27
+
Original file line number Diff line number Diff line change
1
+ form at ELF64
2
+
3
+ section '.data' writeable
4
+ a dq 0
5
+ b dq 0
6
+ inputForm at db "%lld%lld" , 0
7
+ outputForm at db "%lld" , 0
8
+
9
+ section '.text' executable
10
+ public main
11
+ extrn scanf
12
+ extrn printf
13
+ main:
14
+ mov rbp , rsp ; for correct debugging
15
+ sub rsp , 32
16
+ and rsp , - 16
17
+ mov rcx , inputForm at
18
+ mov rdx , a
19
+ mov r8 , b
20
+ call scanf
21
+ mov rdx , qword [ a ]
22
+ add rdx , qword [ b ]
23
+ mov rcx , outputForm at
24
+ call printf
25
+ mov rsp , rbp
26
+ xor rax , rax
27
+ ret
28
+
Original file line number Diff line number Diff line change
1
+ .data
2
+ a: .long 0
3
+ b: .long 0
4
+ inputForm at : .asciz "%d%d"
5
+ outputForm at : .asciz "%d"
6
+
7
+ . extern _printf
8
+ . extern _scanf
9
+ .text
10
+ . global _main
11
+ _main:
12
+ movl % esp , % ebp # for correct debugging
13
+ pushl $ b
14
+ pushl $ a
15
+ pushl $ inputFormat
16
+ call _scanf
17
+ movl a , % eax
18
+ addl b , % eax
19
+ pushl % eax
20
+ pushl $ outputFormat
21
+ call _printf
22
+ movl % ebp , % esp
23
+ xorl % eax , % eax
24
+ ret
25
+
26
+
Original file line number Diff line number Diff line change
1
+ .data
2
+ a: .quad 0
3
+ b: .quad 0
4
+ inputForm at : .asciz "%lld%lld"
5
+ outputForm at : .asciz "%lld"
6
+
7
+ . extern printf
8
+ . extern scanf
9
+ .text
10
+ . global main
11
+ main:
12
+ movq % rsp , % rbp # for correct debugging
13
+ subq $ 32 , % rsp
14
+ andq $ - 16 , % rsp
15
+ movq $ inputFormat , % rcx
16
+ movq $ a , % rdx
17
+ movq $ b , % r8
18
+ call scanf
19
+ movq (a) , % rdx
20
+ addq (b) , % rdx
21
+ movq $ outputFormat , % rcx
22
+ call printf
23
+ movq % rbp , % rsp
24
+ xorq % rax , % rax
25
+ ret
26
+
27
+
You can’t perform that action at this time.
0 commit comments