Difference between revisions of "CSC231 Homework 4 Fall 2017"
(→Details) |
|||
Line 51: | Line 51: | ||
<br /> | <br /> | ||
Submit your program on Moodle. Make sure you test it well before submitting it. In particular, if you add comments to your program just before submitting it, you should assemble, link and run it at least once to make sure you didn't change the logic of your program by adding comments. | Submit your program on Moodle. Make sure you test it well before submitting it. In particular, if you add comments to your program just before submitting it, you should assemble, link and run it at least once to make sure you didn't change the logic of your program by adding comments. | ||
+ | <br /> | ||
+ | =Problem 2= | ||
+ | <br /> | ||
+ | =Problem 3= | ||
+ | <br /> |
Revision as of 14:17, 13 October 2017
--D. Thiebaut (talk) 15:15, 13 October 2017 (EDT)
Problem 1
Write an assembly language program called hw4a.asm that translate a decimal unsigned integer into its octal equivalent.
Here is an example of how it should behave:
cs231a@aurora ~/ $ nasm -f elf hw4a.asm cs231a@aurora ~/ $ ld -melf_i386 hw4a.o 231Lib.o -o hw4a cs231a@aurora ~/ $ ./hw4a > 1 00000000001 cs231a@aurora ~/ $ ./hw4a > 4294967295 37777777777 cs231a@aurora ~/ $ ./hw4a > 0 00000000000 cs231a@aurora ~/ $ ./hw4a > 2 00000000002 cs231a@aurora ~/ $ ./hw4a > 4 00000000004 cs231a@aurora ~/ $ ./hw4a > 8 00000000010 cs231a@aurora ~/ $ ./hw4a > 9 00000000011 cs231a@aurora ~/ $ ./hw4a > 32 00000000040 cs231a@aurora ~/ $ ./hw4a > 2147483647 17777777777
Details
- Your program must be linked with the 231Lib.asm library
- Your program will print a prompt ( "> " ) first, then the user enters a positive number (it will never be negative)
- Your program gets the input using the _getInput() function in the 231Lib.asm library
- Your program outputs the octal equivalent, padded with leading 0s.
- You can use the on-line converter at http://calc.50x.eu/ to verify that your program outputs the correct information. Make sure you set it to 32 bits.
Submission
Submit your program on Moodle. Make sure you test it well before submitting it. In particular, if you add comments to your program just before submitting it, you should assemble, link and run it at least once to make sure you didn't change the logic of your program by adding comments.
Problem 2
Problem 3