Question: Write a program to check if a given string is a palindrome. You are free to implement an algorithm of your own but a recommended

Write a program to check if a given string is a palindrome. You are free to implement an algorithm of your own but a recommended approach is given in the next section. Study the logic in the pseudocode and think of how it is implemented in NASM...

UPDATE 4/30/18 Small but significant bugs removed from Pseudocode

------------------------------------------

C-Style Pseudocode is given below:

print(The string is: "); // output Msg1 print(string1); // output the string that is being checked print(nl); // output new line character // get string length stringLength = 0; edi = &string1; checkNextChar: if( *edi == null ) GOTO countFinished; else{ edi++; stringLength++; GOTO checkNextChar }

countFinished: edi = &string1 esi = &string1 esi = esi + stringLength esi--; COMPARE_LETTERS:

ah = *edi; al = *esi; if(ah != al) GOTO NOT_PALINDROME else{ edi++; esi--; if(edi >= esi) GOTO IS_PALINDROME GOTO COMPARE_LETTERS: }

IS_PALINDROME: print(string1); print(" IS a palindrome); print(nl); exit(0);

NOT_PALINDROME: print(string1); print(" is NOT a palindrome); print(nl); exit(0);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement a program in NASM Netwide Assembler that checks if a given string is a palindrome we will break down the pseudocode into key steps and th... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!