A Brief Overview of Architecture and Assembly Language
Computers = The Force?
Computers are everywhere; they surround us; they are a part of everything we do. I’m not simply referring to desktops and laptops, or even tablets and cell phones. Computers are found in microwave ovens, in our cars and yes, even in our voice-recorded greeting cards! For instance, that greeting card computer may be able to record and play a message from your grandmother, but you wouldn’t expect it to be able to open a PowerPoint presentation. Why? Because it would be ridiculous to put a powerful processor in a greeting card that sells for $5. This when the worlds of hardware and software collide in Computer Science -- we must be prepared to write software for any number of different hardware platforms.
To understand how to accomplish this, we must first understand how computers, specifically processors, work. Many people may be vaguely aware that computers can only understand machine or binary language. Binary is a numerical system also called base 2 that represents all numbers as 1’s and 0’s. If a computer can only understand a numerical system, how is it able to read and write text? How can it make decisions? How can it access memory? These questions can be answered by the Instruction Set Architecture (ISA), which are instructions the processor understands in order to compute operations in a meaningful way to the user.
Mars, the main program we use to write MIPS Assembly programs.
Normally when we write programs, we use a high-level language such as C++, C# or Java. These languages are friendly to the programmer since a single line of code can accomplish several operations at once. These languages come with a compiler, to translate the source code into machine language. Assembly language is a simple, yet complex low-level programming language close to what the processor can directly understand. This low-level programming is typically avoided (like the plague) by programmers, for two main reasons. First, unlike writing in high-level languages, assembly programs can only run on its specific architecture. This means the assembly code will not work on every computer, which can be detrimental to the longevity of the program itself. Secondly, assembly language is more complex to write than the high-level equivalent. Where one line of code in a high-level language can do multiple instructions, in assembly, a single line of code can typically only perform a single operation. This obviously requires more typing and can easily lead to more mistakes by the programmer.
But Luke, Why?!
Simple, or embedded computers generally do not use high-level language programs because of the limited storage capacity and limited processing power. Instead, they operate on assembly code, bringing us back to the entire point of learning assembly language; we want to be able to write software for any number of hardware platforms, including those used by microwaves and greeting cards.
What do you find when hardware and software collide? 10 frustrated students! The complexities involved in this class can be overwhelming at times. Personally, I’ll be happy if I never write another program in assembly in my life. However, this class has been an eye-opening exercise in my understanding of what it takes for computers and applications to make our lives more interesting.