ࡱ> EGFXzayuIӘq( r?'N2( %/ 0DTimes New Roman0z[ 0DWingdingsRoman0z[ 0 DCourier Newman0z[ 01@ .  @n?" dd@  @@`` 0eQED :=>?@ABDEFGHIJK,r$yuIӘqi <AA@8duʚ;93ʚ; g4$d$d z[ 0ppp@ <4!d!dL 081<4ddddL 081%0___PPT10 ___PPT9n 8X(4u`ePNG  IHDRF} PLTEfffff3GtRNS@f cmPPJCmp0712Om&IDATc`  @gNS( IENDB`? %O =)CDAT2343<80x86  Real Memory Addressing6G& Real Memory SpaceIn Intel/Microsoft terminology,  real memory is the first 1 Megabyte of memory (memory beyond this is  protected or  extended memory and will not be discussed in this course).  Real memory requires a 20-bit address (5 hex digits)H Addresses and WordsA Intel 8086 word : 16 bits (2 bytes) Addresses are specified using word values (often contained in 16-bit/word registers) Problem: how to create a 20-bit address when only 16-bit (word) values are available.I!3Offset Addresses: Accessibility with a Word Address44(Assuming some (20-bit) base location, a 16-bit (word) address could be used to measure a distance or  offset from that base location to any location between 0 and 64K bytes beyond that base location. Example (assuming a base location of 2A340 hex) a 16-bit offset value 47E2 (hex) would provide the address for a  real memory location 2EB22 (hex).^Z^J"Segment AddresseshA  segment is the maximum amount of  real memory which can be addressed using a 16-bit offset from some  base location . The  base location for a segment is specified as a 16-bit value, called a  segment address , which is the number of pages (1 page = 10 hex / 16 dec bytes) from the beginning of memory.5Z5 &K#&Combining Segment and Offset Addresses''("A segment address can be converted from a 16-bit page number into a 20-bit  real memory (byte) value by multiplying it by 10 hex (since there are 10 hex bytes per page). Segment and Offset combinations are usually written as: segment:offset As an example 2A34:47E2, which can be converted into a  real (byte) address as 2A34 * 10 h = 2A340 plus 47E2 = 2EB22 CPNPPcObb) b  b  b M%The Segment RegistersIn the Intel 8086 : 4 Registers used for Segment Addresses CS beginning of the current code (instruction) segment area DS beginning of the main (default) data segment area ES beginning of a secondary data segment area SS beginning of an area use for the  stack (mainly used to hold function return addresses and temporary local variables)$;PPXN&The Offset RegistersIn the Intel 8086: 6 Registers use for Offsets IP instruction pointer: (with CS) offset to next instruction to be executed BX base index: (default, with DS) offset to a data value SI source index: (default, with DS) offset to a data value (often the  source of a  source-destination pair DI destination index: (default, with ES or DS depending on instruction) offset to a data value SP stack pointer: (with SS) offset to last value stored on the stack BP base pointer: (default, with SS) offset to data value in the stack to permit access/manipulation of value in the stack without  losing track of the top of the stack.$/PGPvO',Real Memory Address Calculation Examples (1)--(MOV 0Dh,[BX] ;location of memory ; specified by the value in BX By default, BX combines with DS Suppose DS = 1380 and BX=0100 (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 13800 + 0100 = 13900 (hex)JEZZZEcP(,Real Memory Address Calculation Examples (2)--(?MOV 0Dh,[ES:BX] ;location of memory ; specified by the values in ES and BX The default has been overridden so ES is used for the segment portion of the address Suppose ES = 26BE and BX=0100 (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 26BE0 + 0100 = 26CE0 (hex) ^NNc  Q),Real Memory Address Calculation Examples (3)--(vMOV 0Dh,[0200h] ;location of memory ; specified immediate offset value 0200h Since no segment override has been coded (and this is an instruction which involves data), the DS register will be used for the segment address. Suppose DS contains 278C (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 278C0 + 0200 = 27AC0 (hex) ^N Nc   R*,Real Memory Address Calculation Examples (4)--(@JMP 2AC4 ;location of memory containing ; next instruction specified as an ; immediate value The default has not been overridden and since this instruction deals with the address of another instruction (not data), the CS register will be used for the segment address. Suppose CS = 1E02 (all values in hex) Then the real memory address of the instruction being  jumped to would be: 1E020 + 2AC4 = 20AE4 (hex) hdP!PPPdc!  S+,Real Memory Address Calculation Examples (5)--(vJMP 4001:2AC4 ;location of memory containing ; next instruction specified as a pair ; of immediate value The default has been overridden with an immediate value which will be used for the segment address. Then the real memory address of the instruction being  jumped to would be: 40010 + 2AC4 = 42AD4 (hex) `ooc  T,,Real Memory Address Calculation Examples (6)--(:PUSH AX ; stores (2-byte) value in AX ; on stack The PUSH instruction automatically uses the SS:SP pair; however, the value in the SP points to the last value stored on the stack, so it must be decremented by 2 before these 2 bytes can be stored. Suppose SS = 12D3 and SP=04E6 (all values in hex) Then the real memory address when the value in AX would be stored would be 12D30 + (04E6  2) = 13214 (hex) h9ZCZ!ZZ9cC!  FP|  ` 33333u333ß̙` &L333333x&-LYMMM` ___333___` &L.i~333Ȫn̙}` 7NRLF333đwjg_MMM>?" dd@,? " Ud@ nF $ @`" d n?" dd@   @@``PR    @ ` `p>>  D@(   : fuA Large confetti"  T Click to edit Master title style! !$ ; 0x "  RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S < 6~ "``  >* = 6 "`   @* B <" * C S 4?A?Large confetti" * D 6" dR * > lA Large confetti"`8  D*<  c $޽h ? &L333333x&-LYMMM___PPT92p22 ,DAT2343 OnLine Lectureq   !  @ C @ ( h     c (?A?Large confetti"1D *"  H`BG0*" *" 9 HLG0*" *" : # lؽ?G0*?"8i *" ; # lS?G0*?"C *" = HVG0*";l * > S `Z?A?Large confetti" j  * ? f]A Large confetti"P   T Click to edit Master title style! ! @ 0_ "8 `    W#Click to edit Master subtitle style$ $ A 6|4 "``  >* B 6D "`   @* C 6 "`   @*<  c $޽h ? &L333333x&-LYMMM 0 zr` (    0к P    P*    08B     R*  d  c $ ?    0@  @  RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S  6K `P   P*    6A `   R*  H  0޽h ? ̙3380___PPT10.^`  }L(  Lx L c $ :   x L c $;` @    L 0`PG }) Alan T. Pinck / Algonquin College; 2003* 2* H L 0޽h ? &L333333x&-LYMMM80___PPT10.;`$  \$(  \r \ S :   r \ S ;  H \ 0޽h ? &L333333x&-LYMMM80___PPT10.Ę '$  `$(  `r ` S :   r ` S ;  H ` 0޽h ? &L333333x&-LYMMM80___PPT10.Ę8+6$  d$(  dr d S :   r d S l;  H d 0޽h ? &L333333x&-LYMMM80___PPT10.Ęgd$  h$(  hr h S :   r h S ;  H h 0޽h ? &L333333x&-LYMMM80___PPT10.ĘË$   l$(  lr l S :   r l S ;  H l 0޽h ? &L333333x&-LYMMM80___PPT10.ĘK$  @t$(  tr t S \ :   r t S 0 ;  H t 0޽h ? &L333333x&-LYMMM80___PPT10.Ęo>$  Px$(  xr x S <:   r x S ;  H x 0޽h ? &L333333x&-LYMMM80___PPT10.Ę F$  `|$(  |r | S x;:   r | S L<;  H | 0޽h ? &L333333x&-LYMMM80___PPT10.Ę$  p$(  r  S R :   r  S  ;   H  0޽h ? &L333333x&-LYMMM80___PPT10.jЗ؃$  $(  r  S @ :   r  S C ;   H  0޽h ? &L333333x&-LYMMM80___PPT10.j$  $(  r  S 8S :   r  S ;  H  0޽h ? &L333333x&-LYMMM80___PPT10.k)$  $(  r  S T+ :  +  r  S > ;   H  0޽h ? &L333333x&-LYMMM80___PPT10.l $  $(  r  S + :  +  r  S ( ;   H  0޽h ? &L333333x&-LYMMM80___PPT10.l'v H@X(  X X 0  @End of Lecture 2,H X 0޽h ? &L333333x&-LYMMMr`02|?%JCPF`PpT@VlXZ\M^aHctegik$n%? qTe 3( %/ 0DTimes New Roman0z[ 0DWingdingsRoman0z[ 0 DCourier Newman0z[ 01@ .  @n?     On-screen Show  Algonquin College*RA Times New Roman Wingdings Courier NewDAT2343 OnLine LectureDAT2343Real Memory SpaceAddresses and Words4Offset Addresses: Accessibility with a Word AddressSegment Addresses'Combining Segment and Offset AddressesThe Segment RegistersThe Offset Registers-Real Memory Address Calculation Examples (1)-Real Memory Address Calculation Examples (2)-Real Memory Address Calculation Examples (3)-Real Memory Address Calculation Examples (4)-Real Memory Address Calculation Examples (5)-Real Memory Address Calculation Examples (6) Slide 15  Fonts UsedDesign Template Slide Titles3,,%.`` 0eQED Root EntrydO) z PicturesCurrent User0SSummaryInformation(  !"#$%&'()*+,-./0123456789:;<=>?@A]CHI\JKLMNOPQRSTUVWYZ[y^_`abcdefghijklmnopqrstuvwxD~{|}B  !"#$%&'()*+,-./1)_Algonquin CollegeAlgonquin CollegeTimes New Roman-. &L2 h80x864&&%&&.-@Times New Roman-. &L+2 CReal Memory Addressing!2!!!C"9&$5&&!&%.-@Times New Roman-. &L2 # Al:=>?@ABDEFGHIJK,r$yuIӘqi <AA@8duʚ;93ʚ; g41d1d z[ 0pppp@ <4!d!dL 00<4ddddL 00%0___PPT10 ___PPT9n 8X(4u`ePNG  IHDRF} PLTEfffff3GtRNS@f cmPPJCmp0712Om&IDATc`  @gNS( IENDB`? %O =,*CDAT2343<80x86  Real Memory Addressing6G& Real Memory SpaceIn Intel/Microsoft terminology,  real memory is the first 1 Megabyte of memory (memory beyond this is  protected or  extended memory and will not be discussed in this course).  Real memory requires a 20-bit address (5 hex digits)H Addresses and WordsA Intel 8086 word : 16 bits (2 bytes) Addresses are specified using word values (often contained in 16-bit/word registers) Problem: how to create a 20-bit address when only 16-bit (word) values are available.I!3Offset Addresses: Accessibility with a Word Address44(Assuming some (20-bit) base location, a 16-bit (word) address could be used to measure a distance or  offset from that base location to any location between 0 and 64K bytes beyond that base location. Example (assuming a base location of 2A340 hex) a 16-bit offset value 47E2 (hex) would provide the address for a  real memory location 2EB22 (hex).^Z^J"Segment AddressesrA  segment is the maximum amount of  real memory which can be addressed using a 16-bit offset from some  base location . The  base location for a segment is specified as a 16-bit value, called a  segment address , which is the number of paragraphs (1 page = 10 hex / 16 dec bytes) from the beginning of memory.:Z:&K#&Combining Segment and Offset Addresses''(6A segment address can be converted from a 16-bit paragraph number into a 20-bit  real memory (byte) value by multiplying it by 10 hex (since there are 10 hex bytes per paragraph). Segment and Offset combinations are usually written as: segment:offset As an example 2A34:47E2, which can be converted into a  real (byte) address as 2A34 * 10 h = 2A340 plus 47E2 = 2EB22 MPNPPcObb) b  b  b M%The Segment RegistersIn the Intel 8086 : 4 Registers used for Segment Addresses CS beginning of the current code (instruction) segment area DS beginning of the main (default) data segment area ES beginning of a secondary data segment area SS beginning of an area use for the  stack (mainly used to hold function return addresses and temporary local variables)$;PPXN&The Offset RegistersIn the Intel 8086: 6 Registers use for Offsets IP instruction pointer: (with CS) offset to next instruction to be executed BX base index: (default, with DS) offset to a data value SI source index: (default, with DS) offset to a data value (often the  source of a  source-destination pair DI destination index: (default, with ES or DS depending on instruction) offset to a data value SP stack pointer: (with SS) offset to last value stored on the stack BP base pointer: (default, with SS) offset to data value in the stack to permit access/manipulation of value in the stack without  losing track of the top of the stack.$/PGPvO',Real Memory Address Calculation Examples (1)--(MOV [BX],0Dh ;location of memory ; specified by the value in BX By default, BX combines with DS Suppose DS = 1380 and BX=0100 (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 13800 + 0100 = 13900 (hex)JEZZZEcP(,Real Memory Address Calculation Examples (2)--(?MOV [ES:BX],0Dh ;location of memory ; specified by the values in ES and BX The default has been overridden so ES is used for the segment portion of the address Suppose ES = 26BE and BX=0100 (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 26BE0 + 0100 = 26CE0 (hex) ^NNc  Q),Real Memory Address Calculation Examples (3)--(vMOV [0200h],0Dh ;location of memory ; specified immediate offset value 0200h Since no segment override has been coded (and this is an instruction which involves data), the DS register will be used for the segment address. Suppose DS contains 278C (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 278C0 + 0200 = 27AC0 (hex) ^N Nc    hR*,Real Memory Address Calculation Examples (4)--(@JMP 2AC4 ;location of memory containing ; next insPowerPoint Document(*DocumentSummaryInformation8" dd@  @@`` 0eQED :=>?@ABDEFGHIJK,r$yuIӘqi <AA@8duʚ;93ʚ; g41d1d z[ 0pppp@ <4!d!dL 0T <4ddddL 0T %0___PPT10 ___PPT9n 8X(4u`ePNG  IHDRF} PLTEfffff3GtRNS@f cmPPJCmp0712Om&IDATc`  @gNS( IENDB`? %O = *CDAT2343<80x86  Real Memory Addressing6G& Real Memory SpaceIn Intel/Microsoft terminology,  real memory is the first 1 Megabyte of memory (memory beyond this is  protected or  extended memory and will not be discussed in this course).  Real memory requires a 20-bit address (5 hex digits)H Addresses and WordsA Intel 8086 word : 16 bits (2 bytes) Addresses are specified using word values (often contained in 16-bit/word registers) Problem: how to create a 20-bit address when only 16-bit (word) values are available.I!3Offset Addresses: Accessibility with a Word Address44(Assuming some (20-bit) base location, a 16-bit (word) address could be used to measure a distance or  offset from that base location to any location between 0 and 64K bytes beyond that base location. Example (assuming a base location of 2A340 hex) a 16-bit offset value 47E2 (hex) would provide the address for a  real memory location 2EB22 (hex).^Z^J"Segment AddressesrA  segment is the maximum amount of  real memory which can be addressed using a 16-bit offset from some  base location . The  base location for a segment is specified as a 16-bit value, called a  segment address , which is the number of paragraphs (1 page = 10 hex / 16 dec bytes) from the beginning of memory.:Z:&K#&Combining Segment and Offset Addresses''(6A segment address can be converted from a 16-bit paragraph number into a 20-bit  real memory (byte) value by multiplying it by 10 hex (since there are 10 hex bytes per paragraph). Segment and Offset combinations are usually written as: segment:offset As an example 2A34:47E2, which can be converted into a  real (byte) address as 2A34 * 10 h = 2A340 plus 47E2 = 2EB22 MPNPPcObb) b  b  b M%The Segment RegistersIn the Intel 8086 : 4 Registers used for Segment Addresses CS beginning of the current code (instruction) segment area DS beginning of the main (default) data segment area ES beginning of a secondary data segment area SS beginning of an area use for the  stack (mainly used to hold function return addresses and temporary local variables)$;PPXN&The Offset RegistersIn the Intel 8086: 6 Registers use for Offsets IP instruction pointer: (with CS) offset to next instruction to be executed BX base index: (default, with DS) offset to a data value SI source index: (default, with DS) offset to a data value (often the  source of a  source-destination pair DI destination index: (default, with ES or DS depending on instruction) offset to a data value SP stack pointer: (with SS) offset to last value stored on the stack BP base pointer: (default, with SS) offset to data value in the stack to permit access/manipulation of value in the stack without  losing track of the top of the stack.$/PGPvO',Real Memory Address Calculation Examples (1)--(MOV 0Dh,[BX] ;location of memory ; specified by the value in BX By default, BX combines with DS Suppose DS = 1380 and BX=0100 (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 13800 + 0100 = 13900 (hex)JEZZZEcP(,Real Memory Address Calculation Examples (2)--(?MOV 0Dh,[ES:BX] ;location of memory ; specified by the values in ES and BX The default has been overridden so ES is used for the segment portion of the address Suppose ES = 26BE and BX=0100 (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 26BE0 + 0100 = 26CE0 (hex) ^NNc  Q),Real Memory Address Calculation Examples (3)--(vMOV 0Dh,[0200h] ;location of memory ; specified immediate offset value 0200h Since no segment override has been coded (and this is an instruction which involves data), the DS register will be used for the segment address. Suppose DS contains 278C (all values in hex) Then the real memory address into which the value 0Dh is to be moved would be: 278C0 + 0200 = 27AC0 (hex) ^N Nc   R*,Real Memory Address Calculation Examples (4)--(@JMP 2AC4 ;location of memory containing ; next instruction specified as an ; immediate value The default has not been overridden and since this instruction deals with the address of another instruction (not data), the CS register will be used for the segment address. Suppose CS = 1E02 (all values in hex) Then the real memory address of the instruction being  jumped to would be: 1E020 + 2AC4 = 20AE4 (hex) hdP!PPPdc!  S+,Real Memory Address Calculation Examples (5)--(vJMP 4001:2AC4 ;location of memory containing ; next instruction specified as a pair ; of immediate value The default has been overridden with an immediate value which will be used for the segment address. Then the real memory address of the instruction being  jumped to would be: 40010 + 2AC4 = 42AD4 (hex) `ooc  T,,Real Memory Address Calculation Examples (6)--(:PUSH AX ; stores (2-byte) value in AX ; on stack The PUSH instruction automatically uses the SS:SP pair; however, the value in the SP points to the last value stored on the stack, so it must be decremented by 2 before these 2 bytes can be stored. Suppose SS = 12D3 and SP=04E6 (all values in hex) Then the real memory address when the value in AX would be stored would be 12D30 + (04E6  2) = 13214 (hex) h9ZCZ!ZZ9cC!  FP$  h$(  hr h S  :   r h S \ ;   H h 0޽h ? &L333333x&-LYMMM80___PPT10.ĘË$   l$(  lr l S ) :   r l S ) ;   H l 0޽h ? &L333333x&-LYMMM80___PPT10.ĘKr|rJ (? XrT 03( %/ 0DTimes New Roman0z[ 0DWingdingsRoman0z[ 0 DCourier Newman0z[ 01@ .  @n?" dd@  @@truction specified as an ; immediate value The default has not been overridden and since this instruction deals with the address of another instruction (not data), the CS register will be used for the segment address. Suppose CS = 1E02 (all values in hOh+'0\ px     $08DAT2343pinckaDAT2343 OnLine LectureAlgonquin Collegetu4goMicrosoft PowerPointe@1 @@0 Ę@`OGg  -  -- @ !--'333-- @ ! --'-B( MMML-& 0-- @ !V--'-- @ ! --'@Times New Roman-. 3332 DAT2343,,%."System-@Times New Roman-. &L2 h80x864&&%&&.-@Times New Roman-. &L+2 CReal Memory Addressing!2!!!C"9&$5&&!&%.-@Times New Roman-. &L2 # Alan T.  .-@Times New Roman-. &L2 Pinck4 .-@Times New Roman-. &L-2 / Algonquin College; 2003     .-՜.+,0ex) Then the real memory address of the instruction being  jumped to would be: 1E020 + 2AC4 = 20AE4 (hex) hdP!PPPdc!  S+,Real Memory Address Calculation Examples (5)--(vJMP 4001:2AC4 ;location of memory containing ; next instruction specified as a pair ; of immediate value The default has been overridden with an immediate value which will be used for the segment address. Then the real memory address of the instruction being  jumped to would be: 40010 + 2AC4 = 42AD4 (hex) `ooc  T,,Real Memory Address Calculation Examples (6)--(:PUSH AX ; stores (2-byte) value in AX ; on stack The PUSH instruction automatically uses the SS:SP pair; however, the value in the SP points to the last value stored on the stack, so it must be decremented by 2 before these 2 bytes can be stored. Suppose SS = 12D3 and SP=04E6 (all values in hex) Then the real memory address when the value in AX would be stored would be 12D30 + (04E6  2) = 13214 (hex) h9ZCZ!ZZ9cC!  FP$  `|$(  |r | S \:   r | S 0;  H | 0޽h ? &L333333x&-LYMMM80___PPT10.Ę$  p$(  r  S X:   r  S ;  H  0޽h ? &L333333x&-LYMMM80___PPT10.jЗ؃$  $(  r  S (:   r  S ;  H  0޽h ? &L333333x&-LYMMM80___PPT10.jr*O0b)? T