17
MICROPROCESSOR BASED MICROPROCESSOR BASED SYSTEM DESIGN SYSTEM DESIGN BY BY PROF. DR. B. S. CHOWDHRY PROF. DR. B. S. CHOWDHRY Lecture # 11 - Lecture # 11 - 12 12

MICROPROCESSOR BASED SYSTEM DESIGN

  • Upload
    emilia

  • View
    52

  • Download
    0

Embed Size (px)

DESCRIPTION

MICROPROCESSOR BASED SYSTEM DESIGN. Lecture # 11 - 12. BY PROF. DR. B. S. CHOWDHRY. BASED ADDRESSING MODE. In this addressing mode, the PA of the operand is obtained by adding a displacement to the contents of either Base Register BX or Base Pointer BP and the current value in DS or SS resp. - PowerPoint PPT Presentation

Citation preview

Page 1: MICROPROCESSOR BASED  SYSTEM DESIGN

MICROPROCESSOR BASED MICROPROCESSOR BASED SYSTEM DESIGNSYSTEM DESIGN

BYBY

PROF. DR. B. S. PROF. DR. B. S. CHOWDHRYCHOWDHRY

Lecture # 11 - Lecture # 11 - 12 12

Page 2: MICROPROCESSOR BASED  SYSTEM DESIGN

BASED ADDRESSING MODE BASED ADDRESSING MODE In this addressing mode, the PA of the operand is In this addressing mode, the PA of the operand is

obtained by adding a displacement to the contents of obtained by adding a displacement to the contents of either Base Register BX or Base Pointer BP and the either Base Register BX or Base Pointer BP and the current value in DS or SS resp.current value in DS or SS resp.

Example:Example:MOVMOV [ BX ] + BETA, AL[ BX ] + BETA, ALOrOr MOVMOV [ BX ] + [1234], AL[ BX ] + [1234], AL

This instruction uses base register BX & direct This instruction uses base register BX & direct displacement BETA to derive to EA of the destination displacement BETA to derive to EA of the destination operand.operand.

Page 3: MICROPROCESSOR BASED  SYSTEM DESIGN
Page 4: MICROPROCESSOR BASED  SYSTEM DESIGN
Page 5: MICROPROCESSOR BASED  SYSTEM DESIGN

PA = 02000H + 1000H + 1234H

DS = 0200(0)HBX = 100 0 H

Displacement ETA= 1234 H ___________

04234 H

The contents of source operand AL are written into the storage location at 04234 H.

Note: (1) The default segment register can be changed with segment override prefix (SEG).

(2) If BP is used instead BX, the calculation of the physical address is performed using contents of SS register instead of DS

Page 6: MICROPROCESSOR BASED  SYSTEM DESIGN
Page 7: MICROPROCESSOR BASED  SYSTEM DESIGN

INDEXED ADDRESSING MODE INDEXED ADDRESSING MODE

Indexed addressing mode works Indexed addressing mode works in a similar way to the in a similar way to the Based Based Addressing ModeAddressing Mode except indexed except indexed addressing mode uses the value addressing mode uses the value of the displacement as a pointer of the displacement as a pointer to the starting point of an to the starting point of an array array of data of data in memory and the in memory and the contents of the specified index contents of the specified index register as anregister as an index index that selects that selects the specific element in the array the specific element in the array that is to be accessed.that is to be accessed.

Page 8: MICROPROCESSOR BASED  SYSTEM DESIGN
Page 9: MICROPROCESSOR BASED  SYSTEM DESIGN

ExampleMOV AL, [ SI ] + ARRAY

Notation ARRAY is the direct displacement The effective address is calculated as

EA = (SI) + ARRAYAnd physical address is obtained by combining the

contents of DS with EA.

PA = DS = 0200 (0)SI = 0200 0 H

ARRAY= 123 4 H______________

05234

PA = 05234 HThen the byte of data stored at this location, which is

BEH, is moved to AL register.

Page 10: MICROPROCESSOR BASED  SYSTEM DESIGN
Page 11: MICROPROCESSOR BASED  SYSTEM DESIGN
Page 12: MICROPROCESSOR BASED  SYSTEM DESIGN

BASED – INDEXED ADDRESSING BASED – INDEXED ADDRESSING MODEMODE

Combining the Combining the based addressing based addressing mode mode and the and the indexed indexed addressing mode addressing mode together together results in a new, more powerful results in a new, more powerful mode known as based – indexed mode known as based – indexed addressing.addressing.

It can be used to access It can be used to access elements in elements in mxn mxn array of dataarray of data

Page 13: MICROPROCESSOR BASED  SYSTEM DESIGN
Page 14: MICROPROCESSOR BASED  SYSTEM DESIGN

Notice that displacement, which is Notice that displacement, which is fixed in value locates the array in fixed in value locates the array in memory.memory.

The base register specifies The base register specifies mm element element of array and index register identifies of array and index register identifies the the nn element. element.

Any element in the array can be Any element in the array can be accessed by simply changing the accessed by simply changing the values in the base & index registers.values in the base & index registers.

Page 15: MICROPROCESSOR BASED  SYSTEM DESIGN

ExampleExample

MOVMOV AH, [ BX ] [ SI ] + BETA or MOV AH, [BX+SI) + AH, [ BX ] [ SI ] + BETA or MOV AH, [BX+SI) + BETABETA

Source operand is accessed using based-indexed Source operand is accessed using based-indexed addressing mode, Therefore the EA of the source addressing mode, Therefore the EA of the source operand will be:operand will be:

EA = (BX) + (SI) + BETAEA = (BX) + (SI) + BETA

and PA of the operand from the current DS and the and PA of the operand from the current DS and the calculated EA will be:calculated EA will be:

DS = 0200 (0)DS = 0200 (0)BX = 0100 0BX = 0100 0SI = 0200 0SI = 0200 0

Displacement Beta = 123 4Displacement Beta = 123 4________________________ 06234 H06234 H

PA =06234 HPA =06234 H

Execution of the instruction causes the value stored at Execution of the instruction causes the value stored at this location to be read into AH register.this location to be read into AH register.

Page 16: MICROPROCESSOR BASED  SYSTEM DESIGN
Page 17: MICROPROCESSOR BASED  SYSTEM DESIGN