CS 352 Lecture 28 – Functions
Dear students, Today we look at how functional abstractions are built atop rudimentary assembly instructions. The magic to make functions happen is really just two ideas: a register (lr), which places a bookmark for our program counter so we know where to return to after the function finishes a standard protocol for passing parameters and […]
CS 145 Lecture 27 – Array Patterns
Dear students, After you solve a few array problems, you start to see some regular patterns emerging in your algorithms. Today, we break down a few of those patterns. The payoff of cataloging these is that the next time we encounter an array problem, we can apply the general structure and save our labor and […]
CS 352 Lecture 27 – If * 3
Dear students, Let’s do another Program This: Translate the following code to ARM assembly: if n >= 0 && n <= 9 print ‘digit’ A straightforward implementation might take this approach: mov r1, #0 mov r2, #0 // Let’s assume n is in r0. cmp r0, #0 movgt r1, #1 cmp r0, #9 movlt r2, […]
CS 145 Lecture 26 – Arrays Cont’d
Dear students, Today we continue looking at the data that we collected last time: The number of children your grandparents had (i.e., the number of parents you have plus their brothers and sisters). For example, I have two parents, three uncles, and two aunts, so I’d report 7. The number of children your parents had, […]
CS 352 Lecture 26 – If++
Dear students, Let’s start with a Program This! Translate this high-level pseudocode into ARM assembly: if n == 0 print ‘R’ else if n == 1 print ‘Y’ else if n == 2 print ‘G’ A straightforward translation of this might look something like this: // Let’s assume n is in r0. cmp r0, #0 […]
CS 145 Lab 9 – Arrays
Welcome to lab 9! If you have checkpoints from the last lab to show your instructor or TA, do so immediately. No credit will be given if you have not already completed the work, nor will credit be given after the first 10 minutes of this lab. You must work with a partner that you […]
CS 491 Meeting 9
Dear students, We are in the working phase of developing our games, so most of our time will be spent giving weekly progress reports. Here are some questions we will probably ask you: What’s the riskiest part left to investigate in your endeavor? What three or more specific things will you accomplish before we meet […]
CS 145 Lecture 25 – Arrays
Dear students, Today we begin our descent into the world of collections of data. No longer will we be content with one or two numbers—we want them by the hundreds! For our first problem involving a data collection, we’ll look at testing whether or not a six-sided die (d6) is fair. We could do it […]
CS 352 Lecture 25 – Branching
Dear students, We ended our discussion of ARM assembly last time wanting to tell the user if they answered a math problem correctly or incorrectly. To support this, we needed to branch between two different sequences of code. We’ve seen unconditional branches that jump our program counter to some other labeled section, but what we […]
CS 145 Lecture 24 – Animation
Dear students, Let’s start with a Program This! Write a method times with the following behavior: times(‘!’, 3) yields “!!!” times(‘#’, 6) yields “######” times(‘-‘, 13) yields “————-” We’ll use this method to generate a random spelunking workout. After that, we’ll generate a few more images. This time we won’t use loops to march through […]