MACHINE-LEVEL
COMPUTER PROGRAMMING
SE 3F03 (Winter 2010)
* * * This outline is distributed at the
time of the first class and is constantly updated. Students should
consult this page regularly for all information relevant to this course
* * *
Instructor
Dr. George Karakostas
Office: ITB/218, Ext: 26132, Mac address: karakos
Office hours: Tue 17:30 - 19:30
Course Assistance
- He Yu, Office: ITB/208, Mac address:
yuh9, Office hours: Fri 15:30-17:30
Schedule
Term 2, 2009/10
M, W, Th : 13:30 - 14:20, BSB/B135
Tutorials: Th : 10:30-11:20, MDCL/1110 (Tutorials
will
be
announced in class ahead of time.)
Tutorials
Tutorials
will
be
announced in class ahead of time.
The lecture time for Mon. 22/2
will be tutorial time, and the tutorial time for Thur. 25/2 will be
lecture time. Wed, and Thur afternoon lectures are not affected (will
be done as scheduled).
Course Objectives - Outline of Topics
In this course, we will study programming at the
assembly level and its relationship to programming in higher level
languages. The assembly language used for the demonstration of concepts
will be that of Intel 80x86 processors. The list of topics covered (in
a chronological order) will be: Introduction - Basic Assembly Language
(manipulation of integers, basic control structures) - Bit Operations -
Subprograms - Arrays - Floating Point - Structures and C++.
Prerequisites
One of ENG PHYS 2E04, SFWR ENG 2DA3 or 2DA4
Antirequisites
COMP ENG 3DJ4, COMP SCI 2MF3
Student Assessment (Grading)
- Homework assignments 10%
- Midterm
exam
35% Midterm
exam: Tue, Feb. 23, 17:30 - 19:20. Place: T28. Exam content: The
material covered by pages 1-76 of the textbook. Open book exam, you can
also bring your own notes, a McMaster-approved calculator, but not any
other electronic devices.
- Final
exam
55% Final
exam: Tue., Apr. 13, 19:00 - 21:00. Place:
IWC 1. Exam content: The material covered by the whole textbook
(pages 1-185). Open book exam, you can also bring your own notes, a McMaster-approved calculator, but
not any
other electronic devices. VERY IMPORTANT: THIS EXAM IS USING
SCAN SHEETS, SO DON'T FORGET TO BRING YOUR OWN MEDIUM-SOFT (HB) PENCIL;
THE OFFICE OF THE REGISTRAR WILL NOT PROVIDE THEM. BE VERY CAREFUL ON
FILLING YOUR ANSWER SHEETS, YOU'LL HAVE ENOUGH TIME TO DOUBLE-CHECK
THAT YOU DIDN'T MAKE A MISTAKE OR FORGOT SOMETHING.
Policy on homework assignments: The students
will be distributed in groups of 5-6 students by the instructor (please
see the instructor immediately if
you find yourself without a group; the student lists usually are not
complete until later in the term). Collaboration
on the homework assignments is highly encouraged, within reasonable
limits. Students are expected to discuss assignment problems with each
other, and to cooperate on solutions in their group. Each group should
submit one copy of the assignment by e-mail to the TA of the course
(usually this will be a zipped directory with the assembly files + C
driver program(s) + Makefile). Grading will be based solely on the
correctness of the program and it will be binary in nature: if the
program(s) don't compile, or they produce wrong results the grade will
be 0 points; otherwise, it will be 10 points. Hint: Do not wait for the last
hour to write up an assembly program, and send it without testing it
thoroughly; most likely it will score a 0.
Policy on delayed assignments: Assignments
delivered between their deadline and 24 hours after it will get 50% of
total credit. After that, no credit will be given.
Policy on collaboration during exams: ABSOLUTELY NO COLLABORATION DURING EXAMS!!!
Resources
Textbook: "PC Assembly Language", by Paul
A. Carter, 2006
Resources:
- Dr.
Carter's website contains not only his course notes (in the
"Tutorial" section"), but example code as well in different platforms
in the "Examples" section.
- The assembler used is the NASM assembler
(installed on the department's machines; you can find it here).
- Here is an
easy converter between hexadecimal and binary.
- Memory
address calculation in protected mode.
- ....
Academic Dishonesty
"Academic dishonesty consists of misrepresentation by
deception or by other
fraudulent means and can result in serious consequences, e.g. the grade
of
zero on an assignment, loss of credit with a notation on the transcript
(notation reads: "Grade of F assigned for academic dishonesty"),
and/or
suspension or expulsion from the university.
It is your responsibility to understand what constitutes academic
dishonesty. For information on the various kinds of academic
dishonesty
please refer to the Academic Integrity Policy, specifically Appendix 3,
located at http://www.mcmaster.ca/senate/academic/ac_integrity.htm
The following illustrates only three forms of academic dishonesty:
1. Plagiarism, e.g. the submission of work that is
not one's own or
for which other credit has been obtained. (e.g. submitting a copy
of someone else's writeup for an assignment)
2. Improper collaboration in group work. (e.g.
collaboration between groups in an assignment)
3. Copying or using unauthorized aids in tests and
examinations."
Faculty/University Notices
"The Faculty of Engineering is concerned with
ensuring an environment that is free of all discrimination. If
there is a problem, individuals are reminded that they should contact
the Department Chair,
the Sexual Harrassment Officer or the Human Rights Consultant, as the
problem occurs."
"The instructor and university reserve
the right to modify elements of the course during the term. The
university may change the dates and deadlines for any or all courses in
extreme circumstances. If either type of modification becomes
necessary, reasonable notice and communication with the students will
be given with explanation and the opportunity to comment on changes. It
is the responsibility of the student to check their McMaster email and
course websites weekly during the term and to note any changes."
Assignments
* Note
that the nasm assembler is
installed in "moore". This is a 64-bit machine, but we are programming
in the 32-bit mode. This means that you should compile+link in a 32-bit
mode, using the "-f elf" and "-m32" options for nasm and gcc
respectively, i.e. "nasm -f elf ..." and "gcc -m32 ...."
Assignment
1 (Due by Fr. 22/1, 7:00 PM): The assignment is here.
Submit one zip file for each team as an attachment in an e-mail to the
TA (contact info above), indicating your team number in the body of the
e-mail. Your programs will be tested on "moore", so make sure that even
if you run &&/|| compile them on your machine or elsewhere, you
have migrated them successfully to "moore". NOTE: Here
is a small tutorial on Makefile.
Assignment 2 (Due by
W. 3/2, 7:00 PM): The assignment is here.
Submission instructions are as above.
Assignment 3 (Due by
Fr. 5/3, 7:00 PM): (Notice the deadline extension) The
assignment is here.
Submission instructions are as above (i.e., one zip file with
everything in it). Don't forget to specify your team # in your e-mail.
Assignment 4 (Due by
Fr. 26/3, 7:00 PM): Modify the textbook example in Chapter 7
that implements the big_int class
to handle integers of different sizes. A few helpful
pointers: (a) A nice C++ tutorial that explains the
different features of this language used in the examples is here.
(b) In your implementation there is no reason to have the
Size_mismatch exception thrown. Therefore your assembly should not
catch this one. Note the way C++ catches exceptions in Fig. 7.18 of the
text, and look at the relevant entry in the
tutorial.
Assignment
5 (Due by Th. 8/4, 7:00 PM): The assignment is here.
Clarification: In
the last sentence of the assignment, the case referred to is the case
of the square root being an imaginary number (i.e., the quantity under
the root is negative). In that case, there are three real roots (see
the "Casus irreducibilis" case in the Wikipedia article, D is the quantity under the square
root), but you are OK if you output the wrong answer the assignment
asks you for ("No real solution").
The teams are here.
Team grades so far are here.
To read files in pdf format, you'll
need the Adobe Reader, which
is here.
Slides/Examples
The slides, figures, and examples used in lectures
are usually from the textbook.