Difference between revisions of "CSC231 Homework 3 Fall 2017"

From dftwiki3
Jump to: navigation, search
(Assignment)
(Assignment)
Line 9: Line 9:
 
==Assignment==
 
==Assignment==
 
<br />
 
<br />
* Using the 231Lib.asm library, write an assembly language program that prompts the user for an integer (positive) number of seconds, which it then translates in a number of days, hours, minutes and seconds.
+
* Write an assembly language program that you will link with the 231Lib library, and that will prompt the user for an integer (positive) number of seconds, which it will then translate in a number of days, hours, minutes and seconds.
 
* Call your program '''hw3.asm'''.
 
* Call your program '''hw3.asm'''.
 
* The format of your output should be similar to the format illustrated in the examples shown below.   
 
* The format of your output should be similar to the format illustrated in the examples shown below.   
 +
* The capture below shows how your program should be behaving. 
 
<br />
 
<br />
 
   
 
   
  cs231a@aurora ~/ $ ./hw3sol
+
  cs231a@aurora ~/ $ ./hw3
 
  > 1
 
  > 1
 
  0 days 0 hours 0 minutes 1 seconds  
 
  0 days 0 hours 0 minutes 1 seconds  
  cs231a@aurora ~/ $ ./hw3sol
+
  cs231a@aurora ~/ $ ./hw3
 
  > 0
 
  > 0
 
  0 days 0 hours 0 minutes 0 seconds  
 
  0 days 0 hours 0 minutes 0 seconds  
  cs231a@aurora ~/ $ ./hw3sol  
+
  cs231a@aurora ~/ $ ./hw3  
 
  > 3601
 
  > 3601
 
  0 days 1 hours 0 minutes 1 seconds  
 
  0 days 1 hours 0 minutes 1 seconds  
  cs231a@aurora ~/ $ ./hw3sol
+
  cs231a@aurora ~/ $ ./hw3
 
  > 8641
 
  > 8641
 
  0 days 2 hours 24 minutes 1 seconds  
 
  0 days 2 hours 24 minutes 1 seconds  
  cs231a@aurora ~/ $ ./hw3sol  
+
  cs231a@aurora ~/ $ ./hw3  
 
  > 86401
 
  > 86401
 
  1 days 0 hours 0 minutes 1 seconds  
 
  1 days 0 hours 0 minutes 1 seconds  
 
  cs231a@aurora ~/ $ 864001
 
  cs231a@aurora ~/ $ 864001
 
  864001: command not found
 
  864001: command not found
  cs231a@aurora ~/ $ ./hw3sol  
+
  cs231a@aurora ~/ $ ./hw3  
 
  > 864001
 
  > 864001
 
  10 days 0 hours 0 minutes 1 seconds  
 
  10 days 0 hours 0 minutes 1 seconds  

Revision as of 16:29, 1 October 2017

--D. Thiebaut (talk) 17:26, 1 October 2017 (EDT)


This assignment is due on Monday 10/9/17 at 11:55 p.m. You can work on this assignment in pairs, in which case you must include both your names in the header of the assembly language program you submit. Both members of a pair must submit a program and answer the quiz.


Problem 1


Assignment


  • Write an assembly language program that you will link with the 231Lib library, and that will prompt the user for an integer (positive) number of seconds, which it will then translate in a number of days, hours, minutes and seconds.
  • Call your program hw3.asm.
  • The format of your output should be similar to the format illustrated in the examples shown below.
  • The capture below shows how your program should be behaving.


cs231a@aurora ~/ $ ./hw3
> 1
0 days 0 hours 0 minutes 1 seconds 
cs231a@aurora ~/ $ ./hw3
> 0
0 days 0 hours 0 minutes 0 seconds 
cs231a@aurora ~/ $ ./hw3  
> 3601
0 days 1 hours 0 minutes 1 seconds 
cs231a@aurora ~/ $ ./hw3 
> 8641
0 days 2 hours 24 minutes 1 seconds 
cs231a@aurora ~/ $ ./hw3  
> 86401
1 days 0 hours 0 minutes 1 seconds 
cs231a@aurora ~/ $ 864001
864001: command not found
cs231a@aurora ~/ $ ./hw3  
> 864001
10 days 0 hours 0 minutes 1 seconds 
cs231a@aurora ~/ $ 


Additional Information


  • Use the DIV instruction
  • Do not worry about whether words should be singular or plural. We do not know how to test quantities yet. Make your program output all the words in their plural form.
  • Make your program output all the quantities on one line.
  • You can use WolfranAlpha to convert seconds to day/hours/minutes/seconds, to test your program. WolframAlpha will correctly understand what to do if you enter something like "864001 seconds" in the search bar.


Submission


  • Document your program well, and submit it on Moodle, in the Homework 3, Problem 1 section. Be careful as Moodle gives only 5-minute increments for the closing time, which means you have until 11:55 p.m. on Monday to submit the program.


Problem 2


  • Answer the quiz on Moodle, in the Homework 3 Problem 2 section.