Difference between revisions of "CSC231 Final Exam 2010"
(Created page with '<tanbox> This final exam is take-home. It is open-books, open-notes, and open-Web. It is due a week after it is made available, at 4:00 p.m. on TBA. You cannot discuss the deta…') |
|||
Line 10: | Line 10: | ||
<onlydft> | <onlydft> | ||
− | =Problem #1= | + | =Problem #1: Debugging Dump= |
+ | ==Part 1== | ||
+ | Write an assembly language program that does '''not''' use the driver.c or asm_io.asm files and that displays a 32-bit integer in binary, hexadecimal, and in decimal. When the number is displayed in decimal it is displayed as an ''unsigned'' '''int'''. For example, 0x80000000 should display as 2147483648. | ||
+ | |||
+ | Your program should contain three functions, one that receives the 32-bit integer in eax and displays it in ''binary''. One that receives the 32-bit integer in eax and displays in ''hexadecimal''. The third one will receive the 32-bit integer in eax and display it in ''decimal'', '''without''' leading zeros. | ||
+ | |||
+ | Demonstrate the functionality of your program by making it display the following 32-bit integers: | ||
+ | |||
+ | |||
+ | 1, | ||
+ | 0xF, | ||
+ | 0X10 | ||
+ | 0x12345678 | ||
+ | 0x7ffffff | ||
+ | 0x89abcdef | ||
+ | 0xffffffff | ||
+ | |||
+ | Here is what your main program should look like: | ||
+ | |||
+ | <code><pre> | ||
+ | section .data | ||
+ | table dd 1, 15, 16 | ||
+ | dd 0x12345678, 0x7ffffff, 0x89abcdef, 0xffffffff, | ||
+ | N equ ($-table)/4 | ||
+ | |||
+ | section .text | ||
+ | start: | ||
+ | mov ebx, table | ||
+ | mov ecx, N | ||
+ | mov eax, [ebx] | ||
+ | |||
+ | call displayBin | ||
+ | call nextLine | ||
+ | call displayHex | ||
+ | call nextLine | ||
+ | call displayUInt | ||
+ | call nextLine | ||
+ | call nextLine | ||
+ | |||
+ | add ebx, 4 | ||
+ | loop for | ||
+ | |||
+ | mov eax, EXIT | ||
+ | mov ebx, 0 | ||
+ | int 0x80 | ||
+ | |||
+ | |||
+ | </pre></code> | ||
+ | :where nextLine is a function that brings the cursor to the next line. | ||
+ | |||
+ | ==Part 2== | ||
+ | Add a fourth function to your program that will display all the registers in hex and decimal. | ||
</onlydft> | </onlydft> |
Revision as of 10:59, 12 December 2010
This final exam is take-home. It is open-books, open-notes, and open-Web. It is due a week after it is made available, at 4:00 p.m. on TBA.
You cannot discuss the details of this exam with anyone except your instructor. The TAs are not allowed to help you out in any way. No question will be answered in person after 12:00 a.m. on 12/13/10. Instead, if you have questions regarding the exam, send them via email to thiebaut@cs.smith.edu, and the question and its answer will be broadcast back to the hole class via email. The exam is given under the rules of the Smith College Honor Code.
Make sure you reference all work/resources you use in your documentation.