CS 352 Lecture 29 – Functions Cont’d
Dear students, We try as hard as we can to use registers for our calculations, but we cannot always avoid going to memory. Today we will look at how variables inside functions are allocated, accessed, and freed through a few more examples. Unlike registers and globals, stack and heap variables don’t have names. We must […]
CS 352 Homework 5 – Armoir – due before December 16
See the PDF.
CS 491 Meeting 10
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 28 – Arrays * 4
Dear students, With arrays, we are treating the computer as a factory worker, performing some automated task on every item rolling through an assembly line. It’s these mindlessly repetitive tasks that make computers so compelling. While they do the grunt work, we can move on to a more intellectually-challenging exercise, like getting the machine running […]
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 […]