Description
COMP 3350 Project #1 Registers and arrays Solved
Assignment Goal:
Get you familiar with :
1. Microsoft Macro Assembler (MASM) on Visual Studio.
2. Setting up an assembly program.
3. Defining and accessing Arrays.
4. Dealing with Registers and instructions.
5. 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_P1.asm
Specifications:
The objective of this assignment is to create a program that will read a value from an
array, add another value to this, and save the sum of those two values into a specific
register.
Design:
Create a BYTE array with the label ‘input’. ‘input’ should have eight elements. You may
place any legal values in each of the elements of this array.
Create a BYTE variable with the label ‘shift’. ‘shift’ should hold a single value. You will
sum the value of this variable with each of the individual values in the array.
Page 1 of 2
Set the values of the EAX, EBX, ECX, and EDX to 0.
The program should then read each of the values from the array ‘input’ one at a time
and add the value ‘shift’ to it. The sum should be stored in the “correct” register.
Correct is defined as:
The first and second sums should be in the AX register.
The third and fourth sums should be in the BX register.
The fifth and sixth sums should be in the CX register.
The seventh and eighth sums should be in the DX register.
E.g. If ‘input’ has the values “1,2,3,4,5,6,7,8” and the value of ‘shift’ is 2 then, after the
program has finished all sums, EAX should have the value 00000304, EBX 00000506,
ECX 00000708, and EDX 0000090A.
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 2 of 2
COMP 3350 Project #2 Arrays and Loops Solved
Assignment Goal:
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_P2.asm
Specifications:
The objective of this assignment is to create a program that will read a value from an
array, and then place this value in another array with the location shifted by a certain
amount. The array may be of any length from 2 to 100. Your program must be flexible
enough to produce the correct solution regardless of the array size. You have to provide
documentation for your program in the form of comments.
Design:
Create a BYTE array with the label ‘input’. This array may be of any length between 2
and 100.
Create a BYTE array with the label ‘output’. This array should be the same length as
‘input’.
Create a DWORD variable with the label ‘shift’. ‘shift’ should hold a single value. The
value of ‘shift’ must be less than the length of ‘input’.
Page 1 of 2
The program should then read each of the values from the array ‘input’ and place the
values into the ‘output’ array but the location should be shifted by the amount in the
‘shift’ variable. If the shift would cause a value to be outside of the bounds of ‘output’,
then the values should “wrap around” to the front of ‘output’.
Example:
My ‘input’ array is 5,0A,3,6,0C
‘shift’ is 3
The proper solution for ‘output’ is 3,6,0C,5,0A
As you can see the value ‘5’ is the 1st value in the ‘input’ array. The value ‘5’ then shifts
3 to the 4th value in the ‘output’ array. Also, note that the value ‘3’ is the 3rd value in the
‘input’ array.
After a shift of 3, this would take the value ‘3’ out of bounds for the ‘output’
array (it is the same length as the ‘input’ array). The value ‘3’ must “wrap around” to the
front of the ‘output’ array. This also holds true for ‘6′ and ‘0C’.
Remember that your program must be flexible enough to handle an array of any length.
Just because you test it with an array of length 6 does not mean that I will test it with an
array of length 6. I could test with an array 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 your judgment to chose between explaining each line or related group
of lines. The purpose of these comments is to make the code readable for other
programmers or for you in the future.
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 2 of 2
COMP 3350 Project #3 Anagram Solved
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




