ECE 362 - Microcontroller design

Module 1

Addressing modes

  1. Immediate Addressing Mode
  2. Direct Addressing Mode
  3. Register Addressing Mode
  4. Indexed Addressing Mode
    .data
    data1 10,11,22,33,44,55,66,77,88,99
    ...
    _start:
    movl $0,%edi ; direct addressing here. Index register
    movl data(,%edi,4),%eax
    ; movl addr_or_offset(%base_or_offset,%index,multiplier)
    ; index : index location
    ; multiplier : space taken by each block of memory
    ;              eg: long takes 4 blocks
    ; IF %edi was some other value, that location would be
    ;    extracted and the content be saved into eax
  5. Indirect Addressing Mode
  6. Base Pointer Addressing Mode

    pushl $7
    pushl $8
    pushl $77
    pushl %ebp ; save value of base ptr to stack, now can overwrite
    movl %esp,%ebp ; over-write base ptr with stack ptr
     
    movl 4(%ebp),%eax ; save 4+esp (77) to eax register
    movl 8(%ebp),%eax  ;
    movl 12(%ebp),%eax ; base pointer addressing

Addressing Modes (IIT-M)

Consider having an operation: ADD X,Y [opcode | source operand | destionation operand] [opcode | (mode,register) | (mode,register) ] (mode : ~16 codes) (register : ~8 registers)

We need a way to address the data points X and Y

  1. Register
  2. Direct Addressing Mode
  3. Indirect (Deffered) Addressing Mode

  4. Index Mode
  5. Index Deffered Mode
  6. Auto-(Increment|Decrement) Mode
  7. Immediate Mode
  8. Relative Addressing