250 likes | 374 Views
Handout 2 Digital System Engineering ( EE-390 ) (Ref: Text book and KFUPM Online course of EE-390) (Remember to solve all the related examples, exercises problems as given in the Syllabus). MOV Statement. Mem. contents. P.A’s. 0202. 01. 00. Addressing Modes. Accumulator.
E N D
Handout 2 Digital System Engineering (EE-390) (Ref: Text book and KFUPM Online course of EE-390) (Remember to solve all the related examples, exercises problems as given in the Syllabus)
MOV Statement Mem. contents P.A’s 0202 01 00
Addressing Modes Accumulator
A) Register Operand Addressing Mode Mem. contents P.A’s 02F2 1B D7
A) Register Operand Addressing Mode Mem. contents P.A’s 0262 1B
B) Immediate Operand Addressing Mode Mem. contents P.A’s 0403 4A 1F
B) Immediate Operand Addressing Mode Mem. contents P.A’s 0402 28 XX
Valid and Invalid Instructions MOV CL, AH VALID MOV CX, SP VALID MOV CH, DX INVALID MOV 15H, AL INVALID MOV CL, 1234H INVALID MOV IP, CX INVALID MOV CS, DS INVALID MOV CL, 234H INVALID
C) Memory Operand Addressing Mode 1) Direct Memory Addressing 2) Indirect Memory Addressing a) Register Indirect Addressing b) Based Addressing c) Indexed Addressing d) Based-Indexed Addressing
C) Memory Operand Addressing Mode PA = Segment Base Address (SBA) : Effective Address (EA) = SBA : EA EA (called Effective or Offset) is EA = Base + Index + Displacement PA = SBA : Base + Index + Displacement CS SS DS ES BX BP SI DI 8-bit displacement 16-bit displacement PA = : + +
1) Direct Addressing Mode Mem. contents P.A’s 0012 Code segment D2 3F data segment
1) Direct Addressing Mode Mem. contents P.A’s 0014 3F XX
1) Direct Addressing Mode Mem. contents P.A’s 0014 52
2) Register Indirect Addressing Mode Mem. contents P.A’s 0012 CA 5D
2) Register Indirect Addressing Mode Mem. contents P.A’s 0012 XX 5D
NOTE By default, using a direct address as [1FA4H], or a register indirect address as [SI] or [DI] assumes you are accessing the DATA SEGMENT. MOV AX, [1FA4H] MOV AX, DS:[1FA4H] To access any other segment, use the “SEGMENT OVERIDE PREFIX” as MOV AX, CS:[1FA4H] MOV SS:[DI] , AX
3) Based Addressing Mode Base Register Points to first address of data (Constant) Displacement Contains number of bytes above base register where data of interest exists (Variable) When Base Register is BX PA = DS : BX + Displacement When Base Register is BP PA = SS : BP + Displacement These are default segments and Segment-Override Prefix changes them
3) Based Addressing Mode Mem. contents P.A’s 0014 XX 5D
3) Based Addressing Mode Mem. contents P.A’s 0014 XX 5D
4) Indexed Addressing Mode Displacement Points to first address of data (Constant) Index Register Contains number of bytes above Displacement where data of interest exists (Variable) When Index Register is SI PA = DS : SI + Displacement When Base Register is DI PA = DS : DI + Displacement These are default segments and Segment-Override Prefix changes them
4) Indexed Addressing Mode Mem. contents P.A’s 0014 XX 99
4) Indexed Addressing Mode Mem. contents P.A’s 0014 10 12
5) Based-Indexed Addressing Mode Displacement Points to first address of data (Constant) Base Register Contains Matrix Column Number (Variable) Index Register Contains Matrix Row Number (Variable) Regardless of using SI or DI When Base Register is BX PA = DS : BX + (SI or DI) + Displacement When Base Register is BP PA = SS : BP + (SI or DI) + Displacement These are default segments and Segment-Override Prefix changes them
5) Based-Indexed Addressing Mode Mem. contents P.A’s 0014 XX 99
5) Based-Indexed Addressing Mode Mem. contents P.A’s 0014 77 FF