CS 210: Assembly Language and Systems Programming (Spring 2008)
Mon-Wed 11:35pm-1:20pm (Room HRN-235)
Phone: (415) 422-6562
Office: 212 Harney Science Center
Office Hours: (see my homepage)
"Assembly language hides nothing, and withholds no power."
-- Jeff Duntemann, "Assembly Language Step-by-Step,"
John Wiley & Sons, Inc. (2000), p. xxiii.
Textbooks (for collateral reading):
- This course introduces students to computer programming at the
machine language level, as a means of
exploring some basic concepts
of microcomputer architecture, system software and peripheral hardware.
It is comprised of lectures, readings, discussions, demonstrations,
consultations, assigned design projects
and scheduled exams.
- The course will focus primarily on the assembly language for Intel
Pentium processors running the Linux
and will use the GNU assembler and program development tools.
Students are presumed
to have prior experience with computer programming
in at least one high-level language (such as C/C++/java),
and to be familiar
with basic operating system commands (e.g., as covered in CS 110/112).
- Class meetings will be held in the
Michael D. Kudlick computer classroom
(Room 235, Harney Science Center)
which affords convenient opportunities
for combining formal instruction with "hands-on" programming exercises.
This facility, a gift of USF alumnus
Alfred S. Chuang ('82), was opened in Fall 2002.
Kip R. Irvine,
Assembly Language Programming for Intel-Based Computers (Fifth Edition)
Prentice-Hall, Inc. (2007), ISBN 0-13-238310-1
"One of my goals is to help students approach programming problems with a
machine-level mind set... [and] give
students the first-hand experience of
writing software in an environment that teaches them how the computer
The present edition includes topics that lead naturally into subsequent
courses in computer architecture,
operating systems, and compiler writing."
-- Kip Irvine, Florida International University
Linux System Programming
O'Reilly Media, Inc. (2007), ISBN 0-596-00958-5
"The last several years have witnessed a trend in application programming
away from system-level programming
and toward very high-level development,
managed code (such as C# or Java). This development, however, does not
foretell the death of system programming.
Indeed, someone still has to
-- Robert Love, Google, Inc.
- You will know the set of fundamental operations a computer can perform.
- You will know how to build complex computations out of simple operations.
- You will be able to "see through" code written in a high-level language.
- You will gain the capability to fully utilize features in modern CPUs.
- You will lay the conceptual ground for understanding later CS courses.
- You will acquire a skill-set of practical value in professional practice.
- Utility program: ljpages.cpp
(a tool that submits your program source to a laser printer)
- Utility program: dump.cpp
(a tool that displays the contents of any file in hex and ascii)
- Utility program: fileview.cpp
(a navigation tool for viewing the contents of binary files)
- Utility program: iopl3.cpp
(a tool by Alex Fedosov that lets user programs do direct I/O)
- Week 1: Love, Chapter 1: Introduction and Essential Concepts;
and Irvine, Chapter 1: Basic Concepts
- Week 2: Love, Chapter 2: File-I/O;
and Irvine, Chapter 2: IA-32 Processor Architecture
- Week 3: Love, Chapter 3: Buffered I/O;
and Irvine, Chapter 3: Assembly Language Fundamentals
- Week 4: Love, Chapter 4: Advanced File I/O;
and Irvine, Chapter 4: Data Transfers, Addressing, and Arithmetic
- Week 5: No new assignment; review for Midterm Exam I.
- Week 6: Love, Chapter 5: Process Management;
and Irvine, Chapter 5: Procedures
- Week 7: Love, Chapter 6: Advanced Process Management;
and Irvine, Chapter 6: Conditional Processing
- Week 8: Love, Chapter 7: File and Directory Management;
and Irvine, Chapter 7: Integer Arithmetic
- Week 9: Love, Chapter 8: Memory Management;
and Irvine, Chapter 8: Advanced Procedures
- Week 10: No new assignment; review for Midterm Exam II.
- Week 11: Love, Chapter 9: Signals;
and Irvine, Chapter 9: Strings and Arrays
- Week 12: Love, Chapter 10: Time;
and Irvine, Chapter 12: High-Level Language Interface
- Week 13: Irvine, Chapter 17: Floating-Point Processing and
- Week 14: No new assignment: complete programming project
- Week 15: No new assignment: review for Final Examination
- 0203-210-01: Course syllabus (PDF)
- What Is Assembly Language? (Powerpoint Slides)
- Simple "high-level" programming example: demo1.c
- Example rewritten in assembler language: demo2.s
- Separate function (needed by 'demo2.s'): sprintf.s
- Demo program: out2file.cpp
shows how a C++ program can create a file with standard library functions
- Demo program: out2file.s
showing how the same task can be accomplished using assembly language
- Demo program: myargs.s
introduces use of a 'program-loop' to display each commamd-line argument
- Demo program: add.s
converts its command-line argument-strings into integers,
then reports their total
-- modified on 02/08/2008
- Demo program: linkdemo.s
shows how an assembly language application calls an 'external' procedure
- External routine: dumpregs.s
this file defines the procedure that gets called from our 'linkdemo' example
- Midterm exercise: square.s
showing one possible way of answering Question V on our Midterm Exam I
- Demo program: run.s
for demonstrating use of the Linux 'fork()', 'waitpid()', and 'execve()'
- Demo program: exitcode.cpp
this program allows a user to determine this program's 'exit-code' value
- Syntax demo: address.s
showing the various ways you can specify the location for a memory-operand
- Demo program: mywhoami.s
shows the use of some string-instructions (cmpsb, scasb, movsb, stosb)
- Demo programs: udpserver.cpp
for simple network programming using sockets API
- Demo program: asclient.s
reimplements in assembly language the socket-calls used in 'udpclient.cpp'
- Demo program: pingpipe.cpp
illustrates use of the 'pipe()' system-call for child-to-parent communication
- Demo program: seehosts.s
showing how programs can open, read, and display a textfile of known size
- Some test-data: easter.txt for project #3
- Demo program: asclientx.s
adds display to 'asclient.s' of its 'sock_addr' data-structure as debugging aid
- Demo program: eflags.s
shows the initial contents of the x86 EFLAGS register as a 32-bit binary integer
- Demo program: cmosdump.s
shows current values from the Real-Time Clock's 128 CMOS storage cells
- Midterm exercise: myargcat.s
showing one possible way of answering Question V on Midterm Exam II
- Demo function: gcd.s
our implementation using assembly language of the ancient Euclidean Algorithm
- Demo programs: gcdcalc.c
examples which illustrate "mixed-language" programming
- Demo program: sqroots.cpp
displays a table of square-roots for all positive integers up to one hundred
- Demo program: multable.cpp
this example of mixed-language programming prints a multiplication table
- Demo function: product.s
this function multiplies a pair of signed integers by repeatedly doing additions
- Demo function: fact.s
shows a 'recursive' function that has been written using assembly language
- Demo program: tryrecur.cpp
showing how a C++ program could call the external function in 'fact.s'
- Demo program: triangle.cpp
this is the C++ program that you will need to modify for your Project #5
- Demo routine: softmulb.s
provides an emulation in software of the CPU's 'mul %bl' instruction
- Demo program: multest.cpp
performs exhaustive testing of our 8-bit software-multiply routine
- Demo routine: softdivb.s
provides an emulation in software of the CPU's 'div %bl' instruction
- Demo program: divtest.cpp
performs exhaustive testing of our 8-bit software-divide routine
- Demo program: hyperfib.cpp
showing the output from some calls to a three-level recursive function
- Final Exam exercise: hyperfib.s
shows one way of answering Question V on our Final Examination
- Enrolled students may join the class mailing-list
- Website for textbook author Kip Irvine is
- No class meeting: Monday, February 18 (President's Day)
- project1: Due Noon Friday, 22 February 2008
- Midterm Exam 1: Monday, February 25
- project2: Due Noon Thursday, 27 March 2008
- No class meetings: March 17-21 (Spring vacation)
- Midterm Exam 2: Monday, April 7
- project3: Due Noon Thursday, 10 April 2008
- project4: Due Noon Thursday, 24 April 2008
- project5: Due Noon Thursday, 01 May 2008
- FINAL EXAMINATION: Noon, Wednesday, 14 May 2008
Last updated on 05/27/2008