-
Notifications
You must be signed in to change notification settings - Fork 1
/
palindromo1.nasm
57 lines (54 loc) · 875 Bytes
/
palindromo1.nasm
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
%macro print 2
mov eax,4
mov ebx,1
mov ecx,%1
mov edx,%2
int 80h
%endmacro
section .data
;cade1 db "abcdefgfedcba"
cade1 db "AbCDefGfedcbA"
leng equ $-cade1
sip db "si"
no db "no"
section .bss
buffer: resb 100
section .text
global _start
_start:
mov eax,cade1
mov ebx,(cade1+leng-1)
mov ecx,(leng/2)
_for:
mov byte dl,byte[eax]
mov byte dh,byte[ebx]
;trasnformando a may o min dl,dh
;'a' = 97
;'A' = 65
;hay q restar 32 ; mucho cuidado con eso
;por naturaleza pensamos q z es menos q A gggg
;ups
cmp dl,'Z' ;si minuscula
jg conti1
xor dl,32
conti1:
;salta
cmp dh,'Z'
jg conti2
xor dh,32 ;si es mayus lo combierte a min
conti2:
cmp dh, dl
jne _no
inc eax
dec ebx
loop _for
_si:
print sip,2
mov eax,1
mov ebx,0
int 80h
_no:
print no,2
mov eax,1
mov ebx,0
int 80h