From CS61
Jump to: navigation, search

9/27: Assembly III Exercise: Assembly Roulette

Learning Objectives

  • Comfort with readings assembly generated in the wild
  • Ability to handle whatever Dr. Evil throws at you in your Bomb

Getting Started

There is no code for today's exercises!

Instead, you will see that there is a number on your bucket. The number corresponds to a Google doc that has been prepared for you. Go to the class folder and select the document for your table.

If you are taking this through extension, then after class, you should find a folder full of assembly functions and solutions -- go wild! Feel free to add some problems if you'd like, but select 2-3 assembly examples from any table that look intriguing and try to solve them.

Now, team up in pairs and have each pair select a color.

Once you've got your team and a color, each team should work on their appliance and write a C function that is not too long - perhaps 10 lines. You will generate assembly that you'll paste into the Google doc and this will become a puzzle for the other teams at your table. Be thoughtful about the C you write -- you want to generate something that is approachable, but challenging. You can decide what optimization level to use to produce the code you post, but unless the others at your table demand it, let's stay away from vectorized instructions -- we could spend an entire couple of lectures learning those and we're not going to do that. Try not to spend more than 5-10 minutes generating your puzzle (we'll alert you after about 10 minutes).

Once each team has generated some assembly, start working on the assembly generated by the team to your left. See if you can work your way all the way around the table; if you do, then everyone gets to write a new C function. If groups get stuck, it's the other groups' job to help them get unstuck. Feel free

If there are constructs you found particularly fun, clever, interesting, or challenging, annotate them on your Google doc (after all the teams have had a chance to try all the functions).

Wrapping Up

We'll take a few minute to ask tables if they have any particularly fun code samples to share.


  • Please, please, please, fill out the survey after class.