CSE306 Processing Systems and Structures J. W. Lockwood,
Lecture 3

Todays Topics


Programming with Registers


Opcodes

Instruction components

Typical Instruction formats

No operands.
example: No Operation
NOP
: w/8-bit data.
: w/16-bit data.
: w/8-bit disp.
example: Relative jump
JE +45
: w/16-bit disp.
example: Direct Addressding
MOV AX,[1234]
: w/mode.
example: Register-to-Register operation:
MOV AL,AH
: : w/mode & disp8.
example: Base-relative indexed
MOV [BX+12],AX
: : w/mode & disp16.
example: Base-relative indexed direct
MOV [BX+1234],AX

In General


A Sampling of addressing Modes

Instruction Comment Addressing
Mode
Memory
Contents
Op Dest, Source
NOP No Operation -none- 90
MOV AX, BX Move to AX the 16-bit value in BX Register 89 D8
:
MOV AX, DI Move to AX the 16-bit value in DI Register 89 F8
:
MOV AH, AL Move to AH the 8-bit value in AL Register 88 C4
:
MOV AH, 12H Move to AH the byte value 12H Immediate B4 12
:
MOV AX, 1234H Move to AX the value 1234H Immediate B8 34 12
:
MOV AX, CONST Move to AX the constant defined as CONST Immediate B8 LSB MSB
:
MOV AX, OFFSET x Move to AX the address (offset) of variable x
MASM Notation
Immediate B8 LSB MSB
:
MOV AX, [1234H] Move to AX the value at memory location 1234H
(uses default segment, DS)
Direct A1 34 12
:
MOV AX, x Move to AX the value of M[x]
(uses default segment, DS)
MASM Notation
Direct A1 LSB MSB
:
MOV x, AX Move to M[x] the value of AX
(uses default segment, DS)
MASM Notation
Direct A3 LSB MSB
:
MOV AX, [DI] Move to AX the value at M[DI]
(uses default segment, DS)
Indexed 8B 05
:
MOV [DI], AX Move to M[DI] the value AX
(uses default segment, DS)
Indexed 89 05
:
MOV AX, [BX] Move to AX the value M[BX]
(uses default segment, DS)
Base-relative 8B 07
:
MOV [BX], AX Move to M[BX] the value AX
(uses default segment, DS)
Base-relative 89 07
:
MOV AX, [BP] Move to AX the value of M[BP]
(uses stack segment, SS)
Base-relative 8B 46
:
MOV [BP], AX Move to M[BP] the value of AX
(uses stack segment, SS)
Base-relative 89 46
:
MOV AX, [tab+BX] Move to AX the value M[tab+BX]
(uses default segment, DS)
Base-relative
Direct
8B 87 LSB MSB
: :
MOV [tab+BX], AX Move to M[tab+BX] the value AX
(uses default segment, DS)
Base-relative
Direct
89 87 LSB MSB
: :
MOV AX, [BX+DI] Move to AX the value M[BX+DI]
(uses default segment, DS)
Base-relative
Indexed
8B 01
:
MOV [BX+DI], AX Move to M[BX+DI] the value AX
(uses default segment, DS)
Base-relative
Indexed
89 01
:
MOV AX, [BX+DI+1234H] Move to AX the value pointed to by BX+DI+1234H
(uses default segment, DS)
Base-relative
Indexed Direct
8B 81 34 12
: :


Complex Addressing via the byte

Description of the Mode Byte

Register/Memory (R/M) and Mode Decoding

Register Decoding


Example Code


Copyright 1996-2004 John Lockwood