CS 210: Assembly Language and Systems Programming (Fall 2003)
Lecture: Tuesday-Thursday 1:15pm-3:00pm (235 Harney Science Center)
Phone: (415) 422-6562
Office: 212 Harney Science Center
Office Hours: (see my homepage)
TA consulting hours: MW 2-3pm
Textbook (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 operating system
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.
Randal E. Bryant and David R. O'Hallaron,
"Computer Systems: A Programmer's Perspective"
Prentice-Hall, Inc. (2003), ISBN 0-13-034074-X
- 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.
- 0203-210-01: Course syllabus (.PDF)
- lesson1.ppt (Powerpoint Slides)
- Simple "high-level" programming example: demo1.c
- Example rewritten in assembler language: demo2.s
- lesson2.ppt (Powerpoint Slides)
- Example program squares.s for inclass exercise
- lesson3.ppt (Powerpoint Slides)
- An "interactive" application: manydots.s
(it illustrates "structured" programming)
- lesson4.ppt (Powerpoint Slides)
- Demo program: noecho.cpp
(shows how to turn off echoing of terminal input)
- lesson5.ppt (Powerpoint Slides)
- Application: password.s
to be modified for Project 2 (as repaired on 9/16/2003)
- lesson6.ppt (Powerpoint Slides)
- Demo: toupper.s
illustrating a counted loop to do array-processing of ascii codes
- lesson7.ppt (Powerpoint Slides)
- Demo: ttyinfo.cpp
shows key details about struct termios' objects under Linux
- lesson8.ppt (Powerpoint Slides)
- Demo program: nocbreak.s
illustrates reprogramming of the normal terminal behavior
- Demo program: factors.s
showing use of the Pentium's MUL and DIV instructions
- Prototype: xmas.cpp
tests algorithm to find which day-of-the-week is Christmas
- Prototype: knuth.cpp
tests algorithm to find the date of Easter in a given year
- Demo program: xmas.s
an assembly language version of the 'xmas.cpp' prototype
- Demo program: theframe.s
showing the stack-frame upon entry to function 'main()'
- Demo program: seestack.cpp
(a program that displays a 'dump' of its own stack area)
- Files: myplus.s and
(you can combine separately-assembled object-files)
- Demo: link2asm.cpp"
showing that you can do "mixed language" programming
- Demo: greeting.s
shows how direct system-calls can be made to the Linux kernel
- Conversion-routines: asc2int.s
to be used with Project 4 and later applications
- Demo program: mynumio.s
for testing the preceeding pair of conversion-routines
- Conversion-routine: gpacalc.s
(can link to symbols from both .data and .code sections)
- Demo program: testcalc.s
is used to test visibility of external variables by 'gpacalc'
- Demo routine: mul_bl.s
shows how a multiplication can be performed with software
- Test program: multest.cpp
(verifies the correctness of our software multiply routine)
- Demo routine: div_bl.s
shows how a division can be performed with software
- Test program: divtest.cpp
(verifies the correctness of our software divide routine)
- Demo routine: imul_bl.s
does a signed-integer multiplication with software
- Demo program: mywhoami.s
shows use of some string-instructions (movsb, cmpsb, scasb)
- Demo program: out2file.s
shows how to directly invoke kernel system-calls to create a file
- Test program: stkdump.s
shows the stack area (for standalone programs that omit 'main')
- Demo program: readdemo.s
shows how to read a file into a dynamically allocated buffer
<--- revised 04/14/2005
- Demo program: tryfork.s
illustrates use of the Linux 'fork' and 'waitpid' system-calls
- Work-in-progress: mytracer.cpp
(for developing our own debugging tool)
- Demo program: tryled.s
illustrating use of the x86 'in' and 'out' instructions
- Demo program: trymmap.s
illustrating use of the 'mmap' and 'munmap' system-calls
- Demo program: fact.s
shows a 'recursive' function written in assembly language
- Demo program: traverse.cpp
uses recursion to print a list of strings in reverse order
- Demo program: showpi.s
introduces use of the Pentium's floating-point instructions
- Assembler floating-point function det.s
is called from a C++ program: trydet.cpp
- Demo program: add.s
shows use of the 'aaa' instruction when adding unpacked-BCD numbers
- Demo program: showid.s
(one possible solution for Question V on the Final Exam)
- Week 1: Chapter 1 in "Computer Systems" textbook
- Week 2: First six sections in the
GNU Assembler manual
- Week 3: Chapter 2 in "Computer Systems" textbook
- Week 4: Chapter 3 in "Computer Systems" textbook
- Week 5: No new assignment (Review for Midterm Exam I)
- Week 6: Chapter 4 in "Computer Systems" textbook
- Week 7: Chapter 5 in "Computer Systems" textbook
- Week 8: Review Chapter 2 in "Computer Systems" textbook
- Week 9: Chapter 6 in "Computer Systems" textbook
- Week 10: No new assignment (Review for Midterm Exam II)
- Weeks 11-14: No new readings (Work on final project)
- Week 15: No new readings (Review for Final Examination)
- Project 1: Due Noon Tuesday, 16 September 2003.
- Project 2: Due Noon Friday, 26 September 2003.
- Midterm Exam 1: Thursday, October 2
- Project 3: Due Noon Tuesday, 14 October 2003.
- Project 4: Due Noon Friday, 24 October 2003.
- Midterm Exam 2: Thursday, November 6
- Project 5: Due Noon Tuesday, 02 December 2003.
- FINAL EXAMINATION: Friday, December 12, 3:30pm
Last updated on 04/14/2005