ICS 312

INSTRUCTOR
David Pager
Post 314C
pagerd001@hawaii.rr.com
Office hrs: Tu & Th  3-4 pm

TA
Todd Baumeister
Post 314-14
baumeist@hawaii.edu
http://www.tbaumeist.com
Office hrs. 1-3 pm Tu & Th, 11am -2.30pm Fri

Catalog Description
ICS 312 Machine-Level and Systems Programming (3).  Machine organization, machine instructions, addressing modes, assembler language, subroutine linkage, linking to higher-level languages, interface to operating systems, introduction to assemblers, loaders, and compilers.

Course Objectives
To develop:
   proficiency with programming in assembly language.
   familiarization with integrated program editing/debugging environment.
   familiarization with the architecture of microcomputers.
   familiarization with compilers and their construction

Textbook: " Assembly Language Programming for the IBM PC Family" by William B. Jones
Optional reference book: "Compilers" by Aho et al. (only a small portion of the book is relevant)

Grading

 

NOTE: for all homework on the computer, you should, supply a listing of the program, plus a listing of some trial data, and the result of running the program on the trial data (see description of how to capture screen contents). Then send all this by email. .

Instructions on downloading Masm 6.15, the assembler translator.

Comments on Dos emulators for Vista

To download a set of slides, right click on it, select "Save target as ..", and set "Save as type" to "All files"

Set 1 Number systems. Notes
Hmw 1:  
Read Chap. 1.
             Exs 1.3 due 8/26/10

How to determine the value of a positive or negative binary or hex number

Quiz 1. A quiz on number systems 8/26/10

Set 2 Microcomputer systems. Notes   
Read Chap. 2   Hmw 2: Ex. 2.2  Due 8/31/10

Set 3 Pentium registers. Notes

Set 4 Program structure. Notes
Quiz 2 (based on Set 4): Reproduce slide 2   8/31/10
Hmw 3:  First Program on the computer (as described in the 4th last slide of Set 4).  Due 9/7/10

Debugging notes  Also see the textbook: Debug Workshop p.135 and Debugger Summary p.715

Quiz 3. Based on slides 8 and 10 of Set4.  9/2/10

Set 5 Mov & arithmetic instructions. Notes
Read Sec. 4.1
Hmw 4:  Ex. 4.1.  Due 9/2/10

Set 6 Types of operands. Notes
Read Secs. 10.1 & 10.2
Hmw 5:  Ex 10.1, p. 252, no. 1 and Ex 10.2, p270, 1st 3 questions of no. 1.   Due 9/7/10

Set 7 Flags.  Notes
Read Sec. 5.1

Set 8 Flow control instructions. Notes  Read Sec. 5.1, 5.3
Hmw 6: Ex 5.1, p. 109, nos. 1a,b,c; 2; 3a,b;  4a,b.  Ex 5.3, p. 115, no. 1.   Due 9/7/10  (also Hmw 5).

Set 9. Logic & shift instructions. Notes    
Hmw 7:
Exercises 9.2, nos. 1 & 2 on p. 233-234.  Omit questions invoving ROL, ROR.  Due 9/9/10
 Read Secs. 9.1-9.3

Hmw 8 deleted.

Set 10. Multiplication & Division instructions. Notes plus note on 0Ah function  
Hmw 9.
On 0Ah function      Read Sec. 4.2.  Due 9/14/10

Set 11. Subroutines. Notes  Using Util.lib  Example using subroutines in Util.lib   Read Sec. 3.1
               Hmw 10 : Calling a subroutine to evaluate X-Y+Z as described in the last slides.   Due 9/16/10

Set 12. Passing arguments via the stack    Hmw 11: on calling subroutines using the stack.  Also Read Sec. 6.2 - 6.4.  Due 9/21/10

Quiz 4. Reproduce exactly slides 7 and slides 15 & 16 of Set 12. (The headings of slides 7 and 15 are in red).  
Optional HmwFor the two numbers a, b specified in class, evaluate x, y, d such that xa + yb = d and d is the GCD of a, b.

EXTRA CREDIT (adds 2% to overal score used for grades):  produce a progam to evaluate the function E(x,y) described
in the Set 12 slides.  Include a run evaluating E(125,75) plus two others runs.  Due date - the midterm

Set 13. String processing instructions      Hmw 12:    Read Chap. 17.   Due 9/28/10

Set 14. Macros. Notes   Link to useful macros to be downloaded into your "programs" directory   Example using macros    
Hmw 13:
e
 Read Sec. 8.1.  Due 9/30/10

Debugging notes  Also see the textbook: Debug Workshop p.135 and Debugger Summary p.715

Set 15. File operations. Notes       Hmw 14:   Read Secs. 18.1 - 18.2  Due 10/5/10

Set 16. Floating Point Arithmetic.   Hmw 15:     Read Secs. 19.1 - 19.5.  Due 10/7/10

Set 17. Video text. Notes     Hmw 16  Due 10/12/10
Examples: Displaying 6 red asterisks at col 40, row 10
    (a) writing directly into video memory    (b) using video function 9

Set 18. Video graphics Notes
Drawing horizontal, vertical and diagonal lines.      
Drawing other lines
Drawing circles, elipses, and segments
Note: the subroutines referred in the above two links make use of the instructions "pushad" and "popad",
which respectively push or pop (in reverse order) all the 32 bit registers onto or from the stack.
Hmw 17.  Produce a listing of the macros specified in the link above on Drawing horizontal, vertical and diagonal lines.  Due 10/14/10

Quiz 5. Draw a given simple shape using video text (somewhat similar to Hmw 16). 10/12/10

Project 1:  The House   due 10/19/10
Test if your computer is capable of displaying graphics as required by the project by downloading
and executing the illustration given above of how to draw a segment.

Bresenham's Algorithm for 1% extra credit

Set 19.  Programming the mouse
Drawing lines according to the mouse position
delay.asm: A procedure for creating a delay
.     delline.asm: An example using the delay procedure

Project 2:  The Airplane Project   Due 11/9/10

Arcade Game for 10% extra credit  
(i.e up to 10% will be added to your overall percentage. This can amount to an increase of a whole grade point)

MIDTERM   Oct. 21
Some advice on studying for the midterm

Set 20 . Interrrupts   Read Secs. 15.1 - 15.4
                                                           
Set 21. Operating system use of Assembler programming
Example: producing the sound waves for a tune   

Project (minor) 3:  playing a tune using sound.asm . Due 11/16/10

Set 22. A simple tutorial on programming for Windows.   If you are interested, you can download Masm32 from http://www.masm32.com

Creating windows in Windows.

Key to the midterm questions

Using a DOS version of Unix (called Cygwin) on a PC (includes versions of Lex & Yacc, plus gcc)

Set 23. Introduction to Compilers. Notes.  Read Chapter 1 of textbook on Compilers

Set 24. Parsers. Notes  
Hmw 18:  using the parsing machine.    Read textbook sections 2.1,2.2.  Due 11/11/09                                                                                                                                          
Set 25. Introduction to Lex & Yacc. Notes.
Hmw 19: counting vowal-consonant pairs  Due 11/16/09
Read textbook sections 3.1, 3.3
.

Set 26. Using Lex & Yacc together.   Skeleton of Lex and Yacc as used together   
Homework 20: interpreter for floating point arithmetic
 Due 11/18/09
Note: the illustrations above are for Unix.  For an illustration of the Cygwin use of Flex and Bison,
see the last part of the Sample compiler description below.

Sample compiler1

Sample compiler2 

Project 4:  The Compiler Project.  Due 12/3/10

Set 27. symbol tables and code generation for executables

Set 28. Finite Automata
Notes: 
      Deterministic Finite Automata  Homework on DFA  Due 12/7/10
  
  Nondeterministic FA 
     Converting DFA to FA

Set 29. How Lex is constructed from Finite Automata   Notes
Exercise on constructing a NFA   Homework on NFA
  Due 12/9/10
Exercise on minimising a DFA     Homework on minimalizing DFA   Due 12/9/10

 
.