8086 segmentation and addressing modes
TRANSCRIPT
![Page 1: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/1.jpg)
![Page 2: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/2.jpg)
![Page 3: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/3.jpg)
![Page 4: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/4.jpg)
![Page 5: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/5.jpg)
![Page 6: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/6.jpg)
![Page 7: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/7.jpg)
![Page 8: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/8.jpg)
![Page 9: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/9.jpg)
![Page 10: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/10.jpg)
![Page 11: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/11.jpg)
![Page 12: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/12.jpg)
![Page 13: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/13.jpg)
![Page 14: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/14.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE
![Page 15: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/15.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000
![Page 16: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/16.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE
![Page 17: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/17.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
![Page 18: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/18.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER
![Page 19: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/19.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX
![Page 20: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/20.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
![Page 21: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/21.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
![Page 22: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/22.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT
![Page 23: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/23.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000]
![Page 24: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/24.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA
![Page 25: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/25.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA AL<=[2000]
![Page 26: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/26.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA AL<=[2000]
REGISTER INDIRECT
![Page 27: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/27.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA AL<=[2000]
REGISTER INDIRECT
MOV AX,[SI]
JMP [DI]
INC BYTEPTR[BP]
DEC WORDPTR[BX]
![Page 28: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/28.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA AL<=[2000]
REGISTER INDIRECT
MOV AX,[SI] DATA
JMP [DI] DATA
INC BYTEPTR[BP] STACK
DEC WORDPTR[BX] DATA
![Page 29: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/29.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA AL<=[2000]
REGISTER INDIRECT
MOV AX,[SI] DATA AL<=[SI]AH<=[SI+1]
JMP [DI] DATA
INC BYTEPTR[BP] STACK
DEC WORDPTR[BX] DATA
![Page 30: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/30.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA AL<=[2000]
REGISTER INDIRECT
MOV AX,[SI] DATA AL<=[SI]AH<=[SI+1]
JMP [DI] DATA IP <={[DI+1] [DI]}
INC BYTEPTR[BP] STACK
DEC WORDPTR[BX] DATA
![Page 31: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/31.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA AL<=[2000]
REGISTER INDIRECT
MOV AX,[SI] DATA AL<=[SI]AH<=[SI+1]
JMP [DI] DATA IP <={[DI+1] [DI]}
INC BYTEPTR[BP] STACK [BP]<=[BP]+1
DEC WORDPTR[BX] DATA
![Page 32: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/32.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
IMMEDIATE MOV AX,1000 CODE AH<=10, AL<=00
REGISTER MOV DX,CX WITHIN THE CPU
DX<=CX
DIRECT MOV AL,[2000] DATA AL<=[2000]
REGISTER INDIRECT
MOV AX,[SI] DATA AL<=[SI]AH<=[SI+1]
JMP [DI] DATA IP <={[DI+1] [DI]}
INC BYTEPTR[BP] STACK [BP]<=[BP]+1
DEC WORDPTR[BX] DATA {[BX+1][BX]}<={[BX+1][BX]} – 1
![Page 33: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/33.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
RELATIVE INDEXED(RELATIVE REGISTER INDIRECT)
MOV AX,[SI+6]
JMP [DI+6]
RELATIVE BASED(RELATIVE REGISTER INDIRECT)
MOV AX,[BP+2]
JMP [BX+2]
![Page 34: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/34.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
RELATIVE INDEXED(RELATIVE REGISTER INDIRECT)
MOV AX,[SI+6] DATA
JMP [DI+6] DATA
RELATIVE BASED(RELATIVE REGISTER INDIRECT)
MOV AX,[BP+2] STACK
JMP [BX+2] DATA
![Page 35: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/35.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
RELATIVE INDEXED(RELATIVE REGISTER INDIRECT)
MOV AX,[SI+6] DATA AL<=[SI+6], AH<=[SI+7]
JMP [DI+6] DATA
RELATIVE BASED(RELATIVE REGISTER INDIRECT)
MOV AX,[BP+2] STACK
JMP [BX+2] DATA
![Page 36: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/36.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
RELATIVE INDEXED(RELATIVE REGISTER INDIRECT)
MOV AX,[SI+6] DATA AL<=[SI+6], AH<=[SI+7]
JMP [DI+6] DATA IP <={[DI+7] [DI+6]}
RELATIVE BASED(RELATIVE REGISTER INDIRECT)
MOV AX,[BP+2] STACK
JMP [BX+2] DATA
![Page 37: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/37.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
RELATIVE INDEXED(RELATIVE REGISTER INDIRECT)
MOV AX,[SI+6] DATA AL<=[SI+6], AH<=[SI+7]
JMP [DI+6] DATA IP <={[DI+7] [DI+6]}
RELATIVE BASED(RELATIVE REGISTER INDIRECT)
MOV AX,[BP+2] STACK AL<=[BP+2], AH<=[BP+3]
JMP [BX+2] DATA
![Page 38: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/38.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
RELATIVE INDEXED(RELATIVE REGISTER INDIRECT)
MOV AX,[SI+6] DATA AL<=[SI+6], AH<=[SI+7]
JMP [DI+6] DATA IP <={[DI+7] [DI+6]}
RELATIVE BASED(RELATIVE REGISTER INDIRECT)
MOV AX,[BP+2] STACK AL<=[BP+2], AH<=[BP+3]
JMP [BX+2] DATA IP <={[BP+3] [BP+2]}
![Page 39: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/39.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED
MOV AX,[BX+SI]
JMP [BX+DI]
INC BYTEPTR[BP+SI]
DEC WORDPTR[BP+DI]
![Page 40: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/40.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED
MOV AX,[BX+SI] DATA
JMP [BX+DI] DATA
INC BYTEPTR[BP+SI] STACK
DEC WORDPTR[BP+DI]
STACK
![Page 41: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/41.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED
MOV AX,[BX+SI] DATA AL<=[BX+SI], AH<=[BX+SI+1]
JMP [BX+DI] DATA
INC BYTEPTR[BP+SI] STACK
DEC WORDPTR[BP+DI]
STACK
![Page 42: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/42.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED
MOV AX,[BX+SI] DATA AL<=[BX+SI], AH<=[BX+SI+1]
JMP [BX+DI] DATA IP <={[BX+DI+1] [BX+DI]}
INC BYTEPTR[BP+SI] STACK
DEC WORDPTR[BP+DI]
STACK
![Page 43: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/43.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED
MOV AX,[BX+SI] DATA AL<=[BX+SI], AH<=[BX+SI+1]
JMP [BX+DI] DATA IP <={[BX+DI+1] [BX+DI]}
INC BYTEPTR[BP+SI] STACK [BP+SI]<=[BP+SI]+1
DEC WORDPTR[BP+DI]
STACK
![Page 44: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/44.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED
MOV AX,[BX+SI] DATA AL<=[BX+SI], AH<=[BX+SI+1]
JMP [BX+DI] DATA IP <={[BX+DI+1] [BX+DI]}
INC BYTEPTR[BP+SI] STACK [BP+SI]<=[BP+SI]+1
DEC WORDPTR[BP+DI]
STACK {[BP+DI+1][BP+DI]} <={[BP+DI+1][BP+DI]} - 1
![Page 45: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/45.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED WITH DISPLACEMENT (RELATIVE BASED AND INDEXED]
MOV AX,[BX+SI+5]
JMP [BX+DI+5]
INC BYTEPTR[BP+SI+5]
DEC WORDPTR[BP+DI+5]
![Page 46: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/46.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED WITH DISPLACEMENT (RELATIVE BASED AND INDEXED]
MOV AX,[BX+SI+5] DATA
JMP [BX+DI+5] DATA
INC BYTEPTR[BP+SI+5]
STACK
DEC WORDPTR[BP+DI+5]
STACK
![Page 47: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/47.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED WITH DISPLACEMENT (RELATIVE BASED AND INDEXED]
MOV AX,[BX+SI+5] DATA AL<=[BX+SI+5], AH<=[BX+SI+6]
JMP [BX+DI+5] DATA
INC BYTEPTR[BP+SI+5]
STACK
DEC WORDPTR[BP+DI+5]
STACK
![Page 48: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/48.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED WITH DISPLACEMENT (RELATIVE BASED AND INDEXED]
MOV AX,[BX+SI+5] DATA AL<=[BX+SI+5], AH<=[BX+SI+6]
JMP [BX+DI+5] DATA IP <={[BX+DI+6] [BX+DI+5]}
INC BYTEPTR[BP+SI+5]
STACK
DEC WORDPTR[BP+DI+5]
STACK
![Page 49: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/49.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED WITH DISPLACEMENT (RELATIVE BASED AND INDEXED]
MOV AX,[BX+SI+5] DATA AL<=[BX+SI+5], AH<=[BX+SI+6]
JMP [BX+DI+5] DATA IP <={[BX+DI+6] [BX+DI+5]}
INC BYTEPTR[BP+SI+5]
STACK [BP+SI+5]<=[BP+SI+5]+1
DEC WORDPTR[BP+DI+5]
STACK
![Page 50: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/50.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
BASED AND INDEXED WITH DISPLACEMENT (RELATIVE BASED AND INDEXED]
MOV AX,[BX+SI+5] DATA AL<=[BX+SI+5], AH<=[BX+SI+6]
JMP [BX+DI+5] DATA IP <={[BX+DI+6] [BX+DI+5]}
INC BYTEPTR[BP+SI+5]
STACK [BP+SI+5]<=[BP+SI+5]+1
DEC WORDPTR[BP+DI+5]
STACK {[BP+DI+6][BP+DI+5]} <={[BP+DI+6][BP+DI+5]} - 1
![Page 51: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/51.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
STRING MOVSB
IMPLICIT CLD
![Page 52: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/52.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
STRING MOVSB EXTRA, DATA
IMPLICIT CLD WITHIN THE CPU
![Page 53: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/53.jpg)
Addressing mode Mnemonic Segment for memory access
Symbolic representation
STRING MOVSB EXTRA, DATA ES:[DI]<=DS:[SI]IF DF=0, INCREMENT SI AND DI BY 1IF DF =1, DECREMENT SI AND DI BY 1
IMPLICIT CLD WITHIN THE CPU
DF = 0
![Page 54: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/54.jpg)
IDENTIFY THE ADDRESSING MODE
MOV AH,47MOV AH,[BP+2]MOV AL,[BP+SI]STDMOV AH,BLMOV DX,[2002]
![Page 55: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/55.jpg)
Problem statement – clear the contents of three memory location
Memory content location62380 0062381 0062382 00
![Page 56: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/56.jpg)
8086 Sample programs MOV AX,6000H move 6000h into AX MOV ES,AX move AX contents into ES MOV DI,2380H move 2380H into DI MOV CX,0003H move 0003H into CX MOV AL,00H move 00H into ALAgain MOV [DI],AL AL => ES:[DI} INC DI Increment the contents of DI LOOP AGAIN dec CX, and if CX is NZ go to again HLT Halt
![Page 57: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/57.jpg)
8086 Sample programs MOV AX,6000H move 6000h into AX MOV ES,AX move AX contents into ES MOV DI,2380H move 2380H into DI CLD clear the direction flag MOV CX,0003H move 0003H into CX MOV AL,00H move 00H into ALREP STOSB AL => ES:[DI]and increment DI (rep this CX times) HLT Halt
![Page 58: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/58.jpg)
(CX=0003h) (AL = 00h)(DI=2380h)(ES=6000h)
• 1st time REP STOSBAL =>ES:[DI] i.e. 00=> [62380]h and DI = 2381h
CX=0002h• 2ND time REP STOSB
AL =>ES:[DI] i.e. 00=> [62381]h and DI = 2382hCX=0001h
• 3RD time REP STOSBAL =>ES:[DI] i.e. 00=> [62382]h and DI = 2383h
CX=0000h• 4TH Time will not happen cos CX = 0000h
![Page 59: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/59.jpg)
REP LOOPPREFIX INSTRUCTIONUSED ONLY BEFORE STRING INSTRUCTION
USED ANYWHERE
USED TO REPEAT ONLY THAT STRING INSTRUCTION
USED TO REPEAT SERIES OF INSTRUCTION
![Page 60: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/60.jpg)
String instructionsSTOSB AL=>ES:[DI] After string opr, if DF = 0, then DI is incremented by 1and viceversa LODSB AL<=DS:[SI]After string opr, if DF = 0, then SI is incremented by 1and viceversa MOVSB DS:[SI]=>ES:[DI]After string opr, if DF = 0, then SI and DI is incremented by 1and viceversa SCASB AL – ES:[DI]After string opr, if DF = 0, then DI is incremented by 1and viceversa CMPSB DS:[SI] – ES:[DI]After string opr, if DF = 0, then SI and DI is incremented by 1and viceversa
![Page 61: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/61.jpg)
Problem statement block transfer
Transfer contents of 52500 to 62500 and 52501 to 62501
![Page 62: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/62.jpg)
Block transferMOV AX,5000 HMOV DS,AXMOV SI,2500HMOV AX,6000HMOV DI,2500HCLDMOV CX,0002HREP MOVSB DS:[SI] =>ES:[DI] and increment DI and SI (rep this CX times)
HLT
![Page 63: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/63.jpg)
(CX=0002h) (DS=5000h)(SI=2500h)(DI=2500h)(ES=6000h)
• 1st time REP MOVSB DS:[SI] =>ES:[DI] i.e. [52500]=>[62500]
SI =2501 and DI = 2501CX=0001h
• 2ND time REP MOVSBDS:[SI] =>ES:[DI] i.e. [52501]=>[62501]
SI =2502 and DI = 2502CX=0000h
• 3rd Time will not happen cos CX = 0000h
![Page 64: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/64.jpg)
8086 sample programs
When both the numbers are positive(+03)h x (+02)h = (+06)hMOV AL,03HMOV BL,02HIMUL BLResult: (+0006)h => AX
![Page 65: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/65.jpg)
8086 sample programsWhen both the numbers are not positive(+03)h x (-02)h = (-06)h2’s complement of 02 = 1’s complement of 00000010 + 1=11111110 = FEhMOV AL,03HMOV BL,FEHIMUL BLResult: (FFFA)h => AX(FFFA)h is actually –(0006)h
![Page 66: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/66.jpg)
8086 sample programs
(+09)h / (-02)h MOV AX,0009HMOV BL,FEHIDIV BLResult: (01FC)h => AX01 =>AH is the remainderFC =>AL is the quotient (-04)h
![Page 67: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/67.jpg)
8086 sample programs
(-09)h / (+02)h MOV AX,FFF7HMOV BL,02HIDIV BLResult: (FFFC)h => AXFF =>AH is the remainder (-01)hFC =>AL is the quotient (-04)h
![Page 68: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/68.jpg)
MOV AX,5000 H MOV DS,AXMOV SI,2500HMOV AX,6000HMOV ES,AXMOV DI,2500HCLDMOV CX,0004HREPNE CMPSB DS:[SI] - ES:[DI] and increment DI and SI (REPNE) HLT
MEMORY SOURCE
CONTENT MEMORYDEST
CONTENT
52500 42 62500 98
52501 45 62501 34
52502 34 62502 34
52503 23 62503 23
![Page 69: 8086 segmentation and addressing modes](https://reader033.vdocuments.us/reader033/viewer/2022061122/5471e14bb4af9f837f8b4701/html5/thumbnails/69.jpg)
(CX=0004h) (DS=5000h)(SI=2500h)(DI=2500h)(ES=6000h)• 1st time REPNE CMPSB
DS:[SI] - ES:[DI] i.e. [52500]-[62500] i.e. 42-98(NE) SI =2501 and DI = 2501
CX=0003h(this is cos of REP prefix)• 2ND time REP CMPSB DS:[SI] - ES:[DI] i.e. [52501]-[62501] i.e. 45-34(NE) SI =2502 and DI = 2502
CX=0002h(this is cos of REP prefix)• 3rd Time REPNE CMPSBDS:[SI] - ES:[DI] i.e. [52502]-[62502] i.e. 34-34(E) SI =2503 and DI = 2503
CX=0001h(this is cos of REP prefix)• 4TH Time REPNE CMPSB will not happen cos locations are no
longer NE