05operand - Operands & Addressing Modes Dr Philip Leong...

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

View Full Document Right Arrow Icon
Computer Architecture (P. Leong) Dr Philip Leong phwl@doc.ic.ac.uk
Background image of page 1

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

View Full DocumentRight Arrow Icon
Computer Architecture (P. Leong) Addressing modes addris address field of instruction ± Immediate addris operand ± Register addris register number in CPU operand := [ addr ] ± Direct addris address in primary (main) memory operand := [ addr ] ± Indirect addris register number (or memory address) operand_address := [ addr ] operand [ operand_address ] ± Indexed addris base address, index is a register operand := [ addr + [ index ] ]
Background image of page 2
Computer Architecture (P. Leong) Instructions Two Operand Instructions Label: OPCODE Destination, Source ; Comments Single Operand Instructions Label: OPCODE Operand ; Comments Zero Operands Instructions Label: OPCODE ; Comments Label is a user-defined identifier that is defined by the address of the instruction or item of data that follows.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Computer Architecture (P. Leong) Operands (Addressing Modes) ¾ Register Operands e.g. EAX, DX, AL, SI, BP, DS ¾ Immediate Operands (Constants) e.g. 23, 67 H , 101010 xB , R , ON ¾ Memory Operands [ BaseReg + Scale * IndexReg + Displacement ] e.g. [24], [BP], [ESI+2], [BP + 8 * DI + 16] Source and Destination operands cannot both be a memory operand. Note: Some instructions use particular registers implicitly.
Background image of page 4
Computer Architecture (P. Leong) Directives ¾ Most assemblers allow “global” variables to be allocatedand defined symbolically with a data definition directive , e.g. MaxElem DW ? ; allocates a word Users DB 3 ; allocates a byte with initial value 3 Total DD ? ; allocates a doubleword Message DB “hello” ; allocates 5 bytes with text value hello Sequence DW 1, 2, 3 ; allocates 3 words with values 1, 2 and 3 List DW 50 DUP (0) ; allocates 50 words initialised to 0 ¾ Most assemblers also allow constant values to be defined symbolically: Age EQU 22 MyPointer EQU 1000
Background image of page 5

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

View Full DocumentRight Arrow Icon
Computer Architecture (P. Leong) Examples Label Instruction Comment MOV AH, CL ; AH := CL ADD AX, [BX] ; AX := AX + Memory [DS:BX] MOV AX, [BP+4] ; AX := Memory[SS:BP+4] ADD AX, ES:[BX] ; AX := AX + Memory [ES:BX] SUB EAX, 45 ; EAX := EAX - 45 MOV BYTE PTR [BX] , 45 ; Memory [DS:BX] := 45 ADD CH, [22] ; CH := CH + Memory [DS:22]
Background image of page 6
Computer Architecture (P. Leong) More Examples Label Instruction Comment CMP EAX, ECX ; Compare operands and Set ; EFLAGS register JE forlabel ; if FLAGS.ZF = 1 then ; EIP := forlabel forlabel: NEG AX ; AX := -AX CALL print ; Call procedure print RET ; Return from procedure
Background image of page 7

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

View Full DocumentRight Arrow Icon
Computer Architecture (P. Leong) Register Operand Register
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/10/2011 for the course COMPUTER E 444 taught by Professor Amigo during the Fall '10 term at Al-Quds University.

Page1 / 30

05operand - Operands & Addressing Modes Dr Philip Leong...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online