c109sp01t1 - CSc 109 Test 1 Wednesday 28 October 2001 Open...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSc 109 Test 1 Wednesday 28 October 2001 Open book, open notes. No calculators, or computers allowed. Suggested answers. 1. (xx pts) Given the sm program below, fill out the table to its right, for the first 11 instructions when the program executes, unless the program halts or crashes before then. It will be more convenient to use hex numbers to indicate the contents of the stack before the instruction is executed. 0 0xB01 Step PC Instruction Stack (top to right) 1 0x300 1 0 B01 0 0 0 0 2 0x30D 3 0x500 2 ___1______300___________0_____0____0_____0__ 4 0x400 5 0xB00 3 ___2______30D___________0_____0____0____BO1_ 6 0x300 7 0x30D 4 ___3______500___________0_____0__BO1______5_ 8 0x500 9 0x400 5 ___4______400___________0_____0____0____B06_ 10 0xB00 11 0x400 6 ___5______B00___________0_____0____0______0_ 12 0xB 13 0x5 7 ___0______B06___________0_____0____0______0_ 8 ___6______300___________0_____0____0______0_ 9 ___7______30D___________0_____0____0____B06_ 10 ___8______500___________0_____0__B06______5_ 11 ___9______400___________0_____0____0____B0B_ 2. (xx pts) Write an sasm program which reads in two numbers and then writes out the remainder when the first is divided by the second. So you can write the complete file, assume you test the program with the numbers 37 and 5 read store x read store y load x load x load y div load y mult sub write halt x:0 y: 0 Q 37 5
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
3.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern