Docsity

Assembly Program Assignment for CSC 3210 - Summer 2008 (Week 4), Assignments of Computer Architecture and Organization

Toggle sidebar
bg1
CSC 3210
Summer 2008
Assignment #4
Due Tuesday, July 22nd
Write an assembly program that:
+ prompts the user to enter a number.
+ prompts the user for a bit position (0-31).
+ displays the user’s input in hexadecimal notation and the bit at specified location
+ prompts for continuing execution (y/n) and follows the user’s request.
============
A sample run, user’s inputs are in bold
Please enter a number (or a character): 13
Please enter a bit location (0-31): 0
You’ve entered: 0xD and the bit at position 0 is: 1
Do you want to repeat the program(y/n): n
=============
Follow submission guidelines to submit your work.
Refer to the link on the class website “sample printing decimal to binary” – this code shows how to
receive input from a user and then retrieve the data within the program
You will need to declare two variables of type word – one for the number and the other for the bit
position. These should be declared first before the byte sized variable for the yes/no option and any
strings that you declare.
The slides for chapter 10 show how to use the scanf function to read user input. Once the user has
provided the input and your program has scanned it in, you will need to use the load instruction to read
it from memory. You will use the ld instruction for the word size variables and the ldub instruction for
the y/n entry. Before using one of the load instructions, you need to use the set command to set the
variable name to a register. Then use that register as the source indicating the memory location for
where to load from. This is shown in the sample program at the link mentioned above.

Partial preview of the text

Download Assembly Program Assignment for CSC 3210 - Summer 2008 (Week 4) and more Assignments Computer Architecture and Organization in PDF only on Docsity!

CSC 3210

Summer 2008 Assignment # Due Tuesday, July 22nd Write an assembly program that:

  • prompts the user to enter a number.
  • prompts the user for a bit position (0-31).
  • displays the user’s input in hexadecimal notation and the bit at specified location
  • prompts for continuing execution (y/n) and follows the user’s request. ============ A sample run, user’s inputs are in bold Please enter a number (or a character): 13 Please enter a bit location (0-31): 0 You’ve entered: 0xD and the bit at position 0 is: 1 Do you want to repeat the program(y/n): n ============= Follow submission guidelines to submit your work. Refer to the link on the class website “sample printing decimal to binary” – this code shows how to receive input from a user and then retrieve the data within the program You will need to declare two variables of type word – one for the number and the other for the bit position. These should be declared first before the byte sized variable for the yes/no option and any strings that you declare. The slides for chapter 10 show how to use the scanf function to read user input. Once the user has provided the input and your program has scanned it in, you will need to use the load instruction to read it from memory. You will use the ld instruction for the word size variables and the ldub instruction for the y/n entry. Before using one of the load instructions, you need to use the set command to set the variable name to a register. Then use that register as the source indicating the memory location for where to load from. This is shown in the sample program at the link mentioned above.