Starting from:

$28

SOLVED COMP 3350 Project #3 Anagram

Assignment Goal: 1. Using critical thinking and problem solving. 2. Get you familiar with : 1. Defining and accessing Arrays. 2. Dealing with Registers and instructions. 3. Dealing with Loops. 4. Debugging and running your assembly code. Deliverables:                                                                                                    Submit the source file (.asm) to Canvas before the due date. This should be the only file you should submit to Canvas. The file should be named {USERNAME}_P{NUMBER}.asm USERNAME is your auburn email without “@auburn.edu” E.g. abc0003_P3.asm Specifications: The objective of this assignment is to create a program that will determine if two strings are anagrams. If the two strings are anagrams, then EAX will have the value 1 after the code has completed. If they are not anagrams, then EAX will have the value 0. Two .java implementations are in the “files” section in Canvas. Feel free to use one of these or another method. All “high level” directives are not allowed on this homework. (e.g. .IF .ENDIF .REPEAT, etc) What is anagram ? From dictionary.com : an·a·gram /ˈanəˌɡram/ noun Page 1 of 4 noun: anagram; plural noun: anagrams a word, phrase, or name formed by rearranging the letters of another, such as cinema, formed from iceman. You can read more about in wikipedia: https://en.wikipedia.org/wiki/Anagram Design: Create a BYTE array with the label ‘s1’. This array may be of any length between 2 and 100. Create a BYTE array with the label ‘s2’. This array should be the same length as ‘s1’. You may create any other values you deem necessary. The program should compare the two strings to determine if they are anagrams. Assume that each of the arrays (s1 and s2) will be the same length. Also assume that all characters in the array will be capital letters. Program: Assume that I am a programmer and I tried to implement the java program “AnagramCounter.java’ In MASM, I wrote this program but I had some issues to make it running: Page 2 of 4 .386 .model flat,stdcall .stack 4096 ExitProcess proto,dwExitCode:dword .data s1 byte "GARDEN" s2 byte "DANGER" c1 byte 21 dup(0) ;counter for each alphabetic letter in s1 c2 byte 21 dup(0) ;counter for each alphabetic letter in s2 .code main proc mov eax, 0 ;we will assume that we do not have an anagram ;(1) iterate lengthof s1 times mov esi, 0 ;start at the first byte of s1 and s2 CounterLoop: ;this will increment the proper 'elements' of c1 and c2 movzx edi, s1[esi] ;move the value from s1 into edi ;(2) increment the counter at the value - 65. ;subtract 65 because the ASCII value of A is 65, B is 66, C is 67... ;when you subtract 65 then the sum of all the As will be stored in 'index' 0 This program has been passed to you to complete and fix. Your job is to successfully implement the comments and fix any bugs in the program. Hint: There are 4 bugs in the code, 1 mistake in the comments, 9 lines to implement “the comments starting with numbers from (1) to (9).” Example: s1 BYTE “GARDEN” s2 BYTE “DANGER” After the code completes EAX would have the value 1. (These are anagrams) Page 3 of 4 ;Bs in 'index' 1, Cs in 'index' 2... ;(3)Do the same procedure for s2 ;(4) increment the counter at the value - 65 dec esi ;increment esi loop CounterLoop ;after this loop terminates our couter arrays will have the proper values ;(5)start checking the counter arrays at 'index' 100 ;(6) iterate lengthof c1 times VerifyLoop: ;(7) move value of c1 into bl ;(8)check bl vs the value of c2 ;(9) if they are not equal then we do not have an anagram. jump to NoAna inc esi ;increment esi loop VerifyLoop mov eax, 10 ;if the loop terminates and we have not jumped then we know we have an anagram NoAna: invoke ExitProcess, 0 main endp end main Another example: s1 BYTE “CODE” s2 BYTE “DOGS” After the code completes EAX would have the value 0. (These are not anagrams) Remember that your program must be flexible enough to handle a string of any length. I could test with a string of length 2 or 100 or any number in between. Code Documentation: At the top of your "asm" file, give a brief description of the program, author name and last modified date in the form of comments. For the code, Use the comments provided find one mistake in the comment and fix it. Late Submission Penalty: • Late submissions will not be accepted and will result in a ZERO without valid excuses, in which case you should talk to Dr. Li to explain your situation. • GTA/Instructor will NOT accept any late submission caused by Internet latency or internet issues. Page 4 of 4