You are on page 1of 2

A detail view of addressing modes Implied Addressing: The addressing mode of certain instructions is implied by the instructions function.

For example, the STC (set carry flag) instruction deals only with the carry flag, the !! (decimal ad"ust accumulator) instruction deals with the accumulator. Register Addressing: #uite a large set of instructions call for register addressing. $ith these instructions, you must specify one of the registers ! through %, & or ' as well as the operation code. $ith these instructions, the accumulator is implied as a second operand. For example, the instruction C() % may be interpreted as *compare the contents of the % register with the contents of the accumulator. (ost of the instructions that use register addressing deal with +,bit -alues. &owe-er, a few of these instructions deal with ./,bit register pairs. For example, the )C&' instruction exchanges the contents of the program counter with the contents of the & and ' registers. Immediate Addressing: 0nstructions that use immediate addressing ha-e data assembled as a part of the instruction itself. For example, the instruction C)0 *C* may be interpreted as 1compare the contents of the accumulator with the letter C. $hen assembled, this instruction has the hexadecimal -alue F%23. &exadecimal 23 is the internal representation for the letter C. $hen this instruction is executed, the processor fetches the first instruction byte and determines that it must fetch one more byte. The processor fetches the next byte into one of its internal registers and then performs the compare operation. 4otice that the names of the immediate instructions indicate that they use immediate data. Thus, the name of an add instruction is ! 5 the name of an add immediate instruction is ! 0. !ll but two of the immediate instructions uses the accumulator as an implied operand, as in the C)0 instruction shown pre-iously. The (60 (mo-e immediate) instruction can mo-e its immediate data to any of the wor7ing registers including the accumulator or to memory. Thus, the instruction (60 , 8FF& mo-es the hexadecimal -alue FF to the register. The '90 instruction (load register pair immediate) is e-en more unusual in that its immediate data is a ./,bit -alue. This instruction is commonly used to load addresses into a register pair. !s mentioned pre-iously, your program must initiali:e the stac7 pointer5 '90 is the instruction most commonly used for this purpose. For example, the instruction '90 S),38FF& loads the stac7 pointer with the hexadecimal -alue 3;FF.

Direct Addressing: <ump instructions include a ./,bit address as part of the instruction. For example, the instruction <() .;;;& causes a "ump to the hexadecimal address .;;; by replacing the current contents of the program counter with the new -alue .;;;&. 0nstructions that include a direct address re=uire three bytes of storage> one for the instruction code, and two for the ./,bit address Register Indirect Addressing: ?egister indirect instructions reference memory -ia a register pair. Thus, the instruction (86 (,C mo-es the contents of the C register into the memory address stored in the & and ' register pair. The instruction ' !9 @ loads the accumulator with the byte of data specified by the address in the @ and C register pair. Combined Addressing Modes: Some instructions use a combination of addressing modes. ! C!'' instruction, for example, combines direct addressing and register indirect addressing. The direct address in a C!'' instruction specifies the address of the desired subroutine5 the register indirect address is the stac7 pointer. The C!'' instruction pushes the current contents of the program counter into the memory location specified by the stac7 pointer.

You might also like