Addressing Modes

Addressing Modes

Addressing Modes the addressing mode defines how data is accessed ↑ # of addressing modes → ↑ flexibility → easier to program ↑ # of addressing modes → ↑ complex machine code each operand has an addressing mode e.g. MOVE.B Num1,D0 ideally, every addressing mode would work with every instruction ≡ orthogonal instruction set effective address ≡ <ea> ≡ EA effective address indicates how the address of the operand is calculated all addressing modes with the exception of immediate have an effective address Basic Addressing Modes 1. Immediate #<data> or Imm # (pound/hashtag) sign indicates that the item that follows is immediate data eg. #%1011, #$AF, #'The', #52*7, #NUM operand is a constant or a constant expression (evaluated at time of assembly) operand is in the instruction machine code <ea> = none operand instruction machine code Basic Addressing Modes 1. Immediate #<data> or Imm e.g. MOVE.B #25,D0 e.g. ADDI.B #1,D2 e.g. MOVE.W #num1,A0 …. num1 DC.W 255 “quick” instructions, e.g. ADDQ, SUBQ, MOVEQ, use immediate data but with restricted range Basic Addressing Modes 2. Register Direct (Register) Dn or An operand is in a general register registers Rn operand instruction machine code … <ea> = Rn e.g. MOVE.B #25,D0 e.g. ADDI.B #1,D2 Basic Addressing Modes 3. Direct (Memory Direct) (xxx).W or (xxx).L operand is a variable ± constant expression (evaluated at time of assembly) the address of the operand is part of the instruction address instruction mcode operand <ea> = address e.g. MOVE.B D0,num1 … num1 DC.B $05 memory e.g. MOVE.B 25,D0 (optional) Direct (Memory Direct) (xxx).W or Abs.W absolute short address stored as 16 bits specified as $00 0000 $0 to $7FFF 32K = 32 x 1024 $8000 to $FFFF $00 7FFF final address is sign extension of 16 bit address (xxx).L or Abs.L absolute long $FF 8000 address stored as 32 32K bits $FF FFFF difference in machine code as absolute short generates memory extremes have special uses more compact machine (system area, I/O interfaces, ROM) code e.g. shift a 16 bit variable left one bit; in place eg. Divide an 8-bit variable into two 4-bit nibbles. Store the top nibble of the original into the low nibble of the top byte of the result and store the low nibble of the original into the low nibble of the low byte of the result. “unpack” the number For example, if byte =$5F, the resulting word would be $050F. Reading/Expectations Reading: Endianness White Paper read pages 1-8 [pdf, 22p, Intel, November 15, 2004] Orthogonal instruction set [Wikipedia®] Expectations: you are able to write simple programs using the three addressing modes you can determine the addressing modes for any instruction (currently limited to the 3 addressing modes that you know) you can explain the concept of effective address and provide it for these and all future addressing modes .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us