-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnLn-Intercalar
More file actions
131 lines (113 loc) · 1.89 KB
/
EnLn-Intercalar
File metadata and controls
131 lines (113 loc) · 1.89 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
segment .data
mensaje1 db 'Ingrese la primer cadena:', 0xA
mensaje2 db 'Ingrese la segunda cadena:', 0xA
mensaje3 db 'Ingrese la tercer cadena:', 0xA
mensajefinal db 'La cadena final es:', 0xA
segment .bss
cad1 resb 50
cad2 resb 50
cad3 resb 50
cadenafinal resb 150
segment .text
global _start
_start:
mov edx,25d
mov ecx,mensaje1
mov ebx,1
mov eax,4
int 0x80
;mostramos el primer mensaje
mov edx,50d
mov ecx,cad1
mov ebx,0
mov eax,3
int 0x80
;introducimos la primer cadena
mov edx,26d
mov ecx,mensaje2
mov ebx,1
mov eax,4
int 0x80
;mostramos el segundo mensaje
mov edx,50d
mov ecx,cad2
mov ebx,0
mov eax,3
int 0x80
;introducimos la segunda cadena
mov edx,25d
mov ecx,mensaje3
mov ebx,1
mov eax,4
int 0x80
;mostramos el tercer mensaje
mov edx,50d
mov ecx,cad3
mov ebx,0
mov eax,3
int 0x80
;introduciomos la tercer cadena
mov edi,cadenafinal
mov esi,cad1
mov eax,cad2
mov ebx,cad3
mov ecx,0
;asignamos las cadenas a registros para un mejor manejo
;mover cadena 1
loop:
mov dl,byte[esi]
cmp dl,0xA
je caso1
mov byte[edi],dl
inc edi
inc esi
jmp loop1
caso1:
inc ecx
jmp loop1
;mover cadena 2
loop1:
mov dl,byte[eax]
cmp dl,0xA
je caso2
mov byte[edi],dl
inc edi
inc eax
jmp loop2
caso2:
inc ecx
jmp loop2
;mover cadena 3
loop2:
mov dl,byte[ebx]
cmp dl,0xA
je caso3
mov byte[edi],dl
inc edi
inc ebx
jmp loop
caso3:
inc ecx
jmp verifica
verifica:
cmp ecx,3
je salida
mov ecx,0
jmp loop
salida:
inc edi
mov byte [edi],0xA
mov edx,19d
mov ecx,mensajefinal
mov ebx,1
mov eax,4
int 0x80
;imprimimos el mensaje final
mov edx,150d
mov ecx,cadenafinal
mov ebx,1
mov eax,4
int 0x80
;Imprimimos la cadena final
mov eax,1
int 0x80