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 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 […]
CS 352 Lecture 24 – Memory and Branching
Dear students, Sometimes in the middle of a semester, we forget why we are here. Let’s step back a moment and check out what the ACM/IEEE Computer Science 2013 Curriculum has to say about computer architecture. Are we hitting upon any of the expected ideas? Let’s then write some programs that will grow our understanding […]
CS 145 Lecture 23 – Images Cont’d
Dear students, I believe the ideas of computer science are best illustrated by manipulating digital media. To me, digital media presents a perfect context: it is one you are familiar with, and it is one that has real-world relevance. I’m sorry if you were hoping to work more with text and numbers. For those of […]
CS 352 Lecture 23 – Hello ARM, For Real
Dear students, Let’s have a look at some ARM instructions. We’ll start with the simplest ones: add a, b, c // a = b + c sub a, b, c // a = b – c Identifiers a, b, and c are just placeholders, not legal operands. In their place, we can either have registers […]