Академический Документы
Профессиональный Документы
Культура Документы
Architecture
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Register Indirect Addressing
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Register Indirect Addressing: Example
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Register Indirect Addressing: Example
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Based Addressing
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Based Addressing: Example
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Based Addressing: Example
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Based Addressing Usage
I Based addressing can be used to access elements of an array
in memory
I Base register will point to start of the array. By changing
value of displacement different elements of array can be
accessed
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Indexed Addressing
I Indexed addressing is similar to based addressing with only
difference that index registers are used in place of based
registers for EA computation
I Indexed addressing can also be used to access elements of a
data array
I Displacement points to start of array
I Different alements can be accessed by incrementing index
register
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Based Index Addressing Mode
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Based Indexed Addressing: Example
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Based Indexed Addressing: Example
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Addressing Modes Review
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Addressing Modes Review
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Addressing Modes Review
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Addressing Modes Review
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Addressing Modes Review
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Addressing Modes Review
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Segment Override Prefix
Examples:
mov ES:[0123H], AL
mov CX, SS:[BX + DI + 0400H]
mov AX, CS:[SI]
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Stack Operations
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Stack Segment Organization
I Stack in 8086 grows in downward direction
I At startup, SP is initialized to FFFEH
I Address SS:FFFEH is called
bottom of the stack
I Address SS:0000H is called
End of stack
I On every push stack
automatically decrements by 2
I On every pop stack
automatically increments by 2
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Stack Addressing Mode
Examples:
PUSH AX ; Push contents of register AX on stack
; sp = sp - 2
; M[SP] = AX
POP AX ; Pop top of the stack and place contents in AX
; AX = M[SP];
; sp = sp + 2;
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Writing 8086 Assembly Programs
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Assembly Language Statements
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Labels and Comments
Labels (LABEL:)
I Lebel allow program to refer to a line of code by name
I Lebels in 8086 must start with a letter and cannot be more
than 31 characters
I Branch and jump instruction use labels to jump to specific
locations in the code
Comments(; COMMENT)
I Comments are for programmer’s reference
I comments are ignored by the assembler
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Assembler Directives
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture
Assembler Directives
Lecture 13: The Stack and 8086 Assembly Programs EE3323: Microprocessor and Computer Architecture