DOC PREVIEW
Wright CEG 320 - Assembly Language Programming Introduction and Addressing Modes

This preview shows page 1-2-3-26-27-28 out of 28 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Assembly Language ProgrammingIntro to Assembly Language: GoalsIntroduction: Basic InstructionsIntroduction: A Few Example InstructionsAssembly: Operand sizeAssembly: Common Instructions - ExamplesAssembly: Common Instructions - EXTSlide 8Register Transfer Notation: IntroductionRegister Transfer Notation: InstructionsAddressing Modes: Register DirectAddressing Modes: Register Direct ExamplesAddressing Modes: Absolute LongAddressing Modes: Absolute Long ExamplesAddressing Modes: ImmediateAddressing Modes: Immediate ExamplesAddressing Modes: Register IndirectAddressing Modes: Register Indirect ExamplesAddressing Modes: Register Indirect – Indexed BasicAddressing Modes: Indexed Basic ExamplesAddressing Modes: Indexed Basic ExampleAddressing Modes: Register Indirect – Post-incrementAddressing Modes: Post-increment ExamplesAddressing Modes: Register Indirect – Pre-decrementAddressing Modes: Pre-decrement ExamplesAddressing Modes: Post-increment/Pre-decrementAssembly Language: In-Class ExercisesIntro to Assembly Language: You Should Know…CEG 320/520: Computer Organization and Assembly Language Programming 1Assembly Language ProgrammingIntroduction and Addressing ModesCEG 320/520: Computer Organization and Assembly Language Programming 2Intro to Assembly Language: Goals•Introduction to Assembly language–Basic instructions: MOVE, ADD, EXT, etc.–Operand size (B, W, L)–Register Transfer Notation (RTN)•Addressing Modes–Register direct, immediate, absolute long, register indirect, indexed basic, autoincrement, autodecrement–When to use the various modes.•Assigned Reading–HVZ Chapter 2.4, 2.5, 2.6, 3.8, 3.9, 3.10, 3.11–Reference: HVZ Appendix CCEG 320/520: Computer Organization and Assembly Language Programming 3Introduction: Basic Instructions•Instructions begin with a mnemonic which represents the operation to be performed.–MOVE, ADD, SUB, CLR, etc.•The mnemonic is followed by a character representing the length of the data to be operated on.–Byte (B), Word (W), and Long Word (L)•In most instructions, the instruction is followed by one or more operands.–How an operand is interpreted depends on the information provided and the addressing mode used for that operand.CEG 320/520: Computer Organization and Assembly Language Programming 4Introduction: A Few Example Instructions•ADD/SUB/MUL/DIV/AND/OR source, dest–Performs operation on dest and source and stores result in dest.•NEG location–Computes 2’s complement of value in location, then stores it into location.•NOT location–Computes complement of value in location, then stores it into location.•CLR location–Sets value of byte/word/long at location to 0.•MOVE source, dest–Moves value of source to dest location.CEG 320/520: Computer Organization and Assembly Language Programming 5Assembly: Operand size•Because the 68000 is capable of performing operations on bytes, words and long words:–In 68000 assembly language, a size indicator is appended to the instruction mnemonic (W=word, B=byte, L=long word):•MOVE.W, MOVE.B, MOVE.L, ADD.W, ADD.B, and ADD.L are examples of this.•If the size indicator is omitted, a WORD operation is assumed.CEG 320/520: Computer Organization and Assembly Language Programming 6Assembly: Common Instructions - Examples•MOVE–MOVE.L D1, D2–D2 = D1–Contents of long word in D1 is copied into D2.–Destroys contents of D2!–Contents of D1 do not change!•ADD/SUB/MUL/DIV–ADD.W D1, D2–D2 = D1 + D2–Sum of words in D1 and D2 is placed into D2.–Destroys contents of D2!CEG 320/520: Computer Organization and Assembly Language Programming 7Assembly: Common Instructions - EXT•EXT.W extends a byte to a word–Bit 7 is copied into bits 8-15.•EXT.L extends a word into a long word–Bit 15 is copied into bits 16-3131 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0CEG 320/520: Computer Organization and Assembly Language Programming 8Assembly: Common Instructions - EXT•Sign extension does not change the value of positive or negative 2’s complement numbers!•0000 0011 = 3•EXT.L : 0000 0000 0000 0011 = 3•1111 1101 = 3•EXT.L : 1111 1111 1111 1101 = 3CEG 320/520: Computer Organization and Assembly Language Programming 9Register Transfer Notation: Introduction•Symbolic and precise way to describe the effect of an instruction.•Example:MOVE D3,D2The contents of register D3 are copied to register D2.A common notation to designate this is:D2  [D3]-Brackets around D3 indicate “contents of”-Left arrow indicates “receives”CEG 320/520: Computer Organization and Assembly Language Programming 10Register Transfer Notation: Instructions•DEST  Result•SUB D5, D7–can be described by:D7  [D7] - [D5]•ADD D2, $001004–Here, $001004 is a memory address. The same notation still suffices:$001004  [$001004] + [D2]CEG 320/520: Computer Organization and Assembly Language Programming 11Addressing Modes: Register DirectMOVE D2, D3 •Register Direct: directly accesses the contents of the indicated register.–RTN: •D3  [D2]–Most efficient addressing mode because it requires no memory access to fetch the operand.–Uses: loop counters, accumulators, operation results of all kinds.–The data is already in your mailbox, you just need to get it.CEG 320/520: Computer Organization and Assembly Language Programming 12Addressing Modes: Register Direct ExamplesMemo r y$002000 $1234$002002 $5678$002004 $ABCDRegistersD2 $1234 5678D3 $XXXX XXXXA0 $0000 2000MOVE.B D2, D3 RegistersD2 $1234 5678D3 $XXXX XX78A0 $0000 2000MOVE.W D2, D3 RegistersD2 $1234 5678D3 $XXXX 5678A0 $0000 2000RegistersD2 $1234 5678D3 $1234 5678A0 $0000 2000MOVE.L D2, D3 •Register Direct: directly accesses the contents of the indicated register.CEG 320/520: Computer Organization and Assembly Language Programming 13Addressing Modes: Absolute LongMOVE $001020, D2•Absolute Long: accesses the contents of the indicated memory location.–RTN: •D2  [$001020]–Motorola 68k also provides an Absolute Short addressing mode, but we will not be using it.–Uses: moving stored variables from memory into registers for processing, storing results back to memory.–You know the actual address ($001020) of the data, so you need to get it from there.CEG 320/520: Computer Organization and Assembly Language Programming 14Addressing Modes: Absolute Long ExamplesMemo r y$002000 $1234$002002 $5678$002004 $ABCDRegistersD2 $XXXX XXXXD3


View Full Document

Wright CEG 320 - Assembly Language Programming Introduction and Addressing Modes

Download Assembly Language Programming Introduction and Addressing Modes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Assembly Language Programming Introduction and Addressing Modes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Assembly Language Programming Introduction and Addressing Modes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?