Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Palindrome Checker using ARM Assembly Looking for help with the problem. I have

ID: 3829693 • Letter: P

Question

Palindrome Checker using ARM Assembly

Looking for help with the problem. I have a method of solving it, but I am having trouble implementing it

This is what I am attempting:

Draw a detailed flowchart and write an ARM assembly program to determine whether a string of printable ASCII letters from a to z or from A to Z, case insensitive) stored in memory is a palindrome e., the letters in the string are the same from left to right as from right to le case insensitive) or not, If palindrome you should store 1 in r if no you should store 2 in r 0. Your code should be highly optimized use as little number of instructions as ossible Ignore all characters that are not letters. You should also treat capital and small letters the same, i.e., case insensitive. For example, "madam", "deleveled "Noon "He lived as a devil, eh? and "Was it a car or a cat I saw?" are palindrome strings. However, madam, I am Adam. is not a palindrome string A string can have even or odd number of characters and ends with character ox00 (the ASCII code of the null character) You may want to define the UPC string as follow: STRING DCB He lived as a devil, eh? string Eos DCB 0x00 end of string

Explanation / Answer

Solution ::

mov bl,50 ; Starting Address of the memory
mov dl,0 ; number of characters make up the string

loop:
in 00 ;read the input from keyboard
cmp al, 2E ;checking to see if input is a fullstop
jz palindrome ;loop to see if input is a palindrome
mov [bl], al ;save input in the memory address
inc bl ;goto the next memory addr in bl
inc dl ;increment dl by 1 to length of the string
push al
jmp loop

palindrome:
cmp dl,0 ;check if it has goes through whole string
jz is_palin ;loop it has then string is a palindrome
mov bl, 50 ;bring back first input character
mov dl,[bl]
pop cl ;put last input character
cmp cl,dl ;check if the two values are the same
jnz not_palindrome ;if they are not same,then loop to not_palindrome
inc bl ;go to next input address
dec dl ;take away 1 from length of the string
jmp palindrome ;loop back to the start of the palindrome

not_palindrome:
mov dl,c0
mov cl,6E
mov [dl],cl ;print the character "n" to the vdu
jmp done ; do not execute code at is_palin

is_palin:
mov dl,c0
mov cl,79
mov [dl],cl ;print the character 'y' to the vdu

end

/// *** Thank You *** ///