4.4 Flow of Control4 Class Schedule4.2 Numbers and Bits4.3 Introduction to Assembly Programming

4.3 Introduction to Assembly Programming

4.3.1 Reading and Web Sites

  1. Instructions add & sub Read IA-32 Volume 2a [4] and Read IA-32 Volume 2b [5]
  2. Instructions idiv & imul Read IA-32 Volume 2 [4] Please note the register restrictions.
  3. Carter Chapter 1, Introduction Section 1.3 on. pages 11-26 [1].

4.3.2 Notes

4.3.3 Lab Assignment: A little math

  1. Install nasm or access system that has nasm [6] installed.
  2. Download Dr. Carter's programs
  3. Compile/assemble his examples (make)
  4. Run some of his examples.
  5. Write Program #2.
    The last digit of your student services number will be "N" in this lab. The program needs to do the following:
    1. Print out your name and the date followed by a line with the value of N by itself.
    2. Compute the following using 32 bit two's complement arithmetic. DO NOT concern yourself with detecting overflow conditions. Please note that the program uses no flow-of-control structures. Use the following tables below to determine what your program needs to compute:
    3. Test your program. Do all of the arithmetic manually or with a high level programming language. Compare thees results to what your program produces. Turn this in. Testing is an important part of programming.
    4. Printout A, B, C, D, W, X, Y, and Z with labels.
    5. Printout W+X+Y+Z with a label.
    6. Use the debug macro dump_regs at least once in your program.
    7. Turn in your test data (and program if there is one), an error free listing of your program, and the printed output of your program.

Values
N A B C D
0 128 0x56 3 27
1 256 0x00 17 31
2 1024 0x12 23 47
3 2048 0x34 97 51
4 4096 0x77 22 71
5 8192 0xA7 153 3
6 64 0x80 9 7
7 32 0xB2 16 171
8 16 0x42 31 72
9 8 0x26 18 147

Equations
N W X Y Z
0 A+B B+C W/C W*W
1 A+C B+D X/C W*X
2 A+D B+A W/C W*Y
3 B+C A-D X/C W*W
4 B+D C+A W/C X*X
5 C+D D+A X/C X*Y
6 A+B B-D W/C X*X
7 A+C A-C X/C X*W
8 A+C D-A X/A X*Y
9 A+C B+D X/A X*C


Instructor: Louis Taber, louis.taber.at.pima at gmail dot com (520) 206-6850
My web site in California
The Pima Community College web site

4.4 Flow of Control4 Class Schedule4.2 Numbers and Bits4.3 Introduction to Assembly Programming