Appendix C - Assembly Language Programming

iSearchNotes is a FREE service that allows College Students to
Search and Share Class Notes.

Vote Up
4
Vote Down
By: JohnHobbsIII 93
November 6, 2008 | Computer Science - Larry N. Young
Save Notes for Word
.doc
1226
views

The 8088 Processor

  1. Within every Pentium there resides an 8088
  2. Not used much, but provides a simpler way to learn assembler
  3. Assembler Programs use a '.s' extension

Processor Cycle

  1. Fetch the instruction from memory from the code segment using PC
  2. Increment the program counter
  3. Decode the fetched instruction
  4. Fetch the necessary data from memory and/or registers
  5. Perform the instruction
  6. Store the results of the instruction in memory and/or registers
  7. Go back to first step

The 8088 Registers - pictures on page 706

8088 General Registers

  1. AX - accumulator register. Collects results of computations and the target of many instructions. AC is the implied destination for many instructions
  2. BX - base register. Can be used as AX, but can also be used as a pointer to memory
    1. Move AX, BX !copy the contents BX to AX
    2. Move AX, (BX) !copy the contents of the address BX points to to AX
      1. Used in array processing
  3. CX - counter register. May be used for multiple tasks, but normally used for loop counters. The loop terminates when CX reaches zero
  4. DX - data register, For double word (32 bit) instructions DX contains high-order bits and AX low-order bits. Otherwise, use as needed
  5. All general registers can be used as either 16-bit registers or 8-bit registers.
    1. AX contains AL and AH

8088 Pointer Registers - This group contains pointer and index registers

  1. SP - stack pointer. Pointer to top of the stack (stack frame)
    1. As you PUSH and POP information on and off the stack this register tracks the top of the stack
  2. BP - Base pointer. May point anywhere in the stack, but normally points at the beginning of the current stack frame that contains the local variables
  3. SI - source index, Pointer used for sources in register indirect addressing and register displacement addressing
  4. DI - destination index. Pointer used for destinations in register indirect...

8088 Flag Register - Also known as the condition code register. A series of single-bit registers as follows:

  1. Z - result is zero
  2. S - result is negative
  3. V - result generated an overflow
  4. C - result generated a carry
  5. A - auxiliary carry (not gonna worry about)
  6. P - parity of the result (not gonna worry about)
  7. I - enable interrupts (not gonna worry about)
  8. T - use tracing mode (not gonna worry about)
  9. D - the direction of string operations (positive and negative direction depends on this bit)

8088 Segment Registers

  1. The original 8086 had only 16 bits (64-kilobytes)
    1. How then to address 1MB that requires 20 address lines?
    2. Segment registers that hold 4-bits were the answer
  2. With the 8088 this was expanded to 20 bits and the segment registers were born
  3. The segment registers all are 4-bit registers that contain the current segment being utilized
    1. CD - code segment
    2. DS - data segment
    3. SS - stack segment
    4. ES - extra segment

Addressing

  1. Instructions need data
  2. Most 8088 instructions have two operands.

For example:

 * MOVE AX, BX        !moves the contents of the BX to AX
 * ADD CX, 20         !Add 20 to CX
  1. For some instructions, only one operand is given and the destination can only be the AX

Addressing - picture page 713

The 8088 Instruction Set - picture page 717

Conditional Jumps - picture page 721

Subroutine Calls - picture page 722

If increasing stack then decrease SP because stack is upside down...

Access Levels for Input-Output Operations

  1. Applications Program. Calls the operating system after loading proper parameters
  2. Operating System (OS) Function. The OS is responsible for the generic I/O
  3. BIOS Function. BIOS interfaces the OS to the hardware
  4. Hardware. Actually preforms the I/O
  5. An assembly language program can write directly to any of these levels

System Calls and System Subroutines - picture on page 723

  1. as88 uses a standard calling sequence for system calls
    1. Push the arguments on the stack in reverse order
    2. Push the call number
    3. Execute the SYS command
  2. Return values are put in either AX or AX : DX combination
  3. Arguments are left on the stack after the SYS call. Programmer must adjust the stack pointer to remove the arguments
  4. Examples on picture

The ACK-Based Assembler - picture on page 729

Tracer Commands - picture on page 734

Hello Word Example on page 737

Start on page 735, make sure tracer is installed on your computer. Then go through Hello World extensively.

Enjoyed These Notes?
Your support will help spread the extreme awesomeness that is iSearchNotes!

0 Comments

You must login to comment.
iSearchNotes.com on Facebook

Login - Register