University of San Francisco
CS210 - Assembly Language and Systems Programming
Fall 2002
Instructor: Alex Fedosov [homepage]

NASM home page



December 9, 2002 -- Final Exam - 12:00 noon in HR 512.
Orange



December 4, 2002 -- Final Review
Final Exam: December 9, 2002 at 12:00 noon in HR 512.
More practice problems for memory/stack layout. Answers.



December 2, 2002 -- Linux device drivers
Demo 22: noise.c -- play a tone on the PC speaker from a Linux kernel modules
Demo 23: speaker.c -- PC speaker Linux device driver



November 27, 2002 -- Timer programming using PIT channel 2
Demo 19: delay50.asm -- create a 50 ms delay using PIT CHN 2
Demo 20: cpuspeed.asm -- calculate CPU frequency using PIT CHN 2
Demo 21: outdelay.asm -- measure how long it takes to execute an 'out' instruction



November 25, 2002 -- Go over midterm and finish speaker programming
Project 5 Assigned.
Due 12/6 at 5:00 pm to my office or my mailbox in HRN 545.
Data files: mary.bin and hbday.bin. Write your own!
Source files: mary.asm and hbday.asm.
Demo 18: scale.asm -- playing musical scale on PC speaker

Note: to avoid seg faults when executing I/O instructions, run 'iopl3' on the lab machines before executing your program.



November 20, 2002 -- Midterm 2



November 18, 2002 -- Midterm 2 Review
Midterm 2 Review Sheet
How Interrupts Work article



November 13, 2002 -- Timer and Speaker
Timer diagram handout
Port 61h bit definitions
Demo 17: noise.asm -- playing sound on PC speaker
Project 3 (sieve) solution: non-optimized optimized



November 11, 2002 -- Finish boot loaders
Demo 16: bootload.asm -- boot loader



November 6, 2002 -- More interrupts and boot loaders
Bootsector handout



November 4, 2002 -- Interrupts, boot process
Project 4 Assigned.
Due 11/15 at 5:00 pm to my office or my mailbox in HRN 545.



October 30, 2002 -- Recursion, string instructions
Reading: Irvine, Ch. 9, section 8.5 (but not the rest of Ch. 8)
Demo 15: nfact.asm -- factorial function using recursive calls
Sieve results:
one billion -- 50,847,534
two billion -- 98,222,287
three billion -- 144,449,537
four billion -- 189,961,812



October 28, 2002 -- Static, shared, dynamic libraries
Demo 13: timestampa.asm -- library function for reading the Pentium Timestamp Counter
timestampa.c -- C program that uses the above library
Demo 14: timestamp_dl.c -- using dl interface to dynamically load the above library



October 23, 2002 -- More C/Assembly interaction
Reading: Irvine, Ch. 7, skip 7.6, section 8.5 (but not the rest of Ch. 8)
Homework Assignment 4 (due 11/4):
pg. 235, 3-8, 11, 12
pg. 239, 3, 4
pg. 247, 8, 10, 12
Demo 11: cargs.asm -- obtaining command-line arguments C-style
Demo 12: mysum.asm sumtest.c -- calling an assembly routine from C.



October 21, 2002 -- Finish file access, whirlwind C review, calling conventions
Demo 10: helloc.asm -- input / output using C library functions



October 16, 2002 -- Go over midterm, finish file access
Demo 9: filecopy.asm -- copying a file
Project 3 Assigned.
Due 11/1 at 5:00 pm to my office or my mailbox in HRN 545.



October 14, 2002 -- Bit Manipulation Instructions, file access
Demo 8: bin2hex.asm -- tricky bin2hex conversion



October 9, 2002 -- Midterm I



October 7, 2002 -- Midterm 1 Review
Midterm 1 Review Sheet



October 2, 2002 -- More on time sys calls, command line arguments
Demo 6: time.asm -- print current time of day
Demo 7: args.asm -- accessing command-line arguments



September 30, 2002 -- Time sys calls, debugging with gdb and ald
Reading: Irvine, Ch. 6
Homework Assignment 3 (due 10/7):
pg. 188, 1-7
pg. 200, 10-13
pg. 210, 1-5



September 25, 2002 -- stack review, Makefile
Makefile example
Project 2 Assigned.
Due 10/11 at 5:00 pm to my office or my mailbox in HRN 545.



September 23, 2002 -- the stack and ASCII to binary conversion
Demo 3: asc2bin.asm -- ASCII to binary conversion subroutine
Demo 4: bin2asc.asm -- binary to ASCII conversion subroutine
Demo 5: intio.asm -- a program that uses the above two subroutines
Reading: Irvine, Ch. 5



September 18, 2002 -- binary to ASCII conversion continued
Demo 2: showdots.asm



September 15, 2002 -- More on Project 1, binary to ASCII conversion
Project 1 Update: New due date September 23 at 3:15pm.
Addendum: you must use at least two procedures in your code. Do NOT copy from the book. Do NOT use stack.
Reading: Irvine, Chapter 4. Skip 4.3.
Homework Assignment #2 (due 9/25):
pg. 40, Problems 1-6
pg. 60, Problems 1-6
pg. 80, Problems 1, 4, 5
pg. 88, Problem 12



September 11, 2002 -- System Calls, Procedures, etc.
Project 1 Assigned.
Due September 18 at 3:15pm. Addendum: you must use at least two procedures in your code.
Handouts: Demo 1 listing file and map file.



September 9, 2002 -- Basic Instructions, Data Declarations
Demo 01: hello.asm
Reading: Irvine, Chapter 3.



September 4, 2002 -- CPU internals
PC devices handout
Reading: Irvine, Chapter 2.



September 2, 2002 -- Labor Day Holiday



August 28, 2002 -- Data Representation



August 26, 2002 -- Introduction
Syllabus
Reading: Irvine, Chapter 1.
Homework Assignment #1 (due 9/4):
pg. 8, Problems 2, 7, 9, 10, 11
pg. 23, Problems 3, 5, 9, 10, 11, 13, 15, 17, 18, 20, 22, 24, 26
pg. 29, Problems 3, 4, 5, 6, 7