Microprocessor based Design for Biomedical Applications MBE 3 – MDBA I : Introduction.
MICROPROCESSOR BASED SYSTEM DESIGN
description
Transcript of 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
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.
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
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.
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.
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
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.
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.