-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx1.asm
More file actions
46 lines (38 loc) · 739 Bytes
/
Ex1.asm
File metadata and controls
46 lines (38 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
global _start
section .data
section .bss
string resb 256
section .text
_start:
input:
MOV edx, 256
MOV ecx, string
MOV eax, 3
MOV ebx, 0
int 80h
sol:
MOV ecx, eax
MOV esi, string
MOV edi, string
ADD edi, eax
dec edi
dec edi
shr eax, 1
.reverse_string:
MOV bl, [esi]
MOV bh, [edi]
MOV [esi], bh
MOV [edi], bl
inc esi
dec edi
dec eax
jnz .reverse_string
output:
MOV edx, ecx
MOV ecx, string
MOV eax, 4
MOV ebx, 1
int 80h
xor ebx, ebx
MOV eax, 1
int 80h