so I have to check palindrome of the string, but it has to convert the string to lowercase first so I'm struggling at that part. Here I have the code to find the length of the string already and now I'm confused how to convert each letter in this string to lowercase. I'm thinking of traversing through the string and convert each letter one by one but don't know actually how the conversion happen, thanks
my code:
.686
.model flat
.code
_IsPalindrome PROC ;
push ebp
mov ebp,esp ;stack pointer to ebp
mov ebx,[ebp+8] ; address of first array element
mov eax, 0
xor dl, dl ;set dl = 0
lengthloop: ;find the length
cmp [ebx+eax], dl
je FirstLast
inc eax
jmp lengthloop
Lowercase: ;change to lower case
;STUCK AT THIS PART CURRENTLY
FirstLast: ;I'm thinking using this for traversing through the string
mov ecx, 0 ;ecx = firt character of the string
dec eax ;subtract one from eax
mov edx, eax ;edx = length of the string
CheckPalindrome: ;Will work on this after the lowercase
AllDone:
pop ebp
ret
_IsPalindrome ENDP
END
this in my main to call this asm file
#include <iostream>
using namespace std;
extern"C" {
bool IsPalindrome(char[]);
}
int main()
{
char myString[] = "kayak";
IsPalindrome(myString);
return 0;
}
thanks a lot, it'll be nice if you can give feedback in this form also, it's MASM x86 Intel