代写 C assembly CS 245 Fall 2019

CS 245 Fall 2019

Assignment 1 –
Parts A and B are Due Thursday, Oct. 10
Part C is Due Thursday, Oct. 17

For all assignments, be sure to:
Include file comments at the top, listing your name, the name of the program, and briefly describe what the program does.
Line up instruction parts in columns:
0=labels; 1tab=instruction mnemonic; 2tabs=operands; 3-4tabs=comments.
Include pseudo-code comments to the right of your assembly code. Avoid comments that tell me what the assembly does, such as: move 25 to register $s3. Keep your comments to the logic. This is important for larger, complex programs.

Program 1A: Totaling 3 Array Elements
For the first program, declare a word array ‘warray’ of 3 variables, total them, and store the total in the ‘total’ variable. The total and warray should exist in memory. You may initialize warray to whatever you like. You do not need to use a loop for this 1a assignment.
Turn this program in as hwk1a.asm and bring a paper copy of your program to class to submit.
$ submit 245 hwk1.asm

Program 1B: Repeater String
Create a word in memory called integr. You may initialize integr to anything you want. In your program, test if integr is positive or negative or zero. Then print the appropriate result: “positive” or “negative” or “zero”.
Turn this program in as hwk1b.asm and bring a paper copy of your program to class to submit.
$ submit 245 hwk2.asm

Program 1C: String compare
Prompt for a string: “Enter String:” Read in the string. Then compare the input string with a null-terminated (asciiz) string you have created in memory called ‘passwd’. Please define passwd as “Ranger123#”. If there is a string match, print “Correct”. Otherwise print “Incorrect”.
Hint: Here is some logic for you to use as comments:
# # syscall.print(“Enter String:”)
# # input = syscall.readstring()
# # index = 0
# # while passwd[index] != 0 (null character)
# # if passwd[index] != input[index]
# # syscall.print(“Incorrect Password”)
# # exit
# # endif
# # index++
# # enddo
# # syscall.print(“Correct”)
Turn this program in as hwk3.asm, with a paper copy for me as well.
$ submit 245 hwk1c.asm