{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

SFU - CMPT 150 - Lectures - Week 11

SFU - CMPT 150 - Lectures - Week 11 - c A.H.Dixon CMPT 150...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
c A.H.Dixon CMPT 150: Week 11 (Mar 17 - 19, 2008) 94 37 ADDRESSING MODES An addressing mode is a way of interpreting the operand field of an assembly language instruction. Choosing appropriate addressing modes can improve the performance of a program (i.e., make it faster) and save memory. This is because the primary “weakness” of the von Neumann model is the time delay associated with memory accesses when retrieving and executing instructions. This weakness is called the von Neumann bottleneck . Among addressing modes the HC-12 instruction set employs are the following: 1. inherent mode : Also called implied mode in other assembly languages, this mode is used by instructions where no operands are required or where the operands are implied by the instruction itself. For example, ABA, IDIV, XGDX, and CLRA are examples of inherent mode instructions. Inherent mode is desirable as the instructions are short (1 or 2 bytes) and therefore can be retrieved in one or two iterations of the fetch phase of the fetch-execute cycle. Furthe,r no other memory accesses are required during the execute phase. This means such instructions can be performed more quickly than multi-byte instructions. 2. direct mode : In the HC-12 main memory, the first 256 bytes of memory is called direct access memory; that is, locations with an address less than 0100 (hexadecimal). When this is the case only the low order two hex-digits need to be included in the instruction since the high-order two digits are always 00 . Instructions using direct mode require two bytes of memory: one to hold the opcode, and one to hold the low-order byte of the address. Thus it takes two memory accesses to retrieve a direct mode instruction, and since the operand is an address, there will be one further memory access when the instruction is executed, in order to retrieve the value of the operand. 3. extended mode : The operand provides the address in memory where the operand will be found, when the address is greater than 00FF (hexadecimal). This mode is similar to direct mode. However extended mode instructions must hold all 4 hex digits of the address, resulting in instructions that are 3 bytes long. LDAA RESULT ; A <- M[RESULT] Remember that if the address RESULT is found in the first 256 bytes of memory then this instruction will be interpreted as direct mode; otherwise, it will be interpreted as extended mode.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
c A.H.Dixon CMPT 150: Week 11 (Mar 17 - 19, 2008) 95 4. immediate mode : when instructions use this mode, the operand’s value is provided explicitly as part of the instruction. In the HC-12 use of this mode
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}